simulate: open a cited turn from the summary with its number - #940
Merged
Conversation
A summary citation could only be followed out of the terminal, by ctrl+clicking its OSC 8 link into the dashboard. The turn it cites is already in the run, so the TUI can open it directly. Each citation now carries a number, and pressing that digit on the list view opens the cited job. Numbering follows render order through one index shared by every block of the summary, so the digit a reader presses selects the citation whose label shows it. Only the first nine are numbered: a number is an invitation to press that digit, and there is no tenth digit. A jump lands at the top of the printed job, which scrollback cannot be scrolled past, so the cited turn is marked where it prints. The mark rides the message text rather than the speaker header, which a message continuing an open agent block never prints. Numbering keys off a citation naming a job, not off a dashboard URL resolving: the jump is local, so it works where the link does not.
… there Marking only ran over chat messages, so a citation naming a tool call went to a transcript with nothing marked in it. A function call carries an id like the messages do, so it marks the same way; the mark rides outside writeToolItem's dimming, which the payload it annotates is under. A summary also cites items that are not in the history it summarized. The jump still lands on the job it named, so the transcript now says the cited turn is not in it rather than leaving a reader scanning for a mark that was never coming.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #939 — base it there, and the diff is this one commit.
A summary citation could only be followed out of the terminal, by ctrl+clicking
its OSC 8 link into the dashboard. The turn it cites is already in the run, so
the TUI can open it directly.
Each citation now renders as
"quoted text" [3], and pressing that digit on thelist view opens the cited job. The hint line gains
1-9 cited turnwhen asummary has citations. The OSC 8 link stays, so ctrl+click still reaches the
dashboard — both work.
Notes on the design
Numbering is derived during render, not in a second pass. One index is
threaded through every block of the summary, and
renderSummarystores itstargets at the end. Collecting the citations separately would be a second source
of truth that could drift from the labels; this way the digit a reader presses
and the label showing it cannot disagree.
A citation is numbered when it names a job, not when a dashboard URL
resolves. The jump is local, so it works where the link does not — previously
an empty
simulationItemDashboardURLdegraded a citation to bare text, whichwould have disabled the keyboard jump along with the link. One existing test's
contract changed to document the split: no job → plain text; job but no URL →
numbered, no hyperlink.
Only the first nine are numbered. A number is an invitation to press that
digit, and there is no tenth. Citations past nine stay hyperlinked for
ctrl+click.
The cited turn is marked where it prints. A jump lands at the top of the
printed job, and scrollback cannot be scrolled to the citation, so the turn says
◀ cited. The mark rides the message text rather than the speaker header: amessage continuing an open agent block never prints a header, which is exactly
the turn a tool-heavy run tends to cite.
Why keyboard and not ctrl+click
Intercepting the OSC 8 link itself is not possible — the spec defines no channel
for reporting activation to the application, and kitty's
open_actionsonlylaunches a separate external program. Capturing a raw
ctrl+clickis possible,but it needs mouse reporting enabled, which takes the mouse away from the
terminal and puts native drag-to-select behind shift.
runSimulateTUIopts outof mouse capture deliberately ("No mouse capture, so the terminal keeps native
drag-to-select"), and #928 moved the job view into scrollback precisely to give
the terminal back selection and search. The digits cost none of that, and work
over a mouse-less ssh/tmux path.
Testing
go test ./cmd/lk/passes, covering the numbering, the no-job and no-URLdegradations, and the nine-citation cap.
go vetandgofmtare clean.