omp packages

@jalaxy33/pi-webtools0.2.0

Web search and page, document, and repository fetching for Pi. Two tools, custom backends, no AI summary, optional proxy and auth.

jalaxy33 Published 3 days ago MIT ~0 downloads/mo

Untested on omp

This is a pi package. No one has reported whether it works on omp yet. If you try it, add your result below.

Did it work for you?

Result

One report per person. A new report replaces your old one.

Reports 0

No reports yet.

Readme

pi-webtools

Web search and content fetching for Pi. Two tools, no AI summary:

  • web_search returns raw titles, URLs, and snippets
  • web_fetch returns pages, documents, images, and repository checkouts as text or local paths

Works with built-in backends and with user-defined command or HTTP services. Built-in search backends are Tavily, Exa, Firecrawl, Brave, SearXNG, DeepSeek, and AnySearch. Fetch works locally first, then through Jina or Firecrawl when configured. PDFs use unpdf, and other documents can go through external commands or DeepSeek OCR.

Install

From npm:

pi install npm:@jalaxy33/pi-webtools

From GitHub:

pi install git:github.com/jalaxy33/pi-webtools

Requires Node.js 22.19 or newer, and git for repositories. curl is only needed for SOCKS proxies or network.transport: "curl".

Tools

Web search

web_search({ query: "typescript 5.9 release notes" })
web_search({ queries: ["query 1", "query 2"], numResults: 8 })
web_search({ query: "latest news", recencyFilter: "week" })
web_search({ query: "sigstore", domainFilter: ["github.com", "-gist.github.com"] })
web_search({ query: "golang generics", provider: "exa" })
  • Returns raw titles, URLs, and snippets; no summary
  • Runs up to three queries in parallel
  • Tries configured backends in order until one returns results
  • multiEngine runs all configured backends and merges the results
  • provider uses one named backend for that call
  • Default backends: Firecrawl, Tavily, Exa

Web fetch

web_fetch({ url: "https://example.com/article" })
web_fetch({ urls: ["https://a.example", "https://b.example"] })
web_fetch({ url: "https://example.com/data.json", mode: "raw" })
web_fetch({ url: "https://github.com/owner/repo" })
web_fetch({ url: "https://docs.company.com/page", auth: "work" })
  • Returns readable Markdown, or the raw body with mode: "raw"
  • Reduces HTML with Defuddle; a page with little text can fall back to a hosted reader
  • Detects PDF, Office, EPUB/MOBI, and images from content type and bytes
  • PDFs use unpdf; other formats come from the configured extractors
  • Recognizes GitHub, GitLab, Bitbucket, Codeberg/Gitea, and explicit .git URLs
  • auth profiles add static headers for login-protected pages
  • Long content is cut inline; the full text path is included
  • Codemode scripts receive the full text in structuredContent

Codemode

Both tools carry an outputSchema, so scripts get data instead of prompt text:

const search = await tools.web_search({ query: "typescript 5.9 release notes" });
const urls = search.queries[0].results.slice(0, 2).map((result) => result.url);
const pages = await tools.web_fetch({ urls });
return pages.urls.map(({ url, title, content }) => ({ url, title, firstLine: content.split("\n")[0] }));

web_search resolves to { queries: [{ query, providers, results, errors }] }; each result has a provider. web_fetch resolves to { urls: [{ url, title, content, error, cachePath?, sourcePath? }] }. cachePath is the saved text; sourcePath is the original file or repository path.

Exposure

exposure controls what the model sees. The default is direct.

Value System prompt Codemode
direct full tool declarations mode: "on" adds a script hint
codemode nothing full declarations
deferred nothing a short hint when codemode or tool_search is active

Restart Pi after changing exposure or an enabled flag.

Configuration

The config file is ~/.pi/agent/webtools.json (inside PI_CODING_AGENT_DIR when set; PI_WEBTOOLS_CONFIG overrides the path). Every field is optional. Unknown keys are errors. The plugin never writes this file.

{
  "search": { "engines": ["tavily", "exa"] },
  "fetch": { "backends": ["local", "jina"] }
}

Configuration is validated when the tools load and on each call. See docs/configuration.md for every field, backend definition, protocol, cache behavior, and examples.

Search backends read their usual environment variables: TAVILY_API_KEY, EXA_API_KEY, FIRECRAWL_API_KEY, BRAVE_API_KEY, SEARXNG_BASE_URL, DEEPSEEK_API_KEY, and ANYSEARCH_API_KEY. The default search set is Firecrawl, Tavily, and Exa; each has a monthly free allowance. Without a key, search is unavailable.

Security and limits

  • Only http and https are fetched. Private, loopback, link-local, and reserved addresses are refused unless allowed by network.ssrf.allowRanges.
  • Redirects are checked again. Text responses are capped by fetch.maxBytes; documents use documents.maxMB.
  • Proxying uses network.proxy; authenticated fetches use static headers. Browser cookies and MCP are not used.
  • No AI summary, no curator, no video support, no bundled OCR engine.
  • Repositories are HTTPS only and do not receive git credentials.
  • Cache files are disposable. They live under the system temporary directory by default and may disappear after a restart.

Development

npm install
npm run typecheck
npm test

Similar Extensions

License

MIT