648c9c33d8b01840195c4591f70c61923459b5e2
274 Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
648c9c33d8 |
Merge main into chat-persist: combine OpenCode pairing chat persistence with main's bottom selector strip
Brings main (
|
||
|
|
0ba1204895 |
chat: attach to the operator's own OpenCode by pairing, fall back honestly
Brokered chat accepted an operator-supplied endpoint (-opencode-endpoint /
PIPELINES_OPENCODE_ENDPOINT) but failed closed against the operator's running
V2 service: that API authenticates every request with HTTP Basic auth (fixed
user "opencode" plus a password), the broker had no credential, so the health
probe answered 401 and startup logged "OpenCode endpoint ... is unreachable or
is not an OpenCode service", disabling chat entirely.
Established from the installed binary (opencode v2.0.20), not from docs:
`opencode --help` advertises `api`, `pair`, `serve`, `service` and `auth`;
`GET /api/info` is unauthenticated-401 with www-authenticate Basic realm
"Secure Area"; Basic auth user `opencode` with the password from
~/.local/state/opencode/service.json answers 200; `POST /api/pair` returns a
code and `GET /auth/connect/{code}` returns a token that is then accepted as
the Basic password.
- internal/opencode/pair.go (new): PairEndpoint does the pair exchange over the
shared nativeRequest transport (same auth, bounds and JSON checks);
ReadServiceCredential reads the operator's local service password under the
private-file rule; OpenEndpointAttached resolves the credential in precedence
order - explicit password file, a paired token stored by an earlier run, then
a fresh pairing bootstrapped by the local service credential - stores the
token owner-only and re-pairs once when a stored token is refused (401).
- internal/opencode/endpoint.go: OpenEndpoint wraps probeEndpoint, which returns
the connection even on failure; Connection.unauthorized (set on HTTP 401 by
the request paths, cleared per probe) distinguishes an authentication refusal
from any other refusal.
- cmd/pipelines-server/main.go: the endpoint attach uses OpenEndpointAttached
with the paired-credential file beside the pipeline database. An endpoint that
cannot be attached logs a line naming it and falls back to the server's own
OpenCode instance instead of leaving chat refused.
- internal/protocol/status.go, internal/server/websocket.go: get_status gains an
opencode object (health = endpoint | fallback | spawned | unavailable, plus
the endpoint url), the honest status evidence for the fallback. No credential
is ever placed there.
- Tests: internal/opencode/pair_test.go, internal/protocol/status_test.go and a
TestStatusReportsOpenCodeAttachment case in internal/server/status_test.go.
Repository checks: go build ./..., go vet ./... and gofmt -l . clean;
go test ./internal/... ./cmd/... green.
Packaged templates and skill references: the repository has no template tree
that mentions the OpenCode endpoint, and no packaged reference file is added, so
internal/author/install.go's managed inventory is unchanged. The packaged
authoring reference internal/author/skill/references/operations.md (the endpoint
paragraph around line 289, the "clear refusal and no fallback" wording and the
password-file/username-only credential story, and the missing opencode status
field) is now stale; per the maintenance convention the item does not edit the
shared document and instead records the stale points, with the exact wording
they should take, in docs/notes/chat-persistence.md for the docs-fold writer.
|
||
|
|
78725e92f0 |
Merge bottom-strip: move the detail and visit selectors to a bottom strip on narrow windows
The narrow detail and visit selectors are now the shared bottom strip in the thumb zone (content above it), while a wide window keeps the left rail and the pinned visit top row; the floating destinations pill lifts clear of the strip. android/ only, no new dependency. |
||
|
|
49f40bfe45 |
android: move the detail and visit selectors to a bottom strip on narrow windows
The two selectors that were a horizontally scrolling Material 3 tab row at the top of a surface become one deliberate treatment. On a narrow window the shared detail selector (`DetailTabs`) and the visit selector are now the shared bottom strip (`ui/components/SelectorStrip.kt`), pinned in the thumb zone above the system gesture inset with the content filling the area above; a wide window keeps the left rail for the detail selector and the pinned top row for visits. - SelectorStrip: the one bottom strip plus its pure model (`SelectorEntry`, `SelectorPlacement`, `detailSelectorPlacement`, `visitSelectorPlacement`, `selectorStripShown`, `detailSelectorEntries`, `visitSelectorKey/Label`, `visitMarker`, `visitSelectorEntries`). Each entry keeps at least the platform minimum touch target, shows its whole label, and a visit shows its recorded status/outcome as a small `RunStatusIcon` marker rather than an invented one. Selection is carried by tab semantics and container colour, not colour alone. A single entry (or none) draws no strip. - `DetailTabs` narrow branch replaced by `SelectorStrip` after the panel in a Column; the wide rail is unchanged. - `StageDetailPane`: `StageVisitStrip` is the narrow visit selector; the bodies put a `weight(1f)` scroll above it and keep the top row only on a wide window. The stage definition section still shows no strip. - `SessionExport`: `SessionExportSection` gains `visitTabs` so the narrow pane does not render the visit selector twice. - `PipelinesApp`: the strip publishes its measured height through the new `LocalBottomStripInset`/`BottomStripInset`, and the floating pill's overlay lifts by `pillBottomOffset(stripHeight) = SPACING_L + stripHeight` (pure, zero when no strip is up), so the pill never overlaps the strip. - Tests: new `SelectorStripTest` (placements, single-entry no strip, detail entries keep tab keys/titles/icons, visit labels and markers, stable visit keys) and a new `PipelinesNavTest` case pinning the pill lift. Pill/strip clearance is the brief's "pill moves clear of the strip" option, implemented once in `pillBottomOffset`. All geometry and motion come from the existing named tokens and the layout; no new dependency. Documentation checked: no packaged OpenCode skill reference (`internal/author/ skill/references/`) or packaged template (`examples/*.md`) documents the app's detail/visit selector presentation, so neither is stale and `internal/author/ install.go`'s managed inventory needs no change. The shared `android/README.md` is made stale by this change (the narrow tab-row wording at lines ~182-184, ~233-235 and ~487-488) and is recorded for the single `docs-fold` writer in the new `docs/notes/bottom-selector-strip.md` rather than edited here. |
||
|
|
d9619ea568 |
Merge slash-commands: run /new, /close, /rename, /stop and /help from the chat composer
The composer reads a leading slash as a command instead of a prompt: a filtered offer list with Enter/tap and D-pad navigation, /new creating a session in the current directory and switching to it (the old one stays listed with its history), /rename on this device, /stop for a running turn and /help, with an unrecognised /… offered as a message or cancelled rather than ever reaching the agent. Commands report as their own transcript lines outside the model's context. /close finishes the session through the server's own close (chat_close) that landed beside this work, then returns to the list. |
||
|
|
dc75791992 |
Merge main into slash-commands: combine the composer's slash commands with the
server-side chat close What was combined: - main brought the server-side close (chat_close/chat_reopen over the protocol, PipelinesRepository.chatClose/chatReopen, ChatStore.sessionClosed/sessionReopened and active/closed session projections, the list's Close chat… confirmation and the Closed chip), plus the destinations-pill overlay and the omni-search and status-label work from the lanes that landed beside this one. - this branch brought the composer's slash commands: parsing, the filtered offer list with Enter/tap/D-pad, the shared prompt path, /new in the current directory, the local /rename, /stop, /help and the unknown-command offer, with local command lines rendered outside the model's conversation. Resolution (the one place the two sides disagreed): The branch's /close reported that no real session close existed, because none did when it was written. main now has one, so /close delegates to it instead: AppViewModel.SessionChatCommandHost.finishSession calls closeChatSession, which uses the server's own chat_close (a running turn is stopped, the session is marked closed for every client, the history is kept), and then chatStore.close returns the operator to the list. A failure is reported on the list, where the list's own close reports it. The now-false "this build has no real session close yet" line and its CHAT_CLOSE_UNAVAILABLE constant are removed, /close's offer summary says it finishes the session for every client, and its test now drives the real store close (sessionClosed + close) and asserts the row is closed, kept as history and off the pane. Checks run after resolving, on the merged tree (HEAD = this merge): `--offline --no-daemon :app:assembleDebug` BUILD SUCCESSFUL, and `:app:testDebugUnitTest` BUILD SUCCESSFUL with 646 tests, 0 failures (including ChatCommandsTest.closeDelegatesToTheRealServerCloseAndReturnsToTheList). DimensTest still holds: no raw dimension was added outside the token files. The packaged templates and packaged authoring skill references are unaffected — this is an Android-app-only change with no protocol, server, installer or Docker change — so none of them needed updating. Documentation now stale (not edited here; one writer folds shared docs): android/README.md's chat section describes the composer and the session list without the slash commands (vocabulary, offer list, unknown-command guard) and without the composer's /close path to the server close. |
||
|
|
fa6106ea46 |
android: add slash commands to the chat composer, starting with /new
The composer now reads a leading slash as a command instead of a prompt, so the operator can start a session, rename it, stop a turn or ask for help without leaving the input field — the same surface the pipeline terminal gives with `:status`, `:logs`, … - ChatCommands.kt: parsing (a bare `/`, an unknown word, an argument, text that merely starts with a slash), the filtered offer list, the Enter target, the `/help` listing, the effect routing and the host interface. Pure, so the routing is testable without a device or server. - ChatComposer.kt: the offer list above the field, Up/Down to move the highlight and Enter/tap to run the highlighted row, shown only while the draft is a bare command word. Sending, attachments, stop-while-streaming, queued state and the field's ordinary keyboard action are unchanged. - AppViewModel.kt: one shared prompt path (`postChatPrompt`) for the composer and the unknown-command offer, and a host that performs the effects. `/new` creates in the current session's directory and switches to it, leaving the old session open, listed and with its history; `/rename` uses the device's own local rename and says so; `/stop` interrupts a running turn; `/close` reports that this revision has no real session close rather than dressing up the local hide. - ChatStore.kt / ChatTranscript.kt / ChatCommandUi.kt: local command lines (`ChatCommandNotice`) rendered as their own transcript item, visually distinct from a message to the agent, with an error container for a failed command. - An unrecognised `/…` is never sent to the agent: it becomes an offer to send it as a message or cancel, and the offer is taken once so a stale tap sends nothing. Running a command adds nothing to the model's conversation. - Dimens.kt: one new token, CHAT_COMMAND_LIST_MAX_HEIGHT, for the capped list. - ChatCommandsTest.kt: parsing, filtering, `/new` in the current directory and switching, `/rename` and `/close` delegating, `/stop` only while running, and the unknown command never reaching the prompt path. Checks made before committing: this is an Android-app-only change with no protocol, server, installer or Docker change, so the packaged templates and the packaged authoring skill references (internal/author/skill/references/) are unaffected and no managed-file inventory in internal/author/install.go changes; none of them needed updating. No dependency was added — Icons.Default.Terminal comes from the already-declared material-icons-extended. Verified with the Android map's own checks for an implementation change, build plus unit tests (`--offline --no-daemon :app:assembleDebug` and `:app:testDebugUnitTest`), and DimensTest's geometry-token rule holds: the only new dimension is the named token above. Device behaviour was deliberately not exercised here (this stage does not use adb); the rendered offer list, D-pad handling and notice item belong to visual review. Documentation that is now stale (not edited here; a single writer folds shared docs): android/README.md's chat section describes the composer without the slash commands — it should gain the command vocabulary, the offer list and the unknown-command guard. |
||
|
|
643073d602 |
Merge lane-pill: make the destinations pill a true overlay, centred narrow and right when wide
The pill no longer takes layout space: it is drawn in the bottom overlay above the content, centred on a narrow window and anchored bottom-right on a wide one, with its trailing clearance moved into each scrollable's own content through LocalPillBottomInset. Templates leaves the pill for a Templates row on the Settings page, backed by the new SettingsDestination sliding stack. The item's documentation change is recorded in docs/notes/pill-overlay-and-position.md for the docs-fold writer rather than edited into android/README.md. |
||
|
|
d6cb1931d0 |
Merge main into lane-pill: combine the pill overlay with main's chat-close, omni-search and status work
Brings the branch up to date with main's tip so it can be merged back without conflict. Merged cleanly, with no conflicted path: git auto-merged ui/PipelinesApp.kt, ui/chat/ChatListPane.kt and ui/screens/RunHistoryScreen.kt, keeping main's changes (the omni-search panel, the one status colour, the chat close/tool-work surfaces) alongside this item's pill overlay, its LocalPillBottomInset clearance and the SettingsDestination templates stack. android/README.md is main's version, not this item's: this item records its documentation change in docs/notes/pill-overlay-and-position.md for the single docs-fold writer instead of editing that shared document. Checks re-run on the merged tree (macOS, JAVA_HOME=Android Studio jbr, ANDROID_HOME=~/Library/Android/sdk, Gradle 8.11.1, --offline --no-daemon): `gradle :app:assembleDebug :app:testDebugUnitTest` -> BUILD SUCCESSFUL, 67 result XMLs aggregating to 627 tests, 0 failures, 0 errors, 0 skipped. |
||
|
|
5a44ff1568 |
android: make the destinations pill a true overlay, centred narrow and right when wide
The floating destination pill no longer takes layout space: it is drawn in the
bottom overlay layer above the content, horizontally centred on a narrow window
and anchored to the bottom-right corner on a wide one. Templates leaves the pill
for a Templates row on the Settings page.
- PipelinesApp: the content Column's pill reservation is gone; contentPillPadding
(pillVisible) is the named zero and a unit test pins both states. The pill and
the attention chip stay in their own bottom-anchored overlay Column, a sibling
of the content in the Box, so nothing positions the content. The one placement
rule is destinationPillAlignment(wide) (CenterHorizontally narrow, End wide);
the corner margin is the named SPACING_L, so no new number. The attention chip
keeps its own bottom-right place at every width via Modifier.align(End).
- Trailing clearance moves into each scrollable's own content: pillScrollInset
(DESTINATION_PILL_RESERVE + ATTENTION_CHIP_RESERVE while drawn, zero while
hidden) is published through the new LocalPillBottomInset
(components/PillInset.kt) and applied with pillContentPadding /
Modifier.pillBottomPadding in every list, grid and scrolling detail, stage and
settings body. The container keeps its full height, a hidden pill leaves no
empty band, and the last row still scrolls clear of the pill.
- Templates is no longer a pill destination: TemplatesDestination.kt is deleted
and destinations is pipelines/runs/chat/settings. The new SettingsDestination
sliding stack (pane 0 SettingsScreen, 1 TemplateGalleryScreen, 2
TemplateDetailScreen) with the pure, Bundle-able SettingsSelection model gives
the gallery the shared covered-pane strip and one-level Back; SettingsScreen
gains the Templates row that opens it. This re-lands the intent of a2043f9,
which never reached main.
- Dimens: the two reserve tokens' docs now describe the scroll-content clearance
and the chip's share of it; no new token and no hardcoded geometry.
Checked where the change belongs: no packaged template (examples/*.md) and no
packaged authoring skill reference (internal/author/skill/references/*) describes
the Android pill, its destinations or the Templates gallery, so none needs
updating and internal/author/install.go's inventory is unchanged. android/README.md
does document the surfaces this item changed, so it is now stale: this item does
not edit that shared document - docs/notes/pill-overlay-and-position.md records
the two places that need it (the Templates bullet and the dated section to append)
for the single docs-fold writer.
Tests: at
|
||
|
|
d3dd5ab868 |
Merge chat-close: finish a chat on the server and keep its history
Adds chat_close/chat_reopen to the brokered chat protocol and the operator_sessions closed state, so an operator can finish with a chat: any turn in flight is stopped through the existing interrupt, the closed state is recorded on the server for every client, and the session, its transcript and its history are kept and stay reachable as history. The app gains a Close action with a confirmation, a Closed section and chip, and Reopen; the device-local hide is renamed Hide on this device. Nothing is deleted and no pipeline-owned run session is touched. |
||
|
|
f85c172dc2 |
Merge main into chat-close: combine the shared chat room with the server-side close
The item adds chat_close/chat_reopen to the brokered chat protocol and the operator-session registry's closed state. main replaced the per-session claim model with shared chat rooms (chat_subscribe, a prompt queue, one broker stream fanned out to every watcher). This merges the two. Resolved conflicts: - internal/protocol/chat.go, internal/protocol/message.go: kept both additions - ChatClose/ChatReopen and main's ChatSubscribe/ChatQueued. - internal/server/chat_sessions.go: kept the closed fields on a listed session; dropped the `Busy` assignment, because main no longer marks a session Busy (any number of clients may watch and write one). - internal/server/chat_claims.go: main deleted the claim model, so the file goes; close's "is a turn running" check is now `chatHub.turnInFlight` in internal/server/chat_room.go, reading the room's `running` flag. That is the same question the old claim answered, against main's model. - internal/server/chat_close.go: calls turnInFlight instead of the removed `active`. - android AppViewModel.kt, ChatFormat.kt, ChatListPane.kt, Message.kt: kept both sides - main's search state, queued-prompt handling, `Busy`-free status label and row/menu shape, plus the item's close/reopen actions, closed chip and section, close confirmation and "Hide on this device" rename. Also in this merge: main's new convention (AGENTS.md) that an item does not edit a shared document; the item's stale-document record for this change lives in docs/notes/chat-close.md, and docs/cli.md, android/README.md and internal/author/skill/references/operations.md are left to the docs-fold writer. Checks after resolving: gofmt clean, go build ./... and go vet ./... clean, the Go module passes, and the app's :app:assembleDebug and :app:testDebugUnitTest pass (--offline --no-daemon). |
||
|
|
971e555ceb |
chat: close and reopen an operator session on the server, keeping its history
Add a server-side close for operator chats, so finishing with a chat takes it out of the active list for every client without deleting anything. The brokered protocol gains chat_close and chat_reopen; chat_close stops a running turn by reusing the existing broker interrupt (its result carries an interrupted flag, so a stream is never left running into nothing) and then sets closed_at on the session's operator_sessions row. The session, its transcript and its history survive, and because the closed state lives in the registry chat_sessions reports it to every client, not just the one that asked. An id that is not a recorded operator session, including a pipeline-owned run session, is refused before anything is written. chat_reopen clears the state again, and simply prompting a closed session also clears it (the store clears closed_at on touch). The registry gains closed_at for a fresh database and an idempotent migration for one created before it existed. The app renders closed sessions under a labelled Closed section with a Closed chip, offers a Close action with a confirmation that says it stops a running turn, marks the chat closed on every device and deletes nothing, and a Reopen action on each closed row. The device-local hide is renamed Hide on this device, with a snackbar saying the chat stays on the server, so it is never confused with the real close. No new dependency, the installer and Docker files are untouched, and no run is started from the app. Checked before committing: the packaged templates carry no chat surface and need no update, and internal/author/install.go's managed inventory needs none either (this adds no reference file). The packaged authoring skill reference internal/author/skill/references/operations.md and the shared docs/cli.md and android/README.md are stale because of this change, but an item no longer edits a shared document: what is stale and what should change there is recorded in docs/notes/chat-close.md for the docs-fold writer, which is committed here with the change. Checks: gofmt clean, go build ./... and go vet ./... clean, and go test ./internal/protocol/... ./internal/pipeline/... ./internal/server/... ./internal/author/... pass. The app side is verified with :app:assembleDebug and :app:testDebugUnitTest (--offline --no-daemon, BUILD SUCCESSFUL); the on-device close, second-client and reopen check is deferred to visual review. Not deployed; deploying is the operator's step. |
||
|
|
2c1dfe9a35 |
android: restore the shared LabelChip the search-icon replay deleted
Replaying b808158 removed ui/components/LabelChip.kt: that commit predates
|
||
|
|
986a62b09f |
android: add omni-search type icons with a kind filter and sorting
The search results panel replaces each row's text type badge (LabelChip,
removed) with a glyph derived from the result kind and, for an artifact,
from its content type. The artifact branch reuses the gallery's own
artifactKind/artifactIcon mapping in ui/graph/ArtifactType.kt instead of
a second table, and the glyph's contentDescription carries the kind in
words so a screen reader hears what the icon cannot show.
The panel's header gains the runs list's FilterMenu and SortMenu: a kind
filter (All kinds, Pipelines, Runs, Steps, Fields, Artifacts, Versions)
that sends the server's SearchRequest.kind verbatim, and Relevance /
Newest / Name sorting. The server's search takes no sort, so Newest and
Name order the results in hand and say so ("Sort results in hand", the
collapsed summary's "(in hand)"); no Prompts option is offered because
the server's search kinds cannot produce one. The chosen kind and order
persist via SettingsRepository, surviving query changes and streaming.
Tests: OmniSearchResultsTest covers the per-kind and per-content-type
glyph (checked against the gallery mapping), the kind label, filter
narrowing, Relevance/Newest/Name ordering with ties, and the empty-state
line; ArtifactTypeTest covers artifactKindLabel.
Checked before committing:
- Packaged templates: none describes the app's search panel; unchanged.
- README/topic docs: android/README.md gains the "Search type icons, a
kind filter and sorting" section; docs/cli.md and docs/ui-ux-review.md
describe only the TUI/server search, so they stay accurate and are
unchanged.
- Packaged authoring skill references: internal/author/skill/references/
contains no Android search-panel documentation (operations.md's "omni
search" is the TUI), so none needs updating; install.go's inventory is
untouched.
Evidence: gradle :app:testDebugUnitTest --rerun 433 tests 0 failures;
:app:assembleDebug successful, APK published to the run artifacts; the
API-27 NewApi lint errors are pre-existing and unrelated.
(cherry picked from commit b808158d499912e09872c31b5259205ee6cd8838)
|
||
|
|
36977d7353 |
Merge multiclient: fan a chat session out to every client and answer approvals exactly once
Every client watching a session receives every frame any client's turn produces, a prompt from any client is accepted and serialised per session (queued behind the in-flight turn, acknowledged as queued), user messages are attributed to the sending device's label, and a pending approval is a shared exactly-once object: the first answer wins, is recorded, is pushed to every watching client, and a later answer is refused. Supersedes the per-session claim and the Busy read-only state. |
||
|
|
672d260b33 |
Merge main into multiclient: combine the multi-client chat fan-out with main's chat tool-work, notifications, status palette and docs-fold changes
No conflicts: main's chat-surface work (the in-flight tool work in ChatFormat, ChatStore and ChatTranscript, run notifications, the status palette) sits in different hunks from this branch's fan-out edits, and main did not touch docs/cli.md. Checks re-run on the merged tree: gofmt -l . (clean), go build ./..., go vet ./..., go test -count=1 ./... (all packages pass; the focused multi-client tests fan-out, per-session serialisation, first-answer-wins, pending replay and resync pass), and the Android unit tests (gradle --offline --no-daemon :app:testDebugUnitTest, BUILD SUCCESSFUL, 598 tests, 0 failures). |
||
|
|
6cb61578de |
Fan a chat session out to every client and share approvals exactly-once
A session was owned by one connection: the claim map in chat_claims.go let the
first client hold it, every other client saw the session Busy and read-only, and
a second client's prompt was rejected. Replace the claim with a per-session
"room" so the operator's phone, tablet and terminal all watch and write the same
conversation, and a pending approval is a shared, exactly-once object.
Server (internal/server, internal/protocol):
- New chat_room.go: one room per session holding the session's single broker
stream, its one bounded prompt queue (8) and the fan-out to every attached
client. A chat_subscribe frame attaches a connection to a session's shared
stream and replays the still-unresolved approval requests the room holds.
- chat_stream.go: handleChatPrompt accepts a prompt from any client. It attaches
the sender, either starts a turn or queues the prompt behind the in-flight turn
and acknowledges it with chat_queued:true ("queued" is the chosen behaviour,
stated on the wire and in docs/cli.md), and echoes the user turn to every other
client attributed to the sender's label. The prompt handler no longer owns the
stream; one turn runner per room drains the queue, so two turns never
interleave. Per-connection write serialisation is unchanged (each chatSub has
its own writer goroutine and bounded buffer).
- chat_permissions.go / chat_commands.go: an approval is reserved by the first
answer and confirmed once delivered; the first answer wins, is recorded with
the answering client's label, and the resolution is pushed to every watching
client as chat_permission with resolved/decision/resolved_by so their cards
clear. A later answer is refused with an error naming the client that answered,
and never reaches the agent twice; a reservation whose reply failed is
released.
- chat_hub.go / chat_sessions.go / chat.go: the hub now owns rooms and the
user-turn id sequence; the resulting user turns are retained (role and client
carried) so a reconnect re-syncs who said what. chat_sessions no longer marks a
session Busy and its clientID parameter is gone; the protocol keeps the Busy
field for wire compatibility only. websocket.go detaches a connection's chat
subscriptions when the read loop ends.
- chat_claims.go is removed, not left vestigial: the only exclusive thing left is
a turn, and the room's queue is that.
App (android):
- PipelinesRepository carries a stable per-device client label (Build.MODEL, with
a fallback) on prompts and replies, and adds chatSubscribe; AppViewModel
subscribes on opening a chat (best-effort, an older server's error frame does
not stop history loading) and records the queued ack.
- ChatStore folds a user frame from another client into the transcript once,
attributed by the sender's label, and never receives its own prompt back, so
the sender's own message is never duplicated. ChatThread.readOnly is gone:
canSend no longer depends on another client, the composer says "Queued - it
will send when the current turn finishes." instead of disabling input, and the
status label is Running/Idle only. Scroll/follow behaviour is untouched.
- Tests: ChatProtocolTest round-trips the new wire fields, ChatFormatTest asserts
the stale Busy flag cannot produce a read-only label, MultiChatStateTest asserts
a session another client watches stays writable.
Reflected where it belongs: no packaged template changes (no bundled starter
embeds the chat protocol). Checked the packaged authoring skill references: none
of them describes the chat wire beyond operations.md, and
internal/author/skill/references/operations.md is now stale - its "Brokered
OpenCode chat" section still says chat_sessions marks "busy" when another client
holds the session and that a second client's chat_prompt is rejected, and it does
not mention chat_subscribe, the per-session prompt queue/chat_queued, the
per-client label or the shared exactly-once approval (it also still describes the
per-subscription permission poller, which the room's single poller replaced). The
supported semantics are the ones in docs/cli.md, updated in this commit; the
operations.md section needs a rewrite to match. No README or other shared
document was edited here.
Checks run on the committed tree: gofmt -l internal cmd examples (nothing), go
build ./..., go vet ./internal/... ./cmd/..., go test ./internal/server
./internal/protocol ./internal/stage ./internal/pipeline.
|
||
|
|
b7abff3a14 | Merge session-activity: show a chat's in-flight tool work instead of a bare Running | ||
|
|
f339503f68 | Merge branch 'main' into session-activity | ||
|
|
597c7b5e76 |
android: show a chat's in-flight tool work instead of a bare Running
A session said "Running" with an empty tool chip while it worked, so a silent wait was indistinguishable from a stuck one. Derive the in-flight work from the stream the app already folds and show it on both surfaces. - ChatFormat: runningToolCalls() reads the tool parts still running, in transcript order, so the conversation and the session row share one set; toolDetail() takes the command/description the part actually carries (the first of description/command/filePath/file_path/path/pattern/query/url), collapsed to one line and elided at 72 chars, and returns null rather than a fabricated summary; runningToolElapsedMillis() uses the protocol's own time.ran/created when present and the local per-part stamp otherwise; runningToolStamps() keeps a stable start per part across frames; TOOL_LONG_RUNNING_MILLIS (60s) and toolLongRunning() mark an unusually long call; sessionWorkLabel() names what a working session is doing while a text-streaming turn stays plain "Running" and a busy session never reads "Idle". - ChatStore: ChatThread gains toolStartedAt, stamped when a part turns running and dropped when it settles, plus runningTools/toolElapsedMillis; history() and the frame fold maintain it; setRunning/turn end clear it. - ChatTranscript: RunningIndicator lists one line per running call (name, detail where present, live elapsed) keyed by part id so concurrent calls render together without flicker; no percentage, ETA or progress bar. - ChatListPane: the session row renders sessionWorkLabel(busy, thread). - ChatRunningWorkTest covers name/detail/elapsed, clear on completion, error state, concurrent calls and the no-detail stream. Only fields the harness reports are used: tool name, state.status and input; the live brokered frame carries no timing envelope, so elapsed falls back to the local stamp. Existing chips, INPUT/OUTPUT, reasoning blocks, stop control, activity marks and scroll/follow behaviour are untouched. Checked and unchanged: no packaged template or packaged authoring-skill reference describes this app surface (the chat references in internal/author/skill/references/ document the server's brokered chat_* protocol, which this change does not touch), so none is stale. android/AGENTS.md already names ui/chat/ and its files. The shared documents this change does make stale are recorded, not edited, in docs/notes/chat-in-flight-tool-work.md: the Running-indicator and session-status statements in android/README.md. |
||
|
|
87856eaaf0 |
android: complete the status-palette port onto main's tree
The recovered commit gave every status one colour, but it predates main's split of the run view and main's own cyan 'waiting' colour. Resolution: keep main's Waiting, keep the run view's own file (main already has RunSummaryTab), and carry the parts that were genuinely missing - RunState.Blocked and RunState.Skipped with their words, glyphs and one colour each - so the palette and the enum agree. |
||
|
|
8411d47b29 |
android: colour every status from one palette
A successful stage read amber in the Timeline because a visit's chip was coloured from the graph's outcome palette (`graphColors`/`outcomeColor`) while every other surface used the run-status palette, so the same word meant two colours. This makes `RunStatusPalette` the single source of truth: - `RunState` gains the server's own `Waiting`/`Blocked`/`Skipped` words, each with a deliberate palette entry, a distinct material glyph and a label, so a status is never colour alone and success is green / failure red everywhere. - `graphColors()` takes success/error from `runStateColor(Succeeded/Failed)`; `outcomeColor()` returns the shared status colour for any word that resolves to a `RunState` and leaves `GraphPalette` only the graph-only flow outcomes (`rejected`/`exhausted`/`retry`/`approved`/`fast`/`missing`; `blocked`/ `skipped`/`done` removed). The Timeline's `TimelineRow` uses the same factory. - A visit's *outcome* stays distinct from the run's *status* by the chip's own label and the row's state glyph, never a second colour. - The runs-list failure diagnostic uses `runStateColor(Failed)` instead of a scheme role that could drift from the chip above it; the status filter gains `waiting`. Tests: new `StatusColorConsistencyTest` (timeline colour comes from the runs-list source; every state maps to exactly one colour) and extended `GraphPaletteTest`/ `RunStatusTest`. `gradle --offline --no-daemon :app:testDebugUnitTest --rerun-tasks` -> 516 tests, 0 failures, 0 errors, 0 skipped. Docs check: the root README and docs/ do not describe the Android status colours; the packaged templates and internal/author/skill/references cover the authoring surface and are unrelated, so nothing there needed updating. android/README.md did enumerate the run states and claimed the graph outcome palette was unchanged, so its features bullets were updated and a new "One status colour everywhere" section added, with the old bullet marked superseded. APK published to the run's artifacts as pipelines-debug-wip-d13f359.apk. (cherry picked from commit a3caa734cd4769f42883b518d877dd0132ef57ae) |
||
|
|
a3f571d672 |
docs: make docs-fold the single writer of shared documentation
Every item wrote the shared, append-only docs (android/README.md, docs/cli.md and the packaged skill references), so every merge conflicted on prose. Keep the duty to notice stale docs; move the writing to one deliberate place. - Per-item note, not a shared edit. An item that makes a shared document stale writes docs/notes/<slug>.md - unique per item, so two items never touch the same file - and commits that note with its change. It never edits a README, topic doc or packaged skill reference itself. - One writer. The manual-only docs-fold pipeline, bundled as the fifth starter examples/docs-fold.md, folds every note under docs/notes/ into the shared document it names and deletes the consumed notes in its own commit; an empty notes directory is a success no-op. Operator trigger: pipelines new "Docs fold" --template docs-fold --no-open; pipelines submit <draft.md>; pipelines run "Docs fold". - Implemented where the convention lives: orchestration.md (brief item 5, the hard-constraint bullet, a "Single documentation writer" section and the "Pipeline choice" committer bullet), the canonical committer checklist in format.md (new step 6), the committer prompts in examples/task.md and examples/three-stage.md, the new examples/docs-fold.md with its catalog and README entries, and the repository guideline AGENTS.md. Test-expectation counts (examples/catalog_test.go, internal/server/templates_test.go, scripts/smoke-first-install.py) follow the fifth starter. Reflected where it belongs: the packaged templates (examples/task.md, examples/three-stage.md, the new examples/docs-fold.md), the packaged skill references (orchestration.md, format.md) and the repo guideline AGENTS.md all carry the new convention. No new reference file was added, so install.go's managed inventory is unchanged. The shared descriptive docs were deliberately not rewritten: this change makes README.md:191, docs/cli.md:170 and internal/author/skill/references/operations.md:13 name four starters where there are now five. Those stay as they are - correcting them now is exactly the per-item shared edit this change removes - and the stale-doc note docs/notes/docs-fold-single-writer.md records each one for the docs-fold writer to fold. Nothing else needed updating. No new dependency; no Android, Gradle, server, installer, Docker or published-definition change; no definition published over the running pipelines. Evidence: go test -count=1 ./... passed; go build ./... and go vet on the touched packages clean; ./internal/author/... covers embedding, reference links, the managed inventory and install/upgrade/protection; ./examples/... validates the fifth starter and its manual-only, committer-terminated graph; ./internal/server/... covers the served catalog. Not run: the docs-fold writer against the shared docs (nothing to fold yet); no install or deploy. (cherry picked from commit f29656cf084d7eee2e033f2a37a9d231d7acaaf0) |
||
|
|
c132e2b59e | docs: record the consent rule and stop ordering shared-document edits | ||
|
|
a297fb6fb3 | Merge notif: post real system-tray notifications when a run needs the operator | ||
|
|
c7f009d850 |
Merge main into notif: combine the run notifications with main's chat reasoning grouping
Brings this branch up to main (
|
||
|
|
54fecbb454 |
android: post real system-tray notifications when a run needs the operator
The app already had an in-app attention surface but nothing in the system tray. This adds the app's own Android notifications for the two events that need a person: a run waiting for a decision (highest importance) and a run that failed. A successful, running or cancelled run raises nothing. - RunAlerts.kt: the pure model. Maps the attention list's kinds to run alerts, coalesces several into one grouped summary, dedupes one notification per run+kind via AlertLedger (never repeated while the run stays failed or waiting), clears on resolution/dismissal/arrival, and decides the one-time permission prompt and tap destination. Unit-tested. - RunNotifier.kt: the Android edge. Creates the single "Runs that need you" channel, posts/clears through NotificationManagerCompat, and reports notificationsAllowed() from POST_NOTIFICATIONS (API 33+) / the system notification switch. Posted from the app's own process. - Manifest: POST_NOTIFICATIONS runtime permission; PipelinesApplication creates the channel before anything can post. - SettingsRepository/AppViewModel: remembers that the permission was asked once (never nags), keeps notificationsAllowed fresh on resume, feeds the tray from the same attention flow, and clears a run's notification when the operator arrives at it. - PipelinesApp/DecisionPrompt/RunDetailScreen: the one-time rationale before the system dialog, asked at a sensible moment (first run that needs the operator, or first open of the attention surface), degrading to the existing in-app surface on refusal; a waiting run's tap opens its decision sheet (pipelines://run/<id>?action=decide), a failed run's tap opens the run; reaching a run clears its notification. - Attention.kt: drops the Finished kind so a successful run is never announced on any surface (the operator's rule), keeps the deep-link parser (now carrying an optional action) and still decodes an older state's looked-at-finished set. - AttentionTest.kt / RunAlertsTest.kt: the mapping (waiting and failed only), the permission paths (granted, refused, not-yet-asked), coalescing and clearing, dedupe, and the tap destination. Checks: `:app:assembleDebug` and `:app:testDebugUnitTest --rerun-tasks` pass (578 tests, 0 failures). Reflected-where-it-belongs check: this is an android/-only change and the packaged authoring skill references and the packaged templates describe the server's ntfy notification authoring, not the Android app's tray, so none of them needs updating. No README or other shared documentation file was touched. |
||
|
|
73284ff68c |
Merge think-group: group a turn's reasoning into one collapsible block
A chat turn that reasoned several times now shows a single collapsible thinking block (with its step count and elapsed time) instead of one box per reasoning part, and a streaming turn grows that block rather than adding another. |
||
|
|
ec6a350a17 |
Group a chat turn's reasoning into one collapsible block
The chat rendered every reasoning part as its own ReasoningBlock, so a turn that reasoned several times stacked several thinking boxes between messages. This folds a turn's reasoning parts into a single collapsible entry, anchored where the turn's first reasoning part sits, so a streaming turn grows the block it has instead of gaining another. - ChatFormat.kt: add ReasoningTurn / turnReasoning (the ordered fold of a turn's reasoning parts), reasoningLabel (counted wording for >1 steps, plain one-block wording otherwise) and turnElapsedMillis (elapsed from the turn's own part timing envelopes, null when unknown). ReasoningExpansion is now keyed by the turn's message id via reasoningTurnKey rather than a per-part key. - ChatTranscript.kt: AssistantParts renders exactly one ReasoningBlock per turn (first reasoning part wins the anchor); the collapsed line reads "Thinking · N steps"/"Reasoning · N steps" when the turn reasoned more than once, else "Thinking…"/"Reasoning", with elapsed time appended when known. Streaming elapsed is driven by thread.runningSince so it matches the running indicator. The answer, tool chips, diff cards, attachments and approval cards are untouched. - Tests: ChatTranscriptTest exercises the turn-keyed expansion; new ChatReasoningTurnTest covers the fold (several parts -> one entry in order), the collapsed wording, elapsed derivation and a streaming turn appending into the same entry. Checked for stale packaged artefacts: none needs updating. The packaged authoring skill references (internal/author/skill/references/) document the protocol (reasoning deltas, cost/token budgets), not the Android transcript rendering, so nothing there describes per-part thinking blocks. No packaged template mentions reasoning rendering. Shared docs / the Android area map are left to the single documentation writer; nothing here changes documented behaviour beyond the transcript fold. Verified with the Android toolchain (no daemon): :app:testDebugUnitTest passes 567 tests, 0 failures, 0 errors, including ChatReasoningTurnTest (5), ChatTranscriptTest (7) and DimensTest (2). No new raw geometry literals. |
||
|
|
79ebba62c7 |
Sweep every screen of the Android app with a UI/UX review and fix what it found
Fixes the sweep findings (attention-chip reserve, formatted timestamps, HTML entities, Raw/Rendered labelling, filter bottom sheet, stage-count wording, labelled key rows, stage-pane de-duplication, wide-window list width, Settings disconnect emphasis, CodeBlock height). Server-side and product decisions are deferred with reasons in the branch commits. |
||
|
|
a2a64931eb |
Merge main into sweep-ui: combine the UI sweep fixes with main's per-area agent maps
Main adds only documentation (per-area agent maps for the Android app, the TUI and the server); the sweep-ui side holds the UI/UX sweep fixes. No overlapping files, so both intents are kept unchanged. |
||
|
|
2e9ba100bd |
Fix UI/UX sweep findings across the Android app
Addresses the survey/review findings on the sweep-ui branch, reusing the
app's existing patterns and named tokens (DetailTabBody, formatLocalTimestamp,
stageCountText, ATTENTION_CHIP_RESERVE) rather than hardcoding values.
Fixed findings:
- n:1 attention-chip reserve (OmniSearchResults, ATTENTION_CHIP_RESERVE in
Dimens, PipelinesApp bottom content reserve).
- n:2 formatted local timestamps via the shared Format.formatLocalTimestamp
(PipelinesApp lists, RunHistory, RunSummaryTab, PipelineDetail).
- n:3 decodeHtmlEntities for the session export's HTML entities (Markdown),
with regression cases for entities and a bold-only line.
- n:4 Raw/Rendered control now labels the current view and its state
(SourceView).
- n:5 filters as a Material modal bottom sheet capped at a window-derived
filterMenuMaxHeight with a scrolling body (FilterMenu), plus tests.
- n:7 stage-count wording via the shared stageCountText helper.
- n:8 labelled key row on the template detail screen.
- n:9 stage pane de-duplicates identity / folds the definition.
- n:10 wide-flag plumbing into the destination lists and ChatListPane, which
now wraps its session list in DetailTabBody(wide, ...) so wide rows keep
DETAIL_MAX_WIDTH_DP centred.
- n:13 Settings: Disconnect is the filled primary while connected and the
trust warning moved into a surfaceVariant card.
- n:15 CodeBlock bounded height plus a scroll affordance with an unbounded
option.
Deferred findings (with reason):
- n:3 (Chat transcript) residual is server-side data: chat_messages returns a
single assistant part whose text is already interleaved/doubled, so the
renderer cannot close it. The android half (entities/Markdown) is fixed.
- n:6 Runs list titles arrive truncated to 80 chars mid-word from the server.
- n:11 Two-pane top-band layering is a product/design decision.
- n:12 48dp graph-node hit targets and label dodging are product decisions.
- n:14 The session-list chip is OpenChatStrip (open chats), not a list filter;
relabelling it would misdescribe it.
Commands: :app:compileDebugKotlin + :app:testDebugUnitTest (562 tests, 0
failures) and :app:assembleDebug all succeed.
|
||
|
|
a4cf7366dd | docs: per-area agent maps for the Android app, the TUI and the server | ||
|
|
bdbc964793 | Merge lane-retry: split chat/model/run files by concern (pure move) | ||
|
|
c1652e2bc6 |
Split chat/model/run files by concern (pure move)
Pure move: split the three multi-feature server files into per-concern files, with no behaviour change - same package, same exported and unexported identifiers, same call graph, same tests. - internal/server/chat.go -> chat.go (broker seam, client token, dispatcher), chat_hub.go, chat_claims.go, chat_permissions.go, chat_sessions.go, chat_stream.go, chat_commands.go - internal/stage/model.go -> model.go, model_run.go, model_failure.go, model_validation.go - internal/pipeline/runs.go -> runs.go (read side), runs_schema.go, runs_create.go, runs_mutate.go, runs_sessions.go Checked before committing: - Packaged templates and internal/author/skill/references: neither refers to internal/server/chat.go, internal/stage/model.go or internal/pipeline/runs.go, so nothing there needed updating (the change is a move with no behaviour change). - gofmt -l on the three packages: clean. go build ./..., go vet ./... and go test ./... pass. go.mod/go.sum unchanged. - No test, docs, android/, install or Docker files touched. Known stale path pointers deliberately left to the single docs writer (shared docs) and out of scope (android/): docs/chat-verification.md and android/README.md name the old file paths. |
||
|
|
4dda63cd7c |
Merge lane-retry: re-verify the chat record at ec27a2d
Combine the chat end-to-end verification record update (revision, APK artifact, test totals and the 3ffc126..ec27a2d chat-surface delta) into main. Docs-only; no behaviour change. |
||
|
|
4426f8cacd |
docs: re-verify the chat record at main's build (ec27a2d)
Update docs/chat-verification.md from the earlier `3ffc126` record to the current revision `ec27a2d`, which is both this lane's HEAD and main: - revision, APK name/size/sha256 and LAN URL refreshed to the rebuilt artifact `pipelines-debug-wip-ec27a2d.apk` (18,585,084 bytes, sha256 5ee4b38c…da84); - unit-test totals refreshed to 61 suites / 558 tests / 0 failures, and the server-side `go build ./...` plus the chat/session/adopt Go tests recorded; - a "Changes since the previous record" section describing the chat-relevant delta `3ffc126..ec27a2d` (the `chat_adopt` request, the lazy `MarkdownBlocks` renderer, the run-watch scope change) and correcting the chat protocol file path to `data/protocol/Chat.kt`. The change is documentation only: no app or server behaviour changes. Checked where the change belongs: packaged templates (no template encodes this record) and the packaged authoring skill references (internal/author/skill/references/) — none is made stale by a verification-record update, so none is touched. `go build ./...` passes. The debug APK lives in the run's artifacts directory outside the repo and is therefore not committed. Refs: brief "Verify the chat end to end, on the phone, against the real server". |
||
|
|
ec27a2dc48 | Merge lane-retry: record and expose per-run model usage (tokens in/out, cost, model) | ||
|
|
7a28aca1f1 |
Merge main into lane-retry: per-run usage recording alongside live run events
main brought pushed run events (emitRun/RunEventFrame across protocol, server and the Android client) and this branch brought per-run usage recording. Both touch internal/server/runner.go; git auto-merged cleanly and the result keeps both intents — each model step is stamped with its effective provider/model and budget-derived usage (stageUsage, overlayEffectiveModels) while run events are emitted (emitRun) and applied to the same step loop. No conflict markers, no side's work discarded. Post-merge checks: gofmt -l clean, go build ./..., go vet ./... and go test ./... all pass. |
||
|
|
3f5c11b7bf |
Record and expose per-run model usage (tokens, split, cost)
Carry the usage a model stage already measures for its budget (stage.Budget.Snapshot()) onto the step as typed evidence and total it in one pass, rather than a second harness read, a transcript parse or an output-length estimate. A shared budget across stage revisits records only the visit's increment, and a revisit that observes no new report records no usage instead of a fabricated known zero. - protocol: StageUsage/RunUsage/TotalUsage and UsageTotals. - pipeline: step_usage table + migration, COALESCEd into the one step projection, FinishStep persistence, one json_extract history aggregate, retention removes the rows with their run. - server: stageUsage maps the budget snapshot, stamping per-stage model and usage for every model stage (including failures). - cli: inspect/stats human and JSON output. - budget/pi: retain the reported in/out split, mark a total-only (Pi) report split-unknown, and keep an unreported cost unknown (never zero). Evidence and docs updated in the packaged skill references and docs/cli.md; the live database has no step_usage rows yet (all history predates this), so per-run figures are reported as unavailable, not zero. |
||
|
|
87571ac7b8 |
Merge lane-live: make every view live from the pushed run events
The Android client subscribes to run events for every workspace its runs list displays (the blank "any workspace" scope the server already honours) instead of only the configured workspace, so a run executing in a lane worktree - a different workspace - now delivers frames. A pushed frame carries the run's pipeline identity (pipeline_id, name, title, version), so the runs-list fold inserts a never-seen run and the pipelines list, run detail, timeline and stage cards all follow a run finishing and a new one starting without a refresh, with no per-event fetch. Server-side workspace isolation and coalescing are unchanged. |
||
|
|
8a62b31398 |
Merge main into lane-live: adopt operator chat brokering alongside live run events
Combines this lane's "make every view live from the pushed run events" change (android + server run-event scope and frame identity) with main's operator chat brokering work (opencode endpoint adoption, protocol/settings/CLI chat support, operations reference). The two touch different files; git's ort strategy merged them cleanly with no conflict markers and nothing to resolve. Post-merge checks: go build/vet and go test ./... all pass; gradle --no-daemon testDebugUnitTest assembleDebug passes (558 tests, 0 failures). |
||
|
|
5e2aece1be |
android+server: make every view live from the pushed run events
The pipelines list (and every other run-state view) kept the row it had when the screen was last fetched. Two class-level root causes, fixed here: - The app subscribed to run events scoped to the one workspace the operator configured, so a run executing in another workspace (a lane worktree is its own workspace) never delivered a frame: the rows only changed on a manual refresh. The app now asks for the blank "any workspace" scope the server already treats as any (ALL_WORKSPACES in AppViewModel.subscribeRuns, blank default on PipelinesRepository.subscribeRuns). Workspace isolation on the server is unchanged: an explicit workspace scope still matches only that workspace (TestRunEventWorkspaceIsolation); the new TestRunEventAllWorkspacesSubscription pins the blank "any" scope. - foldRunEvent refused to insert a run the list had never held, returning needsResync and leaving the list untouched, so a run started after the screen loaded appeared only after a fetch. The pushed frame now carries the pipeline identity a row needs (RunEventFrame.PipelineID/Name/Title/Version), so the fold inserts the new run at the head from the frame's own identity without a fetch and without reordering existing rows; a server that predates those fields still falls back to the one resync. Added fields and why each is needed: pipeline_id (row's pipeline join), name (row title), title (the stored operator-facing title a row shows), version (the row's pinned version) - everything a RunSummary row renders, so no per-event fetch and no guess from stale cache. The server stamps them on every emitted frame from a per-run identity remembered at create/decide/cancel/resume (runner.go runIdentity/rememberRunIdentity/stampRunIdentity), first-write-wins through the coalescer (mergeRunEventFrame) and on the subscribe snapshot, so every transition - created/queued, running, each stage start/finish, terminal - carries them. Reconnect still resyncs once then follows pushes; the pull-to-refresh path is untouched. Checks run: go build ./..., go vet ./..., go test ./... (all packages ok), go test -race -run 'RunEvent|RunEvents|Subscribe' ./internal/protocol/ ./internal/server/, and gradle --no-daemon testDebugUnitTest assembleDebug (558 tests, 0 failures, 0 skipped; BUILD SUCCESSFUL). Packaged templates and the packaged authoring skill references were checked: nothing there describes the run_event field list or the client's subscription scope, so neither needs updating (references/notifications.md only says the attention surface is derived from the pushed run events, which is unchanged). Docs are a shared file owned by a single writer and were not edited: docs/cli.md's description of the pushed `run_event` frame still enumerates only the older fields (status, outcome, current stage, completed-step count, timestamps, optional step) and is now incomplete - it should mention the pipeline identity fields; docs/ntfy.md remains accurate. |
||
|
|
1ae56b7d14 |
Merge lane-retry: broker chat from an operator's OpenCode endpoint and adopt existing sessions
Broker chat from an operator-supplied OpenCode endpoint (opt-in flag/env, validated once, no fallback) with the endpoint choice recorded across restarts, and add chat_adopt with the pipelines chat-adopt CLI command to continue a session that already exists on that endpoint. |
||
|
|
1f75e4797e |
Broker chat from an operator's own OpenCode endpoint and adopt existing sessions
Add an opt-in way to broker chat from an operator-supplied OpenCode service instead of the instance the server spawns for itself, and a way to adopt a session that already exists on that endpoint so it appears in chat_sessions and can be continued from the app. - Endpoint selection: the `-opencode-endpoint` server flag (defaulting to `PIPELINES_OPENCODE_ENDPOINT`) opts in; precedence is explicit flag > explicit environment > the endpoint recorded on a previous run, with the spawned instance as the default. opencode.OpenEndpoint validates the reference once (http(s), host, no userinfo/query/fragment/path), detects the backend from its own /api/info (v2) or /global/health (v1) contract, and requires a streamable text/event-stream event path. It owns no process (Close is a no-op) and never calls startServe; every failure names the endpoint and disables chat rather than silently falling back. An authenticated endpoint takes an optional password only through the private file PIPELINES_OPENCODE_ENDPOINT_PASSWORD_FILE, with PIPELINES_OPENCODE_ENDPOINT_USERNAME overriding the detected default. - Persistence: the validated choice is recorded in an additive single-row server_settings table so a restart with no flag/environment reuses it; an unreachable recorded endpoint disables chat with a clear message and no fallback. - chat_adopt: a new protocol request (ChatAdoptRequest) with handleChatAdopt in internal/server/chat.go. It refuses a nil broker/registry/payload and a blank or foreign-shaped id before any endpoint call, reads the endpoint via the shared Chat.Session (which reuses Sessions/decodeChatSessions), records through the existing RecordOperatorSession with the endpoint's directory and title verbatim, and echoes the adopted session plus its registry row like chat_create. A missing id is refused naming the id and records nothing; an endpoint record with an empty directory is refused rather than substituting the server's working directory or home. - CLI: `pipelines chat-adopt <session-id> [--json]` (usage, notes, help inventory, dispatch) with docs/cli.md updated under Chat sessions. - Autostart preserves the endpoint variables (and the password-file reference, never an inline secret) via serviceEnvironmentKeys. Checks before committing: - Package location: the change is user-facing chat behaviour, so the packaged authoring skill reference internal/author/skill/references/operations.md is updated in the same change (Brokered OpenCode chat section) with a dated verification-evidence entry and the not-deployed state. No new reference file is added, so internal/author/install.go's managed inventory is unchanged. - Packaged templates: this repository packages no template set for this behaviour and none references the chat endpoint, so no template needs updating. - Verification: `go build ./...`, `go vet` on the touched packages, `gofmt -l` clean and `go test ./...` all pass. The unit tests cover the endpoint validation/precedence, the adopt happy path and refusals, the recorded endpoint round-trip, the protocol round-trip and the CLI dispatch. The live scratch-server check against the operator's real endpoint was not run in this change. Nothing unrelated is staged; docs left stale (README and other shared documents) are not edited here and are for a single folding writer. |
||
|
|
50af9dbc62 |
Merge lane-retry: read a stage's exported session from the run view
Lands the Android reader for the per-stage session export: a Session section in
the stage detail that appears only when the visit's session_export actually wrote
a file, renders the markdown export with the app's existing markdown renderer
(lazy, off the main thread), offers the html export in a WebView via a toggle, and
reports a failed fetch as its own in-pane error without hiding other sections.
The server-side export already landed in
|
||
|
|
752e761837 |
android: read a stage's exported session from the run view
Add a Session section to the stage detail that appears only when the visit's session export actually wrote a file, beside the artifacts it was written with, and opens the transcript on a click like any artifact. - Derive the section from the recorded `session_export` matched against the step's artifact listing (`sessionExportFiles`), so a visit with no export - a non-OpenCode harness, an export failure, or a pre-export server - lists no empty section, mirroring internal/protocol/runs.go and the server's export. - Default to the markdown export rendered with the app's existing markdown renderer (new lazy `MarkdownBlocks` reusing `MarkdownBlock`), and when both files exist offer the html export through an "HTML view" toggle in a WebView for fidelity; html is the default only when markdown is absent. - Behave like the artifacts around it: the same Scaffold/TopAppBar/back chrome, the shared ArtifactBytesCache so the file is fetched once and never loaded twice, decode/parse off the main thread so a several-hundred-kilobyte session stays responsive in a lazy block list, and a failed fetch shown as its own in-pane error without hiding the other sections. - `SessionExport` protocol model and `RunStep.session_export`, with the unit tests for section presence, fetch/render, fetch failure isolation and a large session. Checked the packaged templates and the packaged authoring skill references: the session export's server-side behaviour is already documented in references/delivery.md and references/operations.md (landed with the server change), and no packaged reference or template describes the Android stage pane's sections, so none of them needs updating for this client-only change. Verified before commit (recorded by the independent code review on this tree): compileDebugKotlin, testDebugUnitTest (forced rerun) and assembleDebug all BUILD SUCCESSFUL, 554 tests / 0 failures across 61 classes, SessionExportTest 9/0/0. |
||
|
|
016c39c3e8 |
Merge lane-retry: export each stage's session as session.md and session.html
Lands the session-export feature: a finished OpenCode-harness stage writes its real session into its own step artifacts directory as session.md and session.html, served by the existing artifact listing and URL path, with bounded source and rendered output, a visible truncation banner, recorded session_export evidence and failure isolation that never fails the stage. |
||
|
|
58c6b9b7c6 |
server: export a finished stage's real session as session.md and session.html
Every OpenCode-harness model stage now writes its real session into its own step artifacts directory as session.md and session.html, so the existing bounded artifact listing, the /artifacts/<run>/<step>/<name> serving path and the artifact scan find and serve them with no special casing, while the stage keeps its bounded preview in the run record unchanged. - internal/opencode/export.go adds the one shared native export invocation and the exact session-ID/messages validation used by both Connection.Messages and the new ExportSession, so the readback path does not diverge. The backend's published subcommand is used (v1 `export <id>`, v2 `session export <id>`), the source read is capped at 8 MiB, and a larger session is read as a prefix and reported truncated instead of failing. boundedOutput.ReadFrom keeps the cap effective so overflow and the truncation path are real. - internal/stage/session_export.go renders markdown and html with a metadata header, every role and every part (unknown part types as raw JSON, every session text escaped in html), atomic temp+rename writes that never overwrite an existing file, a visible truncation banner at both ends when the source or the 2 MiB rendered cap cuts it, and an honest 0-message header for an empty session rather than fabricated text. - protocol.SessionExport and RunStep.SessionExport are stored in a new step_session_exports table (CREATE TABLE IF NOT EXISTS, so an old database gains an empty table with no migration) loaded through the existing main SELECT alongside the other per-step evidence and deleted by run retention. - internal/server/runner.go exports after the post-stage filediff capture and before scanArtifacts, with context.WithTimeout(context.WithoutCancel(ctx), 10s); it never waits for session idleness and a failure or a Pi stage (no native export path) records a sanitized diagnostic and continues, never changing the stage status, outcome, target, timing or result validation. Reflected where it belongs: the packaged skill references (internal/author/skill/references/operations.md and delivery.md) carry the new Session export rules and the run-artifacts bullet, and docs/stage-artifacts.md documents the names, the <run>/<step> paths, the served URL, the caps, the truncation labels, failure isolation and the Pi limitation. The packaged templates (examples/*.md) only tell a stage to save its own artifacts and say nothing about the server-written session export, so none needed updating; no new reference file was added, so install.go's managed inventory is unchanged. Shared documentation: README.md's per-step artifacts sentence is now stale - it should name the exported session alongside images, screenshots, reports and logs. It is deliberately not committed here; the shared documents are folded by the single documentation writer. Checks: gofmt -l on the touched packages produced no output; go vet ./... passed; go test -race -count=1 ./... passed. |