@openserv-labs/sdk 1.8.1 → 2.0.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 +217 -5
- package/dist/agent.d.ts +13 -25
- package/dist/agent.d.ts.map +1 -1
- package/dist/agent.js +46 -11
- package/dist/index.d.ts +4 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -7
- package/dist/logger.d.ts.map +1 -1
- package/dist/logger.js +18 -4
- package/dist/mcp.d.ts +8 -8
- package/dist/run.d.ts +58 -0
- package/dist/run.d.ts.map +1 -0
- package/dist/run.js +108 -0
- package/dist/tunnel.d.ts +189 -0
- package/dist/tunnel.d.ts.map +1 -0
- package/dist/tunnel.js +803 -0
- package/dist/types.d.ts +198 -2938
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +0 -305
- package/package.json +5 -1
package/README.md
CHANGED
|
@@ -6,9 +6,42 @@
|
|
|
6
6
|
|
|
7
7
|
A powerful TypeScript framework for building non-deterministic AI agents with advanced cognitive capabilities like reasoning, decision-making, and inter-agent collaboration within the OpenServ platform. Built with strong typing, extensible architecture, and a fully autonomous agent runtime.
|
|
8
8
|
|
|
9
|
+
## What's New in v2
|
|
10
|
+
|
|
11
|
+
Version 2.0.0 introduces built-in tunnel support for local development, eliminating the need to deploy your agent to test it with the OpenServ platform.
|
|
12
|
+
|
|
13
|
+
### Key Changes
|
|
14
|
+
|
|
15
|
+
- **Built-in Tunnel for Local Development** - New `run()` function and `OpenServTunnel` class create a secure WebSocket connection to OpenServ, allowing you to develop and test locally without deploying. No need to configure an Agent Endpoint URL during development.
|
|
16
|
+
- **Automatic Port Fallback** - If your preferred port is busy, the agent automatically finds an available port instead of failing.
|
|
17
|
+
- **Secrets Management** - New `getSecrets()` and `getSecretValue()` methods allow agents to securely access workspace secrets.
|
|
18
|
+
- **Delete File Support** - New `deleteFile()` method for workspace file management.
|
|
19
|
+
- **Increased Request Size Limit** - Body parser limit increased to 10MB for larger payloads.
|
|
20
|
+
- **Enhanced Logging** - Added pino-pretty for more readable log output during development.
|
|
21
|
+
|
|
22
|
+
### Migration from v1.x
|
|
23
|
+
|
|
24
|
+
The v2 API is backwards compatible. To take advantage of the new tunnel feature for local development, simply replace:
|
|
25
|
+
|
|
26
|
+
```typescript
|
|
27
|
+
// v1.x - Required deploying to a public URL
|
|
28
|
+
agent.start()
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
With:
|
|
32
|
+
|
|
33
|
+
```typescript
|
|
34
|
+
// v2.x - Works locally without deployment
|
|
35
|
+
import { run } from '@openserv-labs/sdk'
|
|
36
|
+
const { stop } = await run(agent)
|
|
37
|
+
```
|
|
38
|
+
|
|
9
39
|
## Table of Contents
|
|
10
40
|
|
|
11
41
|
- [OpenServ TypeScript SDK, Autonomous AI Agent Development Framework](#openserv-typescript-sdk-autonomous-ai-agent-development-framework)
|
|
42
|
+
- [What's New in v2](#whats-new-in-v2)
|
|
43
|
+
- [Key Changes](#key-changes)
|
|
44
|
+
- [Migration from v1.x](#migration-from-v1x)
|
|
12
45
|
- [Table of Contents](#table-of-contents)
|
|
13
46
|
- [Features](#features)
|
|
14
47
|
- [Framework Architecture](#framework-architecture)
|
|
@@ -39,10 +72,24 @@ A powerful TypeScript framework for building non-deterministic AI agents with ad
|
|
|
39
72
|
- [Workspace Management](#workspace-management)
|
|
40
73
|
- [Get Files](#get-files)
|
|
41
74
|
- [Upload File](#upload-file)
|
|
75
|
+
- [Delete File](#delete-file)
|
|
76
|
+
- [Secrets Management](#secrets-management)
|
|
77
|
+
- [Get Secrets](#get-secrets)
|
|
78
|
+
- [Get Secret Value](#get-secret-value)
|
|
42
79
|
- [Integration Management](#integration-management)
|
|
43
80
|
- [Call Integration](#call-integration)
|
|
44
81
|
- [MCP](#mcp)
|
|
82
|
+
- [Configure MCP servers](#configure-mcp-servers)
|
|
83
|
+
- [Local (stdio) transport](#local-stdio-transport)
|
|
84
|
+
- [Server-Sent Events (sse) transport](#server-sent-events-sse-transport)
|
|
85
|
+
- [Using MCP tools](#using-mcp-tools)
|
|
45
86
|
- [Advanced Usage](#advanced-usage)
|
|
87
|
+
- [Local Development with Tunnel](#local-development-with-tunnel)
|
|
88
|
+
- [How It Works](#how-it-works)
|
|
89
|
+
- [Quick Start](#quick-start-1)
|
|
90
|
+
- [Tunnel vs. Deployed Endpoint](#tunnel-vs-deployed-endpoint)
|
|
91
|
+
- [Configuration Options](#configuration-options)
|
|
92
|
+
- [Using the Tunnel Directly](#using-the-tunnel-directly)
|
|
46
93
|
- [OpenAI Process Runtime](#openai-process-runtime)
|
|
47
94
|
- [Error Handling](#error-handling)
|
|
48
95
|
- [Custom Agents](#custom-agents)
|
|
@@ -64,6 +111,7 @@ A powerful TypeScript framework for building non-deterministic AI agents with ad
|
|
|
64
111
|
- 📝 Strong TypeScript typing with Zod schemas
|
|
65
112
|
- 📊 Built-in logging and error handling
|
|
66
113
|
- 🎯 Three levels of control for different development needs
|
|
114
|
+
- 🚇 Built-in tunnel for local development and testing
|
|
67
115
|
|
|
68
116
|
## Framework Architecture
|
|
69
117
|
|
|
@@ -257,15 +305,21 @@ agent.addCapabilities([
|
|
|
257
305
|
|
|
258
306
|
// Start the agent server
|
|
259
307
|
agent.start()
|
|
308
|
+
|
|
309
|
+
// Or use run() for local development with automatic tunnel management
|
|
310
|
+
// import { run } from '@openserv-labs/sdk'
|
|
311
|
+
// const { stop } = await run(agent)
|
|
260
312
|
```
|
|
261
313
|
|
|
262
314
|
## Environment Variables
|
|
263
315
|
|
|
264
|
-
| Variable
|
|
265
|
-
|
|
|
266
|
-
| `OPENSERV_API_KEY`
|
|
267
|
-
| `OPENAI_API_KEY`
|
|
268
|
-
| `PORT`
|
|
316
|
+
| Variable | Description | Required | Default |
|
|
317
|
+
| --------------------- | ------------------------------------------ | -------- | ---------------------------------- |
|
|
318
|
+
| `OPENSERV_API_KEY` | Your OpenServ API key | Yes | - |
|
|
319
|
+
| `OPENAI_API_KEY` | OpenAI API key (for process() method) | No\* | - |
|
|
320
|
+
| `PORT` | Server port | No | 7378 |
|
|
321
|
+
| `OPENSERV_AUTH_TOKEN` | Token for authenticating incoming requests | No | - |
|
|
322
|
+
| `OPENSERV_PROXY_URL` | Custom proxy URL for tunnel connections | No | `https://agents-proxy.openserv.ai` |
|
|
269
323
|
|
|
270
324
|
\*Required if using OpenAI integration features
|
|
271
325
|
|
|
@@ -528,6 +582,61 @@ await agent.uploadFile({
|
|
|
528
582
|
})
|
|
529
583
|
```
|
|
530
584
|
|
|
585
|
+
#### Delete File
|
|
586
|
+
|
|
587
|
+
```typescript
|
|
588
|
+
await agent.deleteFile({
|
|
589
|
+
workspaceId: number | string,
|
|
590
|
+
fileId: number
|
|
591
|
+
})
|
|
592
|
+
```
|
|
593
|
+
|
|
594
|
+
### Secrets Management
|
|
595
|
+
|
|
596
|
+
Agents can securely access secrets configured in their workspace. Secrets are managed through the OpenServ platform.
|
|
597
|
+
|
|
598
|
+
#### Get Secrets
|
|
599
|
+
|
|
600
|
+
Returns a list of all secrets available to the agent in a workspace.
|
|
601
|
+
|
|
602
|
+
```typescript
|
|
603
|
+
const secrets = await agent.getSecrets({
|
|
604
|
+
workspaceId: number | string
|
|
605
|
+
})
|
|
606
|
+
// Returns: { id: number, name: string }[]
|
|
607
|
+
```
|
|
608
|
+
|
|
609
|
+
#### Get Secret Value
|
|
610
|
+
|
|
611
|
+
Retrieves the actual value of a specific secret.
|
|
612
|
+
|
|
613
|
+
```typescript
|
|
614
|
+
const value = await agent.getSecretValue({
|
|
615
|
+
workspaceId: number | string,
|
|
616
|
+
secretId: number
|
|
617
|
+
})
|
|
618
|
+
// Returns: string
|
|
619
|
+
```
|
|
620
|
+
|
|
621
|
+
**Example:**
|
|
622
|
+
|
|
623
|
+
```typescript
|
|
624
|
+
// Get all available secrets
|
|
625
|
+
const secrets = await agent.getSecrets({ workspaceId: 123 })
|
|
626
|
+
|
|
627
|
+
// Find a specific secret by name
|
|
628
|
+
const apiKeySecret = secrets.find(s => s.name === 'EXTERNAL_API_KEY')
|
|
629
|
+
|
|
630
|
+
if (apiKeySecret) {
|
|
631
|
+
// Retrieve the secret value
|
|
632
|
+
const apiKey = await agent.getSecretValue({
|
|
633
|
+
workspaceId: 123,
|
|
634
|
+
secretId: apiKeySecret.id
|
|
635
|
+
})
|
|
636
|
+
// Use the secret value securely
|
|
637
|
+
}
|
|
638
|
+
```
|
|
639
|
+
|
|
531
640
|
### Integration Management
|
|
532
641
|
|
|
533
642
|
#### Call Integration
|
|
@@ -633,6 +742,109 @@ You can also access the raw MCP client via `agent.mcpClients['MCP_SERVER_ID']` t
|
|
|
633
742
|
|
|
634
743
|
## Advanced Usage
|
|
635
744
|
|
|
745
|
+
### Local Development with Tunnel
|
|
746
|
+
|
|
747
|
+
The SDK provides a built-in tunnel that connects your locally running agent to the OpenServ platform. This eliminates the need to deploy your agent to a public URL during development.
|
|
748
|
+
|
|
749
|
+
#### How It Works
|
|
750
|
+
|
|
751
|
+
When you use the `run()` function or `OpenServTunnel` class:
|
|
752
|
+
|
|
753
|
+
1. Your agent starts an HTTP server locally (default port 7378)
|
|
754
|
+
2. A WebSocket connection is established to OpenServ's proxy server
|
|
755
|
+
3. The proxy authenticates your agent using your `OPENSERV_API_KEY`
|
|
756
|
+
4. OpenServ routes incoming tasks through the tunnel to your local machine
|
|
757
|
+
|
|
758
|
+
**No Agent Endpoint URL configuration is needed during local development.** The tunnel connection is identified by your API key, which is already associated with your registered agent in the OpenServ platform.
|
|
759
|
+
|
|
760
|
+
#### Quick Start
|
|
761
|
+
|
|
762
|
+
```typescript
|
|
763
|
+
import { Agent, run } from '@openserv-labs/sdk'
|
|
764
|
+
import { z } from 'zod'
|
|
765
|
+
|
|
766
|
+
const agent = new Agent({
|
|
767
|
+
systemPrompt: 'You are a helpful assistant.'
|
|
768
|
+
})
|
|
769
|
+
|
|
770
|
+
agent.addCapability({
|
|
771
|
+
name: 'greet',
|
|
772
|
+
description: 'Greet someone',
|
|
773
|
+
schema: z.object({ name: z.string() }),
|
|
774
|
+
async run({ args }) {
|
|
775
|
+
return `Hello, ${args.name}!`
|
|
776
|
+
}
|
|
777
|
+
})
|
|
778
|
+
|
|
779
|
+
// Start the agent with automatic tunnel management
|
|
780
|
+
const { tunnel, stop } = await run(agent)
|
|
781
|
+
|
|
782
|
+
// The agent is now connected to OpenServ and ready to receive tasks
|
|
783
|
+
|
|
784
|
+
// To gracefully stop the agent and tunnel:
|
|
785
|
+
await stop()
|
|
786
|
+
```
|
|
787
|
+
|
|
788
|
+
The `run()` function automatically:
|
|
789
|
+
|
|
790
|
+
- Starts the agent's HTTP server
|
|
791
|
+
- Creates a WebSocket tunnel to the OpenServ proxy
|
|
792
|
+
- Handles reconnection with exponential backoff (up to 10 retries)
|
|
793
|
+
- Registers signal handlers for graceful shutdown (SIGTERM, SIGINT)
|
|
794
|
+
|
|
795
|
+
#### Tunnel vs. Deployed Endpoint
|
|
796
|
+
|
|
797
|
+
| Aspect | Tunnel (Local Development) | Deployed Endpoint (Production) |
|
|
798
|
+
| ----------------- | -------------------------- | ------------------------------ |
|
|
799
|
+
| Setup | Just run your code | Deploy to cloud/server |
|
|
800
|
+
| URL Configuration | Not needed | Set Agent Endpoint in platform |
|
|
801
|
+
| Connection | WebSocket via proxy | Direct HTTP |
|
|
802
|
+
| Use case | Development & testing | Production |
|
|
803
|
+
|
|
804
|
+
#### Configuration Options
|
|
805
|
+
|
|
806
|
+
```typescript
|
|
807
|
+
const { tunnel, stop } = await run(agent, {
|
|
808
|
+
// Tunnel-specific options
|
|
809
|
+
tunnel: {
|
|
810
|
+
apiKey: 'your-api-key', // Defaults to OPENSERV_API_KEY env var
|
|
811
|
+
proxyUrl: 'custom-proxy-url' // Defaults to OPENSERV_PROXY_URL env var
|
|
812
|
+
},
|
|
813
|
+
// Disable automatic signal handlers if you want to handle shutdown yourself
|
|
814
|
+
handleSignals: false
|
|
815
|
+
})
|
|
816
|
+
```
|
|
817
|
+
|
|
818
|
+
#### Using the Tunnel Directly
|
|
819
|
+
|
|
820
|
+
For more advanced control, you can use the `OpenServTunnel` class directly:
|
|
821
|
+
|
|
822
|
+
```typescript
|
|
823
|
+
import { Agent, OpenServTunnel } from '@openserv-labs/sdk'
|
|
824
|
+
|
|
825
|
+
const agent = new Agent({
|
|
826
|
+
systemPrompt: 'You are a helpful assistant.'
|
|
827
|
+
})
|
|
828
|
+
|
|
829
|
+
await agent.start()
|
|
830
|
+
|
|
831
|
+
const tunnel = new OpenServTunnel({
|
|
832
|
+
apiKey: process.env.OPENSERV_API_KEY,
|
|
833
|
+
onConnected: isReconnect => {
|
|
834
|
+
console.log(isReconnect ? 'Reconnected!' : 'Connected!')
|
|
835
|
+
},
|
|
836
|
+
onError: error => {
|
|
837
|
+
console.error('Tunnel error:', error.message)
|
|
838
|
+
}
|
|
839
|
+
})
|
|
840
|
+
|
|
841
|
+
await tunnel.start(agent.port)
|
|
842
|
+
|
|
843
|
+
// Later, to stop:
|
|
844
|
+
await tunnel.stop()
|
|
845
|
+
await agent.stop()
|
|
846
|
+
```
|
|
847
|
+
|
|
636
848
|
### OpenAI Process Runtime
|
|
637
849
|
|
|
638
850
|
The framework includes built-in OpenAI function calling support through the `process()` method:
|
package/dist/agent.d.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
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, GetFilesResponse, GetSecretsResponse, UploadFileResponse, DeleteFileResponse, GetTaskDetailResponse, GetAgentsResponse, GetTasksResponse, CreateTaskResponse } from './types';
|
|
3
|
-
import type { doTaskActionSchema, respondChatMessageActionSchema } from './types';
|
|
4
|
-
import { actionSchema } from './types';
|
|
2
|
+
import type { GetFilesParams, GetSecretsParams, GetSecretValueParams, UploadFileParams, DeleteFileParams, MarkTaskAsErroredParams, CompleteTaskParams, SendChatMessageParams, GetTaskDetailParams, GetAgentsParams, GetTasksParams, CreateTaskParams, AddLogToTaskParams, RequestHumanAssistanceParams, UpdateTaskStatusParams, ProcessParams, IntegrationCallRequest, GetChatMessagesParams, AgentChatMessagesResponse, GetFilesResponse, GetSecretsResponse, UploadFileResponse, DeleteFileResponse, GetTaskDetailResponse, GetAgentsResponse, GetTasksResponse, CreateTaskResponse, ActionSchema, DoTaskActionSchema, RespondChatMessageActionSchema } from './types';
|
|
5
3
|
import type { ChatCompletionMessageParam, ChatCompletion } from 'openai/resources/chat/completions';
|
|
6
4
|
import OpenAI from 'openai';
|
|
7
5
|
import type { z } from 'zod';
|
|
@@ -44,7 +42,7 @@ export interface AgentOptions<T extends string> {
|
|
|
44
42
|
*/
|
|
45
43
|
mcpServers?: Record<T, MCPServerConfig>;
|
|
46
44
|
}
|
|
47
|
-
export declare class Agent<M extends string> {
|
|
45
|
+
export declare class Agent<M extends string = string> {
|
|
48
46
|
private options;
|
|
49
47
|
/**
|
|
50
48
|
* The Express application instance used to handle HTTP requests.
|
|
@@ -67,9 +65,9 @@ export declare class Agent<M extends string> {
|
|
|
67
65
|
/**
|
|
68
66
|
* The port number the server will listen on.
|
|
69
67
|
* Defaults to DEFAULT_PORT (7378) if not specified in options.
|
|
70
|
-
*
|
|
68
|
+
* May change if the preferred port is unavailable.
|
|
71
69
|
*/
|
|
72
|
-
|
|
70
|
+
port: number;
|
|
73
71
|
/**
|
|
74
72
|
* The system prompt used for OpenAI chat completions.
|
|
75
73
|
* This defines the base behavior and context for the agent.
|
|
@@ -148,7 +146,7 @@ export declare class Agent<M extends string> {
|
|
|
148
146
|
* @param {Function} capability.run - Function that implements the capability's behavior
|
|
149
147
|
* @param {Object} capability.run.params - Parameters for the run function
|
|
150
148
|
* @param {z.infer<S>} capability.run.params.args - Validated arguments matching the schema
|
|
151
|
-
* @param {
|
|
149
|
+
* @param {ActionSchema} [capability.run.params.action] - Optional action context
|
|
152
150
|
* @param {ChatCompletionMessageParam[]} capability.run.messages - Chat message history
|
|
153
151
|
* @returns {this} The agent instance for method chaining
|
|
154
152
|
* @throws {Error} If a capability with the same name already exists
|
|
@@ -159,7 +157,7 @@ export declare class Agent<M extends string> {
|
|
|
159
157
|
schema: S;
|
|
160
158
|
run(this: Agent<M>, params: {
|
|
161
159
|
args: z.infer<S>;
|
|
162
|
-
action?:
|
|
160
|
+
action?: ActionSchema;
|
|
163
161
|
}, messages: ChatCompletionMessageParam[]): string | Promise<string>;
|
|
164
162
|
}): this;
|
|
165
163
|
/**
|
|
@@ -182,7 +180,7 @@ export declare class Agent<M extends string> {
|
|
|
182
180
|
schema: T[K];
|
|
183
181
|
run(this: Agent<M>, params: {
|
|
184
182
|
args: z.infer<T[K]>;
|
|
185
|
-
action?:
|
|
183
|
+
action?: ActionSchema;
|
|
186
184
|
}, messages: ChatCompletionMessageParam[]): string | Promise<string>;
|
|
187
185
|
};
|
|
188
186
|
}): this;
|
|
@@ -292,18 +290,7 @@ export declare class Agent<M extends string> {
|
|
|
292
290
|
* @param {number} params.agentId - ID of the agent to get chat messages from
|
|
293
291
|
* @returns {Promise<AgentChatMessagesResponse>} List of chat messages
|
|
294
292
|
*/
|
|
295
|
-
getChatMessages(params: GetChatMessagesParams): Promise<
|
|
296
|
-
messages: {
|
|
297
|
-
message: string;
|
|
298
|
-
id: number;
|
|
299
|
-
createdAt: Date;
|
|
300
|
-
author: "agent" | "user";
|
|
301
|
-
}[];
|
|
302
|
-
agent: {
|
|
303
|
-
name: string;
|
|
304
|
-
id: number;
|
|
305
|
-
};
|
|
306
|
-
}>;
|
|
293
|
+
getChatMessages(params: GetChatMessagesParams): Promise<AgentChatMessagesResponse>;
|
|
307
294
|
/**
|
|
308
295
|
* Creates a new task in a workspace.
|
|
309
296
|
*
|
|
@@ -366,13 +353,13 @@ export declare class Agent<M extends string> {
|
|
|
366
353
|
* This method can be overridden by extending classes to customize task handling
|
|
367
354
|
* @protected
|
|
368
355
|
*/
|
|
369
|
-
protected doTask(action:
|
|
356
|
+
protected doTask(action: DoTaskActionSchema): Promise<void>;
|
|
370
357
|
/**
|
|
371
358
|
* Handle a chat message response request
|
|
372
359
|
* This method can be overridden by extending classes to customize chat handling
|
|
373
360
|
* @protected
|
|
374
361
|
*/
|
|
375
|
-
protected respondToChat(action:
|
|
362
|
+
protected respondToChat(action: RespondChatMessageActionSchema): Promise<void>;
|
|
376
363
|
/**
|
|
377
364
|
* Handles execution of a specific tool/capability.
|
|
378
365
|
*
|
|
@@ -381,7 +368,7 @@ export declare class Agent<M extends string> {
|
|
|
381
368
|
* @param {string} req.params.toolName - Name of the tool to execute
|
|
382
369
|
* @param {Object} req.body - Request body
|
|
383
370
|
* @param {z.infer<z.ZodTypeAny>} [req.body.args] - Arguments for the tool
|
|
384
|
-
* @param {
|
|
371
|
+
* @param {ActionSchema} [req.body.action] - Action context
|
|
385
372
|
* @param {ChatCompletionMessageParam[]} [req.body.messages] - Message history
|
|
386
373
|
* @returns {Promise<{result: string}>} The result of the tool execution
|
|
387
374
|
* @throws {BadRequest} If tool name is missing or tool is not found
|
|
@@ -393,7 +380,7 @@ export declare class Agent<M extends string> {
|
|
|
393
380
|
};
|
|
394
381
|
body: {
|
|
395
382
|
args?: z.infer<z.ZodTypeAny>;
|
|
396
|
-
action?:
|
|
383
|
+
action?: ActionSchema;
|
|
397
384
|
messages?: ChatCompletionMessageParam[];
|
|
398
385
|
};
|
|
399
386
|
}): Promise<{
|
|
@@ -418,6 +405,7 @@ export declare class Agent<M extends string> {
|
|
|
418
405
|
private setupRoutes;
|
|
419
406
|
/**
|
|
420
407
|
* Starts the agent's HTTP server.
|
|
408
|
+
* If the preferred port is unavailable, it will find an open port.
|
|
421
409
|
*
|
|
422
410
|
* @returns {Promise<void>} Resolves when the server has started
|
|
423
411
|
* @throws {Error} If server fails to start
|
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,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,EACrB,yBAAyB,EACzB,gBAAgB,EAEhB,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EAClB,qBAAqB,EACrB,iBAAiB,EACjB,gBAAgB,EAChB,kBAAkB,EAOlB,YAAY,EACZ,kBAAkB,EAClB,8BAA8B,EAC/B,MAAM,SAAS,CAAA;AAEhB,OAAO,KAAK,EACV,0BAA0B,EAE1B,cAAc,EACf,MAAM,mCAAmC,CAAA;AAI1C,OAAO,MAAM,MAAM,QAAQ,CAAA;AAC3B,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAC5B,OAAO,EAAE,UAAU,EAAE,MAAM,c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IG;cACa,aAAa,CAAC,MAAM,EAAE,8BAA8B;IA+BpE;;;;;;;;;;;;;OAaG;IACG,eAAe,CAAC,GAAG,EAAE;QACzB,MAAM,EAAE;YAAE,QAAQ,EAAE,MAAM,CAAA;SAAE,CAAA;QAC5B,IAAI,EAAE;YACJ,IAAI,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,UAAU,CAAC,CAAA;YAC5B,MAAM,CAAC,EAAE,YAAY,CAAA;YACrB,QAAQ,CAAC,EAAE,0BAA0B,EAAE,CAAA;SACxC,CAAA;KACF;;;IAyBD;;;;;;;OAOG;IACG,eAAe,CAAC,GAAG,EAAE;QAAE,IAAI,EAAE,OAAO,CAAA;KAAE;IAgB5C;;;;OAIG;IACH,OAAO,CAAC,WAAW;IAuBnB;;;;;;OAMG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAqF5B;;;;OAIG;IACG,IAAI;IAQV;;;OAGG;IACH,OAAO,CAAC,WAAW;IAOnB;;;;;;;;;;;;;OAaG;IACG,eAAe,CAAC,WAAW,EAAE,sBAAsB;IASzD;;;;;;;;OAQG;IACH,OAAO,CAAC,yBAAyB;CAsClC"}
|
package/dist/agent.js
CHANGED
|
@@ -12,7 +12,6 @@ const express_async_router_1 = require("express-async-router");
|
|
|
12
12
|
const helmet_1 = __importDefault(require("helmet"));
|
|
13
13
|
const hpp_1 = __importDefault(require("hpp"));
|
|
14
14
|
const logger_1 = require("./logger");
|
|
15
|
-
const types_1 = require("./types");
|
|
16
15
|
const http_errors_1 = require("http-errors");
|
|
17
16
|
const zod_to_json_schema_1 = require("zod-to-json-schema");
|
|
18
17
|
const json_schema_to_zod_1 = require("@n8n/json-schema-to-zod");
|
|
@@ -59,7 +58,7 @@ class Agent {
|
|
|
59
58
|
/**
|
|
60
59
|
* The port number the server will listen on.
|
|
61
60
|
* Defaults to DEFAULT_PORT (7378) if not specified in options.
|
|
62
|
-
*
|
|
61
|
+
* May change if the preferred port is unavailable.
|
|
63
62
|
*/
|
|
64
63
|
port;
|
|
65
64
|
/**
|
|
@@ -170,7 +169,7 @@ class Agent {
|
|
|
170
169
|
'x-openserv-key': this.apiKey
|
|
171
170
|
}
|
|
172
171
|
});
|
|
173
|
-
this.app.use(express_1.default.json());
|
|
172
|
+
this.app.use(express_1.default.json({ limit: '10mb' }));
|
|
174
173
|
this.app.use(express_1.default.urlencoded({ extended: false }));
|
|
175
174
|
this.app.use((0, hpp_1.default)());
|
|
176
175
|
this.app.use((0, helmet_1.default)());
|
|
@@ -209,7 +208,7 @@ class Agent {
|
|
|
209
208
|
* @param {Function} capability.run - Function that implements the capability's behavior
|
|
210
209
|
* @param {Object} capability.run.params - Parameters for the run function
|
|
211
210
|
* @param {z.infer<S>} capability.run.params.args - Validated arguments matching the schema
|
|
212
|
-
* @param {
|
|
211
|
+
* @param {ActionSchema} [capability.run.params.action] - Optional action context
|
|
213
212
|
* @param {ChatCompletionMessageParam[]} capability.run.messages - Chat message history
|
|
214
213
|
* @returns {this} The agent instance for method chaining
|
|
215
214
|
* @throws {Error} If a capability with the same name already exists
|
|
@@ -657,7 +656,7 @@ class Agent {
|
|
|
657
656
|
* @param {string} req.params.toolName - Name of the tool to execute
|
|
658
657
|
* @param {Object} req.body - Request body
|
|
659
658
|
* @param {z.infer<z.ZodTypeAny>} [req.body.args] - Arguments for the tool
|
|
660
|
-
* @param {
|
|
659
|
+
* @param {ActionSchema} [req.body.action] - Action context
|
|
661
660
|
* @param {ChatCompletionMessageParam[]} [req.body.messages] - Message history
|
|
662
661
|
* @returns {Promise<{result: string}>} The result of the tool execution
|
|
663
662
|
* @throws {BadRequest} If tool name is missing or tool is not found
|
|
@@ -695,7 +694,7 @@ class Agent {
|
|
|
695
694
|
*/
|
|
696
695
|
async handleRootRoute(req) {
|
|
697
696
|
try {
|
|
698
|
-
const action =
|
|
697
|
+
const action = req.body;
|
|
699
698
|
if (action.type === 'do-task') {
|
|
700
699
|
this.doTask(action);
|
|
701
700
|
}
|
|
@@ -738,17 +737,53 @@ class Agent {
|
|
|
738
737
|
}
|
|
739
738
|
/**
|
|
740
739
|
* Starts the agent's HTTP server.
|
|
740
|
+
* If the preferred port is unavailable, it will find an open port.
|
|
741
741
|
*
|
|
742
742
|
* @returns {Promise<void>} Resolves when the server has started
|
|
743
743
|
* @throws {Error} If server fails to start
|
|
744
744
|
*/
|
|
745
745
|
async start() {
|
|
746
|
+
const preferredPort = this.port;
|
|
747
|
+
// Try the preferred port first, fallback to an available port if it fails
|
|
746
748
|
await new Promise((resolve, reject) => {
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
749
|
+
const tryListen = (port, isRetry) => {
|
|
750
|
+
const server = this.app.listen(port);
|
|
751
|
+
const onListening = () => {
|
|
752
|
+
// Remove the startup handlers once listening succeeds
|
|
753
|
+
server.removeListener('error', errorHandler);
|
|
754
|
+
server.removeListener('listening', onListening);
|
|
755
|
+
if (isRetry) {
|
|
756
|
+
const address = server.address();
|
|
757
|
+
if (address && typeof address === 'object') {
|
|
758
|
+
this.port = address.port;
|
|
759
|
+
logger_1.logger.info(`Port ${preferredPort} was unavailable, using port ${this.port} instead`);
|
|
760
|
+
}
|
|
761
|
+
}
|
|
762
|
+
else {
|
|
763
|
+
logger_1.logger.info(`Agent server started on port ${this.port}`);
|
|
764
|
+
}
|
|
765
|
+
this.server = server;
|
|
766
|
+
resolve();
|
|
767
|
+
};
|
|
768
|
+
const errorHandler = (err) => {
|
|
769
|
+
// Clean up the failed server before handling the error
|
|
770
|
+
server.removeListener('error', errorHandler);
|
|
771
|
+
server.removeListener('listening', onListening);
|
|
772
|
+
// Close the failed server to release resources
|
|
773
|
+
server.close();
|
|
774
|
+
if (err.code === 'EADDRINUSE' && !isRetry) {
|
|
775
|
+
logger_1.logger.warn(`Port ${this.port} is in use, finding an available port...`);
|
|
776
|
+
// Let the OS assign an available port
|
|
777
|
+
tryListen(0, true);
|
|
778
|
+
}
|
|
779
|
+
else {
|
|
780
|
+
reject(err);
|
|
781
|
+
}
|
|
782
|
+
};
|
|
783
|
+
server.on('listening', onListening);
|
|
784
|
+
server.on('error', errorHandler);
|
|
785
|
+
};
|
|
786
|
+
tryListen(this.port, false);
|
|
752
787
|
});
|
|
753
788
|
const connectionPromises = Object.values(this.mcpClients).map(client => client.connect());
|
|
754
789
|
const results = await Promise.allSettled(connectionPromises);
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
export { Agent } from './agent';
|
|
2
2
|
export type { AgentOptions } from './agent';
|
|
3
3
|
export { Capability } from './capability';
|
|
4
|
+
export { OpenServTunnel } from './tunnel';
|
|
5
|
+
export type { OpenServTunnelOptions, RequestData, ResponseData, TunnelState, TunnelEvent } from './tunnel';
|
|
6
|
+
export { run } from './run';
|
|
7
|
+
export type { RunOptions, RunResult } from './run';
|
|
4
8
|
export type { TaskStatus, GetFilesParams, UploadFileParams, DeleteFileParams, MarkTaskAsErroredParams, CompleteTaskParams, SendChatMessageParams, GetTaskDetailParams, GetAgentsParams, GetTasksParams, CreateTaskParams, AddLogToTaskParams, RequestHumanAssistanceParams, UpdateTaskStatusParams, ProcessParams, CapabilityFuncParams, GetChatMessagesParams } from './types';
|
|
5
|
-
export { actionSchema, doTaskActionSchema, respondChatMessageActionSchema, taskStatusSchema, agentKind } from './types';
|
|
6
9
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAC/B,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAC/B,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AACzC,YAAY,EACV,qBAAqB,EACrB,WAAW,EACX,YAAY,EACZ,WAAW,EACX,WAAW,EACZ,MAAM,UAAU,CAAA;AACjB,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA;AAC3B,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAElD,YAAY,EACV,UAAU,EACV,cAAc,EACd,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,oBAAoB,EACpB,qBAAqB,EACtB,MAAM,SAAS,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.run = exports.OpenServTunnel = exports.Capability = exports.Agent = void 0;
|
|
4
4
|
var agent_1 = require("./agent");
|
|
5
5
|
Object.defineProperty(exports, "Agent", { enumerable: true, get: function () { return agent_1.Agent; } });
|
|
6
6
|
var capability_1 = require("./capability");
|
|
7
7
|
Object.defineProperty(exports, "Capability", { enumerable: true, get: function () { return capability_1.Capability; } });
|
|
8
|
-
var
|
|
9
|
-
Object.defineProperty(exports, "
|
|
10
|
-
|
|
11
|
-
Object.defineProperty(exports, "
|
|
12
|
-
Object.defineProperty(exports, "taskStatusSchema", { enumerable: true, get: function () { return types_1.taskStatusSchema; } });
|
|
13
|
-
Object.defineProperty(exports, "agentKind", { enumerable: true, get: function () { return types_1.agentKind; } });
|
|
8
|
+
var tunnel_1 = require("./tunnel");
|
|
9
|
+
Object.defineProperty(exports, "OpenServTunnel", { enumerable: true, get: function () { return tunnel_1.OpenServTunnel; } });
|
|
10
|
+
var run_1 = require("./run");
|
|
11
|
+
Object.defineProperty(exports, "run", { enumerable: true, get: function () { return run_1.run; } });
|
package/dist/logger.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,YAAY,
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,YAAY,6CAmBxB,CAAA;AAED,eAAO,MAAM,MAAM,uCAAiB,CAAA"}
|
package/dist/logger.js
CHANGED
|
@@ -5,9 +5,23 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.logger = exports.createLogger = void 0;
|
|
7
7
|
const pino_1 = __importDefault(require("pino"));
|
|
8
|
-
const createLogger = () =>
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
const createLogger = () => {
|
|
9
|
+
const isPretty = process.env.LOG_PRETTY === 'true' ||
|
|
10
|
+
(process.env.NODE_ENV !== 'production' && process.stdout.isTTY);
|
|
11
|
+
return (0, pino_1.default)({
|
|
12
|
+
name: 'openserv-agent',
|
|
13
|
+
level: process.env.LOG_LEVEL || 'info',
|
|
14
|
+
transport: isPretty
|
|
15
|
+
? {
|
|
16
|
+
target: 'pino-pretty',
|
|
17
|
+
options: {
|
|
18
|
+
colorize: true,
|
|
19
|
+
translateTime: 'SYS:standard',
|
|
20
|
+
ignore: 'pid,hostname'
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
: undefined
|
|
24
|
+
});
|
|
25
|
+
};
|
|
12
26
|
exports.createLogger = createLogger;
|
|
13
27
|
exports.logger = (0, exports.createLogger)();
|
package/dist/mcp.d.ts
CHANGED
|
@@ -46,12 +46,12 @@ export declare const mcpServerConfigSseSchema: z.ZodObject<{
|
|
|
46
46
|
/** Whether to automatically discover tools and register them as capabilities upon successful connection. Defaults to false. */
|
|
47
47
|
autoRegisterTools: z.ZodOptional<z.ZodBoolean>;
|
|
48
48
|
}, "strip", z.ZodTypeAny, {
|
|
49
|
-
url: string;
|
|
50
49
|
transport: "sse";
|
|
50
|
+
url: string;
|
|
51
51
|
autoRegisterTools?: boolean | undefined;
|
|
52
52
|
}, {
|
|
53
|
-
url: string;
|
|
54
53
|
transport: "sse";
|
|
54
|
+
url: string;
|
|
55
55
|
autoRegisterTools?: boolean | undefined;
|
|
56
56
|
}>;
|
|
57
57
|
/** Zod schema for validating MCP server configurations using 'http' (Streamable HTTP) transport. */
|
|
@@ -63,12 +63,12 @@ export declare const mcpServerConfigHttpSchema: z.ZodObject<{
|
|
|
63
63
|
/** Whether to automatically discover tools and register them as capabilities upon successful connection. Defaults to false. */
|
|
64
64
|
autoRegisterTools: z.ZodOptional<z.ZodBoolean>;
|
|
65
65
|
}, "strip", z.ZodTypeAny, {
|
|
66
|
-
url: string;
|
|
67
66
|
transport: "http";
|
|
67
|
+
url: string;
|
|
68
68
|
autoRegisterTools?: boolean | undefined;
|
|
69
69
|
}, {
|
|
70
|
-
url: string;
|
|
71
70
|
transport: "http";
|
|
71
|
+
url: string;
|
|
72
72
|
autoRegisterTools?: boolean | undefined;
|
|
73
73
|
}>;
|
|
74
74
|
/**
|
|
@@ -106,12 +106,12 @@ export declare const mcpServerConfigSchema: z.ZodDiscriminatedUnion<"transport",
|
|
|
106
106
|
/** Whether to automatically discover tools and register them as capabilities upon successful connection. Defaults to false. */
|
|
107
107
|
autoRegisterTools: z.ZodOptional<z.ZodBoolean>;
|
|
108
108
|
}, "strip", z.ZodTypeAny, {
|
|
109
|
-
url: string;
|
|
110
109
|
transport: "sse";
|
|
110
|
+
url: string;
|
|
111
111
|
autoRegisterTools?: boolean | undefined;
|
|
112
112
|
}, {
|
|
113
|
-
url: string;
|
|
114
113
|
transport: "sse";
|
|
114
|
+
url: string;
|
|
115
115
|
autoRegisterTools?: boolean | undefined;
|
|
116
116
|
}>, z.ZodObject<{
|
|
117
117
|
/** Specifies the transport type as 'http'. */
|
|
@@ -121,12 +121,12 @@ export declare const mcpServerConfigSchema: z.ZodDiscriminatedUnion<"transport",
|
|
|
121
121
|
/** Whether to automatically discover tools and register them as capabilities upon successful connection. Defaults to false. */
|
|
122
122
|
autoRegisterTools: z.ZodOptional<z.ZodBoolean>;
|
|
123
123
|
}, "strip", z.ZodTypeAny, {
|
|
124
|
-
url: string;
|
|
125
124
|
transport: "http";
|
|
125
|
+
url: string;
|
|
126
126
|
autoRegisterTools?: boolean | undefined;
|
|
127
127
|
}, {
|
|
128
|
-
url: string;
|
|
129
128
|
transport: "http";
|
|
129
|
+
url: string;
|
|
130
130
|
autoRegisterTools?: boolean | undefined;
|
|
131
131
|
}>]>;
|
|
132
132
|
/** Configuration for a single MCP server, covering all transport types. */
|