Skip to content

Commit be98ea6

Browse files
committed
refactor to have daemon
1 parent 0489ccb commit be98ea6

File tree

5 files changed

+724
-60
lines changed

5 files changed

+724
-60
lines changed

README.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,40 @@ Ash supports two backends for running sandboxes:
3333
└──────────────────┘
3434
```
3535

36+
### Daemon Mode (Optional)
37+
38+
The optional daemon process maintains persistent backend connections and stateful resources across CLI invocations.
39+
40+
```
41+
┌─────────────┐ ┌──────────────────┐ ┌─────────────────┐
42+
│ ash CLI │────▶│ ash daemon │────▶│ Docker/K8s │
43+
│ (thin │ │ (long-lived) │ │ Backends │
44+
│ client) │ UDS │ │ │ │
45+
└─────────────┘ │ BackendManager │ └─────────────────┘
46+
│ ProcessRegistry │
47+
│ EventSystem │
48+
└──────────────────┘
49+
```
50+
51+
Without daemon, the CLI falls back to direct execution (same as before).
52+
53+
```bash
54+
# Start daemon
55+
ash daemon start
56+
57+
# Check status
58+
ash daemon status
59+
60+
# Stop daemon
61+
ash daemon stop
62+
```
63+
64+
**What the daemon provides:**
65+
- Persistent connections to Docker/K8s backends (faster session operations)
66+
- Async process tracking survives across CLI invocations
67+
- Event queue persists (process completion notifications work)
68+
- Cached health checks (`ash info` responds instantly)
69+
3670
## Quick Start
3771

3872
```bash
@@ -580,6 +614,17 @@ ash-mcp --transport http --port 8080
580614
| `-h, --help` | Show help |
581615
| `-V, --version` | Show version |
582616

617+
### Daemon
618+
619+
| Command | Description |
620+
|---------|-------------|
621+
| `ash daemon start` | Start daemon (detaches to background) |
622+
| `ash daemon start --foreground` | Start daemon in foreground |
623+
| `ash daemon stop` | Stop the daemon |
624+
| `ash daemon status` | Check if daemon is running |
625+
626+
Files: `~/.ash/daemon.sock` (Unix socket), `~/.ash/daemon.pid` (PID file)
627+
583628
---
584629

585630
## Error Handling

0 commit comments

Comments
 (0)