OpenCode plugin

Visual Inspector

Select rendered web elements, describe visual changes, and send precise annotations to OpenCode.

Install

OpenCode V2

opencode2 plugin add 'git+https://github.com/frontendxlab/opencode-annotate.git#main'

Use opencode2 plugin list to verify. The V2 plugin registers /inspect, /inpect, and visual.inspect. The TUI, local desktop app, and local web app share the server plugin.

OpenCode V1

npm install opencode-visual-inspector
{ "plugin": ["opencode-visual-inspector/v1"] }

V1 exposes visual_inspect. Copy commands/inspect.md into .opencode/commands/inspect.md when a V1 command is desired.

Open the inspector

/inspect http://localhost:5173

Use /inspect for automatic target detection. The misspelled /inpect alias remains supported.

Validated options

/inspect http://localhost:5173 --model openai/gpt-5.6-luna --mode quick --context=fork

Duplicate options, malformed model identifiers, invalid values, and multiple URLs are rejected before the browser opens. A model with context=default displays a yellow warning that the current session model will change.

The argument contract is validated in both adapters. Host-specific model switching and fork-session execution depend on the active OpenCode session API.

Browser workflow

  1. Toggle Inspect on.
  2. Hover and select an element, or focus it and press Alt+Shift+I.
  3. Describe the requested change.
  4. Choose Add to batch or Change live.
  5. Use viewport presets or custom dimensions.
  6. Send the batch to the main agent, a contextual subagent, or a fresh subagent.

Turn inspection off to use login forms, links, menus, and normal navigation without capture.

Viewports

Custom width is limited to 320 through 7680 and height to 320 through 4320. The inspector records the actual measured viewport.

Live changes

Change live sends one annotation and reports submitting, working, succeeded, failed, or cancelled states over authenticated SSE. Success reloads the page. Stop tracking stops inspector tracking only and does not remotely cancel the agent.

Security and login

Only loopback targets are allowed by default. The injected client runs inside the target page, so inspect only applications you control.

export OPENCODE_INSPECT_ALLOW_PRIVATE=1
export OPENCODE_INSPECT_ALLOW_PUBLIC=1

Private and public access are independent. The proxy is loopback-only, token-authenticated, host-validated, same-origin for redirects, and maintains a target-scoped cookie jar. External identity-provider redirects and page-origin authorization headers are not supported.

GUI behavior

The proxy and browser run on the OpenCode server host. Local V2 TUI, desktop, and web clients can use it through the same server. Remote GUI use is not supported.

Troubleshooting