# System Endpoints

---

## GET /health

Lightweight liveness check. Returns immediately, no DB access.

**Response**
```json
{
  "status": "ok",
  "version": "0.1.0",
  "uptime": 142
}
```

| Field | Type | Description |
|-------|------|-------------|
| `status` | string | Always `"ok"` |
| `version` | string | VeilCLI version |
| `uptime` | integer | Seconds since server start |

**Example**
```bash
curl http://localhost:5050/health
```

---

## GET /status

Full server status snapshot including agent and session counts.

**Response**
```json
{
  "status": "ok",
  "version": "0.1.0",
  "uptime": 261,
  "cwd": "/home/user/my-workspace",
  "agents": 3,
  "activeSessions": 2
}
```

| Field | Type | Description |
|-------|------|-------------|
| `cwd` | string | Workspace directory the server was started in |
| `agents` | integer | Number of agents found in `.veil/agents/` |
| `activeSessions` | integer | Open chat sessions |

**Example**
```bash
curl http://localhost:5050/status
```

---

## POST /shutdown

Triggers a graceful shutdown of the server. The server closes active connections, closes the SQLite database, and removes its PID file before exiting.

**Request body** — none

**Response**
```json
{
  "status": "shutting_down"
}
```

The process exits approximately 500ms after responding.

**Example**
```bash
curl -X POST http://localhost:5050/shutdown
```
