@easbot/agent 0.2.21 → 0.2.22
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/dist/assets/txt/tool/pty_session.txt +80 -37
- package/dist/cli.cjs +184 -177
- package/dist/cli.mjs +177 -170
- package/dist/index.cjs +175 -168
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +178 -171
- package/package.json +12 -12
|
@@ -1,34 +1,17 @@
|
|
|
1
1
|
Create and manage persistent interactive PTY sessions for long-running processes. Enables background execution, session persistence, and reconnection capabilities for continuous operations.
|
|
2
2
|
|
|
3
|
-
**!! CRITICAL
|
|
3
|
+
**!! CRITICAL: PERSISTENT BACKGROUND SESSIONS !!**
|
|
4
4
|
|
|
5
5
|
Key capabilities:
|
|
6
|
-
- Persistent session creation
|
|
6
|
+
- Persistent session creation (default: persistent=true)
|
|
7
7
|
- Background process management
|
|
8
|
-
- Session reconnection
|
|
8
|
+
- Session reconnection (persistent mode)
|
|
9
9
|
- Multi-session support
|
|
10
|
-
-
|
|
10
|
+
- Output buffer with configurable truncation
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
- Long-running services (web servers, databases)
|
|
14
|
-
- Interactive SSH sessions
|
|
15
|
-
- REPL environments (Node.js, Python, etc.)
|
|
16
|
-
- Continuous monitoring (log tailing, system monitoring)
|
|
17
|
-
- Interactive development environments
|
|
12
|
+
**!! IMPORTANT: MUST CREATE SESSION FIRST !!**
|
|
18
13
|
|
|
19
|
-
|
|
20
|
-
- command (required): Initial command to run in session
|
|
21
|
-
- sessionName (optional): Unique identifier for session
|
|
22
|
-
- cols/rows (optional): Terminal dimensions
|
|
23
|
-
- persistent (optional): Keep session running after command completes (default: true)
|
|
24
|
-
- truncateMode (optional): head or tail for output truncation (default: tail)
|
|
25
|
-
|
|
26
|
-
**!! INPUT INTERACTION !!**
|
|
27
|
-
|
|
28
|
-
Send input to session using pty_manage tool:
|
|
29
|
-
```
|
|
30
|
-
pty_manage { "action": "write", "sessionId": "<sessionId>", "data": "your input\n" }
|
|
31
|
-
```
|
|
14
|
+
You MUST create a session before interacting with it. There is NO direct command execution.
|
|
32
15
|
|
|
33
16
|
Interactive workflow:
|
|
34
17
|
1. Create session: pty_session { "command": "ssh user@host" }
|
|
@@ -37,24 +20,84 @@ Interactive workflow:
|
|
|
37
20
|
4. Check output: pty_manage { "action": "get", "sessionId": "..." }
|
|
38
21
|
5. Close session: pty_manage { "action": "close", "sessionId": "..." }
|
|
39
22
|
|
|
40
|
-
**!!
|
|
23
|
+
**!! WHEN TO USE PTY vs BASH !!**
|
|
24
|
+
|
|
25
|
+
Use pty_session for:
|
|
26
|
+
- SSH connections: ssh user@host
|
|
27
|
+
- Interactive sessions: top, htop, vim, nano
|
|
28
|
+
- Long-running processes: tail -f logfile
|
|
29
|
+
- Any command requiring a terminal (TTY)
|
|
30
|
+
|
|
31
|
+
Use bash tool for:
|
|
32
|
+
- Simple commands: ls, git status, npm build
|
|
33
|
+
- One-shot commands: echo, cat, grep
|
|
34
|
+
- Scripts: ./script.sh
|
|
35
|
+
|
|
36
|
+
**!! PARAMETERS !!**
|
|
37
|
+
|
|
38
|
+
Parameters:
|
|
39
|
+
- command (required): Command to run in session
|
|
40
|
+
- Windows: "cmd.exe", "powershell.exe", "ssh.exe"
|
|
41
|
+
- Unix: "/bin/bash", "/usr/bin/ssh"
|
|
42
|
+
- args (optional): Command arguments as array
|
|
43
|
+
- cwd (optional): Working directory (defaults to project directory)
|
|
44
|
+
- env (optional): Environment variables
|
|
45
|
+
- sessionName (optional): Custom name for identification
|
|
46
|
+
- cols (optional): Terminal columns (default: 120, range: 10-500)
|
|
47
|
+
- rows (optional): Terminal rows (default: 30, range: 5-200)
|
|
48
|
+
- truncateMode (optional): head or tail for output truncation (default: tail)
|
|
49
|
+
- persistent (optional): Keep session after process exits (default: true, RECOMMENDED)
|
|
50
|
+
|
|
51
|
+
**!! COMMAND PATH REQUIREMENTS !!**
|
|
41
52
|
|
|
42
|
-
|
|
53
|
+
PTY directly executes the command you provide. The command MUST be:
|
|
54
|
+
- An executable file path, OR
|
|
55
|
+
- A command in system PATH
|
|
43
56
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
3. **Sessions do not automatically terminate** - they run indefinitely until explicitly closed
|
|
48
|
-
4. **REGULAR monitoring required**: pty_manage { "action": "list" }
|
|
49
|
-
5. **IMMEDIATE termination**: pty_manage { "action": "close", "sessionId": "id" }
|
|
50
|
-
6. **FAILURE to clean up WILL lead to SYSTEM RESOURCE EXHAUSTION**
|
|
51
|
-
7. **SECURITY RISK**: Uncleaned sessions provide persistent system access
|
|
57
|
+
Examples:
|
|
58
|
+
- Windows: "cmd.exe", "powershell.exe", "ssh.exe", "C:\\Windows\\System32\\cmd.exe"
|
|
59
|
+
- Unix: "/bin/bash", "/usr/bin/ssh", "ssh"
|
|
52
60
|
|
|
53
|
-
|
|
61
|
+
If command not found, you'll see error:
|
|
62
|
+
"Failed to create PTY session: File not found"
|
|
63
|
+
|
|
64
|
+
💡 Fix: Use full path or ensure command is in PATH
|
|
65
|
+
|
|
66
|
+
**!! SESSION PERSISTENCE BEHAVIOR !!**
|
|
67
|
+
|
|
68
|
+
When persistent=true (DEFAULT):
|
|
69
|
+
- Session is NOT deleted when process exits
|
|
70
|
+
- Session remains available for inspection
|
|
71
|
+
- Can still query output buffer and session info
|
|
72
|
+
- MUST explicitly close with pty_manage { "action": "close" }
|
|
73
|
+
|
|
74
|
+
When persistent=false:
|
|
75
|
+
- Session is automatically deleted when process exits
|
|
76
|
+
- Use for short-lived commands
|
|
77
|
+
|
|
78
|
+
**!! SESSION STATUS !!**
|
|
79
|
+
|
|
80
|
+
Sessions can have status:
|
|
81
|
+
- running: Process is active
|
|
82
|
+
- exited: Process has completed (session still exists if persistent=true)
|
|
83
|
+
|
|
84
|
+
**!! RESOURCE MANAGEMENT !!**
|
|
85
|
+
|
|
86
|
+
**WARNING**: Sessions consume system resources until EXPLICITLY closed!
|
|
87
|
+
|
|
88
|
+
MANDATORY CLEANUP:
|
|
89
|
+
1. ALWAYS close sessions when done: pty_manage { "action": "close", "sessionId": "id" }
|
|
90
|
+
2. Monitor active sessions: pty_manage { "action": "list" }
|
|
91
|
+
3. Unclosed sessions cause RESOURCE LEAK
|
|
92
|
+
|
|
93
|
+
Resource consumption:
|
|
54
94
|
- CPU cycles for active processes
|
|
55
|
-
- Memory
|
|
95
|
+
- Memory for session buffers
|
|
56
96
|
- File descriptors for terminal I/O
|
|
57
97
|
- Network connections (if applicable)
|
|
58
|
-
- System limits may be reached causing crashes
|
|
59
98
|
|
|
60
|
-
|
|
99
|
+
**!! SECURITY !!**
|
|
100
|
+
|
|
101
|
+
- Requires authorization for session creation and management
|
|
102
|
+
- Sessions provide direct system access
|
|
103
|
+
- Always close sessions to prevent unauthorized access
|