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
@@ -791,21 +791,28 @@ pub type EventSink = mpsc::UnboundedSender<Event>;
|
||||
/// leave going.
|
||||
///
|
||||
/// Runtime state, never written to a transcript: it is what the provider
|
||||
/// says right now, so a session with no process has nothing to say. Served
|
||||
/// by `GET /sessions/{id}/background`; the `BackgroundTasks` event carries
|
||||
/// only the size, which is what the status row draws.
|
||||
/// says right now, so a session with no process has nothing to say. What
|
||||
/// `GET /sessions/{id}/background` answers is this resolved against the
|
||||
/// transcript -- see [`BackgroundTaskView`](crate::session::BackgroundTaskView);
|
||||
/// the `BackgroundTasks` event carries only the size, which is what the
|
||||
/// status row draws.
|
||||
///
|
||||
/// [`description`](Self::description) is `None` where the provider names a
|
||||
/// task by something no reader would recognise -- a process id -- rather
|
||||
/// than by a sentence worked out here; the phone says it does not know.
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
|
||||
/// than by a sentence worked out here. Where [`call`](Self::call) is known
|
||||
/// the transcript answers it instead, from the call's own arguments; see
|
||||
/// [`LiveSession::background_tasks`](crate::session::LiveSession::background_tasks).
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub struct BackgroundTask {
|
||||
/// The provider's own id for it. Never shown; it is what makes two
|
||||
/// snapshots comparable, and what keys the list on the phone.
|
||||
pub id: String,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub description: Option<String>,
|
||||
pub kind: BackgroundTaskKind,
|
||||
/// The id of the tool call that started it, where the provider says
|
||||
/// which. `None` is a provider that does not, or one whose account of
|
||||
/// the start was never seen -- an adopted process mid-task.
|
||||
pub call: Option<String>,
|
||||
}
|
||||
|
||||
/// What kind of thing a [`BackgroundTask`] is, in the terms the app draws.
|
||||
|
||||
Reference in new issue
Block a user