Merge branch 'main' into worktree-agent-a35ac03e196ffae50

# Conflicts:
#	app/lib/features/runs/ui/run_detail_content.dart
#	app/lib/features/runs/ui/run_list_row.dart
#	app/tool/search_selection_probe_entry.dart
This commit is contained in:
2026-11-04 17:44:29 +00:00
296 changed files with 17727 additions and 3360 deletions
+14 -2
View File
@@ -31,8 +31,10 @@ component, on both hosts.
given. Only below `kAppListRowMinimalWidth` (160, narrower than any list
pane) does it drop the avatar and menu so the text never overflows.
(`keepMenuWhenCompact` is gone: every row keeps its menu.)
- No fixed heights. Padding is 16 horizontal and 10 vertical. At 2x text in
a 320px row everything ellipsises without overflowing.
- No fixed heights. Padding is 16 horizontal and 13 vertical
(`kAppListRowVerticalPadding`), with a 4px gap under the title and a 14px
gap after the avatar (8 when compact). At 2x text in a 320px row
everything ellipsises without overflowing.
- Test keys: `appListRowSurfaceKey` and `appListRowDividerKey`.
- `app_list_avatar.dart`
- `AppListAvatar` is a 40px circle (the `CircleAvatar` default) holding an
@@ -130,3 +132,13 @@ directory). The sources were:
The captures were taken at 560 and 1200, in light and dark, on Material and
Cupertino. There was no device run, so Android and iOS are unverified.
## Roomier rows (2026-11-03)
The user found the chat, run and pipeline lists cramped. In `AppListRow` only:
vertical padding 10 -> 13 per side, title-to-subtitle gap 2 -> 4, avatar-to-text
gap 12 -> 14 (compact stays 8). A two-line Material row goes from about 69 to
75 logical px; text sizes and the content-driven layout are unchanged, and the
divider still starts at the text column. Narrow (compact) list panes still fit.
Captures (Material light, 560x1000 and 1400x900, plus a narrowed pane and
Cupertino chat) are in `/tmp/rowsize/{before,after}/`.
+92
View File
@@ -0,0 +1,92 @@
# Artifact viewer: full screen, HTML scroll/pan/zoom, links
## What changed
- The viewer's bottom bar has a **Full screen** control (Material
`Icons.fullscreen` / `CupertinoIcons.fullscreen`). It pushes a full-screen
dialog route on the root navigator, covering the shell's tab bar and list
pane. The route draws the same viewer frame (`ArtifactFullscreenHost`
mixin + `buildFrame`), so the same top bar, preview and bottom bar
(`ArtifactViewerBar`, shared, not duplicated) appear, and paging, loading
and status follow the page. Exit: the bar's **Exit full screen**, the
route's Close (Material X / Cupertino Cancel), Escape, system back.
- Full screen renders the bytes the viewer already fetched with the app's
session. It never calls `openArtifactExternally`/`launchUrl` for the
artifact. The iPad report (HTML opening in Chrome, then a sign-in prompt)
came from the viewer's existing **Open** action
(`openArtifactExternally` → `launchUrl(externalApplication)`): it is now
labelled **Open in browser** in the viewer bar and the gallery dialog.
- Images, text, tables and video keep their own behaviour in full screen.
## Why HTML would not scroll or pinch
- **Android/iOS app:** a platform view only gets pointers for gestures its
`gestureRecognizers` win in Flutter's gesture arena. `WebViewWidget` had
none, and the viewer's page-swipe `GestureDetector` (horizontal drag)
stays in the arena until the finger lifts, so the web view got a drag only
after release: no live scroll, no pinch. Now inline the web view claims
vertical drags (the document scrolls, a horizontal swipe still pages), and
full screen claims every pointer (`EagerGestureRecognizer`): scroll, pan
and pinch all reach the web view. Zoom is on (`enableZoom(true)`; the
Android plugin already sets built-in zoom with hidden controls and ignores
viewport meta, so no viewport injection is needed).
- **Web:** wheel, trackpad and touch scrolling inside the iframe already
worked (captured below). Pinch cannot work: a pinch over a frame is a page
zoom, which the Flutter page's viewport (`user-scalable=no`) refuses, and
the sandbox (no `allow-same-origin`) keeps the document out of the app's
reach. Full screen therefore adds **Zoom out / Actual size / Zoom in**
(50%–400%) that scale the live frame like a browser page zoom (frame laid
out at 1/zoom and scaled back), so the document reflows and keeps
scrolling. Not a screenshot.
## Links
- Decision: `lib/features/artifacts/domain/artifact_html_links.dart`
(`artifactHtmlLinkAction`): `#place` / `about:blank|srcdoc#place` stay in
the document; `http(s)` with a host and `mailto` open outside; everything
else (`javascript:`, `file:`, `data:`, `tel:`, `intent:`, relative paths,
`//host`) is inert.
- Web: the iframe sandbox is `allow-popups allow-popups-to-escape-sandbox`
(still no scripts, no same-origin, no forms, no top navigation). Before
showing, the document is rewritten through the browser's inert
`DOMParser`: `<base>` removed, external links get `target=_blank
rel="noopener noreferrer"`, in-document links become `about:srcdoc#place`
with `target=_self` (a bare `#place` resolves against the app page in a
srcdoc frame and blanked the frame), blocked links lose `href`.
- Native: the `NavigationDelegate` allows the initial `about:`/`data:` load
until the page finishes, then applies the same decision; external links go
to the system handler, nothing else navigates the view.
- Relative links cannot resolve (the document is loaded from a string with
no address) and stay inert. A link to the Pipelines server itself opens in
the browser without the app's session.
- Applies inline and in full screen.
## Checks
- `flutter analyze`: no issues. `tool/memwatch/full.sh test`: 2778 pass;
`test/features/artifacts`: 240 pass (new `ui/artifact_fullscreen_test.dart`,
`domain/artifact_html_links_test.dart`).
- Real Chrome (capture kit, `--params html=1`, fixture
`tool/capture/fixtures/release-dashboard.html`), captures in
`/tmp/afs/final/`:
- `desktop/` 1280x900 Material: inline, full screen, wheel scroll, zoom
125%, Details sheet over the frame, Escape back to the inline viewer.
- `phone/` 560x1000 touch: full screen, swipe up scrolls, swipe left pans
the wide table; a pinch does not zoom (web limit above).
- `ipad/` 820x1180 Cupertino touch: full screen, swipe scrolls, Exit full
screen returns.
- `links/`: "Jump to section 5" scrolls the frame; example.com opens a new
tab (`05-tabs-after-external.json`) with the frame unchanged; script and
relative links are plain text and open nothing.
- The capture kit gained `--touch true`, `swipe=`, `pinch=` and `tabs=`.
## Not verified / limits
- Android and iOS behaviour (web view gestures, pinch, link hand-off) is
**unverified**: no device or simulator was used.
- Web: no pinch zoom (buttons instead). A zoom step returns the document to
its top: Chrome resets the frame's scroll when the app resizes it (a plain
page keeps it; wrapping the frame in a box did not help).
- Web: Escape while focus is inside the frame goes to the frame; use the
close button or click outside first.
- Narrow windows: the bar's actions scroll sideways so the pager stays whole.
+24
View File
@@ -13,6 +13,16 @@
links outside backtick code become links. Text without a link stays
`SelectableText`.
- Inline code and fenced code are never linkified.
- Click: a primary mouse press on a link belongs to the link (its recognizer
accepts on pointer down), like a press on a web page's anchor. Before, the
`SelectionArea` claimed the press as a selection drag once the pointer moved
`kPrecisePointerPanSlop` (2 px), so in the browser a click with a little
hand or trackpad drift opened nothing (headless Chrome: 0-2 px opened, 3, 5
and 8 px did not). The click still cancels past the tap slop (18 px); a
selection drag that starts on plain text still crosses links; a drag that
starts on a link selects nothing (as a browser drags an anchor). Touch,
stylus and right-click presses keep competing in the arena, so a long press
still selects and offers Copy link.
- Style: host primary colour (`CupertinoTheme.primaryColor`), underline; hover
thickens the underline (paint-only, selection survives) with a click cursor.
- Copy link: long press adds it to the selection toolbar. On native desktop the
@@ -23,6 +33,17 @@
rebuilds without its platform menu wrapper, remounts its subtree, throws in
`StaticSelectionContainerDelegate.hasSize` and drops the selection.
Browser check: `tool/capture/examples/chat-link-click.json` drifts a click
5 px on a link and drags a selection across links, and expects exactly one
`window.open`. Checked in headless Chrome (Nov 2026), desktop and touch
emulation (iPhone/Android/iPad user agents): tap and click open through
`window.open` with user activation active; right-click Copy link (desktop)
and long-press Copy link (touch) write the URL to `navigator.clipboard` and it
reads back. Not verified: real iOS/macOS Safari (popup and clipboard user
activation rules differ) and real devices. In headless CPU rendering the
text-selection toolbars (stock Copy/Select all as well as Copy link) draw no
surface; popup menus do, so this looks like the renderer, not the links.
Browser capture: `?links=1` on the chat fixture (`tool/perf/chat_scroll_fixture.dart`).
With the capture kit's semantics tree on, a CDP click lands on link semantics
nodes whose rects are the bounding box of a wrapped link, so verify clicks with
@@ -30,3 +51,6 @@ pointer events dispatched to `flutter-view`.
Observed, not caused by links: dragging a selection over text below a fenced
code block in the same answer also highlights the code block.
## 2026-11-03 operator check
The operator confirmed "Copy link" works in their browser; only the drifting mouse click was broken.
+46
View File
@@ -0,0 +1,46 @@
# Answered questions collapse into their turn like tool calls
User report: after replying to a harness question (OpenCode question tool,
Claude Code AskUserQuestion, Codex elicitation) the question card stays at the
bottom of the chat. Follow-up: it should collapse like tool calls.
## Root cause
Not a missed server event. The reply's ack already marked the form resolved
locally (`ChatThreadCards.answerQuestion`), and OpenCode/Codex resolution
frames folded correctly. But every retained form, settled or not, was still
rendered as a full card in the transcript's `trailing` rows
(`chatCardRows` -> `transcriptRows(trailing:)`), so an answered question stayed
as an "Answer recorded." card pinned after the last message. Narrow and wide
used the same rows; on a phone the card simply covers more of the screen.
## Behavior now
- Pending questions, and ones whose answer was refused (with the server's
reason), stay full interactive cards.
- Once the reply is acknowledged (Claude Code: the ack is the only prompt
signal; the server's readback resolution comes later) or the server sends a
resolved/cancelled `form` frame (OpenCode `form.replied`/`form.cancelled`,
Codex), the card leaves the card list and becomes a `ChatTurnChip` in the
footer of the agent turn it arrived during, beside `N tools`:
`Which database? · Postgres` (`· Expired`, `· Closed`, `· +N more`). It opens
a native sheet with the title, status and full recorded answers.
`groupSettledQuestions` in `lib/features/chat/conversation/chat_question_group.dart`.
- Forms carry no turn id, so the client stamps the agent message streaming
when the first frame arrives (`raised_in_message_id`, client-only). A question
with no turn in view shares one loose `questions` row where it stood.
- Forms are not part of stored history and the server replays only pending
ones, so after a reload an answered question is gone (its tool call remains
in the turn's tools chip).
## Evidence
- Tests: `test/features/chat/conversation/chat_question_group_test.dart`
(grouping, summary, narrow 390x844 and wide 1280x900 ack collapse, refusal
keeps the card, OpenCode/Codex resolution frame, cancel, ack plus
form.replied, Cupertino, stale pending replay, remount). The full
`test/features/chat` suite passes; `flutter analyze` is clean.
- Browser: fixture option `?question=claude|opencode|fail`
(`tool/perf/chat_question_fixture.dart`). Before/after captures at 560x1000
and 1280x800 under `build/cq/out/`.
- Not deployed, no device verification.
+21
View File
@@ -0,0 +1,21 @@
# Chat list: tool calls no longer mark a chat New
Follow-up to 985cc355 ("Fix chat session unread attention state").
Root cause: that fix made unread purely frame-driven
(`lib/features/chat/ui/sessions/session_attention.dart`), but it still listed
a returned tool result (`kind: tool`, status `completed`/`error` with content or
error) and any `kind: user` frame as unread content. Every finished tool call in
a background chat therefore raised the New badge even when the agent had said
nothing yet. Text frames carrying a `message_kind` (harness `notice`, subagent
`agent_report`, often emitted around tool calls) and whitespace-only deltas also
counted.
Now only visible assistant reply text (`kind: text`, non-blank delta, no
`message_kind`, matching the server's own `finalReplyTextLocked`), a pending
form, or an unresolved permission request marks a chat New. Tool frames only
drive the working indicator. The open chat stays excluded (`activeSessionId`).
Tests: `test/features/chat/ui/sessions/chat_sessions_live_new_test.dart`
(tool call case, open-chat case), `session_attention_test.dart` (frame table).
Not browser- or device-verified.
+44
View File
@@ -0,0 +1,44 @@
# Interface font choice (per device)
Settings > Font offers System default (the default everywhere: Roboto on
Android and the web, SF in the iOS app), Inter, IBM Plex Sans, Source Sans 3
and Atkinson Hyperlegible Next. Each option is named in its own face.
- `lib/ui/theme/app_font.dart`: the options, stable stored ids and assets.
- `lib/ui/theme/app_font_store.dart`: `shared_preferences` key
`pipelines.next.font.v1`, so the choice belongs to this device or browser
and is never sent to the server.
- `lib/ui/theme/app_font_controller.dart`: `AppFontController.instance`
loads the chosen family with a `FontLoader` and only then switches the
theme (one switch, no reflow loop). Startup waits up to 1.5 s for a stored
font beside the session load, then draws in the system font and applies
the font when it lands. A failed load keeps the current face and says so.
- `lib/ui/theme/app_theme.dart`: `appLightTheme`/`appDarkTheme({fontFamily})`
and `appCupertinoThemeWith({fontFamily})` replace only the family in every
text role; sizes, weights and text scaling are unchanged. Explicit
`appMonospaceFamily` (RobotoMono) styles are untouched.
- `MyApp` and the onboarding host rebuild from the controller, so a choice
applies immediately on Material and Cupertino hosts.
- `lib/ui/theme/app_font_licenses.dart`: each `fonts/<family>/OFL.txt` is
registered with `LicenseRegistry`. The app has no licence page of its own
yet, so nothing shows them in the UI.
## Web download cost
The families are plain `assets:`, not pubspec `fonts:` (the web engine fetches
every `fonts:` family at boot). Browser resource log on the fixture build:
startup fetches no optional font; opening Settings fetches each family's
Regular weight for the previews (65–431 KB each); choosing one fetches its
other three weights. A stored choice fetches only its four files at startup.
Build size (release web): `main.dart.js` 4,214,247 -> 4,232,251 bytes (+18 KB,
+5 KB gzip); `build/web` 43.6 -> 48.0 MB because the four families' 16 TTFs
(4.45 MB, 2.09 MB gzip) ship as on-demand assets. The APK grows by about the
same compressed amount (not measured).
## Known gaps
- Chat markdown code blocks were already in the proportional UI face, not
RobotoMono; they now follow the chosen font too.
- On the web Cupertino fixture, "System default" names an unregistered
`CupertinoSystemText` family, which the browser engine substitutes.
+9
View File
@@ -0,0 +1,9 @@
# Changes: why a file has no patch
The server's `FileChange.no_patch_reason` (`binary`, `file_size`, `budget`,
`lines`, `evidence_size`, `git_status`, `baseline`) is parsed into
`FileChange.noPatchReason` and worded by `noPatchReasonMessage` in
`lib/features/changes/domain/change_wording.dart`. The file viewer shows it in
place of the generic truncated/binary message. A missing, blank or unknown
reason (older server) keeps the old wording. Tests:
`test/features/changes/no_patch_reason_test.dart`.
+51
View File
@@ -0,0 +1,51 @@
# Run token usage beside size
Runs that spend 20M+ tokens now show it the way they show disk size.
## Server (payload)
- `RunSummary.usage` (`protocol.RunUsage`) moved up from `RunDetail`, so
`list_runs` rows carry the run total too. `get_run` still sends `usage` at
the same JSON key, now through the embedded summary.
- The list fills it with one grouped `step_usage` aggregate per 100-run batch
(`internal/pipeline/run_usage.go`), using the same column sums as the
history-wide stats (`usageSumColumns` in `stats.go`). It is joined to
`run_steps`, so orphaned usage rows (reported: about 650 rows, 1.47B tokens,
left by an Oct 19 history wipe) no longer count in stats or per-run totals.
The rows are not deleted. If a wiped run id was reused, an orphan row that
matches a new run's (run_id, sequence) still cannot be told apart.
- `StageUsage` now keeps `tokens_reasoning`, `cache_read` and `cache_write`
with `cache_known` (the runner dropped them before). They are JSON keys in
`usage_json`, so old rows need no migration: they lack `cache_known`, so
their cache share is unknown, not zero. Run totals add `cache_known_stages`
and `cache_known` (every token-reporting stage recorded the split).
## App
- `lib/features/runs/domain/run_tokens.dart`: parsing and formatting.
`22.4M tokens`, `≥9.1M tokens` when `tokens_known_stages < stages`. Nothing
is estimated, and a row without `usage` (an older server) shows nothing.
- List row: tokens after the size, in both the full and the compact subtitle.
- Sort: `Most tokens` (`most_tokens`) after `Largest first`, flat like it.
Runs without a reported total sort last.
- Summary: `Size on disk`, `Tokens` (`22.4M · 2.1M fresh, 20.3M cached ·
1.8M in, 240K out`; fresh is total minus cache reads, shown only when
`cache_known`) and `Cost`.
- Stage rows: the Timeline row subtitle adds `· 20.1M tokens · 97% cached ·
$1.42` (`stageTokenRowLabel`). The cached share (cache reads over the total,
rounded) appears only when the stage recorded `cache_known`; the cost only
when positive, to two places, `<$0.01` below half a cent. The visit facts
add `Tokens` and `Cost` (`Not reported` stays there).
- Cost is shown only when a positive `cost_usd` was reported. Subscription
models report `cost_known` with no amount, which shows as `Not reported`.
The stats page's `Reported cost` uses the same rule.
- `usage` is no longer treated as detail-only in
`RunsController.acceptRunDetail`, so opening a run refreshes its row's total.
## Evidence
Fixture: `tool/probe_usage_fixture.dart`, opt-in `?usage=1` on the capture
entry (run 7: 340 MB, 22.4M tokens, mostly cached, $1.42; run 6: partial
≥9.1M). Captures were taken with `tool/capture` at 560x1000 and 1400x900:
the list, the sort sheet, Most tokens, the run 7 Summary and Timeline, the
build and plan visits, and the no-usage (old-server) list and Summary.
@@ -0,0 +1,58 @@
# Session list: turn and background-task indicators
Request: besides the turn spinner, show a quieter indicator on a chat list row
when the turn is idle but the session still runs background work (shells,
Claude Code background Bash and Agent/Task subagents, Codex command executions,
OpenCode shells). Also make the spinner reliable for every listed chat, not
only chats this connection opened.
Implemented, with an approved server change.
## Server
- `protocol.ChatSession.Activity` (`activity`: `turn_running`,
`background_tasks`, `seq`) is set on every `chat_sessions` row from the hub's
own state (`internal/server/chat_activity.go`, `handleChatSessions`).
- `chat_activity` is pushed to every connection (through `chatSessionChanges`)
when a session's turn starts or ends or its running-shell count changes. It
is computed under the hub mutex at those points only: turn admitted or
finished, step frames, shell frames, shell readback, and room release. Text
and tool chunks never push. `seq` starts from the wall clock in microseconds,
so it orders across a restart.
- Keep-alive: `keepUnattendedLocked` keeps an unwatched room while it holds
running shells, so their exits are seen and the badge clears. When the last
shell exits, the room is released at once (`emitRoom`) or by the reaper.
Bounds: the existing 16-room unattended cap, the 6-hour
`chatUnattendedTurnLimit` (measured from when the room became unattended),
and the harness itself. A Claude Code process exit now reports its running
background tasks as exited (`processExit`, `internal/claude`). A released
room reports 0 tasks rather than a stale count.
## App
- `ChatSessionsController` applies `chat_activity` and row `activity` by `seq`
(the larger wins), deriving `running` and `background_tasks` on the row.
The list re-reads on reconnect (the existing `syncToken`). A server without
`activity` leaves the list as before.
- `session_activity_badge.dart`: the turn spinner, or, when idle with tasks,
a muted `Icons.pending` / `CupertinoIcons.ellipsis_circle_fill` glyph with
tooltip and semantics "Background tasks running (N)". The tooltip shows on
hover only (`TooltipTriggerMode.manual`), so a touch long press stays the
row's own gesture.
- Fixture: `?chats=N&activity=1` in the capture app lists one running chat,
one with two background tasks and idle chats (`tool/perf/perf_fixture.dart`).
## Evidence
- Go: `chat_activity_test.go` covers the list payload, the pushes on turn start
and end and on task start and exit, unattended keep and release on exit, and
expiry of a task that never reports an exit. `background_tasks_test.go` covers
the Claude process exit.
- Flutter: `test/features/chat/ui/sessions/chat_sessions_activity_test.dart`.
- Captures (fixture app): Material phone 560x1000, Material desktop
1280x900 with the hover tooltip, and Cupertino dark phone.
## Unverified
- Real harness behaviour. Shell start and exit events come from each adapter's
existing translation. Whether a real Codex or OpenCode background command
always reports its exit was not exercised against live harnesses here.
- Background Bash outliving a crashed Claude Code CLI. It is reported exited
on process exit, on the assumption that the CLI's tasks end with it.
- Device (Android/iOS) rendering; only the browser was captured.