dsh-querit 1.0.1 → 1.0.3
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/README-zh.md +6 -4
- package/README.md +7 -5
- package/cordis.patch.yml +19 -0
- package/lib/index.d.ts +5 -4
- package/lib/index.js +5 -3
- package/lib/provider.js +1 -1
- package/package.json +7 -1
package/README-zh.md
CHANGED
|
@@ -8,7 +8,7 @@ English | [中文](./README-zh.md)
|
|
|
8
8
|
|
|
9
9
|
## 快速开始
|
|
10
10
|
|
|
11
|
-
1.
|
|
11
|
+
1. 按「安装与更新」装包即可。v1.0.3 起本包以 *profile bundle* 形式发布:`dsh plugin add` 会自动完成接线(注册插件行并路由接缝),无需手改 `cordis.patch.yml`(「接线」一节说明了它具体应用的内容,以及如何覆盖默认值)。
|
|
12
12
|
2. 按优先级配置 API key:
|
|
13
13
|
- 启动环境里的 `QUERIT_API_KEY` 环境变量,或
|
|
14
14
|
- 凭据存储(`$DSH_HOME/.credentials.yaml` 加一行 `QUERIT_API_KEY: <key>`,热加载、无需重启),或
|
|
@@ -29,6 +29,8 @@ dsh plugin --profile web add dsh-querit
|
|
|
29
29
|
|
|
30
30
|
(`dsh plugin` 会把参数转发给 profile 目录下的 pnpm;`web` 换成你的 profile 名。)
|
|
31
31
|
|
|
32
|
+
安装还会同步 profile 的 bundle 列表:由于 `dsh-querit` 声明了 `dsh.bundle`,它会自动加入 `dsh.profile.bundles`,随包分发的补丁层会自动注册插件行并完成接缝路由(条目见「接线」)。装完重启 profile 即生效。手动接线只在 1.0.3 之前的版本或需要覆盖 bundle 默认行值时才有必要。
|
|
33
|
+
|
|
32
34
|
### 更新
|
|
33
35
|
|
|
34
36
|
```bash
|
|
@@ -53,7 +55,7 @@ dsh plugin --profile web add ./dsh-querit-<版本号>.tgz
|
|
|
53
55
|
|
|
54
56
|
## 接线
|
|
55
57
|
|
|
56
|
-
|
|
58
|
+
v1.0.3 起本包以 profile bundle 形式发布,随包补丁层会自动完成以下全部接线。作为参考,它会应用(包内 `cordis.patch.yml`)如下条目:
|
|
57
59
|
|
|
58
60
|
```yaml
|
|
59
61
|
# 添加插件行(同时注册 Querit provider 与 web_fetch 工具)
|
|
@@ -70,14 +72,14 @@ dsh plugin --profile web add ./dsh-querit-<版本号>.tgz
|
|
|
70
72
|
fetchProvider: querit
|
|
71
73
|
```
|
|
72
74
|
|
|
73
|
-
|
|
75
|
+
这就是全部接线:`web_search`(由 preset 按会话注册)与 `web_fetch`(由本包注册)都经由 `ctx.web`,后者现在选择 Querit。补丁会**整体替换**目标行的 `config`,所以上面 `web` 条目把两个键都写全了。bundle 层位于 base 与 app bundle 之后,因此它的 `web` 覆盖生效;若你的 profile 自己的 `cordis.patch.yml` 或 `--patch` 覆盖层更晚出现并重写该行,则以你为准——这也是切回 DeepSeek 搜索(`searchProvider: deepseek-official`)或固定自定义默认值的方式。API key 可以通过凭据服务、启动环境的 `QUERIT_API_KEY`、或行内 `apiKey` 字面量提供;改完重启 profile 生效。若某个 preset 自行注册了 `web_fetch`,请把本行 `fetch` 设为 `false`。
|
|
74
76
|
|
|
75
77
|
## 配置项
|
|
76
78
|
|
|
77
79
|
| 键 | 默认值 | 说明 |
|
|
78
80
|
|---|---|---|
|
|
79
81
|
| `apiKey` | 无 | 字面量 Querit API key(优先用 `apiKeyEnv`,避免密钥进配置文件;两者同时设置时 `apiKeyEnv` 环境变量优先) |
|
|
80
|
-
| `apiKeyEnv` | `QUERIT_API_KEY` |
|
|
82
|
+
| `apiKeyEnv` | `QUERIT_API_KEY` | 每次调用按“启动环境中的同名变量 → 凭据服务 → 行内 `apiKey`”解析;缺失时调用失败为 `WEB_PROVIDER_CREDENTIAL_MISSING` |
|
|
81
83
|
| `baseURL` | `https://api.querit.ai` | API 基地址;可被 `$QUERIT_BASE_URL` 环境变量覆盖 |
|
|
82
84
|
| `timeoutMs` | `70000` | 单请求超时(毫秒) |
|
|
83
85
|
| `count` | `5` | 无 `maxResults` 约束时的结果数(1–20) |
|
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@ Sign up on [Querit.ai](https://www.querit.ai) to get an API key with **1,000 fre
|
|
|
8
8
|
|
|
9
9
|
## Quick start
|
|
10
10
|
|
|
11
|
-
1. Install the package (see **Install and update** below)
|
|
11
|
+
1. Install the package (see **Install and update** below). Since v1.0.3 the package ships as a *profile bundle*: `dsh plugin add` wires the provider row and the seam routing automatically — no `cordis.patch.yml` edits needed (see **Wire it up** for what it applies and how to override).
|
|
12
12
|
2. Configure your Querit API key in priority order:
|
|
13
13
|
- `QUERIT_API_KEY` in the launching environment, or
|
|
14
14
|
- the credentials store (`$DSH_HOME/.credentials.yaml`: `QUERIT_API_KEY: <key>`, hot-reloaded — no restart needed), or
|
|
@@ -19,7 +19,7 @@ If the plugin loads without any resolvable key, the host log prints a one-time w
|
|
|
19
19
|
|
|
20
20
|
There is no settings-page UI for out-of-tree plugins in the current harness version (the web settings API serves a fixed namespace whitelist), so all configuration is the composition patch plus the credentials store.
|
|
21
21
|
|
|
22
|
-
This is an **implementation** package: it registers one search provider and one fetch provider into `ctx.web
|
|
22
|
+
This is an **implementation** package: it registers one search provider and one fetch provider into `ctx.web`. Per operation, it resolves the API key from the launching environment first, then the optional `ctx.credentials` seam, then literal config. It does not register the model-facing `web_search` tool (the agent preset does); by default, it reuses [`@deepseek-ai/dsh-tool-web`](https://www.npmjs.com/package/@deepseek-ai/dsh-tool-web)'s `applyWebFetchTool` to register `web_fetch`. That last step exists because in the web app the host `tool-web` row is disabled and the shipped presets keep `fetch: false` — this package is the one place that turns page retrieval on. Both providers share the stable id `querit`.
|
|
23
23
|
|
|
24
24
|
## Install and update
|
|
25
25
|
|
|
@@ -31,6 +31,8 @@ dsh plugin --profile web add dsh-querit
|
|
|
31
31
|
|
|
32
32
|
(`dsh plugin` forwards to pnpm in the profile directory; replace `web` with your profile name.)
|
|
33
33
|
|
|
34
|
+
Installing also reconciles the profile's bundle list: because `dsh-querit` declares `dsh.bundle`, it automatically joins `dsh.profile.bundles` and its shipped patch layer registers the provider row plus the seam routing (the same entries shown in **Wire it up**). After the install completes, restart the profile and the plugin is live. The manual wiring below is only needed for pre-1.0.3 installs or when you override the bundle's default row values.
|
|
35
|
+
|
|
34
36
|
### Update
|
|
35
37
|
|
|
36
38
|
```bash
|
|
@@ -55,7 +57,7 @@ Only when pnpm is unavailable: unpack the tarball into `<profile>/node_modules/d
|
|
|
55
57
|
|
|
56
58
|
## Wire it up
|
|
57
59
|
|
|
58
|
-
|
|
60
|
+
Since v1.0.3 the package ships as a profile bundle whose patch layer applies all of this automatically. For reference, the entries it applies (kept in the package as `cordis.patch.yml`) are:
|
|
59
61
|
|
|
60
62
|
```yaml
|
|
61
63
|
# Add the provider row (registers the Querit providers AND the web_fetch tool).
|
|
@@ -72,7 +74,7 @@ Edit the profile's `cordis.patch.yml` (`$DSH_HOME/profiles/<profile>/cordis.patc
|
|
|
72
74
|
fetchProvider: querit
|
|
73
75
|
```
|
|
74
76
|
|
|
75
|
-
That is the whole wiring: `web_search` (registered per session by the agent preset) and `web_fetch` (registered by this package) both route through `ctx.web`, which now selects Querit. A patch **replaces** the targeted row's whole `config`, so
|
|
77
|
+
That is the whole wiring: `web_search` (registered per session by the agent preset) and `web_fetch` (registered by this package) both route through `ctx.web`, which now selects Querit. A patch **replaces** the targeted row's whole `config`, so the `web` entry above restates both keys. The bundle layer applies after the base and app bundles, so its `web` override wins unless your profile's own `cordis.patch.yml` or a `--patch` overlay comes later and restates the row — that is also how you switch back to DeepSeek search (`searchProvider: deepseek-official`) or pin custom defaults. Store the API key through the credentials service, export `QUERIT_API_KEY` in the launching environment, or set a literal `apiKey` in the row above. Restart the profile to load the row.
|
|
76
78
|
|
|
77
79
|
Keep the DeepSeek provider reachable by leaving the `web-search-deepseek` row in place; the seam selects by the configured id, and switching back is a one-line patch.
|
|
78
80
|
|
|
@@ -83,7 +85,7 @@ If a preset ever registers `web_fetch` itself (its `tool-web` row with `fetch: t
|
|
|
83
85
|
| Key | Default | Meaning |
|
|
84
86
|
|---|---|---|
|
|
85
87
|
| `apiKey` | omitted | Literal Querit API key. Prefer `apiKeyEnv` so no secret enters configuration. The `apiKeyEnv` environment variable wins when both are set. |
|
|
86
|
-
| `apiKeyEnv` | `QUERIT_API_KEY` | Credential reference resolved per operation through `ctx.credentials
|
|
88
|
+
| `apiKeyEnv` | `QUERIT_API_KEY` | Credential reference resolved per operation from the launching environment first, then through `ctx.credentials`; a literal `apiKey` is the final fallback. A missing value fails the call as `WEB_PROVIDER_CREDENTIAL_MISSING`. |
|
|
87
89
|
| `baseURL` | `https://api.querit.ai` | Querit API base; `/v1/search` and `/v1/contents` are appended. Falls back to `$QUERIT_BASE_URL` from any environment layer. An unparseable value makes both providers unavailable. |
|
|
88
90
|
| `timeoutMs` | `70000` | Per-request timeout in ms (minimum 1000). |
|
|
89
91
|
| `count` | `5` | Result count used when the seam passes no `maxResults` bound (1–20; the API caps at 20). The `dsh-tool-web` layer always bounds searches, so this mainly serves direct seam callers. |
|
package/cordis.patch.yml
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# The dsh-querit bundle patch: applied as a profile layer after the base and
|
|
2
|
+
# app bundles, so installing this package wires the Querit providers in
|
|
3
|
+
# automatically — no cordis.patch.yml edits needed.
|
|
4
|
+
#
|
|
5
|
+
# A patch replaces the targeted row's whole `config`, so the `web` row below
|
|
6
|
+
# restates every key it owns (search + fetch selection). The base layer's
|
|
7
|
+
# `web-search-deepseek` row stays in place; the seam selects by id, so
|
|
8
|
+
# switching back is a one-line patch (`searchProvider: deepseek-official`).
|
|
9
|
+
|
|
10
|
+
- insert:
|
|
11
|
+
- id: web-search-querit
|
|
12
|
+
name: 'dsh-querit'
|
|
13
|
+
config:
|
|
14
|
+
apiKeyEnv: QUERIT_API_KEY
|
|
15
|
+
|
|
16
|
+
- id: web
|
|
17
|
+
config:
|
|
18
|
+
searchProvider: querit
|
|
19
|
+
fetchProvider: querit
|
package/lib/index.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Register Querit-backed search and fetch providers in `ctx.web`.
|
|
3
3
|
* Both providers call the public Querit API (`POST /v1/search`,
|
|
4
|
-
* `POST /v1/contents`) with a Bearer key resolved per operation
|
|
5
|
-
* optional `ctx.credentials
|
|
6
|
-
* The model-facing `web_search
|
|
7
|
-
*
|
|
4
|
+
* `POST /v1/contents`) with a Bearer key resolved per operation from the
|
|
5
|
+
* launching environment, then optional `ctx.credentials`, then literal config.
|
|
6
|
+
* The agent preset registers model-facing `web_search`; this package does not.
|
|
7
|
+
* By default, it reuses the official `applyWebFetchTool` helper to register
|
|
8
|
+
* `web_fetch`, and both tools route through the seam.
|
|
8
9
|
* @module dsh-querit
|
|
9
10
|
*/
|
|
10
11
|
import type { Context } from "@deepseek-ai/cordis";
|
package/lib/index.js
CHANGED
|
@@ -49,7 +49,6 @@ export function resolveOptions(ctx, config) {
|
|
|
49
49
|
: undefined;
|
|
50
50
|
const environment = launchEnvironmentOf(ctx);
|
|
51
51
|
return {
|
|
52
|
-
...(literalApiKey === undefined ? {} : { apiKey: literalApiKey }),
|
|
53
52
|
resolveApiKey: () => resolveQueritApiKey(ctx, apiKeyEnv, literalApiKey),
|
|
54
53
|
apiKeyEnv,
|
|
55
54
|
baseURL: (config.baseURL ?? environment.get(BASE_URL_ENV)?.value ?? QUERIT_API_BASE_URL).replace(/\/+$/, ""),
|
|
@@ -118,8 +117,11 @@ export async function resolveQueritApiKey(ctx, apiKeyEnv, literalApiKey) {
|
|
|
118
117
|
if (ambient !== undefined && ambient.value.length > 0)
|
|
119
118
|
return ambient.value;
|
|
120
119
|
const credentials = ctx.get("credentials");
|
|
121
|
-
if (credentials !== undefined)
|
|
122
|
-
|
|
120
|
+
if (credentials !== undefined) {
|
|
121
|
+
const stored = await credentials.resolve(apiKeyEnv);
|
|
122
|
+
if (stored !== undefined && stored.value.length > 0)
|
|
123
|
+
return stored.value;
|
|
124
|
+
}
|
|
123
125
|
return literalApiKey !== undefined && literalApiKey.length > 0 ? literalApiKey : undefined;
|
|
124
126
|
}
|
|
125
127
|
/**
|
package/lib/provider.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { WebError } from "@deepseek-ai/dsh-web";
|
|
2
|
-
import {
|
|
2
|
+
import { QueritApiError, QueritClient, } from "./client.js";
|
|
3
3
|
/** Stable id both providers register under. */
|
|
4
4
|
export const QUERIT_PROVIDER_ID = "querit";
|
|
5
5
|
export const COUNTRY_VALUES = [
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-querit",
|
|
3
3
|
"description": "Querit-backed search and fetch providers for the DeepSeek Harness web capability seam (ctx.web)",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.3",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"types": "lib/index.d.ts",
|
|
@@ -18,11 +18,17 @@
|
|
|
18
18
|
},
|
|
19
19
|
"files": [
|
|
20
20
|
"lib",
|
|
21
|
+
"cordis.patch.yml",
|
|
21
22
|
"README.md",
|
|
22
23
|
"README-zh.md",
|
|
23
24
|
"LICENSE"
|
|
24
25
|
],
|
|
25
26
|
"license": "MIT",
|
|
27
|
+
"dsh": {
|
|
28
|
+
"bundle": {
|
|
29
|
+
"patch": "./cordis.patch.yml"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
26
32
|
"repository": {
|
|
27
33
|
"type": "git",
|
|
28
34
|
"url": "git+https://github.com/querit-ai/querit-plugins.git"
|