Repository navigation
v0.6.0
[0.6.0] - 2026-10-15
Added
TUI sidebar panel
A PTY section in OpenCode's terminal sidebar, listing this project's sessions and
opening a session's live output in a dialog. Contributed additively through the
V2 TUI plugin API (Plugin.define plus the sidebar.content slot), so it sits
beside the built-in sidebar items rather than replacing them.
-
The server publishes its bound address to a small record under
$XDG_RUNTIME_DIR/opencode-pty/, which is how the panel finds it. A reader
validates every candidate with/health, and the owner removes its own record
on shutdown. -
Sessions now record
exitAt: when the process actually stopped, as opposed to
endedAt, which is written from the exit notification and lost on a restart. It
travels into the archive, which is what lets the dialog show a finished run's
duration. -
The panel polls rather than subscribing: the web UI has a WebSocket for this and
a TUI has no equivalent, soPOLL_MSis the floor for how stale it may look. -
The list is ordered with running sessions first, then finished ones newest first.
It holds every session the server knows, which on a machine with any history is
hundreds of records - and a live process below all of them is one you have to
scroll to find. The header's count stays the true total, so nothing is hidden. -
Once a start has failed repeatedly, the status names the gesture that still works
(toggle the panel again) rather than inviting a click that no longer starts
anything. -
The sidebar lists the running sessions, and the archive is one click away in the
footer. Measured on the author's machine the list held 200 entries in a ~40-column
sidebar, of which three carried news (exit 1,exit 2) and 197 wereexit 0; the
section also displaced the host's own MCP and LSP sections. Ordering could not fix
that, because a status strip cannot be a session manager. Sosidebar.contentdraws
one row per RUNNING session - or one dim line saying nothing is running - and a new
sidebar.footerslot carries the archive's size. Clicking that line expands the
finished runs that FAILED, newest first, capped at 10. Anexit 0is a record, not
an event: on a machine with history there are hundreds of them, and the only place
they are still browsable is the web UI. The header's count stays the true total, and
the footer names the archive rather than the rows on screen - when the cap cuts the
list it says so (10 of 17 failed). The line is absent when nothing failed, because
a click that opens nothing is a control with no answer. -
Opening the archive does not start a server. Expanding the panel is the only trigger
that does, and the sessions the archive shows are already in the panel state, so the
expansion needs no refresh at all. -
The sidebar has a filter, driven by the host's own prompt.
/pty-filterasks for a
query throughui.dialog.promptand stores it beside the collapsed flag, so the plugin
needs no text field and no key handling of its own. Matching is the SHARED rule
(filterGroups/sessionMatches) rather than a second matcher that would drift:
case-insensitive, over the conversation heading and every field a row shows, with a heading
match keeping its whole group. To let the panel use it, those functions are now constrained
on the fields they READ rather than onPTYSessionInfo- the same moveTimeOrderedwas -
because the panel carries a trimmed shape across a process boundary and itsargsis
optional, so the haystack tolerates a session with no command line at all. The header reads
N of 200while a filter is active, the query appears beside it as a clickable chip (the
way to clear it that needs no typing), and an empty body names the query instead of
claiming nothing is running. A dismissed prompt leaves the filter alone; an empty answer
clears it. The numerator counts what the body draws, so0 of 200and "nothing matches"
cannot contradict each other. -
The sidebar groups the running sessions by the conversation that started them. The
list was global: a conversation that had started no PTY still saw the whole machine's
sessions, and without the parent id by heart there was no way to tell whose process a row
was. Each group now carries one collapsible heading, titled through the host's own
data.session.getand falling back toSession <id>- orUngroupedfor a session
started by hand - with the same agent name the web sidebar shows. The fold is the host MCP
sidebar's idiom, copied: ONE mouse handler, on a chevron that appears only once a group is
big enough for folding to save something. A group of one or two is therefore always open,
so the collapse can never take the one live process out of sight. A group holding a
running session is drawn above one that only finished, and the group state is a durable
preference beside the collapsed flag. The grouping applies to the running set - the
archive in the footer stays a single count, because 200 sessions across 20 conversations
would be a wall of headings in a ~40-column sidebar. -
The output dialog uses a plain box rather than a scrollbox. Measured against
opentui 0.5.14: a scrollbox renders nothing when its text contains a line break,
andstickyScrolltogether withstickyStart: 'bottom'blanks it even for a
single line. The box shows exactly as many lines as it has rows, so the newest
output is what lands on screen. The full history stays in the web UI. -
opencode-pty/v2now also resolves/tui. OpenCode builds the TUI specifier from
the configured plugin name, so the documented V2 entry was probed as
opencode-pty/v2/tuiand the panel was never found - while the tools loaded
normally, which is what makes it a silent failure. Found by running OpenCode's own
resolver against the built package. -
opencode-pty/tuiis now a declared export. Theexportswildcards did not reach
it -./*matches one path segment and pointed atdist/src/tui.jsrather than
the directory'sindex.js- so opencode's resolver reported the plugin as having
no TUI feature, which reads as "the panel never appears" rather than as a
packaging mistake. -
@babel/core, pulled in by@opentui/solid's Babel plugin, is overridden past
advisory GHSA-4. Nothing here runs Babel; onlyjsx-runtimeis used. -
The session list is ordered by
exitAt, in the browser as well as the sidebar.
endedAtis lost across a restart - that is the reasonexitAtexists - so a restarted
session had no end time and fell back to its start when the list was ordered. A session
that finished twenty minutes ago therefore sorted ABOVE one that finished a minute ago,
on every surface.sortSessionsByTimenow prefersexitAt, thenendedAt, then
createdAt. -
One duration formatter with two presets.
formatDurationMsis the implementation;
compactgives2h 04mfor the web sidebar andprecisegives1m 05sfor the 40-column
one, both from the same arithmetic. The sidebar's run timer is no longer a second
implementation, and two surfaces can no longer disagree about how long a run was.
One deliberate behaviour change: a duration of zero or less now renders as EMPTY rather
than0s, because0sclaimed a run lasted nothing on a clock that cannot be trusted -
and the callers already render the empty case deliberately. -
The sidebar panel's ordering is now the shared rule plus one step of its own. The
partition (running above finished) stays local, because a live process below a page of
records is one you have to scroll to find. The order inside each half comes from the
shared sort, which also brought its deterministic tie-break: two sessions with the same
timestamp are separated by id rather than by whichever order the server sent them in. -
A
session.panelfor the PTYs of the conversation you are in. A PTY session belongs to
the OpenCode session that spawned it - the web UI groups its list byparentSessionIdfor
the same reason - so the panel claimssession.panel, the host's own place for an extra
view of a session, where Review and Files already live. Open it from the command palette
or/pty-sessions; no keybind is configured, because any guess could collide with the
host's own and the command has an id for the user's keymap config.
It lists this conversation's processes, one on screen, read on the same poll as the
sidebar - the panel's rows are a subset of that list, so a second fetch would be a second
answer to a question already answered. -
The freshness check asks the registry about the version a bump would take.
bun outdated
prints Current, Update and Latest, and the age lookup read only Update. For an exactly-pinned
dependency Update is the CURRENT version - there is nothingbun updatecan install inside
an exact pin - so the lookup returned an age of months and the gate could never wait such a
release out. It demanded a same-day bump instead, which is the outcomeminimumReleaseAge
exists to prevent, and the failure AGENTS.md records as "a gate stricter than the policy it
enforces will fail on every publish". One package gave two answers in the same run: the
@opencode/theme(dev)row looked up 2.0.23 and failed, the(peer)row looked up 2.0.24
and waited it out. The target is now Update when it differs from Current, Latest otherwise.
publishedAtreceives that version instead of the row, so which version is asked about is
assertable rather than something a test has to re-derive by parsing the table itself. -
serovalis overridden past a critical advisory thatsolid-jspins into the lockfile.
seroval@1.5.6carries GHSA-mv8w… (thenable assimilation, critical) plus a high one, and
solid-js@1.9.15pins~1.5.4for bothserovalandseroval-plugins. Only
solid-js/web/dist/server.jsimports it - Solid's SSR build, and nothing in a terminal
plugin renders HTML - so bothbun auditand Aislop's own
security/vulnerable-dependencyrule were failing on code this package cannot reach.
Narrowingbun auditto--productionwas the first attempt and the wrong one: it would
have quieted one tool while leaving Aislop's rule unsatisfied, for an advisory still
installed. The override fixes both, and it sits inside the contract rather than past it -
seroval-pluginsdeclaresserovalas a peer of^1.0, so 1.6.8 is a version its own
package asks a consumer for.bun auditnow reports no vulnerabilities across 430
packages. Same shape and same expiry as the existing@babel/coreoverride:
test/tui-package.test.tspins both values, and the override goes whensolid-jsships a
fixed pin. -
Clicking a row in the sidebar opens the panel — the row had no click handler at all.
Reported as "clicking a running session should open the panel too", and the reason it did
not is worth recording:PanelView.onOpenexisted, was wired to a row, and no row ever
called it. Only the remove glyph carried a mouse handler, soonOpenwas unreachable from
a row and the output could be opened from the palette and nowhere else. A prop that nothing
renders is not a wired prop. The row now opens on mouse-UP, with the mouse-DOWN stopped so
the press half cannot reach the section's own collapse toggle. -
The panel can drive the process on screen, through a command line rather than keys. A
plugin gets named commands and no raw key events, so forwarding keystrokes would mean
binding every printable key - andq, the quit key of every full-screen program, belongs
to OpenCode'sdiff.close, whose command carries noenabledpredicate and is therefore
live at all times.ui.dialog.promptis the input the SDK genuinely offers, so⌨ sendin
the header andf4open it, and the line is written to/api/sessions/:id/inputwith a
newline.topis fully usable this way. It is a command line, not a terminal: arrow keys
and raw control characters remain out of reach, andhtopneeds key handling this SDK does
not expose. The origin is resolved BEFORE the prompt opens - a test caught the earlier order,
which asked a reader with no server to talk to for input that could not be delivered. -
The panel has a footer, mirroring the web UI's identifiers-above-counters-below. Id,
status, terminal size, output lines and the rendered screen's row count. Size and line count
are the ones that matter for a full-screen program:topgiven 120x40 and shown in 80
columns is wrapping, not a rendering fault. It is the framed screen's SIBLING, not a child,
because the screen grows to fill and a bar inside it would be pushed off the bottom. -
The panel's keys are exactly three, and two of them are keys the host left free.
ctrl+ycloses the panel andf3enlarges it; both also appear in the palette, which is
the route that cannot be taken away. Switching sessions deliberately has no key: OpenCode
hassession.liston<leader>land closes this panel as a side effect of leaving, so a
key here would only shadow a binding that already works. The obvious choices for "leave
this" were both taken -escapeissession.interrupt, andqisdiff.close, whose
command carries noenabledpredicate and is therefore reachable at any time. Measured, of
the 167 binds in the host's keybind config.
toggleFullscreenexists only onPanelInput, which arrives inside the slot's render and
nowhere else -ui.panelis justopen,closeandcurrent- so the claim records the
function it was handed and the key drives that. -
The session panel has a way out. It did not have one, and a reader reported the
consequence. OpenCode has no key for closing a plugin panel: all fourpanels.close()
call sites in the TUI are side effects of something else - changing session, selecting a
terminal, opening the sidebar - so every route out of the panel was a DIFFERENT action
that happened to close it. Opening/pty-sessionstherefore left a reader with a panel
they could not leave, and the only remaining move was killing the terminal. Three exits
now exist: a palette entry,ctrl+y(the command's id is
opencode-pty.session-panel.close, so it can be moved), and a✕ closecontrol in the
panel header. The key is only live while a panel is open, because a binding that does
nothing the rest of the time teaches the reader to distrust the one time it matters. -
The panel's screen box fills the panel instead of claiming a row count. It computed
half ofrenderer.height- the TERMINAL's height - and asked for that many rows inside a
panel far smaller, so the box overflowed the session view rather than filling it; a
reader reported the panel ignoring the available length. It now grows, which is both
correct and what the host's own terminal pane does.panelScreenRowsis gone. -
An empty panel no longer draws an empty black rectangle. The framed screen is drawn
only when a session is selected. Next to the sentence explaining that the conversation
started nothing, a large empty frame read as a rendering failure rather than an absence.
It is read-only, and that is the SDK's ceiling rather than a choice.context.keymap
offers exactlylayer(),dispatch()andshortcuts(), so a plugin can bind named
commands and nothing else; there is no access to raw key events, and the host's own
terminal pane gets one through an internal TUI context a plugin does not receive. So
pty_writefrom free typing, scrolling the output and resizing are unreachable from a TUI
plugin on this version. What the panel adds over the dialog is that it is not modal, that
it is wider, and that it shows the processes of the conversation you are reading. -
The theme's six colour slots are read in one place instead of four. Three surfaces draw
with them, and three copies of a palette is three places for a rename to miss. -
The panel's output dialog reads that screen instead of the plain buffer. It asked
/api/sessions/:id/buffer/plain, which isBun.stripANSI(raw): the colour codes go and
the cursor movement goes with them, so a full-screen program's output arrived unpainted
with its layout gone - every repaint on its own line. The dialog now reads the screen
endpoint, which replays the same bytes through the same VT emulatorpty_screenuses.
Measured onprintf '%b' 'top\r\nsecond\r\n\e[3;7Hmoved': the plain buffer yields
moved, the screen yieldsmoved. The rows are kept as they are, trailing blank
rows included, so a line too wide for the terminal occupies two rows in the dialog
exactly as it does on the terminal.buffer/plainitself is untouched - it is the right
answer to "what bytes did the program write", andpty_readand the web UI both depend
on it. -
GET /api/sessions/:id/screenreturns the rendered screen - lines, cursor,
colour spans - for a session.buffer/plainanswers "what bytes did the program
write" and is unchanged: it is the ANSI-stripped byte stream, which is the right
answer to that question and whatpty_readdepends on. The new route answers
"what does it look like?", which that one cannot: the layout of a full-screen
program lives in the escape sequences, so stripping them leaves every repaint as
text on its own line. The web UI never needed this - it reconstructs the screen on
the client from the raw buffer - but a TUI plugin has no DOM and no renderer of
its own, so the server has to do the replay. It is the samerenderScreencall
pty_screenmakes, at the same geometry, and?cols/?rowsrender at another
size without resizing the session.
Changed
@opentui/core,@opentui/solid,solid-jsand@opencode/themeare optional
peer dependencies, at the floors@opencode/pluginitself declares. They are
also development dependencies, so the TUI contract is type-checked in CI. A host
with no TUI can still install this package.
Fixed
-
The poll stopped twitching the panel. Every poll tick handed the panel state a list the
server had just built - the same CONTENT, but a new array of new objects every time - and the
claim's render spread the whole state into its reactive scope, which tracks every field: a tick
that only moved the clock re-laid the panel out. Two halves, same rule: a list-note now carries
over the rows it already shows (a row whose fields did not move keeps its object identity, a
changed row is the only one re-handed), and the claim hands the view the store rather than a copy,
so a watcher re-renders only what its field moved. Measured as a state rule and red-proved by
name ("keeps the rows' identity..."). -
The send dialog's key chips fit a medium dialog. At 60 columns (the width
dialogWidth
hands a medium dialog) the chips row was longer than the dialog, and the reader measured the last
chip (Enter) running out at the edge - a wider test width had hidden it. The row wraps (the
host's own dialogs do, viaflexDrop), the hint moved to the footer, and a narrow-width render
asserts every label drawn inside the box. -
The console now scrolls the history the emulator was holding, and stops selling blank
rows as content./screenanswered with the visible screen only, so a line printed moments
ago left the panel's console for good - measured, the emulator HELD 103 scrollback rows for the
same session the/screenwas answering with 81 screen rows, and the web UI scrolled all the
way up through the full transcript. The route now takes?scrollback=<n>(default 0, so
pty_screenand the web's client keep their exact shape) and prepends the older rows, oldest
first, within the replay window; the response says how many it added. The panel asks for the
history. And the consumer drops the trailing blank rows a screen has BY SHAPE: a fresh 81-row
run half-printed produced a console full of blanks with a scrollbar the reader measured
scrolling through before any output filled it. -
The console stays where the reader scrolled it, and the texts speak one language. A reader
who scrolled up in a PTY console was dragged back to the bottom by the next poll, because the
scrollbox pinned itself unconditionally. The pin is now a decision (scroll-keeper.ts): it holds
only while the reader is at the bottom, releases while they are away - the view keeps its rows -
and resumes when they return. A fresh selection arms it, so a session the reader has not read
starts at its bottom like any screen they never scrolled. The host's own transcript is the
reference for the same rule. The run timer readsendedAtwhere a record has noexitAt, which
is what a 19-second build needed to stop claiming it had run 17 hours. And the session panel's
German leftovers (N Sessionen… (aufklappen),… und N weitere in der Sidebar) are English,
like the sidebar next to them already was. -
The send dialog survived the gesture that opened it, and grew the keys it was missing. The
dialog asked for on the panel header's mouse-down was dead on arrival: a click delivers a
mouse-down and a mouse-up, and by release time the host's dialog backdrop sat under the pointer,
whose mouse-up closes the dialog - so the field only stayed open while the button was held.
Reported by a reader, reproduced from the host's own backdrop handler
(packages/tui/src/ui/dialog.tsxin the opencode checkout). The opener now fires on mouse-up -
mousedown-only stays for the togglers, and a one-shot open belongs to the release. The dialog
itself is now the plugin's own rather than the SDK prompt, because the SDK one draws only a title
and a field: it has a✕ closethe pointer can click,enter submit · esc closefor the
keyboard, and a row of key chips (Ctrl+C,Ctrl+D,Ctrl+Z,Esc,Tab,Enter) that send
their control byte at once, without the typed line -writeInputposts bytes, so the chips are
data, and the ending key is data the line discipline reads as enter. The dialog settles once and
closes after, so a dismissal and a submission cannot interleave; the action keeps a blank-line
guard at the seam because a whitespace answer is neither a key nor a command. -
A row clicked in the sidebar now shows that process, even when its conversation is another
project's. The sidebar lists PTYs from every project, while a panel belongs to ONE session and
listed only that session's processes - so a row whose conversation this project has never opened
showed nothing, in every tab. Measured: sevenLizenz-Hashes erzeugenruns whose parent was a
davx5 conversation from the day before, listed by the sidebar and by no panel at all. A click now
scopes the panel to the conversation the row names - the parent id needs no session to exist, it is
the key the PTY was recorded under - and the line above the console says which process is on
screen: title, date, state, and the conversation that started it, falling back to the parent id
when the host cannot name it. Opening the panel from the palette clears that scope, so it means
this conversation again. -
Sidebar rows and group headings wrapped in a narrow sidebar, splitting a group in two. At ~36
columns chevron (2) + title (22) + meta (18) came to 42, and a text wraps by default: the heading
drew over two lines. The title is now the element that shrinks and never wraps, the state and the
controls are fixed, and the state is its own element rather than the tail of one string - a row cut
from its end lost123456Lto1below 30 columns. (Committed one commit before this entry was
written; the code and its tests are inbd2095e.) -
The sidebar asks the server half where it is listening, instead of deriving it. The origin
record is filed under the location the server was STARTED for, and one long-lived
opencode serve --servicemakes that unknowable: it hosts the plugin for every project the
user opens, so the record sits under the directory that process was started in while the panel
sits in a session somewhere else. Measured while chasing it - the record said/var/home/j
while the panel was in.../homelab/openwrt-installer-lab, with 376 sessions (48 of them
failed) behind a server that answered/health, and the panel read "not running". A plugin can
register an RPC method its TUI half calls (@opencode/plugin/rpc,context.client.rpc), so
this plugin now answers one question - where is the server - read off the live server object.
That needs no key and cannot be stale. The record is still tried next, since that is what a host
without RPC has, and a panel that can name neither still takes any healthy record, logged,
because a list from another instance beats no list at all. Starting a server stays where it was:
only a user who expanded the panel causes one. -
A sidebar store written before a field existed took the whole section down. The host's
storepersists an object and hands it back exactly as it was:initialis used only when
nothing was stored, and is never merged into what comes back. So every preference added after
a reader's first run isundefineduntil something writes it - andfilterwas read as a
string, reachednormalizeQuery, and threwundefined is not an object (evaluating 'query.trim')inside thesidebar.contentslot on every render, which is why dismissing the
crash panel brought it straight back. The preferences are now repaired once per setup
(fillMissingPrefs), which also replaces a stored value of the wrong type, and covers
collapsedGroupsfrom the same kind of store. -
The sidebar reported "not running" next to a healthy server, so its footer stayed empty.
A PTY server files ONE origin record, under the location it was STARTED for, while the host
hands a plugin the SESSION's location (packages/tui/src/routes/session/index.tsxsets it
fromsession().location). A server thatautostartstarted is filed under the app's default
location, so as soon as a session was moved -/cd, or opencode launched in one directory
with a session in a project below it - the two keys differed: the lookup matched records on
the directory exactly, found nothing, and the panel drew "not running" with no sessions. The
footer only draws when there is something to report, which is why it vanished with it.
Measured on a running 2.0.29:findProjectOrigin("/var/home/j")answered
http://127.0.0.1:4200while the panel's own key returned null, with 376 sessions
(48 of them failed - the footer said nothing) behind it. The panel now tries the session's
location first and the app's default second, so a moved session still reads its own project's
server rather than another one.