Commit graph

21984 commits

Author SHA1 Message Date
Simon Klee
08f517b0ee
feat(cli-rs): merge adjacent text, reasoning, and tool input deltas
V2Event's Event impl now folds adjacent deltas of one part (session, message, ordinal) or one tool call, so a 10 ms batch of streamed deltas reaches the store as one edit.
2026-11-04 18:48:52 +01:00
Simon Klee
e8e040d5e1
docs(cli-rs): design the store core and its change tracking
F.7 design note: one locked state behind a cloneable handle, eager spawned reads, and revisioned change sets per session and message for the UI.
2026-11-04 18:48:52 +01:00
Simon Klee
d6a1d29a68
fix(cli-rs): tag message unions whose members are unions
Session.Message.Info has a Compaction member that is itself a union tagged by status, so the generator fell back to an untagged enum. serde then decoded an assistant message as the first member that fits (AgentSelected). Nested unions now join the outer tag when all their objects share one value.
2026-11-04 18:48:51 +01:00
Simon Klee
5c873ff272
feat(cli-rs): add the P-CLI and P-PTY parity runners
A fake server serves a scenario's route table and logs requests. P-CLI runs the TS CLI from source and opencode-rs against it in isolated homes and compares exit code, stdout, stderr and requests. P-PTY runs both under a PTY through OpenTUI's embedded terminal and compares the OSC log and screen checkpoints.
2026-11-04 18:47:33 +01:00
Simon Klee
c909f4e6dd
feat(cli-rs): share one diff gutter across a patch's hunks
G.10 added Diff::gutter and sizes unified diffs to their lines. diff::view
now gives every hunk PatchDiff's gutter (padding 1 + gutter_padding, digits
of the largest line number) and drops the automatic-basis workaround. The
first hunk matches TypeScript, so the V05a deviation goes.
2026-11-04 18:41:02 +01:00
Simon Klee
64721408d6
feat(cli-rs): set TextPart's Markdown options on the widget
markdown::view now takes conceal and streaming as TextPart passes them,
draws grid tables with one column of cell padding and Core's conceal-scope
border color, and applies a CodeBlockRenderers registry for the LaTeX and
Mermaid plugins. New P-COMP fixtures cover raw mode and a table; the rows
that still differ are colors from MarkdownColors (V03).
2026-11-04 18:41:02 +01:00
Simon Klee
a9da6109c0
test(cli-rs): narrow the V03 exemptions to what G.3 still differs
G.3 changed the Markdown widget to '-' bullets and unpadded code blocks, so
those rows match TypeScript now and the suite failed on the stale exemption.
The remaining rows differ only in color; the fence rows are H06 queries.
2026-11-04 18:41:02 +01:00
Simon Klee
0e36cd440c
feat(cli-rs): port tool summaries and display helpers
tool_inline_info ports toolInlineInfo over the generated SessionMessageAssistantTool, with the tool-display, todo, and toolPath helpers the TUI's tool views use. A P-ORACLE runs 60 parts built with the TUI's canonicalToolPart fixture through both; OPENCODE_TOOL_PARTS compares parts recorded from real sessions.
2026-11-04 18:34:12 +01:00
Simon Klee
7baefa3f36
fix(cli-rs): keep JSON key order in generated records
Records decoded into BTreeMap, which sorts keys. The TUI prints tool inputs in wire order (primitiveInputSummary, the fallback JSON title), so records are now IndexMap; serde_json already preserves order.
2026-11-04 18:34:12 +01:00
Simon Klee
bd57751d15
feat(cli-rs): wrap Markdown, code, and diff widgets in the TUI theme
Port generateSyntax as code::syntax_theme, proven scope for scope against the TS function for four theme views. Add the transcript's Markdown, numbered code, and PatchDiff wrappers on the current opentui-rust widgets, compared cell by cell with Core renders of a small corpus. Rows where the widgets still differ (conceal and Markdown layout, highlight queries, the diff gutter) are exempted per deviation file, and the test fails once a row matches.
2026-11-04 18:32:57 +01:00
Simon Klee
c1c064ba63
fix(cli-rs): log a discovered service's version mismatch only
A Rust client is always another version than the service it finds, so
the warning went to stderr on every run. Per O-22 it now goes to the log
under --print-logs; --server keeps the TS warning on stderr.
2026-11-04 18:32:29 +01:00
Simon Klee
782c5a8701
feat(cli-rs): connect to --server or a discovered service
Port ServerConnection.resolve, the /api/info probe and its decide()
classification, and the connect error texts. Discovery tries the
OPENCODE_CHANNEL registration, then service.json, then every other
service*.json newest first (O-21), so the client finds a channel
build's service without flags. A mismatched version warns and is
never replaced; standalone and ensure wait for F.9.
2026-11-04 18:30:47 +01:00
Simon Klee
d2ce72d83d
test(cli-rs): prove the TUI keymap against @opentui/keymap
P-ORACLE: the harness runs 2,733 key sequences through the TypeScript Keymap.Provider for every default binding and an override corpus; the Rust test replays the same bytes through the input parser into TuiKeymap. The 16 cases that differ depend on the parser's legacy linefeed and keypad Enter reports (G.9).
2026-11-04 18:25:38 +01:00
Simon Klee
8a1b46b47d
feat(cli-rs): add the TUI keymap layer and command registry
Keybinds resolves the keybinds config as TuiKeybind.parse and TuiConfig.resolve do. TuiKeymap installs the Provider's addons on opentui::keymap and adds layers, the mode stack, dispatch input, the timed leader, and shortcut formatting.
2026-11-04 18:25:35 +01:00
Simon Klee
5bfa4b6c7f
feat(cli-rs): generate the 244 TUI keybind definitions
script/gen/keybinds.ts writes each name, its default as JSON text, and its description from TuiKeybind.Definitions.
2026-11-04 18:25:27 +01:00
Simon Klee
7e2aee9820
docs(cli-rs): design the TUI keymap layer (U.2)
The keymap layer on opentui::keymap: generated keybind names, config resolution, the Provider's addons, layers, modes, and the P-ORACLE against @opentui/keymap.
2026-11-04 18:25:27 +01:00
Simon Klee
aa1f920686
test(cli-rs): prove local files interoperate with the TypeScript client
A Bun helper drives the TypeScript Flock, channel and registration functions, and ServiceConfig; the Rust interop test contends for one lock from both sides and compares the service config bytes and validation messages. An example prints the registration discovery resolves to.
2026-11-04 18:25:02 +01:00
Simon Klee
25db8f9586
feat(cli-rs): add local paths, channel, lock, registration, service config
Ports the XDG roots, channel naming, the Flock directory lock, the service registration file, and the service config file with its legacy migrations, so the Rust client shares these files with the TypeScript client.
2026-11-04 18:25:02 +01:00
Simon Klee
1349acd672
feat(cli-rs): resolve themes and track the theme state
Ports the V2 schema check, expansion, and resolver, both V1 migrations, the system theme, custom theme discovery, and the TUI theme state (mode, lock, palette, fallback). The state queues config writes, palette probes, and theme errors for its owner.

parity/oracle/U.1-themes.ts records the TypeScript tokens of every built-in theme in every mode and surface, the system theme over six palettes, and fifteen broken themes; tests/theme_oracle.rs matches all of them.
2026-11-04 18:23:05 +01:00
Simon Klee
98141f92f7
feat(cli-rs): generate the built-in theme table
script/gen/themes.ts writes every built-in theme as the V2 document the TypeScript TUI resolves: V1 themes migrated by both migrations (current and new-designs), plus opencode and opencode2. The Rust resolver starts from the same documents.
2026-11-04 18:22:46 +01:00
Simon Klee
0f63e545d7
chore(cli-rs): format the API generator and type the oracle's fetch
Prettier over script/gen/api.ts and script/rust; the oracle's fake fetch no
longer casts to typeof fetch, so bun check passes. Output is unchanged.
2026-11-04 18:20:48 +01:00
Simon Klee
b826557733
test(cli-rs): decode the TUI's reads against the running service
An opt-in live test (OPENCODE_LIVE=1) reads through the generated client from
the service script/live.sh uses: info, sessions, messages, inbox, forms,
permissions, location collections, and the event stream. It skips
experimental.session.stats, which took the shared service down unbounded.
2026-11-04 18:20:48 +01:00
Simon Klee
34e9ec7d47
test(cli-rs): prove API requests and decoding against the TS client
A P-ORACLE fixture records the requests the TypeScript Promise client builds;
the generated Rust client must build the same ones, and query::append must
match appendQuery. Unit tests cover tagged unions (known, rpc.*, unknown),
literal enums, double options, declared errors, binary bodies, auth, and
the event stream through F.3's SSE reader.
2026-11-04 18:20:48 +01:00
Simon Klee
a477234497
feat(cli-rs): share one type for equal anonymous API shapes
Every endpoint's location query decoded into its own struct; equal anonymous
objects and unions now share one, and the location query is LocationQueryInput.
2026-11-04 18:20:48 +01:00
Simon Klee
cc409d1fcf
feat(cli-rs): generate the Rust API client from ClientApi
script/gen/api.ts compiles ClientApi with the Promise client's options and emits
types and one method per endpoint (166) into crates/api/src/generated. The
request core, errors, query encoding, and the reqwest transport are written
by hand. Tagged unions decode through a generated Deserialize that keeps
unknown members and routes rpc.* events.
2026-11-04 18:20:48 +01:00
Simon Klee
6954ec9bf2
docs(cli-rs): add the F.2 API type mapping note
How script/gen/api.ts maps ClientApi schemas to Rust types, unions, and methods.
2026-11-04 18:20:48 +01:00
Simon Klee
267c1ff412
chore(cli-rs): declare effect for the command dump
script/gen/commands.ts imports effect; without the dev dependency the package typecheck cannot resolve it.
2026-11-04 18:19:46 +01:00
Simon Klee
e0923a565a
docs(cli-rs): record the command tree deviations
Help and completion layout (Q12 b), usage error output, and the deferred --wizard (O-11).
2026-11-04 18:19:21 +01:00
Simon Klee
01ab034b56
feat(cli-rs): add the command tree
All 48 commands of the TypeScript CLI with clap derive, proven against the dumped Spec tree. A pre-pass and a post-parse check keep the Effect CLI behaviors scripts see: --no-<flag>, boolean literals, repeated flags, k=v values, -w without a following value, the scope of --standalone and --server, and root flags before a subcommand. Help, version, completions for six shells, exit code 1 on usage errors, and stdout that ignores EPIPE. Handlers are stubs that name their step; the root command reports that the TUI is not built yet.
2026-11-04 18:19:21 +01:00
Simon Klee
ad5c8910e0
feat(cli-rs): dump the TypeScript command tree
script/gen/commands.ts writes the Spec tree of packages/cli/src/commands/commands.ts to crates/cli/tests/fixtures/commands.json: names, aliases, descriptions, arguments, and flags with types, bounds, and defaults. The Rust tree test compares against it.
2026-11-04 18:19:21 +01:00
Simon Klee
73e4842f35
docs(cli-rs): design the command tree
C.0 design note: clap derive tree proven against a dump of the TypeScript Spec tree, and the Effect CLI parsing behaviors kept.
2026-11-04 18:19:21 +01:00
Simon Klee
a067e063aa
feat(cli-rs): compare TestApp captures with cell fixtures
opencode-parity loads P-COMP fixtures, compares a capture cell by cell, and reports each differing row with markers plus the fields of each differing cell. Tests cover byte-exact reformatting, an injected one-cell change, and an opentui-rust box matching the TypeScript render.
2026-11-04 18:15:42 +01:00
Simon Klee
20b0af8827
feat(cli-rs): dump TUI component cells to P-COMP fixtures
renderComponent renders a TUI component in createTestRenderer at a fixed size and theme, inside the TUI providers or bare, and writes its cells through the same native resolved-chars call opentui-rust's Capture uses. bun run fixtures now also runs parity/component scripts.
2026-11-04 18:15:40 +01:00
Simon Klee
e812746abe
feat(cli-rs): add the WebSocket helper
Build socket URLs as the PTY and client MCP clients do (path prefix and base query kept, URLSearchParams.set order, ws or wss), with an optional ticket parameter, and open them with handshake headers.
2026-11-04 18:04:23 +01:00
Simon Klee
e5800a0de2
feat(cli-rs): share event streams and run the connection loop
SharedEvents ports shared-events.ts: one upstream per subscriber set, a types filter, the latest server.connected for late subscribers, and a 4,096-event cap per subscriber. connect() ports createClientConnection: server.connected first, the 2 s connect and 45 s idle limits, resync, 1 s reconnect, and 10 ms batches with adjacent deltas merged on a bounded queue. Both are generic over an Event trait. An opt-in live test (OPENCODE_LIVE=1) reads the running service.
2026-11-04 18:04:18 +01:00
Simon Klee
00695b7119
feat(cli-rs): mint time-sortable identifiers
Port Identifier.create with session, message, and part prefixes. A P-ORACLE script records the time prefixes TypeScript mints for a call sequence, counter restarts and overflow included, and the Rust test replays it.
2026-11-04 18:04:13 +01:00
Simon Klee
3d6ee48b53
feat(cli-rs): add the SSE reader
Port the generated TypeScript client's SSE reader: blank-line blocks, joined data lines, CRLF and CR normalization across chunks, streaming UTF-8 decoding, and the 16 MiB limit counted in UTF-16 units. Every chunk reports activity, keepalive comments included.
2026-11-04 18:04:08 +01:00
Simon Klee
271fc7c26d
feat(cli-rs): scaffold the Rust client workspace
Add packages/cli-rs: a Cargo workspace with the 14 crates of the plan,
module stubs for api, local, service, store, and ui, and the expected
third-party crates in [workspace.dependencies]. opentui is a path
dependency on the local opentui-rust checkout, linked statically.

script/opentui-lib.sh copies native artifacts whose header matches the
bindings into ~/.cache/opencode-rs/opentui, where .cargo/config.toml
points OPENTUI_LIB_DIR. opencode-rs --version runs; script/live.sh
runs it against the elected background service.
2026-11-04 17:52:34 +01:00
usrnk1
8568952e77
feat(app): add return sessions to the first unread message experiment (#61663) 2026-11-04 14:03:26 +00:00
usrnk1
5a750e64a2
feat(session-ui): reveal token throughput on response footer hover (#61646) 2026-11-04 13:38:14 +01:00
usrnk1
b9d0982b44
test(app): keep the bulk tab close case off the draft navigation race (#61642) 2026-11-04 13:25:18 +01:00
usrnk1
7864a94152
feat(app): add close other tabs and tabs after from the tab menu (#61631) 2026-11-04 11:24:00 +00:00
Adam
b3fd4a75fe
feat(core): refresh Console config before prompts and add a console.poll server option (#61583) 2026-11-04 04:29:54 -06:00
Adam
ce53f18a1b
feat(server): let embedders supply the fetch for OpenCode's HTTP and MCP requests (#61582) 2026-11-04 04:13:45 -06:00
Adam
baeebc2f93
feat(core): add a websearch.use policy action (#61557) 2026-11-04 04:13:25 -06:00
Aiden Cline
ffe6fed583
fix(cli): wait for background jobs in opencode run (#60699) 2026-11-04 01:20:08 -06:00
Luke Parker
59e95cc539
perf(app): stop restyling the side panel on every move of a resize drag (#61560) 2026-11-04 00:35:27 -06:00
Luke Parker
ba084e62d8
perf(ui): run the spinner and the text shimmer on the compositor (#61562) 2026-11-04 00:30:30 -06:00
Aiden Cline
d85283496f
fix(cli): stop opencode run from leaving a background service running (#61564) 2026-11-04 00:05:12 -06:00
Andras Lassu
55276f2108
fix(mcp): send logo_uri on dynamic client registration (#59031)
Co-authored-by: DS <78942835+Tarquinen@users.noreply.github.com>
2026-11-03 23:53:13 -05:00