Files
pipelines/android/app
alan 829d6d3551 chat: attach files to a message from the composer
Let the operator attach one or more files to the next chat message and send
them with it. The platform multi-document picker returns content URIs; the app
resolves only each file's name, size and MIME (confirming it can be opened) and
holds the attachments per chat, exactly like the draft. Nothing is read or
transmitted until the message is sent.

- Composer: an attach action, a strip of removable chips (image thumbnail or
  file glyph, name, size, remove), and a send that is blocked while any
  attachment is flagged.
- Wire: one shared builder, ChatProtocol.promptRequest(sessionId, text, files),
  carries the attached URIs on the chat_prompt frame, in attachment order and
  omitted for a text-only prompt so that shape is unchanged.
  PipelinesRepository.chatPrompt takes the same list.
- Transcript: a sent turn carries each attachment as a ChatProtocol.PART_FILE
  part, drawn through the existing UserParts -> FilePart display path rather
  than a second rendering.
- Honest failures: an unreadable or over-24-MiB file is attached with its reason
  and blocks the send; a server rejection takes the optimistic bubble back out
  and returns the files flagged with the server's message. Attaching never
  transmits on its own, and attachments clear once the message is sent.

Review follow-ups in the same slice: the composer now uses ui/Format.kt's
humanBytes instead of a duplicate formatter; optimistic user-turn ids come from a
monotonic counter so removing a rejected turn cannot re-mint a live key;
restoreAttachments keeps a file attached between send and rejection; the
thumbnail decode catches Exception rather than Throwable.

Checks made for this commit:
- The change is android/ only; the server, its Go source, the installer and the
  Docker files are untouched, no run is started from the app, and no dependency
  was added beyond the already-declared material-icons-extended.
- Packaged authoring skill references (internal/author/skill/references/): no
  update needed. operations.md documents the brokered chat server, which this
  change does not alter; the server still stores user turns as text and ignores
  the prompt's files, so that reference stays accurate.
- Packaged templates (internal/tui, internal/server) and the root README/topic
  docs: no update needed; none describes the Android chat composer. The
  Android-facing documentation lives in android/README.md, which this change
  updates with the attachment slice, its known server-side gap and its tests.

Tests: ChatAttachmentTest (5 cases), ChatAttachmentStateTest (5 cases) and a new
ChatProtocolTest case cover building the request with attachments (and omitting
them for a text-only prompt), removing one, the unreadable and oversized paths,
which files travel with the prompt, the optimistic turn's file parts, clearing
after send, and the rejected path restoring the files flagged. Verified by the
review stage with gradle --offline --no-daemon :app:testDebugUnitTest
:app:assembleDebug -> BUILD SUCCESSFUL, 487 tests / 0 failures / 0 errors /
0 skipped.
2026-10-17 13:35:56 +01:00
..