Draw a background task as what it ran, and go there on a tap
A card in the session's panel said "background command" under every description -- and for Codex, which names a terminal by a process id and gives no description at all, that phrase was the whole of every card. Both halves of the answer are in the transcript rather than in what the provider says: a driver now reports which tool call its task belongs to (Claude's `task_started` carries the `tool_use_id`, Codex's terminal list the `itemId`), and `LiveSession::background_tasks` resolves those ids against the transcript into a sequence number and, where the provider said nothing, the command the call was made with. So the card draws the command, and the kind shrinks to a mark beside it whose name is what a screen reader is given. Tapping one goes to that call in the transcript, opened, which is where a backgrounded command's output already lands -- rather than drawing a second copy of it beside the panel. The journey is the one a reopened session already makes to put a reader back where they stopped, now one function (`travelTo`). It has to release the held backlog first: events arriving while the reader is away from the newest end are held rather than applied, so a task started since they scrolled back was in no row at all and the tap looked like it had done nothing. Verified against the sandbox on the emulator: the panel draws `sleep 120 && echo done` for an echo session's `/background`, and tapping it lands on that Bash card with its output showing.
This commit is contained in:
1 parent
3b309766d7
commit
cedb18e8c1
18 files changed
+635
-151
No files matched your search
@@ -242,6 +242,11 @@ fun AppRoot(
|
||||
remember(here.summary.id) {
|
||||
mutableIntStateOf(here.summary.backgroundTasks)
|
||||
}
|
||||
// Where the panel has asked the session screen to put the reader: the
|
||||
// call a background task was started by. Held here rather than inside
|
||||
// either, because the two are siblings -- the panel is the one being
|
||||
// tapped and the transcript is the one that can travel.
|
||||
var goTo by remember(here.summary.id) { mutableStateOf<CallSite?>(null) }
|
||||
// The two panels this session can be pulled aside for: its subagents
|
||||
// from the right, and the whole main screen from the left. Both are here
|
||||
// rather than screens of their own for the same reason the explorer is --
|
||||
@@ -279,6 +284,13 @@ fun AppRoot(
|
||||
backgroundTasks = backgroundTasks,
|
||||
onClose = close,
|
||||
onOpenSubagent = { screen = here.copy(subagent = it) },
|
||||
// Closed with it: what the reader asked to see is under this
|
||||
// panel, and a panel left open over the answer is the one
|
||||
// thing the tap cannot have meant.
|
||||
onOpenCall = {
|
||||
goTo = it
|
||||
close()
|
||||
},
|
||||
)
|
||||
},
|
||||
) {
|
||||
@@ -293,6 +305,8 @@ fun AppRoot(
|
||||
share = share,
|
||||
onShareTaken = { share = null },
|
||||
onBackgroundTasks = { backgroundTasks = it },
|
||||
goTo = goTo,
|
||||
onGoToTaken = { goTo = null },
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user