pi-deepseek-local-search

Pi extension: session-scoped DeepSeek Search/Fetch takeover of web_search/web_fetch via /deepseek_search_on and /deepseek_search_off — nothing persisted, no provider override

Packages

Package details

extension

Install pi-deepseek-local-search from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:pi-deepseek-local-search
Package
pi-deepseek-local-search
Version
0.1.0
Published
Nov 1, 2026
Downloads
405/mo · 405/wk
Author
boois
License
MIT
Types
extension
Size
20.2 KB
Dependencies
0 dependencies · 2 peers
Pi manifest JSON
{
  "extensions": [
    "./extensions/index.ts"
  ]
}

Security note

Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.

README

pi-deepseek-local-search

A pi extension that lets you swap the agent's web tools to DeepSeek's official Search & Fetch API for the current session only.

Session-only by design. The switch exists in memory for the current live window/session and nowhere else. It never writes settings.json, a provider definition, or any config file. As soon as you turn it off (/deepseek_search_off), replace the session (/new, /resume, /reload), or close the window, the takeover is gone and the original web_search / web_fetch tools are back.

/deepseek_search_on      # for this window only: web_search/web_fetch -> deepseek_search/deepseek_fetch
/deepseek_search_off     # for this window only: restore the original tools
/deepseek_search_status  # print the current takeover state

Session lifetime

Action Effect on the takeover
/deepseek_search_on On, until something below happens
/deepseek_search_off Off immediately, original tools restored
/new, /resume, /fork, /reload Reset (back to off)
Close the window / exit pi Reset (nothing survives)
Install, uninstall, upgrade No stored state involved

Nothing is persisted anywhere: the state is a single in-memory boolean inside the extension runtime. There is no setting, no config key, no dotfile to clean up.

Install

# local package (development / self-use; edits take effect immediately, nothing is copied)
pi install ./pi-deepseek-local-search

# or from npm / git
pi install npm:pi-deepseek-local-search
pi install git:github.com/<you>/pi-deepseek-local-search

Restart pi or run /reload, then run /login deepseek once so the extension can obtain a key through pi's model registry.

Usage

Command Effect
/deepseek_search_on Removes web_search / web_fetch from the active tool set and adds deepseek_search / deepseek_fetch. The status bar shows DS search ON.
/deepseek_search_off Puts back exactly the tools that were removed.
/deepseek_search_status Prints takeover state plus the current active tool list.
pi --ds-search Start this session with the takeover already on (same as running /deepseek_search_on).

The tools are direct-exposed, so while the takeover is off deepseek_search / deepseek_fetch stay registered but are not declared to the model and cannot be called. The model never sees a dangling tool.

Why not simply override web_search?

Pi requires tool names to be unique across extensions, so two extensions cannot both register web_search. This extension therefore swaps the active tool set (pi.getActiveTools() / pi.setActiveTools()) instead of shadowing a name: after /deepseek_search_on, the model is only declared deepseek_search + deepseek_fetch, and the previous web_* tools are no longer declared or callable. Functionally identical, no name collision.

It also never registers a provider or changes the wire format, so it does not compete with provider-level extensions (for example anything that re-pins DeepSeek to the Responses API), and it is safe to keep installed next to @bytetrue/pi-web-search or any other search plugin.

Tools

deepseek_search

Argument Required Meaning
query yes 1-128 chars; supports site:, -site:, lang:, after:, before:, "exact phrase", -exclude
max_results no 1-10, default 5 (sent as DeepSeek count)

Returns one block per hit with title, URL, publish date, authority (0-4), rerank_score, site name, and a summary clipped to 600 chars. details.results carries the structured list for rendering and HTML export.

deepseek_fetch

Argument Required Meaning
url yes Public http(s) URL

Returns {title, content} as Markdown (extraction happens server side), truncated to 20,000 chars. Loopback, private, and link-local targets are rejected before the request leaves the machine.

Cost & limits

Per the official guide, Search and Fetch are billed per successful request (HTTP 200 and a non-empty result): CNY 5 / 1000 calls each. Failed requests, empty result sets, and timeouts are not billed. QPS: Search 100, Fetch 25 per account. count changes the number of results, not the price.

Requirements

  • pi with @earendil-works/pi-coding-agent (peer) and typebox (peer)
  • a DeepSeek API key available to pi for provider deepseek (/login deepseek)

Development

# load the extension file directly, without installing the package
pi --no-extensions -e ./extensions/index.ts --ds-search --mode json "search today's weather in Beijing"

# inspect what would be published
npm pack --dry-run

Tunable constants live at the top of extensions/index.ts: REPLACED_TOOLS, MAX_SUMMARY_CHARS, MAX_FETCH_CHARS, SEARCH_TIMEOUT_MS, FETCH_TIMEOUT_MS.

Notes

  • Commands must be typed in pi's input; pi -p "/deepseek_search_on" is treated as a prompt. In Git Bash a leading / argument is path-translated, so quote it or use PowerShell.
  • If an older copy of this extension was dropped into ~/.pi/agent/extensions/, remove it before installing the package: both would register the same tool names and collide.

License

MIT