Skip to content

Fix clickable markdown links in agent dialogue TUI - #119

Merged
ernestrc merged 2 commits into
unstablebuild:mainfrom
Spandan-Mishra:fix/agent-dialogue-clickable-links
Oct 8, 2026
Merged

ernestrc merged 2 commits into
unstablebuild:mainfrom
Spandan-Mishra:fix/agent-dialogue-clickable-links

Conversation

@Spandan-Mishra

Copy link
Copy Markdown
Contributor

Summary

Closes #7.

Fixes an issue in the rune-agent dialogue TUI where left-clicking markdown links in sent messages, received messages, or prompt bodies fell through to normal text selection rather than activating the link.

Changes

  • cmd/rune-agent/dialogue/dialoguetui:
    • Added OnLinkClick func(*url.URL) bool to ComponentConfig.
    • Implemented (*Component).LinkAt(pos term.Coordinates) *markdown.LinkInfo to traverse visible messages in c.messages, unwrap spans/handlers, and hit-test underlying markdown components.
    • Updated mouseDelegate.OnAction to query d.comp.LinkAt(pos) on mouse.LeftClick, parse the URL, and invoke OnLinkClick, returning true to suppress selection.
  • internal/handler/markdown:
    • Exported Component() *markdown.Component on *Handler to permit component unwrapping during layout hit-testing.
  • cmd/rune-agent/extension:
    • Wired ret.cfg.OnLinkClick via newLinkClickHandler: copies http and https URLs to clipboard.Register and dispatches a success notification via browserapi.Notifications.
  • Tests:
    • Added regression test TestMouseDelegate_LinkClick covering sent messages, received messages, prompt bodies, non-link text fallthrough, unhandled bare anchors, and nil callbacks.
    • Added TestExtensionDialogue_LinkClick_CopiesToClipboard testing URL copying, notifications, and non-http filtering.

Results

screenrecording-2026-09-20_15-47-56.mp4

Spandan-Mishra and others added 2 commits October 8, 2026 01:07
Markdown links inside dialogue messages were not clickable because
mouseDelegate.OnAction ignored LeftClick events and dialogue.Component
lacked hit-testing to locate links in the messages list. This caused all
clicks on links to fall through to standard text selection.

Add LinkAt to dialoguetui.Component to hit-test message nodes and extract
underlying markdown components across nested spans and handlers. Expose
Component() on internal/handler/markdown.Handler. In mouseDelegate.OnAction,
query LinkAt on LeftClick and invoke the configured OnLinkClick callback,
suppressing text selection when handled. Wire the callback in rune-agent
extension to copy http/https URLs to the clipboard and display a success
notification.

Fixes unstablebuild#7
Signed-off-by: Spandan Mishra <[email protected]>
Also restore four icon glyphs that were corrupted in config.go doc comments.

Signed-off-by: ernestrc <[email protected]>
@ernestrc
ernestrc force-pushed the fix/agent-dialogue-clickable-links branch from 3fdcf98 to 6396695 Compare October 8, 2026 12:04
@ernestrc
ernestrc enabled auto-merge (squash) October 8, 2026 12:06
@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 92.00000% with 4 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
cmd/rune-agent/dialogue/dialoguetui/component.go 83.33% 2 Missing ⚠️
.../rune-agent/dialogue/dialoguetui/mouse_delegate.go 91.66% 1 Missing ⚠️
cmd/rune-agent/extension/handler.go 96.15% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@ernestrc
ernestrc merged commit 3bb0fa9 into unstablebuild:main Oct 8, 2026
8 checks passed
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.

Rune Agent: make markdown links clickable in the dialogue TUI

3 participants