android: make the conversation readable — markdown, collapsed reasoning, one identity

Fix the three reading problems in the chat conversation view. Android only;
no new dependency (the declared material-icons-extended only); no server,
Go, installer or Docker file touched and no run started from the app.

- Markdown reaches the transcript. Assistant text already went through
  MarkdownText inside a private composable; name the decision as the pure
  ChatFormat.partRendering(part) (MARKDOWN/REASONING/PLAIN/HIDDEN) and have
  MessagePart consume it. Text outside the renderer's documented subset and
  unknown part kinds still render as their own text (PLAIN); blank parts
  render nothing (HIDDEN).
- Reasoning collapsed by default. ReasoningBlock is now one compact, muted
  line per part (icon, label, chevron) that expands on tap to the muted
  text. Expansion is hoisted to the conversation pane as the pure
  ReasoningExpansion set keyed per stable part key, so a part keeps its
  state across scroll/disposal and every part starts collapsed in a newly
  opened chat. A running turn's streaming reasoning stays collapsed under a
  live "Thinking…" label, signalling progress without competing with the
  answer.
- One identity in the header. ChatFormat.conversationHeader(thread) builds
  the app-bar title plus only context (labelled kind chip from the server
  tag, activity, directory, model); the app bar and the context line read
  the same value. openChatsBeside drops the active chat from the open-chat
  strip so its title is shown once; every other open chat stays one tap
  away and the session list is unchanged.

Tests: new ChatTranscriptTest (7 cases) plus the existing ChatFormatTest —
the markdown subset reaches the renderer from a ChatPart, text outside the
subset and an unknown kind still render, reasoning starts collapsed and
toggles per part, the header names the session once, and the strip offers
only the other open chats.

Checked, and none needs an update: the packaged templates carry no Android
chat surface; the repository guidelines (README, docs/) document the server
and CLI, whose behaviour is unchanged — docs/cli.md's note that Android
rendering of the tag is out of scope for the server change still holds; and
the packaged authoring skill references (internal/author/skill/references/)
describe delivery/verification generally, none of which this UI change
alters. android/README.md records the new behaviour.

Verified: `gradle :app:testDebugUnitTest :app:assembleDebug --no-daemon
--offline --rerun-tasks` → BUILD SUCCESSFUL; JUnit XMLs total 508 tests, 0
failures, 0 errors, 0 skipped. app-debug.apk sha256
0df6899429a8f5632ec568340dddb63a5617b1a04af19f52c6ebb793470a0b23.
This commit is contained in:
2026-10-17 15:14:52 +01:00
parent 5ac196c68d
commit 2bc00a2a94
5 changed files with 492 additions and 39 deletions
+65
View File
@@ -5783,3 +5783,68 @@ Not verified in this pass: the search field, the directory sections and the
empty state on a device, and the narrow/wide layouts — the brief keeps
implementation verification to the build and the unit tests, and visual review
owns the operator's Pixel 9 Pro XL.
## Conversation reading: markdown, collapsed reasoning, one identity (17 Oct 2026)
Making the conversation readable on a phone. `android/` only; no new dependency
(the declared `material-icons-extended` only), no Pipelines server/Go/installer/
Docker file touched and no run started from the app.
- **Markdown reaches the transcript (tested).** The assistant `text` part was
already rendered through `MarkdownText`, but the transcript's decision was
buried in a private composable. `ChatFormat.partRendering(part)` now names the
one decision the transcript makes (`MARKDOWN` / `REASONING` / `PLAIN` /
`HIDDEN`), `MessagePart` consumes it, and `ChatTranscriptTest` drives a sample
covering the whole documented subset (headings, paragraph, bullet and ordered
lists, quote, table, fenced code, rule, inline code/bold/italic/link) from a
`ChatPart` into `parseMarkdown`/`parseInline`. Text outside the subset (raw
HTML, `~~strike~~`) still parses to a paragraph and renders verbatim; an
unknown part kind still renders its text, never drops it.
- **Reasoning collapsed by default.** `ReasoningBlock` is now one compact,
muted line per part — a `Psychology` icon, a label (`Thinking…` while the
newest turn streams, `Reasoning` once settled) and a chevron — that expands on
tap to the full, still-muted text. Expansion is a pure
`ReasoningExpansion` set hoisted to the conversation pane (not the lazy
transcript), so a part keeps its state while the operator scrolls and its item
is disposed, and every part starts collapsed in a freshly opened chat. The
choice for a running turn: its streaming reasoning stays collapsed and keeps
following the stream under the live `Thinking…` label, so it signals progress
without competing with the answer.
- **One identity in the header.** `ChatFormat.conversationHeader(thread)` builds
the app-bar title plus the only extra context — the labelled kind chip
(`Operator`) from the server's own tag, the activity (`Running` /
`Busy · read-only` / `Idle`), the directory and the model — and the app bar and
context line read the same value. The conversation's active chip is omitted
from the open-chat strip (`openChatsBeside`), so the session's title is shown
once; every *other* open chat is still one tap away, and the session list is
unchanged.
Tests (`ChatTranscriptTest`, 7 cases, plus the existing `ChatFormatTest`): the
markdown subset reaches the renderer from a `ChatPart`; text outside the subset
and an unknown part kind still render; reasoning starts collapsed, toggles per
part and never expands on a blank key; the header names the session once with
only kind/activity/directory/model beside it; and the conversation strip offers
only the other open chats.
Evidence (macOS, JDK 17, Gradle 9.7.1 `--offline`, `--no-daemon`,
`ANDROID_HOME=/Users/alan/Library/Android/sdk`):
- `gradle :app:assembleDebug --no-daemon --offline --rerun-tasks` → `BUILD
SUCCESSFUL` (35 tasks executed).
- `gradle :app:testDebugUnitTest --no-daemon --offline --rerun-tasks` →
`BUILD SUCCESSFUL`; the JUnit XMLs total **508 tests, 0 failures, 0 errors, 0
skipped** (7 new in `ChatTranscriptTest`).
- **APK publish.** `app-debug.apk` copied to this run's artifacts directory as
`pipelines-debug-wip-5ac196c.apk` (18,486,624 bytes, sha256
`0df6899429a8f5632ec568340dddb63a5617b1a04af19f52c6ebb793470a0b23`; `5ac196c`
is `git rev-parse --short HEAD`, the tree being uncommitted WIP on top of it).
It is served at
`http://10.0.0.75:8080/artifacts/274/1/pipelines-debug-wip-5ac196c.apk`
(`HTTP/1.1 200 OK`, `Content-Type: application/vnd.android.package-archive`,
`Content-Length: 18486624`).
Not verified in this pass: the conversation, the collapsed/expanded reasoning
and the header on a device — the brief keeps implementation verification to the
build and the unit tests, and visual review owns the operator's Pixel 9 Pro XL
(captures: headings/list/fenced code/table, reasoning collapsed then expanded,
and the header).