feat(run): style browser_execute in headless run mode like bash#73
Merged
Conversation
Headless �code run rendered browser_execute calls with the default gear icon and duplicated tool name (�rowser_execute browser_execute). Mirror the existing TUI BrowserExecute component: REPL-style > icon, description as title, prompted code block (> first line, continuations), streamed output, and a completion line with timing. Mirrors the bash/shell handling in the same file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
In headless
bcode run "..."mode,browser_executetool calls render with the default gear icon and a duplicated tool name:The TUI path (
session/index.tsx) already has a customBrowserExecutecomponent modeled onShell, but the run-mode renderer (cli/cmd/run/tool.ts) had no entry for it and fell through tofallbackInline/fallbackStart.Change
Adds a
browser_executeentry toTOOL_RULESinpackages/opencode/src/cli/cmd/run/tool.ts, mirroring the existingbashrule and the TUIBrowserExecutecomponent:run→ icon>, title =description ?? "Browser execute", block mode, body = streamed output on completion (parallel torunBash).scroll.start→# <description>followed by a prompted code block (>first line,continuations), matching the TUI renderer.scroll.progress→ streamed console output, ANSI-stripped and trimmed.scroll.final→browser_execute completed [· <time>].permission→ icon#, title = description, lines = prompted code.Type plumbing: imports
BrowserExecuteToolas a type-only import, addsbrowser_execute: typeof BrowserExecuteTooltoToolDefs.Before / after
Before:
After:
Test
Verified locally on Windows by running:
Output renders with the new styling on
browser_executecalls and is unchanged on every other tool.Notes
packages/opencode/src/). Will add a corresponding row tomemory/browsercode/EXCEPTIONS.mdin the agent repo alongside the existing TUIbrowser_executeMatch-block entry.bun typecheckfor this file passes; pre-existing missing-deps errors inpackages/core/(immer, ai-sdk/*) are unrelated to this diff.Summary by cubic
Styles
browser_executein headlessbcode runto match the bash/TUI experience. Adds REPL-style prompt, description-based title, streamed output, and a completion line with timing.browser_executerule inpackages/opencode/src/cli/cmd/run/tool.ts, mirroringbash/TUI.>icon, title = description or "Browser execute", block mode, outputs on completion.# <description>and prompted code; progress streams trimmed, ANSI-stripped output; final showsbrowser_execute completed · <time>.#+ prompted code; added type-onlyBrowserExecuteToolimport andToolDefsentry.Written for commit 1a00390. Summary will update on new commits. Review in cubic