Bump to v2.3.0: replace polling with SSE stream, fix detector imports

- Add GET /stream SSE endpoint to aggregator.py; state is pushed
  instantly on every change instead of fetched every 2s
- Replace setInterval polling in index.html with EventSource;
  onerror shows the ( ?.?) face and auto-reconnect is handled by
  the browser natively
- Fix ModuleNotFoundError in detectors: inject project root into
  PYTHONPATH when launching subprocesses from kao.py
- Update openapi.yaml, CLAUDE.md, README.md with /stream endpoint
- Remove completed SSE item from TODO.md

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-24 17:25:15 -06:00
parent 9291066263
commit aaae20281d
7 changed files with 114 additions and 33 deletions

View File

@@ -12,6 +12,7 @@ Turn an old phone (with its OLED screen) into a glanceable ambient display for y
- **OLED-optimized** — Pure black background, saves battery
- **Glanceable** — Know your server's status from across the room
- **Instant updates** — SSE stream pushes state changes the moment they happen
- **Extensible** — Add custom detectors for any metric
- **Personality** — Rotating expressions, celebration animations, sleep mode
- **Sound effects** — Optional audio cues for state changes (tap to enable)
@@ -215,18 +216,19 @@ Navigate with `↑↓` or `Tab`, press `Enter` to fire, `Q` to quit. A toast con
## API Reference
| Endpoint | Method | Description |
| --------- | ------ | ------------------------------------------------ |
| `/` | GET | Web UI |
| `/status` | GET | Current state as JSON |
| `/events` | GET | List all active events |
| `/event` | POST | Register an event |
| `/clear` | POST | Clear an event by ID |
| `/clear-all` | POST | Clear all active events |
| `/notify` | POST | Simple notification `{"message": "", "duration": 5}` |
| `/sleep` | POST | Enter sleep mode |
| `/wake` | POST | Exit sleep mode |
| `/docs` | GET | Interactive API documentation (Swagger UI) |
| Endpoint | Method | Description |
| ------------ | ------ | ----------------------------------------------------- |
| `/` | GET | Web UI |
| `/stream` | GET | SSE stream — pushes state JSON on every change |
| `/status` | GET | Current state as JSON (one-shot query) |
| `/events` | GET | List all active events |
| `/event` | POST | Register an event |
| `/clear` | POST | Clear an event by ID |
| `/clear-all` | POST | Clear all active events |
| `/notify` | POST | Simple notification `{"message": "", "duration": 5}` |
| `/sleep` | POST | Enter sleep mode |
| `/wake` | POST | Exit sleep mode |
| `/docs` | GET | Interactive API documentation (Swagger UI) |
Full API documentation available at [/docs](http://localhost:5100/docs) or in [openapi.yaml](openapi.yaml).