@openserv-labs/sdk 1.6.0 → 1.8.0
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/README.md +69 -11
- package/dist/agent.d.ts +57 -36
- package/dist/agent.d.ts.map +1 -1
- package/dist/agent.js +104 -16
- package/dist/capability.d.ts +3 -3
- package/dist/capability.d.ts.map +1 -1
- package/dist/mcp.d.ts +289 -0
- package/dist/mcp.d.ts.map +1 -0
- package/dist/mcp.js +308 -0
- package/dist/types.d.ts +1539 -305
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +150 -56
- package/package.json +3 -1
package/README.md
CHANGED
|
@@ -41,6 +41,7 @@ A powerful TypeScript framework for building non-deterministic AI agents with ad
|
|
|
41
41
|
- [Upload File](#upload-file)
|
|
42
42
|
- [Integration Management](#integration-management)
|
|
43
43
|
- [Call Integration](#call-integration)
|
|
44
|
+
- [MCP](#mcp)
|
|
44
45
|
- [Advanced Usage](#advanced-usage)
|
|
45
46
|
- [OpenAI Process Runtime](#openai-process-runtime)
|
|
46
47
|
- [Error Handling](#error-handling)
|
|
@@ -449,7 +450,7 @@ const files = await agent.getFiles({
|
|
|
449
450
|
|
|
450
451
|
```typescript
|
|
451
452
|
const task = await agent.createTask({
|
|
452
|
-
workspaceId: number,
|
|
453
|
+
workspaceId: number | string,
|
|
453
454
|
assignee: number,
|
|
454
455
|
description: string,
|
|
455
456
|
body: string,
|
|
@@ -463,8 +464,8 @@ const task = await agent.createTask({
|
|
|
463
464
|
|
|
464
465
|
```typescript
|
|
465
466
|
await agent.updateTaskStatus({
|
|
466
|
-
workspaceId: number,
|
|
467
|
-
taskId: number,
|
|
467
|
+
workspaceId: number | string,
|
|
468
|
+
taskId: number | string,
|
|
468
469
|
status: 'to-do' | 'in-progress' | 'human-assistance-required' | 'error' | 'done' | 'cancelled'
|
|
469
470
|
})
|
|
470
471
|
```
|
|
@@ -473,8 +474,8 @@ await agent.updateTaskStatus({
|
|
|
473
474
|
|
|
474
475
|
```typescript
|
|
475
476
|
await agent.addLogToTask({
|
|
476
|
-
workspaceId: number,
|
|
477
|
-
taskId: number,
|
|
477
|
+
workspaceId: number | string,
|
|
478
|
+
taskId: number | string,
|
|
478
479
|
severity: 'info' | 'warning' | 'error',
|
|
479
480
|
type: 'text' | 'openai-message',
|
|
480
481
|
body: string | object
|
|
@@ -487,7 +488,7 @@ await agent.addLogToTask({
|
|
|
487
488
|
|
|
488
489
|
```typescript
|
|
489
490
|
await agent.sendChatMessage({
|
|
490
|
-
workspaceId: number,
|
|
491
|
+
workspaceId: number | string,
|
|
491
492
|
agentId: number,
|
|
492
493
|
message: string
|
|
493
494
|
})
|
|
@@ -497,8 +498,8 @@ await agent.sendChatMessage({
|
|
|
497
498
|
|
|
498
499
|
```typescript
|
|
499
500
|
await agent.requestHumanAssistance({
|
|
500
|
-
workspaceId: number,
|
|
501
|
-
taskId: number,
|
|
501
|
+
workspaceId: number | string,
|
|
502
|
+
taskId: number | string,
|
|
502
503
|
type: 'text' | 'project-manager-plan-review',
|
|
503
504
|
question: string | object,
|
|
504
505
|
agentDump?: object
|
|
@@ -511,7 +512,7 @@ await agent.requestHumanAssistance({
|
|
|
511
512
|
|
|
512
513
|
```typescript
|
|
513
514
|
const files = await agent.getFiles({
|
|
514
|
-
workspaceId: number
|
|
515
|
+
workspaceId: number | string
|
|
515
516
|
})
|
|
516
517
|
```
|
|
517
518
|
|
|
@@ -519,7 +520,7 @@ const files = await agent.getFiles({
|
|
|
519
520
|
|
|
520
521
|
```typescript
|
|
521
522
|
await agent.uploadFile({
|
|
522
|
-
workspaceId: number,
|
|
523
|
+
workspaceId: number | string,
|
|
523
524
|
path: string,
|
|
524
525
|
file: Buffer | string,
|
|
525
526
|
skipSummarizer?: boolean,
|
|
@@ -533,7 +534,7 @@ await agent.uploadFile({
|
|
|
533
534
|
|
|
534
535
|
```typescript
|
|
535
536
|
const response = await agent.callIntegration({
|
|
536
|
-
workspaceId: number,
|
|
537
|
+
workspaceId: number | string,
|
|
537
538
|
integrationId: string,
|
|
538
539
|
details: {
|
|
539
540
|
endpoint: string,
|
|
@@ -573,6 +574,63 @@ const response = await agent.callIntegration({
|
|
|
573
574
|
})
|
|
574
575
|
```
|
|
575
576
|
|
|
577
|
+
### MCP
|
|
578
|
+
|
|
579
|
+
Easily connect your agent to external [Model Context Protocol](https://modelcontextprotocol.org) (MCP) servers and automatically import their tools as capabilities.
|
|
580
|
+
|
|
581
|
+
#### Configure MCP servers
|
|
582
|
+
|
|
583
|
+
Provide an `mcpServers` object when creating the agent. Each key is a **server ID** of your choice. Supported transports are `http`, `sse`, and `stdio`.
|
|
584
|
+
|
|
585
|
+
```typescript
|
|
586
|
+
import { Agent } from '@openserv-labs/sdk'
|
|
587
|
+
|
|
588
|
+
const agent = new Agent({
|
|
589
|
+
systemPrompt: 'You are a search-engine assistant.',
|
|
590
|
+
mcpServers: {
|
|
591
|
+
Exa: {
|
|
592
|
+
transport: 'http',
|
|
593
|
+
url: 'https://server.smithery.ai/exa/mcp?api_key=YOUR_API_KEY',
|
|
594
|
+
autoRegisterTools: true // automatically turn MCP tools into capabilities
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
})
|
|
598
|
+
|
|
599
|
+
await agent.start()
|
|
600
|
+
```
|
|
601
|
+
|
|
602
|
+
##### Local (stdio) transport
|
|
603
|
+
|
|
604
|
+
```typescript
|
|
605
|
+
mcpServers: {
|
|
606
|
+
LocalLLM: {
|
|
607
|
+
transport: 'stdio',
|
|
608
|
+
command: 'my-mcp-binary',
|
|
609
|
+
args: ['--model', 'gpt-4o'],
|
|
610
|
+
env: { OPENAI_API_KEY: process.env.OPENAI_API_KEY },
|
|
611
|
+
autoRegisterTools: true
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
```
|
|
615
|
+
|
|
616
|
+
##### Server-Sent Events (sse) transport
|
|
617
|
+
|
|
618
|
+
```typescript
|
|
619
|
+
mcpServers: {
|
|
620
|
+
Anthropic: {
|
|
621
|
+
transport: 'sse',
|
|
622
|
+
url: 'https://my-mcp-server.com/sse',
|
|
623
|
+
autoRegisterTools: false
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
```
|
|
627
|
+
|
|
628
|
+
#### Using MCP tools
|
|
629
|
+
|
|
630
|
+
If `autoRegisterTools` is `true`, each MCP tool becomes a capability named `mcp_<serverId>_<toolName>`.
|
|
631
|
+
|
|
632
|
+
You can also access the raw MCP client via `agent.mcpClients['MCP_SERVER_ID']` to list tools (`getTools`) or execute them directly (`executeTool`) inside your agents own capabilities.
|
|
633
|
+
|
|
576
634
|
## Advanced Usage
|
|
577
635
|
|
|
578
636
|
### OpenAI Process Runtime
|
package/dist/agent.d.ts
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { type AxiosInstance } from 'axios';
|
|
2
|
-
import type { GetFilesParams, GetSecretsParams, GetSecretValueParams, UploadFileParams, DeleteFileParams, MarkTaskAsErroredParams, CompleteTaskParams, SendChatMessageParams, GetTaskDetailParams, GetAgentsParams, GetTasksParams, CreateTaskParams, AddLogToTaskParams, RequestHumanAssistanceParams, UpdateTaskStatusParams, ProcessParams, IntegrationCallRequest, GetChatMessagesParams } from './types';
|
|
2
|
+
import type { GetFilesParams, GetSecretsParams, GetSecretValueParams, UploadFileParams, DeleteFileParams, MarkTaskAsErroredParams, CompleteTaskParams, SendChatMessageParams, GetTaskDetailParams, GetAgentsParams, GetTasksParams, CreateTaskParams, AddLogToTaskParams, RequestHumanAssistanceParams, UpdateTaskStatusParams, ProcessParams, IntegrationCallRequest, GetChatMessagesParams, GetFilesResponse, GetSecretsResponse, UploadFileResponse, DeleteFileResponse, GetTaskDetailResponse, GetAgentsResponse, GetTasksResponse, CreateTaskResponse } from './types';
|
|
3
3
|
import type { doTaskActionSchema, respondChatMessageActionSchema } from './types';
|
|
4
4
|
import { actionSchema } from './types';
|
|
5
5
|
import type { ChatCompletionMessageParam, ChatCompletion } from 'openai/resources/chat/completions';
|
|
6
6
|
import OpenAI from 'openai';
|
|
7
7
|
import type { z } from 'zod';
|
|
8
8
|
import { Capability } from './capability';
|
|
9
|
+
import { type MCPServerConfig, MCPClient } from './mcp';
|
|
9
10
|
/**
|
|
10
11
|
* Configuration options for creating a new Agent instance.
|
|
11
12
|
*/
|
|
12
|
-
export interface AgentOptions {
|
|
13
|
+
export interface AgentOptions<T extends string> {
|
|
13
14
|
/**
|
|
14
15
|
* The port number for the agent's HTTP server.
|
|
15
16
|
* Defaults to 7378 if not specified.
|
|
@@ -38,8 +39,12 @@ export interface AgentOptions {
|
|
|
38
39
|
* @param context - Additional context about where the error occurred
|
|
39
40
|
*/
|
|
40
41
|
onError?: (error: Error, context?: Record<string, unknown>) => void;
|
|
42
|
+
/**
|
|
43
|
+
* Configuration for MCP servers to connect to
|
|
44
|
+
*/
|
|
45
|
+
mcpServers?: Record<T, MCPServerConfig>;
|
|
41
46
|
}
|
|
42
|
-
export declare class Agent {
|
|
47
|
+
export declare class Agent<M extends string> {
|
|
43
48
|
private options;
|
|
44
49
|
/**
|
|
45
50
|
* The Express application instance used to handle HTTP requests.
|
|
@@ -76,7 +81,7 @@ export declare class Agent {
|
|
|
76
81
|
* Each capability is an instance of the Capability class with a name, description, schema, and run function.
|
|
77
82
|
* @protected
|
|
78
83
|
*/
|
|
79
|
-
protected tools: Array<Capability<z.ZodTypeAny>>;
|
|
84
|
+
protected tools: Array<Capability<M, z.ZodTypeAny>>;
|
|
80
85
|
/**
|
|
81
86
|
* The OpenServ API key used for authentication.
|
|
82
87
|
* Can be provided in options or via OPENSERV_API_KEY environment variable.
|
|
@@ -101,6 +106,11 @@ export declare class Agent {
|
|
|
101
106
|
* @protected
|
|
102
107
|
*/
|
|
103
108
|
protected _openai?: OpenAI;
|
|
109
|
+
/**
|
|
110
|
+
* Map of MCP clients by server ID.
|
|
111
|
+
* @private
|
|
112
|
+
*/
|
|
113
|
+
mcpClients: Record<M, MCPClient<M>>;
|
|
104
114
|
/**
|
|
105
115
|
* Getter that converts the agent's tools into OpenAI function calling format.
|
|
106
116
|
* Used when making chat completion requests to OpenAI.
|
|
@@ -124,7 +134,8 @@ export declare class Agent {
|
|
|
124
134
|
* @param {AgentOptions} options - Configuration options for the agent
|
|
125
135
|
* @throws {Error} If OpenServ API key is not provided in options or environment
|
|
126
136
|
*/
|
|
127
|
-
constructor(options: AgentOptions);
|
|
137
|
+
constructor(options: AgentOptions<M>);
|
|
138
|
+
private initializeMCPClients;
|
|
128
139
|
/**
|
|
129
140
|
* Adds a single capability (tool) to the agent.
|
|
130
141
|
* Each capability must have a unique name and defines a function that can be called via the API.
|
|
@@ -146,7 +157,7 @@ export declare class Agent {
|
|
|
146
157
|
name: string;
|
|
147
158
|
description: string;
|
|
148
159
|
schema: S;
|
|
149
|
-
run(this: Agent
|
|
160
|
+
run(this: Agent<M>, params: {
|
|
150
161
|
args: z.infer<S>;
|
|
151
162
|
action?: z.infer<typeof actionSchema>;
|
|
152
163
|
}, messages: ChatCompletionMessageParam[]): string | Promise<string>;
|
|
@@ -169,7 +180,7 @@ export declare class Agent {
|
|
|
169
180
|
name: string;
|
|
170
181
|
description: string;
|
|
171
182
|
schema: T[K];
|
|
172
|
-
run(this: Agent
|
|
183
|
+
run(this: Agent<M>, params: {
|
|
173
184
|
args: z.infer<T[K]>;
|
|
174
185
|
action?: z.infer<typeof actionSchema>;
|
|
175
186
|
}, messages: ChatCompletionMessageParam[]): string | Promise<string>;
|
|
@@ -180,21 +191,21 @@ export declare class Agent {
|
|
|
180
191
|
*
|
|
181
192
|
* @param {GetFilesParams} params - Parameters for the file retrieval
|
|
182
193
|
* @param {number} params.workspaceId - ID of the workspace to get files from
|
|
183
|
-
* @returns {Promise<
|
|
194
|
+
* @returns {Promise<GetFilesResponse>} The files in the workspace
|
|
184
195
|
*/
|
|
185
|
-
getFiles(params: GetFilesParams): Promise<
|
|
196
|
+
getFiles(params: GetFilesParams): Promise<GetFilesResponse>;
|
|
186
197
|
/**
|
|
187
198
|
* Get all secrets for an agent in a workspace.
|
|
188
199
|
*
|
|
189
200
|
* @param {GetSecretsParams} params - Parameters for the secrets retrieval
|
|
190
|
-
* @returns {Promise<
|
|
201
|
+
* @returns {Promise<GetSecretsResponse>} List of agent secrets.
|
|
191
202
|
*/
|
|
192
|
-
getSecrets(params: GetSecretsParams): Promise<
|
|
203
|
+
getSecrets(params: GetSecretsParams): Promise<GetSecretsResponse>;
|
|
193
204
|
/**
|
|
194
205
|
* Get the value of a secret for an agent in a workspace
|
|
195
206
|
*
|
|
196
207
|
* @param {GetSecretValueParams} params - Parameters for the secret value retrieval
|
|
197
|
-
* @returns {Promise<
|
|
208
|
+
* @returns {Promise<GetSecretValueResponse>} The value of the secret.
|
|
198
209
|
*/
|
|
199
210
|
getSecretValue(params: GetSecretValueParams): Promise<string>;
|
|
200
211
|
/**
|
|
@@ -206,18 +217,18 @@ export declare class Agent {
|
|
|
206
217
|
* @param {number[]|number|null} [params.taskIds] - Optional task IDs to associate with the file
|
|
207
218
|
* @param {boolean} [params.skipSummarizer] - Whether to skip file summarization
|
|
208
219
|
* @param {Buffer|string} params.file - The file content to upload
|
|
209
|
-
* @returns {Promise<
|
|
220
|
+
* @returns {Promise<UploadFileResponse>} The uploaded file details
|
|
210
221
|
*/
|
|
211
|
-
uploadFile(params: UploadFileParams): Promise<
|
|
222
|
+
uploadFile(params: UploadFileParams): Promise<UploadFileResponse>;
|
|
212
223
|
/**
|
|
213
224
|
* Deletes a file from a workspace.
|
|
214
225
|
*
|
|
215
226
|
* @param {DeleteFileParams} params - Parameters for the file deletion
|
|
216
227
|
* @param {number} params.workspaceId - ID of the workspace containing the file
|
|
217
228
|
* @param {number} params.fileId - ID of the file to delete
|
|
218
|
-
* @returns {Promise<
|
|
229
|
+
* @returns {Promise<DeleteFileResponse>} A success message confirming the file was deleted
|
|
219
230
|
*/
|
|
220
|
-
deleteFile(params: DeleteFileParams): Promise<
|
|
231
|
+
deleteFile(params: DeleteFileParams): Promise<DeleteFileResponse>;
|
|
221
232
|
/**
|
|
222
233
|
* Marks a task as errored.
|
|
223
234
|
*
|
|
@@ -225,9 +236,9 @@ export declare class Agent {
|
|
|
225
236
|
* @param {number} params.workspaceId - ID of the workspace containing the task
|
|
226
237
|
* @param {number} params.taskId - ID of the task to mark as errored
|
|
227
238
|
* @param {string} params.error - Error message describing what went wrong
|
|
228
|
-
* @returns {Promise<
|
|
239
|
+
* @returns {Promise<MarkTaskAsErroredResponse>} The updated task details
|
|
229
240
|
*/
|
|
230
|
-
markTaskAsErrored(params: MarkTaskAsErroredParams): Promise<
|
|
241
|
+
markTaskAsErrored(params: MarkTaskAsErroredParams): Promise<undefined>;
|
|
231
242
|
/**
|
|
232
243
|
* Completes a task with the specified output.
|
|
233
244
|
*
|
|
@@ -235,9 +246,9 @@ export declare class Agent {
|
|
|
235
246
|
* @param {number} params.workspaceId - ID of the workspace containing the task
|
|
236
247
|
* @param {number} params.taskId - ID of the task to complete
|
|
237
248
|
* @param {string} params.output - Output or result of the completed task
|
|
238
|
-
* @returns {Promise<
|
|
249
|
+
* @returns {Promise<CompleteTaskResponse>} The completed task details
|
|
239
250
|
*/
|
|
240
|
-
completeTask(params: CompleteTaskParams): Promise<
|
|
251
|
+
completeTask(params: CompleteTaskParams): Promise<undefined>;
|
|
241
252
|
/**
|
|
242
253
|
* Sends a chat message from the agent.
|
|
243
254
|
*
|
|
@@ -245,34 +256,34 @@ export declare class Agent {
|
|
|
245
256
|
* @param {number} params.workspaceId - ID of the workspace where the chat is happening
|
|
246
257
|
* @param {number} params.agentId - ID of the agent sending the message
|
|
247
258
|
* @param {string} params.message - Content of the message to send
|
|
248
|
-
* @returns {Promise<
|
|
259
|
+
* @returns {Promise<SendChatMessageResponse>} The sent message details
|
|
249
260
|
*/
|
|
250
|
-
sendChatMessage(params: SendChatMessageParams): Promise<
|
|
261
|
+
sendChatMessage(params: SendChatMessageParams): Promise<undefined>;
|
|
251
262
|
/**
|
|
252
263
|
* Gets detailed information about a specific task.
|
|
253
264
|
*
|
|
254
265
|
* @param {GetTaskDetailParams} params - Parameters for getting task details
|
|
255
266
|
* @param {number} params.workspaceId - ID of the workspace containing the task
|
|
256
267
|
* @param {number} params.taskId - ID of the task to get details for
|
|
257
|
-
* @returns {Promise<
|
|
268
|
+
* @returns {Promise<GetTaskDetailResponse>} The detailed task information
|
|
258
269
|
*/
|
|
259
|
-
getTaskDetail(params: GetTaskDetailParams): Promise<
|
|
270
|
+
getTaskDetail(params: GetTaskDetailParams): Promise<GetTaskDetailResponse>;
|
|
260
271
|
/**
|
|
261
272
|
* Gets a list of agents in a workspace.
|
|
262
273
|
*
|
|
263
274
|
* @param {GetAgentsParams} params - Parameters for getting agents
|
|
264
275
|
* @param {number} params.workspaceId - ID of the workspace to get agents from
|
|
265
|
-
* @returns {Promise<
|
|
276
|
+
* @returns {Promise<GetAgentsResponse>} List of agents in the workspace
|
|
266
277
|
*/
|
|
267
|
-
getAgents(params: GetAgentsParams): Promise<
|
|
278
|
+
getAgents(params: GetAgentsParams): Promise<GetAgentsResponse>;
|
|
268
279
|
/**
|
|
269
280
|
* Gets a list of tasks in a workspace.
|
|
270
281
|
*
|
|
271
282
|
* @param {GetTasksParams} params - Parameters for getting tasks
|
|
272
283
|
* @param {number} params.workspaceId - ID of the workspace to get tasks from
|
|
273
|
-
* @returns {Promise<
|
|
284
|
+
* @returns {Promise<GetTasksResponse>} List of tasks in the workspace
|
|
274
285
|
*/
|
|
275
|
-
getTasks(params: GetTasksParams): Promise<
|
|
286
|
+
getTasks(params: GetTasksParams): Promise<GetTasksResponse>;
|
|
276
287
|
/**
|
|
277
288
|
* Gets a list of tasks in a workspace.
|
|
278
289
|
*
|
|
@@ -304,9 +315,9 @@ export declare class Agent {
|
|
|
304
315
|
* @param {string} params.input - Input data for the task
|
|
305
316
|
* @param {string} params.expectedOutput - Expected output format or content
|
|
306
317
|
* @param {number[]} params.dependencies - IDs of tasks that this task depends on
|
|
307
|
-
* @returns {Promise<
|
|
318
|
+
* @returns {Promise<CreateTaskResponse>} The created task details
|
|
308
319
|
*/
|
|
309
|
-
createTask(params: CreateTaskParams): Promise<
|
|
320
|
+
createTask(params: CreateTaskParams): Promise<CreateTaskResponse>;
|
|
310
321
|
/**
|
|
311
322
|
* Adds a log entry to a task.
|
|
312
323
|
*
|
|
@@ -316,9 +327,9 @@ export declare class Agent {
|
|
|
316
327
|
* @param {'info'|'warning'|'error'} params.severity - Severity level of the log
|
|
317
328
|
* @param {'text'|'openai-message'} params.type - Type of log entry
|
|
318
329
|
* @param {string|object} params.body - Content of the log entry
|
|
319
|
-
* @returns {Promise<
|
|
330
|
+
* @returns {Promise<AddLogToTaskResponse>} The created log entry details
|
|
320
331
|
*/
|
|
321
|
-
addLogToTask(params: AddLogToTaskParams): Promise<
|
|
332
|
+
addLogToTask(params: AddLogToTaskParams): Promise<undefined>;
|
|
322
333
|
/**
|
|
323
334
|
* Requests human assistance for a task.
|
|
324
335
|
*
|
|
@@ -328,9 +339,9 @@ export declare class Agent {
|
|
|
328
339
|
* @param {'text'|'project-manager-plan-review'} params.type - Type of assistance needed
|
|
329
340
|
* @param {string|object} params.question - Question or request for the human
|
|
330
341
|
* @param {object} [params.agentDump] - Optional agent state/context information
|
|
331
|
-
* @returns {Promise<
|
|
342
|
+
* @returns {Promise<RequestHumanAssistanceResponse>} The created assistance request details
|
|
332
343
|
*/
|
|
333
|
-
requestHumanAssistance(params: RequestHumanAssistanceParams): Promise<
|
|
344
|
+
requestHumanAssistance(params: RequestHumanAssistanceParams): Promise<undefined>;
|
|
334
345
|
/**
|
|
335
346
|
* Updates the status of a task.
|
|
336
347
|
*
|
|
@@ -338,9 +349,9 @@ export declare class Agent {
|
|
|
338
349
|
* @param {number} params.workspaceId - ID of the workspace containing the task
|
|
339
350
|
* @param {number} params.taskId - ID of the task to update
|
|
340
351
|
* @param {TaskStatus} params.status - New status for the task
|
|
341
|
-
* @returns {Promise<
|
|
352
|
+
* @returns {Promise<UpdateTaskStatusResponse>} The updated task details
|
|
342
353
|
*/
|
|
343
|
-
updateTaskStatus(params: UpdateTaskStatusParams): Promise<
|
|
354
|
+
updateTaskStatus(params: UpdateTaskStatusParams): Promise<undefined>;
|
|
344
355
|
/**
|
|
345
356
|
* Processes a conversation with OpenAI, handling tool calls iteratively until completion.
|
|
346
357
|
*
|
|
@@ -438,5 +449,15 @@ export declare class Agent {
|
|
|
438
449
|
* @throws {Error} If the integration call fails
|
|
439
450
|
*/
|
|
440
451
|
callIntegration(integration: IntegrationCallRequest): Promise<any>;
|
|
452
|
+
/**
|
|
453
|
+
* Registers a list of MCP tool descriptors as capabilities on the agent.
|
|
454
|
+
* Each tool is wrapped in a function that calls `executeMCPTool`.
|
|
455
|
+
* The capability name is prefixed with `mcp_<serverId>_`.
|
|
456
|
+
*
|
|
457
|
+
* @param serverId - The ID of the MCP server these tools belong to.
|
|
458
|
+
* @param tools - An array of {@link MCPToolDescriptor} objects to register.
|
|
459
|
+
* @private
|
|
460
|
+
*/
|
|
461
|
+
private addMCPToolsAsCapabilities;
|
|
441
462
|
}
|
|
442
463
|
//# sourceMappingURL=agent.d.ts.map
|
package/dist/agent.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../src/agent.ts"],"names":[],"mappings":"AAAA,OAAc,EAAE,KAAK,aAAa,EAAE,MAAM,OAAO,CAAA;AAUjD,OAAO,KAAK,EACV,cAAc,EACd,gBAAgB,EAChB,oBAAoB,EACpB,gBAAgB,EAChB,gBAAgB,EAChB,uBAAuB,EACvB,kBAAkB,EAClB,qBAAqB,EACrB,mBAAmB,EACnB,eAAe,EACf,cAAc,EACd,gBAAgB,EAChB,kBAAkB,EAClB,4BAA4B,EAC5B,sBAAsB,EACtB,aAAa,EACb,sBAAsB,EACtB,qBAAqB,
|
|
1
|
+
{"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../src/agent.ts"],"names":[],"mappings":"AAAA,OAAc,EAAE,KAAK,aAAa,EAAE,MAAM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