Feature hasn't been suggested before.
Describe the enhancement you want to request
POST /tui/select-session can only open a session in the TUI's current directory. If the session belongs to another directory, the TUI shows it but keeps the old directory's agents, commands, file search and @ completions.
I'd like an optional targetDirectory on the request. When it's set and differs from the TUI's directory, the TUI points its SDK client at that directory, reloads its directory-scoped data, then shows the session. Omitting it keeps today's behavior.
Use case: one opencode serve with a single attached TUI used as a viewer, plus an external session picker (a dashboard listing sessions across all projects) that switches it between sessions in different repos. Today the only option is to kill the TUI and re-attach it in the new directory, which takes a few seconds and loses its state.
This builds on #52869 (the optional client id on the same endpoint) and is related to #45963 (selecting a session from plugins). The change is small: the event schema, context/sdk.tsx gets a setDirectory, and the tui.session.select handler in app.tsx. It also has to show the session before the new directory's session list arrives, which #53392 makes possible. I've been running it in my own build daily and can open a PR if this sounds good.
Feature hasn't been suggested before.
Describe the enhancement you want to request
POST /tui/select-sessioncan only open a session in the TUI's current directory. If the session belongs to another directory, the TUI shows it but keeps the old directory's agents, commands, file search and@completions.I'd like an optional
targetDirectoryon the request. When it's set and differs from the TUI's directory, the TUI points its SDK client at that directory, reloads its directory-scoped data, then shows the session. Omitting it keeps today's behavior.Use case: one
opencode servewith a single attached TUI used as a viewer, plus an external session picker (a dashboard listing sessions across all projects) that switches it between sessions in different repos. Today the only option is to kill the TUI and re-attach it in the new directory, which takes a few seconds and loses its state.This builds on #52869 (the optional
clientid on the same endpoint) and is related to #45963 (selecting a session from plugins). The change is small: the event schema,context/sdk.tsxgets asetDirectory, and thetui.session.selecthandler inapp.tsx. It also has to show the session before the new directory's session list arrives, which #53392 makes possible. I've been running it in my own build daily and can open a PR if this sounds good.