opencode-websearch

agent
Guvenlik Denetimi
Uyari
Health Uyari
  • License — License: MIT
  • Description — Repository has a description
  • Active repo — Last push 0 days ago
  • Low visibility — Only 6 GitHub stars
Code Gecti
  • Code scan — Scanned 12 files during light audit, no dangerous patterns found
Permissions Gecti
  • Permissions — No dangerous permissions requested
Purpose
This plugin integrates native web search capabilities from providers like Anthropic and OpenAI directly into the OpenCode CLI, acting as a bridge to fetch external search results.

Security Assessment
Overall Risk: Low. The tool inherently makes external network requests, but this is strictly limited to fulfilling the web search functions via official provider APIs. The light code audit of 12 files found no dangerous execution patterns, no hardcoded secrets, and no attempts to access unauthorized local sensitive data or execute shell commands. No dangerous permissions are requested by the package.

Quality Assessment
The code is open-source under the permissive and standard MIT license. It is an actively maintained project, with the most recent code push occurring just today. However, it currently has extremely low community visibility with only 6 GitHub stars. This means it has not been widely vetted by a large audience, and users must rely primarily on the clean automated code scan rather than established community trust.

Verdict
Safe to use, though it should be treated as a young, low-visibility project.
SUMMARY

Web search plugin for OpenCode that provides web search functionality using each provider's native APIs, inspired by Claude Code's WebSearch tool.

README.md

opencode-websearch

Web search plugin for OpenCode that provides web search functionality using each provider's native APIs, inspired by Claude Code's WebSearch tool.

Supported providers

Provider SDK package Search mechanism Notes
Anthropic @ai-sdk/anthropic Web search tool This plugin uses Anthropic tool type web_search_20250305; model compatibility follows that tool version.
OpenAI @ai-sdk/openai Responses API web search Known unsupported: gpt-4.1-nano, and gpt-5 with reasoning.effort: "minimal".
GitHub Copilot @ai-sdk/github-copilot Copilot model-native web search Requires Copilot can search the web using model native search to be enabled in GitHub Copilot settings. OpenAI-family models are working here; Claude models do not appear to work with Copilot built-in model-native search capabilities.

These limitations are based on current provider docs and can change over time.

Install

Add the plugin to your opencode.json:

{
  "plugin": ["opencode-websearch"]
}

OpenCode will install it automatically at startup.

Configuration (optional)

No configuration is needed if your active chat model supports the provider's native web search capability used by this plugin. To customize which model handles web searches, tag a model with "websearch": "auto" or "websearch": "always".

Important: "auto" is a provider-level fallback, not a model-level fallback.

Model selection

The plugin chooses which model to use for each search:

Priority Condition Behavior
1 A model is tagged "always" That model is always used, regardless of what you're chatting with
2 Active model is on a supported and configured provider The active model is used for web search
3 Active model is on an unsupported provider, and a model is "auto" The "auto" model is used as fallback
4 None of the above An error is returned

"auto" mode (fallback)

Use "auto" to set a fallback model when your active model is on an unsupported provider.

If your active model is on a supported provider, that active model is used, even if that specific model does not support web search.

If you want one model to always handle web search, use "always".

{
  "provider": {
    "anthropic": {
      "models": {
        "claude-sonnet-4-5": {
          "options": {
            "websearch": "auto"
          }
        }
      }
    }
  }
}

"always" mode

Use "always" to lock web search to a specific model, regardless of what you're chatting with.

{
  "provider": {
    "openai": {
      "models": {
        "gpt-5.2": {
          "options": {
            "websearch": "always"
          }
        }
      }
    }
  }
}

Development

Local Development

To develop or customize the plugin locally, clone the repo and symlink the
source entry point into your OpenCode plugin directory:

git clone https://github.com/emilsvennesson/opencode-websearch ~/.config/opencode/opencode-websearch
cd ~/.config/opencode/opencode-websearch
bun install
mkdir -p ~/.config/opencode/plugin
ln -sf ~/.config/opencode/opencode-websearch/src/index.ts ~/.config/opencode/plugin/websearch.ts

OpenCode will load the plugin directly from source on startup. Any edits to the
files in src/ take effect next time you start OpenCode.

Note: When using the symlink approach, remove "opencode-websearch" from
the plugin array in your opencode.json to avoid loading the plugin twice.

Commands

bun install            # install dependencies
bun run format         # auto-format source files
bun run format:check   # verify formatting (no changes)
bun run lint           # run oxlint
bun run lint:fix       # auto-fix lint issues
bun run typecheck      # type check with tsc
bun run check          # format:check + lint + typecheck (full quality gate)
bun run build          # ESM bundle + declaration files → dist/

License

MIT

Yorumlar (0)

Sonuc bulunamadi