{{ message }}
Repository navigation
feat(tasks): add terminal output to the add context menu - #3301
Open
kr1shna-exe wants to merge 2 commits into
Open
kr1shna-exe wants to merge 2 commits into
kr1shna-exe wants to merge 2 commits into
Conversation
Task terminals now show up in the Add context popover. Picking one pastes the terminal's current selection, or its last 200 lines when nothing is selected, into the active agent session as a fenced block. Refs: generalaction#2769
Contributor
Find the longest backtick run with a loop instead of spreading every match into Math.max, which overflowed the call stack on large output. Show a toast when reading a terminal fails instead of dropping the error.
This branch has not been deployed
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.

Description
Task terminals now show up in the Add context popover (Cmd+Shift+A in a conversation). Picking one pastes that terminal's output into the active agent session, the same way linked issues and line comments already get pasted in:
The output is read when you pick the entry, not when the list is built. Terminals whose tab was never opened get connected first, and the app waits for the replayed scrollback to finish before reading, so you get current output either way.
Implementation notes:
terminals/api/browser/pty/terminal-output.tsreads the xterm buffer.context-actions.tsgains aterminal-outputaction.AddContextPopover.onApplyActionnow receives just the action.ContextBarresolves the text itself, since terminal text has to be read asynchronously.One visible side effect: the context bar now appears in any task that has a terminal, even when there's no linked issue, comment or prompt. It can still be hidden from its right-click menu.
Related issues
Closes #2769
Testing
pnpm run format:check,pnpm run lintandpnpm run typecheckinapps/emdash-desktoppass.vitest run --project node: 3927 passed. The one failure isfiles-domain.integration.test.ts"classifies a path outside any checkout as an unavailable content state", which fails the same way on main.terminal-output.test.tsruns a real xtermTerminaland covers wrapped lines, the line cap, spaces on a wrap boundary, selection taking priority and an empty buffer.context-actions.test.tscovers ordering, fencing and reading at apply time.Screenshot/Recording (if applicable)
Popover with both terminals listed:
07-popover.pngSelected line pasted into the agent:
11-after-selection.pngChecklist
messages and, when possible, the PR title