Skip to content

feat(mobile): match web styles for timeline items - #276

Merged
nixuuu merged 1 commit into
devfrom
feat/mobile-timeline-parity
Nov 6, 2026
Merged

nixuuu merged 1 commit into
devfrom
feat/mobile-timeline-parity

Conversation

@nixuuu

@nixuuu nixuuu commented Nov 6, 2026

Copy link
Copy Markdown
Member

What

The mobile timeline (threads and bot chats) renders every item kind the way the web does. Shared labels and layout rules move from apps/web into @canopy/domain, and both clients use them. Folds, groups and items that the reader toggles by hand keep their header on screen, on mobile and on the web.

  • Shared logic (packages/domain, the web now imports from here):
    • tools: the tool registry, parsers, diff counts, agent-bus labels.
    • work-summary: fold counts, group labels ("Read 1 file and ran 5 commands"), live hint.
    • Plus humanize, json readers, turn-origin, status-look, format, questions, failure-presentation, first-line and bot-chat (model, botEntries, layoutChat).
  • Mobile: new src/features/timeline, replacing the old ui/timeline.tsx. It has one small view per item kind, the turn rows (start, input with its origin, steers, notices, end, footer), the WorkFold/WorkGroup headers with the work rail, and the shared building blocks (Badge, StatusDot, Rule, Spinner, LiveText, SmallButton, ui/tone.ts). Bot chat uses ChatTimeline, ChatRows and a new ChatBubble.
  • Fold position:
    • Mobile (ui/feed-anchor.tsx): the inverted FlatList grows a row towards older content. The tapped header is measured before and after the change, and the list moves by the difference.
    • Web: VirtualFeed.keep(rowKey). While following the end, toggling any fold except the last one released the end and kept the header still.
    • Details: docs/timeline-folding.md, "Pozycja przy ręcznym przełączaniu".
  • Docs: docs/mobile.md, docs/timeline-folding.md, docs/ui-api.md, docs/agent-bus.md.

Inventory (web → mobile before this PR → now)

Item / row Web Mobile before Mobile now
User message, attachments, mentions grey bubble, chips same same
Queued / Starting turn note above bubble same same
Steer (delivered) "↳ Steered into this turn", agent sender in violet missing (only the input turn showed) same
Steer in flight spinner note, dimmed bubble grey Notice "Sending to the current turn" same
Turn from an agent: task, message, report, answer violet line "Task from ‹thread pill› model · N hops", violet bubble folded to first line grey note "Message from …", grey bubble same
Side thread question, schedule, bot input, other triggers amber/sky/violet line and tinted bubble missing / grey same
Background task note turn / steer "⚡ Background task finished · exit 0 · ‹title›" user bubble with platform text same
Day separator, goal mark, silent trigger label pill, flag, label missing same (the turn time stays hover-only on the web, so it is hidden here too)
Agent message, commentary, streaming caret markdown; commentary quieter with a rail markdown only same
Fold "Working for / Worked for" chevron, time, counts or live hint, "N still running", rule "Worked for", step count same, shared rules
Tool groups inside a fold "Read 1 file and ran 5 commands" missing same
Work rail under an open fold left hairline missing same
Answer slot, segments after an answer per segment per segment same
Command mono line, duration, exit badge, cwd, output mono label, raw output same (output preview capped at 12k characters with a note)
Tool call (built-in, MCP, connector) registry title + subject, diff counts, error, typed body, "Show raw" tool name, raw output title/subject/counts/error same; body: diff for edits, command for shell, result text otherwise, "Show raw"
File change "Edited a.ts, b.ts" +/−, per-file kind badge, path, diff "N file changes", path list same
Reasoning "Thinking/Thought" + preview, opens summary "Thinking" tool row same
Web search query, result links label only same
Plan / to do "1 of 3 done", steps with states label only same
Image path, prompt, detail, preview missing same without the image preview (the phone does not load blobs yet)
Subagent (provider) type + description, prompt well, nested work, result label only same
Background task "Background ‹name›", kind badge, Stop, tail of output, stop reason label only same (Stop calls StopBackgroundTask; "Open output" dialog stays web-only)
Agent bus calls violet title with thread pill, typed body, subagent and delivery cards, refusals generic tool row same (schedule tools show their prompt; the schedule summary in words stays web-only)
Interaction record (permission/question) kind, question/answer, who answered, status badge with dot missing same
Context compaction centred rule with label generic row same
Provider event "Provider event ‹type›", fields generic row same (fields shown as JSON)
Notices (rate limit, retry, provider error) tinted row with icon inside the turn last 3 as grey notices above the composer same, in turn order; turnless ones at the end
Failed turn FailureNotice: heading, explanation, auth hint, "Show details" red error text same; Retry, Change model and provider links stay web-only
Interrupted / cancelled turn status + who stopped it missing same; "Continue" stays web-only
Turn footer Copy answer, Fork from here, duration missing duration only
Shell turn rose card same same
Bot chat date lines "Today 8:44 PM" after a day change or an hour's pause missing same
Bot bubbles runs with tighter corners, markdown on grey, yours on ink single style same
Bot ⇄ bot exchanges "Messaged ‹Bea›", "Message from ‹Bea›", "N messages with ‹Bea›" relayed text as bubbles same
Bot events (reminders, settings changes) centred event line centred caption same (the "View" of setting changes stays web-only)
Bot reply failure "‹Bot› couldn't reply" FailureNotice "Could not complete this response." bubble same; Retry/Change worker stay web-only
Bot status avatar + shimmering "Typing…" / status line plain text same
Bot cards (question/approval) inline in time order stacked above the composer inline in time order (same card component as before)

Still different, and why

  • Phone-only gaps: Copy answer and Fork (no clipboard module in the build, no fork on mobile), image previews, the background "Open output" dialog, bot message actions (Reply, Copy text) and bot mentions as chips inside bot text.
  • Retry, Change model and Change worker on failures stay on the web, like the rest of mobile's read-only recovery.
  • The agent message bubble folds when it is longer than one line by a character heuristic. The web measures the rendered line.
  • The tool call body is simpler than the web's per-tool views (file lines, grep matches, script steps).

Verification

  • Web (Chromium, 412 px, light and dark): against a seeded throwaway gateway. Fold anchoring on the long history thread:

    Case Before After
    Following the end, toggle a fold that is not the last header 393 → 349 px (moved by the inserted rows) 393 → 393 → 393
    Following the end, toggle the last fold — stays at the end (distance 0)
    Scrolled up mid-thread — 333 → 333 → 333
  • Android emulator Medium_Phone_API_36.1: EAS development build from this branch, light and dark, every item kind, bus and background rows, bot chat. Fold anchoring in a long thread:

    Case Header y (px)
    Mid-thread, anchor disabled (old behaviour) 1087 → 972 → 1087
    Mid-thread, with this change 994 → 994 → 994
    Live (running) turn, following the bottom stays at the bottom
  • Not checked:

    • Canopy_Fold (folded or unfolded): another agent's session was using it.
    • The ≥ 640 dp details: shown only from 640 dp, like the web's sm:; not looked at on a wide screen.
  • Emulator streaming caveat (also on dev, not caused by this PR): in this setup, WatchThread/WatchOverview through the Android pinned-fetch module never deliver a byte, both over the tailnet and through adb reverse, with an older dev client and with a fresh EAS build of this branch. The server streams the snapshot within 17 ms to Node and curl (HTTP/1.1 and HTTP/2), and the emulator's TCP connection acknowledges the bytes, so the stall is in the native or JS stream path on the device. To see the timeline, I routed the app through a local, uncommitted HTTP/1.1 shim. This needs its own look.

Gates

bun install, bun run gen:check, bun run typecheck, bun run lint, bun run format:check, bunx expo lint, bun run check:tmp (1500 pass, 0 fail on the rebased tree), web build, expo export --platform android.

Copy audit (docs/copy.md §8)

New or changed UI text is copied from the web unless noted:

Before → after Reason
"No additional output." → "No output." / "Waiting for output…" web wording
"Working…" under answers → removed the fold header says it
"Sending to the current turn: ‹text›" → "Steering into the running turn…" / "Accepted, joins at the agent's next step" with the message web wording
"Could not complete this response." → "‹Bot› couldn't reply" + explanation + "Show details" error = what happened, then what to do, details behind Show details
New (mobile only): "Shows the first 12,000 characters. Open this thread on the web for the rest." names the limit and the action; one idea per sentence
New (mobile only): "‹w›×‹h› px preview; open this thread on the web to see it." names the gap and the action
  • Glossary terms are unchanged.
  • Buttons start with a verb (Stop, Show details, Show raw, Show all output).
  • No text relies only on colour: statuses carry labels, and the dots sit next to text.
  • Checked with short and long thread titles; the long title truncates in its pill.

Mobile threads and bot chats render every timeline item the way the web
does: work rows with the shared tool registry, commands, diffs, reasoning,
subagents, agent-bus calls with thread pills and cards, background tasks
and notes, notices, turn origins and failures, folds with groups, and the
bot chat layout with date, exchange, event and error lines.

Labels, counts and layout rules move to @canopy/domain (tools, humanize,
work-summary, turn-origin, status-look, format, questions,
failure-presentation, first-line, bot-chat) and the web uses them from
there.

Toggling a fold, group or item by hand keeps its header in place on
mobile (inverted list offset correction) and on the web (VirtualFeed.keep
for readers following the end); a reader at the end stays there only for
the last fold.
@nixuuu
nixuuu merged commit 7baaf95 into dev Nov 6, 2026
9 checks passed
@nixuuu
nixuuu deleted the feat/mobile-timeline-parity branch November 6, 2026 12:40
nixuuu added a commit that referenced this pull request Nov 7, 2026
Mobile live status labels faded as a whole, so "Working for …" pulsed
instead of showing the web's moving highlight. A shared `LiveText` now
sweeps a soft band from left to right for work headers, tool groups,
thinking labels and bot status rows.

The component uses clipped native text copies and Reanimated transforms
on the UI thread. It matches the web's theme colours, 40/50/60% gradient
stops on a 200% background, and linear 2-second cycle including the
off-text pause. Shared motion tokens describe the sweep; web reads its
unchanged duration through a named CSS token. Only the base text
participates in layout and accessibility. Long labels retain one-line
ellipsis. Reduced motion removes the highlight and cancels the loop,
including live changes to the system setting. No native dependency or
rebuild is required.

Fixes: #276

Verification:
- `bun install`, `bun run gen:check`, `bun run typecheck`, `bun run
lint`, `bun run format:check`, mobile typecheck and `bunx expo lint`.
- `bun run check:tmp`: 1751 passed, 161 skipped, 0 failed; no temp
leftovers.
- Web production build; Expo Doctor (20/20), clean CNG prebuild and
Android/iOS JS exports.
- Android Medium Phone and Fold: isolated PostgreSQL + gateway +
scripted worker with a running turn; recorded light/dark sweeps and
static reduced-motion text. Also checked short, typical and truncated
long labels, tool groups and thinking labels on a temporary manual
screen, then removed that screen. Verified motion resumes after
re-enabling animations, including after launching with reduced motion
enabled.
- Web browser comparison at desktop and phone widths in both themes:
computed 2s/linear timing, 200% background and matching theme gradient
stops. No automated UI tests added.

iOS limitation: the installed simulator app has a bundled JS build and
did not load the current development bundle; native iOS rendering
remains unverified. No Mac or store build was made.

Cleanup: stopped the isolated stack, web server, Metro and reverse
tunnel; removed device forwards, pairing credentials and generated
native output; closed device/browser sessions while preserving the
existing AVDs.

Copy audit: no UI text changed.
nixuuu added a commit that referenced this pull request Nov 19, 2026
## Changes

Mobile threads show send progress in the existing send button. The work
header carries the turn from “Starting” to “Working” in place. A slow
confirmation shows a message above the composer without resizing the
conversation.

Web and desktop keep the send button width stable while its icon
changes. Pending bot messages stay dimmed until confirmation on all
clients. Delivery failures retain their visible “Not sent” label.

Fixes: #276

## Verification

- Measured 0 px of vertical movement for the tested message and composer
transitions on Android at 320 and 411 dp, in light and dark themes.
- Checked the shared web and desktop components in Chromium at 390 and
1280 px in both themes. The work header, message bubbles and Steer
button kept their positions across the tested transitions.
- Mobile typecheck, lint on the edited mobile files, formatting and diff
checks passed locally. The visual checks used locally controlled
delivery states. Native iOS, a separate Electron window and a live
gateway send were outside the local verification. Full repository checks
run in CI.

## Copy audit

Passed the §8 audit. Previously, “Starting” appeared twice and a
temporary “Sending…” caption repeated the progress indicator. The work
header now reports startup once. The send controls expose progress to
assistive technology. Slow delivery and failure messages still explain
their states. Checked short and multiline messages and the waiting
notice with a long computer name.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant