Skip to content

feat(desktop): make terminal output links clickable - #5033

Open
faga295 wants to merge 2 commits into
apache:mainfrom
faga295:feat/terminal_support_search_web_link
Open

feat(desktop): make terminal output links clickable#5033
faga295 wants to merge 2 commits into
apache:mainfrom
faga295:feat/terminal_support_search_web_link

Conversation

@faga295

@faga295 faga295 commented Sep 8, 2026

Copy link
Copy Markdown

Summary

URLs printed in the task terminal were plain text; opening one required copying it into a browser by hand.

This PR loads @xterm/addon-web-links on the Terminal instance the panel already owns, so URLs in terminal output are clickable and open in the system browser. A renderer-side pure policy (terminalWebUrl) allows only explicit http:/https: URLs — non-web schemes and malformed values are ignored before window.open is ever attempted. The main process external-link guard remains the final boundary.

terminalWebUrl is dependency-free and DOM-free so node:test can exercise it directly.

Fixes #5032

Verification

  • npx tsx --test src/main/__tests__/terminal-interaction-policy.test.ts — 2/2 pass (accepts only explicit HTTP(S); rejects non-http(s) and malformed values)
  • Not run: full desktop lint/typecheck suites (happy to run on request)

AI use

Select exactly one:

  • No generative tool made a substantive contribution
  • Generative tooling made a substantive contribution

Tool(s) and scope: Claude (pi) authored the change and tests under my direction.

Checklist

  • Tests cover the change and fail without it
  • Lint, format, typecheck and the affected suites pass locally

Does this PR entail a change in behavior?

  • Yes — described under Summary above
  • No

Load @xterm/addon-web-links on the task terminal so URLs in output can
be opened. A renderer-side terminalWebUrl policy allows only explicit
HTTP(S) URLs; main's external-link guard remains the final boundary
behind window.open.

Fixes apache#5032
@github-actions github-actions Bot added the effort/S Under 100 readable lines label Sep 8, 2026

@Astro-Han Astro-Han left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review result: NO-GO on exact head 48eb54f4bd87b511fbedf78a54462ecf434e466e

I independently reviewed the complete PR diff and re-checked the live PR head immediately before publishing this comment. The head is still 48eb54f4bd87b511fbedf78a54462ecf434e466e; the PR is open and non-draft.

P1 — generated third-party notice is stale

apps/desktop/resources/licenses/npm/THIRD_PARTY_NOTICES.txt:4787-4788 contains two consecutive separator lines before the new @xterm/addon-web-links@0.12.0 section, and :4758 has an extra blank line before the preceding separator. The generator joins adjacent sections with exactly one separator (scripts/generate-third-party-notices.mjs:468), and its --check mode compares the committed notice byte-for-byte. This means the new dependency notice is not the generator output and the full test/release plan's notice gate will fail.

Please regenerate apps/desktop/resources/licenses/npm/THIRD_PARTY_NOTICES.txt from the exact lockfile/dependency closure and rerun the notice gate.

The terminal-link path itself is statically coherent: session-terminal-panel.tsx:100-110 loads WebLinksAddon on the owned terminal, terminal-interaction-policy.ts:25-35 permits only parsed HTTP(S) URLs, and main-window.ts:439-451 retains the shell.openExternal boundary. git diff --check and the base/head merge-tree check were clean. I could not run the focused test, full build/typecheck, browser/Electron click smoke, or notice check in this checkout because workspace dependencies and build artifacts are absent.


Automated review notice: This AI-assisted review is not a substitute for independent human review.

@Astro-Han Astro-Han left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed exact head e3bed7d8825b446b19f9ae4ee1983bfe478a198d.

The prior notice-generation finding is fixed: THIRD_PARTY_NOTICES.txt now has one generated section separator at :4758-4759 and :4786-4814, with the duplicate separator and extra blank line removed. The lockfile also contains @xterm/addon-web-links@0.12.0. I found no new P0–P2 issues in this re-review; the renderer link path remains statically consistent with the main-process external-link guard.

No hosted checks are currently reported for this head, so this comment does not certify CI or merge readiness.

Automated review notice: This review was generated by an AI agent and is not a substitute for independent human review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

effort/S Under 100 readable lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Terminal output: clickable web links

2 participants