feat: add image attachments for vision models

A chat line can carry up to four images, each capped at 5 MB and
sniffed from its bytes. Uploads go to a room route first, the message
references the ids, and the bytes are served back to members; an
upload no message claims within an hour is swept on the next send.

Images only make sense when the model can look at them, and the
catalog's answer is tri-state, so the gate is a stored fact, not a
guess: the provider listing remembers supports_vision per kind and
model, the upload and send routes refuse when the room's effective
model is not a known vision model, and the composer hides the attach
button on the same fact, which rides the room payload. At turn time
the fact goes to the host agent, which sends the blocks on a vision
model and leaves a note where each image was on the rest.
This commit is contained in:
vhaudiquet committed 2026-12-01 21:59:53 +01:00
1 parent acc545ede7
commit 2e17e7463c
18 files changed
+624 -46

No files matched your search

+13 -2
View File
@@ -350,7 +350,12 @@ paged backwards. Composer at the bottom with `@` completion for the
agent and for people. Each message carries author, colour, time, and,
for agent messages, the turn. Images and pastes ride the message row;
the bytes are served from a room route, and vision models get inline
image blocks the way the claw already sends them.
image blocks the way the claw already sends them. A line carries at
most four images, each capped at 5 MB and sniffed from its bytes. Only
a model the provider listing says has vision accepts them: the composer
hides the attach button and the upload route refuses otherwise, and the
turn passes the fact to the host agent, which masks the blocks for a
model that cannot see.
A running turn has no transcript card. The status line above the composer
shows `Rhema is working...` until `turn_end`. When the turn ends, the log
@@ -610,6 +615,12 @@ members(room_id, id, account_id, display_name, role, color, guest_token_hash,
invites(token_hash, room_id, role, created_by, expires_at, max_uses, uses)
messages(room_id, seq, id, author_kind, author_id, text, mentions_json,
turn_id, created_at)
attachments(id, room_id, uploader, mime, bytes, size, message_id,
created_at) -- message_id set when a line sent it; older
-- unreferenced uploads are swept after an hour
model_facts(kind, model_id, supports_vision, updated_at) -- filled by
-- the provider listing; the send, upload, and turn paths
-- read it instead of repeating a live call
turn_events(room_id, seq, turn_id, kind, body_json, created_at)
turns(room_id, id, status, started_by, started_at, ended_at, steps,
usage_json, cost_usd)
@@ -645,7 +656,7 @@ Refuse to start on a non-loopback `listen` without a `public_url`, a
secret key, and at least one account. First run prints a one-time setup
token that creates the first account.
Backups: the SQLite file, the secret key, and the attachment directory.
Backups: the SQLite file (attachments included) and the secret key.
## 11. Framework changes