From cc7642ded1bd2d529e30363d6a0f39819a28ef01 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sat, 21 Mar 2026 13:00:42 +0200 Subject: Add web-search Pi extension (web_search + web_fetch tools) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Implements two LLM-callable tools using DuckDuckGo's free HTML endpoint — no API key or account required: - web_search: searches DDG, returns up to 8 results with title/URL/snippet - web_fetch: fetches a URL, strips script/style/nav blocks, returns up to 12,000 chars of readable text Both tools are TypeScript registered via pi.registerTool() and load automatically from pi/agent/extensions/web-search/ via the ~/.pi symlink. HTTP requests use Node.js built-ins (node:https) with a 15s timeout and single-redirect follow. Also adds an Extensions section to README.md listing all extensions with a focused web-search subsection. --- README.md | 34 +++++ pi/agent/extensions/web-search/README.md | 42 ++++++ pi/agent/extensions/web-search/index.ts | 248 +++++++++++++++++++++++++++++++ 3 files changed, 324 insertions(+) create mode 100644 pi/agent/extensions/web-search/README.md create mode 100644 pi/agent/extensions/web-search/index.ts diff --git a/README.md b/README.md index 7ccc620..2206092 100644 --- a/README.md +++ b/README.md @@ -204,6 +204,40 @@ model switch hyperstack1/openai/gpt-oss-120b Pi sends subsequent requests to the new model ID immediately; the provider base URL stays the same. +## Extensions + +Custom extensions live in `pi/agent/extensions/` and are loaded automatically via the `~/.pi` symlink. + +| Extension | Purpose | +|-----------|---------| +| `web-search` | `web_search` and `web_fetch` tools — DuckDuckGo search + page fetching, no API key | +| `ask-mode` | `/ask` command — restricts the model to read-only exploration tools | +| `loop-scheduler` | `/loop` command — re-sends a prompt on a recurring interval | +| `inline-bash` | `!{cmd}` syntax — expands shell output inline before sending to the model | +| `session-name` | Auto-names sessions from the first message | +| `modal-editor` | Opens an external editor (`$VISUAL`) for composing long prompts | +| `handoff` | Compacts and hands off context to a fresh session | +| `fresh-subagent` | Spawns a sub-agent in a clean context for isolated tasks | +| `reload-runtime` | `/reload-runtime` command — hot-reloads extensions without restarting Pi | +| `nemotron-tool-repair` | Repairs malformed tool calls from Nemotron models | +| `taskwarrior-plan-mode` | Integrates Taskwarrior task management into Pi sessions | + +### Web search + +The `web-search` extension registers two LLM-callable tools: + +- **`web_search`** — searches DuckDuckGo and returns up to 8 results (title, URL, snippet) +- **`web_fetch`** — fetches a URL and returns up to 12,000 characters of readable text + +Example prompts: + +``` +Search for the vLLM 0.9.0 changelog +Find the Qwen3-Coder model card and summarize the recommended vLLM flags +``` + +No API key or account required. Uses DuckDuckGo's free HTML endpoint. + ## Single-VM setup A single VM can be deployed with the default config (GPT-OSS 120B): diff --git a/pi/agent/extensions/web-search/README.md b/pi/agent/extensions/web-search/README.md new file mode 100644 index 0000000..c7b77b3 --- /dev/null +++ b/pi/agent/extensions/web-search/README.md @@ -0,0 +1,42 @@ +# web-search + +Pi.dev extension that gives the LLM two tools for consulting the web during coding sessions. + +## Tools + +### `web_search` + +Searches DuckDuckGo (no API key, no account required) and returns up to 8 results with +titles, URLs, and snippets. Use when the model needs current documentation, release notes, +library APIs, or any information not in its training data. + +### `web_fetch` + +Fetches the full text of a URL. Strips `