Support file attachments in Sessions

Merged
GJ
3mo ago
+1578-76

What type of PR is this?

/kind feature

What this PR does / why we need it:

Adds persisted input attachments to interactive Sessions so users can provide images and other local files from either client.

  • stores validated attachments in the Session state directory with per-file, per-message, and per-Session limits
  • journals attachment metadata and restores it with queued and retained messages
  • maps raster images to native Codex image inputs, OpenCode attachments to file parts, and exposes local paths to every provider
  • adds authenticated multipart upload and download endpoints to the Session web server
  • adds file selection and drag-and-drop to the web composer
  • adds /attach PATH to terminal chat and recognizes bracketed-paste file drops in the interactive terminal UI
  • adds end-to-end coverage for web transfer, Pod recovery, history, reset cleanup, and terminal submission

Which issue(s) this PR is related to:

N/A

Special notes for your reviewer:

Attachments use the existing Session state volume. They survive Pod replacement only for Sessions configured with spec.volumeClaimTemplate; reset and deletion follow the existing workspace lifecycle. The current limits are 10 MiB per file, 8 files per message, and 100 MiB or 128 files per Session.

Verification completed with:

  • make verify
  • make test
  • make build

Does this PR introduce a user-facing change?

Sessions now support image and file attachments from the web composer and `kelos session connect`, including drag-and-drop in both interactive interfaces.

Summary by cubic

Add file attachments to Sessions across web and terminal. Users can attach images and other files; attachments are stored in Session state, included in turns and history, and persist across Pod replacement when using spec.volumeClaimTemplate.

  • New Features

    • Web composer: attach button and drag-and-drop, pending attachment chips, and inline image previews/downloads.
    • Terminal: /attach PATH, bracketed-paste drag-and-drop in the interactive UI, and /send to submit files without text.
    • Storage and limits: 10 MiB per file, up to 8 files per message, and up to 100 MiB or 128 files per Session. Attachments live in the Session state volume and follow the workspace lifecycle.
    • API and runtime: authenticated multipart upload POST /api/sessions/{ns}/{name}/attachments and download GET /api/sessions/{ns}/{name}/attachments/{id}; kelos-session-runtime attachment put|get; new internal/sessionattachment client using Pod exec.
    • Provider integration: raster images become native Codex local images; OpenCode receives file parts via file:// URLs; all providers receive a prompt that includes an attachment summary.
  • Migration

    • Providers: Provider.RunTurn now accepts TurnInput (text + attachments) instead of a string prompt. Update custom providers accordingly.
    • Socket clients: include attachmentIds on message requests if sending attachments.