feat: file/image upload + separated framework root (sessions/data/uploads)

- POST /api/uploads: base64 -> shared ~/.strata-ctl/uploads store (uuid+ext),
  content-sniffed kind (image/text/binary), text token-counted via the model
  tokenizer; metadata persisted in a new uploads table.
- Chat attachments routed by kind: images -> Vision bridge (multipart image_url),
  small text (<=2000 tokens) inlined, large text/binary -> path + shell_exec
  reminder; binaries never inlined. Attachment context persisted with the turn.
- GUI: attach button + file picker, removable chips, attachments sent with the
  turn and shown on the user bubble; cleared on session switch.
- Framework root ~/.strata-ctl separated by type: sessions/<name>/, data/ (SQLite,
  moved from ~/.config/strata-ctl), uploads/. Legacy DB copied once on first run.
- count_tokens seam on Formatter (real tokenizer override) + ChatService.
- i18n: upload errors + attachment markers (backend) and attach.* (GUI), it+en.
- 121 tests + 2 ignored; clippy/fmt clean; validated live (upload routing, real
  tokenizer count, image->Vision answered "Rosso", new layout).
This commit is contained in:
adm committed 2026-11-25 16:25:55 +01:00
1 parent 498e3dbc1b
commit 65f8111ba2
19 files changed
+672 -47

No files matched your search

+7 -1
View File
@@ -3,5 +3,11 @@
"identity.folder": " Your personal folder is {folder}.",
"error.name_locked": "The session name is immutable after the first interaction.",
"error.name_empty": "The name must not be empty.",
"error.session_not_found": "Session not found."
"error.session_not_found": "Session not found.",
"upload.bad_base64": "Invalid file data (base64).",
"upload.empty": "The file is empty.",
"upload.too_large": "The file exceeds the maximum allowed size.",
"upload.image_marker": "\n\n[Attached image: {name}]",
"upload.inline_file": "\n\n[File: {name}]\n{content}",
"upload.path_file": "\n\n[Attached file: {name} — path: {path}. Use shell_exec to inspect it selectively, do not dump it all into context.]"
}
+7 -1
View File
@@ -3,5 +3,11 @@
"identity.folder": " La tua cartella personale è {folder}.",
"error.name_locked": "Il nome della sessione è immutabile dopo la prima interazione.",
"error.name_empty": "Il nome non può essere vuoto.",
"error.session_not_found": "Sessione non trovata."
"error.session_not_found": "Sessione non trovata.",
"upload.bad_base64": "Dati del file non validi (base64).",
"upload.empty": "Il file è vuoto.",
"upload.too_large": "Il file supera la dimensione massima consentita.",
"upload.image_marker": "\n\n[Immagine allegata: {name}]",
"upload.inline_file": "\n\n[File: {name}]\n{content}",
"upload.path_file": "\n\n[File allegato: {name} — percorso: {path}. Usa shell_exec per ispezionarlo selettivamente, non riversarlo tutto nel contesto.]"
}