Skip to content

feat(tool): add interactive terminal tool with vscode auto-attach - #41449

Open
Albertban wants to merge 5 commits into
anomalyco:devfrom
Albertban:terminal-tool
Open

feat(tool): add interactive terminal tool with vscode auto-attach#41449
Albertban wants to merge 5 commits into
anomalyco:devfrom
Albertban:terminal-tool

Conversation

@Albertban

Copy link
Copy Markdown

Issue for this PR

Closes #

Type of change

  • New feature

What does this PR do?

Adds a terminal tool to opencode so the agent can open and drive a real interactive PTY (open/read/input/close), and adds VS Code extension support that auto-attaches those sessions into real VS Code terminals via a Pseudoterminal bridge.

Differs from the existing open PR #23794 on the same area by:

  • Auto-attaching agent-created PTYs into VS Code terminals (watcher + "Attach Interactive Terminal" command + port discovery), so you can type passwords interactively instead of the non-TTY bash tool.
  • Running the command through an explicit shell (powershell / cmd / bash, defaulting to PowerShell on Windows).
  • Normalizing input line endings on Windows (\n -> \r) — before this, model-sent \n got stuck in PowerShell's continuation prompt and keystrokes appeared lost.
  • Bundling the real extension icons (previous files were placeholder path references).

How did you verify your code works?

  • bun typecheck passes in packages/opencode; tsc --noEmit passes in sdks/vscode.
  • Verified create/read/input/close roundtrip against a live server, and that auto-attach pops the terminal in VS Code and echoes input both ways.

Screenshots / recordings

N/A (no UI change beyond the auto-attached terminal).

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions

github-actions Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

Related PR Found:

Why it's related:
The PR description explicitly mentions that this PR (#41449) differs from #23794 on the same area. The main differences are:

  • Auto-attaching to VS Code terminals instead of just creating PTYs
  • Explicit shell selection (powershell/cmd/bash)
  • Windows line ending normalization
  • Real extension icons bundling

This appears to be an enhancement/alternative approach to the existing terminal tool work in #23794, not a true duplicate, but they are closely related features addressing the same problem space.

@Albertban

Copy link
Copy Markdown
Author

This is the currently open implementation of an interactive erminal tool for the agent (the earlier #23794 and its rebased successor #41554 are both closed).

Scope of this PR (5 commits):

  • New erminal tool (open/read/input/close) backed by the existing Pty service.
  • VS Code extension: auto-attach agent-created PTYs to real VS Code terminals (watcher + Attach Interactive Terminal command + port discovery), so keystrokes/passwords work interactively.
  • Explicit shell selection (powershell/cmd/bash) and Windows line-ending normalization (\n -> \r) that previously made model-sent input appear lost.
  • Real icons for the extension.

If maintainers prefer folding the tool part into another design, happy to adjust; the VS Code auto-attach piece is the part we'd like to keep either way. Thanks for the review.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant