@opentiny/next-sdk 0.1.15-beta.1 → 0.1.15

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.
Files changed (40) hide show
  1. package/agent/AgentModelProvider.ts +1 -490
  2. package/agent/type.ts +2 -8
  3. package/dist/WebMcpClient.d.ts +26 -165
  4. package/dist/WebMcpServer.d.ts +147 -36
  5. package/dist/agent/AgentModelProvider.d.ts +1 -35
  6. package/dist/agent/type.d.ts +2 -8
  7. package/dist/index.es.dev.js +11175 -14893
  8. package/dist/index.es.js +18206 -20985
  9. package/dist/index.js +320 -2411
  10. package/dist/index.umd.dev.js +11200 -14918
  11. package/dist/index.umd.js +71 -111
  12. package/dist/{mcpsdk@1.24.3.dev.js → mcpsdk@1.23.0.dev.js} +6652 -8271
  13. package/dist/{mcpsdk@1.24.3.es.dev.js → mcpsdk@1.23.0.es.dev.js} +6641 -8260
  14. package/dist/mcpsdk@1.23.0.es.js +15584 -0
  15. package/dist/mcpsdk@1.23.0.js +43 -0
  16. package/dist/transport/ExtensionPageServerTransport.d.ts +2 -1
  17. package/dist/webagent.dev.js +19914 -23355
  18. package/dist/webagent.es.dev.js +19889 -23330
  19. package/dist/webagent.es.js +15583 -18140
  20. package/dist/webagent.js +65 -105
  21. package/dist/webmcp-full.dev.js +7263 -8880
  22. package/dist/webmcp-full.es.dev.js +7261 -8878
  23. package/dist/webmcp-full.es.js +9267 -10421
  24. package/dist/webmcp-full.js +32 -32
  25. package/dist/webmcp.dev.js +22 -14
  26. package/dist/webmcp.es.dev.js +20 -12
  27. package/dist/webmcp.es.js +179 -172
  28. package/dist/webmcp.js +1 -1
  29. package/dist/zod@3.25.76.dev.js +32 -30
  30. package/dist/zod@3.25.76.es.dev.js +30 -28
  31. package/dist/zod@3.25.76.es.js +145 -143
  32. package/dist/zod@3.25.76.js +1 -1
  33. package/package.json +8 -9
  34. package/transport/ExtensionPageServerTransport.ts +4 -2
  35. package/agent/utils/generateReActPrompt.ts +0 -55
  36. package/agent/utils/parseReActAction.ts +0 -34
  37. package/dist/agent/utils/generateReActPrompt.d.ts +0 -9
  38. package/dist/agent/utils/parseReActAction.d.ts +0 -14
  39. package/dist/mcpsdk@1.24.3.es.js +0 -16781
  40. package/dist/mcpsdk@1.24.3.js +0 -43
@@ -68,13 +68,7 @@ export declare class WebMcpClient {
68
68
  * Sends a ping to the server to check if it is still connected.
69
69
  */
70
70
  ping(options?: RequestOptions): Promise<{
71
- _meta?: {
72
- [x: string]: unknown;
73
- "io.modelcontextprotocol/related-task"?: {
74
- [x: string]: unknown;
75
- taskId: string;
76
- } | undefined;
77
- } | undefined;
71
+ _meta?: Record<string, unknown> | undefined;
78
72
  }>;
79
73
  /**
80
74
  * Sends a completion request to the server.
@@ -87,25 +81,13 @@ export declare class WebMcpClient {
87
81
  total?: number | undefined;
88
82
  hasMore?: boolean | undefined;
89
83
  };
90
- _meta?: {
91
- [x: string]: unknown;
92
- "io.modelcontextprotocol/related-task"?: {
93
- [x: string]: unknown;
94
- taskId: string;
95
- } | undefined;
96
- } | undefined;
84
+ _meta?: Record<string, unknown> | undefined;
97
85
  }>;
98
86
  /**
99
87
  * Sends a request for setting the logging level to the server.
100
88
  */
101
89
  setLoggingLevel(level: LoggingLevel, options?: RequestOptions): Promise<{
102
- _meta?: {
103
- [x: string]: unknown;
104
- "io.modelcontextprotocol/related-task"?: {
105
- [x: string]: unknown;
106
- taskId: string;
107
- } | undefined;
108
- } | undefined;
90
+ _meta?: Record<string, unknown> | undefined;
109
91
  }>;
110
92
  /**
111
93
  * Gets the prompt with the given params from the server.
@@ -117,37 +99,22 @@ export declare class WebMcpClient {
117
99
  content: {
118
100
  type: "text";
119
101
  text: string;
120
- annotations?: {
121
- audience?: ("user" | "assistant")[] | undefined;
122
- priority?: number | undefined;
123
- lastModified?: string | undefined;
124
- } | undefined;
125
- _meta?: Record<string, unknown> | undefined;
102
+ _meta
103
+ /**
104
+ * Sends a ping to the server to check if it is still connected.
105
+ */
106
+ ? /**
107
+ * Sends a ping to the server to check if it is still connected.
108
+ */: Record<string, unknown> | undefined;
126
109
  } | {
127
110
  type: "image";
128
111
  data: string;
129
112
  mimeType: string;
130
- annotations?: {
131
- audience?: ("user" | "assistant")[] | undefined;
132
- priority?: number | undefined;
133
- lastModified?: string | undefined;
134
- } | undefined;
135
113
  _meta?: Record<string, unknown> | undefined;
136
114
  } | {
137
115
  type: "audio";
138
116
  data: string;
139
117
  mimeType: string;
140
- annotations
141
- /**
142
- * Unsubscribes from a resource on the server.
143
- */
144
- ? /**
145
- * Unsubscribes from a resource on the server.
146
- */: {
147
- audience?: ("user" | "assistant")[] | undefined;
148
- priority?: number | undefined;
149
- lastModified?: string | undefined;
150
- } | undefined;
151
118
  _meta?: Record<string, unknown> | undefined;
152
119
  } | {
153
120
  type: "resource";
@@ -162,11 +129,6 @@ export declare class WebMcpClient {
162
129
  mimeType?: string | undefined;
163
130
  _meta?: Record<string, unknown> | undefined;
164
131
  };
165
- annotations?: {
166
- audience?: ("user" | "assistant")[] | undefined;
167
- priority?: number | undefined;
168
- lastModified?: string | undefined;
169
- } | undefined;
170
132
  _meta?: Record<string, unknown> | undefined;
171
133
  } | {
172
134
  uri: string;
@@ -174,11 +136,6 @@ export declare class WebMcpClient {
174
136
  type: "resource_link";
175
137
  description?: string | undefined;
176
138
  mimeType?: string | undefined;
177
- annotations?: {
178
- audience?: ("user" | "assistant")[] | undefined;
179
- priority?: number | undefined;
180
- lastModified?: string | undefined;
181
- } | undefined;
182
139
  _meta?: {
183
140
  [x: string]: unknown;
184
141
  } | undefined;
@@ -190,13 +147,7 @@ export declare class WebMcpClient {
190
147
  title?: string | undefined;
191
148
  };
192
149
  }[];
193
- _meta?: {
194
- [x: string]: unknown;
195
- "io.modelcontextprotocol/related-task"?: {
196
- [x: string]: unknown;
197
- taskId: string;
198
- } | undefined;
199
- } | undefined;
150
+ _meta?: Record<string, unknown> | undefined;
200
151
  description?: string | undefined;
201
152
  }>;
202
153
  /**
@@ -220,17 +171,9 @@ export declare class WebMcpClient {
220
171
  mimeType?: string | undefined;
221
172
  sizes?: string[] | undefined;
222
173
  }[] | undefined;
223
- title? /**
224
- * Registers a handler for the elicitation request.
225
- */: string | undefined;
174
+ title?: string | undefined;
226
175
  }[];
227
- _meta?: {
228
- [x: string]: unknown;
229
- "io.modelcontextprotocol/related-task"?: {
230
- [x: string]: unknown;
231
- taskId: string;
232
- } | undefined;
233
- } | undefined;
176
+ _meta?: Record<string, unknown> | undefined;
234
177
  nextCursor?: string | undefined;
235
178
  }>;
236
179
  /**
@@ -243,11 +186,6 @@ export declare class WebMcpClient {
243
186
  name: string;
244
187
  description?: string | undefined;
245
188
  mimeType?: string | undefined;
246
- annotations?: {
247
- audience?: ("user" | "assistant")[] | undefined;
248
- priority?: number | undefined;
249
- lastModified?: string | undefined;
250
- } | undefined;
251
189
  _meta?: {
252
190
  [x: string]: unknown;
253
191
  } | undefined;
@@ -258,13 +196,7 @@ export declare class WebMcpClient {
258
196
  }[] | undefined;
259
197
  title?: string | undefined;
260
198
  }[];
261
- _meta?: {
262
- [x: string]: unknown;
263
- "io.modelcontextprotocol/related-task"?: {
264
- [x: string]: unknown;
265
- taskId: string;
266
- } | undefined;
267
- } | undefined;
199
+ _meta?: Record<string, unknown> | undefined;
268
200
  nextCursor?: string | undefined;
269
201
  }>;
270
202
  /**
@@ -275,13 +207,12 @@ export declare class WebMcpClient {
275
207
  resourceTemplates: {
276
208
  uriTemplate: string;
277
209
  name: string;
278
- description?: string | undefined;
210
+ description? /**
211
+ * Registers a handler to invoke when this protocol object receives a request with the given method.
212
+ *
213
+ * Note that this will replace any previous request handler for the same method.
214
+ */: string | undefined;
279
215
  mimeType?: string | undefined;
280
- annotations?: {
281
- audience?: ("user" | "assistant")[] | undefined;
282
- priority?: number | undefined;
283
- lastModified?: string | undefined;
284
- } | undefined;
285
216
  _meta?: {
286
217
  [x: string]: unknown;
287
218
  } | undefined;
@@ -292,13 +223,7 @@ export declare class WebMcpClient {
292
223
  }[] | undefined;
293
224
  title?: string | undefined;
294
225
  }[];
295
- _meta?: {
296
- [x: string]: unknown;
297
- "io.modelcontextprotocol/related-task"?: {
298
- [x: string]: unknown;
299
- taskId: string;
300
- } | undefined;
301
- } | undefined;
226
+ _meta?: Record<string, unknown> | undefined;
302
227
  nextCursor?: string | undefined;
303
228
  }>;
304
229
  /**
@@ -317,37 +242,19 @@ export declare class WebMcpClient {
317
242
  mimeType?: string | undefined;
318
243
  _meta?: Record<string, unknown> | undefined;
319
244
  })[];
320
- _meta?: {
321
- [x: string]: unknown;
322
- "io.modelcontextprotocol/related-task"?: {
323
- [x: string]: unknown;
324
- taskId: string;
325
- } | undefined;
326
- } | undefined;
245
+ _meta?: Record<string, unknown> | undefined;
327
246
  }>;
328
247
  /**
329
248
  * Subscribes to a resource on the server.
330
249
  */
331
250
  subscribeResource(params: SubscribeRequest['params'], options?: RequestOptions): Promise<{
332
- _meta?: {
333
- [x: string]: unknown;
334
- "io.modelcontextprotocol/related-task"?: {
335
- [x: string]: unknown;
336
- taskId: string;
337
- } | undefined;
338
- } | undefined;
251
+ _meta?: Record<string, unknown> | undefined;
339
252
  }>;
340
253
  /**
341
254
  * Unsubscribes from a resource on the server.
342
255
  */
343
256
  unsubscribeResource(params: UnsubscribeRequest['params'], options?: RequestOptions): Promise<{
344
- _meta?: {
345
- [x: string]: unknown;
346
- "io.modelcontextprotocol/related-task"?: {
347
- [x: string]: unknown;
348
- taskId: string;
349
- } | undefined;
350
- } | undefined;
257
+ _meta?: Record<string, unknown> | undefined;
351
258
  }>;
352
259
  /**
353
260
  * Calls a tool on the server with the given parameters.
@@ -357,31 +264,16 @@ export declare class WebMcpClient {
357
264
  content: ({
358
265
  type: "text";
359
266
  text: string;
360
- annotations?: {
361
- audience?: ("user" | "assistant")[] | undefined;
362
- priority?: number | undefined;
363
- lastModified?: string | undefined;
364
- } | undefined;
365
267
  _meta?: Record<string, unknown> | undefined;
366
268
  } | {
367
269
  type: "image";
368
270
  data: string;
369
271
  mimeType: string;
370
- annotations?: {
371
- audience?: ("user" | "assistant")[] | undefined;
372
- priority?: number | undefined;
373
- lastModified?: string | undefined;
374
- } | undefined;
375
272
  _meta?: Record<string, unknown> | undefined;
376
273
  } | {
377
274
  type: "audio";
378
275
  data: string;
379
276
  mimeType: string;
380
- annotations?: {
381
- audience?: ("user" | "assistant")[] | undefined;
382
- priority?: number | undefined;
383
- lastModified?: string | undefined;
384
- } | undefined;
385
277
  _meta?: Record<string, unknown> | undefined;
386
278
  } | {
387
279
  type: "resource";
@@ -396,11 +288,6 @@ export declare class WebMcpClient {
396
288
  mimeType?: string | undefined;
397
289
  _meta?: Record<string, unknown> | undefined;
398
290
  };
399
- annotations?: {
400
- audience?: ("user" | "assistant")[] | undefined;
401
- priority?: number | undefined;
402
- lastModified?: string | undefined;
403
- } | undefined;
404
291
  _meta?: Record<string, unknown> | undefined;
405
292
  } | {
406
293
  uri: string;
@@ -408,11 +295,6 @@ export declare class WebMcpClient {
408
295
  type: "resource_link";
409
296
  description?: string | undefined;
410
297
  mimeType?: string | undefined;
411
- annotations?: {
412
- audience?: ("user" | "assistant")[] | undefined;
413
- priority?: number | undefined;
414
- lastModified?: string | undefined;
415
- } | undefined;
416
298
  _meta?: {
417
299
  [x: string]: unknown;
418
300
  } | undefined;
@@ -423,25 +305,13 @@ export declare class WebMcpClient {
423
305
  }[] | undefined;
424
306
  title?: string | undefined;
425
307
  })[];
426
- _meta?: {
427
- [x: string]: unknown;
428
- "io.modelcontextprotocol/related-task"?: {
429
- [x: string]: unknown;
430
- taskId: string;
431
- } | undefined;
432
- } | undefined;
308
+ _meta?: Record<string, unknown> | undefined;
433
309
  structuredContent?: Record<string, unknown> | undefined;
434
310
  isError?: boolean | undefined;
435
311
  } | {
436
312
  [x: string]: unknown;
437
313
  toolResult: unknown;
438
- _meta?: {
439
- [x: string]: unknown;
440
- "io.modelcontextprotocol/related-task"?: {
441
- [x: string]: unknown;
442
- taskId: string;
443
- } | undefined;
444
- } | undefined;
314
+ _meta?: Record<string, unknown> | undefined;
445
315
  }>;
446
316
  /**
447
317
  * Lists all tools available on the server.
@@ -470,9 +340,6 @@ export declare class WebMcpClient {
470
340
  idempotentHint?: boolean | undefined;
471
341
  openWorldHint?: boolean | undefined;
472
342
  } | undefined;
473
- execution?: {
474
- taskSupport?: "optional" | "required" | "forbidden" | undefined;
475
- } | undefined;
476
343
  _meta?: Record<string, unknown> | undefined;
477
344
  icons?: {
478
345
  src: string;
@@ -481,13 +348,7 @@ export declare class WebMcpClient {
481
348
  }[] | undefined;
482
349
  title?: string | undefined;
483
350
  }[];
484
- _meta?: {
485
- [x: string]: unknown;
486
- "io.modelcontextprotocol/related-task"?: {
487
- [x: string]: unknown;
488
- taskId: string;
489
- } | undefined;
490
- } | undefined;
351
+ _meta?: Record<string, unknown> | undefined;
491
352
  nextCursor?: string | undefined;
492
353
  }>;
493
354
  /**
@@ -98,13 +98,7 @@ export declare class WebMcpServer {
98
98
  * Sends a ping to the client to check if it is still connected.
99
99
  */
100
100
  ping(): Promise<{
101
- _meta?: {
102
- [x: string]: unknown;
103
- "io.modelcontextprotocol/related-task"?: {
104
- [x: string]: unknown;
105
- taskId: string;
106
- } | undefined;
107
- } | undefined;
101
+ _meta?: Record<string, unknown> | undefined;
108
102
  }>;
109
103
  /**
110
104
  * Creates a LLM message to be sent to the client.
@@ -116,46 +110,169 @@ export declare class WebMcpServer {
116
110
  content: {
117
111
  type: "text";
118
112
  text: string;
119
- annotations?: {
120
- audience?: ("user" | "assistant")[] | undefined;
121
- priority?: number | undefined;
122
- lastModified?: string | undefined;
123
- } | undefined;
124
- _meta?: {
125
- [x: string]: unknown;
126
- } | undefined;
113
+ _meta?: Record<string, unknown> | undefined;
127
114
  } | {
128
115
  type: "image";
129
116
  data: string;
130
117
  mimeType: string;
131
- annotations?: {
132
- audience?: ("user" | "assistant")[] | undefined;
133
- priority?: number | undefined;
134
- lastModified?: string | undefined;
118
+ _meta?: Record<string, unknown> | undefined;
119
+ } | {
120
+ type: "audio";
121
+ data: string;
122
+ mimeType: string;
123
+ _meta?: Record<string, unknown> | undefined;
124
+ } | {
125
+ [x: string]: unknown;
126
+ type: "tool_use";
127
+ name: string;
128
+ id: string;
129
+ input: {
130
+ [x: string]: unknown;
131
+ };
132
+ _meta?: {
133
+ [x: string]: unknown;
135
134
  } | undefined;
135
+ } | {
136
+ [x: string]: unknown;
137
+ type: "tool_result";
138
+ toolUseId: string;
139
+ content: ({
140
+ type: "text";
141
+ text: string;
142
+ _meta?: Record<string, unknown> | undefined;
143
+ } | {
144
+ type: "image";
145
+ data: string;
146
+ mimeType: string;
147
+ _meta?: Record<string, unknown> | undefined;
148
+ } | {
149
+ type: "audio";
150
+ data: string;
151
+ mimeType: string;
152
+ _meta?: Record<string, unknown> | undefined;
153
+ } | {
154
+ type: "resource";
155
+ resource: {
156
+ uri: string;
157
+ text: string;
158
+ mimeType?: string | undefined;
159
+ _meta?: Record<string, unknown> | undefined;
160
+ } | {
161
+ uri: string;
162
+ blob: string;
163
+ mimeType?: string | undefined;
164
+ _meta?: Record<string, unknown> | undefined;
165
+ };
166
+ _meta?: Record<string, unknown> | undefined;
167
+ } | {
168
+ uri: string;
169
+ name: string;
170
+ type: "resource_link";
171
+ description?: string | undefined;
172
+ mimeType?: string | undefined;
173
+ _meta?: {
174
+ [x: string]: unknown;
175
+ } | undefined;
176
+ icons?: {
177
+ src: string;
178
+ mimeType?: string | undefined;
179
+ sizes?: string[] | undefined;
180
+ }[] | undefined;
181
+ title?: string | undefined;
182
+ })[];
183
+ structuredContent?: {
184
+ [x: string]: unknown;
185
+ } | undefined;
186
+ isError?: boolean | undefined;
136
187
  _meta?: {
137
188
  [x: string]: unknown;
138
189
  } | undefined;
190
+ } | ({
191
+ type: "text";
192
+ text: string;
193
+ _meta?: Record<string, unknown> | undefined;
194
+ } | {
195
+ type: "image";
196
+ data: string;
197
+ mimeType: string;
198
+ _meta?: Record<string, unknown> | undefined;
139
199
  } | {
140
200
  type: "audio";
141
201
  data: string;
142
202
  mimeType: string;
143
- annotations?: {
144
- audience?: ("user" | "assistant")[] | undefined;
145
- priority?: number | undefined;
146
- lastModified?: string | undefined;
147
- } | undefined;
203
+ _meta?: Record<string, unknown> | undefined;
204
+ } | {
205
+ [x: string]: unknown;
206
+ type: "tool_use";
207
+ name: string;
208
+ id: string;
209
+ input: {
210
+ [x: string]: unknown;
211
+ };
148
212
  _meta?: {
149
213
  [x: string]: unknown;
150
214
  } | undefined;
151
- };
152
- _meta?: {
215
+ } | {
153
216
  [x: string]: unknown;
154
- "io.modelcontextprotocol/related-task"?: {
217
+ type: "tool_result";
218
+ toolUseId: string;
219
+ content: ({
220
+ type: "text";
221
+ text: string;
222
+ _meta?: Record<string, unknown> | undefined;
223
+ } | {
224
+ type: "image";
225
+ data: string;
226
+ mimeType: string;
227
+ _meta?: Record<string, unknown> | undefined;
228
+ } | {
229
+ type: "audio";
230
+ data: string;
231
+ mimeType: string;
232
+ _meta?: Record<string, unknown> | undefined;
233
+ } | {
234
+ type: "resource";
235
+ resource: {
236
+ uri: string;
237
+ text: string;
238
+ mimeType?: string | undefined;
239
+ _meta?: Record<string, unknown> | undefined;
240
+ } | {
241
+ uri: string;
242
+ blob: string;
243
+ mimeType?: string | undefined;
244
+ _meta?: Record<string, unknown> | undefined;
245
+ };
246
+ _meta?: Record<string, unknown> | undefined;
247
+ } | {
248
+ uri: string;
249
+ name: string;
250
+ type: "resource_link";
251
+ description?: string | undefined;
252
+ mimeType?: string | undefined;
253
+ _meta? /**
254
+ * Registers a handler to invoke when this protocol object receives a notification with the given method.
255
+ *
256
+ * Note that this will replace any previous notification handler for the same method.
257
+ */: {
258
+ [x: string]: unknown;
259
+ } | undefined;
260
+ icons?: {
261
+ src: string;
262
+ mimeType?: string | undefined;
263
+ sizes?: string[] | undefined;
264
+ }[] | undefined;
265
+ title?: string | undefined;
266
+ })[];
267
+ structuredContent?: {
268
+ [x: string]: unknown;
269
+ } | undefined;
270
+ isError?: boolean | undefined;
271
+ _meta?: {
155
272
  [x: string]: unknown;
156
- taskId: string;
157
273
  } | undefined;
158
- } | undefined;
274
+ })[];
275
+ _meta?: Record<string, unknown> | undefined;
159
276
  stopReason?: string | undefined;
160
277
  }>;
161
278
  /**
@@ -172,13 +289,7 @@ export declare class WebMcpServer {
172
289
  name?: string | undefined;
173
290
  _meta?: Record<string, unknown> | undefined;
174
291
  }[];
175
- _meta?: {
176
- [x: string]: unknown;
177
- "io.modelcontextprotocol/related-task"?: {
178
- [x: string]: unknown;
179
- taskId: string;
180
- } | undefined;
181
- } | undefined;
292
+ _meta?: Record<string, unknown> | undefined;
182
293
  }>;
183
294
  /**
184
295
  * Sends a logging message to the client.
@@ -32,8 +32,6 @@ export declare class AgentModelProvider {
32
32
  onClientDisconnected?: (serverName: string, reason?: string) => void;
33
33
  /** 缓存 ai-sdk response 中的 多轮会话的上下文 */
34
34
  messages: any[];
35
- /** 是否使用 ReAct 模式(通过提示词而非 function calling 进行工具调用) */
36
- useReActMode: boolean;
37
35
  constructor({ llmConfig, mcpServers }: IAgentModelProviderOption);
38
36
  /** 创建一个 ai-sdk的 mcpClient, 创建失败则返回 null */
39
37
  private _createOneClient;
@@ -52,43 +50,11 @@ export declare class AgentModelProvider {
52
50
  /** 全量更新所有的 mcpServers */
53
51
  updateMcpServers(mcpServers?: Record<string, McpServerConfig>): Promise<void>;
54
52
  /** 插入一个新的mcpServer,如果已经存在则返回false */
55
- insertMcpServer(serverName: string, mcpServer: McpServerConfig): Promise<false | WebMcpClient | import('@ai-sdk/mcp').experimental_MCPClient | null>;
53
+ insertMcpServer(serverName: string, mcpServer: McpServerConfig): Promise<false | WebMcpClient | import('ai').experimental_MCPClient | null>;
56
54
  /** 通过服务器名称删除mcpServer: mcpServers mcpClients mcpTools ignoreToolnames */
57
55
  removeMcpServer(serverName: string): Promise<void>;
58
56
  /** 创建临时允许调用的tools集合 */
59
57
  private _tempMergeTools;
60
- /** 生成 ReAct 模式的系统提示词(包含工具描述) */
61
- private _generateReActSystemPrompt;
62
- /** 执行 ReAct 模式下的工具调用 */
63
- private _executeReActToolCall;
64
- /** ReAct 模式的对话实现 */
65
- private _chatReAct;
66
- /**
67
- * 检查消息内容是否包含图片
68
- * @param content 消息内容
69
- * @returns 是否包含图片
70
- */
71
- private _messageHasImage;
72
- /**
73
- * 从消息中移除图片,但保留文本内容
74
- * @param message 原始消息
75
- * @returns 移除图片后的消息(如果只有图片没有文本,返回 null)
76
- */
77
- private _removeImageFromMessage;
78
- /**
79
- * 构建用于模型调用的消息列表(magentic-ui 风格)
80
- * 策略:保留所有文本消息,仅限制图片数量(类似 magentic-ui 的 maybe_remove_old_screenshots)
81
- *
82
- * @param systemMessage 系统提示词
83
- * @param allMessages 所有消息历史(包括初始消息和后续对话)
84
- * @param maxImages 最多保留的图片数量(默认3张)
85
- * @returns 构建好的消息列表
86
- */
87
- private _buildMessagesForModel;
88
- /** ReAct 模式非流式对话 */
89
- private _chatReActNonStream;
90
- /** ReAct 模式流式对话 */
91
- private _chatReActStream;
92
58
  private _chat;
93
59
  chat(options: Parameters<typeof generateText>[0] & {
94
60
  maxSteps?: number;
@@ -1,7 +1,6 @@
1
1
  import { ProviderV2 } from '@ai-sdk/provider';
2
- import { experimental_MCPClientConfig as MCPClientConfig } from '@ai-sdk/mcp';
3
-
4
- export type MCPTransport = MCPClientConfig['transport'];
2
+ import { MCPTransport } from 'ai';
3
+ export type { experimental_MCPClient as MCPClient } from 'ai';
5
4
  type ProviderFactory = 'openai' | 'deepseek' | ((options: any) => ProviderV2);
6
5
  type LlmFactoryConfig = {
7
6
  /** API密钥 */
@@ -12,8 +11,6 @@ type LlmFactoryConfig = {
12
11
  providerType: ProviderFactory;
13
12
  /** 互斥:当使用 providerType 分支时不允许传入 llm */
14
13
  llm?: never;
15
- /** 是否使用 ReAct 模式(通过提示词而非 function calling 进行工具调用),默认为 false */
16
- useReActMode?: boolean;
17
14
  };
18
15
  type LlmInstanceConfig = {
19
16
  /** 自定义 Provider 实例,优先级最高 */
@@ -22,8 +19,6 @@ type LlmInstanceConfig = {
22
19
  apiKey?: never;
23
20
  baseURL?: never;
24
21
  providerType?: never;
25
- /** 是否使用 ReAct 模式(通过提示词而非 function calling 进行工具调用),默认为 false */
26
- useReActMode?: boolean;
27
22
  };
28
23
  /** 代理模型提供器的大语言配置对象, 通过 XOR 表达二选一 */
29
24
  export type IAgentModelProviderLlmConfig = LlmFactoryConfig | LlmInstanceConfig;
@@ -52,4 +47,3 @@ export interface IAgentModelProviderOption {
52
47
  /** Mcp Server的配置对象的集合,键为服务器名称,值为配置对象 */
53
48
  mcpServers?: Record<string, McpServerConfig>;
54
49
  }
55
- export {};