Hold an image's place, open it full screen, and fold a run of calls
Five changes to how a transcript reads. **Images no longer move the page.** The row was as tall as whatever had loaded, so it grew when the bytes arrived and pushed everything below it -- and in a bottom-anchored list, an image loading above the viewport moved the text under the reader's eyes. The height is now decided before the fetch and never changes: four lines of the body style, measured from the type so it stays four lines when the reader has scaled their fonts. Nothing to see when loading finishes, which is the point. **A small image is enlarged with nearest neighbour**, a large one shrunk smoothly -- decided per image from its actual size rather than set once, since blowing a 16px sprite up with interpolation turns it into a blur of exactly the thing being looked at. **Tapping one opens it full screen**, fitted so the whole image is visible first, with two-finger zoom to 8x and pan once zoomed. A dialog rather than a screen, so back returns to the transcript. **A tool call is one line closed**: the tool's name and what the call is for. The command is not on it, because a wrapped command turns one row into four. Open, it shows the command, the rest of the input and the output, with the timeout at the top right -- a limit on the call rather than part of what it does, worth seeing beside the command it constrains. A call waiting on permission is shown open regardless, since the command is the thing being decided. **Adjacent calls fold into "Called n tools"**, closed by default, and it closes again from either end -- a long group's heading scrolls away while its last call is still on screen, and the reader who wants it shut is looking at the bottom. The calls keep their full width; what says they belong together is the surface behind them, one cue rather than two half-cues. Grouping happens at display time, not in the fold: the transcript's own order is what paging and the stream depend on. Echo gains `/tools [n]` so a run of calls can be produced without paying for one. Verified on the emulator: four calls folded and expanded, one opened inside the group showing `timeout 5000` top right, a 16px checkerboard enlarged with hard pixel edges beside a shrunk screenshot at the same height, the screen byte-identical between one second and six after opening, full screen fitted, and back returning to the same scroll position. Pinch itself is the one thing not verified here -- `adb input` cannot inject a two-finger gesture. 53 tests, clippy, rustfmt, Android lint and ktfmt clean. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
8fe13634cb
commit
011ed0d0e1
5 files changed
+559
-141
No files matched your search
@@ -7,6 +7,8 @@
|
||||
//! A leading word asks for something more specific:
|
||||
//!
|
||||
//! - `/tool [input]` -- a full tool run, start through end.
|
||||
//! - `/tools [n]` -- n calls back to back, for what a run of them looks
|
||||
//! like when a screen groups them.
|
||||
//! - `/question [text]` -- a question, exercising the answer path.
|
||||
//! - `/slow [seconds]` -- a turn that stays running (default 30), so states that only
|
||||
//! exist *while* something is happening can be looked at.
|
||||
@@ -108,9 +110,20 @@ impl Driver for EchoDriver {
|
||||
return;
|
||||
}
|
||||
|
||||
let run_tool = text
|
||||
.strip_prefix("/tool")
|
||||
.map(|rest| rest.trim().to_string());
|
||||
// Checked before `/tool`, which is a prefix of it: matching the
|
||||
// shorter one first would read "/tools 4" as a single tool whose
|
||||
// input is "s 4".
|
||||
let many_tools = text.strip_prefix("/tools").map(|rest| {
|
||||
// At least two, because one call is not a run of them and this
|
||||
// exists to produce a run.
|
||||
rest.trim().parse::<usize>().unwrap_or(3).clamp(2, 12)
|
||||
});
|
||||
let run_tool = if many_tools.is_some() {
|
||||
None
|
||||
} else {
|
||||
text.strip_prefix("/tool")
|
||||
.map(|rest| rest.trim().to_string())
|
||||
};
|
||||
// Seconds to stay running before answering, default 30. Clamped
|
||||
// rather than trusted: this is a test affordance, and a session
|
||||
// pinned running for an hour by a typo is a worse outcome than a
|
||||
@@ -187,6 +200,29 @@ impl Driver for EchoDriver {
|
||||
return;
|
||||
}
|
||||
|
||||
if let Some(count) = many_tools {
|
||||
for i in 1..=count {
|
||||
let id = format!("t-{}", super::random_hex());
|
||||
send(Event::ToolStart {
|
||||
id: id.clone(),
|
||||
tool: if i % 2 == 0 { "Read" } else { "Bash" }.to_string(),
|
||||
input: serde_json::json!({
|
||||
"command": format!("grep -rn 'call {i}' /tmp | head -3"),
|
||||
"file_path": format!("/tmp/call-{i}.txt"),
|
||||
"description": format!("The {i} of {count} calls in this run"),
|
||||
"timeout": 5000,
|
||||
}),
|
||||
});
|
||||
tokio::time::sleep(DELTA_DELAY).await;
|
||||
send(Event::ToolEnd {
|
||||
id,
|
||||
output: format!("call {i} finished"),
|
||||
});
|
||||
}
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
|
||||
if let Some(input) = run_tool {
|
||||
let id = format!("t-{}", super::random_hex());
|
||||
send(Event::ToolStart {
|
||||
|
||||
Reference in new issue
Block a user