Repository navigation
Commit d8a2087
committed
feat(tool): add interactive terminal tool with persistent PTY sessions
Introduces a new terminal tool with action-based session management:
- run (default): backward-compatible one-shot execution
- create: start persistent PTY session, returns sessionId
- send: write input to existing session (commands, control sequences)
- read: cursor-based incremental output reading
- close: terminate session and cleanup resources
Sessions stored via InstanceState for per-directory isolation with
FIFO eviction at max 20 sessions. Fixes PowerShell exit code by using
\ instead of \True on Windows.
Closes anomalyco#237591 parent f033d2d commit d8a2087
7 files changed
Lines changed: 1038 additions & 0 deletions
File tree
- packages/opencode
- src/tool
- test/tool
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| 45 | + | |
45 | 46 | | |
46 | 47 | | |
47 | 48 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| |||
32 | 33 | | |
33 | 34 | | |
34 | 35 | | |
| 36 | + | |
35 | 37 | | |
36 | 38 | | |
37 | 39 | | |
| |||
86 | 88 | | |
87 | 89 | | |
88 | 90 | | |
| 91 | + | |
89 | 92 | | |
90 | 93 | | |
91 | 94 | | |
| |||
108 | 111 | | |
109 | 112 | | |
110 | 113 | | |
| 114 | + | |
111 | 115 | | |
112 | 116 | | |
113 | 117 | | |
| |||
189 | 193 | | |
190 | 194 | | |
191 | 195 | | |
| 196 | + | |
192 | 197 | | |
193 | 198 | | |
194 | 199 | | |
| |||
212 | 217 | | |
213 | 218 | | |
214 | 219 | | |
| 220 | + | |
215 | 221 | | |
216 | 222 | | |
217 | 223 | | |
| |||
344 | 350 | | |
345 | 351 | | |
346 | 352 | | |
| 353 | + | |
347 | 354 | | |
348 | 355 | | |
349 | 356 | | |
0 commit comments