Skip to content

feat(opencode): add separately spawnable terminal runtime #754

Closed

Description

@Juliusolsson05

Motivation

Agent Code currently exposes OpenCode only through the HTTP/SSE-backed rendered surface. That renderer is not yet mature enough to be the only usable OpenCode experience, while the native OpenCode TUI is already functional. Users need an explicit OpenCode Terminal creation choice that runs the real TUI without replacing or disguising the existing OpenCode choice.

This supersedes the old assumption in #485 that native OpenCode should become only another global Agent/Terminal display mode. The requested product behavior is two separately spawnable instances.

Intended behavior

  • Keep OpenCode as the existing structured HTTP/SSE runtime.
  • Add OpenCode Terminal as a distinct option anywhere a new agent provider is selected.
  • Spawn the native opencode TUI in a PTY and route raw bytes, input, resize, exit, and process identity through the existing agent-terminal transport.
  • Persist the terminal runtime flavor so restore, lazy wake, duplicate placement, undo-close, and Dispatch keep the same runtime.
  • Run the existing managed-skill reconciliation before terminal startup.
  • Inject the selected Agent Code built-in MCP domains into the OpenCode TUI through per-process inline config without writing bearer credentials to argv or a project file.
  • Preserve the existing OpenCode rendered runtime and do not make its unfinished renderer a dependency of the terminal variant.

Acceptance criteria

  • The New Agent picker visibly offers both OpenCode and OpenCode Terminal.
  • Choosing OpenCode Terminal starts a working xterm-backed OpenCode TUI; typing and resize reach the PTY.
  • The session survives renderer remount/restore with its runtime flavor intact.
  • Built-in MCP domains and managed personal skills remain available to the terminal session.
  • OpenCode Terminal does not create a duplicate Setup prerequisite or CLI updater entry.
  • Focused unit/renderer/system tests cover option selection, persistence/recovery, MCP launch material, and PTY lifecycle.
  • Typecheck and relevant test suites pass.

Refs #485

Activity

  1. Juliusolsson05 commented on Sep 3, 2026

    @Juliusolsson05
    OwnerAuthor

    Scope update: this implementation now covers the complete goal, not only the PTY launcher. OpenCode Terminal is a separately selectable runtime under the existing OpenCode provider identity; runtime flavor is persisted through recovery, Dispatch, linked panes, undo, and duplication. Built-in skills and all Agent Code MCP domains remain available through the shared lifecycle. The work also adds OpenCode CLI export/import hosting, all six Claude/Codex/OpenCode switch directions, duplicate/rewind support, unfinished-export protection, and the companion agent-transcript-parser decoder/projector tracked in Juliusolsson05/agent-transcript-parser#22 (PR #23).

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions