Skip to content

feat(tool): add interactive terminal tool with persistent PTY sessions - #41554

Closed
herjarsa wants to merge 5 commits into
anomalyco:devfrom
herjarsa:rebase/23794-interactive-terminal
Closed

feat(tool): add interactive terminal tool with persistent PTY sessions#41554
herjarsa wants to merge 5 commits into
anomalyco:devfrom
herjarsa:rebase/23794-interactive-terminal

Conversation

@herjarsa

@herjarsaherjarsa commented Aug 10, 2026

Copy link
Copy Markdown

Issue for this PR

Closes#23759

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Adds an interactive terminal tool with persistent PTY sessions, rebased onto current dev. This is a clean rebase of #23794 (originally 1812 commits divergent), containing only the 5 logical commits:

  1. feat(tool): add interactive terminal tool with persistent PTY sessions
  2. feat(terminal): surface agent-created PTY sessions in Desktop UI
  3. fix(terminal): address PR #23794 review feedback from egdev6
  4. fix(terminal): address review round 3 feedback from egdev6
  5. fix(terminal): migrate Zod discriminatedUnion to Effect Schema Union

Rebase resolutions applied:

  • packages/app/src/context/terminal.tsx — took the PR version (new session surface).
  • packages/opencode/src/pty/index.ts — modify/delete conflict; took the PR version (the modifications address the upstream review feedback from @egdev6).
  • bun.lock removed (regenerable with bun install).
  • Generated terminal.txt and txt.d.ts ignored (artifacts of the native build).

Diff stats: 8 files changed, 1466 insertions(+), 293 deletions(-).

How did you verify your code works?

Rebased cleanly onto current dev; the 5 logical commits apply without merge conflicts. Terminal tests included.

Screenshots / recordings

Not a UI change; native tool + desktop session surface.

Checklist

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

- Subscribe to pty.created events in TerminalContext
- Add deduplication to avoid duplicate sessions
- Auto-open terminal panel when agent creates a PTY session
- Set agent session as active tab when created
Closes Phase 2 of anomalyco#23449
# Conflicts:
#	packages/app/src/context/terminal.tsx
- Remove duplicated -l args in pty.create() calls (Pty.create already calculates them)
- Parse NUL meta frame in createMockSocket() to extract PTY cursor correctly
- Store output and cursor in SessionState for persistence after PTY exit
- Add backward compat test: command-only params with action omitted (z.preprocess)
- Remove duplicated focus effect in terminal-panel.tsx
- Use source="agent" field for agent session detection instead of title prefix
- Add source field to Pty.Info and CreateInput schemas
# Conflicts:
#	packages/opencode/src/pty/index.ts
@github-actionsgithub-actionsBot added the needs:compliance This means the issue will auto-close after 2 hours. label Aug 10, 2026
@github-actions

Copy link
Copy Markdown
Contributor

This PR doesn't fully meet our contributing guidelines and PR template.

What needs to be fixed:

  • PR description is missing required template sections. Please use the PR template.

Please edit this PR description to address the above within 2 hours, or it will be automatically closed.

If you believe this was flagged incorrectly, please let a maintainer know.

@github-actions

Copy link
Copy Markdown
Contributor

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

I found one potentially related PR:

Related PR Found:

@github-actions

Copy link
Copy Markdown
Contributor

This pull request has been automatically closed because it was not updated to meet our contributing guidelines within the 2-hour window.

Feel free to open a new pull request that follows our guidelines.

@github-actionsgithub-actionsBot removed the needs:compliance This means the issue will auto-close after 2 hours. label Aug 10, 2026
Sign up for freeto 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.

feat(tool): add interactive terminal tool with persistent PTY sessions

1 participant

@herjarsa