@elizaos/plugin-ngrok 2.0.0-beta.1 โ 2.0.11-beta.7
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/LICENSE +21 -0
- package/README.md +38 -294
- package/package.json +24 -7
- package/src/__tests__/test-utils.ts +2 -2
- package/src/__tests__/unit/environment.test.ts +1 -1
- package/dist/__tests__/NgrokTestSuite.d.ts +0 -6
- package/dist/__tests__/NgrokTestSuite.d.ts.map +0 -1
- package/dist/__tests__/NgrokTestSuite.js +0 -92
- package/dist/__tests__/NgrokTestSuite.js.map +0 -1
- package/dist/actions/get-tunnel-status.d.ts +0 -4
- package/dist/actions/get-tunnel-status.d.ts.map +0 -1
- package/dist/actions/get-tunnel-status.js +0 -186
- package/dist/actions/get-tunnel-status.js.map +0 -1
- package/dist/actions/start-tunnel.d.ts +0 -4
- package/dist/actions/start-tunnel.d.ts.map +0 -1
- package/dist/actions/start-tunnel.js +0 -221
- package/dist/actions/start-tunnel.js.map +0 -1
- package/dist/actions/stop-tunnel.d.ts +0 -4
- package/dist/actions/stop-tunnel.d.ts.map +0 -1
- package/dist/actions/stop-tunnel.js +0 -174
- package/dist/actions/stop-tunnel.js.map +0 -1
- package/dist/environment.d.ts +0 -12
- package/dist/environment.d.ts.map +0 -1
- package/dist/environment.js +0 -68
- package/dist/environment.js.map +0 -1
- package/dist/index.d.ts +0 -13
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -29
- package/dist/index.js.map +0 -1
- package/dist/services/NgrokService.d.ts +0 -30
- package/dist/services/NgrokService.d.ts.map +0 -1
- package/dist/services/NgrokService.js +0 -333
- package/dist/services/NgrokService.js.map +0 -1
- package/src/__tests__/e2e/real-ngrok.test.ts +0 -543
- package/src/__tests__/unit/actions.test.ts +0 -402
- package/src/actions/get-tunnel-status.ts +0 -218
- package/src/actions/start-tunnel.ts +0 -255
- package/src/actions/stop-tunnel.ts +0 -203
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Shaw Walters and elizaOS Contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,325 +1,69 @@
|
|
|
1
1
|
# @elizaos/plugin-ngrok
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Ngrok tunnel backend plugin for elizaOS. Implements the `ITunnelService` contract from `@elizaos/plugin-tunnel`, enabling Eliza agents to expose local HTTP ports via secure ngrok HTTPS tunnels.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## What it does
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
When loaded alongside `@elizaos/plugin-tunnel`, this plugin registers `NgrokService` under the shared `"tunnel"` service slot. The `TUNNEL` action (provided by `plugin-tunnel`) then delegates start/stop/status operations to ngrok. If another tunnel backend (such as a cloud tunnel service) has already claimed the slot, this plugin skips registration silently โ first-active-wins.
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
- ๐ **Web Dashboard**: Real-time monitoring and management of active tunnels
|
|
11
|
-
- ๐ง **Full API**: RESTful API for programmatic tunnel management
|
|
12
|
-
- ๐งช **100% Test Coverage**: Comprehensive unit, integration, E2E, and Cypress tests
|
|
13
|
-
- ๐ฏ **TypeScript**: Fully typed for excellent developer experience
|
|
14
|
-
- ๐ **Secure**: Built-in auth token support and secure tunnel management
|
|
9
|
+
This plugin adds **no new agent actions**. Tunnel control is handled by the `TUNNEL` action in `@elizaos/plugin-tunnel`.
|
|
15
10
|
|
|
16
|
-
##
|
|
17
|
-
|
|
18
|
-
```bash
|
|
19
|
-
npm install @elizaos/plugin-ngrok
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
## Quick Start
|
|
23
|
-
|
|
24
|
-
1. **Get your ngrok auth token** (optional but recommended):
|
|
25
|
-
|
|
26
|
-
- Visit [ngrok.com](https://dashboard.ngrok.com/get-started/your-authtoken)
|
|
27
|
-
- Sign up for a free account
|
|
28
|
-
- Copy your auth token
|
|
29
|
-
|
|
30
|
-
2. **Configure your environment**:
|
|
31
|
-
|
|
32
|
-
```bash
|
|
33
|
-
# .env file
|
|
34
|
-
NGROK_AUTH_TOKEN=your_auth_token_here # Optional but recommended
|
|
35
|
-
NGROK_REGION=us # Optional: us, eu, ap, au, sa, jp, in
|
|
36
|
-
NGROK_SUBDOMAIN=my-app # Optional: requires paid plan
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
3. **Use in your agent**:
|
|
40
|
-
|
|
41
|
-
```typescript
|
|
42
|
-
import ngrokPlugin from '@elizaos/plugin-ngrok';
|
|
43
|
-
|
|
44
|
-
const agent = new Agent({
|
|
45
|
-
plugins: [ngrokPlugin],
|
|
46
|
-
// ... other config
|
|
47
|
-
});
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
## Web Dashboard
|
|
11
|
+
## Requirements
|
|
51
12
|
|
|
52
|
-
The
|
|
53
|
-
|
|
54
|
-
### Running the Dashboard
|
|
13
|
+
- The `ngrok` CLI must be installed and available on `PATH`.
|
|
55
14
|
|
|
56
15
|
```bash
|
|
57
|
-
#
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
# Or run them separately:
|
|
61
|
-
npm run demo:api # Start API server on port 3001
|
|
62
|
-
npm run dev # Start dashboard on port 5173
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
Visit http://localhost:5173 to access the dashboard.
|
|
66
|
-
|
|
67
|
-
### Dashboard Features
|
|
68
|
-
|
|
69
|
-
- **Real-time Status**: Monitor active tunnels with live updates
|
|
70
|
-
- **Easy Management**: Start/stop tunnels with a single click
|
|
71
|
-
- **Configuration**: Set port, region, and custom subdomains
|
|
72
|
-
- **Copy URL**: Quick copy button for sharing tunnel URLs
|
|
73
|
-
- **Responsive Design**: Works perfectly on desktop and mobile
|
|
74
|
-
- **Auto-refresh**: Status updates every 5 seconds
|
|
75
|
-
|
|
76
|
-
## Available Actions
|
|
77
|
-
|
|
78
|
-
The plugin provides three main actions:
|
|
79
|
-
|
|
80
|
-
### START_TUNNEL
|
|
81
|
-
|
|
82
|
-
Starts a new ngrok tunnel on the specified port.
|
|
83
|
-
|
|
84
|
-
```typescript
|
|
85
|
-
// Example usage in agent
|
|
86
|
-
'Can you start a tunnel on port 3000?';
|
|
87
|
-
'Open ngrok on port 8080 in the EU region';
|
|
88
|
-
"Create a tunnel with subdomain 'my-app' on port 3000";
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
### STOP_TUNNEL
|
|
92
|
-
|
|
93
|
-
Stops the currently active tunnel.
|
|
94
|
-
|
|
95
|
-
```typescript
|
|
96
|
-
'Stop the tunnel';
|
|
97
|
-
'Close ngrok';
|
|
98
|
-
'Shutdown the tunnel';
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
### GET_TUNNEL_STATUS
|
|
102
|
-
|
|
103
|
-
Gets the current status of the tunnel.
|
|
104
|
-
|
|
105
|
-
```typescript
|
|
106
|
-
"What's the tunnel status?";
|
|
107
|
-
'Is ngrok running?';
|
|
108
|
-
'Show me the tunnel URL';
|
|
109
|
-
```
|
|
110
|
-
|
|
111
|
-
## Testing
|
|
112
|
-
|
|
113
|
-
This plugin includes comprehensive test coverage across multiple test types:
|
|
114
|
-
|
|
115
|
-
### Run All Tests
|
|
116
|
-
|
|
117
|
-
```bash
|
|
118
|
-
# Run all plugin tests (unit + E2E)
|
|
119
|
-
npm test
|
|
120
|
-
|
|
121
|
-
# Run with coverage report
|
|
122
|
-
npm run test:coverage
|
|
123
|
-
```
|
|
124
|
-
|
|
125
|
-
### Unit Tests
|
|
126
|
-
|
|
127
|
-
```bash
|
|
128
|
-
# Run unit tests only
|
|
129
|
-
npm run test:unit
|
|
130
|
-
|
|
131
|
-
# Run in watch mode
|
|
132
|
-
npm run test:watch
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
### Integration Tests
|
|
136
|
-
|
|
137
|
-
```bash
|
|
138
|
-
# Run integration tests (requires ngrok installed)
|
|
139
|
-
npm run test:integration
|
|
140
|
-
```
|
|
141
|
-
|
|
142
|
-
### E2E Tests
|
|
16
|
+
# macOS
|
|
17
|
+
brew install ngrok
|
|
143
18
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
npm run test:e2e
|
|
19
|
+
# Linux
|
|
20
|
+
snap install ngrok
|
|
147
21
|
```
|
|
148
22
|
|
|
149
|
-
|
|
23
|
+
## Installation
|
|
150
24
|
|
|
151
25
|
```bash
|
|
152
|
-
|
|
153
|
-
npm run test:cypress
|
|
154
|
-
|
|
155
|
-
# Open Cypress interactive mode
|
|
156
|
-
npm run cypress:open
|
|
157
|
-
```
|
|
158
|
-
|
|
159
|
-
## API Reference
|
|
160
|
-
|
|
161
|
-
### REST API Endpoints
|
|
162
|
-
|
|
163
|
-
The plugin includes an Express API server for the dashboard:
|
|
164
|
-
|
|
165
|
-
#### GET /api/tunnel/status
|
|
166
|
-
|
|
167
|
-
Returns the current tunnel status.
|
|
168
|
-
|
|
169
|
-
**Response:**
|
|
170
|
-
|
|
171
|
-
```json
|
|
172
|
-
{
|
|
173
|
-
"active": true,
|
|
174
|
-
"url": "https://abc123.ngrok.io",
|
|
175
|
-
"port": 3000,
|
|
176
|
-
"startedAt": "2024-01-01T00:00:00.000Z",
|
|
177
|
-
"provider": "ngrok",
|
|
178
|
-
"uptime": "15 minutes"
|
|
179
|
-
}
|
|
180
|
-
```
|
|
181
|
-
|
|
182
|
-
#### POST /api/tunnel/start
|
|
183
|
-
|
|
184
|
-
Starts a new tunnel.
|
|
185
|
-
|
|
186
|
-
**Request Body:**
|
|
187
|
-
|
|
188
|
-
```json
|
|
189
|
-
{
|
|
190
|
-
"port": 3000,
|
|
191
|
-
"region": "eu", // optional
|
|
192
|
-
"subdomain": "my-app" // optional, requires paid plan
|
|
193
|
-
}
|
|
26
|
+
npm install @elizaos/plugin-ngrok
|
|
194
27
|
```
|
|
195
28
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
Stops the active tunnel.
|
|
29
|
+
## Usage
|
|
199
30
|
|
|
200
|
-
|
|
31
|
+
Load it in your agent's plugin list alongside `@elizaos/plugin-tunnel`:
|
|
201
32
|
|
|
202
33
|
```typescript
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
url: string | null;
|
|
206
|
-
port: number | null;
|
|
207
|
-
startedAt: Date | null;
|
|
208
|
-
provider: string;
|
|
209
|
-
}
|
|
34
|
+
import { tunnelPlugin } from '@elizaos/plugin-tunnel';
|
|
35
|
+
import ngrokPlugin from '@elizaos/plugin-ngrok';
|
|
210
36
|
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
subdomain?: string;
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
interface ITunnelService {
|
|
219
|
-
start(port: number): Promise<string>;
|
|
220
|
-
stop(): Promise<void>;
|
|
221
|
-
getUrl(): string | null;
|
|
222
|
-
isActive(): boolean;
|
|
223
|
-
getStatus(): TunnelStatus;
|
|
224
|
-
}
|
|
37
|
+
const agent = new AgentRuntime({
|
|
38
|
+
plugins: [tunnelPlugin, ngrokPlugin],
|
|
39
|
+
// ...
|
|
40
|
+
});
|
|
225
41
|
```
|
|
226
42
|
|
|
227
|
-
##
|
|
228
|
-
|
|
229
|
-
### Project Structure
|
|
230
|
-
|
|
231
|
-
```
|
|
232
|
-
plugin-ngrok/
|
|
233
|
-
โโโ src/
|
|
234
|
-
โ โโโ actions/ # Agent actions
|
|
235
|
-
โ โโโ services/ # NgrokService implementation
|
|
236
|
-
โ โโโ types/ # TypeScript types
|
|
237
|
-
โ โโโ frontend/ # React dashboard
|
|
238
|
-
โ โโโ __tests__/ # Test suites
|
|
239
|
-
โโโ demo/ # Demo applications
|
|
240
|
-
โโโ cypress/ # Cypress E2E tests
|
|
241
|
-
โโโ dist/ # Build output
|
|
242
|
-
```
|
|
243
|
-
|
|
244
|
-
### Building
|
|
245
|
-
|
|
246
|
-
```bash
|
|
247
|
-
# Build plugin and dashboard
|
|
248
|
-
npm run build
|
|
249
|
-
|
|
250
|
-
# Build plugin only
|
|
251
|
-
tsup src/index.ts --format esm --dts
|
|
252
|
-
|
|
253
|
-
# Build dashboard only
|
|
254
|
-
vite build
|
|
255
|
-
```
|
|
256
|
-
|
|
257
|
-
### Development Mode
|
|
258
|
-
|
|
259
|
-
```bash
|
|
260
|
-
# Watch plugin changes
|
|
261
|
-
npm run dev:plugin
|
|
262
|
-
|
|
263
|
-
# Run dashboard dev server
|
|
264
|
-
npm run dev
|
|
265
|
-
|
|
266
|
-
# Run everything in dev mode
|
|
267
|
-
npm run demo:full
|
|
268
|
-
```
|
|
269
|
-
|
|
270
|
-
## Environment Variables
|
|
271
|
-
|
|
272
|
-
| Variable | Description | Default | Required |
|
|
273
|
-
| -------------------- | ------------------------------------------ | ------- | -------------------- |
|
|
274
|
-
| `NGROK_AUTH_TOKEN` | Your ngrok authentication token | - | No (but recommended) |
|
|
275
|
-
| `NGROK_REGION` | Tunnel region (us, eu, ap, au, sa, jp, in) | us | No |
|
|
276
|
-
| `NGROK_SUBDOMAIN` | Custom subdomain (requires paid plan) | - | No |
|
|
277
|
-
| `NGROK_DEFAULT_PORT` | Default port for tunnels | 3000 | No |
|
|
278
|
-
| `API_PORT` | Port for the API server | 3001 | No |
|
|
279
|
-
|
|
280
|
-
## Troubleshooting
|
|
281
|
-
|
|
282
|
-
### Ngrok not installed
|
|
283
|
-
|
|
284
|
-
If you see "ngrok is not installed", install it using:
|
|
285
|
-
|
|
286
|
-
```bash
|
|
287
|
-
# macOS
|
|
288
|
-
brew install ngrok
|
|
289
|
-
|
|
290
|
-
# Linux
|
|
291
|
-
snap install ngrok
|
|
292
|
-
|
|
293
|
-
# Windows
|
|
294
|
-
choco install ngrok
|
|
295
|
-
```
|
|
296
|
-
|
|
297
|
-
### Auth token issues
|
|
298
|
-
|
|
299
|
-
Without an auth token, tunnels will have limited functionality. Get a free token at [ngrok.com](https://dashboard.ngrok.com/get-started/your-authtoken).
|
|
300
|
-
|
|
301
|
-
### Port already in use
|
|
43
|
+
## Configuration
|
|
302
44
|
|
|
303
|
-
|
|
45
|
+
All variables are read from `runtime.getSetting()` first, then `process.env`.
|
|
304
46
|
|
|
305
|
-
|
|
47
|
+
| Variable | Required | Default | Description |
|
|
48
|
+
|----------|----------|---------|-------------|
|
|
49
|
+
| `NGROK_AUTH_TOKEN` | No | โ | ngrok account auth token. Without it, tunnels are anonymous and session-limited. |
|
|
50
|
+
| `NGROK_REGION` | No | `us` | Tunnel region: `us`, `eu`, `ap`, `au`, `sa`, `jp`, `in` |
|
|
51
|
+
| `NGROK_DOMAIN` | No | โ | Static domain (e.g. `my-agent.ngrok-free.app`). Required for pay-as-you-go accounts. |
|
|
52
|
+
| `NGROK_SUBDOMAIN` | No | โ | Custom subdomain (requires paid ngrok plan). |
|
|
53
|
+
| `NGROK_DEFAULT_PORT` | No | `3000` | Default port to tunnel (also aliased from `NGROK_TUNNEL_PORT`). |
|
|
54
|
+
| `NGROK_USE_RANDOM_SUBDOMAIN` | No | โ | Set `true` to force a random URL even when a domain/subdomain is configured. |
|
|
306
55
|
|
|
307
|
-
|
|
56
|
+
### Getting an ngrok auth token
|
|
308
57
|
|
|
309
|
-
1.
|
|
310
|
-
2.
|
|
311
|
-
3.
|
|
312
|
-
4. Ensure all tests pass (`npm test`)
|
|
313
|
-
5. Commit your changes (`git commit -m 'Add amazing feature'`)
|
|
314
|
-
6. Push to the branch (`git push origin feature/amazing-feature`)
|
|
315
|
-
7. Open a Pull Request
|
|
58
|
+
1. Sign up at [dashboard.ngrok.com](https://dashboard.ngrok.com/get-started/your-authtoken)
|
|
59
|
+
2. Copy your auth token
|
|
60
|
+
3. Set `NGROK_AUTH_TOKEN=<token>` in your environment or agent config
|
|
316
61
|
|
|
317
|
-
|
|
62
|
+
### Pay-as-you-go accounts
|
|
318
63
|
|
|
319
|
-
|
|
64
|
+
If you see `ERR_NGROK_15002`, your account requires a registered domain. Set `NGROK_DOMAIN` to a domain registered in your ngrok dashboard (e.g. `NGROK_DOMAIN=my-agent.ngrok-free.app`).
|
|
320
65
|
|
|
321
|
-
##
|
|
66
|
+
## How it works
|
|
322
67
|
|
|
323
|
-
|
|
68
|
+
`NgrokService` spawns the `ngrok http <port>` CLI subprocess and polls `http://localhost:4040/api/tunnels` (ngrok's local API) to discover the public HTTPS URL. It retries up to 3 times at 2-second intervals. Once the URL is obtained, it is exposed via `getUrl()` and `getStatus()`.
|
|
324
69
|
|
|
325
|
-
For questions and discussions, join the ElizaOS community on Discord.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elizaos/plugin-ngrok",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.11-beta.7",
|
|
4
4
|
"description": "Ngrok tunnel plugin for elizaOS โ third-party backend implementing the @elizaos/plugin-tunnel ITunnelService contract.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -10,8 +10,24 @@
|
|
|
10
10
|
"./package.json": "./package.json",
|
|
11
11
|
".": {
|
|
12
12
|
"types": "./dist/index.d.ts",
|
|
13
|
+
"eliza-source": {
|
|
14
|
+
"types": "./src/index.ts",
|
|
15
|
+
"import": "./src/index.ts",
|
|
16
|
+
"default": "./src/index.ts"
|
|
17
|
+
},
|
|
13
18
|
"import": "./dist/index.js",
|
|
14
19
|
"default": "./dist/index.js"
|
|
20
|
+
},
|
|
21
|
+
"./*.css": "./dist/*.css",
|
|
22
|
+
"./*": {
|
|
23
|
+
"types": "./dist/*.d.ts",
|
|
24
|
+
"eliza-source": {
|
|
25
|
+
"types": "./src/*.ts",
|
|
26
|
+
"import": "./src/*.ts",
|
|
27
|
+
"default": "./src/*.ts"
|
|
28
|
+
},
|
|
29
|
+
"import": "./dist/*.js",
|
|
30
|
+
"default": "./dist/*.js"
|
|
15
31
|
}
|
|
16
32
|
},
|
|
17
33
|
"files": [
|
|
@@ -21,7 +37,7 @@
|
|
|
21
37
|
"scripts": {
|
|
22
38
|
"build": "tsc --noCheck -p tsconfig.json",
|
|
23
39
|
"dev": "tsc --watch",
|
|
24
|
-
"typecheck": "
|
|
40
|
+
"typecheck": "tsgo --noEmit",
|
|
25
41
|
"test": "bun run --cwd ../plugin-tunnel build && bun test",
|
|
26
42
|
"test:unit": "bun test src/__tests__/unit/",
|
|
27
43
|
"lint": "bunx @biomejs/biome check --write --unsafe .",
|
|
@@ -37,12 +53,12 @@
|
|
|
37
53
|
"networking"
|
|
38
54
|
],
|
|
39
55
|
"peerDependencies": {
|
|
40
|
-
"@elizaos/core": "2.0.
|
|
41
|
-
"@elizaos/plugin-tunnel": "2.0.
|
|
56
|
+
"@elizaos/core": "2.0.11-beta.7",
|
|
57
|
+
"@elizaos/plugin-tunnel": "2.0.11-beta.7"
|
|
42
58
|
},
|
|
43
59
|
"dependencies": {
|
|
44
|
-
"@elizaos/core": "2.0.
|
|
45
|
-
"@elizaos/plugin-tunnel": "2.0.
|
|
60
|
+
"@elizaos/core": "2.0.11-beta.7",
|
|
61
|
+
"@elizaos/plugin-tunnel": "2.0.11-beta.7",
|
|
46
62
|
"@ngrok/ngrok": "^1.5.1",
|
|
47
63
|
"zod": "^4.4.2"
|
|
48
64
|
},
|
|
@@ -59,5 +75,6 @@
|
|
|
59
75
|
"agentConfig": {
|
|
60
76
|
"pluginType": "elizaos:plugin:1.0.0",
|
|
61
77
|
"pluginParameters": {}
|
|
62
|
-
}
|
|
78
|
+
},
|
|
79
|
+
"gitHead": "cdbc876f793d96073d7eb0d09715a031ce0cd32e"
|
|
63
80
|
}
|
|
@@ -78,9 +78,9 @@ export function createMockRuntime(overrides: MockRuntimeOverrides = {}): IAgentR
|
|
|
78
78
|
|
|
79
79
|
// Ngrok-specific services
|
|
80
80
|
getService: <T extends Service>(name: ServiceTypeName | string): T | null => {
|
|
81
|
-
const
|
|
81
|
+
const testRuntime = { agentId: 'mock' } as IAgentRuntime;
|
|
82
82
|
const defaults: Record<string, Service> = {
|
|
83
|
-
'ngrok-tunnel': new MockNgrokService(
|
|
83
|
+
'ngrok-tunnel': new MockNgrokService(testRuntime),
|
|
84
84
|
};
|
|
85
85
|
const merged: Record<string, Service | null | undefined> = {
|
|
86
86
|
...defaults,
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"NgrokTestSuite.d.ts","sourceRoot":"","sources":["../../src/__tests__/NgrokTestSuite.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,QAAQ,EAAE,MAAM,eAAe,CAAC;AAG7D,qBAAa,cAAc;IACzB,IAAI,SAAW;IACf,KAAK,EAAE,QAAQ,EAAE,CAuGf;CACH"}
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import { NgrokService } from '../services/NgrokService';
|
|
2
|
-
export class NgrokTestSuite {
|
|
3
|
-
name = 'ngrok';
|
|
4
|
-
tests = [
|
|
5
|
-
{
|
|
6
|
-
name: 'Initialize Ngrok Service',
|
|
7
|
-
fn: async (runtime) => {
|
|
8
|
-
// Test service initialization
|
|
9
|
-
const service = new NgrokService(runtime);
|
|
10
|
-
// Verify service is initialized
|
|
11
|
-
if (!service) {
|
|
12
|
-
throw new Error('Failed to initialize Ngrok service');
|
|
13
|
-
}
|
|
14
|
-
if (!(service instanceof NgrokService)) {
|
|
15
|
-
throw new Error('Service is not instance of NgrokService');
|
|
16
|
-
}
|
|
17
|
-
},
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
name: 'Start and Stop Tunnel',
|
|
21
|
-
fn: async (runtime) => {
|
|
22
|
-
const service = new NgrokService(runtime);
|
|
23
|
-
// Test starting tunnel
|
|
24
|
-
const url = await service.startTunnel(3000);
|
|
25
|
-
if (!url?.startsWith('https://')) {
|
|
26
|
-
throw new Error('Failed to start tunnel or invalid URL returned');
|
|
27
|
-
}
|
|
28
|
-
// Verify tunnel is active
|
|
29
|
-
if (!service.isActive()) {
|
|
30
|
-
throw new Error('Tunnel should be active after starting');
|
|
31
|
-
}
|
|
32
|
-
// Test getting status
|
|
33
|
-
const status = service.getStatus();
|
|
34
|
-
if (!status.active || status.port !== 3000) {
|
|
35
|
-
throw new Error('Invalid tunnel status');
|
|
36
|
-
}
|
|
37
|
-
// Test stopping tunnel
|
|
38
|
-
await service.stopTunnel();
|
|
39
|
-
// Verify tunnel is stopped
|
|
40
|
-
if (service.isActive()) {
|
|
41
|
-
throw new Error('Tunnel should not be active after stopping');
|
|
42
|
-
}
|
|
43
|
-
},
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
name: 'Service Registration',
|
|
47
|
-
fn: async (runtime) => {
|
|
48
|
-
// Test that service can be registered and retrieved
|
|
49
|
-
const _service = new NgrokService(runtime);
|
|
50
|
-
// In a real test, we would register the service with runtime
|
|
51
|
-
// and then retrieve it to verify registration
|
|
52
|
-
const serviceType = NgrokService.serviceType;
|
|
53
|
-
if (serviceType !== 'tunnel') {
|
|
54
|
-
throw new Error('Service type should be "tunnel"');
|
|
55
|
-
}
|
|
56
|
-
},
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
name: 'Tunnel Status When Inactive',
|
|
60
|
-
fn: async (runtime) => {
|
|
61
|
-
const service = new NgrokService(runtime);
|
|
62
|
-
// Get status when tunnel is not active
|
|
63
|
-
const status = service.getStatus();
|
|
64
|
-
if (status.active) {
|
|
65
|
-
throw new Error('Tunnel should not be active initially');
|
|
66
|
-
}
|
|
67
|
-
if (status.url !== null || status.port !== null) {
|
|
68
|
-
throw new Error('URL and port should be null when inactive');
|
|
69
|
-
}
|
|
70
|
-
if (status.provider !== 'ngrok') {
|
|
71
|
-
throw new Error('Provider should always be "ngrok"');
|
|
72
|
-
}
|
|
73
|
-
},
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
name: 'Multiple Start Attempts',
|
|
77
|
-
fn: async (runtime) => {
|
|
78
|
-
const service = new NgrokService(runtime);
|
|
79
|
-
// Start tunnel
|
|
80
|
-
const url1 = await service.startTunnel(3000);
|
|
81
|
-
// Try to start again (should return same URL)
|
|
82
|
-
const url2 = await service.startTunnel(3000);
|
|
83
|
-
if (url1 !== url2) {
|
|
84
|
-
throw new Error('Starting tunnel twice should return the same URL');
|
|
85
|
-
}
|
|
86
|
-
// Clean up
|
|
87
|
-
await service.stopTunnel();
|
|
88
|
-
},
|
|
89
|
-
},
|
|
90
|
-
];
|
|
91
|
-
}
|
|
92
|
-
//# sourceMappingURL=NgrokTestSuite.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"NgrokTestSuite.js","sourceRoot":"","sources":["../../src/__tests__/NgrokTestSuite.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAExD,MAAM,OAAO,cAAc;IACzB,IAAI,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