Port of handlers/run.ts, run/run.ts and run/noninteractive.ts: text and
--format json output, permissions and forms auto-rejected (or approved
with --auto), -f attachments typed by the mime-types table, stdin and
words after --, -w worktrees, titles and archived sessions. Events and
messages stay JSON so JSON lines pass server fields through unchanged.
P-CLI scenarios in parity/scenarios/C.10 compare it with the TS run.
These commands need the server, the installer, npm and Host.resolve,
which exist only in TypeScript (Q4). opencode-rs now execs
OPENCODE_TS_BIN, else opencode on PATH, with its own arguments, so the
TS binary keeps the pid, stdio, signals and exit status. Remote access
gets enable_remote (TS service set remote true) and tunnel_hostname,
which reads the OpenTunnel XDG storage, for C.8 and C.9.
Local now resolves the routed location; the connect requests use it. The MCP test expects the integration dialog for a server that signs in through an integration.
P-COMP fixtures for the list, accounts, methods, key, form and OAuth views, and P-REQ tests for every connect flow, the account actions and the form steps over a fixture server, with a URL sink instead of a browser. The form list scrolls from row heights, since rows rebuilt in a render have no layout yet.
Ports dialog-integration.tsx: the integration list, accounts (activate, rename, remove), the method picker, API keys, OAuth in the browser or with a pasted code, external and command connects, and the method forms. /connect, the model dialog, the prompt without a model and the MCP sign-in now open it.
Port C.14: merge NO_PROXY with the loopback hosts, run as the SSH askpass
helper when OPENCODE_SSH_ASKPASS_PORT is set, install a log facade logger
that writes the TS key=value format to <data>/log (with trim, --log-level,
--print-logs, and OTLP log export), and bound signal-initiated shutdown to
10 s with SIGHUP as SIGTERM under a terminal.
Panics and the service connection notes now go through the same logger.
Three P-APP scenarios: the last turn selected from the source dialog and loaded again after a turn, the base branch picker over a repository's branches, and the shortcuts dialog with the file menu. The harness gains a right-click step, and repo.ts also returns the repository's branches.
The diff source dialog, the base branch picker, the shortcuts dialog and the right-click file menu fill E.15a's stubs (DLG46 to DLG49). In turn mode the viewer loads the last turn again when its session goes from running to idle, and a docked panel keeps its focus styling while a dialog is open, as TS does.
Ports packages/cli/src/commands/handlers/session/*.ts: the list with its less pager on a terminal, the export picker on stderr through the prompt kit, and the import that replaces the file's location in place. P-CLI compares 14 cases with TS on the fake server.
The updater stays with the CLI: features::update_notification::Source is what D.2 provides through set_source, and until then there is no /update and no notice, as in TS without an updater. With a source, client notices and the installation.* events show the home notice; skip remembers it in update-notifications. The dialog checks, installs, and restarts as DialogUpdate does, proven against a fake updater. The dialog footer now shows an action without a key or command, as TS does, and the P-COMP helper compares the footer band too.
DialogHighlights shows the embedded OPENCODE_RELEASE_HIGHLIGHTS, as TS stable builds do; /highlights is registered only when there are some. Once connected, an idle home claims the version in the highlights storage under its lock, ported from util/highlights.ts with its tests.
/pair and /web read GET /api/info and POST /api/pair, then show the connect links, the localhost link, and a QR code of the first link as renderUnicodeCompact draws it (byte mode, level L, smallest version). Proven against a test transport only, since a pairing creates a code on the server.
/plugins lists the TUI plugins from the registry and the server plugins from GET /api/plugin. Enter toggles a TUI plugin through set_active and remounts the route, space or Enter opens an error, ctrl+u updates and ctrl+r checks packages, ctrl+a shows the built-ins. A configured TS plugin is listed as skipped with the reason as its error. The error details view gains the source path line, and select actions gain hidden_when for row-dependent actions.
Settings → Theme and /themes open DialogThemeList. Moving or filtering previews the theme, Escape restores the opening one, and Enter writes theme.name. The dialog is built again in each previewed theme, as TS restyles it, through a select restore of the selection and scroll.
session.queued_prompts read the store in its enabled condition, which
the reentry assert caught under a keymap query. It reads the count the
dock last updated instead (carbon-5).
Leaving a missing location session, keymap queries under the store
lock, permission reads after a reconnect, and focus under a dialog
(carbon-2, carbon-5, carbon-6).
Permission, SessionForms and HomeForms read each owner once per mount,
so a request created while the event stream was down never showed. They
now read again on a full sync, which a reconnect brings. Reading on
every sync instead loops when a read fails with SessionNotFoundError.
A permission or form that closed under an open dialog focused the prompt
behind the dialog. The prompt now takes the keys when the dialog closes,
through the new Dialogs::refocus (carbon-6).
Keymap queries evaluate every command's conditions, and has_sessions, the
prompt's running, the session actions' reverted and child, and
Local::route_fn locked the store. A query under Data::read then hung the
UI thread. Tui::sync now caches the routed session and whether sessions
exist, and the prompt caches running at each refresh (carbon-5).
LocationMissing, the scroll controls and the transcript dropped their
Disposer handles, which keeps the layers registered. After a missing
location session, Enter on home opened "Choose directory", and session
commands stayed in the palette. Each view now disposes its layers when it
replaces or drops them (carbon-2).
The store mutex is not reentrant, so a read under a read hung the UI thread
until the test timeout. Debug builds now track the stores each thread
holds and panic with a stack trace instead (carbon-5).
Theme::decrease and increase matched tokens by address, so a Color copied
to a local never shifted and hover and badge surfaces kept the raised
background. A copy now shifts by the tones of the tokens with its value,
and stays unchanged when they disagree (carbon-8).
P-FILE under contention: parity/oracle/MS1-files.ts writes with the
TypeScript TUI's own persistence functions while Rust writes, and a
reader checks every state of both files.
Under real contention a trim by rename dropped a line the TypeScript TUI
was appending without the lock: Node can open the old file before the
rename and write after it. Saves now only append, as TypeScript does
below the limit, and the load trims the file to the newest 50.
Covers carbon-3 (a project-local agent survives a submit, acknowledged
commits clear the drafts) and carbon-7 (pins and history lines another
client wrote survive, early prompts are kept, deletes prune pins).
Local takes its models, providers, agents, integrations, and configured
model from the store for the current location, and follows it when the
TUI moves. Acknowledged agent and model commits clear their drafts, and
session.deleted drops drafts and pins, as context/local.tsx does
(carbon-3).
Pins and history entries are written in order on one worker, under the
file's Flock lock, from what the file holds then, with uniquely named
atomic rewrites. Pins and lines the TypeScript TUI wrote since survive,
and prompts submitted before the history loads are kept (carbon-7).
TestApp tests over a recording fixture and the clipboard sink: compact pastes and their expansion, clipboard images and text, read errors, pasted paths and SVGs, previews and the image dialog, copy, and the stash dialog. P-FILE runs the real PromptStashProvider on the Rust stash file and back.
A mouse selection copied while the prompt is focused expands each [Pasted ~N lines] label to its text, as the TS prompt's getClipboardText does. Drops parts::files, which the attachment path replaced.
The P-APP harness gains a bracketed paste step on both sides. E.4/paste collapses a three-line paste, expands it by pasting it again, and strips ANSI from a short paste; every checkpoint equals TS.
Long pastes collapse into [Pasted ~N lines] parts on the E.3 extmark map, pasted file paths and clipboard images attach as [Image N] or [PDF N], and the prompt stash keeps prompt-stash.jsonl in step with the TS TUI. Adds the image preview and stash dialogs, and opens the preview from transcript images.
File times come from a coarse clock that can trail Date.now(), so the load's
rewrite is now told by a changed mtime rather than one past the mount time.
The frecency appends land in any order, so they are compared as a set. A wait
that runs out now names itself on stderr, where a failing test shows it.
Each append ran on its own blocking task, so two quick submits could reach
prompt-history.jsonl in reverse order, and one made before the load finished
was dropped. Entries now queue in submit order, each task appends the whole
queue while it holds the history, and whichever task runs first loads the
file. prompt.rs caught the reversed file on a loaded machine.
The TypeScript history and frecency providers rewrite the file on load without
awaiting it. Under load, an append made after the load could land first and be
truncated by the rewrite. The oracles now wait for the rewrite, by mtime,
before running the ops. This is a race in the TS client itself.
The E.2 and E.3 oracles gave the TypeScript appends a fixed 50 ms and the load
1 s. They now wait, up to 30 s, until the file ends with the appended lines,
read through a fresh BunFile each time, since a reused one can keep a stale
size.
ses_a's inbox, permission and form reads answered SessionNotFoundError, as for
a session not created yet. When one landed after the test set ses_a running,
the store marked ses_a deleted and dropped its status, so 'esc interrupt' never
showed.
Each tabs update wrote the file on its own blocking task, and the tasks could
run out of order: a tab's title, set once its session read landed, could reach
the file before the tab itself, and was then lost. Each task now writes every
pending update, in order, while it holds the queue. tabs.rs caught it on a
loaded machine: ses_b stayed untitled in tabs.json for 30 s.
tabs, navigate, prompt and complete failed on a loaded machine. Waits now share
a 30 s ceiling (tests/support/wait.rs) and return once their condition holds;
fixed sleeps before assertions became waits for the asserted state.
- navigate: a page-up near the top moves two frames later, and when the older
page arrived before the first render the move landed on the next key's
frame. press and dispatch now render until no frame is pending.
- tabs: wait for both stored titles, not just two tabs.
- complete: wait for the search for 'ma', not only its results.