feat(desktop): make terminal output links clickable - #5033
Conversation
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
Astro-Han
left a comment
There was a problem hiding this comment.
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
left a comment
There was a problem hiding this comment.
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.
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-linkson 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 explicithttp:/https:URLs — non-web schemes and malformed values are ignored beforewindow.openis ever attempted. The main process external-link guard remains the final boundary.terminalWebUrlis dependency-free and DOM-free sonode:testcan 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)AI use
Select exactly one:
Tool(s) and scope: Claude (pi) authored the change and tests under my direction.
Checklist
Does this PR entail a change in behavior?