Commit Graph

142 Commits

Author SHA1 Message Date
alan bd09c55c47 Merge lane-go: titles, verdicts, human stage, line result format, stale-client guard
Integrates nine commits of reviewed work from the lane-go branch after the
automated resolver failed on this merge five times (each attempt dying on the
malformed-result defect whose fix is contained in this same merge).

Integration decisions:
- Search: kept main's shipped design (Store.Search + SearchResponse.Results) and
  dropped lane-go's parallel, older attempt (an unused Message.Matches field, an
  absent runs.search, and two partial TUI plumbing blocks). lane-go itself did not
  compile: protocol.SearchMatch was undefined and model.go referenced searchNav,
  requestSearch and applyRunNav, which exist nowhere. Those partial TUI blocks are
  removed; the queued TUI omni-search item will implement the surface properly on
  main's design.
- Both sides' additions are kept where they are independent: run titles and
  provenance, the human decision stage and its CLI/TUI surface, the derived stage
  verdict, the stale-client guard, the line-oriented result format, and main's
  search command.
- The search key's help label is now "/ omni search"; the two tests asserting the
  old label are updated rather than the label reverted.
- docs/cli.md and the packaged operations reference carry both sides' text.

Verified: go build ./... , go vet ./... and the full go test ./... suite pass.
2026-10-16 22:21:43 +01:00
alan aac1be18cc docs: document line-oriented model/agent result format 2026-10-16 21:49:14 +01:00
alan 3aa6ed97aa skill: add the project work ledger and session lifecycle
Add references/work.md: one durable ledger per project (queue, active, done,
failed), the start/pause/resume/status operations, per-item directives, a
restart-safe queue driver, sleep autonomy and a conciseness rule. Index it from
SKILL.md and add it to the installed inventory.
2026-10-16 21:42:52 +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 b05277a57d Add line-oriented result format for model and agent stages
Introduce a short, markdown-ish result format whose first non-empty line is
the declared outcome and whose "# output" section carries the routing data,
so stage output stops carrying multi-kilobyte prose inside a JSON envelope.

- New internal/stage/line_result.go: resultFormat() gates legacy JSON ('{'
  first) vs the new line format; decodeLineResult() parses outcome-from-first
  line, requires a JSON-object "# output" section, stores extra sections
  verbatim under normalised keys, and records a reserved result_parse status
  (parsed/partial/failed). Failures return a salvage Result plus
  ErrInvalidModelResult, and never route an undeclared outcome.
- internal/stage/model.go: write the raw response to raw-output.md (0600,
  best-effort) before parsing, and route the line format through
  decodeLineResult while leaving the JSON path (stageResultText ->
  decodeModelResult -> repairModelResult) unchanged.
- internal/stage/agent.go: agentResultText returns line-format text verbatim
  so the "# output" body is not stripped by the JSON-object extractor.
- internal/server/runner.go: merge a non-empty salvage Result into the error
  envelope under "salvage" on failure (a no-op for the legacy JSON path).
- internal/stage/line_result_test.go: raw-text fixtures covering happy path,
  missing/undeclared outcome, missing "# output", best-effort extras,
  adversarial prose, legacy JSON unchanged, >=64KB responses, and
  raw-output.md written before parsing.
2026-10-16 21:34: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 fa0998b35d Merge lane-c: keep the lane's reviewed work
Combine lane-c's incoming work with the local branch.

- PipelinesApp.kt was the only unmerged path: resolution is purely additive over HEAD, keeping HEAD's hoisted selection/onSelectionChange and pendingNav/onPendingNavResolved while adding lane-c's listState wiring and compactLabel/compactIcon.
- graph/StageDetailPane.kt and theme/Dimens.kt auto-merged and retain both sides' changes.
- Incoming branch af68a62 preserved as second parent.
2026-10-16 20:32:11 +01:00
alan e2147b043b android: share one LabelChip and drop the dead Run.artifacts flag
Consolidate the omni-search row type badge and the stage-type chip into a
single ui/components/LabelChip composable, so the chip's shape, colour and
type live in one place and a second copy cannot drift.

Remove the unused SearchTarget.Run.artifacts field: an artifact hit and a
step hit now resolve identically to the visit's stage pane, whose fixed
section order already leads with the artifacts. Correct the
SearchUiState.failed KDoc to describe how prior results are kept, and
update OmniSearchResultsTest to the simplified target.
2026-10-16 19:53:10 +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 e7c4b8f71f Merge branch 'main' into lane-e 2026-10-16 19:30:13 +01:00
alan 80f7b0adbc android: add omni-search entry point and pill morph
Add the fourth Search destination to the floating bottom container and
morph that container into the omni-search field.

- PipelinesApp: the destination pill gains a Search icon; tapping it
  animates the icons out and turns the same Surface into a focused text
  field whose size and position derive from the pill's own layout and the
  window insets rather than fixed pill sizes. Back, the back gesture and a
  scrim tap play the reverse and restore the pill with its previous
  destination still selected. The open field covers the content behind a
  scrim and shows a results panel above it.
- OmniSearch: pure state model (open/focused/query) with the open, dismiss,
  focus and query transitions and a Bundle-able Saver, so an open field
  survives a saved-state round trip.
- OmniSearchResults / SearchResultsPanel: map the typed search reply to
  rows and render the ranked results, keeping the last accepted results
  while a newer query loads and reporting a failure without blanking.
- AppViewModel / PipelinesRepository: drive queries over the existing
  transport with debounce and reply ordering; the server search command
  arrives in a later item, so a reply is classified by envelope type and a
  non-search_results reply is reported with a clear message instead of
  being mis-parsed, never a crash.
- Message: SEARCH / SEARCH_RESULTS constants and the SearchRequest,
  SearchResponse and per-kind result payloads.
- AndroidManifest: adjustNothing so the app reads the IME from Compose
  window insets and the field is not cleared twice by a window resize.
- Dimens: spacing for the search surface.
- Unit tests for the state model (pill, opening, focused, dismissed and
  restored after the Saver round trip) and for the result-row mapping.
2026-10-16 19:29:40 +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 8c1eea53a9 Report a stale client and refuse an unreadable newer server
Exchange a build/protocol identity so an older CLI can no longer talk to a
newer native server silently:

- protocol carries ProtocolVersion and every server frame (including the
  unsolicited welcome) is stamped with the server build and protocol, so a
  client that never pings still learns the server identity.
- buildinfo.Compare classifies the relationship as InSync/Warn/Refuse and
  names both builds; the client Watch reports one warning per connection and
  returns a hard error when the server speaks a newer, uninterpretable
  protocol so the caller never acts on the frame.
- client.ReceiveNotice decodes the raw frame so an unmodeled top-level field
  produces a one-time "unrecognized field(s)" notice instead of being dropped
  silently (the case that hid the artifacts field).
- CLI routes warnings to stderr, keeps machine JSON stdout clean and fails
  non-zero on a refused mismatch; ping/connection print the client/server
  relationship. The TUI surfaces the same notices through the shared log.
- scripts/setup-native.py now warns when an older `pipelines` earlier on PATH
  shadows prefix/bin/pipelines, naming both paths and versions, without
  installing or modifying anything else.
- Docs, the packaged debugging skill reference and README no longer imply the
  installed CLI always matches the server.

Tests cover the comparison table, unknown-field detection and caching, the
server identity stamping on pong and welcome, the CLI/TUI reporting paths and
the installer PATH shadowing warning.
2026-10-16 18:37:01 +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 98bbc2deac Report recorded decision evidence and harden the Pi artifacts env
Refinements on top of the human decision stage (a6aff47):

- `pipelines decide` now reports the feedback the server actually stored for
  the chosen option, so a repeated (idempotent) decision shows the recorded
  evidence instead of the ignored request text. A repeated decision is covered
  by a new assertion that also checks the step output does not change.
- The decision option/feedback output keys are defined once in protocol
  (DecisionOptionKey/DecisionFeedbackKey) with a DecisionEvidence reader, and
  the store and CLI use them instead of bare string literals.
- piEnvironment drops any inherited PIPELINES_ARTIFACTS_DIR before spawning Pi,
  so the artifactsDir argument is authoritative and an ambient directory (for
  example Pipelines' own when a stage runs inside another stage) never leaks
  into a child that was given none. Covered by a test with an ambient value set.
2026-10-16 17:25:48 +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 a6aff47117 Add a human decision stage that pauses a run for an operator's choice
A new registered stage type `human` (internal/stage/human.go) has no model,
agent, tools or configs: its required `prompt` block carries the operator
instructions and its non-error edges are the selectable options. It parses,
validates, renders, exports and imports like every other type (no parser
special-case, no config keys).

At runtime the runner parks the run instead of executing: the step and the run
persist `waiting` with self-contained {prompt, options} evidence, and the run
returns without starting later stages, capturing file diffs, scanning artifacts,
holding a goroutine/timer or applying a stage timeout. The wait is durable: a
restart leaves the waiting rows untouched (RecoverRuns excludes them) and a
rebuilt runtime over the same database still accepts the decision.

`pipelines decide <run-id> [stage] --option KEY [--feedback TEXT] [--json]` and
the TUI `c` picker resolve the decision from the pinned graph in one store
transaction, record the choice and feedback as the step's evidence and resume
along edges[KEY]. An unknown option is refused with the valid list, a stage that
is not waiting is refused, and a repeated decision for an already-decided visit
does not double-apply. Cancel and retry keep working while waiting and after a
decision; a human stage is never killed by a stage timeout or max_visits, and a
`notify` policy can fire an `on=waiting` event.

Docs: the authoring skill references (format.md, operations.md), docs/cli.md and
README describe the stage, the command and the TUI picker. Tests cover stage
validation, the parsing round-trip, the store transitions, a websocket wait/decide
integration, cancel/retry, waiting notifications and a persistence-layer rebuild
(second Open + newRunner over one database, no process restart).
2026-10-16 16:47:28 +01:00
alan c700b28e6a Add cross-system read-only search
One query now finds anything in the system over the wire and from the CLI.

- protocol: add Search/SearchResults message types and a SearchRequest
  (query, optional kind filter, optional limit) / SearchResponse (typed,
  ranked matches plus truncation and scan-bound counters) pair, with typed
  payloads for pipeline, version, run, step/visit, field text and artifact.
- store: add Store.Search, a read-only query over pipelines,
  pipeline_versions, pipeline_runs, run_steps (+step_control) and
  step_artifacts. Ranks exact name (3) > name substring (2) > body text (1),
  breaks ties by recency then a stable kind/target order, and reports the
  matched field. Bounds work with a 50-default/200-max result cap, a 2000-row
  per-kind scan limit and a 2000-step / 1 MiB field-text scan budget.
- terms: a bare status word or lone date expression (today, yesterday, this
  week, YYYY-MM-DD) selects runs; anything else stays free text.
- server: dispatch protocol.Search to stores[0].Search; read-only and
  unconfirmed.
- cli: add `pipelines search QUERY [--type KIND] [--limit N] [--json]`, help
  text and a BROWSE line.
- store: add OpenReadOnly so the live-database check never runs DDL.
- docs: document the grammar, kinds, ranking and bounds in docs/cli.md,
  scope the TUI omnisearch to pipelines in docs/ui-ux-review.md, and add a
  search bullet to the packaged operations reference.
- tests: protocol round trip, store/ranking/term-parsing/limit/scan-bound
  unit tests, a server end-to-end test, and an env-guarded live check.

No new dependencies; go.mod/go.sum unchanged.
2026-10-16 15:43:25 +01:00
alan 1b4674d22c Show the derived stage verdict atop the stage view in the run detail
Move a completed stage visit's derived verdict out of the Progress summary
and into the top of the selected stage's Result section, so the chosen
option, its concise reason and the referenced artifacts are visible where
the stage is inspected.

- Add stageVerdictLines, which renders one line "Verdict: <option> · <reason>"
  (still stating the option when the reason is absent) plus a following
  "Referenced artifacts:" line only when artifacts exist, and returns nil
  for a nil verdict so nothing extra is shown.
- Prepend those lines in runSectionLines after the stage state and before
  the stage output and evidence, without adding a section or changing the
  panel layout.
- Update the TUI test to render through the run-detail view, asserting the
  option, reason and artifact names appear, and that a nil verdict adds
  nothing; document the TUI placement in the debugging skill reference.

Omni-search work already present in the working tree (including the
runDuration→protocol.Duration refactor in run_detail.go) is unrelated to
this change and is left uncommitted.
2026-10-16 15:12:23 +01:00
alan c13dca0f42 Merge branch 'main' into lane-go 2026-10-16 14:18:24 +01:00
alan e79ff9585f Derive a plain-language verdict for every completed stage visit
Each completed step now exposes a verdict: the chosen option (outcome -> target),
a bounded one-line reason with model/fallback/absent provenance, and the recorded
artifacts the reason refers to. The store persists only the model-generated line
in a new step_verdicts table and derives the fallback at read time (no backfill);
the server generates the line once at completion, best-effort; the TUI renders it
in the stage progress summary. The packaged debugging reference documents it.
2026-10-16 13:54:48 +01:00
alan f3e0593f4d Let runs carry an operator title shown in the CLI and TUI
Add a bounded, never-empty title to every run. `pipelines run --title "..."`
sets it explicitly and skips model generation; otherwise the server generates
it from the prompt through the shared summariser and falls back to the prompt's
first line, recording title_source (model/fallback/explicit) and title_model.

- protocol/store: RunSummary.Title plus Label(), a set_run_title message, title
  columns with an idempotent migration, CreateRunTitled, and SetRunTitle renames.
- summarise: Title/GenerateTitle/DeriveTitle/ExplicitTitle bounded to TitleCap.
- runner: generate the title outside the admission lock and only for a request
  that starts a run; a replay reuses the stored title and an explicit title
  skips the model entirely.
- CLI: `--title` on run and a `title <run-id> "<title>"` rename command; human
  `runs` and `inspect` show the title beside the pipeline name and version.
- TUI: the run list row, run detail header, Home run cards and last-run line,
  and the pipeline Results line show the title via Label().

Tests cover storage/migration/fallback, explicit-title and rename, the
end-to-end CLI flow, and title rendering; CLI and operations docs updated.
2026-10-16 13:36:48 +01:00
alan dce624b428 Merge lane-go: keep the lane's reviewed work 2026-10-16 13:12:36 +01:00
alan 0e6fbcc062 Merge branch 'main' into lane-go 2026-10-16 13:09:34 +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 9f88e4ff71 Recover malformed model-stage results with a bounded, work-preserving repair
A model stage whose final result was malformed failed the whole run even when
the work and evidence had survived, because the only recovery was an isolated
formatter call on a fixed 30-second deadline that could time out on its own
(run 55, ui_reviewer of pipeline 9 v6).

Add an ordered, deterministic local repair pass (internal/stage/result_repair.go)
that runs before any model call: (a) append missing closing delimiters via the
existing closeJSONContainers; (b) remove one unambiguous trailing comma before a
closing } or ]; (c) insert exactly the single comma/colon the JSON parser reported
at its byte offset. Every candidate must pass losslessSyntaxRepair(original,
candidate) and decodeModelResult before it is accepted, so no field value is
invented, removed, reordered or rewritten. Ambiguous payloads (an unescaped quote
or colon inside a string value, or a stray delimiter with no single completion)
return not-ok and fall through to the bounded model re-emit rather than guessing.
stageResultText still strips surrounding prose and a single code fence first;
model_prompt.go now also strips prose around a single balanced-but-malformed
object span so the deterministic pass sees just the object.

Replace the fixed 30-second formatter deadline with repairDeadline(payloadBytes,
remaining), which grows monotonically with payload size, has a floor, and is
clamped to the attempt's remaining budget minus a safety margin, so the stage
context remains the outer bound and a large result is not guaranteed to time out.
The one-request-per-attempt, 32 KiB bound and the deny-all, retained, new-session
property of RepairFormat are unchanged for OpenCodeClient and PiClient.

Record an explicit recovery status on every terminal path: repaired, partial or
unrecoverable, plus a byte offset. A candidate that is valid JSON but still fails
envelope validation is marked partial and never returned as a completed result;
the unrecoverable path retains the bounded original payload, the precise parse
error (including its byte offset) and surfaces the status in the FINAL RESULT
VALIDATION diagnostic.

safeToReplay is intentionally unchanged. The deterministic local repair and the
fresh deny-all, no-tools, retained formatter session are independent of the
stage's tool set and never re-prompt or replay the admitted agent session, so a
shell-enabled review stage gains malformed-result recovery without any replay of
admitted work. Risk: no change to mutation safety; the only added cost is one
bounded formatter call, already budgeted. Replayability is not extended for shell
stages.

Docs and packaged skill references (docs/model-results.md,
internal/author/skill/references/{format,debugging,verification}.md) describe the
three-tier recovery, the status words and the derived deadline; the safeToReplay
decision and its risk are recorded there alongside the commit.

Tests add mocked, offline coverage for the deterministic and partial paths, a
repairDeadline monotonicity/floor/clamp table, and a shell-stage regression
proving a recoverable malformed result does not fail the run or replay tool work.
2026-10-16 13:02:53 +01:00
alan 7b3a56398d Merge branch 'main' into lane-go 2026-10-16 12:44:09 +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 bfef465977 Fix build: define protocol.NormalizeText used by the summariser
internal/summarise called protocol.NormalizeText, which was never defined, so the tree did not compile. Add the shared normalisation helper: drop zero-width formatting runes, turn control characters into spaces and collapse whitespace runs (including the non-breaking space variants) into single spaces. Reuse it in OutputPreview instead of duplicating the mapping logic.

Cover the awkward inputs (newlines, tabs, non-breaking spaces, zero-width runes, surrounding quotes, trailing punctuation) in the protocol and summarise tests. Unrelated working-tree changes are left uncommitted.
2026-10-16 12:28:27 +01:00
alan 8e49a0c6f9 Merge lane-go: keep the lane's reviewed work 2026-10-16 12:07:02 +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 e84b0db728 Merge branch 'main' into lane-go 2026-10-16 11:33:19 +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 5157b3a716 Add bounded one-line summariser using the configured default harness
internal/summarise performs a single tool-free generation through the
configured default harness (its interactive model), reusing the exact
stage.ModelGenerator/OpenCodeClient/PiClient construction provider-check
uses. It bounds input (InputCap), output (one line, OutputCap runes) and
time (DefaultTimeout), returns the NoSummary sentinel on any error/timeout/
unusable reply, never runs tools or writes files, and records the harness,
model and failed flag in one sanitized log line plus at most one
OperationEvidence.

Reuse: stage.TruncateRunes and stage.OperationLog.Record are the exported
forms of the existing rune-safe truncation and bounded evidence recording;
protocol.NormalizeText trims replies to one line. No new dependencies.

Not wired into titles/verdicts yet: protocol.OutputPreview and the
internal/server/notify.go notification summary are the obvious future call
sites.
2026-10-16 10:55:43 +01:00
alan 7f7492a7bd Merge branch 'main' into lane-go 2026-10-16 10:45:56 +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 8b39c087fd Animate the active stage and executed edges in the run graph
Show what is happening while a run is live. The executing stage now carries a
subtle pulsing halo (replacing the blink) and a live ticking elapsed badge
derived from the run's current visit start. Executed edges carry a directional
flow of light dots along the path; a finished stage settles into its static
colour. A finished run never animates, the animation pauses when the graph is
off screen, and with the system animation setting disabled it falls back to a
static but clearly marked running state.

The per-frame visual state and should-animate decision live in pure functions
(GraphMotion.kt, Format.kt secondsSince; GraphSemantics exposes executing and
currentStageStartedAt) with unit tests and no frame-timing assertions. Adds
GraphMotionTest and extends GraphSemanticsTest and FormatTest.
2026-10-16 09:52:57 +01:00
alan 1818a06d2f Restrict chat_sessions to server-owned sessions
chat_sessions now brokers GET /api/session but filters the global list to
the sessions this server recorded in run_steps, deduped by session id, and
fails closed to an empty list when no ownership source is configured. A
session another client holds (in-server claim, released on stream end or
disconnect) or an active run is marked busy; a second client's chat_prompt
for a held session is rejected before any OpenCode call. chat_create stays
unbrokered.
2026-10-16 09:21:50 +01:00
alan dca72a09ee Merge branch 'main' into lane-go 2026-10-16 09:07:06 +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 3ff5cd8838 Poll OpenCode permission requests and forward chat_reply 2026-10-16 08:06:39 +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