feat: add server.sh bash management script (macOS/Linux)

Equivalent to server.ps1 for bash environments:
- start / stop / restart / status / logs [N|-f]
- Detached background process via nohup
- PID file in logs/ with live-process verification
- Port-based fallback detection via lsof
- Memory reporting (Linux /proc + macOS ps)
- Colour output with ANSI codes
- stderr error highlighting in status view
- Follow mode (-f) for live log tailing
This commit is contained in:
2026-03-27 04:21:40 +08:00
parent 7de4a03d94
commit 1cc75afe87
2 changed files with 265 additions and 1 deletions

View File

@@ -488,6 +488,7 @@ Server-Sent Events endpoint for live UI updates.
- [x] Dark / light theme toggle defaulting to OS colour-scheme preference.
- [x] `default_wait_seconds` changed to fully server-controlled (agents can no longer override wait time).
- [x] Non-blocking `server.ps1` management script (start / stop / restart / status / logs).
- [x] Non-blocking `server.sh` bash management script — identical feature set for macOS / Linux.
- [x] MCP stateless/stateful mode configurable via `MCP_STATELESS` env var (default `true`).
- [x] Per-agent generation counter prevents abandoned (timed-out) coroutines from silently consuming instructions meant for newer calls.
- [x] `tests/test_wakeup.py` covers both immediate-wakeup timing and concurrent-call generation safety.
@@ -518,8 +519,9 @@ pip install -r requirements.txt
python main.py
```
Or use the included management script (recommended — non-blocking):
Or use the included management scripts (recommended — non-blocking):
**PowerShell (Windows)**
```powershell
.\server.ps1 start # start in background, logs to logs/
.\server.ps1 stop # graceful stop
@@ -530,6 +532,18 @@ Or use the included management script (recommended — non-blocking):
.\server.ps1 logs 100 # show last 100 lines
```
**Bash (macOS / Linux)**
```bash
chmod +x server.sh # make executable once
./server.sh start # start in background, logs to logs/
./server.sh stop # graceful stop
./server.sh restart # stop + start
./server.sh status # PID, memory, tail logs
./server.sh logs # show last 40 stdout lines
./server.sh logs -f # follow logs live
./server.sh logs 100 # show last 100 lines
```
The server starts on `http://localhost:8000` by default.
| URL | Description |