feat(shell): add parallel bash shell subsystem auto-started per workspace

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
tao.chen
2026-07-03 16:36:35 +08:00
co-authored by Claude
parent 75e807c154
commit 0ec3efa812
14 changed files with 730 additions and 12 deletions
+18
View File
@@ -44,6 +44,12 @@ workspace:
root: "./workspaces"
process:
opencodeCommand: "opencode"
shell:
command: "bash"
args:
- "-i"
file:
maxWriteBytes: 1048576
gin:
@@ -60,6 +66,8 @@ log:
| `CODESPACE_ADDR` | Listen address | `:8080` |
| `CODESPACE_WORKSPACE_ROOT` | Workspace storage root | `./workspaces` |
| `CODESPACE_OPENCODE_COMMAND` | OpenCode binary path | `opencode` |
| `CODESPACE_SHELL_COMMAND` | Shell binary path | `bash` |
| `CODESPACE_SHELL_ARGS` | Comma-separated shell arguments | `-i` |
| `CODESPACE_FILE_MAX_WRITE_BYTES` | Max bytes per file write | `1048576` |
| `CODESPACE_GIN_MODE` | Gin mode (`debug`, `release`, `test`) | `release` |
| `CODESPACE_READ_TIMEOUT` | HTTP read timeout | `15s` |
@@ -107,6 +115,16 @@ All runtime logging uses slog; `fmt`, `log.Printf`, and the Gin default logger a
| `GET` | `/api/workspaces/:id/process/status` | Get process running status and PID |
| `GET` | `/api/workspaces/:id/process/ws` | WebSocket: stream process stdout/stderr, send stdin (text frames, raw bytes) |
### Shell
| Method | Path | Description |
|---|---|---|
| `POST` | `/api/workspaces/:id/shell/start` | Start interactive shell for workspace |
| `POST` | `/api/workspaces/:id/shell/stop` | Stop interactive shell |
| `POST` | `/api/workspaces/:id/shell/restart` | Restart interactive shell |
| `GET` | `/api/workspaces/:id/shell/status` | Get shell running status and PID |
| `GET` | `/api/workspaces/:id/shell/ws` | WebSocket: stream shell stdout/stderr, send stdin (text frames, raw bytes) |
### Health
| Method | Path | Description |