Commit Graph

9 Commits

Author SHA1 Message Date
alan 370eaaed1f Let the detail tabs collapse and rebuild the step and source layouts
DetailTabs: give every tab a meaningful ImageVector from the core Material
icon set and turn the wide rail into a collapsible one. A rememberSaveable
railExpanded flag plus an accessibility-labelled "Collapse tabs"/"Expand
tabs" control shrink the rail to a narrow icon-only strip and back; the
collapsed tile still names its tab via the icon's content description and
still marks the selected tab by container colour and tab semantics, and the
content box reclaims the rail width. Narrow windows keep the top
PrimaryScrollableTabRow. railWidthDp is a pure, unit-tested predicate.

RunDetailScreen: render a step's metadata as aligned label/value rows
(KeyValueRow) instead of a ragged stack of lines, paired into two columns on
wide windows (status/outcome, duration/visit, target/session, agent/model
target) and a single column on narrow ones. Evidence (input, output,
transcript, file changes, notifications, control diagnostics) fills its card
in full-width monospace with a shared padding/line height, and the vertical
rhythm is one bottom gap per step with no doubled gap for a step without
expandable detail. The timeline glyph and connector stay aligned with the
step title. All previously shown fields are retained.

PipelineDetailScreen/CodeBlock: the Source tab now fills the whole tab area
with the tab's single LazyColumn owning all scrolling (CodeBlock gains an
optional maxHeight = null that renders unbounded; the default bounded
behaviour is unchanged for other callers). It renders the parsed definition
as one collapsible section per stage (key, type) built from the same
stageDefinitionFields/StageFieldRow the stage detail sheet uses, covering
prompt, output, tools, configs, edges (outcomes with resolved targets and
#success/#failure terminals), memory, limits and notify policy while skipping
absent fields. A Raw toggle reveals the exact markdown and a copy action
copies the whole definition.

Extract shared formatting helpers (fileChangeLine, notificationLine,
fileChangesSummary, controlVisitLabel) into Format.kt and expose
StageFieldRow/StageTypeChip/stageDefinitionFields so the sheet and the Source
tab agree. Add StageDetailSheetTest and StepMetaTest, extend DetailTabsTest
(icon distinctness, rail width) and FormatTest, and record the build,
unit-test and emulator-screenshot verification in android/README.md; the
captures stay in the git-ignored android/captures/space_pass/.

Assisted-by: DeepSeek V4.1 Flash
2026-10-15 17:18:05 +01:00
alan 238f3fbdd8 Give every graph edge its own track and open a stage detail sheet on tap
Allocate a distinct source port, target port, across-run lane and vertical
track per edge in the pure layoutGraph (stable edge-id order), mirroring the
TUI's per-edge routing, so no two routes share a row or column; each outcome
label follows its own edge's track. Rewrite routePoints to build every
polyline from those precomputed ports/lanes/tracks instead of shared corridor
constants, keeping runs axis-aligned and the layout deterministic.

Add pure hitTest/toGraphPoint plus a tap detector that maps taps back through
the current transform: tapping a node calls onStageTap, tapping empty space
does nothing, and pan/zoom keep working. Add StageDetailSheet, a Material 3
ModalBottomSheet overlay (near full height, scrollable, responsive on wide
windows) showing the stage definition and, on a run graph, that run's step;
wire it into the pipeline and run graph tabs.

Extend WorkflowGraphTest with the no-shared-collinear-run invariant, distinct
port, determinism and hit-test cases.
2026-10-15 16:46:40 +01:00
alan 1828171a9c Give the detail screens tabs, styled code blocks and a foldable layout
- Pipeline detail and run detail are now tabbed: run detail has Summary, Graph,
  Input, Output, Evidence and Steps, pipeline detail has Summary, Graph and Source,
  with the version list in Summary. The graph gets a tab of its own, so it uses the
  whole content area with its Fit and expand controls. Selection is remembered and
  the tabs carry real tab semantics.
- The code-like blocks (Input, Output, Source, prompt, transcripts) are styled
  content cards with a label header, monospace body, a copy action and a bounded
  height that scrolls internally, instead of a raw bordered div.
- Content inside a tab breaks down into collapsible inner sections (DetailTabs.kt,
  CodeBlock.kt), reusing the existing section component with remembered state.
- Foldable layout is driven by window width (WindowSize.kt): narrow windows keep
  the single-pane tabs, wide windows use list-and-detail side by side with the
  detail capped to a readable width.

Verified: :app:assembleDebug and :app:testDebugUnitTest succeed offline with 60
tests and 0 failures (new WindowSizeTest and DetailTabsTest), and the reviewer
drove every tab plus both a narrow and a wide window on the emulator (captures in
android/captures/tabs_pass/view/). The implementer's own capture set in that
directory is unusable: it wrote screencap's multi-display warning into the files
(they begin with ASCII '[Warning', not the PNG magic), so only the reviewer's
captures were reviewed.
2026-10-15 14:34:49 +01:00
alan e843aa08a8 Restructure the Runs area and add collapsible sticky sections
Four related UI changes, all requested after using the app on a phone.

- Graph pinch zoom is now anchored to the gesture centroid. The handler dropped
  the centroid and the canvas scaled about the content origin, so a pinch slid
  the graph away from the fingers. zoomAbout() keeps the content point under the
  fingers fixed, applies the pan and then clampOffset, with unit tests proving
  the centroid point is unchanged and the scale and bounds are respected.
- Pipeline detail and run detail now use a LazyColumn of collapsible sections
  (shared Sections.kt header, rotating chevron, animateContentSize) whose titles
  stick to the top while their content scrolls beneath, with per-section state
  remembered and exposed to accessibility. Steps and session evidence stay lazy
  list items instead of nested scrollables.
- The Runs list is rebuilt: the raw result preview is gone, failures show a
  two-line diagnostic in the error colour, each run has a colour-coded status
  chip with a matching icon per state (RunStatus.kt, core Material icons - no new
  dependency), the usage aggregates render as a metrics block with a formatted
  average instead of a run-on line of seconds, and runs are grouped by day under
  sticky date headers.
- Run detail steps are a timeline: a status dot joined to the next step, the
  stage and visit number, an outcome chip and the duration, with input, output,
  transcript, file changes and notifications behind a per-step 'Show details'.
- One centralised type hierarchy (Typography.kt) for screen title, section
  header, card title, subtitle, body and monospace data, applied across the list,
  the cards and both detail screens.

Verified: :app:assembleDebug and :app:testDebugUnitTest succeed offline with 53
tests and 0 failures (new FormatTest, RunStatusTest and RunGroupingTest;
WorkflowGraphTest 23 to 27), and the app was driven on the emulator with
screenshots of the runs list states, the sticky date header, the steps timeline,
an expanded step, a collapsed section and the sticky section header.
2026-10-15 03:46:06 +01:00
alan 1a890d8c31 Draw workflow-graph edges as straight runs and give the graph a bigger panel
A user reading the graph on their phone said it was not clear what happened, and
asked for the TUI's straight arrows and a larger panel.

- Edges are now axis-aligned orthogonal polylines instead of Bezier curves: the
  stage-to-stage runs and the routes into the bottom-row #success/#failure
  terminals are horizontal/vertical segments joined at right angles, matching the
  Go TUI's routing, and every arrowhead now points along the direction of its
  final segment instead of the straight source-to-target chord (which pointed
  wrongly as soon as a route turned a corner). Routing is a pure function.
- The graph panel is a sensible share of the window height on both screens
  instead of 360dp/340dp, and a new expand/collapse control beside 'Fit graph to
  view' grows it to nearly the full height.

Verified: :app:assembleDebug and :app:testDebugUnitTest succeed offline with 42
tests and 0 failures (WorkflowGraphTest 15 to 23, covering the orthogonal routing
and arrowhead direction), and the app was driven on the emulator with before/after
screenshots of a pipeline graph, a run graph with the executed route highlighted,
a panned state and the expanded panel.
2026-10-15 02:34:15 +01:00
alan 9ca775291b Give the Android client a dark-first Material 3 look and TUI-style graph terminals
Three UI changes requested after reviewing the first on-device screenshots:

- Dark-first theme: the app now owns its colour scheme instead of following the
  system wallpaper. Theme.kt defaults to a deliberate darkColorScheme built from
  a mint/teal seed with an amber tertiary (new Color.kt) so it matches the dark
  Pipelines TUI; dynamic colour is gone and a complete light scheme is retained
  for when it is explicitly requested. themes.xml/colors.xml give the app a dark
  window background and dark system bars with light icons, so launching never
  flashes light.
- Workflow graph matches the TUI: the #success/#failure terminals now share a
  lower row under the stage row, with arrows entering their top borders and the
  error -> #failure route leaving the bottom of its source stage, mirroring
  internal/tui/graph_layout.go ('Terminals share a lower row...') and graph.go's
  '[FAILURE]   [SUCCESS]' bottom row. Fit-to-content, pan clamping, the Fit
  action, run highlighting and the TalkBack description are preserved.
- More style: consistent Material 3 top app bars for Pipelines, Runs and
  Settings, the new colour scheme applied across the screens and state
  components, and monospace retained for hashes, source and run input/output.

Verified on the host and on the device: :app:compileDebugKotlin, :app:assembleDebug
and :app:testDebugUnitTest succeed offline with 34 tests and 0 failures
(WorkflowGraphTest grew to 15 tests covering the terminal row, bottom exits and
fit/clamp), and the app was run on the Pixel_Fold_API_36 emulator in dark mode
against the live server: the whole 4-stage graph renders with its terminal row,
and the list, detail and settings screens use the new theme.
2026-10-14 12:36:58 +01:00
alan cee9fb2f79 Fix graph fitting, pan bounds, auto-connect and run wording in the Android client
An emulator run against the live server exposed four usability defects and one
legibility defect, all fixed here:

- The workflow graph was not fit-to-content: 3- and 4-stage graphs showed only the
  first columns until the user panned. The initial view now fits and centres the
  whole graph, scaling down when it is wider than the viewport.
- A panned graph could be dragged completely out of view with no way back. Pan is
  now clamped so content stays visible, and a 'Fit graph to view' action restores
  the fitted view.
- The app did not connect on launch even with a saved server URL. It now connects
  from the saved URL using the existing bounded backoff; an explicit Disconnect
  still stays authoritative for the session.
- The runs list said 'N steps' while run detail said 'N recorded visits'. Both now
  use the server's own vocabulary ('N completed visits' / 'N recorded visits')
  through one shared helper in Format.kt.
- Outcome labels: labels are drawn after all curves so none is crossed, dimmed
  labels use onSurfaceVariant, and executed labels no longer resolve to
  near-invisible container accents ('rejected' measured ~1.2:1 before).

Verified: :app:compileDebugKotlin, :app:assembleDebug and :app:testDebugUnitTest
succeed offline with 28 tests and 0 failures (WorkflowGraphTest grew to 9 tests
covering fitScale, clampOffset extremes and label slots), and the app was driven
on the Pixel_Fold_API_36 emulator against the live server with before/after
screenshots and no FATAL or Compose exception in logcat.
2026-10-13 21:55:16 +01:00
alan 2881256af3 Fix workflow-graph crashes and label layout in the Android client
Running the client on an emulator against a live server exposed real defects in the
workflow graph, all fixed here:

- DrawScope.drawText's string overload measured against the draw scope's constraints
  and threw when a node or edge label fell outside them (wide or panned graphs),
  crashing the pipeline-detail and run-detail screens. Both call sites now draw a
  pre-measured TextLayoutResult.
- The graph Canvas was not clipped, so panning drew nodes and edges over the
  'Versions' row and the 'Workflow graph' heading. The viewport now clips its
  children.
- Outcome labels overprinted when a stage had more than one outgoing edge ('error'
  over 'success'). Labels are now laid out in one row per source edge, with a
  backing rect for legibility.
- Stage columns followed an iterative rank relaxation, so graphs with a back edge
  rendered out of order (planner before reviewer). rankStages now returns
  declaration order, matching internal/tui/graph_layout.go.

Verified: :app:compileDebugKotlin, :app:assembleDebug and :app:testDebugUnitTest
succeed offline with 20 tests and 0 failures (new WorkflowGraphTest covers the
rank order and label slots), and the app was driven on the Pixel_Fold_API_36
emulator against the live server with no FATAL or Compose exception in logcat.
2026-10-13 19:23:10 +01:00
alan 9a94eabaa3 Add the native Android client for the Pipelines server
Kotlin and Jetpack Compose Material 3 client that speaks the existing WebSocket
protocol: settings requiring an explicit server URL and workspace, pipeline list and
detail with the workflow graph, run history, run detail and evidence, start and
cancel run, reconnect, and the loading/empty/error/disconnected states. It stores no
credentials and keeps execution, definitions and run history on the server.

Verified on the host: :app:compileDebugKotlin and :app:assembleDebug succeed and
:app:testDebugUnitTest passes 19 tests. Ignore Gradle outputs and re-include the
net.awan.pipelines.data package, which the repository runtime data/ rule would
otherwise exclude.
2026-10-13 17:20:18 +01:00