Skip to content

simulate: open a cited turn from the summary with its number - #940

Merged
u9g merged 2 commits into
jason/simulate-refs-dev-modefrom
jason/simulate-ref-jump
Aug 14, 2026
Merged

simulate: open a cited turn from the summary with its number#940
u9g merged 2 commits into
jason/simulate-refs-dev-modefrom
jason/simulate-ref-jump

Conversation

@u9g

@u9g u9g commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

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 the
list view opens the cited job. The hint line gains 1-9 cited turn when a
summary 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 renderSummary stores its
targets 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 simulationItemDashboardURL degraded a citation to bare text, which
would 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: a
message 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_actions only
launches a separate external program. Capturing a raw ctrl+click is possible,
but it needs mouse reporting enabled, which takes the mouse away from the
terminal and puts native drag-to-select behind shift. runSimulateTUI opts out
of 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-URL
degradations, and the nine-citation cap. go vet and gofmt are clean.

u9g added 2 commits August 14, 2026 09:48
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.
@u9g
u9g merged commit 17b310f into jason/simulate-refs-dev-mode Aug 14, 2026
9 checks passed
@u9g
u9g deleted the jason/simulate-ref-jump branch August 14, 2026 15:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant