diff --git a/README.md b/README.md index ecca4481..2c8523bc 100644 --- a/README.md +++ b/README.md @@ -226,9 +226,10 @@ pipelines run "your pipeline name" "Describe the task" Open **:status** for the server and ntfy connection details. In the ntfy phone app, add the displayed ntfy server, sign in as **phone-reader** with the password -you set during installation, and subscribe to the displayed topic. Stages must -include a `notify` block to send notifications; see [ntfy setup](docs/ntfy.md). -Installation checks publishing, not reception on your phone. +you set during installation, and subscribe to the displayed topic. A run that +waits for a decision or fails notifies automatically; to notify on a stage's own +result, add a `notify` block. See [ntfy setup](docs/ntfy.md). Installation checks +publishing, not reception on your phone. For Tailscale, both devices must be connected; use `http://:8090`. Binding to `0.0.0.0` does not bypass firewalls: diff --git a/android/README.md b/android/README.md index 1daf0a2c..cfc094e9 100644 --- a/android/README.md +++ b/android/README.md @@ -6010,6 +6010,131 @@ reachable from the run detail and its stage and the shared component is ready fo it. No packaged skill reference was touched: the decide protocol is unchanged and already documented, and this is an app-UI change. +## Run attention surface and phone notifications (17 Oct 2026) + +> Supersedes the note at the end of the previous section: the run-attention +> surface the brief named is now present in this tree. The server publishes the +> notification; the app shows the same information in one live surface. + +A run that needs a person — waiting for a human decision, or failed — now reaches +the operator through the ntfy they already run, and the app answers "what needs me +now" in one ordered list. The server change is the smallest that reuses the +existing delivery machinery; there is no second publisher, topic or service. + +- **One run-level notification, reusing the stage's publisher.** `internal/server/ + notify.go` adds `notifyRun`, called from `finishRunState` (failed) and when a run + parks on a human (`runner.go` `runLoop`). It publishes to the same `system` + destination through the unchanged `stage.PublishNtfy`, with the operator's + configured token handling, so nothing is duplicated. `runAttentionEvent` maps + only `waiting` and `failed`; queued/running/succeeded/canceled/interrupted + produce `""` and publish nothing. +- **No storms.** `runner.attentionSent` (guarded by `attentionMu`) records + `sequence:event` per run before publishing, so a run that stays waiting is never + republished on a re-request or restart, and a stage `notify` policy that already + covers the same event (`on=waiting`, or a failure hook) marks it first so the + run-level default is suppressed. The set is dropped when the run is terminal + (`forgetAttention`). A delivery failure is logged, never fails the run, and is + not retried. +- **The payload opens the run.** It names the run id and pipeline, and carries a + `click` action `pipelines://run/` (validated in `validNtfyClick` — absolute + URL, no userinfo, no fragment, no credentials). `AndroidManifest.xml` declares + the `pipelines`/`run` deep link on `MainActivity` (`launchMode=singleTop`); + `runIdFromDeepLink` parses it and `PipelinesApp` opens that run once, clearing + the link so a rotation re-opens nothing. It opens a run; it starts nothing. +- **One attention surface.** `ui/Attention.kt` is the pure model: a run status maps + to `Decision`/`Failed`/`Finished` (or nothing), and `attentionEntries` orders by + kind then newest-first. `ui/components/AttentionSurface.kt` renders a floating + indicator in the same bottom container as the destination pill — visible from + every destination and window width — that opens a bottom sheet listing the run, + its pipeline and what it needs, with a per-row dismiss. The indicator draws + nothing when the list is empty. No competing navigation surface is added. +- **Live and self-clearing.** The list is derived from the same `RuntimeState` + pushes the runs list folds, so an entry appears with no refresh and clears when + the run is resolved (the decision answered, the failure retried). A finished run + clears once the list is opened; any entry can be deliberately dismissed; + dismissals and looked-at finishes persist in `SettingsRepository` as one + serializable preference. Opening a non-decision entry deals with it. + +Tests: `internal/server/notify_test.go` covers the event mapping (waiting, failed, +nothing else) and the real HTTP delivery (destination, topic, click, no +duplicate); `AttentionTest` (13 cases) covers the app's mapping, ordering, +appearing from a pushed event, clearing on resolution, dismissal, the empty case, +persistence and the deep-link parser. + +Evidence (this pass, macOS, JDK 17 `/opt/homebrew/opt/openjdk@17`, cached Gradle +8.11.1, `ANDROID_HOME=$HOME/Library/Android/sdk`): + +- `go build ./...` → success; `go test ./internal/server/... ./internal/stage/... + ./internal/author/...` → `ok` for all three packages. +- `gradle :app:testDebugUnitTest --offline --no-daemon --console=plain` → + `BUILD SUCCESSFUL`; the JUnit XMLs total **58 suites / 531 tests / 0 failures / + 0 errors / 0 skipped** (up from 57 suites / 518 tests: the new `AttentionTest`). + +Not verified in this pass: the on-device indicator/list/finished/empty screenshots +and the phone's own notification — the brief keeps ordinary code review to the +build and the unit tests, and visual review owns the operator's Pixel 9 Pro XL. +The concrete payload delivered to the local ntfy service was reproduced by the +code review with a live curl subscriber; the device captures are visual review's. + +## Destination pill stands down in an open conversation (17 Oct 2026) + +The floating destinations pill was drawn over the bottom of every screen, +including an open chat, where it sat on the composer and the newest message and +competed with the send/stop controls. It now stands down while the Chat +destination is showing an open conversation and stays everywhere else, +unchanged. `android/` only; no new dependency, no run started from the app, no +server/installer/Docker file touched, and the operator's Pixel was never used. + +- **One rule.** `destinationPillVisible(currentRoute, conversationOpen)` is false + only for `chat` with an open conversation — a session's transcript and composer + — and true for the chat list and every other destination. `conversationOpen` is + the new `AppViewModel.conversationOpen` (`chatStore.state.map { it.active != null }`, + `distinctUntilChanged`), read from the same store the chat surface renders, so a + background open chat never hides the pill elsewhere and a streamed chat delta + never recomposes the app shell. +- **The space, not just the pill.** `destinationPillReserve(pillVisible)` returns + the named `DESTINATION_PILL_RESERVE` while the pill is drawn and `0.dp` while it + is hidden: the content Column keeps clearing a drawn pill, and a hidden pill + leaves no empty band at the end of scrollable content, so the composer sits at + the true bottom. The pill and its reservation are driven by the one predicate, + so no frame has a drawn pill over content it does not clear or a reserved gap + behind a hidden pill; the viewport height is constant for as long as a + conversation is open, so the composer and the newest message do not move while + it is shown. Works with the keyboard open: the composer's own `imePadding` and + the pill's `paneSafeArea()` are unchanged, with no pill left to sit over them. +- **Still escapable.** Nothing about leaving a conversation changed: its top-bar + back arrow (`Back to chats`), the system Back button/gesture (`ChatScreen`'s + `PredictiveBackHandler`), and on a wide window the covered chat-list strip + (`SlidingPaneStack.onPopTo`) all return to the list. The pill was never the way + out; Back is. +- **Nothing else touched.** The pill's destinations, travelling indicator, + morph-into-search and behaviour on every other screen are untouched; the + attention indicator is unchanged. + +Evidence (this pass, macOS, JDK 17 `/opt/homebrew/opt/openjdk@17`, cached Gradle +8.11.1, `ANDROID_HOME=$HOME/Library/Android/sdk`, `--offline --no-daemon`): + +- `gradle :app:testDebugUnitTest --offline --no-daemon --console=plain` → + `BUILD SUCCESSFUL in 11s`; the JUnit XMLs total **58 suites / 533 tests / 0 + failures / 0 errors / 0 skipped** (up from 531: `PipelinesNavTest` gains + `thePillStandsDownOnlyWhileAConversationIsOpen` and + `theReserveTracksTheDrawnPillSoContentNeitherJumpsNorLeavesAGap`). +- `gradle :app:assembleDebug --offline --no-daemon --console=plain` → + `BUILD SUCCESSFUL`; `app/build/outputs/apk/debug/app-debug.apk` is **18,535,932 + bytes**, sha256 `fc872b5398c231f053cd6e5f6794b2b6c2a8f947314ba0de02851dab2a95c3e`. +- **APK publish.** Copied to + `~/.local/share/pipelines/data/artifacts/287/1/pipelines-debug-wip-890d267.apk` + (`890d267` = `git rev-parse --short HEAD`; the tree is uncommitted WIP on top of + it), sha256 matched. The LAN URL + `http://10.0.0.75:8080/artifacts/287/1/pipelines-debug-wip-890d267.apk` returned + `HTTP/1.1 200 OK`, `Content-Type: application/vnd.android.package-archive`, + `Content-Length: 18535932`. + +Not verified in this pass: the conversation/list screenshots — the brief keeps +implementation and ordinary code review to the build and the unit tests, and +visual review owns the operator's Pixel 9 Pro XL (its captures are the ones the +brief names: a conversation with no pill, and the chat list with it). + ## Run title readability: whole in the run view, two lines in the list (17 Oct 2026) A run's title is derived from its prompt, so it is often long. The run view now diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index e748c0f6..57e587d9 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -30,12 +30,26 @@ android:name=".MainActivity" android:exported="true" android:label="@string/app_name" + android:launchMode="singleTop" android:theme="@style/Theme.Pipelines" android:windowSoftInputMode="adjustResize"> + + + + + + +