opencode-pty icon indicating copy to clipboard operation
opencode-pty copied to clipboard

[Feature]: Setting to have the web ui running even without /pty-... command

Open BananaAcid opened this issue 2 months ago • 3 comments

Problem Statement

"I'm always frustrated when..."

I try to reload the browser tab with the running sessions ... and page is not reachable.

even with my own shell script setting the port env, when opencode start ... and launches a pty session ... I manually must use /pty-... to be able to refresh the browser tab to see the sessions.

Proposed Solution

a config param (v1 -> env, v2 -> env+config) to have the pty web ui start on opencode use

Alternatives Considered

... doing it manual. But when the a task runs, until the /pty-... command is processed, it might take a while and I am not able to look at the output / not being able to input if something was needed on the console.

Use Case

Describe the use case(s) this feature would enable:

being able to interact with the pty session while a task is running, and the /pty-... is not yet being processed and thus the webui is not reachable.

BananaAcid avatar Sep 18 '26 15:09 BananaAcid

This feature is recently added in #59 I guess.

shekohex avatar Sep 18 '26 23:09 shekohex

@shekohex it seems to be the exact feature, but as per https://github.com/shekohex/opencode-pty#environment-variables autostart is supported for V1

BananaAcid avatar Sep 19 '26 02:09 BananaAcid

PR #59 introduced the autostart option specifically for OpenCode V2 through ctx.options.autostart in opencode.json, but did not include an environment variable or autostart for OpenCode V1 (where plugin options do not exist and configuration is handled via environment variables like PTY_WEB_PORT).

I've opened #62 to address this:

  • Adds support for PTY_WEB_AUTOSTART (and alias PTY_AUTOSTART) environment variable accepting true, 1, yes, on.
  • Autostarts the PTY web server immediately during plugin setup in OpenCode V1 when enabled.
  • Falls back to PTY_WEB_AUTOSTART in OpenCode V2 if options.autostart is not explicitly set in config.
  • Documents PTY_WEB_AUTOSTART in the README under ### Environment Variables.

With this, you can set export PTY_WEB_AUTOSTART=true (along with PTY_WEB_PORT) in your shell script and refresh your browser tab immediately on startup without needing to invoke slash commands.

kumar-shivang avatar Sep 19 '26 04:09 kumar-shivang