Skip to content

Give Agents access to Terminal output#1032

Open
maskdotdev wants to merge 6 commits intopingdotgg:mainfrom
maskdotdev:feat/terminal-context
Open

Give Agents access to Terminal output#1032
maskdotdev wants to merge 6 commits intopingdotgg:mainfrom
maskdotdev:feat/terminal-context

Conversation

@maskdotdev
Copy link
Contributor

@maskdotdev maskdotdev commented Mar 13, 2026

sorry this is so close to the 1k limit outline in the contributing.md., some of the code here could be reused by the diff pr at #1003 (could make smaller if I remove the timeline and composer pills, but I think those provide value to the end user)

What Changed

Added terminal selection as chat context, surfaced pending terminal-context chips in the composer, and rendered sent terminal context as compact metadata in the timeline.

Why

resolves #26

UI Changes

Composer now shows selected terminal snippets as removable chips, the terminal drawer adds an “Add to chat” action for selections, and sent messages show a compact terminal-context indicator with tooltip preview.

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes
  • I included a video for animation/interaction changes
Screenshot 2026-03-13 at 11 16 56 AM
t3code-terminal-context-optimized.mp4

Note

Give agents access to terminal output by attaching selected text as context in chat

  • Adds a floating 'Add to chat' button in TerminalViewport that appears when the user selects text; clicking it appends a <terminal_context> block to the composer draft via composerDraftStore.
  • Pending terminal contexts are shown as removable pill chips above the composer via a new ComposerPendingTerminalContexts component.
  • On send, the terminal context block is appended to the message text; user messages render compact inline labels (e.g. @terminal-1:3-7) with tooltips instead of raw block text.
  • The composer draft store persists and restores terminal contexts per thread, deduplicates identical selections, and clears them with other composer content.
  • Timeline height estimation and the empty-send guard are updated to account for terminal context blocks correctly.

Macroscope summarized 1bee2ab.

@coderabbitai
Copy link

coderabbitai bot commented Mar 13, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 29faca63-259c-47e9-a604-0ee15df985a0

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions bot added size:XXL 1,000+ changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list. labels Mar 13, 2026
Copy link
Member

@juliusmarminge juliusmarminge left a comment

Choose a reason for hiding this comment

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

this looks amazing - definitely will try and get this merged soon. thank you! don't worry about the diff limit for this one

one nit: i think this indicator is a bit small and discrete, how would it look to keep the pill-like thing on top of the message similar to the composer input (or even inline like file taggings?)

CleanShot 2026-03-13 at 09 34 50@2x

another "feature" I originally wanted from this is the ability to tag a terminal using look at the logs in @terminal-1 and fix the build issue or whatever (autocompletes similar to the workspace entries search) and we'd transform that in the user message to include a reference to the terminal log file (in ~/.t3/userdata/logs/terminals/.log` that the agent can go look at

@maskdotdev
Copy link
Contributor Author

maskdotdev commented Mar 13, 2026

I know you mentiond to not worry about the diff size on this one, but would you prefer if I create another issue and separate PR for the @terminal feature, or do it on this PR as well?

@juliusmarminge
Copy link
Member

I know you mentiond to not worry about the diff size on this one, but would you prefer if I create another issue and separate PR for the @terminal feature, or do it on this PR as well?

i don't mind either. whatever is easiest!

@maskdotdev
Copy link
Contributor Author

maskdotdev commented Mar 13, 2026

this looks amazing - definitely will try and get this merged soon. thank you! don't worry about the diff limit for this one

one nit: i think this indicator is a bit small and discrete, how would it look to keep the pill-like thing on top of the message similar to the composer input (or even inline like file taggings?)

CleanShot 2026-03-13 at 09 34 50@2x

another "feature" I originally wanted from this is the ability to tag a terminal using look at the logs in @terminal-1 and fix the build issue or whatever (autocompletes similar to the workspace entries search) and we'd transform that in the user message to include a reference to the terminal log file (in ~/.t3/userdata/logs/terminals/.log` that the agent can go look at

I'm leaning towards the inlined ones, possibly the basic one, which one do you prefer? Could be a combination of them too.

t3code-terminal-tagging

@juliusmarminge
Copy link
Member

inline pills i think looks the best - will also match the existing file pills the best

@maskdotdev
Copy link
Contributor Author

maskdotdev commented Mar 13, 2026

Style now reflects inline in a similar fashion to file mentions

Created a separate issue for @mention terminals feature at #1042

Will create a separate PR for that one 🫡

@juliusmarminge
Copy link
Member

mind attaching a new recording of the current state?

@maskdotdev
Copy link
Contributor Author

of course! here you go

t3code-term-context-inline.mp4

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

Labels

size:XXL 1,000+ changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: Give Agents access to Terminal output

2 participants