@wha7ever/dsh-web-search-anysearch 0.2.0
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/LICENSE +22 -0
- package/README.md +137 -0
- package/README.zh-CN.md +137 -0
- package/cordis.patch.yml +10 -0
- package/lib/client.d.ts +60 -0
- package/lib/client.js +488 -0
- package/lib/fetch-provider.d.ts +16 -0
- package/lib/fetch-provider.js +52 -0
- package/lib/index.d.ts +40 -0
- package/lib/index.js +70 -0
- package/lib/limits.d.ts +8 -0
- package/lib/limits.js +8 -0
- package/lib/provider.d.ts +18 -0
- package/lib/provider.js +52 -0
- package/lib/tools/batch.d.ts +67 -0
- package/lib/tools/batch.js +248 -0
- package/lib/tools/capabilities.d.ts +14 -0
- package/lib/tools/capabilities.js +171 -0
- package/lib/tools/search.d.ts +32 -0
- package/lib/tools/search.js +233 -0
- package/lib/types.d.ts +83 -0
- package/lib/types.js +1 -0
- package/lib/version.d.ts +4 -0
- package/lib/version.js +4 -0
- package/package.json +88 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 AnySearch Team
|
|
4
|
+
Copyright (c) 2026 wha7ever (fork modifications: package identity, DSH compatibility metadata, publishing pipeline)
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
<h1>@wha7ever/dsh-web-search-anysearch</h1>
|
|
3
|
+
<p>AnySearch-powered real-time web and vertical search for DeepSeek Harness.</p>
|
|
4
|
+
<p><a href="https://www.npmjs.com/package/@wha7ever/dsh-web-search-anysearch"><img src="https://img.shields.io/npm/v/%40wha7ever%2Fdsh-web-search-anysearch?logo=npm" alt="npm version"></a> <a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="MIT license"></a> <a href="https://github.com/deepseek-ai/deepseek-harness"><img src="https://img.shields.io/badge/DeepSeek-Harness-4F46E5" alt="DeepSeek Harness plugin"></a></p>
|
|
5
|
+
<p><strong>English</strong> | <a href="README.zh-CN.md">简体中文</a></p>
|
|
6
|
+
</div>
|
|
7
|
+
|
|
8
|
+
> **Community fork.** This package republishes [`@anysearch/anysearch-dsh`](https://github.com/anysearch-team/anysearch-dsh) (MIT, © 2026 AnySearch Team) with updated DSH compatibility metadata and publishing pipeline. Provider code, tools, and behavior are those of upstream 0.1.6; no feature changes. Not affiliated with or endorsed by AnySearch. Do **not** install it alongside the upstream plugin: both register the same `anysearch` web provider id.
|
|
9
|
+
|
|
10
|
+
`@wha7ever/dsh-web-search-anysearch` connects [AnySearch](https://anysearch.com) to [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) as a plugin. Keep using Harness's native `web_search` and `web_fetch` while gaining real-time web search, cleaned URL content, vertical search, and concurrent batch search.
|
|
11
|
+
|
|
12
|
+
AnySearch is search infrastructure for AI agents, covering the public web and specialized data sources across code, finance, academia, law, security, and more.
|
|
13
|
+
|
|
14
|
+
## Quick start
|
|
15
|
+
|
|
16
|
+
Install the plugin into the `web` profile:
|
|
17
|
+
|
|
18
|
+
```sh
|
|
19
|
+
npx -y @deepseek-ai/dsh plugin --profile web add @wha7ever/dsh-web-search-anysearch
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Start DeepSeek Harness:
|
|
23
|
+
|
|
24
|
+
```sh
|
|
25
|
+
npx -y @deepseek-ai/dsh web
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
No API key is required for a quick start. Requests use AnySearch's anonymous quota until you configure one.
|
|
29
|
+
|
|
30
|
+
## What you get
|
|
31
|
+
|
|
32
|
+
- Through Harness's built-in `web_search`, AnySearch returns results with titles, snippets, and URLs for easy citation.
|
|
33
|
+
- Through Harness's built-in `web_fetch`, AnySearch Extract retrieves and cleans the content of a specific public HTTP(S) URL.
|
|
34
|
+
- Discover searchable domains, vertical categories, and supported parameters in real time, then run advanced searches using tags, regions, languages, and structured parameters.
|
|
35
|
+
- Run one to five searches concurrently; an individual failure does not affect the other results.
|
|
36
|
+
- Advanced search preserves useful structured results without source URLs, while page-backed results can return cleaned content on demand.
|
|
37
|
+
|
|
38
|
+
## Optional API key
|
|
39
|
+
|
|
40
|
+
Try it without an API key.
|
|
41
|
+
|
|
42
|
+
Sign up for an AnySearch account and configure an API key to get 1,000 free search calls per day.
|
|
43
|
+
|
|
44
|
+
Sign up or sign in at [anysearch.com](https://anysearch.com), then visit [API Keys](https://www.anysearch.com/console/api-keys) to get one. Store the key in `$DSH_HOME/.credentials.yaml` (`~/.dsh/.credentials.yaml` by default):
|
|
45
|
+
|
|
46
|
+
```yaml
|
|
47
|
+
ANYSEARCH_API_KEY: "as_sk_your_key"
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
The plugin resolves the managed credential for every operation, so credential rotation reaches the next request without restarting DSH. A launching `ANYSEARCH_API_KEY` environment variable has higher priority.
|
|
51
|
+
|
|
52
|
+
Inspect the composed profile without exposing the credential value:
|
|
53
|
+
|
|
54
|
+
```sh
|
|
55
|
+
npx -y @deepseek-ai/dsh --profile web --dump-config
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Tools
|
|
59
|
+
|
|
60
|
+
| Use case | Harness tool |
|
|
61
|
+
|---|---|
|
|
62
|
+
| Ordinary web search | `web_search` |
|
|
63
|
+
| Fetch and clean a specific URL | `web_fetch` |
|
|
64
|
+
| Discover available domains and tags | `anysearch_capabilities` |
|
|
65
|
+
| Vertical or parameterized search | `anysearch_search` |
|
|
66
|
+
| Run one to five searches together | `anysearch_batch_search` |
|
|
67
|
+
|
|
68
|
+
For ordinary prompts, let Harness select the tool. Models can discover live domain and parameter definitions before making a specialized search.
|
|
69
|
+
|
|
70
|
+
## Environment requirements
|
|
71
|
+
|
|
72
|
+
Requires Node.js 22.19 or Node.js 24+, pnpm 11.7, and DeepSeek Harness. The DSH plugin command uses pnpm to manage profile dependencies, so `pnpm` must be available on `PATH`.
|
|
73
|
+
|
|
74
|
+
Windows, Linux, and macOS use the same installation command. Before installing, ensure that Node.js, `npx`, and `pnpm` can all be run directly from `PATH`.
|
|
75
|
+
|
|
76
|
+
## Configuration
|
|
77
|
+
|
|
78
|
+
The bundled profile layer automatically selects AnySearch as the existing `ctx.web` search and fetch provider, enables `web_fetch`, and mounts the advanced tools, so no changes are required by default.
|
|
79
|
+
|
|
80
|
+
To customize it, add the complete block below to the target DSH profile's user configuration layer, overriding the bundled `id: web-search-anysearch` entry. Keep the `id` unchanged, replace the complete `config`, and do not add a second AnySearch provider under a different ID:
|
|
81
|
+
|
|
82
|
+
```yaml
|
|
83
|
+
- id: web-search-anysearch
|
|
84
|
+
config:
|
|
85
|
+
apiKeyEnv: ANYSEARCH_API_KEY
|
|
86
|
+
baseURL: https://api.anysearch.com
|
|
87
|
+
maxRenderedContentChars: 12000
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
| Field | Default | Purpose |
|
|
91
|
+
|---|---|---|
|
|
92
|
+
| `apiKeyEnv` | `ANYSEARCH_API_KEY` | DSH credential reference; missing uses anonymous access |
|
|
93
|
+
| `baseURL` | `https://api.anysearch.com` | AnySearch API base URL |
|
|
94
|
+
| `maxRenderedContentChars` | `12000` | Maximum result-content characters rendered to the model per advanced tool call |
|
|
95
|
+
|
|
96
|
+
## Manage the plugin
|
|
97
|
+
|
|
98
|
+
Update:
|
|
99
|
+
|
|
100
|
+
```sh
|
|
101
|
+
npx -y @deepseek-ai/dsh plugin --profile web update @wha7ever/dsh-web-search-anysearch
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Remove:
|
|
105
|
+
|
|
106
|
+
```sh
|
|
107
|
+
npx -y @deepseek-ai/dsh plugin --profile web remove @wha7ever/dsh-web-search-anysearch
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## Compatibility and limitations
|
|
111
|
+
|
|
112
|
+
- DSH peer range: `>=0.1.7-rc.2 <0.2.0-0 || >=0.2.0-rc.1 <0.3.0-0` for the `@deepseek-ai/dsh-*` services this plugin consumes. Validated against DSH `0.1.7-rc.2` and `0.2.0-rc.2`; every plugin-facing DSH package is byte-identical between those releases.
|
|
113
|
+
- DeepSeek Harness is in developer preview and may make compatibility-breaking changes.
|
|
114
|
+
- URL extraction is exposed through Harness's provider-neutral `web_fetch`; the plugin does not add a duplicate `anysearch_extract` tool.
|
|
115
|
+
- Configure the API key through DSH-managed credentials or an environment variable; the DSH settings page does not currently provide a third-party Provider credential field.
|
|
116
|
+
- Known upstream behavior: the bundle patch selects `searchProvider: anysearch` for the host `web` service. Toggling the plugin off without removing it leaves that selection dangling, so `web_search`/`web_fetch` fail with `WEB_PROVIDER_CONFIGURED_MISSING` until you remove the plugin or override the `web` row. See [upstream issue #15](https://github.com/anysearch-team/anysearch-dsh/issues/15).
|
|
117
|
+
|
|
118
|
+
## Development
|
|
119
|
+
|
|
120
|
+
This package lives in the [`wha7ev9r/dsh-kit`](https://github.com/wha7ev9r/dsh-kit) monorepo:
|
|
121
|
+
|
|
122
|
+
```sh
|
|
123
|
+
git clone https://github.com/wha7ev9r/dsh-kit.git
|
|
124
|
+
cd dsh-kit
|
|
125
|
+
pnpm install --ignore-scripts
|
|
126
|
+
pnpm --filter @wha7ever/dsh-web-search-anysearch run check
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
The live AnySearch E2E suite is opt-in. Run it without ambient credentials in anonymous mode:
|
|
130
|
+
|
|
131
|
+
```sh
|
|
132
|
+
ANYSEARCH_E2E=1 ANYSEARCH_E2E_ANONYMOUS=1 pnpm --filter @wha7ever/dsh-web-search-anysearch run test:e2e
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
## License
|
|
136
|
+
|
|
137
|
+
[MIT](LICENSE). Based on [`@anysearch/anysearch-dsh`](https://github.com/anysearch-team/anysearch-dsh), © 2026 AnySearch Team; fork modifications © 2026 wha7ever.
|
package/README.zh-CN.md
ADDED
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
<h1>@wha7ever/dsh-web-search-anysearch</h1>
|
|
3
|
+
<p>由 AnySearch 驱动,为 DeepSeek Harness 提供实时网页搜索与垂直领域搜索能力。</p>
|
|
4
|
+
<p><a href="https://www.npmjs.com/package/@wha7ever/dsh-web-search-anysearch"><img src="https://img.shields.io/npm/v/%40wha7ever%2Fdsh-web-search-anysearch?logo=npm" alt="npm 版本"></a> <a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="MIT 许可证"></a> <a href="https://github.com/deepseek-ai/deepseek-harness"><img src="https://img.shields.io/badge/DeepSeek-Harness-4F46E5" alt="DeepSeek Harness 插件"></a></p>
|
|
5
|
+
<p><a href="README.md">English</a> | <strong>简体中文</strong></p>
|
|
6
|
+
</div>
|
|
7
|
+
|
|
8
|
+
> **社区二开版。** 本包基于 [`@anysearch/anysearch-dsh`](https://github.com/anysearch-team/anysearch-dsh)(MIT,© 2026 AnySearch Team)重新发布,仅更新 DSH 兼容声明与发布流水线;Provider 代码、工具与行为均与上游 0.1.6 一致,未做功能改动。与 AnySearch 官方无隶属关系。**请勿与原版同时安装**:两者注册相同的 `anysearch` web provider id。
|
|
9
|
+
|
|
10
|
+
`@wha7ever/dsh-web-search-anysearch` 将 [AnySearch](https://anysearch.com) 作为插件接入 [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness)。无需改变 Harness 使用方式,即可通过原生 `web_search` 和 `web_fetch` 获得实时网页搜索、URL 清洗正文、垂直领域搜索和批量搜索能力。
|
|
11
|
+
|
|
12
|
+
AnySearch 是面向 AI Agent 的搜索基础设施,覆盖公开网页,以及代码、金融、学术、法律、安全等专业数据源。
|
|
13
|
+
|
|
14
|
+
## 快速开始
|
|
15
|
+
|
|
16
|
+
将插件安装到 `web` profile:
|
|
17
|
+
|
|
18
|
+
```sh
|
|
19
|
+
npx -y @deepseek-ai/dsh plugin --profile web add @wha7ever/dsh-web-search-anysearch
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
启动 DeepSeek Harness:
|
|
23
|
+
|
|
24
|
+
```sh
|
|
25
|
+
npx -y @deepseek-ai/dsh web
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
快速体验不需要 API Key。未配置时,请求使用 AnySearch 匿名额度。
|
|
29
|
+
|
|
30
|
+
## 提供什么
|
|
31
|
+
|
|
32
|
+
- 通过 Harness 内置的 `web_search` 返回 AnySearch 搜索结果,来源包含标题、摘要和 URL,便于引用。
|
|
33
|
+
- 通过 Harness 内置的 `web_fetch` 调用 AnySearch Extract,抓取并清洗指定公开 HTTP(S) URL 的正文。
|
|
34
|
+
- 实时发现可搜索领域、垂直分类和支持的参数,再用标签、地区、语言和结构化参数执行高级搜索。
|
|
35
|
+
- 一次并发执行一至五个搜索,单项失败不影响其他结果。
|
|
36
|
+
- 高级搜索会保留没有来源 URL 的有效结构化结果;对于带网页来源的结果,可按需返回清洗正文。
|
|
37
|
+
|
|
38
|
+
## 可选 API Key
|
|
39
|
+
|
|
40
|
+
无需 API Key 即可体验。
|
|
41
|
+
|
|
42
|
+
注册 AnySearch 账号并配置 API Key 后,可获得每天 1000 次免费搜索调用额度。
|
|
43
|
+
|
|
44
|
+
访问 [anysearch.com](https://anysearch.com) 注册并登录,然后前往 [API Keys](https://www.anysearch.com/console/api-keys) 获取。获取后,将凭据写入 `$DSH_HOME/.credentials.yaml`,默认位置是 `~/.dsh/.credentials.yaml`:
|
|
45
|
+
|
|
46
|
+
```yaml
|
|
47
|
+
ANYSEARCH_API_KEY: "as_sk_your_key"
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
插件会在每次操作时解析受管凭据,因此轮换凭据后,下一次请求即可使用新值,无需重启 DSH。启动进程的 `ANYSEARCH_API_KEY` 环境变量具有更高优先级。
|
|
51
|
+
|
|
52
|
+
可以检查最终组合配置,输出中不会出现真实凭据值:
|
|
53
|
+
|
|
54
|
+
```sh
|
|
55
|
+
npx -y @deepseek-ai/dsh --profile web --dump-config
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## 工具
|
|
59
|
+
|
|
60
|
+
| 使用场景 | Harness 工具 |
|
|
61
|
+
|---|---|
|
|
62
|
+
| 普通网页搜索 | `web_search` |
|
|
63
|
+
| 抓取并清洗指定 URL | `web_fetch` |
|
|
64
|
+
| 查看可用领域和标签 | `anysearch_capabilities` |
|
|
65
|
+
| 垂直或参数化搜索 | `anysearch_search` |
|
|
66
|
+
| 一次执行一至五个搜索 | `anysearch_batch_search` |
|
|
67
|
+
|
|
68
|
+
对于普通提示词,让 Harness 自动选择工具即可。模型可以先读取实时领域和参数定义,再执行专门搜索。
|
|
69
|
+
|
|
70
|
+
## 环境依赖
|
|
71
|
+
|
|
72
|
+
需要 Node.js 22.19 或 Node.js 24+、pnpm 11.7 和 DeepSeek Harness。DSH 插件命令使用 pnpm 管理 profile 依赖,因此 `pnpm` 必须位于 `PATH` 中。
|
|
73
|
+
|
|
74
|
+
Windows、Linux 和 macOS 使用相同的安装命令。安装前请确保 Node.js、`npx` 和 `pnpm` 均可从 `PATH` 直接运行。
|
|
75
|
+
|
|
76
|
+
## 配置
|
|
77
|
+
|
|
78
|
+
随包提供的 profile 层会自动将 AnySearch 设为现有 `ctx.web` 的搜索与抓取 Provider、启用 `web_fetch`,并挂载高级工具,默认无需修改。
|
|
79
|
+
|
|
80
|
+
如需自定义,请把下面的完整条目加入目标 DSH profile 的用户配置层,以覆盖随包提供的 `id: web-search-anysearch` 配置。保持 `id` 不变,完整替换 `config`,不要使用不同 ID 新增第二个 AnySearch Provider:
|
|
81
|
+
|
|
82
|
+
```yaml
|
|
83
|
+
- id: web-search-anysearch
|
|
84
|
+
config:
|
|
85
|
+
apiKeyEnv: ANYSEARCH_API_KEY
|
|
86
|
+
baseURL: https://api.anysearch.com
|
|
87
|
+
maxRenderedContentChars: 12000
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
| 字段 | 默认值 | 用途 |
|
|
91
|
+
|---|---|---|
|
|
92
|
+
| `apiKeyEnv` | `ANYSEARCH_API_KEY` | DSH 凭据引用;缺失时使用匿名访问 |
|
|
93
|
+
| `baseURL` | `https://api.anysearch.com` | AnySearch API 基础地址 |
|
|
94
|
+
| `maxRenderedContentChars` | `12000` | 单次高级工具调用向模型展示的结果正文字符上限 |
|
|
95
|
+
|
|
96
|
+
## 管理插件
|
|
97
|
+
|
|
98
|
+
更新:
|
|
99
|
+
|
|
100
|
+
```sh
|
|
101
|
+
npx -y @deepseek-ai/dsh plugin --profile web update @wha7ever/dsh-web-search-anysearch
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
移除:
|
|
105
|
+
|
|
106
|
+
```sh
|
|
107
|
+
npx -y @deepseek-ai/dsh plugin --profile web remove @wha7ever/dsh-web-search-anysearch
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## 兼容性与限制
|
|
111
|
+
|
|
112
|
+
- DSH peer 范围:本插件消费的 `@deepseek-ai/dsh-*` 服务声明为 `>=0.1.7-rc.2 <0.2.0-0 || >=0.2.0-rc.1 <0.3.0-0`。已在 DSH `0.1.7-rc.2` 与 `0.2.0-rc.2` 上验证;这两个版本之间所有插件可见的 DSH 包逐字节相同。
|
|
113
|
+
- DeepSeek Harness 仍处于开发预览阶段,可能发布不兼容变更。
|
|
114
|
+
- 网页提取通过 Harness 原生 `web_fetch` 暴露;插件不会再增加一个重复的 `anysearch_extract` 工具。
|
|
115
|
+
- 请通过 DSH 管理的凭据文件或环境变量配置 API Key;DSH 设置页当前不提供第三方 Provider 凭据输入项。
|
|
116
|
+
- 已知上游行为:随包 patch 会把宿主 `web` 服务指向 `searchProvider: anysearch`。仅把插件开关关掉而不移除,会让该指向悬空,`web_search`/`web_fetch` 会持续报 `WEB_PROVIDER_CONFIGURED_MISSING`;需移除插件或覆盖 `web` 行才能恢复。详见[上游 issue #15](https://github.com/anysearch-team/anysearch-dsh/issues/15)。
|
|
117
|
+
|
|
118
|
+
## 开发
|
|
119
|
+
|
|
120
|
+
本包位于 [`wha7ev9r/dsh-kit`](https://github.com/wha7ev9r/dsh-kit) monorepo:
|
|
121
|
+
|
|
122
|
+
```sh
|
|
123
|
+
git clone https://github.com/wha7ev9r/dsh-kit.git
|
|
124
|
+
cd dsh-kit
|
|
125
|
+
pnpm install --ignore-scripts
|
|
126
|
+
pnpm --filter @wha7ever/dsh-web-search-anysearch run check
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
真实 AnySearch E2E 测试需要显式开启。匿名模式不会读取环境中的凭据:
|
|
130
|
+
|
|
131
|
+
```sh
|
|
132
|
+
ANYSEARCH_E2E=1 ANYSEARCH_E2E_ANONYMOUS=1 pnpm --filter @wha7ever/dsh-web-search-anysearch run test:e2e
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
## 许可证
|
|
136
|
+
|
|
137
|
+
[MIT](LICENSE)。基于 [`@anysearch/anysearch-dsh`](https://github.com/anysearch-team/anysearch-dsh),© 2026 AnySearch Team;二开修改部分 © 2026 wha7ever。
|
package/cordis.patch.yml
ADDED
package/lib/client.d.ts
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/** Shared HTTP client for every AnySearch provider and tool operation. */
|
|
2
|
+
import type { AnySearchDomainsResponse, AnySearchExtractRequest, AnySearchExtractResponse, AnySearchSearchRequest, AnySearchSearchResponse, AnySearchSubDomainsResponse } from './types.ts';
|
|
3
|
+
export { ANYSEARCH_DSH_CLIENT_ID } from './version.ts';
|
|
4
|
+
/** Public AnySearch API origin. */
|
|
5
|
+
export declare const ANYSEARCH_DEFAULT_BASE_URL = "https://api.anysearch.com";
|
|
6
|
+
/** AnySearch operation names retained in safe diagnostics. */
|
|
7
|
+
export type AnySearchOperation = 'search' | 'extract' | 'domains' | 'sub_domains';
|
|
8
|
+
/** Resolved AnySearch client configuration. */
|
|
9
|
+
export interface AnySearchClientOptions {
|
|
10
|
+
/** Resolve the API key for one operation; `undefined` uses anonymous access. */
|
|
11
|
+
resolveApiKey: () => Promise<string | undefined>;
|
|
12
|
+
/** Credential reference whose literal value must never be sent as an API key. */
|
|
13
|
+
apiKeyReference?: string;
|
|
14
|
+
/** API base URL; public paths are appended to its pathname. */
|
|
15
|
+
baseURL: string;
|
|
16
|
+
}
|
|
17
|
+
/** Safe HTTP and credential failure surfaced by the shared client. */
|
|
18
|
+
export declare class AnySearchClientError extends Error {
|
|
19
|
+
/** Failure category used by Harness adapters. */
|
|
20
|
+
readonly kind: 'aborted' | 'provider';
|
|
21
|
+
/** Operation that failed. */
|
|
22
|
+
readonly operation: AnySearchOperation;
|
|
23
|
+
/** Upstream HTTP status when a response arrived. */
|
|
24
|
+
readonly httpStatus?: number;
|
|
25
|
+
/** Authentication mode used for an upstream response. */
|
|
26
|
+
readonly authentication?: 'anonymous' | 'credential';
|
|
27
|
+
/** AnySearch request id when the response supplied one. */
|
|
28
|
+
readonly requestId?: string;
|
|
29
|
+
/** Upstream retry delay retained for diagnostics; the client never retries. */
|
|
30
|
+
readonly retryAfter?: string;
|
|
31
|
+
/** Stable AnySearch business error code when the response supplied one. */
|
|
32
|
+
readonly errorCode?: string;
|
|
33
|
+
constructor(message: string, options: {
|
|
34
|
+
kind?: 'aborted' | 'provider';
|
|
35
|
+
operation: AnySearchOperation;
|
|
36
|
+
httpStatus?: number;
|
|
37
|
+
authentication?: 'anonymous' | 'credential';
|
|
38
|
+
requestId?: string;
|
|
39
|
+
retryAfter?: string;
|
|
40
|
+
errorCode?: string;
|
|
41
|
+
cause?: unknown;
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
/** HTTP client shared by the native Provider and AnySearch-specific tools. */
|
|
45
|
+
export declare class AnySearchClient {
|
|
46
|
+
private readonly options;
|
|
47
|
+
constructor(options: AnySearchClientOptions);
|
|
48
|
+
/** Whether the configured base URL can produce public HTTP endpoints. */
|
|
49
|
+
available(): boolean;
|
|
50
|
+
/** Execute one search and validate its complete response. */
|
|
51
|
+
search(request: AnySearchSearchRequest, signal?: AbortSignal): Promise<AnySearchSearchResponse>;
|
|
52
|
+
/** Extract and validate the cleaned content of one public HTTP(S) URL. */
|
|
53
|
+
extract(request: AnySearchExtractRequest, signal?: AbortSignal): Promise<AnySearchExtractResponse>;
|
|
54
|
+
/** List all top-level domains in the dynamic capability catalog. */
|
|
55
|
+
listDomains(signal?: AbortSignal): Promise<AnySearchDomainsResponse>;
|
|
56
|
+
/** Read detailed capabilities for the supplied ordered domain names. */
|
|
57
|
+
getSubDomains(domains: readonly string[], signal?: AbortSignal): Promise<AnySearchSubDomainsResponse>;
|
|
58
|
+
private request;
|
|
59
|
+
private resolveApiKey;
|
|
60
|
+
}
|