Skip to content

feat(ui-tui): resolve markdown links to readable page titles#24013

Merged
OutThisLife merged 3 commits into
mainfrom
bb/ui-tui-link-titles
May 11, 2026
Merged

feat(ui-tui): resolve markdown links to readable page titles#24013
OutThisLife merged 3 commits into
mainfrom
bb/ui-tui-link-titles

Conversation

@OutThisLife

Copy link
Copy Markdown
Collaborator

Summary

  • add a TUI external-link resolver that normalizes URLs, fetches HTML titles with timeout/byte guardrails, deduplicates in-flight requests, and caches canonicalized results
  • update markdown link rendering so markdown links, autolinks, and bare URLs display resolved page titles (with slug-based fallback labels when fetches fail)
  • add focused coverage for link helper behavior (fetchability, canonical cache sharing, error-title filtering) and markdown rendering of readable bare-link labels

Test plan

  • npm test -- src/__tests__/externalLink.test.ts src/__tests__/markdown.test.ts
  • npm run type-check

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.
@github-actions

github-actions Bot commented May 11, 2026

Copy link
Copy Markdown
Contributor

🔎 Lint report: bb/ui-tui-link-titles vs origin/main

ruff

Total: 0 on HEAD, 0 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 0 pre-existing issues carried over.

ty (type checker)

Total: 8168 on HEAD, 8168 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 4303 pre-existing issues carried over.

Diagnostics are surfaced as warnings — this check never fails the build.

@alt-glitch alt-glitch added type/feature New feature or request comp/tui Terminal UI (ui-tui/ + tui_gateway/) P3 Low — cosmetic, nice to have labels May 11, 2026
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.
@OutThisLife

Copy link
Copy Markdown
Collaborator Author

@copilot review

@OutThisLife

Copy link
Copy Markdown
Collaborator Author

@copilot please review this PR for bugs, regressions, and edge cases. Leave actionable comments for anything you find.

Copilot AI commented May 11, 2026

Copy link
Copy Markdown
Contributor

@copilot review

Reviewed at 4b95e16: no additional changes were needed for this PR. I also re-ran npm test -- src/__tests__/externalLink.test.ts src/__tests__/markdown.test.ts and npm run type-check in ui-tui successfully. The current CI failure is from tools/process_registry.py Windows-footgun checks, which is outside this PR’s touched files.

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:

  • www.expedia.com
    • Triggering command: /opt/hostedtoolcache/node/24.14.1/x64/bin/node /opt/hostedtoolcache/node/24.14.1/x64/bin/node --experimental-import-meta-resolve --require /home/REDACTED/work/hermes-agent/hermes-agent/ui-tui/node_modules/vitest/suppress-warnings.cjs --conditions node --conditions development /home/REDACTED/work/hermes-agent/hermes-agent/ui-tui/node_modules/vitest/dist/workers/forks.js (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

@OutThisLife

Copy link
Copy Markdown
Collaborator Author

@copilot review latest changes

Copilot AI commented May 11, 2026

Copy link
Copy Markdown
Contributor

@copilot please review this PR for bugs, regressions, and edge cases. Leave actionable comments for anything you find.

Reviewed 4b95e16 with targeted tests/type-check passing. I found one actionable edge-case risk in ui-tui/src/lib/externalLink.ts:122-130: isTitleFetchable() blocks localhost, but still allows private/link-local/internal targets (e.g. 10.x, 192.168.x, 172.16/12, 169.254.169.254, IPv6 ULA/link-local, .local). Since link-title fetch runs automatically, this can trigger unintended internal-network requests. Suggested fix: reject private/link-local IP ranges and local hostnames before fetch, and add tests covering those inputs. Screenshot: N/A (review-only; no UI changes in this pass).

@copilot review latest changes

Reviewed latest branch state (HEAD 4b95e16) and reran npm test -- src/__tests__/externalLink.test.ts src/__tests__/markdown.test.ts plus npm run type-check in ui-tui; all passed. No additional regressions beyond the previously noted internal-network fetchability edge case in isTitleFetchable(). Screenshot: N/A (review-only; no UI changes in this pass).

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:

  • www.expedia.com
    • Triggering command: /opt/hostedtoolcache/node/24.14.1/x64/bin/node /opt/hostedtoolcache/node/24.14.1/x64/bin/node --experimental-import-meta-resolve --require /home/REDACTED/work/hermes-agent/hermes-agent/ui-tui/node_modules/vitest/suppress-warnings.cjs --conditions node --conditions development /home/REDACTED/work/hermes-agent/hermes-agent/ui-tui/node_modules/vitest/dist/workers/forks.js (dns block)

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.
@OutThisLife

Copy link
Copy Markdown
Collaborator Author

Addressed the private-network fetchability edge case in 0d56b2f:

  • isTitleFetchable() now rejects private/link-local/internal targets (RFC1918, CGNAT, loopback/unspecified, IPv6 ULA/link-local, .local/single-label intranet hosts)
  • added regression tests in ui-tui/src/__tests__/externalLink.test.ts for blocked host classes

@copilot review latest changes

Copilot AI commented May 11, 2026

Copy link
Copy Markdown
Contributor

Addressed the private-network fetchability edge case in 0d56b2f:

  • isTitleFetchable() now rejects private/link-local/internal targets (RFC1918, CGNAT, loopback/unspecified, IPv6 ULA/link-local, `....

Reviewed latest changes at 0d56b2f and reran npm test -- src/__tests__/externalLink.test.ts src/__tests__/markdown.test.ts plus npm run type-check in ui-tui; all passed. The private-network hardening and new regression coverage look correct, and I didn’t find additional bugs/regressions in the touched code. Current workflow noise remains the unrelated Windows-footgun check in tools/process_registry.py. Screenshot: N/A (review-only; no UI changes in this pass).

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:

  • www.expedia.com
    • Triggering command: /opt/hostedtoolcache/node/24.14.1/x64/bin/node /opt/hostedtoolcache/node/24.14.1/x64/bin/node --experimental-import-meta-resolve --require /home/REDACTED/work/hermes-agent/hermes-agent/ui-tui/node_modules/vitest/suppress-warnings.cjs --conditions node --conditions development /home/REDACTED/work/hermes-agent/hermes-agent/ui-tui/node_modules/vitest/dist/workers/forks.js (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

@OutThisLife OutThisLife merged commit 75b428c into main May 11, 2026
10 of 13 checks passed
@OutThisLife OutThisLife deleted the bb/ui-tui-link-titles branch May 11, 2026 21:16
02356abc pushed a commit to 02356abc/hermes-agent that referenced this pull request May 14, 2026
…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.
jsboige pushed a commit to jsboige/hermes-agent that referenced this pull request May 14, 2026
…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.
AlexFoxD pushed a commit to AlexFoxD/hermes-agent that referenced this pull request May 21, 2026
…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.
briandevans added a commit to briandevans/hermes-agent that referenced this pull request May 28, 2026
…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>
gweeteve pushed a commit to gweeteve/hermes-agent that referenced this pull request Jun 2, 2026
…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/tui Terminal UI (ui-tui/ + tui_gateway/) P3 Low — cosmetic, nice to have type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants