feat: add web search tools extension

This commit is contained in:
alex wiesner
2026-04-09 11:16:53 +01:00
parent c2d7cd53ce
commit 472de4ebaf
5 changed files with 176 additions and 7 deletions

View File

@@ -1186,7 +1186,7 @@ git -C /home/alex/dotfiles commit -m "feat: add web_search tool"
- Test: `/home/alex/dotfiles/.pi/agent/extensions/web-search/src/tools/web-fetch.test.ts`
- Test: `/home/alex/dotfiles/.pi/agent/extensions/web-search/src/extension.test.ts`
- [ ] **Step 1: Write the failing `web_fetch` and extension registration tests**
- [x] **Step 1: Write the failing `web_fetch` and extension registration tests**
Create `/home/alex/dotfiles/.pi/agent/extensions/web-search/src/tools/web-fetch.test.ts` with this content:
@@ -1275,7 +1275,7 @@ test("the extension entrypoint registers both web_search and web_fetch", () => {
});
```
- [ ] **Step 2: Run the new tests to verify they fail**
- [x] **Step 2: Run the new tests to verify they fail**
Run:
@@ -1286,7 +1286,7 @@ npx tsx --test src/tools/web-fetch.test.ts src/extension.test.ts
Expected: `FAIL` with an `ERR_MODULE_NOT_FOUND` error for `./web-fetch.ts`.
- [ ] **Step 3: Write the minimal `web_fetch` tool implementation**
- [x] **Step 3: Write the minimal `web_fetch` tool implementation**
Create `/home/alex/dotfiles/.pi/agent/extensions/web-search/src/tools/web-fetch.ts` with this content:
@@ -1383,7 +1383,7 @@ export function createWebFetchTool({ resolveProvider }: FetchToolDeps) {
}
```
- [ ] **Step 4: Replace the temporary entrypoint with the final entrypoint that registers both tools**
- [x] **Step 4: Replace the temporary entrypoint with the final entrypoint that registers both tools**
Replace `/home/alex/dotfiles/.pi/agent/extensions/web-search/index.ts` with this content:
@@ -1420,7 +1420,7 @@ export default function webSearch(pi: ExtensionAPI) {
}
```
- [ ] **Step 5: Run the `web_fetch` and entrypoint smoke tests to verify they pass**
- [x] **Step 5: Run the `web_fetch` and entrypoint smoke tests to verify they pass**
Run:
@@ -1431,7 +1431,7 @@ npx tsx --test src/tools/web-fetch.test.ts src/extension.test.ts
Expected: `PASS` for all four tests.
- [ ] **Step 6: Reload pi and manually verify search + single fetch + batch fetch**
- [x] **Step 6: Reload pi and manually verify search + single fetch + batch fetch**
Run:
@@ -1458,7 +1458,7 @@ Expected manual checks:
- batch fetch output is clearly separated per URL
- if one URL fails, the result still includes the successful URL output and a failure section for the bad URL
- [ ] **Step 7: Commit the completed web tools extension**
- [x] **Step 7: Commit the completed web tools extension**
Run: