feat(ui-tui): resolve markdown links to readable page titles#24013
Conversation
Mirror desktop pretty-link behavior in the TUI by resolving HTTP links to page titles with shared caching and safe fetch filters, plus slug-based fallbacks so chat links stay readable even when title fetch fails.
🔎 Lint report:
|
Clean up the link-title resolver by hardening in-flight cleanup and clarifying title length limits, while adding focused coverage for HTML entity decoding and markdown-label fallback behavior.
|
@copilot review |
|
@copilot please review this PR for bugs, regressions, and edge cases. Leave actionable comments for anything you find. |
Reviewed at Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
@copilot review latest changes |
Reviewed
Reviewed latest branch state (HEAD Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Prevent automatic link-title resolution from requesting local or private hosts by rejecting RFC1918, link-local, ULA, and intranet-style hostnames before fetch, and add regression coverage for blocked host patterns.
|
Addressed the private-network fetchability edge case in
@copilot review latest changes |
Reviewed latest changes at Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
…earch#24013) * feat(ui-tui): resolve links to readable page titles Mirror desktop pretty-link behavior in the TUI by resolving HTTP links to page titles with shared caching and safe fetch filters, plus slug-based fallbacks so chat links stay readable even when title fetch fails. * refactor(ui-tui): tighten link-title fallback handling Clean up the link-title resolver by hardening in-flight cleanup and clarifying title length limits, while adding focused coverage for HTML entity decoding and markdown-label fallback behavior. * fix(ui-tui): block private-network targets in title fetches Prevent automatic link-title resolution from requesting local or private hosts by rejecting RFC1918, link-local, ULA, and intranet-style hostnames before fetch, and add regression coverage for blocked host patterns.
…earch#24013) * feat(ui-tui): resolve links to readable page titles Mirror desktop pretty-link behavior in the TUI by resolving HTTP links to page titles with shared caching and safe fetch filters, plus slug-based fallbacks so chat links stay readable even when title fetch fails. * refactor(ui-tui): tighten link-title fallback handling Clean up the link-title resolver by hardening in-flight cleanup and clarifying title length limits, while adding focused coverage for HTML entity decoding and markdown-label fallback behavior. * fix(ui-tui): block private-network targets in title fetches Prevent automatic link-title resolution from requesting local or private hosts by rejecting RFC1918, link-local, ULA, and intranet-style hostnames before fetch, and add regression coverage for blocked host patterns.
…earch#24013) * feat(ui-tui): resolve links to readable page titles Mirror desktop pretty-link behavior in the TUI by resolving HTTP links to page titles with shared caching and safe fetch filters, plus slug-based fallbacks so chat links stay readable even when title fetch fails. * refactor(ui-tui): tighten link-title fallback handling Clean up the link-title resolver by hardening in-flight cleanup and clarifying title length limits, while adding focused coverage for HTML entity decoding and markdown-label fallback behavior. * fix(ui-tui): block private-network targets in title fetches Prevent automatic link-title resolution from requesting local or private hosts by rejecting RFC1918, link-local, ULA, and intranet-style hostnames before fetch, and add regression coverage for blocked host patterns.
…abels (NousResearch#25606) `urlSlugTitleLabel()` (introduced with PR NousResearch#24013's `ResolvedLink` / `useLinkTitle` flow) iterates URL path segments and title-cases the first one with a letter. The numeric-only filter two lines above already skips IDs like `12345`, but a generic trailing path word such as `status`, `auth`, or `item` slips through and becomes the entire user-facing label. The reported symptom: every `https://x.com/<user>/status/<id>` link in the TUI rendered as the literal word "Status", hiding which user and tweet was linked. `https://accounts.google.com/o/oauth2/auth` rendered as "Auth". Add a sibling skip for generic single-word segments (status, auth, oauth/oauth2, signin/signup/login/logout, page/pages, home/index, post/posts, tweet/tweets, view/show, comment/embed, dashboard/profile/account/settings, item, callback, redirect, …). When skipped, the loop either reaches a more meaningful preceding segment (`x.com/OpenAI/status/...` → "OpenAI") or falls through to the existing `hostPathLabel` fallback (`accounts.google.com/o/oauth2/auth`, `news.ycombinator.com/item`) so the destination stays visible instead of being masked by a one-word generic label. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…earch#24013) * feat(ui-tui): resolve links to readable page titles Mirror desktop pretty-link behavior in the TUI by resolving HTTP links to page titles with shared caching and safe fetch filters, plus slug-based fallbacks so chat links stay readable even when title fetch fails. * refactor(ui-tui): tighten link-title fallback handling Clean up the link-title resolver by hardening in-flight cleanup and clarifying title length limits, while adding focused coverage for HTML entity decoding and markdown-label fallback behavior. * fix(ui-tui): block private-network targets in title fetches Prevent automatic link-title resolution from requesting local or private hosts by rejecting RFC1918, link-local, ULA, and intranet-style hostnames before fetch, and add regression coverage for blocked host patterns.
Summary
Test plan
npm test -- src/__tests__/externalLink.test.ts src/__tests__/markdown.test.tsnpm run type-check