Skip to content

Session Chat: image galleries in the timeline #898

Done

Description

@ivanfenenko

Images in Session Chat (images you attach, images tools return, and images the agent refers to by path) appear inline as a gallery under the message or tool row that produced them, and open in a viewer that pages through the whole group.

Why: today only a single user-attached image renders inline (220 pt cap, one-image viewer). Images returned by tools are dropped when the message is decoded, and a markdown image keeps only its alt text, so screenshots an agent takes never reach the timeline.

Design (chosen from a UI prototype, "inline mosaic"):

  • Consecutive images from one source in a turn form one gallery block placed where the image belongs: under the tool card or tool group, inside your message bubble, and after the paragraph that names a path.
  • Layout by count: 1 keeps today's inline image (220 pt cap); 2 side by side; 3 one large plus two small; 4 or more show four tiles with a "+N" overflow on the last.
  • Path images show a neutral placeholder while loading and a failure tile with the file name when the fetch fails.
  • Tapping any tile opens a viewer that pages through the group: index label, pinch zoom, swipe down to dismiss, share and save.
  • Both server protocols (v1 and v2), both apps, same behaviour.

Server facts this relies on:

  • v2 tool results carry images as content[] items of type: "file" with a data: URL; v1 uses attachments[] on the completed tool state. Neither arrives before the tool completes. (The v1 shape must be confirmed on the scenario harness.)
  • Images named by path are not in the payload. v2: GET /api/fs/read/<path> returns raw bytes with an ETag. v1: GET /file/content?path= returns base64 JSON.
  • There is no thumbnail or blob endpoint, so decoding and downsampling are client work. User uploads over 20 MiB are rejected, and the server may re-encode large images.

Constraints:

  • Component-first: the gallery and viewer go through the design-system workflow with a presentation-safe API (no domain models, data URLs or bytes in public parameters), with gallery entries on both platforms.
  • State goes through the Session Chat Timeline region as immutable UI state plus explicit actions.
  • Fetching images the agent merely mentions reads files from the user's machine, so it sits behind a preference.

Acceptance:

  • A tool that returns images shows them in the timeline on v1 and v2, on iOS and Android, as soon as the tool completes.
  • Your own attachments use the same gallery layout and viewer.
  • The viewer pages across the group, zooms, dismisses by swipe, and can share or save the image.
  • A group with more than four images shows the "+N" tile and opens the full set.
  • Loading and failure states are visible for path images; a failed image never blocks the rest.
  • Large groups stay responsive: thumbnails are downsampled off the main thread and decoded images are cached with a memory bound.
  • Behaviour is covered by unit tests, snapshot mocks, and a scenario-harness image scenario on both protocols.

Open decisions:

  • Default for loading images the agent mentions (on, off, or ask once).
  • Placement in the Chips, Step Rail and Activity Card timeline styles (the Standard style is the first target).
  • Whether every tool's images show, or only screenshot-style tools.

Remaining:

  • Domain: keep tool-result files (v1 attachments, v2 content[type=file], REST and live events) on iOS and Android (#898 Show images inline as galleries in Session Chat #911; v1 shape covered by unit tests only, not yet confirmed on a real v1 server)
  • Gallery component and paged viewer through the design-system workflow, with gallery entries on both platforms (#898 Show images inline as galleries in Session Chat #911)
  • Timeline: group consecutive images into a gallery block in the Standard style (tool row, user bubble, assistant text) and decide the other three styles. Standard style done in #898 Show images inline as galleries in Session Chat #911; Chips, Step Rail and Activity Card left
  • Path images: markdown keeps the image URL, a path classifier, a v1 and v2 loader, and a "load images the agent mentions" preference
  • Evidence: unit tests, snapshot mocks, and a scenario-harness image scenario for v1 and v2

Activity

  1. added
    enhancement
    ios
    android
    shared
    todo
    priority: medium
    on Oct 31, 2026
  2. added 2 commits that reference this issue on Oct 31, 2026
  3. ivanfenenko commented on Nov 29, 2026

    @ivanfenenko
    CollaboratorAuthor

    Tool-result images show as galleries in every timeline style on both platforms (#911, #1097). Not done: path images named in markdown, the 'load images the agent mentions' preference, and the scenario-harness image evidence. These need a new issue if still wanted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    androidenhancementiospriority: mediumsharedtodo

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions