Wire the media archive into the daemon: command, service, and API

This commit is contained in:
Fisto
2026-09-16 08:08:12 +02:00
parent 91782f0b80
commit 8b7b5b675d
13 changed files with 421 additions and 18 deletions
+1
View File
@@ -181,6 +181,7 @@ event. The log rotates at the size limit.
| `command` | Command text, requester, result |
| `reply` | Command, mode, target, result, error |
| `voice` | Voice action, channel, mute |
| `media` | Scrape start or stop: scrape ID, channel, mode |
| `audio` | Audio action (speak, stop, devices, capture), provider, size |
| `message-edit` | Message ID, channel, author, content length, whether the cache had it |
| `message-delete` | Message ID, channel, whether the cache had it |
+2 -2
View File
@@ -4,7 +4,7 @@ The media archive is designed for agent access. The daemon exposes one service,
are thin wrappers around it. The same service backs the Web UI routes, so the two clients cannot
drift.
Status: hooks designed, implementation at checkpoint C7 in [CURRENT.md](../CURRENT.md).
Status: hooks designed, implementation at checkpoint C8 in [CURRENT.md](../CURRENT.md).
## Service interface
@@ -54,7 +54,7 @@ the action log apply.
- Media bytes are never returned inline. Tools return metadata, the original URL, and the local
path; an agent that wants the bytes reads the file through the daemon host.
## Hooks to leave in place before C7
## Hooks to leave in place before C8
1. `MediaService` is constructed once in the daemon and passed to both the Web UI routes and the
MCP registration. No globals.
+2 -1
View File
@@ -111,4 +111,5 @@ and the MCP `get_media_scrape` tool read the same fields.
## Checkpoints
Implementation goals live in [CURRENT.md](../CURRENT.md). The engine is C3; slopbot is C4.
Implementation goals live in [CURRENT.md](../CURRENT.md). The engine is C3; slopbot is C4; daemon
wiring (command, service, routes) is C5.
+4 -3
View File
@@ -1,7 +1,8 @@
# Media archive
Status: design approved 2026-09-16. Implementation in progress. Checkpoints live in
[CURRENT.md](../CURRENT.md).
Status: design approved 2026-09-16. The engine, the slopbot backend, the `scrape media` command,
and the `/api/media/*` routes are implemented (C3-C5). The Media and Bot tabs are C6. Checkpoints
live in [CURRENT.md](../CURRENT.md).
The media archive saves the media history of a channel. A trusted user runs `scrape media` in the
channel. The daemon walks the history through a scrape backend and indexes every image, GIF,
@@ -125,7 +126,7 @@ that deletion is irreversible. The delete button is disabled for a 5 second coun
## MCP
The agent can query the archive and start scrapes with MCP tools. The hooks are designed in
[media-mcp.md](media-mcp.md) and implemented at checkpoint C7.
[media-mcp.md](media-mcp.md) and implemented at checkpoint C8.
## Security
+3 -3
View File
@@ -75,6 +75,6 @@ Slopbot runs with the faster bot budget; the puppet backend uses the slower user
## Status
Backend implemented 2026-09-16 (C4): mapping, paging, and client lifecycle, tested with a fake
fetcher. Not wired into the daemon yet; that is C5. A live login with a real token is owed at C8.
Checkpoints: [CURRENT.md](../CURRENT.md).
Backend implemented 2026-09-16 (C4), wired into the daemon at C5: `MediaService` logs the client in
on the first scrape and picks it for guild channels it is in. A live login with a real token is owed
at C9. Checkpoints: [CURRENT.md](../CURRENT.md).
+5
View File
@@ -235,6 +235,11 @@ replaceable.
| POST | `/api/audio/stop` | none | Stop speech and clear the queue |
| POST | `/api/audio/capture` | `start` | Start or stop capture |
| GET | `/api/transcript` | `limit?`, `sessionId?` | Sessions and captured segments |
| GET | `/api/media` | `kind?`, `limit?`, `offset?` | Media items across every scrape, newest first |
| GET | `/api/media/scrapes` | none | Every scrape with state and counters |
| GET | `/api/media/status` | none | Slopbot connection state and the scrape list |
| POST | `/api/media/scrape` | `channelId`, `guildId?`, `mode?` | Start a media scrape |
| POST | `/api/media/scrape/stop` | `id` | Stop a media scrape |
| GET | `/api/logs` | `limit` | The persistent action log |
| GET | `/api/events` | none | Server-sent events |