Skip to content

v0.6.0

Choose a tag to compare

@lenucksi lenucksi released this 15 Oct 21:19
· 106 commits to local/modernized since this release

[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, so POLL_MS is 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 were exit 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. So sidebar.content draws
    one row per RUNNING session - or one dim line saying nothing is running - and a new
    sidebar.footer slot carries the archive's size. Clicking that line expands the
    finished runs that FAILED, newest first, capped at 10. An exit 0 is 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-filter asks for a
    query through ui.dialog.prompt and 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 on PTYSessionInfo - the same move TimeOrdered was -
    because the panel carries a trimmed shape across a process boundary and its args is
    optional, so the haystack tolerates a session with no command line at all. The header reads
    N of 200 while 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, so 0 of 200 and "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.get and falling back to Session <id> - or Ungrouped for 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,
    and stickyScroll together with stickyStart: '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/v2 now also resolves /tui. OpenCode builds the TUI specifier from
    the configured plugin name, so the documented V2 entry was probed as
    opencode-pty/v2/tui and 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/tui is now a declared export. The exports wildcards did not reach
    it - ./* matches one path segment and pointed at dist/src/tui.js rather than
    the directory's index.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; only jsx-runtime is used.

  • The session list is ordered by exitAt, in the browser as well as the sidebar.
    endedAt is lost across a restart - that is the reason exitAt exists - 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. sortSessionsByTime now prefers exitAt, then endedAt, then
    createdAt.

  • One duration formatter with two presets. formatDurationMs is the implementation;
    compact gives 2h 04m for the web sidebar and precise gives 1m 05s for 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
    than 0s, because 0s claimed 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.panel for 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 by parentSessionId for
    the same reason - so the panel claims session.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 nothing bun update can 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 outcome minimumReleaseAge
    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.
    publishedAt receives 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.

  • seroval is overridden past a critical advisory that solid-js pins into the lockfile.
    seroval@1.5.6 carries GHSA-mv8w… (thenable assimilation, critical) plus a high one, and
    solid-js@1.9.15 pins ~1.5.4 for both seroval and seroval-plugins. Only
    solid-js/web/dist/server.js imports it - Solid's SSR build, and nothing in a terminal
    plugin renders HTML - so both bun audit and Aislop's own
    security/vulnerable-dependency rule were failing on code this package cannot reach.
    Narrowing bun audit to --production was 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-plugins declares seroval as a peer of ^1.0, so 1.6.8 is a version its own
    package asks a consumer for. bun audit now reports no vulnerabilities across 430
    packages. Same shape and same expiry as the existing @babel/core override:
    test/tui-package.test.ts pins both values, and the override goes when solid-js ships 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.onOpen existed, was wired to a row, and no row ever
    called it. Only the remove glyph carried a mouse handler, so onOpen was 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 - and q, the quit key of every full-screen program, belongs
    to OpenCode's diff.close, whose command carries no enabled predicate and is therefore
    live at all times. ui.dialog.prompt is the input the SDK genuinely offers, so ⌨ send in
    the header and f4 open it, and the line is written to /api/sessions/:id/input with a
    newline. top is fully usable this way. It is a command line, not a terminal: arrow keys
    and raw control characters remain out of reach, and htop needs 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: top given 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+y closes the panel and f3 enlarges it; both also appear in the palette, which is
    the route that cannot be taken away. Switching sessions deliberately has no key: OpenCode
    has session.list on <leader>l and 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 - escape is session.interrupt, and q is diff.close, whose
    command carries no enabled predicate and is therefore reachable at any time. Measured, of
    the 167 binds in the host's keybind config.
    toggleFullscreen exists only on PanelInput, which arrives inside the slot's render and
    nowhere else - ui.panel is just open, close and current - 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 four panels.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-sessions therefore 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 ✕ close control 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 of renderer.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. panelScreenRows is 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 exactly layer(), dispatch() and shortcuts(), 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_write from 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 is Bun.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 emulator pty_screen uses.
    Measured on printf '%b' 'top\r\nsecond\r\n\e[3;7Hmoved': the plain buffer yields
    moved, the screen yields moved. 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/plain itself is untouched - it is the right
    answer to "what bytes did the program write", and pty_read and the web UI both depend
    on it.

  • GET /api/sessions/:id/screen returns the rendered screen - lines, cursor,
    colour spans - for a session. buffer/plain answers "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 what pty_read depends 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 same renderScreen call
    pty_screen makes, at the same geometry, and ?cols/?rows render at another
    size without resizing the session.

Changed

  • @opentui/core, @opentui/solid, solid-js and @opencode/theme are optional
    peer dependencies, at the floors @opencode/plugin itself 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, via flexDrop), 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.
    /screen answered 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 /screen was 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_screen and 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 reads endedAt where a record has no exitAt, 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.tsx in 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 ✕ close the pointer can click, enter submit · esc close for 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 - writeInput posts 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: seven Lizenz-Hashes erzeugen runs 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 lost 123456L to 1 below 30 columns. (Committed one commit before this entry was
    written; the code and its tests are in bd2095e.)

  • 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 --service makes 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
    store persists an object and hands it back exactly as it was: initial is used only when
    nothing was stored, and is never merged into what comes back. So every preference added after
    a reader's first run is undefined until something writes it - and filter was read as a
    string, reached normalizeQuery, and threw undefined is not an object (evaluating 'query.trim') inside the sidebar.content slot 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
    collapsedGroups from 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.tsx sets it
    from session().location). A server that autostart started 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:4200 while 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.