Skip to content

feat(run): style browser_execute in headless run mode like bash#73

Merged
Alezander9 merged 1 commit into
mainfrom
feat/run-mode-browser-execute-styling
May 16, 2026
Merged

feat(run): style browser_execute in headless run mode like bash#73
Alezander9 merged 1 commit into
mainfrom
feat/run-mode-browser-execute-styling

Conversation

@Alezander9
Copy link
Copy Markdown
Member

@Alezander9 Alezander9 commented May 16, 2026

Problem

In headless bcode run "..." mode, browser_execute tool calls render with the default gear icon and a duplicated tool name:

⚙ browser_execute browser_execute

The TUI path (session/index.tsx) already has a custom BrowserExecute component modeled on Shell, but the run-mode renderer (cli/cmd/run/tool.ts) had no entry for it and fell through to fallbackInline / fallbackStart.

Change

Adds a browser_execute entry to TOOL_RULES in packages/opencode/src/cli/cmd/run/tool.ts, mirroring the existing bash rule and the TUI BrowserExecute component:

  • run → icon >, title = description ?? "Browser execute", block mode, body = streamed output on completion (parallel to runBash).
  • 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.finalbrowser_execute completed [· <time>].
  • permission → icon #, title = description, lines = prompted code.

Type plumbing: imports BrowserExecuteTool as a type-only import, adds browser_execute: typeof BrowserExecuteTool to ToolDefs.

Before / after

Before:

⚙ browser_execute browser_execute

After:

# Connect to local Chrome
> const session = await connect()
  const tabs = await session.getTabs()
  console.log(tabs)
[streamed output...]
browser_execute completed · 2.3s

Test

Verified locally on Windows by running:

bun --cwd packages/opencode --conditions=browser run src/index.ts run "..."

Output renders with the new styling on browser_execute calls and is unchanged on every other tool.

Notes

  • Yellow-zone modification (upstream-vendored packages/opencode/src/). Will add a corresponding row to memory/browsercode/EXCEPTIONS.md in the agent repo alongside the existing TUI browser_execute Match-block entry.
  • bun typecheck for this file passes; pre-existing missing-deps errors in packages/core/ (immer, ai-sdk/*) are unrelated to this diff.

Summary by cubic

Styles browser_execute in headless bcode run to match the bash/TUI experience. Adds REPL-style prompt, description-based title, streamed output, and a completion line with timing.

  • New Features
    • Added browser_execute rule in packages/opencode/src/cli/cmd/run/tool.ts, mirroring bash/TUI.
    • Run view: > icon, title = description or "Browser execute", block mode, outputs on completion.
    • Scroll view: header with # <description> and prompted code; progress streams trimmed, ANSI-stripped output; final shows browser_execute completed · <time>.
    • Permissions/types: permission card uses # + prompted code; added type-only BrowserExecuteTool import and ToolDefs entry.

Written for commit 1a00390. Summary will update on new commits. Review in cubic

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.
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

Re-trigger cubic

@Alezander9 Alezander9 merged commit 6586e5b into main May 16, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant