Open http(s) URL links from widget markdown#301
Merged
Conversation
Hovering an `[text](https://…)` link inside a widget panel underlined
the text (the in-frame auto-linkifier saw the visible URL portion) but
clicks did nothing — the markdown renderer only recognized
`agentd:action/...` patterns when registering hit-targets, so the label
half rendered as inert plain text alongside the bracketed source.
Detect `[text](http(s)://…)` alongside the existing `agentd:action/`
pattern in `render_inline_action_spans`, register a new
`DynamicUiUrlHit` (parallel to `DynamicUiActionHit` so neither protocol
nor existing call sites need to change), and dispatch via the existing
platform `open_url()` helper from `handle_dynamic_ui_overlay_click`
when a click lands on one.
Also route paragraph-style widget text through
`render_inline_action_spans` so inline URLs in regular sentences ("See
[docs](https://…) for details.") register the hit and render as just
the underlined label — not the raw `[label](url)` markdown source.
Four new tests cover the regression: bare URL in a paragraph, URL in a
checklist item, mixed action+URL across separate lines, and the
exclusion of non-http(s) schemes (mailto, file).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Problem
Hovering over an
[text](https://…)link inside a widget panel underlined the text (the in-frame auto-linkifier sees the visible URL portion), but clicking did nothing. The widget markdown renderer (render_inline_action_spansatcrates/cli/src/ui.rs:3686) only recognized theagentd:action/...pattern when registering hit-targets —http(s)://...URLs fell through to plain text, and the click handler atcrates/cli/src/app.rs:3953had nothing to dispatch on.Fix
Two changes, both in
crates/cli:render_inline_action_spansnow branches onagentd:action/,http://,https://, or "other". For URL links it pushes a newDynamicUiUrlHit(parallel toDynamicUiActionHitso no protocol change, no rename of the existing hit list, no churn on existing call sites). The visible label is rendered with an underline modifier so it reads as a link even at rest.handle_dynamic_ui_overlay_clicknow checksdynamic_ui_url_hitsafter the action-hit list (in both the inline-panel and dropdown branches) and calls the existingopen_url()helper — same one that handles terminal-pane URL clicks viaxdg-open/open/cmd /C start.Also routes paragraph-style widget text through
render_inline_action_spansso a URL in regular prose ("See docs for details.") gets the same treatment instead of rendering the raw[label](url)source unchanged.Test
4 new unit tests in
crates/cli/src/ui.rs:http_link_in_widget_registers_url_hit— paragraph text containing one https link.http_link_in_checklist_is_clickable_and_offset_correctly— http link inside a checkbox item, hit geometry offset by the glyph.mixed_action_and_url_links_partition_correctly— action link on one line, URL on another, neither cross-contaminates the other's hit list.non_http_link_schemes_do_not_register_url_hits—mailto:andfile://deliberately do not register (security guard against accidental dispatch).🤖 Generated with Claude Code