Commit Graph

76 Commits

Author SHA1 Message Date
alan 2bc00a2a94 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.
2026-10-17 15:14:52 +01:00
alan 355fe4e908 chat: search the session list and group it by directory
With a day's sessions the list was a flat, unsearchable wall in recency
order, so the chat the operator wanted was the one that could not be
found, and sessions of one repository were scattered through it.

Narrow the list as the operator types and keep same-repository chats
together, using the control and empty-state patterns the other lists
already use:

- ChatListFilter.kt adds the one pure derivation: sessionMatchesQuery /
  filterChatSessions match a case-insensitive substring over a session's
  title and directory, a blank query narrows nothing, and the survivors
  keep their incoming (recency) order. groupChatSessionsByDirectory groups
  the narrowed list by directory, each group keeping that order and the
  groups ordered by their first (most recent) session, so the top still
  leads with the newest activity.
- ChatState.sessionQuery (set through ChatStore.searchSessions /
  AppViewModel.setChatSessionQuery) is a display narrowing only: the
  server's list, open conversations and the activity marks are untouched.
  filteredSessions is visibleSessions narrowed by the query.
- ChatListPane renders the existing FilterMenu with one OutlinedTextField
  and a Clear search reset (the pipelines/runs filter pattern), shows a
  directory heading per group only when more than one directory is
  present, and renders the shared EmptyState ("No chats match ...") with
  a Clear search action when nothing matches. The trailing New chat
  action is never hidden while the list is narrowed, and every row still
  shows its directory.

Tests (ChatListFilterTest, 9 cases): the match rule over title and
directory, that a narrowing preserves the recency order, grouping by
directory (order by the first session, order kept inside a group, a
single directory yields one group, a blank directory groups too), and
through the store that searching narrows filteredSessions, clearing
restores the full list, the server's list is untouched and a filtered
session still reports its activity mark.

Checked before commit: android/README.md was updated in this change with
the behaviour, tests and evidence. The packaged authoring skill references
(internal/author/skill/references/) document the Pipelines server, its
chat_* protocol surface and authoring, none of which changed - this is a
client-side narrowing over the already-listed sessions - so none needed
updating, and the internal/author/install.go managed reference inventory
is unchanged. No repository template or root/topic doc describes the
Android session list, so none was stale.

android/ only; no dependency added beyond the already-declared
material-icons-extended; no run is started from the app.
2026-10-17 14:50:30 +01:00
alan bb486acc11 chat: mark new activity in the session list
With several operator sessions the list gave no sign of where a reply
arrived: an idle chat and one streaming a reply right now looked the same,
so the operator lost the conversation they were in.

Add a per-session read state that the session list derives from data it
already receives, and render it as a three-state activity badge:

- ChatSeenState (ui/chat/ChatSeen.kt) keeps a per-session recency watermark
  (the newest updated_at the operator has read) plus the ids that moved on
  while the app was open. It is persisted as one opaque JSON preference
  (SettingsRepository chat_seen, observed by AppViewModel.observeChatSeen),
  the same way ChatSessionOverrides is, so the marks survive a restart and
  not only a reconnect.
- ChatState.isUnseen marks a background session that carried a live mark
  (a pushed chat_event/permission frame) or, if never opened here, is newer
  than its stored watermark; first sight of a session is seeded to its
  current recency so a pre-existing chat is not reported as new. Opening,
  activating and closing a conversation reads it and clears the mark;
  history for the active chat advances the watermark to the newest server
  message. No server request is added.
- ChatFormat.sessionActivity(running, unseen) is the one pure derivation
  (streaming outranks finished-unseen, which outranks idle) and
  SessionActivityBadge renders it as Streaming/New/Open beside the
  unchanged kind chip and directory line. Most-recently-used order is
  untouched.

Tests (ChatActivityTest): unseen is marked, opening clears it including in
the persisted state, the derivation distinguishes streaming/finished-unseen/
idle, and the seen state survives an encode/decode into a fresh store.

Checked before commit: android/README.md was updated in this change with the
behaviour, tests and evidence. The packaged authoring skill references
(internal/author/skill/references/) describe the Pipelines server and its
chat_* protocol surface, neither of which changed - this is a client-side
derivation over existing frames - so none needed updating, and the
internal/author/install.go managed reference inventory is unchanged. No
repository template or root/topic doc describes the Android session list,
so none was stale.

android/ only; no dependency added; no run is started from the app.
2026-10-17 14:40:02 +01:00
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
alan d1a859ec7d Merge lane-chat2: keep the lane's reviewed work 2026-10-17 12:46:18 +01:00
alan 664e563fca chat: open a conversation at its newest message and follow it
Opening a conversation used to start at the top, so the operator first had to
scroll down past everything already said to find the current turn. The
transcript now opens at its newest message, follows it while the operator reads
the newest part, and offers a jump-to-latest affordance when they have
deliberately scrolled up instead.

- Opening at the newest message. The transcript's list state is created the
  moment the conversation first has content, with its first visible item set by
  chatFirstScroll (ui/chat/ChatScroll.kt): a position the operator left is
  restored and clamped with the app's shared rule (restoredScrollAnchor), and
  every other conversation starts at its newest item. "A position of their own"
  is explicit now: ChatThread.scroll is nullable, null meaning the operator has
  never left a position here, so a chat left at the very top
  (ChatScrollPosition(0, 0)) is restored rather than mistaken for "new", and a
  list state that never held content saves nothing. Placement is unanimated, on
  the list's first measure, and goes through the one scroll path below.
- One scroll path, changed deliberately. The existing follow scroll, the app
  bar's approval jump and the new jump-to-latest all go through
  LazyListState.scrollToEnd(itemCount, animated); when the newest item sits
  entirely below the fold it is brought in first, and any part still below is
  then closed by exactly that distance (closeBottomGap). An item already partly
  visible is only gap-closed, so following a growing stream never bounces. The
  distance is measured against the transcript's content count
  (chatBottomDistancePx), not the layout's stale count, so an item appended
  ahead of the measure that shows it actually arrives in view.
- Follow while reading the newest part. Only the operator's own drag changes
  following (a DragInteraction.Start stops it, a settling Stop/Cancel resumes it
  at or within the threshold, chatFollowsAt); while it holds, an arriving
  message, a streamed delta, a tool chip, a freshly arrived approval card, a
  grown composer or the appearing keyboard re-follows smoothly. The item count
  is read at use time (rememberUpdatedState) so a captured count cannot go
  stale. Programmatic scrolls never touch the list's interactionSource.
- Threshold. CHAT_FOLLOW_THRESHOLD_DP (ui/theme/Dimens.kt) is 32dp: about one
  comfortable line of text.
- Jump to latest. A small Material 3 SmallFloatingActionButton (the
  already-declared KeyboardArrowDown icon, on the shared gutter token) is offered
  only while the view is not following and there is genuinely something below the
  fold (chatShowJumpToLatest), hidden at the bottom or for an empty transcript;
  tapping it re-engages the follow. A pending permission/approval is still
  brought into view as the existing code did - it is the transcript's last item,
  so the follow brings it in while the operator reads the newest part, and the
  app bar's approval action still jumps straight to it.

android/ only: no dependency added beyond the already-declared
material-icons-extended, no run is started from the app, and no Pipelines
server, Go source, installer or Docker file is touched.

Checks: the packaged authoring skill references need no update - they document
the Pipelines server's own contract, not the Android client, and this change is
app-side only, so nothing in them became stale. There are no packaged templates
in this repository. The repository's topic doc for the client, android/README.md,
is updated in this change with the flow, the threshold, the one scroll path and
what remains unverified on a device.

Verified by the review stage on this tree: gradle --no-daemon
:app:testDebugUnitTest :app:assembleDebug -> BUILD SUCCESSFUL, 50 suites / 458
tests / 0 failures / 0 errors / 0 skipped (including the new ChatScrollTest, 11
cases), and the published APK matches the freshly built app-debug.apk
byte-for-byte.
2026-10-17 12:45:37 +01:00
alan 8644ff98a3 Merge lane-chat2: combine operator chat session management with live run updates
Both sides are reviewed work and both are kept:

- android/app/.../ui/AppViewModel.kt: HEAD's live-run push wiring
  (RunStreamState/_runStream, combine(connectionState, settings.workspace),
  subscribeRuns/streamDown/resync, applyRunEvent, scheduleRunsResync/
  scheduleRunDetailSync, observeRunEvents) together with lane-chat2's chat
  management (ChatStore overrides, observeChatOverrides, refreshChatDirectories,
  startNewChat/selectChatDirectory/cancelNewChat/createNewChat,
  renameChat/removeChat/undoRemoveChat). The only textual conflict was the
  import list; combine (HEAD) plus map and ui.chat.ChatSessionOverrides (lane)
  are all kept and all used. No duplicated definitions.
- android/README.md: HEAD's "Live run updates from the socket" section and
  lane-chat2's "Operator chat sessions: choose the directory, list only your
  own" section are both present once, in file order.
- The rest of lane-chat2's chat files (ChatDirectories.kt, ChatOverrides.kt,
  ChatStore.kt, ChatScreen.kt, ChatFormat.kt, protocol Chat/Message, repositories,
  tests) merge cleanly on top of HEAD's work.

Documentation check: android/README.md is updated by this merge and its new
section is consistent with HEAD's. docs/cli.md and
internal/author/skill/references/operations.md already describe the server's
chat_sessions/chat_create/chat_directories surface this client builds on, and
the authoring skill (SKILL.md, references/) contains no Android-client behaviour
to stale, so nothing there needed changing and no packaged reference or
inventory entry was touched. No server, installer or template change is part of
this merge.

Checks (android/, Gradle 8.11.1, --offline):
- gradle :app:testDebugUnitTest --offline --rerun-tasks -> BUILD SUCCESSFUL;
  test-results report 463 tests, 0 failures, 0 errors across 50 suites
  (including ChatDirectoriesTest and ChatSessionManagementTest).
- gradle :app:assembleDebug --offline -> BUILD SUCCESSFUL (debug APK built).

Not verified here: on-device picker/rendering, which the visual-review stage owns.
2026-10-17 11:45:41 +01:00
alan 311a0156d6 chat: choose a new chat's directory and list only the operator's sessions
Starting a chat now asks where first, and the session list is the operator's
own chats alone, told apart by the server's own tag.

- The create flow is a normal pane of the chat stack, not a modal: it loads
  the server's chat_directories (home first, then the directories of previous
  operator sessions, most recently used first) into the shared ListRow, each
  with its full path, and starts on the operator's home
  (directoryChoices/defaultDirectoryChoice). Back, the app-bar back control,
  the footer Cancel and predictive back all leave it without creating
  anything. chat_create is always sent the chosen directory (HOME_DIRECTORY
  "~" for home, the absolute path for a recent), so a session is never
  created in the server's working directory; the server resolves or rejects
  it and its error is shown in the pane.
- The list renders ChatState.visibleSessions: exactly the server's
  chat_sessions (operator sessions only) with the operator's own local
  changes applied; the app adds no ownership guessing. Each row shows its
  directory and the kind chip derived from the server's tag
  (sessionTagLabel, "operator" -> "Operator"); another tag shows verbatim,
  an untagged session shows no chip.
- The brokered protocol exposes no chat rename or delete (no
  chat_rename/chat_delete type and no session endpoint), so both are
  device-local and persisted with the other settings
  (ChatSessionOverrides, KEY_CHAT_OVERRIDES): rename stores a local title
  that wins on later list loads, and "Remove from list" hides the row and
  closes its conversation with an Undo snackbar ("Removed from this list;
  the chat stays on the server."). Nothing is deleted on the server.
- Messages, streaming replies, tool chips, diff cards, approval cards, stop
  and the reconnect path are unchanged.

android/ only: no dependency added beyond the declared
material-icons-extended, no run is started from the app, and no Pipelines
server, Go source, installer or Docker file is touched.

Checks: the packaged authoring skill references need no update - the server
contract this builds on is already documented in
internal/author/skill/references/operations.md ("Brokered OpenCode chat",
committed with lane-chatsrv) and this change is app-side only, so nothing in
it became stale. There are no packaged templates in this repository. The
repository's topic doc for the client, android/README.md, is updated in this
change with the new flow, the honest local rename/removal and what remains
unverified.

Verified: gradle 8.11.1, JDK 17, --offline --no-daemon, from android/;
:app:testDebugUnitTest :app:assembleDebug -> BUILD SUCCESSFUL, 447 tests in
50 suites, 0 failures, 0 errors.
2026-10-17 11:39:11 +01:00
alan 6a6c1d65fa android: drive the runs list and run detail from server pushes
Replace the Android app's one-second run poll with the server's
workspace-scoped run_event pushes. The runs list, each pipeline row's
last-run line, the run header and the run detail (status, timeline,
stages, artifacts) now advance from the socket instead of polling or a
manual refresh.

- Wire: Message.kt mirrors internal/protocol/runevents.go (subscribe,
  unsubscribe, run_event; RunEventFrame/RunStepDelta). The frames are
  unsolicited and already arrive on the client's events stream;
  PipelinesRepository.subscribeRuns/unsubscribeRuns add the typed
  command, sent via a new PipelinesClient.sendOnly that does not hold the
  send lock waiting for the running server's unreliable subscribe ack.
- One pure fold: ui/RunEvents.kt folds a frame into the list (in place,
  order preserved) and the open detail with one shared status ladder and
  one shared run-field merge. It is monotonic (a stale or duplicate
  delta is dropped whole), reports needsResync for a run the list does
  not hold instead of inventing a row, and only requests a full get_run
  for a settled step or terminal run.
- Wiring: AppViewModel subscribes once per (re)connect and workspace;
  every (re)subscribe re-reads the list and open detail once, because the
  deployed server's subscribe snapshot is partial, then folds the pushes
  on top. Re-reads are push-driven, coalesced and keyed so no push is
  dropped and no timer remains. LiveBadge (RunStream.kt RunStreamState)
  shows honestly live/reconnecting/not live, confirmed by the ack, a
  push or a successful read and dropped when a read fails.
- ui/RunEventsTest.kt pins the delta sequence as pure cases: created run
  not in the list, step started, step finished, run finished, unknown
  run, duplicate/out-of-order deltas, and a reconnect resync.
- android/README.md records the change, the wire mapping and the
  observed limitation of the running server (partial snapshot, no ack
  within 30s), which the client tolerates without inventing a stream.

Checked where the change belongs: android/README.md gained this entry;
docs/cli.md described the Android app as still polling, which this makes
stale, so that sentence now says the app consumes the pushes while the
TUI still polls. The packaged TUI pipeline templates (internal/tui) do
not touch run-state refresh and need no change, and the packaged
authoring skill references (internal/author/skill/references) document
the authoring workflow, not the Android client's run updates, so none of
them needs updating.

Reviewed and approved by the run's review stage (build, unit tests,
Kotlin compile and lint in android/README.md); no merge/rebase/cherry-pick
was in progress and no conflict was present.
2026-10-17 11:15:21 +01:00
alan 7875762b9a Merge lane-c: keep the lane's reviewed work
Combine the two reviewed versions of the Android artifact gallery/viewer.

- ArtifactViewer.kt: keep lane-c's gallery-wide paged full-screen viewer
  (artifacts/index/configuredServerUrl/onIndexChange overload with paging
  gestures, header, page buttons, share action and video-frame support) and
  re-add HEAD's single-artifact overload (url/name/fetchBytes/onDismiss/video)
  as a thin wrapper so StageVerdict still compiles and works.
- Artifacts.kt: keep lane-c's gallery-owned single viewer + onOpen callback and
  compose HEAD's all-artifacts-as-tiles grid (media tiles open the paged viewer,
  non-media open externally, selection and per-item share/copy preserved).

Checked: no conflict markers remain in any affected path. android/README.md
already carries the new "Page between artifacts in the full-screen viewer
(17 Oct 2026)" section documenting this change; the packaged templates, the
top-level README and topic docs, and the packaged authoring skill references
are not made stale by this Android-client UI change, so nothing further needs
updating.
2026-10-17 02:35:42 +01:00
alan f440b109ac Swipe between artifacts in the full-screen artifact viewer
The full-screen viewer becomes a pager instead of a single image with no
way to reach its neighbours.

- ArtifactGallery now owns the one viewer instance over pagedArtifacts(groups)
  -- the grid's image artifacts in the order the grid draws them -- and each
  tile opens the position it holds in that list via viewerIndexByUrl, so the
  grid and the viewer derive their index from one source (previously a second,
  untested per-tile counter and a per-tile viewer that had no neighbours).
- A horizontal drag or flick in ArtifactViewerBody moves to the previous/next
  artifact: pagedIndex moves by one and clamps at both ends without wrapping,
  a single-item gallery is inert, and canPageAtScale pages only at fit so a
  zoomed image pans via the existing zoomAbout/clampImageOffset as before.
  Previous/next IconButtons (disabled at each end) keep both neighbours
  reachable without a swipe, and the header shows "N of M · type" while the
  open artifact's own content, type icon, name and actions reload per artifact.
- Pure helpers pagedArtifacts, viewerIndexByUrl, pagedIndex, canPageAtScale and
  artifactViewerPositionLabel are added to ArtifactViewer.kt; ArtifactViewerTest
  covers next/previous, clamping at both ends, a single-item and an empty list,
  a zoomed viewer that does not page, the paged order versus the grid's draw
  order, and the per-artifact position label.

Placement check: the Android topic doc android/README.md is updated in this
commit with a section describing the pager, its gesture rule and the recorded
build/test checks. No packaged template and no packaged authoring skill
reference (internal/author/skill/references/*, internal/author/install.go's
inventory) documents the app's full-screen artifact viewer, so none needed
updating.

Only the four files this run changed are staged. The unrelated uncommitted
covered-pane statistics and list-load-phase edits (SlidingPaneStack.kt,
States.kt, Dimens.kt, LoadPhaseTest.kt) and the untracked scratch files in the
worktree belong to other changes and are deliberately left uncommitted.
2026-10-17 02:17:35 +01:00
alan c164d08cc5 Merge lane-c: keep the lane's reviewed work
Combines lane-c's Templates gallery and detail view with the chat and omni-search work already on main (lane-t2). The three files both lanes touched keep both intents: AppViewModel.kt keeps refreshTemplates/createFromTemplate alongside the search/chat flows, PipelinesApp.kt keeps both the Templates and Chat destinations, and graph/Artifacts.kt adopts the shared galleryGrid fitting while keeping the tile-gallery refactor.

Doc check before committing: nothing needs updating. This is an android/-only merge. The app's topic doc (android/README.md) already documents the Templates destination (lane-c) and the Chat/omni-search work (lane-t2). The root README and docs/ describe the server CLI/TUI (whose :templates catalog is a separate surface) and are unchanged. The packaged authoring skill references (internal/author/skill/references/) mention the Android client only for APK-delivery mechanics, which this change does not alter, and the packaged templates are server-side and untouched.
2026-10-17 01:42:51 +01:00
alan 052ece0163 skill: match the answer's length to the question in the conciseness guidance 2026-10-17 01:31:24 +01:00
alan 18db2f913a Add a Templates gallery and detail view to the app
The server's template catalog (the list_templates command) had no surface in
the app. This adds a Templates destination to the shared SlidingPaneStack: a
measured card gallery (name, short description, stage count and its own glyph;
one column narrow, a fitting grid wide) and a detail pane that reuses the
pipeline detail's Summary/Graph/Source tabs, plus a create-from-template action
that submits a create-only draft. Stage counts come from a source the server
parsed (validate); a source that does not parse is still viewable as raw
markdown.

Added: Templates.kt (TemplateEntry/TemplateCard, the grid-column and
stage-count mapping), components/GalleryGrid.kt (the shared measured-gallery
fitting, extracted from the artifact gallery), graph/SourceView.kt
(PipelineSourceView, the one rendered-definition view, extracted from
PipelineDetailScreen), screens/TemplateGalleryScreen.kt,
screens/TemplateDetailScreen.kt, TemplatesTest.kt.
Changed: PipelinesApp.kt (the Templates destination), AppViewModel.kt
(refreshTemplates/createFromTemplate), data/PipelinesRepository.kt
(listTemplates/validateSource/createPipeline), graph/Artifacts.kt (use the
shared galleryGrid), PipelineDetailScreen.kt (use the shared
PipelineSourceView), ArtifactGalleryTest.kt (exercise galleryGrid).

Doc/state check before committing:
- android/README.md (the app's topic doc): updated. Added a Features bullet for
  the Templates destination and a dated "Templates: a gallery and a detail view"
  section, matching the per-feature convention every prior android change uses.
- Packaged templates: not touched. The server's templates are Go-side and the
  brief forbids touching the Pipelines server; this change only renders the
  catalog the server already exposes.
- Packaged authoring skill references (internal/author/skill/references/): not
  updated. They document the Pipelines harness, not the Android app, and this
  change adds no harness runtime behaviour.
- Root README and docs/: not updated. They document the CLI/TUI/server, which
  are unchanged; the Android app is documented in android/README.md.

No conflict was present: no unmerged paths and no unfinished merge, rebase or
cherry-pick, so nothing needed resolving.
Deliberately left uncommitted (other work this run did not touch, not staged):
the worktree's other WIP - components/ListScroll.kt and screens/PaneStats.kt with
their tests, and the uncommitted edits to components/SlidingPaneStack.kt,
components/States.kt, theme/Dimens.kt and components/LoadPhaseTest.kt - plus the
untracked .ui-review-*/ capture artifacts.
2026-10-17 01:30:27 +01:00
alan 0df0c278b0 Open stage sections as their own pane instead of expanding inline
Expanding a stage section drew its rows stacked at the section's origin:
CollapsibleSectionBody passed the section's several field composables straight
into AnimatedVisibility, which lays out a single child, so the rows overlapped at
the top of the section and only the last was visible. The shared body now wraps
its content in one full-width Column, so any multi-row section stacks its rows
under its header.

Every stage section now opens as its own pane rather than growing the stage
screen inline:

- PaneState: add the Section pane level (MAX_PANE_DEPTH = 3) and a saved
  sectionKey primitive, with backStep/popTo/encode/decode handling so one Back or
  peek pops exactly one level and the open section survives rotation and process
  death.
- StageDetailPane: the stage screen keeps a compact collapsed list of its
  sections (Artifacts, Output, Input, This run, Stage definition); opening one
  shows it as a full-window surface over the stage on a narrow window, or a panel
  to the right of the stage pane on a wide one, with its own Scaffold/TopAppBar
  title, its own scroll and its own top spacing.
- SectionHeader: a navigation mode for those rows - a static forward chevron
  (mirrored for RTL) and an "Open <section>" action instead of a rotating
  disclosure chevron and "Expand/Collapse", so assistive tech is not told the row
  expands in place. The detail screens' disclosure rows are unchanged.
- DetailTabs: drop the rememberSectionExpansion initiallyExpanded seed, whose
  last caller was the inline stage definition.
- Tests: cover the Section level's backStep, popTo, encode/decode and depth, and
  the shared stageSectionSpecs order and blank-section cases.

Sections still start collapsed, the operator's choices still persist, and each
section's content is unchanged. android/ only; no dependency was added.

Also in this diff, from the covered-identity statistics work: PipelinesApp passes
compactStats = true on its two stacks (SlidingPaneStack's statistics flag).
2026-10-17 01:08:29 +01:00
alan cb71f35c59 Merge lane-c: keep the lane's reviewed work
# Conflicts:
#	android/README.md
#	android/app/src/test/java/net/awan/pipelines/ui/components/PaneIdentityTest.kt
2026-10-17 00:52:18 +01:00
alan dcd58b8a3d Reach the covered pane's full statistics and wrap its title at whole words
A covered pane's width is spent on the covered region (`identityWidth +
startInset`), and when a second level is covered `coveredEdgesDp` gives the
nearest identity that region less the thin older edge (`startInset + minTouch`;
the leading gesture inset cancels), i.e. `identityWidth - minTouch`. Flooring a
statistics-bearing identity at the full block alone (`MIN_COVERED_PANE_WIDTH_DP +
PEEK_WIDTH_DP`, 168dp) therefore left the nearest edge at 120dp, below the
`paneStatTier` Full boundary, so a pipeline's last-run/age and average lines were
filtered out at every depth a pipeline is ever covered. `coveredIdentityWidthDp`
now floors a statistics-bearing identity one touch target above the block
(`+ minTouch`), so the nearest edge is exactly 168dp and reaches Full, while the
single-covered and title-only cases are unchanged and the active pane width still
does not depend on depth.

The covered title also broke mid-word in a narrow strip ("Complete a Task" ->
"Complet"/"e a Task"). `wholeWordTitle` now packs the title greedily onto
whole-word lines and, once they are full, drops the remaining words and
ellipsizes the last line at a word boundary; a word wider than the whole strip is
the one exception, ellipsized to the width because it has no internal boundary.
It takes an injected `measure`, so the packing rule is unit-testable without a
device, and `PaneIdentity` measures with the same `cardTitle` role it draws with.

`PaneIdentityTest` adds the pure cases: the width-degradation tiers, the
statistics-bearing width floor, the nearest-edge geometry at depth 2 (which fails
without the `+ minTouch` reserve, so it pins the defect), and the whole-word
wrap/ellipsis/oversized-word/no-room cases. `android/README.md` records the
corrected geometry, the fix and the run's build/test evidence.

android/ only; no new dependency, no server field, and no server/Go/installer/
Docker change. Build and unit tests only (no device): 300 tests, 0 failures.
2026-10-16 23:30:47 +01:00
alan 0937327e8c android: correct omni-search IME docs to the declared adjustResize mode
The soft-input comments in the manifest, PipelinesApp.kt and android/README.md
still described `adjustNothing`, a mode the activity no longer declares. MainActivity
uses `android:windowSoftInputMode="adjustResize"` and the app draws edge-to-edge, so
the Compose window inset (WindowInsets.safeDrawing) is the single source of the IME
geometry and is applied once by the surface that owns it.

- AndroidManifest.xml: rewrite the soft-input comment to describe adjustResize, why
  the app is edge-to-edge and reads the IME from Compose window insets, and warn
  against changing it without re-checking the chat composer.
- PipelinesApp.kt: correct the bottom search column comment that claimed the activity
  declares adjustNothing and the window is never resized for the IME.
- android/README.md: correct the omni-search results-panel section that claimed the
  IME inset was counted once because of adjustNothing; now records the declared
  adjustResize mode, the edge-to-edge single source of IME geometry, and the chat
  composer's imePadding.

Documentation only; no rendered surface or behaviour changes. The omni-search entry
point and pill morph already exist at this HEAD; this reconciles the stale wording
with the committed mode.
2026-10-16 22:48:28 +01:00
alan 910a7aa798 Merge lane-app2: the chat experience and its multi-conversation state
Integrates eight commits of reviewed chat work: the Chat destination with
several conversations, markdown transcripts, tool-call chips with an expandable
INPUT/OUTPUT panel, edit diff cards, the composer's stop control, and approval
cards. The automated resolver failed on this merge repeatedly (its own stages kept
dying on the malformed-result defect), so it was integrated by hand.

Integration decisions:
- Pill geometry: main's tokens win. lane-app2 carried private duplicates of
  DESTINATION_ITEM_SIZE/GAP and a private DESTINATION_PILL_RESERVE, added before the
  geometry-token migration; those duplicates are dropped in favour of the theme
  tokens main already exports.
- IME mode: kept lane-app2's adjustResize for the window, because the chat composer
  and the search field both raise the keyboard and the chat UI was reviewed with it.
- Protocol and view-model constants: both sides' independent additions are kept.
- ChatScreen now passes the compactLabel main's SlidingPaneStack gained, and the
  literals lane-app2 introduced before the token discipline are converted to five
  new named tokens (HAIRLINE_DP, ICON_BUTTON_SMALL_DP, TOOL_PANEL_MAX_WIDTH_DP,
  CHAT_TITLE_MAX_WIDTH_DP, CHAT_BUBBLE_MAX_WIDTH_DP) rather than allow-listed.

Verified: assembleDebug plus the full Android unit suite (409 tests) pass,
including the geometry enforcement test.
2026-10-16 22:27:30 +01:00
alan 1fe7edb30f android: document the omni-search results panel
Add a "Omni-search results panel (16 Oct 2026)" section to android/README.md
describing the panel that sits above the omni-search field: its placement above
the input and IME, the badge/title/secondary row layout with a bold+underlined
snippet span, the debounced query with stale-response gating and no flicker to
empty, the loading/empty/error states, and result-to-target navigation for every
kind. Records the verification evidence (unit tests and assembleDebug, APK hash
and size, published APK and LAN URL) and notes what was left to the visual review.

No source behaviour changes: the panel logic already existed; this pass verified
it and filled the documentation gap.
2026-10-16 21:42:33 +01:00
alan 9b9f12f48e Merge lane-e: keep the lane's reviewed work
Combine lane-e's reviewed Android UI work with main's lane-c/lane-d work.
Conflicts resolved by keeping both intents:
- android/README.md: both documentation sections retained
- graph/StageDetailPane.kt: lane-e pane plus local section changes
- screens/RunDetailScreen.kt, RunHistoryScreen.kt: lane-e features and
  local work both preserved
- screens/PipelineListScreen.kt: new row layout and remembered
  sort/filter controls kept together
2026-10-16 20:46:56 +01:00
alan c4833870a9 Merge lane-d: open stage sections as their own pane
Combine the local list-scroll/covered-edge and hoisted pane wiring work with
lane-d's Section pane level, sectionKey persistence, three-way back
descriptions and single-Column CollapsibleSectionBody. Both intents survive:
conflicts in README, PipelinesApp, StageDetailPane, PaneState, Sections and
their tests were resolved by composing both sides, without conflict markers.

Build: ./gradlew :app:assembleDebug
Tests: ./gradlew :app:testDebugUnitTest (322 tests, 0 failures)
2026-10-16 20:37:07 +01:00
alan b083cbad34 android: drop the pipelines list inline search, add a filter-menu name facet
The pipelines list carried its own "Search pipelines" field while the app also
has the omni search, so the list offered a second, narrower way to do the same
job. Remove that field and move name narrowing into the list's filter control,
keeping "filters narrow one list" separate from "search finds across the system".

- PipelineListScreen no longer owns a `query` state or draws the
  OutlinedTextField; the list is now the first child under the app bar, so the
  reclaimed space comes from layout with no compensating spacer or new dp value.
- PipelineFilters gains a free-text `name` facet beside presence/lastRunStatuses,
  applied by filterPipelines through the new pure pipelineMatchesName
  (case-insensitive contains, blank means any). It needs no run history, so it
  applies as soon as pipelines load while the run facets still wait for runsKnown;
  activeCount and isActive include it, and hasRunFacets gates just the run facets.
- PipelineFilterControl opens with a Name section holding a single-line
  PipelineNameFilter labelled "Pipeline name contains"; the shared Clear filters
  resets it with the run facets and the active-count badge counts it.
- SettingsRepository/AppViewModel persist the name under pipeline_filter_name.
- Empty-state messages reflect the name-only miss.
- ListFilterTest covers the new name narrowing (+4 cases) and storage parsing.
- android/README.md documents the change and the build/APK evidence.

The runs list never had an inline search field, so nothing was removed there.
2026-10-16 19:50:19 +01:00
alan 007639948c Show the stage verdict atop the stage pane, with clickable artifacts
Mirror the server's derived verdict onto RunStep as a nullable
StageVerdict ({option, reason, reason_source, artifacts}, absent -> null),
matching internal/protocol/verdict.go.

Render a StageVerdictBlock at the top of the run pane, below the visit
tabs and above the facts, only when a verdict is present - a null or
empty verdict draws nothing, never an empty heading. The chosen option is
a ColoredChip in the stage outcome's existing colour; the reason is plain
pipelinesText().body that wraps without a maxLines clip.

The artifacts the reason names become inline, tappable references
(image/video open the shared ArtifactViewer, anything else uses the
existing openArtifact action) plus the same references as compact
FlowRow chips. Referenced names resolve to the visit's recorded
artifacts, deduplicated and in recorded order; reason text is split
around those names longest-match-first. No new dependency and no new dp
or sp literal.

android/ only.
2026-10-16 19:17:26 +01:00
alan af68a62ab8 Measure the covered pane edge instead of spending a fixed budget
The covered panes spent a fixed 224dp (PEEK_BUDGET_DP) whatever the window
width, so a folded window lost over half its width and the active pane was
squeezed as levels were added. Derive the covered region at runtime from the
compact identity a covered edge must show - an icon plus the shortest label
that identifies the pane, measured with the app's own type role and floored at
the platform minimum touch target - plus the leading gesture inset.

coveredEdgesDp now returns edges that sum to exactly that region, so the active
pane opens at hostWidth - region and its width is identical at every depth:
opening a level only adds a thin edge inside the region. The nearest covered
level shows its identity, one older level is a thinner touch-target edge, and
older levels fold into a count rather than accumulating width; tapping an edge
still pops everything above it. Removes PEEK_BUDGET_DP, MIN_ACTIVE_PANE_WIDTH_DP
and the peekBudgetDp/peekStripsDp budget split from Dimens.kt and
SlidingPaneStack.kt. PaneIdentity gains the pane-kind icon drawn above the title
at the vector's own measured default size, and each destination passes its
compact label/icon.

The touched files also carry the in-flight covered-pane statistics and list-scroll
plumbing they depend on (PaneStat/paneStatTier/visiblePaneStats, per-destination
LazyListState); the remaining pieces of that work remain uncommitted.
2026-10-16 18:50:36 +01:00
alan 8b0d7b1ecb Show a run's title beside its pipeline name
Surface the operator's title for a run so two runs of the same pipeline
read as clearly different goals, with the pipeline name kept as context.

- protocol: optional nullable `title` on RunSummary and RunDetail; absent
  or blank degrades to the pipeline name.
- ui/RunIdentity.kt: one shared fallback (`runLabel`) and two-line identity
  (`runIdentity`) so the list, detail header and stage pane never spell a
  run differently; a titled run shows the pipeline name + version as a
  second line, an untitled run keeps the pipeline name as its only line.
- runs list / run detail / stage pane use the shared identity; the status
  chip, duration and metadata layout are unchanged.
- no rename affordance: the server exposes no title and no `set_run_title`,
  so the app does not fake renaming.
- tests: RunIdentityTest (5) plus ProtocolModelTest cases for a present and
  an absent title; README documents the change and its verification.
2026-10-16 18:26:29 +01:00
alan b003872032 Show live elapsed time for running runs
A running run now shows how long it has taken so far instead of its start
time, kept live: the runs-list meta row, the pipeline list's last-run line
and the run detail summary's Duration row all read one shared rule,
runDurationText (ui/Format.kt), which reports the elapsed while executing and
keeps the stored total once the run has finished.

The elapsed is derived from the server's own start timestamp against a single
shared clock, rememberLiveNowMillis/hostResumed (ui/components/LiveTime.kt),
so it stays correct after a reconnect and never ticks while the app is
backgrounded or while no shown run is executing. WorkflowGraph's private
lifecycle read and once-a-second loop are replaced by that same shared pair.
A missing start omits the value and a future start (clock skew) reads as 0s.

Unit tests (FormatTest, PipelineLastRunTest) cover a run that has just
started, the minute and hour boundaries, a missing and a future start, and a
finished run keeping its stored total duration.
2026-10-16 18:13:50 +01:00
alan e1c531a537 Make the run summary's artifacts gallery a collapsed section
The run summary led with the artifacts gallery, but it was always open, so a
long run's grid pushed the run's own facts below the fold. The gallery now
sits in one collapsed-by-default section in the same place, with a header that
describes itself while collapsed.

- RunDetailScreen.kt: RunSummaryTab renders the gallery through the shared
  LazyListScope.collapsibleSection, keyed "artifacts" and seeded with
  rememberSectionExpansion(run.id), so a run opened fresh starts collapsed and
  the operator's choice persists per run across tab switches and config
  changes. Order is unchanged: the section still leads the summary and the
  facts item follows it. Expanding composes the unchanged ArtifactGallery;
  collapsing composes nothing.
- ArtifactGroups.kt: new pure runArtifactsHeader(steps, executing) builds the
  self-describing header - singular/plural title, recorded count and
  "· partial capture" when any visit excluded or omitted files; empty runs
  reuse the shared artifactsEmptyMessage. Its count equals runArtifactGroups'
  tile total, so the header and the expanded gallery cannot disagree.
- ArtifactGroupsTest.kt: four header tests covering count, singular vs plural,
  the partial-capture notes and the empty case, plus a count-matches-gallery
  assertion.
- android/README.md: records the change and its verification evidence.

Android only; no new dependency, no run started from the app, device work on
the operator's Pixel 10 Pro Fold (58281FDCG000JF). Verified: 269/0/0/0 unit
tests, clean assembleDebug and published APK LAN URL 200.
2026-10-16 17:51:56 +01:00
alan 95150c79c5 Render every artifact in the shared gallery, with file-type icons
Standardise the artifacts gallery so the run summary and the stage pane
render one tile per artifact instead of images as a grid and everything
else as a plain list.

- Artifacts.kt: ArtifactTile now covers both shapes - an image/video fills
  the cell with a thumbnail (a video shows its poster frame with a play
  badge), anything else shows its file-type icon with the name and size
  beneath it; the grid, share/copy actions and multi-select are unchanged
  and the capture wording is untouched.
- ArtifactType.kt (new): pure ArtifactKind classification from content
  type plus name extension fallback, and artifactIcon(kind) mapping each
  kind to a distinct glyph.
- ArtifactImage.kt: ArtifactVideoFrame/rememberArtifactVideoFrame extract
  a poster frame via MediaMetadataRetriever over an in-memory
  MediaDataSource; the shared memoized-preview scaffold is factored into
  rememberArtifactPreview.
- ArtifactViewer.kt: full-screen viewer takes a video flag and shows the
  poster frame.
- Format.kt: add isVideoContentType; drop the now-unused artifactMetaLine.
- Dimens.kt: ARTIFACT_TYPE_ICON_DP, ARTIFACT_PLAY_BADGE_DP,
  ARTIFACT_TILE_ACTION_DP tokens.
- Tests: new ArtifactTypeTest (type-to-icon mapping, extension fallback,
  distinct glyphs); FormatTest updated for the removed helper.
- android/README.md documents the pass.

android/ only; no new dependencies beyond material-icons-extended.
2026-10-16 17:13:35 +01:00
alan 12976ba372 Open stage sections as their own pane instead of expanding inline
Expanding a stage section rendered its rows stacked at the top of the section: CollapsibleSectionBody passed the section's several field composables straight into AnimatedVisibility, which measures a single child, so all rows were placed at the section origin and only the last (Memory) was visible. Fix the shared body by laying its content out in one full-width Column, and make every stage section open as its own pane rather than growing the stage screen inline.

- PaneState: add the Section pane level (MAX_PANE_DEPTH = 3), a saved sectionKey primitive, and the matching backStep/popTo/encode/decode handling so one Back or peek pops one level and the open section survives rotation and process death.

- StageDetailPane: the stage screen now keeps a compact collapsed list of sections (Artifacts, Output, Input, This run, Stage definition); tapping one opens it as a full-window screen on a narrow window or a panel to the right of the stage pane on a wide one, with its own title, scroll and top spacing. A shared stageSectionSpecs derives the sections for both the stage screen and the section pane, and the artifacts section keeps the shared ArtifactSelectionScaffold.

- PipelinesApp: wire the Section pane into the stack, its peeks and Back. Section content (Definition, Input, Output, Artifacts) and semantics are unchanged; sections start collapsed and the operator's choice persists.

- Tests: cover the section pane level, backStep, popTo and the shared stageSectionSpecs. Build and forced unit tests pass (262 tests, 0 failures); lint shows only the pre-existing themes.xml NewApi errors.

Android only (7 files); no dependency added, no server/Go/installer/Docker change, no run started from the app. APK published to the run artifacts directory and documented in android/README.md.
2026-10-16 17:12:13 +01:00
alan ee5cd742c2 Prove the always decision through the shared approval reply builder
Extend ChatApprovalTest so once, always and reject each go through the same
ChatProtocol.replyRequest builder plus one encode/decode round trip using the
DECISION_* constants, so no decision is asserted more weakly than another, and
add answeringAlwaysUpdatesTheCardInPlace (settled card, no actions, risk panel
retired, request still visible). Refresh the android/README.md verification
notes: 267 tests, the rebuilt APK's sha256 and byte size, the 147/3 artifact
path and LAN URL, and the emulator/device-lock notes for this pass.
2026-10-16 16:57:57 +01:00
alan 305714c30f Drive the composer's stop control and IME action from one derivation
While a turn was in flight the trailing composer button became the stop
control, but the text field's keyboard send action still checked only
canSend, so a prompt could be sent from the IME during a run even though
the visible control had become stop.

Add ChatFormat.composerAction(thread) -> ComposerAction.Send/Stop as the
single pure derivation and read it from both the trailing button and the
keyboard action, so the two controls can no longer disagree.
ChatFormatTest.composerControlIsStopWhileARunIsInFlightAndSendOtherwise
covers Send when idle and Stop while running. android/ only; no new
dependency.
2026-10-16 16:26:16 +01:00
alan 609721d53b Show pushed approvals as in-place chat cards
Render a server-pushed chat_permission as an approval card in the
transcript instead of a transient bar above the composer, matching the
reference opencode/Jarvis chat: the requested action, its resources, the
amber RISK REVIEW panel, and once/always/reject actions wired to the
server's chat_reply.

- ChatFormat: a pure approvalCard()/ApprovalCard model and one
  ChatProtocol.replyRequest() builder shared by the card's actions and
  the repository, so the wire frame and the controls cannot drift.
- ChatStore/AppViewModel: answerPermission() settles the card in place
  optimistically and survives a chat switch; a failed reply reopens the
  same request rather than showing an unacknowledged decision.
- ChatPermissionFrame gains optional resolved/decision fields so a
  request the server reports as already settled shows its verdict with
  no stale actions; a new request replaces a settled card.
- Findability: a gold PanTool top-bar action and chat-chip marker jump
  to the pending card; the running indicator stands down while waiting.
- Tests: ChatApprovalTest covers pending/answered/resolved, the reply
  builder's once/reject decisions and the missing-summary fallback;
  ChatProtocolTest covers the server-resolution frame. README records
  the 265-test/assembleDebug evidence and the emulator-5556 captures,
  and .approval_check/chat_stub_approval.py is the test double used.

android/ only; no new dependency beyond material-icons-extended; no
Pipelines server, Go, installer or Docker file touched; no run started
from the app. The live brokered server is not verified (the resolved
frame fields are an additive contract it does not emit yet).
2026-10-16 16:12:22 +01:00
alan 78d5bd38fc Route the stop control's interrupt through one tested builder
Extract the single chat_interrupt frame into ChatProtocol.interruptRequest and
have PipelinesRepository.chatInterrupt send it, so production and its unit test
share the one wire shape instead of the repository building it inline.

Add chatInterruptRequestCarriesTheRunningSession, which asserts the frame the
stop control sends is chat_interrupt carrying the running session's id (and no
chat prompt/reply) and that it survives the client's JSON round-trip.
Document the slice and its emulator-5556 evidence in android/README.md.
2026-10-16 15:31:04 +01:00
alan e2f306b8bd Summarise large edit diffs and label the card with file and stat
The chat edit diff card rendered every line of an edit, so the >400-line
fallback flooded the transcript with thousands of Text nodes on a phone;
it also showed only the tool name, not the file, on the expanded panel.

- ChatFormat.toolEditDiff keeps the first MAX_RENDERED_DIFF_LINES (200)
  lines and puts the remainder in the new ToolDiff.omitted, while the
  +N/-M counts continue to describe the whole edit.
- DiffView prints "… N more changed lines not shown" first so the
  truncation is visible without scrolling.
- The expanded panel header now shows the edited file name and the shared
  green/red DiffStat, matching the collapsed chip.
- ChatFormatTest pins omitted = 0 for a small edit and the true counts,
  200-line cap and omitted = 300 for an oversized one.
- android/README.md records the change and its evidence.
2026-10-16 15:15:35 +01:00
alan 291cec2bda Show chat tool calls as expandable INPUT/OUTPUT chips
Render each assistant turn's tool calls the way the reference jarvis chat
does: one compact chip per call showing the tool name, its duration and a
spinner while it runs, with consecutive calls of a turn grouped into one
wrapping row so the transcript stays scannable (ChatScreen AssistantParts /
ToolCalls).

Tapping a chip opens a floating panel over the transcript with INPUT as
pretty-printed JSON and OUTPUT as monospace, plus copy actions. The panel is
dismissible by tapping outside or its Close action and is positioned by
ToolPanelPositionProvider so it never moves the conversation (the transcript
scroll position is untouched while the overlay is open).

A failed call is shown as failed and renders both its diff (when present) and
an ERROR block. ERROR text now comes from the new toolErrorText, which prefers
the server's error message over any partial output, while toolOutputText is the
OUTPUT derivation again; toolFailed identifies the error state.

While a turn streams, the transcript follows the newest content with a hard
jump unless the operator has dragged away, driven by
listState.interactionSource.interactions (DragInteraction.Start/Stop/Cancel)
rather than programmatic scrolls. The running indicator and its live elapsed
time derive from the turn's own start (ChatThread.elapsedMillis, an injectable
clock in ChatStore) so they survive a chat switch.

A reconnecting socket now settles every open chat and re-fetches its history
(ChatStore.streamResumed, AppViewModel.observeConnection), and a server-pushed
stream error with no session id settles the sole/active running turn with the
server's message instead of leaving the indicator spinning.

Tests: ChatFormatTest covers toolErrorText; new ChatStreamTest covers the
streaming/elapsed/reconnect/stream-error guarantees against an injected clock;
new ToolPanelPositionProviderTest covers the panel's below/flip/margin
placement. README's chat section documents the follow-the-stream mechanism.
2026-10-16 14:17:50 +01:00
alan d546bc7a3a Migrate the graph, panes, rail and sheet onto the geometry tokens
Move the workflow-graph package (WorkflowGraph, the StageDetailPane sheet,
Artifacts, ArtifactViewer, ArtifactImage) off its remaining raw dp literals
and onto the geometry tokens, all substitutions value-equal so the visuals
are unchanged.

- ui/theme/Dimens.kt gains the off-scale component and graph-chrome sizes:
  the run legend's GRAPH_LEGEND_PAD_X/PAD_Y/GAP, the collapsed
  GRAPH_PANEL_MIN_HEIGHT (moved off WorkflowGraph.kt, now imported by its
  test), the gallery's ARTIFACT_TILE_DP/THUMB_DP/BADGE_DP/PROGRESS_DP/
  PROGRESS_STROKE_DP, and the stage-type chip's STAGE_CHIP_PAD_H.
- Artifact tile/row and thumbnail corner radii derive from the Material
  shape scale (MaterialTheme.shapes.medium/.small), matching the graph's
  existing node corners.
- DimensTest.kt's allow-list shrinks from 24 to 21 entries: 24.dp, 56.dp and
  96.dp are gone now that their last call sites migrated. The structural
  hairlines/zeros, the not-yet-migrated app shell and Settings literals, and
  the sp type values owned by Typography.kt remain.
- WorkflowGraphTest.kt imports the moved GRAPH_PANEL_MIN_HEIGHT.
- android/README.md documents the change and its verification evidence.

Verified: gradle :app:assembleDebug :app:testDebugUnitTest --rerun-tasks
BUILD SUCCESSFUL, 30 XMLs / 259 tests, 0 failures/errors/skipped; the
enforcement test fails on a deliberately introduced literal and passes once
removed; before/after captures at both window widths differ only on the
status-bar clock and live relative-time text.
2026-10-16 13:08:54 +01:00
alan d7f650032d Render assistant text as markdown in the chat transcript
Add a dependency-free CommonMark-subset parser/renderer (ui/chat/Markdown.kt):
paragraphs, headings, fenced code, block quotes, bullet/ordered lists, tables,
thematic rules and inline code/bold/italic/links/autolinks. The renderer turns
blocks into themed, selectable Compose content: fenced code reuses the shared
CodeBlock (existing whole-block copy action), tables are a bordered grid with a
bold header, links use LinkAnnotation.Url, and inline code/headings use the
shared type roles.

ChatScreen.MessagePart now calls MarkdownText(part.text) for PART_TEXT instead
of a single plain Text; the assistant message stays one SelectionContainer, so
all of it remains selectable and long content stays inside the bubble. Geometry
reuses the chat tokens (CHAT_ITEM_GAP promoted private -> internal).

Add MarkdownTest with 10 unit tests covering fences/language, unterminated
fences, soft-wrap joining, headings/rules, lists, tables, inline spans, bare-URL
autolinks and snake_case non-emphasis. Document the change in android/README.md.
2026-10-16 13:01:39 +01:00
alan 0718f5ba6f Add the Chat destination and hold several conversations at once
Entry point: the floating destination pill gains a Chat icon between Runs and
Settings; it stays a single non-wrapping Row of 48dp targets using the named
DESTINATION_ITEM_SIZE/DESTINATION_ITEM_GAP tokens, clear of the existing 88dp
reserve, so it stays narrow however many destinations it holds.

Protocol/transport: new data/protocol/Chat.kt mirrors the brokered chat wire
shapes; Message gains the optional chat_* payloads, PipelinesClient forwards
unsolicited frames (chat_event/chat_permission) to a new events flow instead of
dropping them, and PipelinesRepository exposes the typed chat calls (sessions,
create, messages, prompt, interrupt, reply).

State: ui/chat/ChatStore.kt is an Android-free multi-chat holder; every open
chat keeps its own conversation, running flag, composer draft and scroll
position, open/activate report when history must be re-synced so a running
session refreshes on return instead of showing a stale copy, and busy/read-only
sessions refuse writes.

Surface: ui/chat/ChatScreen.kt lists the server's sessions with running/busy/
read-only status and an open-chat strip to switch between conversations (chip X
closes only that chat); the conversation is a bottom-anchored transcript of user
bubbles, reasoning, assistant text and tool-call chips that expand to INPUT
(pretty JSON)/OUTPUT (monospace), edit-family calls render a diff card derived
from oldString/newString, and pending chat_permission frames surface an approval
bar answered via chat_reply. New chat creates and opens a session. The manifest
sets windowSoftInputMode=adjustResize for the composer.

Tests: ChatProtocolTest, ChatFormatTest and MultiChatStateTest cover the wire
shapes, formatting and the multi-chat model (switching preserves each
conversation, a running session re-syncs on return, per-chat drafts/scroll,
busy read-only, background events land on their chat). README documents the
slice and its evidence.
2026-10-16 12:43:37 +01:00
alan 3765fdfdf6 Migrate the list and detail screens onto the geometry tokens
Replace the hardcoded paddings, spacings, sizes and offsets in the four
list/detail screens and the shared components they are built from with
references to the token file from the previous item, via WindowInsets or
layout where those derive the value. Every replacement is value-equal, so
the screens render identically at both window widths.

Name the glyph sizes that cannot derive from layout as four new ICON_*
tokens in ui/theme/Dimens.kt (14/18/20/24dp) and shrink the DimensTest
allow-list from 30 to 24 entries: 14.dp, 18.dp and 20.dp leave because
their last call site migrated, and the already-unused 32.dp, 11.sp and
13.sp entries are dropped. All adb/emulator work targeted emulator-5554
only; android/ only; no new dependency, server/Go/installer/Docker file
touched, and no run started from the app.

Verified: :app:assembleDebug + the full unit suite (30 result XMLs, 259
tests, 0 failures/0 errors/0 skipped), the shrunk allow-list still fails a
forced raw-literal probe, and before/after screenshots of every converted
screen at narrow and wide widths match near-zero.
2026-10-16 12:43:19 +01:00
alan a8ff49f423 Merge lane-app2: keep both lanes' reviewed work
Compose the parallel lane (lane-app2) with the work already on main,
preserving both intents rather than picking one side:

- lane-app2's modernised run graph (rounded tonal nodes, pill terminals,
  chipped outcome labels, pass/fail emphasis and active-stage/edge motion)
  plus its remembered list filters/sort and last-run badges, and the
  app-owned run-status palette.
- main's cross-fading loading/empty/error states, animated list items and
  the single geometry token file (Dimens.kt + DimensTest).

Conflicts resolved in android/README.md (kept both appended sections),
RunStatus.kt (kept the shared ColoredChip extraction and made it animate
under MotionQuick), PipelineListScreen.kt (filters/sort/badges composed with
the StateCrossfade/load-phase presentation and animateListItem rows),
RunDetailScreen.kt (kept both the artifact-selection and graph-palette
imports) and RunHistoryScreen.kt (the cross-faded load branch now passes
sort/filters through, and both empty branches keep the Clear filters action
with animated items). LoadPhase.Empty now carries an optional recovery
action so the crossfade can still offer Clear filters. The graph's new
geometry literals moved onto Dimens.kt GRAPH_* tokens so DimensTest passes
and its allow-list shrinks as intended.

Verified: :app:assembleDebug and :app:testDebugUnitTest (259 tests,
0 failures) with the offline Gradle 8.11.1 / JDK 17 toolchain.
2026-10-16 12:04:45 +01:00
alan f6b9424894 Add a single geometry token file and a test that enforces it
Introduce ui/theme/Dimens.kt as the one source of truth for app geometry,
alongside Typography.kt for type. It defines the 4dp spacing scale
(SPACING_XXS/XS/S/M/L/XL/XXL) and receives the geometry constants that
already existed, each with a comment tying it to what it is: PEEK_WIDTH_DP
(the collapsed strip), PEEK_BUDGET_DP, MIN_ACTIVE_PANE_WIDTH_DP and
MIN_COVERED_PANE_WIDTH_DP from SlidingPaneStack.kt, DESTINATION_PILL_RESERVE
from PipelinesApp.kt, and WIDE_RAIL_WIDTH_DP and DETAIL_MAX_WIDTH_DP from
DetailTabs.kt. Call sites now import the tokens; every value is unchanged,
so no layout changes.

Add ui/theme/DimensTest.kt, a JVM test that scans the app's Kotlin sources
for raw dp/sp literals and fails with file:line:literal unless the literal
is a token or an explicit, reasoned allow-list entry. The allow-list records
the 34 literals that predate the token file, each with a written reason, and
is expected to shrink as call sites migrate onto the tokens.

Document the change and its verification in android/README.md.
2026-10-16 11:50:26 +01:00
alan e5bde981ee Modernise the workflow graph's visual language
Replace the old terminal-diagram look on the Graph tab with a tonal
surface language, keeping the same information and every outcome hue.

- Nodes: stages are rounded rectangles from MaterialTheme.shapes.medium,
  terminals become pills (height/2). Fills are tonal surfaces via the new
  pure tonalFill(surface, accent, fraction) with a soft outlineVariant
  border instead of a flat fill plus hard outline.
- Type: node names use the cardTitle role and outcome labels the label
  role, with theme line height/letter spacing; the [brackets] and all-caps
  are gone (nodeDisplayLabel renders Success/Failure title-cased in colour).
- Edges: StrokeCap.Round/StrokeJoin.Round, bends rounded by one
  ROUTE_CORNER_RADIUS (cornerCutRadius clamps short segments), filled
  arrowheads scaled as edgeStrokeWidth * ARROW_HEAD_SCALE, and labels on
  a shared DrawScope tonal chip.
- Spacing: named dp tokens instead of ad-hoc literals.

Adds pure-logic unit tests (WorkflowGraphTest, GraphPaletteTest) and
documents the change in android/README.md.

Verified: :app:assembleDebug and :app:testDebugUnitTest both BUILD
SUCCESSFUL (207 tests, 0 failures) with no Kotlin warnings.
2026-10-16 11:50:08 +01:00
alan d019213c5b Animate selection and live state changes
Animate selection and status changes across the Android UI using the
existing Motion tokens, leaving every resting state unchanged.

- DestinationPill draws one selection indicator and animates its offset
  between the three slots (animateDpAsState, MotionStandard), with the
  glyph tint cross-fading in step; geometry comes from named
  DESTINATION_ITEM_SIZE/GAP tokens via the unit-tested
  destinationIndicatorOffsetDp helper.
- The shared ListRow fades its tonal container and content colour under
  MotionQuick instead of switching.
- New shared CollapsibleSectionBody wraps section bodies in
  AnimatedVisibility (expand/shrink + fade) under MotionQuick, used by
  both the lazy collapsibleSection and the stage pane's StageSection, so
  body and chevron move together.
- StatusChip eases container and label colour and RunStatusIcon eases its
  glyph tint, so a live run's status transition is visible rather than a
  silent colour swap.

Verified: assembleDebug + testDebugUnitTest BUILD SUCCESSFUL, 186 tests
across 23 classes with 0 failures/errors/skips; frames captured on
emulator-5554 for the travelling pill, section collapse and a live status
change; APK published to the run artifact directory. README documents the
change and its evidence.
2026-10-16 11:24:01 +01:00
alan b89ad29c41 Cross-fade loading, empty and error states in data-backed panes
A data-backed pane swapped its loading spinner, empty message, error
message and content with a plain `when`, so content flashed from empty to
full and empty/error states popped.

Introduce a shared presentation model in ui/components/States.kt:
- `LoadPhase` (Loading, Error(message), Empty(message), Content), with
  message-carrying phases capturing their text at classification so a
  fading-out branch never recomposes against cleared error/filter state.
- `listLoadPhase(loading, error, hasData, emptyMessage)` and
  `detailLoadPhase(error, hasData)` pure classifiers preserving the
  existing precedence (failed load with no data, then loading, then
  empty, else content; stale data keeps the pane on content).
- `StateCrossfade(phase)` wraps the branch in a `Crossfade` using the
  existing `MotionStandard` token; both branches share one box so the
  resting layout is unchanged and the outgoing phase fades under the
  incoming one.

Apply to PipelineListScreen, RunHistoryScreen, PipelineDetailScreen and
RunDetailScreen. Detail panes render the fading-out branch from the last
non-null item. The Runs pane keeps its inline empty/error line inside the
list, now fading through animateListItem().

Add LoadPhaseTest covering the classifiers and captured messages, and
document the change and evidence in android/README.md.
2026-10-16 10:45:27 +01:00
alan 934994d7f7 Add named motion tokens and animate list item changes
Introduce ui/components/Motion.kt beside the pane dimension tokens: two
named duration+easing tokens, MotionQuick (120ms) for small in-place state
changes and MotionStandard (220ms) for content that moves or swaps, under a
300ms MAX_MOTION_MILLIS cap. Every animation call site now asks a token for
its spec instead of writing a duration: the pane slide and section
Crossfade use MotionStandard, the section chevron uses MotionQuick, and the
pane-pop stagger moves in as MOTION_STAGGER_MILLIS (the old
PANE_SLIDE_* / SECTION_SWAP_MILLIS constants are gone).

Add a single LazyItemScope.animateListItem() helper (ListRow.kt) wrapping
the supported Modifier.animateItem with the tokens: items fade in/out
(MotionQuick) and slide to new positions on refresh, filter or re-sort
(MotionStandard). Pipelines rows, run rows, version rows and evidence rows
use it. Specs are built at composition time (no per-frame allocation) and
the chevron reads its angle inside graphicsLayer so it turns without
recomposing the header; resting layout is unchanged and the standard
animator duration scale still applies, so disabled animations are instant.

Add MotionTest covering token ordering, per-token bands, the cap, monotonic
easings, self-reversal and spec timing; SlidingPaneStackTest now reads the
pane timing from the token. Document the change and its verification in
android/README.md.
2026-10-16 09:55:41 +01:00
alan 0b74903a00 Add long-press artifact multi-select with bulk copy and share
Long-pressing any artifact — a gallery tile in the run summary or a row in
the stage pane's per-visit list — now enters artifact selection: the pressed
item is selected with the app's selected treatment and further taps toggle
items instead of opening them. A contextual bar replaces the surface's top
bar while selecting, showing the count plus Copy links, Share and a close;
it carries the same pane safe-area insets as the bar it replaces, uses 48dp
IconButtons and leaves selection mode on Back before the surface's own Back
runs. Selection applies only to artifacts, never the runs or pipelines lists.

The selection is one shared host: ArtifactSelectionScaffold owns the
remembered ArtifactSelection, the resolvedSelection lookup, the bulk
copy/share actions, the SnackbarHostState and the pane-scoped BackHandler,
and both RunDetailScreen (summary grid) and StageDetailPane (per-visit list)
go through it, so neither screen owns its own SnackbarHostState or
BackHandler. The immutable ArtifactSelection (enter/toggle/selectAll/clear)
treats selection mode as "one or more urls selected", so it can never
restore half-applied; rememberArtifactSelection saves it via a listSaver and
reseeds per run/visit.

Copy links resolves every selected url against the configured server through
the existing resolvedArtifactUrl (no hardcoded host), writes one absolute
link per line through the new single Clipboard.copyText path (now also used
by the code blocks, pipeline source, artifact row and viewer), and confirms
the number of lines actually produced in a Snackbar. Share fetches every
selected artifact through the existing client, reuses the single-item
writeSharedArtifact (same bounded cache, FileProvider and prune), and sends
one ACTION_SEND_MULTIPLE typed by bulkShareMimeType (the common type, else
the wildcard) with the count in the chooser title; when any fetch fails the
whole set degrades in the same action to its resolved links shared as text.

Pure helpers and tests: ArtifactSelectionTest covers enter, toggle,
deselect-last, select-all/clear, the restored state, the one-per-line link
formatting and the labels; ArtifactSharingTest gains shareTargets and
bulkShareMimeType cases. Unit tests plus assembleDebug pass (168 tests,
21 classes, 0 failures). android/README.md documents the model, action bar
and the bulk share flow, and the doc-accuracy pass records that the bulk
copy writes links in gallery (candidate) order.

No new dependency (icons come from the declared material-icons-extended).
2026-10-16 08:51:03 +01:00
alan 1e7862e7c9 Make pass/fail edges the loudest lines in the run graph
Treat `success` and `error` as the emphasised outcomes so pass/fail is
obvious at a glance and from a distance. An executed pass/fail edge now
uses PASSFAIL_EDGE_STROKE=7f (was 3f), a same-hue, more saturated stroke
(PASSFAIL_SATURATION=1.6f via the new pure boostSaturation helper) and a
matched PASSFAIL_ARROW_HEAD_SIZE=20f arrowhead. Other executed outcomes
keep EDGE_STROKE=3f and not-executed routes the finer
INACTIVE_EDGE_STROKE=2.5f, so the two decisive outcomes dominate.

All widths, the arrowhead size and the saturation factor are named
tokens chosen by edgeStrokeWidth/edgeArrowHeadSize/edgeStrokeColor; the
old 12f arrowhead literal at the call site is gone (drawArrowHead now
takes the size as a parameter). Outcome hues are unchanged; the boosted
stroke keeps the original hue and value.

The run Graph tab help line notes that executed success and failure
routes are drawn thickest, and the definition-only view gets the same
emphasis since every route counts as executed there. New unit tests cover
the saturation maths (hue/value/alpha preserved, safe and clamped) and the
per-edge width/arrowhead/colour choices.
2026-10-16 08:06:34 +01:00
alan 9c47527def Make executed vs not-executed unmistakable in the run graph
Carry the two states structurally instead of by fading, so the difference
survives a screenshot, a dim screen and a colour-blind reader.

- Executed edges: solid full-colour stroke plus an arrowhead.
- Not-executed edges: dashed muted stroke (INACTIVE_DASH_EFFECT), no arrowhead.
- Executed nodes: keep their fill and normal border.
- Not-executed nodes: no fill, dashed muted border and a muted but legible label.
- Add a one-line legend (GRAPH_LEGEND / GraphLegendEntry / LegendSwatch) pinned
  TopStart, rendered only when a run is selected.
- Replace the private EdgeLayout.isExecuted/inline visited check with the shared
  edgeIsExecuted/stageIsExecuted predicates and remove the alpha-based dimming.
- Update the KDoc and the run Graph tab help text ("solid ... dashed and outlined").

Tests: executed/inactive predicates over the definition view and a RunGraphState,
the dash pattern as a positive even-length rhythm, and the legend naming both
states with executed first.
2026-10-16 07:04:48 +01:00
alan 1195535852 Add a real share action to every artifact item
Give each gallery image cell and each per-visit file row its own share
control: a 48dp IconButton with an accurate "Share <name>" content
description drawn as a sibling of the item's tap handler, so sharing
never opens the image or the item.

Sharing fetches the artifact through the existing client into a scoped
cache file (cache/shared-artifacts/), exposed via a non-exported
FileProvider declared with the new res/xml/file_paths.xml, and sends it
through ACTION_SEND. When the fetch returns nothing the action falls
back to sharing the resolved link as text. Cache files are named
deterministically per artifact so re-sharing overwrites instead of
growing without bound, and a failed or unreachable fetch cannot crash.

The artifact-to-file naming, mime/extension table and the file-vs-link
fallback decision are factored into ArtifactSharing.kt and covered by
the new ArtifactSharingTest.kt. The existing open and copy-link actions
are unchanged; the viewer's action scrim alpha is shared as
ARTIFACT_ACTION_SCRIM_ALPHA. android/README.md documents the provider
and the share flow. No new dependency is added.
2026-10-16 07:03:18 +01:00