{"id":50055969,"url":"https://github.com/code-yeongyu/pi-websearch","last_synced_at":"2026-05-21T13:14:04.701Z","repository":{"id":354980988,"uuid":"1226295033","full_name":"code-yeongyu/pi-websearch","owner":"code-yeongyu","description":"Provider-backed web search tool for pi-coding-agent with config-gated activation, TUI status, and source-aware results.","archived":false,"fork":false,"pushed_at":"2026-05-13T10:44:07.000Z","size":102,"stargazers_count":2,"open_issues_count":0,"forks_count":2,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-13T12:32:51.561Z","etag":null,"topics":["brave","coding-agent","exa","perplexity","pi-coding-agent","pi-extension","pi-package","serper","tavily","typescript","web-search","websearch"],"latest_commit_sha":null,"homepage":"https://github.com/code-yeongyu/pi-websearch","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/code-yeongyu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":"NOTICE","maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null}},"created_at":"2026-05-01T07:59:59.000Z","updated_at":"2026-05-13T10:44:16.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/code-yeongyu/pi-websearch","commit_stats":null,"previous_names":["code-yeongyu/pi-websearch"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/code-yeongyu/pi-websearch","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/code-yeongyu%2Fpi-websearch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/code-yeongyu%2Fpi-websearch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/code-yeongyu%2Fpi-websearch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/code-yeongyu%2Fpi-websearch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/code-yeongyu","download_url":"https://codeload.github.com/code-yeongyu/pi-websearch/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/code-yeongyu%2Fpi-websearch/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33301811,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-21T12:23:38.849Z","status":"ssl_error","status_checked_at":"2026-05-21T12:22:11.673Z","response_time":62,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["brave","coding-agent","exa","perplexity","pi-coding-agent","pi-extension","pi-package","serper","tavily","typescript","web-search","websearch"],"created_at":"2026-05-21T13:14:01.688Z","updated_at":"2026-05-21T13:14:04.686Z","avatar_url":"https://github.com/code-yeongyu.png","language":"TypeScript","funding_links":[],"categories":["Extensions"],"sub_categories":[],"readme":"# pi-websearch\n\nProvider-backed `web_search` tool for pi. It starts with zero configuration: OpenAI and Anthropic sessions defer silently to senpi's built-in provider-native web search, while other providers use the built-in DuckDuckGo HTML backend unless a config file overrides it.\n\n## Tool Schema\n\nThe public tool schema matches free-code:\n\n```json\n{\n\t\"query\": \"The search query to use\",\n\t\"allowed_domains\": [\"example.com\"],\n\t\"blocked_domains\": [\"spam.example.com\"]\n}\n```\n\nOnly `query` is required. `allowed_domains` and `blocked_domains` are mutually exclusive for a single tool call. Result limits are configured per provider, not exposed in the tool schema.\n\n## Configuration\n\nThe loader checks these files in order:\n\n1. `.pi/websearch.json` in the current project\n2. `~/websearch.json`\n3. `~/.pi/websearch.json`\n\nNo config file is required for the default backend. For non-native providers, pi-websearch uses DuckDuckGo's HTML endpoint (`https://html.duckduckgo.com/html/`) because it is free and does not require an API key. Create a config file only when you want a different backend or routing policy.\n\nExample override:\n\n```json\n{\n\t\"backend\": \"perplexity\",\n\t\"apiKey\": \"pplx-...\",\n\t\"maxResults\": 8,\n\t\"allowedDomains\": [\"docs.example.com\"]\n}\n```\n\nLegacy configs that use `\"provider\"` instead of `\"backend\"` continue to work.\n\nMultiple provider entries enable fallback and routing:\n\n```json\n{\n\t\"strategy\": \"priority\",\n\t\"fallback\": true,\n\t\"auto\": true,\n\t\"providers\": [\n\t\t{\n\t\t\t\"id\": \"brave-search\",\n\t\t\t\"provider\": \"brave\",\n\t\t\t\"apiKey\": \"\u003clocal-only-key\u003e\",\n\t\t\t\"priority\": 10,\n\t\t\t\"maxResults\": 8\n\t\t},\n\t\t{\n\t\t\t\"id\": \"exa-search\",\n\t\t\t\"provider\": \"exa\",\n\t\t\t\"apiKey\": \"\u003clocal-only-key\u003e\",\n\t\t\t\"priority\": 10,\n\t\t\t\"maxResults\": 8\n\t\t}\n\t]\n}\n```\n\n### Native auto-route\n\nIf the active model provider is `openai` or `anthropic`, pi-websearch registers no startup warning and defers to senpi's built-in `openai-web-search` or `anthropic-web-search` extension. Those built-ins wire the provider-native tool directly into supported model requests, so this extension only handles non-native providers and explicit override configs.\n\nWhen `auto` is `true` (the default) and the active pi model exposes a server-hosted search tool, the extension prepends an implicit `{ id: \"native\", ... }` entry that reuses the model's resolved API key via `ExtensionContext.modelRegistry.getApiKeyAndHeaders`. The native entry tries first; on failure or when the model does not match, the configured providers handle the search. Disable with `\"auto\": false` if you want only the explicit `providers` list.\n\nModels that activate native routing (Q1 2026):\n\n- `openai`: `gpt-5.5`, `gpt-5.5-fast`, `gpt-4.1`, `gpt-4.1-mini`, `gpt-4o`, `gpt-4o-mini` (excludes `gpt-4.1-nano`, `gpt-5-codex`, `gpt-5.1-codex`).\n- `anthropic`: `claude-opus-4-*`, `claude-sonnet-4-*`.\n- `xai`: any `grok-*`.\n- `perplexity`: any `sonar*` (search is intrinsic to Sonar models).\n- `z-ai` or `zai`: any `glm-*`.\n- `openrouter`: any `\u003cprovider\u003e/\u003cmodel\u003e` whose `\u003cprovider\u003e` and `\u003cmodel\u003e` match one of the rows above (for example `openai/gpt-5.5` or `anthropic/claude-opus-4-7`).\n\nThe native entry inherits `model.baseUrl` from `ExtensionContext.model`, so any local gateway override registered in the pi model registry is honored. The endpoint path is appended automatically: if `baseUrl` already ends with `/v1`, only the resource segment is added; otherwise `/v1/\u003cresource\u003e` is appended.\n\nRouting strategies:\n\n- `priority`: try lower `priority` values first, falling back in order when `fallback` is `true`.\n- `round-robin`: rotate the first provider per search; optional `weight` repeats entries in the rotation.\n- `fill-first`: collect unique results across providers until the requested result count is filled.\n\nSupported providers:\n\n- `duckduckgo-html`: DuckDuckGo HTML search endpoint. Requires no `apiKey`; used as the zero-config default.\n- `exa`: direct Exa search. Requires `apiKey`.\n- `tavily`: direct Tavily search. Requires `apiKey`.\n- `brave`: Brave Search API. Requires `apiKey`.\n- `serper`: Serper Google search API. Requires `apiKey`.\n- `google-cse`: Google Custom Search JSON API. Requires `apiKey` and `searchEngineId`.\n- `z-ai`: Z.ai web search endpoint. Requires `apiKey`.\n- `openai`: OpenAI Responses API hosted `web_search` tool. Requires `apiKey`.\n- `codex`: OpenAI Responses API hosted `web_search` tool. Requires `apiKey`.\n- `anthropic`: Anthropic Messages API with server `web_search_20250305` tool. Requires `apiKey`.\n- `perplexity`: Perplexity Search API. Requires `apiKey`.\n- `xai`: xAI Responses API hosted `web_search` tool. Requires `apiKey`.\n\nProvider-specific optional fields include `id`, `baseUrl`, `model`, `maxResults`, `priority`, `weight`, `searchContextSize`, `codexMode`, `allowedDomains`, `blockedDomains`, and `userLocation` where supported. `baseUrl` is supported for every provider and must be a public HTTPS URL without embedded credentials.\n\nTool text and TUI output include the selected provider entry, routing strategy, and fallback attempts so the agent can see which provider produced the result.\n\n## Commands\n\n```bash\nnpm test\nnpm run typecheck\nnpm run check\npi -e ./src/index.ts\n```\n\nInside pi, run `/websearch status` to inspect activation state.\n\n## Related\n\n- [senpi](https://github.com/code-yeongyu/senpi) — the fork/runtime these extensions are extracted from.\n- [Ultraworkers Discord](https://discord.gg/PUwSMR9XNk) — community link from the senpi README.\n- [Dori](https://sisyphuslabs.ai) — the product powered by senpi under the hood.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcode-yeongyu%2Fpi-websearch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcode-yeongyu%2Fpi-websearch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcode-yeongyu%2Fpi-websearch/lists"}