pi-better-web-search 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,53 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.0.1 — Your pi login, your search tools
4
+
5
+ ### Fixes
6
+
7
+ - Discover official DeepSeek Search/Fetch through pi's provider-level `/login`
8
+ and `models.json` authentication even when the available chat catalog is
9
+ empty, filtered, stale, or has no flash model. Reuse request-time registry
10
+ credentials and configured native/proxy endpoints without copying keys or
11
+ invoking an inference model. Expose Search and Fetch in both provider pickers
12
+ and enable the URL-capable tool schema without a second extension login.
13
+ - Keep the pi-authenticated DeepSeek route separate from extension-saved and
14
+ environment standalone credentials. Preserve configured API priority, manual
15
+ preferences, fallback, and one menu entry per provider. Login/logout changes
16
+ invalidate discovery fingerprints; request-time auth and captured-header
17
+ redaction protect stale routes and in-flight credential rotation. Third-party
18
+ gateways merely hosting DeepSeek chat models are not treated as its native API.
19
+ - Show all terminal command entrypoints in `/pi-better-web-search` and
20
+ `/pi-better-web-search help`, including `/web-search-provider search`,
21
+ `/web-search-provider fetch`, and `/web-search-api`. Empty/help requests show
22
+ informational guidance instead of a warning; invalid arguments still warn
23
+ without echoing potentially sensitive values. Keep hidden-dialog-only key entry.
24
+
25
+ ### Documentation and artwork
26
+
27
+ - Restore the original white-background, black/gray wireframe architecture style
28
+ and concise README introduction. Lead both English and Chinese READMEs with
29
+ what the plugin does; retain the updated standalone APIs and native fallback
30
+ diagram, and remove its duplicate from the later routing section.
31
+ - Use the maintainer's original Artificial Analysis screenshot unchanged as
32
+ `assets/search-index.png`, replacing the redrawn SVG chart. Update related
33
+ documentation links and package verification so the screenshot ships in npm.
34
+ - Prominently mark **Pi 1.5.2 verified** in both READMEs and the architecture
35
+ graphic. Define verification as type checking and automated tests against pi
36
+ 1.5.2 host dependencies, with Node.js 22/24 CI, not live testing every provider.
37
+ - Document command discovery, independent search/fetch preferences, direct reuse
38
+ of pi's DeepSeek credentials, the API-only model-tier exception, and the latest
39
+ 1.0.1 package and publishing commands in English and Chinese.
40
+
41
+ ### Tests
42
+
43
+ - Add real pi 1.5.2 registry integration with isolated credential/model stores
44
+ for pi-login and `models.json` auth, plus regression tests for catalog gaps,
45
+ stale snapshots, legacy registries, tool exposure, provider selection,
46
+ proxy/auth overrides, logout, credential rotation, priority, and fallback.
47
+ - Add full-help discovery tests across TUI/RPC/print contexts and expand invalid
48
+ argument checks to ensure help opens no dialogs, changes no state, and never
49
+ echoes credentials.
50
+
3
51
  ## 1.0.0 — Search is an agent superpower
4
52
 
5
53
  ### The flagship search upgrade
package/README.md CHANGED
@@ -10,7 +10,7 @@ providers. Keep your conversation model; get provider results as-is.
10
10
  [![CI](https://github.com/zhexusun10/pi-better-web-search/actions/workflows/ci.yml/badge.svg)](https://github.com/zhexusun10/pi-better-web-search/actions/workflows/ci.yml)
11
11
  [![npm](https://img.shields.io/npm/v/pi-better-web-search)](https://www.npmjs.com/package/pi-better-web-search)
12
12
  [![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)
13
- [![Pi 1.5.2](https://img.shields.io/badge/Pi-1.5.2-blue.svg)](https://pi.dev)
13
+ [![Pi 1.5.2 verified](https://img.shields.io/badge/Pi-1.5.2_verified-blue.svg)](docs/testing.md)
14
14
  [![Node](https://img.shields.io/badge/node-%3E%3D22.19-339933.svg)](https://nodejs.org)
15
15
 
16
16
  [简体中文](docs/README.zh-CN.md) · [Search APIs](docs/search-apis.md) · [Architecture](docs/architecture.md) · [Providers](docs/providers.md) · [Testing](docs/testing.md)
@@ -46,7 +46,7 @@ tokens rediscovering a solution someone has already published.** One well-placed
46
46
  `web_search` call can surface the right API, package, or fix—turning repeated
47
47
  trial and error into a direct path to a successful task, with fewer wasted tokens.
48
48
 
49
- ### 1.0.0: An epic release for the pi open-source community
49
+ ### 1.0: An epic release for the pi open-source community
50
50
 
51
51
  Built to be the web-search tool you reach for first:
52
52
 
@@ -63,7 +63,7 @@ Built to be the web-search tool you reach for first:
63
63
 
64
64
  ## Install and search
65
65
 
66
- **Version 1.0.0 is available.** Download the package from the [GitHub release](https://github.com/zhexusun10/pi-better-web-search/releases/tag/v1.0.0), or install from npm once the maintainer publishes it:
66
+ **Version 1.0.1 is available.** [Release notes and package download](https://github.com/zhexusun10/pi-better-web-search/releases/tag/v1.0.1).
67
67
 
68
68
  ```bash
69
69
  pi install npm:pi-better-web-search
@@ -93,7 +93,8 @@ pi install ./path/to/pi-better-web-search
93
93
  > Do not load this package together with `pi-web-search`. Both register a tool
94
94
  > named `web_search`, and the second registration replaces the first.
95
95
 
96
- Requirements: **pi 1.3+** and **Node.js 22.19+**. Tested with **pi 1.5.2**.
96
+ Requirements: **pi 1.3+** and **Node.js 22.19+**. **Pi 1.5.2 verified** with
97
+ type checking and automated tests against pi 1.5.2 host dependencies.
97
98
 
98
99
  ## What makes it better
99
100
 
@@ -105,7 +106,8 @@ A focused tool with the reliability features an agent actually needs:
105
106
  and parameter schema.
106
107
  - **Correct exposure.** The tool is hidden when the current model has no
107
108
  compatible search interface and no compatible provider is authenticated. A
108
- configured dedicated search API or authenticated lightweight model exposes it.
109
+ configured dedicated search API, pi-authenticated DeepSeek tools, or an
110
+ authenticated lightweight model exposes it.
109
111
  - **Automatic fallback.** If the current model cannot search, or a provider
110
112
  call fails, the extension tries other authenticated provider interfaces until
111
113
  one succeeds.
@@ -193,6 +195,13 @@ final return type.
193
195
 
194
196
  ## Dedicated search APIs
195
197
 
198
+ **Already logged into official DeepSeek with pi's `/login`, or configured its key
199
+ in pi's `models.json`? No second login is needed.** The extension reuses pi's
200
+ `deepseek` provider credentials for native Search/Fetch, even if the available chat
201
+ catalog is empty or has no `flash` model. Select it with `/web-search-provider fetch`
202
+ or `/web-search-provider search`. No inference model is invoked and no key is copied.
203
+ Third-party gateways merely hosting DeepSeek models are not treated as the official API.
204
+
196
205
  Run **`/pi-better-web-search login`** in pi's terminal, choose **DeepSeek, Exa,
197
206
  Keenable, or Perplexity**, then paste/type the API key into the **hidden input**
198
207
  and press Enter. The key is saved separately from settings/cache, and the API
@@ -275,6 +284,9 @@ support per family.
275
284
 
276
285
  ## Choose providers in the terminal
277
286
 
287
+ Run `/pi-better-web-search` or `/pi-better-web-search help` to list all terminal
288
+ commands, including login, search/fetch preferences, and API enable/disable settings.
289
+
278
290
  Run `/web-search-provider` to choose a preferred provider separately for
279
291
  **Web Search** and **URL Fetch**. Or open either picker directly:
280
292
 
@@ -312,10 +324,11 @@ Dedicated retrieval APIs have no chat-model tier and can expose the tool on
312
324
  their own. For model-backed interfaces, only lightweight models are eligible:
313
325
  **OpenAI = `luna`, Claude = `haiku`,
314
326
  all other brands (including DeepSeek) = `flash`**. This is a strict allowlist,
315
- not live price detection. It applies to search, URL analysis, current models,
316
- cache hints, and all fallback attempts. Without an eligible model, the tool
317
- stays hidden unless a standalone API is available; it never silently upgrades
318
- to another model tier.
327
+ not live price detection. It applies to model-backed search, URL analysis,
328
+ current models, cache hints, and fallback. Pi-authenticated DeepSeek native tools
329
+ are an API-only exception: they use no inference model and need no `flash` id.
330
+ Without an eligible model, pi-authenticated DeepSeek tools, or a standalone API,
331
+ the tool stays hidden; it never silently upgrades to another inference-model tier.
319
332
 
320
333
  After any explicit provider preference, configured **Keenable → Exa →
321
334
  Perplexity → standalone DeepSeek** APIs are tried first (Fetch skips Perplexity),
@@ -524,10 +537,13 @@ needed.
524
537
  search interface; or
525
538
  - at least one authenticated available lightweight model maps to a supported
526
539
  provider family; or
540
+ - pi has configured official `deepseek` provider credentials for native
541
+ Search/Fetch (no available chat model or `flash` id needed); or
527
542
  - a dedicated search API is configured and usable (no chat model needed).
528
543
 
529
544
  For model-backed interfaces the same lightweight restriction applies to `urls`;
530
- standalone Keenable, Exa, and DeepSeek expose it without a chat-model tier.
545
+ standalone Keenable, Exa, and DeepSeek, plus pi-authenticated DeepSeek native
546
+ tools, expose it without a chat-model tier.
531
547
 
532
548
  For an unsupported current model with no compatible login or API key, the tool
533
549
  stays hidden (removed from the active tool set). The extension never calls an
@@ -588,6 +604,8 @@ See [SECURITY.md](SECURITY.md) for reporting vulnerabilities.
588
604
 
589
605
  ## Verified
590
606
 
607
+ - **Pi 1.5.2 verified**: type checking and automated tests against pi 1.5.2
608
+ host dependencies, with CI passing on Node.js 22 and 24.
591
609
  - **Unit and integration tests** covering exposure, schema variants,
592
610
  provider request shapes, SSE parsing, raw-result preservation, fallback,
593
611
  cache invalidation, URL handling, truncation, and abort behavior.
@@ -630,7 +648,7 @@ npm run build
630
648
  ```
631
649
 
632
650
  `npm run build` runs the checks and tests, verifies the npm file list, and packs
633
- `dist/pi-better-web-search-1.0.0.tgz`. Nothing is published automatically.
651
+ `dist/pi-better-web-search-1.0.1.tgz`. Nothing is published automatically.
634
652
 
635
653
  The test suite uses plain `.mjs` files that import the `.ts` sources directly.
636
654
  It mocks `globalThis.fetch`, uses a temporary cache file, and exercises
@@ -1,6 +1,6 @@
1
1
  <svg xmlns="http://www.w3.org/2000/svg" width="1200" height="640" viewBox="0 0 1200 640" role="img" aria-labelledby="title desc">
2
2
  <title id="title">pi-better-web-search architecture</title>
3
- <desc id="desc">One web_search tool accepts a query, URLs, or both. The router honors separate search and fetch preferences, tries configured Keenable, Exa, Perplexity and DeepSeek APIs, then falls back across eligible authenticated native providers. Search and fetch preserve successful raw results independently, with a 96,000-character output guard.</desc>
3
+ <desc id="desc">One web_search tool accepts a query, URLs, or both. The router honors separate search and fetch preferences, tries configured Keenable, Exa, Perplexity and DeepSeek APIs, then falls back across eligible authenticated native providers. Search and fetch preserve successful raw results independently, with a 96,000-character output guard. Type checking and automated tests are verified against pi 1.5.2 host dependencies.</desc>
4
4
  <defs>
5
5
  <marker id="arrow" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto-start-reverse">
6
6
  <path d="M 0 0 L 10 5 L 0 10 z" fill="#52525b"/>
@@ -33,6 +33,9 @@
33
33
  <text class="title" x="56" y="82">pi-better-web-search</text>
34
34
  <text class="subtitle" x="56" y="116">one tool · search APIs · native fallback · raw results</text>
35
35
 
36
+ <rect class="box" x="980" y="54" width="160" height="30" rx="15"/>
37
+ <text class="p" x="1060" y="74" text-anchor="middle">Pi 1.5.2 verified</text>
38
+
36
39
  <rect class="box" x="56" y="150" width="220" height="124" rx="16"/>
37
40
  <text class="h" x="76" y="180">Your pi agent</text>
38
41
  <text class="t" x="76" y="208">web_search</text>
@@ -6,6 +6,8 @@
6
6
  使用 **Keenable、Exa、Perplexity 或 DeepSeek** 搜索,在支持时抓取 URL,
7
7
  并在已认证的原生 provider 之间自动回退。不换对话模型,provider 数据原样返回。
8
8
 
9
+ [![Pi 1.5.2 verified](https://img.shields.io/badge/Pi-1.5.2_verified-blue.svg)](testing.md)
10
+
9
11
  [English](../README.md) · [搜索 API](search-apis.md) · [架构说明](architecture.md) · [Provider 细节](providers.md) · [测试](testing.md)
10
12
 
11
13
  ## 插件具体在做什么
@@ -36,7 +38,7 @@ Artificial Analysis Search Index 把差距画得很直观:虚线是**无搜索
36
38
  一次恰到好处的 `web_search`,就能找到正确的 API、可复用的包或有效修复,
37
39
  用更少的无效 token,把任务做对。
38
40
 
39
- ### 1.0.0:献给 pi 开源社区的一次史诗级升级
41
+ ### 1.0:献给 pi 开源社区的一次史诗级升级
40
42
 
41
43
  冲着成为你首选的 Web Search 工具而来:
42
44
 
@@ -51,7 +53,7 @@ Artificial Analysis Search Index 把差距画得很直观:虚线是**无搜索
51
53
 
52
54
  ## 安装,登录,开搜
53
55
 
54
- **1.0.0 已可用。** 从 [GitHub Release](https://github.com/zhexusun10/pi-better-web-search/releases/tag/v1.0.0) 下载安装包,或在维护者发布后从 npm 安装:
56
+ **1.0.1 已可用。** [查看更新说明与下载安装包](https://github.com/zhexusun10/pi-better-web-search/releases/tag/v1.0.1)。
55
57
 
56
58
  ```bash
57
59
  pi install npm:pi-better-web-search
@@ -78,7 +80,8 @@ pi install ./path/to/pi-better-web-search
78
80
  > 不要和 `pi-web-search` 同时加载。两者都注册 `web_search`,后注册的会覆盖
79
81
  > 先注册的。
80
82
 
81
- 要求:**pi 1.3+**,**Node.js 22.19+**。已通过 **pi 1.5.2** 依赖测试。
83
+ 要求:**pi 1.3+**,**Node.js 22.19+**。**Pi 1.5.2 verified**:已基于 pi 1.5.2
84
+ 宿主依赖通过类型检查和自动化测试。
82
85
 
83
86
  ## 为什么更好用
84
87
 
@@ -159,6 +162,12 @@ URL 失败写入 `fetched[].error`。只有请求结构非法或没有任何成
159
162
 
160
163
  ## 第三方专用 Search API
161
164
 
165
+ **已通过 pi 自带 `/login` 登录官方 DeepSeek,或在 pi 的 `models.json` 配置其 key?
166
+ 无需重复登录扩展。** 插件直接复用 `deepseek` provider 的凭据调用原生 Search/Fetch,
167
+ 即使可用对话模型列表为空或没有 `flash` 模型,也会显示在搜索/抓取首选菜单中。
168
+ 运行 `/web-search-provider fetch` 或 `/web-search-provider search` 即可选择。
169
+ 不调用推理模型,也不复制 key;第三方网关仅提供 DeepSeek 模型不等于官方 API。
170
+
162
171
  直接在 pi 终端运行:
163
172
 
164
173
  ```text
@@ -233,6 +242,9 @@ Provider 识别顺序:
233
242
 
234
243
  ## 在终端选择 provider
235
244
 
245
+ 直接运行 `/pi-better-web-search` 或 `/pi-better-web-search help`,即可查看完整终端命令:
246
+ 登录、搜索/抓取首选与 API 启用/禁用设置。
247
+
236
248
  运行 `/web-search-provider`,分别设置 **Web Search** 和 **URL Fetch** 的首选
237
249
  provider;也可以直接打开对应选择器:
238
250
 
@@ -263,8 +275,10 @@ URL 抓取只重试未成功的 URL;输入校验和取消行为保持不变。
263
275
  ## 自动选择与 fallback
264
276
 
265
277
  模型接口严格限定轻量档位:**OpenAI 只用 `luna`,Claude 只用 `haiku`,DeepSeek 和其他
266
- 品牌只用 `flash`**。这是名称白名单,不是实时价格判断。搜索、URL 分析、当前模型、
267
- 缓存和模型 fallback 都遵守此规则;没有合格模型或可用独立 API 时隐藏工具,不自动升级其他模型档位。
278
+ 品牌只用 `flash`**。这是名称白名单,不是实时价格判断。模型搜索、URL 分析、当前模型、
279
+ 缓存和模型 fallback 都遵守此规则。通过 pi 认证的 DeepSeek 原生工具是纯 API 例外:
280
+ 不调用推理模型,不要求 `flash` id。没有合格模型、pi 已认证的 DeepSeek 原生工具或
281
+ 可用独立 API 时隐藏工具,不自动升级其他推理模型档位。
268
282
 
269
283
  上述轻量档位限制只针对模型接口;专用 Search API 不调用推理模型。
270
284
  在可用的手动首选之后,先尝试已配置的 **Keenable → Exa → Perplexity → 独立 DeepSeek**
@@ -446,10 +460,11 @@ PowerShell 使用 `$env:PI_BETTER_WEB_SEARCH_MAX_CHARS = "100000"`。
446
460
 
447
461
  - 当前对话模型属于上述轻量档位,且支持 provider 原生搜索接口;或
448
462
  - 至少一个已认证的可用轻量模型映射到支持的 provider family;或
463
+ - pi 已配置官方 `deepseek` provider 凭据,可调用原生 Search/Fetch,无需可用对话模型或 `flash` id;或
449
464
  - 已配置可用的专用 Search API,无需对话模型。
450
465
 
451
- 模型接口的 `urls` 暴露也遵守轻量档位限制;独立 Keenable、Exa 和 DeepSeek
452
- 无需 chat 模型即可提供 URL 抓取。
466
+ 模型接口的 `urls` 暴露也遵守轻量档位限制;独立 Keenable、Exa、DeepSeek,
467
+ 以及通过 pi 认证的 DeepSeek 原生工具,无需 chat 模型即可提供 URL 抓取。
453
468
 
454
469
  当前模型不支持搜索,且没有兼容的登录/API key 时,工具保持隐藏(从 active
455
470
  tool set 移除)。扩展不会调用未认证的 provider。可用 provider 或凭据集合变化
@@ -492,6 +507,8 @@ provider;`403`/`404` 作为单个 URL 的错误上报,orchestrator 只重试
492
507
 
493
508
  ## 已验证
494
509
 
510
+ - **Pi 1.5.2 verified**:基于 pi 1.5.2 宿主依赖通过类型检查和自动化测试,
511
+ Node.js 22 / 24 CI 均通过。
495
512
  - **单元/集成测试**:暴露规则、schema 变体、provider 请求形状、SSE 解析、
496
513
  原始结果保留、fallback、缓存失效、URL 处理、截断和取消。
497
514
  - **真实 DeepSeek Search/Fetch**:使用真实 API key,返回 10 条原始搜索结果、
@@ -527,7 +544,7 @@ npm run build
527
544
  ```
528
545
 
529
546
  `npm run build` 会运行检查、测试、包内容验证,并生成
530
- `dist/pi-better-web-search-1.0.0.tgz`。不会自动发布。
547
+ `dist/pi-better-web-search-1.0.1.tgz`。不会自动发布。
531
548
 
532
549
  测试是 `.mjs` 文件,直接导入 `.ts` 源码,mock `globalThis.fetch`,使用临时缓存
533
550
  目录。详见 [测试](testing.md) 和 [发布](publishing.md)。
@@ -20,7 +20,8 @@ output guard. It does not own provider result cleanup.
20
20
  authentication quirks, and stream format.
21
21
  5. **Strict lightweight routing.** Only OpenAI `luna`, Claude `haiku`, and
22
22
  other brands' `flash` models are eligible for model-backed routes. Standalone
23
- APIs are tier-independent. Prefer an explicit user selection, then configured
23
+ APIs and pi-authenticated DeepSeek native tools are tier-independent. Prefer
24
+ an explicit user selection, then configured
24
25
  APIs, then current-provider/cache/family routing. Model hints reselect eligible
25
26
  models and cannot bypass tier rules.
26
27
  6. **Do not touch pi's system prompt.** No prompt snippets, guidelines, loadout
@@ -71,14 +72,17 @@ as standalone interfaces merely because they share the `deepseek` provider id.
71
72
 
72
73
  ## Exposure
73
74
 
74
- A candidate is either a supported lightweight chat model or a configured
75
- standalone retrieval API, both implementing `ProviderAdapter`. Standalone
76
- candidates have internal cache/health identities, not actual inference models.
75
+ A candidate is a supported lightweight chat model, a configured standalone
76
+ retrieval API, or pi-authenticated DeepSeek native tools, all implementing
77
+ `ProviderAdapter`. API-only candidates have internal cache/health identities,
78
+ not actual inference models.
77
79
  The tool is exposed when:
78
80
 
79
81
  - the current conversation model has the required lightweight tier and maps to
80
82
  a supported family; or
81
83
  - `modelRegistry.getAvailable()` contains at least one supported lightweight model; or
84
+ - pi's registry reports configured `deepseek` auth and a native provider endpoint,
85
+ even when no eligible chat model is available; or
82
86
  - a saved-key or environment-configured retrieval API (or explicitly enabled public
83
87
  Keenable) is available, without requiring a model registry entry.
84
88
 
@@ -100,7 +104,7 @@ silently re-add it.
100
104
  ## Candidate ordering
101
105
 
102
106
  An explicit per-phase provider preference is inserted first when authenticated,
103
- lightweight, and supported. This is not a filter: all automatic fallback remains
107
+ supported, and lightweight for inference-backed routes. This is not a filter: all automatic fallback remains
104
108
  available, and the explicit preference is tried first even after failures.
105
109
 
106
110
  Configured Keenable, Exa, Perplexity, then standalone DeepSeek come next, ahead
package/docs/providers.md CHANGED
@@ -60,16 +60,21 @@ For model-backed interfaces, routing strictly requires OpenAI-brand `luna`, Clau
60
60
  brands' `flash` tier, including gateway models and DeepSeek/Ollama credential
61
61
  candidates. Select the highest numeric version within the brand's eligible
62
62
  tier. Current models, cache hints, and fallback cannot bypass this allowlist.
63
- An authenticated native provider with no eligible model does not expose the
64
- tool on its own; configured standalone APIs remain available.
63
+ An authenticated inference-model provider with no eligible model does not expose
64
+ the tool on its own; configured standalone APIs remain available. Pi-authenticated
65
+ DeepSeek Search/Fetch is a provider-level API exception: it needs no inference
66
+ model and does not depend on a `flash` id or a populated available chat catalog.
65
67
 
66
68
  ## DeepSeek
67
69
 
68
70
  DeepSeek uses the documented native Search/Fetch API rather than the older
69
71
  Anthropic-compatible chat route. Neither endpoint sends a `model` parameter:
70
72
  choosing a flash candidate selects credentials/base URL, not an inference
71
- model. The terminal displays the actual Search or Fetch API endpoint rather
72
- than a misleading pro/flash chat-model label.
73
+ model. If no eligible chat route is available, provider-level discovery reuses
74
+ pi's official `deepseek` login or `models.json` credentials directly. No second
75
+ extension login is required; no key is copied into extension storage. The
76
+ terminal displays the actual Search or Fetch API endpoint rather than a
77
+ misleading pro/flash chat-model label.
73
78
 
74
79
  ### Authentication and base URL
75
80
 
@@ -30,7 +30,7 @@ local `pi-web-search` reference checkout, `.env` files, and `DESIGN.md`.
30
30
  npm run build
31
31
  ```
32
32
 
33
- This produces `dist/pi-better-web-search-1.0.0.tgz`. The tarball is not
33
+ This produces `dist/pi-better-web-search-1.0.1.tgz`. The tarball is not
34
34
  committed.
35
35
 
36
36
  ## Publish
@@ -42,7 +42,7 @@ npm publish --access public
42
42
  Alternatively, publish the verified tarball directly:
43
43
 
44
44
  ```bash
45
- npm publish dist/pi-better-web-search-1.0.0.tgz --access public
45
+ npm publish dist/pi-better-web-search-1.0.1.tgz --access public
46
46
  ```
47
47
 
48
48
  When publishing from the checkout, `prepublishOnly` reruns the checks, tests,
@@ -52,10 +52,10 @@ build` first to verify it. npm may require browser or OTP authentication.
52
52
  ## Tag and release
53
53
 
54
54
  ```bash
55
- git tag -a v1.0.0 -m "v1.0.0"
56
- git push origin v1.0.0
57
- gh release create v1.0.0 dist/pi-better-web-search-1.0.0.tgz \
58
- --title "v1.0.0" \
55
+ git tag -a v1.0.1 -m "v1.0.1"
56
+ git push origin v1.0.1
57
+ gh release create v1.0.1 dist/pi-better-web-search-1.0.1.tgz \
58
+ --title "v1.0.1" \
59
59
  --notes-file /path/to/release-notes.md
60
60
  ```
61
61
 
@@ -27,7 +27,16 @@ Terminal login works without a pi chat model. Both native endpoints use the
27
27
  resolved saved/environment key as a Bearer credential, and neither sends a
28
28
  model name. Extension-saved keys are not silently forwarded to arbitrary
29
29
  custom model gateways. It shares credential-specific `Retry-After` across search and fetch, and rejects
30
- malformed header keys before HTTP. Existing pi model/provider authentication is unchanged.
30
+ malformed header keys before HTTP.
31
+
32
+ Pi's official `deepseek` provider is also supported independently: credentials
33
+ saved by pi's `/login` or configured through `models.json` are resolved through
34
+ pi's registry at request time, not copied into this extension. Provider-level
35
+ Search/Fetch discovery works without an available chat model or `flash` id.
36
+ These routes retain pi's configured native/proxy base URL and headers; extension
37
+ API toggles still apply only to the separate saved/environment standalone path.
38
+ Third-party gateways merely listing DeepSeek chat models are not promoted to
39
+ native DeepSeek Search/Fetch.
31
40
 
32
41
  ### Perplexity: standard Search API only
33
42
 
package/docs/testing.md CHANGED
@@ -17,7 +17,7 @@ npm run verify:package
17
17
  tarball contains runtime sources, docs, assets, and metadata, while excluding
18
18
  tests, scripts, CI files, the local reference checkout, and `DESIGN.md`.
19
19
  - `npm run build` runs the checks, tests, package verification, and packs
20
- `dist/pi-better-web-search-1.0.0.tgz`.
20
+ `dist/pi-better-web-search-1.0.1.tgz`.
21
21
 
22
22
  Tests import the TypeScript sources directly. The suite mocks `globalThis.fetch`
23
23
  and uses temporary cache directories. Coverage includes:
@@ -51,7 +51,11 @@ and uses temporary cache directories. Coverage includes:
51
51
  Exa in-flight key-rotation redaction and canonical-URL error statuses; bounded
52
52
  HTTP error cleanup even when underlying stream cancellation never settles;
53
53
  a subprocess-mocked DeepSeek smoke test that cannot call unrelated APIs;
54
- - strict luna/haiku/flash eligibility and numeric newest-version ordering;
54
+ - pi 1.5.2 registry integration using isolated credential/model stores: official
55
+ DeepSeek pi-login and `models.json` auth with an empty chat snapshot, native
56
+ Search/Fetch without a flash id, provider menus/tool exposure, proxy/header
57
+ preservation, login/logout fingerprints, rotation redaction and fallback;
58
+ - strict luna/haiku/flash eligibility for inference-backed routes and numeric newest-version ordering;
55
59
  - explicit/current-provider/cache/family ordering without pinning an older model;
56
60
  - terminal provider pickers, independent persistent search/fetch choices, Auto,
57
61
  cancellation, unavailable choices, and save failures;
@@ -171,7 +175,9 @@ execution, provider switching, the real DeepSeek API, and cache persistence.
171
175
 
172
176
  ## CI
173
177
 
174
- The GitHub Actions workflow runs on Node 22 and 24:
178
+ **Pi 1.5.2 verified** means type checking and automated tests pass against the
179
+ pinned pi 1.5.2 host dependencies. It does not imply live verification of every
180
+ provider. The GitHub Actions workflow runs on Node 22 and 24:
175
181
 
176
182
  ```bash
177
183
  npm ci --ignore-scripts
package/lib/candidates.ts CHANGED
@@ -22,6 +22,8 @@ export interface Candidate {
22
22
  model: Model<Api>;
23
23
  family: ProviderFamily;
24
24
  adapter: ProviderAdapter;
25
+ /** Provider-level tools use no inference model and have no model-tier limit. */
26
+ nativeTools?: true;
25
27
  }
26
28
 
27
29
  export interface ResolutionContext {
@@ -71,11 +73,12 @@ function modelBrandRank(id: string): number {
71
73
  }
72
74
 
73
75
  /**
74
- * A strict allowlist, not a price estimate: never fall back to a larger tier.
76
+ * A strict allowlist for inference-backed routes, not a price estimate:
77
+ * never fall back to a larger tier. API-only tools invoke no inference model.
75
78
  * Classify by model brand, not API family, so gateways follow the same rule.
76
79
  */
77
80
  function isLightweightCandidate(candidate: Candidate): boolean {
78
- if (candidate.adapter.standalone) return true;
81
+ if (candidate.adapter.standalone || candidate.nativeTools) return true;
79
82
  const id = normalizedModelId(candidate.model.id);
80
83
  const brand = modelBrandRank(id);
81
84
  const tier = brand === 1 ? "luna" : brand === 2 ? "haiku" : "flash";
@@ -160,6 +163,42 @@ function dedicatedCandidate(provider: DedicatedProvider): Candidate {
160
163
  return { model, family: provider, adapter: provider === "deepseek" ? { ...adapter, standalone: true } : adapter };
161
164
  }
162
165
 
166
+ /** Reuse pi's DeepSeek login even while its chat catalog is empty, filtered,
167
+ * stale, or contains only non-flash ids. Never read/copy pi's credential file. */
168
+ function piDeepSeekToolsCandidate(
169
+ ctx: ExtensionContext,
170
+ nativeCandidates: Candidate[],
171
+ current: Candidate | undefined,
172
+ ): Candidate | undefined {
173
+ if (nativeCandidates.some(candidate => candidate.family === "deepseek" && supportsUrls(candidate))) {
174
+ return undefined; // The existing authenticated model route already works.
175
+ }
176
+ try {
177
+ const registry = ctx.modelRegistry;
178
+ const provider = registry.getProvider?.("deepseek");
179
+ // Preserve configured native/proxy origins; never borrow another provider's key.
180
+ const baseUrl = provider?.baseUrl
181
+ || registry.getAll?.().find(model => model.provider === "deepseek" && isChatModel(model))?.baseUrl;
182
+ if (!baseUrl) return undefined;
183
+ const model: Model<Api> = {
184
+ ...dedicatedCandidate("deepseek").model,
185
+ id: "pi-search-fetch",
186
+ api: "pi-native-web-search",
187
+ baseUrl,
188
+ };
189
+ const configured = registry.getProviderAuthStatus?.("deepseek").configured
190
+ || registry.hasConfiguredAuth(model);
191
+ if (!configured) return undefined;
192
+ if (current?.family === "deepseek" && supportsUrls(current) && registry.hasConfiguredAuth(current.model)) {
193
+ return undefined;
194
+ }
195
+ return { model, family: "deepseek", adapter: getAdapterForFamily("deepseek")!, nativeTools: true };
196
+ } catch {
197
+ // Older registries or failed provider discovery must not break other routes.
198
+ return undefined;
199
+ }
200
+ }
201
+
163
202
  function availableModels(ctx: ExtensionContext): Model<Api>[] {
164
203
  try {
165
204
  const models = ctx.modelRegistry.getAvailable();
@@ -193,12 +232,18 @@ export function resolveResolutionContext(
193
232
  available.push(candidate);
194
233
  }
195
234
 
235
+ const piDeepSeek = piDeepSeekToolsCandidate(ctx, available, current);
236
+ if (piDeepSeek) available.push(piDeepSeek);
237
+
196
238
  const preferences = readProviderPreferences();
197
239
  for (const provider of configuredDedicatedProviders(preferences.apis)) {
198
240
  available.push(dedicatedCandidate(provider));
199
241
  }
200
242
  const cache = readCache();
201
- const fingerprint = fingerprintAvailableModels(ctx, models, dedicatedFingerprintEntries(preferences.apis));
243
+ const fingerprint = fingerprintAvailableModels(ctx, models, [
244
+ ...dedicatedFingerprintEntries(preferences.apis),
245
+ ...(piDeepSeek ? [`pi-tools:deepseek@${piDeepSeek.model.baseUrl}`] : []),
246
+ ]);
202
247
  return {
203
248
  ctx,
204
249
  ...(conversationModel ? { currentProvider: conversationModel.provider } : {}),
@@ -215,7 +260,7 @@ function compareText(left: string, right: string): number {
215
260
  return left < right ? -1 : left > right ? 1 : 0;
216
261
  }
217
262
 
218
- /** Only lightweight models are eligible; newest version wins within a brand. */
263
+ /** Inference-backed routes require lightweight models; newest version wins. */
219
264
  export function rankFamilyCandidates(candidates: Candidate[]): Candidate[] {
220
265
  return candidates.filter(isLightweightCandidate).sort((left, right) => {
221
266
  const standaloneOrder = Number(!!right.adapter.standalone) - Number(!!left.adapter.standalone);
@@ -6,17 +6,28 @@ import { promptApiKey } from "./secret-input.ts";
6
6
 
7
7
  export const LOGIN_COMMAND_NAME = "pi-better-web-search";
8
8
 
9
+ const COMMAND_HELP = [
10
+ "Usage:",
11
+ `/${LOGIN_COMMAND_NAME} [help] — show all web search commands`,
12
+ `/${LOGIN_COMMAND_NAME} login|logout|status — manage saved API keys`,
13
+ "/web-search-provider search — choose the preferred search provider",
14
+ "/web-search-provider fetch — choose the preferred URL fetch provider",
15
+ "/web-search-api [deepseek|exa|keenable|perplexity] — enable/disable standalone APIs",
16
+ "Search and fetch preferences are independent. Manual preferences are tried first; automatic fallback remains enabled.",
17
+ "Enter keys only in the hidden terminal dialog, never in a command argument.",
18
+ ].join("\n");
19
+
9
20
  export function registerLoginCommand(
10
21
  pi: Pick<ExtensionAPI, "registerCommand">,
11
22
  onChanged?: (ctx: ExtensionContext) => void,
12
23
  ): void {
13
24
  pi.registerCommand(LOGIN_COMMAND_NAME, {
14
- description: "Login, logout or view saved API-key status for DeepSeek, Exa, Keenable and Perplexity",
25
+ description: "Web search help and API login/logout/status; discover provider preferences and API settings",
15
26
  handler: async (args, ctx) => {
16
27
  const action = args.trim();
17
28
  // Never accept an API key as an argument: arguments can enter history.
18
29
  if (!["login", "logout", "status"].includes(action)) {
19
- ctx.ui.notify(`Usage: /${LOGIN_COMMAND_NAME} login|logout|status. Enter keys only in the hidden terminal dialog, never in a command argument.`, "warning");
30
+ ctx.ui.notify(COMMAND_HELP, !action || action === "help" ? "info" : "warning");
20
31
  return;
21
32
  }
22
33
  if (!ctx.hasUI || ctx.mode !== "tui" || typeof ctx.ui.custom !== "function") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-better-web-search",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Give pi agents the web: native Keenable, Exa, Perplexity and DeepSeek search APIs, URL fetch, raw results, and automatic provider fallback.",
5
5
  "type": "module",
6
6
  "license": "MIT",