web-terminal-agent 1.0.0 → 1.1.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 +29 -49
- package/index.js +92 -20
- package/package.json +6 -4
- package/public/__manus__/debug-collector.js +821 -0
- package/public/assets/index-BwC69ZBZ.js +515 -0
- package/public/assets/index-CqQn1g4I.css +1 -0
- package/public/images/connection-orb.png +0 -0
- package/public/images/crt-background.png +0 -0
- package/public/images/terminal-frame.png +0 -0
- package/public/index.html +81 -0
package/README.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# web-terminal-agent
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**TerminalMate** - Use AI tools without the tech stuff.
|
|
4
|
+
|
|
5
|
+
A lightweight local agent that gives you a beautiful web interface to run CLI tools like Claude Code on your computer. No terminal experience required!
|
|
4
6
|
|
|
5
7
|
## Quick Start
|
|
6
8
|
|
|
@@ -8,25 +10,24 @@ A lightweight local agent that enables browser-based terminal access to your com
|
|
|
8
10
|
npx web-terminal-agent
|
|
9
11
|
```
|
|
10
12
|
|
|
11
|
-
That's it!
|
|
13
|
+
That's it! Your browser will open automatically to `http://localhost:3456` with the full web interface.
|
|
12
14
|
|
|
13
|
-
## What
|
|
15
|
+
## What does it do?
|
|
14
16
|
|
|
15
|
-
This agent runs on your computer and
|
|
17
|
+
This agent runs on your computer and provides:
|
|
16
18
|
|
|
17
|
-
-
|
|
18
|
-
|
|
19
|
-
-
|
|
20
|
-
- Install development tools
|
|
19
|
+
1. **A beautiful web interface** - No scary terminal, just a friendly UI
|
|
20
|
+
2. **Access to AI tools** - Run Claude Code, Clawdbot, and more through simple buttons
|
|
21
|
+
3. **Full terminal power** - When you need it, the terminal is there
|
|
21
22
|
|
|
22
23
|
## Security
|
|
23
24
|
|
|
24
25
|
**Your security is our priority:**
|
|
25
26
|
|
|
26
|
-
- ✅ **Localhost only** - The agent only listens on `127.0.0.1` (your computer). It cannot be accessed from the internet
|
|
27
|
-
- ✅ **You're in control** -
|
|
28
|
-
- ✅ **Transparent** - All commands are logged
|
|
29
|
-
- ✅ **Open source** - The code is fully visible
|
|
27
|
+
- ✅ **Localhost only** - The agent only listens on `127.0.0.1` (your computer). It cannot be accessed from the internet.
|
|
28
|
+
- ✅ **You're in control** - Start and stop anytime with `Ctrl+C`
|
|
29
|
+
- ✅ **Transparent** - All commands are logged so you can see what's happening
|
|
30
|
+
- ✅ **Open source** - The code is fully visible
|
|
30
31
|
|
|
31
32
|
## Installation Options
|
|
32
33
|
|
|
@@ -43,72 +44,51 @@ npm install -g web-terminal-agent
|
|
|
43
44
|
web-terminal-agent
|
|
44
45
|
```
|
|
45
46
|
|
|
46
|
-
|
|
47
|
+
## Configuration
|
|
48
|
+
|
|
49
|
+
### Change the port
|
|
47
50
|
|
|
48
51
|
```bash
|
|
49
|
-
|
|
50
|
-
cd web-terminal-agent
|
|
51
|
-
npm install
|
|
52
|
-
node index.js
|
|
52
|
+
PORT=8080 npx web-terminal-agent
|
|
53
53
|
```
|
|
54
54
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
By default, the agent runs on port `3456`. You can change this:
|
|
55
|
+
### Disable auto-open browser
|
|
58
56
|
|
|
59
57
|
```bash
|
|
60
|
-
|
|
58
|
+
NO_BROWSER=1 npx web-terminal-agent
|
|
61
59
|
```
|
|
62
60
|
|
|
63
61
|
## Requirements
|
|
64
62
|
|
|
65
63
|
- Node.js 18 or higher
|
|
66
|
-
- Works on Windows
|
|
64
|
+
- Works on **Windows**, **macOS**, and **Linux**
|
|
67
65
|
|
|
68
66
|
## How it works
|
|
69
67
|
|
|
70
|
-
1. You run
|
|
71
|
-
2. The agent starts a local server on `http://
|
|
72
|
-
3.
|
|
73
|
-
4.
|
|
74
|
-
5.
|
|
75
|
-
|
|
76
|
-
## API Endpoints
|
|
77
|
-
|
|
78
|
-
If you want to integrate with the agent programmatically:
|
|
79
|
-
|
|
80
|
-
- `GET /health` - Check if agent is running
|
|
81
|
-
- `GET /cwd` - Get current working directory
|
|
82
|
-
- `POST /execute` - Execute a command (body: `{ "command": "ls -la" }`)
|
|
83
|
-
- `GET /tools/:tool` - Check if a tool is installed
|
|
84
|
-
- `POST /tools/:tool/install` - Install a tool
|
|
85
|
-
- `WebSocket /ws` - Real-time command execution
|
|
68
|
+
1. You run `npx web-terminal-agent`
|
|
69
|
+
2. The agent starts a local server on `http://localhost:3456`
|
|
70
|
+
3. Your browser opens automatically
|
|
71
|
+
4. Use the friendly web interface to run AI tools
|
|
72
|
+
5. Press `Ctrl+C` to stop when you're done
|
|
86
73
|
|
|
87
74
|
## Troubleshooting
|
|
88
75
|
|
|
89
76
|
### Port already in use
|
|
90
77
|
|
|
91
|
-
If port 3456 is busy, use a different port:
|
|
92
|
-
|
|
93
78
|
```bash
|
|
94
79
|
PORT=3457 npx web-terminal-agent
|
|
95
80
|
```
|
|
96
81
|
|
|
97
|
-
###
|
|
82
|
+
### Browser didn't open
|
|
98
83
|
|
|
99
|
-
|
|
84
|
+
Open `http://localhost:3456` manually in your browser.
|
|
85
|
+
|
|
86
|
+
### Permission denied (Mac/Linux)
|
|
100
87
|
|
|
101
88
|
```bash
|
|
102
89
|
chmod +x ./node_modules/.bin/web-terminal-agent
|
|
103
90
|
```
|
|
104
91
|
|
|
105
|
-
### Connection refused in browser
|
|
106
|
-
|
|
107
|
-
Make sure:
|
|
108
|
-
1. The agent is running (you should see the banner in your terminal)
|
|
109
|
-
2. You're connecting to `http://localhost:3456` (not `127.0.0.1` in some browsers)
|
|
110
|
-
3. No firewall is blocking localhost connections
|
|
111
|
-
|
|
112
92
|
## License
|
|
113
93
|
|
|
114
94
|
MIT
|
package/index.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Web Terminal Agent
|
|
5
5
|
*
|
|
6
6
|
* A lightweight local server that enables browser-based terminal access.
|
|
7
|
-
*
|
|
7
|
+
* Serves both the web interface and the API on localhost.
|
|
8
8
|
*
|
|
9
9
|
* Usage: npx web-terminal-agent
|
|
10
10
|
* node index.js
|
|
@@ -18,6 +18,7 @@ const { spawn, exec } = require('child_process');
|
|
|
18
18
|
const http = require('http');
|
|
19
19
|
const os = require('os');
|
|
20
20
|
const path = require('path');
|
|
21
|
+
const fs = require('fs');
|
|
21
22
|
|
|
22
23
|
// Configuration
|
|
23
24
|
const PORT = process.env.PORT || 3456;
|
|
@@ -31,23 +32,25 @@ const colors = {
|
|
|
31
32
|
cyan: '\x1b[36m',
|
|
32
33
|
red: '\x1b[31m',
|
|
33
34
|
dim: '\x1b[2m',
|
|
35
|
+
bold: '\x1b[1m',
|
|
34
36
|
};
|
|
35
37
|
|
|
36
38
|
// Print banner
|
|
37
39
|
function printBanner() {
|
|
38
40
|
console.log(`
|
|
39
|
-
${colors.
|
|
40
|
-
║
|
|
41
|
-
║ ${colors.
|
|
42
|
-
║ ${colors.
|
|
43
|
-
║ ${colors.
|
|
44
|
-
║ ${colors.
|
|
45
|
-
║ ${colors.
|
|
46
|
-
║ ${colors.
|
|
47
|
-
║
|
|
48
|
-
║
|
|
49
|
-
║
|
|
50
|
-
|
|
41
|
+
${colors.cyan}╔═══════════════════════════════════════════════════════════════╗
|
|
42
|
+
║ ║
|
|
43
|
+
║ ${colors.bold}████████╗███████╗██████╗ ███╗ ███╗██╗███╗ ██╗ █████╗ ██╗ ${colors.cyan}║
|
|
44
|
+
║ ${colors.bold}╚══██╔══╝██╔════╝██╔══██╗████╗ ████║██║████╗ ██║██╔══██╗██║ ${colors.cyan}║
|
|
45
|
+
║ ${colors.bold} ██║ █████╗ ██████╔╝██╔████╔██║██║██╔██╗ ██║███████║██║ ${colors.cyan}║
|
|
46
|
+
║ ${colors.bold} ██║ ██╔══╝ ██╔══██╗██║╚██╔╝██║██║██║╚██╗██║██╔══██║██║ ${colors.cyan}║
|
|
47
|
+
║ ${colors.bold} ██║ ███████╗██║ ██║██║ ╚═╝ ██║██║██║ ╚████║██║ ██║███████╗${colors.cyan}║
|
|
48
|
+
║ ${colors.bold} ╚═╝ ╚══════╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝╚═╝ ╚═══╝╚═╝ ╚═╝╚══════╝${colors.cyan}║
|
|
49
|
+
║ ║
|
|
50
|
+
║ ${colors.yellow}MATE v1.0.0${colors.cyan} ║
|
|
51
|
+
║ ${colors.dim}AI tools made simple${colors.cyan} ║
|
|
52
|
+
║ ║
|
|
53
|
+
╚═══════════════════════════════════════════════════════════════════╝${colors.reset}
|
|
51
54
|
`);
|
|
52
55
|
}
|
|
53
56
|
|
|
@@ -64,9 +67,20 @@ function getShortDir(dir) {
|
|
|
64
67
|
|
|
65
68
|
// Detect platform
|
|
66
69
|
const isWindows = process.platform === 'win32';
|
|
70
|
+
const isMac = process.platform === 'darwin';
|
|
67
71
|
const shell = isWindows ? 'cmd.exe' : (process.env.SHELL || '/bin/bash');
|
|
68
72
|
const shellArgs = isWindows ? ['/c'] : ['-c'];
|
|
69
73
|
|
|
74
|
+
// Open browser
|
|
75
|
+
function openBrowser(url) {
|
|
76
|
+
const command = isWindows ? 'start' : isMac ? 'open' : 'xdg-open';
|
|
77
|
+
exec(`${command} ${url}`, (error) => {
|
|
78
|
+
if (error) {
|
|
79
|
+
console.log(`${colors.yellow}!${colors.reset} Could not auto-open browser. Please open manually: ${colors.cyan}${url}${colors.reset}`);
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
|
|
70
84
|
// Check if a command/tool is installed
|
|
71
85
|
async function checkToolInstalled(command) {
|
|
72
86
|
return new Promise((resolve) => {
|
|
@@ -197,12 +211,20 @@ function executeCommand(command, ws) {
|
|
|
197
211
|
|
|
198
212
|
// Create Express app
|
|
199
213
|
const app = express();
|
|
214
|
+
|
|
215
|
+
// Enhanced CORS configuration
|
|
200
216
|
app.use(cors({
|
|
201
|
-
origin:
|
|
202
|
-
methods: ['GET', 'POST'],
|
|
217
|
+
origin: true,
|
|
218
|
+
methods: ['GET', 'POST', 'OPTIONS'],
|
|
219
|
+
allowedHeaders: ['Content-Type', 'Authorization', 'X-Requested-With'],
|
|
220
|
+
credentials: true,
|
|
203
221
|
}));
|
|
222
|
+
|
|
223
|
+
app.options('*', cors());
|
|
204
224
|
app.use(express.json());
|
|
205
225
|
|
|
226
|
+
// API Routes (before static files)
|
|
227
|
+
|
|
206
228
|
// Health check endpoint
|
|
207
229
|
app.get('/health', (req, res) => {
|
|
208
230
|
res.json({
|
|
@@ -252,6 +274,47 @@ app.get('/cwd', (req, res) => {
|
|
|
252
274
|
res.json({ cwd: getShortDir(currentDir) });
|
|
253
275
|
});
|
|
254
276
|
|
|
277
|
+
// Serve static files from the 'public' directory
|
|
278
|
+
const publicDir = path.join(__dirname, 'public');
|
|
279
|
+
if (fs.existsSync(publicDir)) {
|
|
280
|
+
app.use(express.static(publicDir));
|
|
281
|
+
|
|
282
|
+
// SPA fallback - serve index.html for all non-API routes
|
|
283
|
+
app.get('*', (req, res) => {
|
|
284
|
+
// Don't serve index.html for API routes
|
|
285
|
+
if (req.path.startsWith('/api/') || req.path === '/health' || req.path === '/cwd' || req.path.startsWith('/tools/')) {
|
|
286
|
+
return res.status(404).json({ error: 'Not found' });
|
|
287
|
+
}
|
|
288
|
+
res.sendFile(path.join(publicDir, 'index.html'));
|
|
289
|
+
});
|
|
290
|
+
} else {
|
|
291
|
+
// No public directory - show a simple landing page
|
|
292
|
+
app.get('/', (req, res) => {
|
|
293
|
+
res.send(`
|
|
294
|
+
<!DOCTYPE html>
|
|
295
|
+
<html>
|
|
296
|
+
<head>
|
|
297
|
+
<title>TerminalMate Agent</title>
|
|
298
|
+
<style>
|
|
299
|
+
body { font-family: system-ui, sans-serif; max-width: 600px; margin: 100px auto; padding: 20px; text-align: center; }
|
|
300
|
+
h1 { color: #6366f1; }
|
|
301
|
+
code { background: #f3f4f6; padding: 8px 16px; border-radius: 8px; display: inline-block; }
|
|
302
|
+
</style>
|
|
303
|
+
</head>
|
|
304
|
+
<body>
|
|
305
|
+
<h1>🚀 TerminalMate Agent Running</h1>
|
|
306
|
+
<p>The agent is running successfully!</p>
|
|
307
|
+
<p>API available at:</p>
|
|
308
|
+
<code>http://localhost:${PORT}</code>
|
|
309
|
+
<p style="margin-top: 40px; color: #666;">
|
|
310
|
+
To use the full web interface, please download the complete package.
|
|
311
|
+
</p>
|
|
312
|
+
</body>
|
|
313
|
+
</html>
|
|
314
|
+
`);
|
|
315
|
+
});
|
|
316
|
+
}
|
|
317
|
+
|
|
255
318
|
// Create HTTP server
|
|
256
319
|
const server = http.createServer(app);
|
|
257
320
|
|
|
@@ -290,19 +353,28 @@ wss.on('connection', (ws) => {
|
|
|
290
353
|
server.listen(PORT, HOST, () => {
|
|
291
354
|
printBanner();
|
|
292
355
|
|
|
293
|
-
|
|
294
|
-
|
|
356
|
+
const url = `http://localhost:${PORT}`;
|
|
357
|
+
|
|
358
|
+
console.log(`${colors.green}✓${colors.reset} Server running at ${colors.cyan}${url}${colors.reset}`);
|
|
359
|
+
console.log(`${colors.green}✓${colors.reset} WebSocket at ${colors.cyan}ws://localhost:${PORT}/ws${colors.reset}`);
|
|
295
360
|
console.log(`${colors.green}✓${colors.reset} Working directory: ${colors.cyan}${getShortDir(currentDir)}${colors.reset}`);
|
|
296
361
|
console.log('');
|
|
297
|
-
|
|
362
|
+
|
|
363
|
+
// Auto-open browser
|
|
364
|
+
if (!process.env.NO_BROWSER) {
|
|
365
|
+
console.log(`${colors.dim}Opening browser...${colors.reset}`);
|
|
366
|
+
setTimeout(() => openBrowser(url), 500);
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
console.log(`${colors.dim}Press Ctrl+C to stop${colors.reset}`);
|
|
298
370
|
console.log('');
|
|
299
371
|
});
|
|
300
372
|
|
|
301
373
|
// Handle graceful shutdown
|
|
302
374
|
process.on('SIGINT', () => {
|
|
303
|
-
console.log(`\n${colors.yellow}Shutting down
|
|
375
|
+
console.log(`\n${colors.yellow}Shutting down...${colors.reset}`);
|
|
304
376
|
server.close(() => {
|
|
305
|
-
console.log(`${colors.green}✓${colors.reset}
|
|
377
|
+
console.log(`${colors.green}✓${colors.reset} Stopped`);
|
|
306
378
|
process.exit(0);
|
|
307
379
|
});
|
|
308
380
|
});
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "web-terminal-agent",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "Local agent for
|
|
3
|
+
"version": "1.1.0",
|
|
4
|
+
"description": "Local agent for TerminalMate - enables browser-based terminal access to your computer. Run CLI tools like Claude Code through a friendly web interface.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
|
7
|
-
"web-terminal-agent": "index.js"
|
|
7
|
+
"web-terminal-agent": "./index.js"
|
|
8
8
|
},
|
|
9
9
|
"scripts": {
|
|
10
10
|
"start": "node index.js"
|
|
@@ -18,7 +18,8 @@
|
|
|
18
18
|
"claude-code",
|
|
19
19
|
"browser-terminal",
|
|
20
20
|
"remote-terminal",
|
|
21
|
-
"web-terminal"
|
|
21
|
+
"web-terminal",
|
|
22
|
+
"ai-tools"
|
|
22
23
|
],
|
|
23
24
|
"author": "",
|
|
24
25
|
"license": "MIT",
|
|
@@ -40,6 +41,7 @@
|
|
|
40
41
|
},
|
|
41
42
|
"files": [
|
|
42
43
|
"index.js",
|
|
44
|
+
"public/**/*",
|
|
43
45
|
"README.md"
|
|
44
46
|
]
|
|
45
47
|
}
|