dsh-querit 1.0.6 → 1.1.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/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 dsh-querit contributors
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2026 dsh-querit contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,169 +1,171 @@
1
- # dsh-querit
2
-
3
- [![license](https://img.shields.io/badge/license-MIT-yellow.svg)](./LICENSE)
4
-
5
- Querit-backed search and fetch providers for the DeepSeek Harness [web capability seam](https://www.npmjs.com/package/@deepseek-ai/dsh-web) (`ctx.web`). It is the DeepSeek Harness counterpart of [`pi-querit`](https://www.npmjs.com/package/pi-querit): the model-facing `web_search` and `web_fetch` tools keep working unchanged, and this package swaps their backend to [Querit](https://www.querit.ai) — live web search and clean page content through `POST https://api.querit.ai/v1/search` and `/v1/contents`.
6
-
7
- Sign up on [Querit.ai](https://www.querit.ai) to get an API key with **1,000 free API calls per month** — no credit card required.
8
-
9
- ## Quick start
10
-
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). Since v1.0.4 the bundle also disables the shipped DeepSeek search provider row, and removing the package restores it.
12
- 2. Configure your Querit API key in priority order:
13
- - `QUERIT_API_KEY` in the launching environment, or
14
- - the credentials store (`$DSH_HOME/.credentials.yaml`: `QUERIT_API_KEY: <key>`, hot-reloaded — no restart needed), or
15
- - the settings page card (v1.0.4+, **Settings → Plugins → Plugin configuration → Querit web search**), or
16
- - `apiKey` on the `web-search-querit` row (a literal; least preferred, secrets should not live in composition files).
17
- 3. Restart the profile to load the plugin row and its settings card.
18
-
19
- If the plugin loads without any resolvable key, the host log prints a one-time warning; a search attempted before a key is configured fails with a `WEB_PROVIDER_CREDENTIAL_MISSING` error that spells out the same three options.
20
-
21
- Since v1.0.4 the package also ships a browser half with a settings card: **Settings → Plugins → Plugin configuration** lists a "Querit web search" card that edits the `web-search-querit` namespace (credential reference, result count, time range, languages, countries, domain lists, content excerpts, fetch format) and can write the API key straight into the credentials domain. Its writes go through the same settings transport as `$DSH_HOME/settings.yaml` (see **Config**). Since v1.0.6 the card chrome (background, padding, font size, chevron toggle, button styles) matches the official plugin cards shipped by `@deepseek-ai/dsh-client-ui-settings-plugins`, so the entry sits flush with "Terminal", "Agent loop", and the DeepSeek "Web search" row. All colors and borders are sourced from the theme's alias tokens (`--dsw-alias-bg-layer-3`, `--dsw-alias-label-primary`, etc.), so the card follows the active light or dark palette without any package-local override.
22
-
23
- 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`.
24
-
25
- ## Install and update
26
-
27
- The package is published on npm as [`dsh-querit`](https://www.npmjs.com/package/dsh-querit), so the normal path needs no build toolchain:
28
-
29
- ```bash
30
- dsh plugin --profile web add dsh-querit
31
- ```
32
-
33
- (`dsh plugin` forwards to pnpm in the profile directory; replace `web` with your profile name.)
34
-
35
- 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, routes the seam, and disables the DeepSeek search row (the entries shown in **Wire it up**). After the install completes, restart the profile and the plugin is live. `dsh plugin remove dsh-querit` drops the whole layer, so everything the bundle did — including the DeepSeek disable — reverts to the base behavior automatically. The manual wiring below is only needed for pre-1.0.3 installs or when you override the bundle's default row values.
36
-
37
- ### Update
38
-
39
- ```bash
40
- dsh plugin --profile web outdated # what's new?
41
- dsh plugin --profile web update dsh-querit # update within the declared range
42
- ```
43
-
44
- pnpm 11+ ignores releases younger than its minimum-release-age window, so a version published minutes ago may not show up in `outdated`/`update` yet. Install it immediately with an explicit version:
45
-
46
- ```bash
47
- dsh plugin --profile web add dsh-querit@<version>
48
- ```
49
-
50
- ### Alternative sources
51
-
52
- ```bash
53
- # GitHub Release tarball (download from the querit-plugins releases page first)
54
- dsh plugin --profile web add ./dsh-querit-<version>.tgz
55
- ```
56
-
57
- Only when pnpm is unavailable: unpack the tarball into `<profile>/node_modules/dsh-querit` and add `"dsh-querit": "<version>"` to the profile `package.json` dependencies. A manually unpacked copy is invisible to pnpm, so `dsh plugin remove` will not delete it.
58
-
59
- ## Wire it up
60
-
61
- 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:
62
-
63
- ```yaml
64
- # Add the provider row (registers the Querit providers AND the web_fetch tool).
65
- - insert:
66
- - id: web-search-querit
67
- name: 'dsh-querit'
68
- config:
69
- apiKeyEnv: QUERIT_API_KEY
70
-
71
- # Route the seam's search and fetch through Querit.
72
- - id: web
73
- config:
74
- searchProvider: querit
75
- fetchProvider: querit
76
-
77
- # This package IS the search backend: stop mounting the DeepSeek provider row.
78
- # Re-enable with `disabled: false` in a later layer if you need it back.
79
- - id: web-search-deepseek
80
- disabled: true
81
- ```
82
-
83
- 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`), re-enable the DeepSeek row (`disabled: false`), 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.
84
-
85
- Keep the DeepSeek provider row disabled unless you explicitly need it: since v1.0.4 the bundle ships `disabled: true` on `web-search-deepseek`, so only Querit is mounted. Adding `- id: web-search-deepseek / disabled: false` to a later layer re-enables it while the seam keeps selecting Querit.
86
-
87
- If a preset ever registers `web_fetch` itself (its `tool-web` row with `fetch: true`), set `fetch: false` on this row so only one registration exists per scope.
88
-
89
- ## Config
90
-
91
- | Key | Default | Meaning |
92
- |---|---|---|
93
- | `apiKey` | omitted | Literal Querit API key. Prefer `apiKeyEnv` so no secret enters configuration. The `apiKeyEnv` environment variable wins when both are set. |
94
- | `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`. |
95
- | `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. |
96
- | `timeoutMs` | `70000` | Per-request timeout in ms (minimum 1000). |
97
- | `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. |
98
- | `timeRange` | none | Relative (`d7`, `w2`, `m3`, `y1`, or any `dN`/`wN`/`mN`/`yN`) or `YYYY-MM-DDtoYYYY-MM-DD` date range. |
99
- | `countries` | none | Country bias. Valid values: `argentina`, `australia`, `brazil`, `canada`, `colombia`, `france`, `germany`, `india`, `indonesia`, `japan`, `mexico`, `nigeria`, `philippines`, `south korea`, `spain`, `united kingdom`, `united states`. |
100
- | `languages` | none | Language filter. Valid values: `english`, `japanese`, `korean`, `german`, `french`, `spanish`, `portuguese`. |
101
- | `includeDomains` | none | **Whitelist** hostnames; only these domains return results. |
102
- | `excludeDomains` | none | **Blacklist** hostnames; these domains never return results. |
103
- | `includeContent` | `false` | Request sentence-level content excerpts (`needContent`); excerpts are appended to each source's snippet. |
104
- | `chunksPerDoc` | `1` | Content chunks per result (1–3). |
105
- | `fetchFormat` | `markdown` | Format requested from `/v1/contents` for fetch calls: `markdown`, `text`, or `html`. HTML bodies are labeled `kind: 'html'` so `dsh-tool-web` converts them to markdown. |
106
- | `fetchCrawlTimeout` | `10` | Per-page crawl timeout in seconds (1–60). |
107
- | `fetchMaxChars` | `8000` | Cap applied to one fetched page's decoded body, in chars; a cut body sets `truncated`. |
108
- | `fetch` | `true` | Register the model-facing `web_fetch` tool (reused from `@deepseek-ai/dsh-tool-web`). Set `false` when another row already registers `web_fetch`. |
109
- | `fetchTimeoutMs` | `30000` | Cooperative tool-call timeout budget (ms) attached to `web_fetch`. |
110
- | `fetchMaxOutputChars` | `200000` | Cap on one `web_fetch` rendered output, in chars. |
111
-
112
- ```yaml
113
- - id: web-search-querit
114
- name: 'dsh-querit'
115
- config:
116
- apiKeyEnv: QUERIT_API_KEY
117
- count: 8
118
- timeRange: m3
119
- languages: [english]
120
- excludeDomains: [pinterest.com, facebook.com, instagram.com, tiktok.com]
121
- ```
122
-
123
- The entry above is the base layer of the `web-search-querit` Settings section: a user layer over it reaches the NEXT operation, because the providers project the section per call rather than capturing it at registration. The seam's provider selection therefore never flickers when a default changes. `apiKey` carries `role('secret')`, so it never rides a `describe()` response — a configuration surface learns only whether the credentials domain holds a value for the reference `apiKeyEnv` names.
124
-
125
- There are three configuration surfaces (the settings-page card writes through two of them):
126
-
127
- 1. **The settings page card** (v1.0.4+): **Settings → Plugins → Plugin configuration → Querit web search**. Edits the `web-search-querit` namespace and can write the API key into the credentials domain. No restart needed for saves.
128
- 2. **The composition patch** (`cordis.patch.yml` above) — needs a restart.
129
- 3. **The settings document** — `$DSH_HOME/settings.yaml`, the same directory as `.credentials.yaml`. A `web-search-querit:` section there overrides the row config and **hot-reloads** (the settings provider watches the file; verified live — no restart needed). The settings card writes this same document through the settings service:
130
-
131
- ```yaml
132
- web-search-querit:
133
- count: 3
134
- timeRange: m3
135
- languages: [english]
136
- ```
137
-
138
- Resolution order per field: `settings.yaml` section (including card writes) > `cordis.patch.yml` row config > schema default. The API key is kept separately in `.credentials.yaml` (or the launching environment, or the card's write-only key input), never in `settings.yaml`.
139
-
140
- ## Mapping
141
-
142
- Search results become citeable sources: `url` ← `url`, `title` ← `title`, `snippet` ← `snippet` plus requested sentence excerpts, `publishedAt` ← `page_age`. No provider-generated answer text is trusted as `content`, so `content` is omitted. Results are deduplicated by URL and normalized to HTTP(S). The seam enforces the request's `maxResults` bound, so the provider sets `truncated: false` and applies `min(maxResults, 20)` at the request layer as a cost optimization.
143
-
144
- Fetch maps a successful `/v1/contents` crawl to `statusCode 200` with a `text` body (`markdown`/`text` formats) or an `html` body (`html` format). A failed crawl is a `WEB_PROVIDER_ERROR`: Querit proxies the retrieval, so no real HTTP status exists to report.
145
-
146
- Failures use the seam's `WebError` taxonomy: `WEB_ABORTED` for cancellation, `WEB_PROVIDER_ERROR` for API/HTTP/parse failures, and `WEB_PROVIDER_CREDENTIAL_MISSING` for a missing key. API keys are redacted from every error surface, responses are size-limited (2 MiB search, 10 MiB contents), and retrieved text is stripped of terminal escape/control sequences and bidi controls before the model sees it.
147
-
148
- ## Safety
149
-
150
- Treat every search result and retrieved page as untrusted external data. The model-facing tools already tell the model this; the providers additionally never follow instructions found in retrieved content and never return content as an answer.
151
-
152
- ## Development
153
-
154
- ```bash
155
- npm install
156
- npm run check # typecheck src + tests
157
- npm test # vitest: host providers + settings form model + card render smoke tests
158
- npm run build # tsc -> lib/ plus the browser bundle -> lib/card.js
159
- ```
160
-
161
- The settings card's form logic lives in `src/form-model.js` (unit-tested); `scripts/build-client.mjs` inlines it into the loader-wrapped browser bundle `src/card.js` and writes `lib/card.js`. The bundle deliberately does not overwrite `lib/client.js`, which tsc produces from `src/client.ts` (the host-side HTTP client) — that collision breaks the host imports. `tests/card-render.test.mjs` renders the built card with `react-dom/server` and asserts its controls; run `npm run build` before `npm test`. To exercise the card in the browser, restart the profile and open **Settings → Plugins → Plugin configuration**.
162
-
163
- ## Packaging notes
164
-
165
- The `peerDependencies` are declared **optional**: the harness provides them at runtime (the profile boot resolves them through the flat module fallback under `$DSH_HOME/profiles/node_modules`), not through the profile's own pnpm graph — so `dsh plugin add` finishes without installing peers and prints no peer warnings.
166
-
167
- ## License
168
-
169
- MIT
1
+ # dsh-querit
2
+
3
+ [![license](https://img.shields.io/badge/license-MIT-yellow.svg)](./LICENSE)
4
+
5
+ Querit-backed search and fetch providers for the DeepSeek Harness [web capability seam](https://www.npmjs.com/package/@deepseek-ai/dsh-web) (`ctx.web`). It is the DeepSeek Harness counterpart of [`pi-querit`](https://www.npmjs.com/package/pi-querit): the model-facing `web_search` and `web_fetch` tools keep working unchanged, and this package swaps their backend to [Querit](https://www.querit.ai) — live web search and clean page content through `POST https://api.querit.ai/v1/search` and `/v1/contents`.
6
+
7
+ Sign up on [Querit.ai](https://www.querit.ai) to get an API key with **1,000 free API calls per month** — no credit card required.
8
+
9
+ Since v1.1.0 the package targets **dsh 0.1.2+**: the host half registers its settings namespace through the `ctx.settings` service (`installSection`), and the settings card reads and writes the API key through the browser `remote.credentials` namespace. On older dsh hosts (0.1.0–0.1.1) install `dsh-querit@1.0.6` instead.
10
+
11
+ ## Quick start
12
+
13
+ 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). Since v1.0.4 the bundle also disables the shipped DeepSeek search provider row, and removing the package restores it.
14
+ 2. Configure your Querit API key in priority order:
15
+ - `QUERIT_API_KEY` in the launching environment, or
16
+ - the credentials store (`$DSH_HOME/.credentials.yaml`: `QUERIT_API_KEY: <key>`, hot-reloaded — no restart needed), or
17
+ - the settings page card (v1.0.4+, **Settings → Plugins → Plugin configuration → Querit web search**), or
18
+ - `apiKey` on the `web-search-querit` row (a literal; least preferred, secrets should not live in composition files).
19
+ 3. Restart the profile to load the plugin row and its settings card.
20
+
21
+ If the plugin loads without any resolvable key, the host log prints a one-time warning; a search attempted before a key is configured fails with a `WEB_PROVIDER_CREDENTIAL_MISSING` error that spells out the same three options.
22
+
23
+ Since v1.0.4 the package also ships a browser half with a settings card: **Settings → Plugins → Plugin configuration** lists a "Querit web search" card that edits the `web-search-querit` namespace (credential reference, result count, time range, languages, countries, domain lists, content excerpts, fetch format) and can write the API key straight into the credentials domain. Its writes go through the same settings transport as `$DSH_HOME/settings.yaml` (see **Config**). Since v1.0.6 the card chrome (background, padding, font size, chevron toggle, button styles) matches the official plugin cards shipped by `@deepseek-ai/dsh-client-ui-settings-plugins`, so the entry sits flush with "Terminal", "Agent loop", and the DeepSeek "Web search" row. All colors and borders are sourced from the theme's alias tokens (`--dsw-alias-bg-layer-3`, `--dsw-alias-label-primary`, etc.), so the card follows the active light or dark palette without any package-local override.
24
+
25
+ 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 registers no model-facing tool itself: since dsh 0.1.2 the base composition and agent presets register both `web_search` and `web_fetch` through their `tool-web` rows, and both tools execute through `ctx.web` — so once the seam selects Querit, both tools are Querit-backed. (`fetch: true` opts into registering `web_fetch` via [`@deepseek-ai/dsh-tool-web`](https://www.npmjs.com/package/@deepseek-ai/dsh-tool-web)'s `applyWebFetchTool` for compositions that provide no `tool-web` row.) Both providers share the stable id `web-search-querit`, mirroring the native `web-search-deepseek` naming.
26
+
27
+ ## Install and update
28
+
29
+ The package is published on npm as [`dsh-querit`](https://www.npmjs.com/package/dsh-querit), so the normal path needs no build toolchain:
30
+
31
+ ```bash
32
+ dsh plugin --profile web add dsh-querit
33
+ ```
34
+
35
+ (`dsh plugin` forwards to pnpm in the profile directory; replace `web` with your profile name.)
36
+
37
+ 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, routes the seam, and disables the DeepSeek search row (the entries shown in **Wire it up**). After the install completes, restart the profile and the plugin is live. `dsh plugin remove dsh-querit` drops the whole layer, so everything the bundle did — including the DeepSeek disable — reverts to the base behavior automatically. The manual wiring below is only needed for pre-1.0.3 installs or when you override the bundle's default row values.
38
+
39
+ ### Update
40
+
41
+ ```bash
42
+ dsh plugin --profile web outdated # what's new?
43
+ dsh plugin --profile web update dsh-querit # update within the declared range
44
+ ```
45
+
46
+ pnpm 11+ ignores releases younger than its minimum-release-age window, so a version published minutes ago may not show up in `outdated`/`update` yet. Install it immediately with an explicit version:
47
+
48
+ ```bash
49
+ dsh plugin --profile web add dsh-querit@<version>
50
+ ```
51
+
52
+ ### Alternative sources
53
+
54
+ ```bash
55
+ # GitHub Release tarball (download from the querit-plugins releases page first)
56
+ dsh plugin --profile web add ./dsh-querit-<version>.tgz
57
+ ```
58
+
59
+ Only when pnpm is unavailable: unpack the tarball into `<profile>/node_modules/dsh-querit` and add `"dsh-querit": "<version>"` to the profile `package.json` dependencies. A manually unpacked copy is invisible to pnpm, so `dsh plugin remove` will not delete it.
60
+
61
+ ## Wire it up
62
+
63
+ 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:
64
+
65
+ ```yaml
66
+ # Add the provider row (registers the Querit providers AND the web_fetch tool).
67
+ - insert:
68
+ - id: web-search-querit
69
+ name: 'dsh-querit'
70
+ config:
71
+ apiKeyEnv: QUERIT_API_KEY
72
+
73
+ # Route the seam's search and fetch through Querit.
74
+ - id: web
75
+ config:
76
+ searchProvider: web-search-querit
77
+ fetchProvider: web-search-querit
78
+
79
+ # This package IS the search backend: stop mounting the DeepSeek provider row.
80
+ # Re-enable with `disabled: false` in a later layer if you need it back.
81
+ - id: web-search-deepseek
82
+ disabled: true
83
+ ```
84
+
85
+ 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`), re-enable the DeepSeek row (`disabled: false`), 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.
86
+
87
+ Keep the DeepSeek provider row disabled unless you explicitly need it: since v1.0.4 the bundle ships `disabled: true` on `web-search-deepseek`, so only Querit is mounted. Adding `- id: web-search-deepseek / disabled: false` to a later layer re-enables it while the seam keeps selecting Querit.
88
+
89
+ If a preset ever registers `web_fetch` itself (its `tool-web` row with `fetch: true`), set `fetch: false` on this row so only one registration exists per scope.
90
+
91
+ ## Config
92
+
93
+ | Key | Default | Meaning |
94
+ |---|---|---|
95
+ | `apiKey` | omitted | Literal Querit API key. Prefer `apiKeyEnv` so no secret enters configuration. The `apiKeyEnv` environment variable wins when both are set. |
96
+ | `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`. |
97
+ | `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. |
98
+ | `timeoutMs` | `70000` | Per-request timeout in ms (minimum 1000). |
99
+ | `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. |
100
+ | `timeRange` | none | Relative (`d7`, `w2`, `m3`, `y1`, or any `dN`/`wN`/`mN`/`yN`) or `YYYY-MM-DDtoYYYY-MM-DD` date range. |
101
+ | `countries` | none | Country bias. Valid values: `argentina`, `australia`, `brazil`, `canada`, `colombia`, `france`, `germany`, `india`, `indonesia`, `japan`, `mexico`, `nigeria`, `philippines`, `south korea`, `spain`, `united kingdom`, `united states`. |
102
+ | `languages` | none | Language filter. Valid values: `english`, `japanese`, `korean`, `german`, `french`, `spanish`, `portuguese`. |
103
+ | `includeDomains` | none | **Whitelist** hostnames; only these domains return results. |
104
+ | `excludeDomains` | none | **Blacklist** hostnames; these domains never return results. |
105
+ | `includeContent` | `false` | Request sentence-level content excerpts (`needContent`); excerpts are appended to each source's snippet. |
106
+ | `chunksPerDoc` | `1` | Content chunks per result (1–3). |
107
+ | `fetchFormat` | `markdown` | Format requested from `/v1/contents` for fetch calls: `markdown`, `text`, or `html`. HTML bodies are labeled `kind: 'html'` so `dsh-tool-web` converts them to markdown. |
108
+ | `fetchCrawlTimeout` | `10` | Per-page crawl timeout in seconds (1–60). |
109
+ | `fetchMaxChars` | `8000` | Cap applied to one fetched page's decoded body, in chars; a cut body sets `truncated`. |
110
+ | `fetch` | `false` | Opt in to registering the model-facing `web_fetch` tool (reused from `@deepseek-ai/dsh-tool-web`). Since dsh 0.1.2 the base and agent-preset `tool-web` rows register `web_fetch` themselves and route through the seam, so leave off unless no other row provides the tool. |
111
+ | `fetchTimeoutMs` | `30000` | Cooperative tool-call timeout budget (ms) attached to `web_fetch`. |
112
+ | `fetchMaxOutputChars` | `200000` | Cap on one `web_fetch` rendered output, in chars. |
113
+
114
+ ```yaml
115
+ - id: web-search-querit
116
+ name: 'dsh-querit'
117
+ config:
118
+ apiKeyEnv: QUERIT_API_KEY
119
+ count: 8
120
+ timeRange: m3
121
+ languages: [english]
122
+ excludeDomains: [pinterest.com, facebook.com, instagram.com, tiktok.com]
123
+ ```
124
+
125
+ The entry above is the base layer of the `web-search-querit` Settings section: a user layer over it reaches the NEXT operation, because the providers project the section per call rather than capturing it at registration. The seam's provider selection therefore never flickers when a default changes. `apiKey` carries `role('secret')`, so it never rides a `describe()` response — a configuration surface learns only whether the credentials domain holds a value for the reference `apiKeyEnv` names.
126
+
127
+ There are three configuration surfaces (the settings-page card writes through two of them):
128
+
129
+ 1. **The settings page card** (v1.0.4+): **Settings → Plugins → Plugin configuration → Querit web search**. Edits the `web-search-querit` namespace and can write the API key into the credentials domain. No restart needed for saves.
130
+ 2. **The composition patch** (`cordis.patch.yml` above) — needs a restart.
131
+ 3. **The settings document** — `$DSH_HOME/settings.yaml`, the same directory as `.credentials.yaml`. A `web-search-querit:` section there overrides the row config and **hot-reloads** (the settings provider watches the file; verified live — no restart needed). The settings card writes this same document through the settings service:
132
+
133
+ ```yaml
134
+ web-search-querit:
135
+ count: 3
136
+ timeRange: m3
137
+ languages: [english]
138
+ ```
139
+
140
+ Resolution order per field: `settings.yaml` section (including card writes) > `cordis.patch.yml` row config > schema default. The API key is kept separately in `.credentials.yaml` (or the launching environment, or the card's write-only key input), never in `settings.yaml`.
141
+
142
+ ## Mapping
143
+
144
+ Search results become citeable sources: `url` ← `url`, `title` ← `title`, `snippet` ← `snippet` plus requested sentence excerpts, `publishedAt` ← `page_age`. No provider-generated answer text is trusted as `content`, so `content` is omitted. Results are deduplicated by URL and normalized to HTTP(S). The seam enforces the request's `maxResults` bound, so the provider sets `truncated: false` and applies `min(maxResults, 20)` at the request layer as a cost optimization.
145
+
146
+ Fetch maps a successful `/v1/contents` crawl to `statusCode 200` with a `text` body (`markdown`/`text` formats) or an `html` body (`html` format). A failed crawl is a `WEB_PROVIDER_ERROR`: Querit proxies the retrieval, so no real HTTP status exists to report.
147
+
148
+ Failures use the seam's `WebError` taxonomy: `WEB_ABORTED` for cancellation, `WEB_PROVIDER_ERROR` for API/HTTP/parse failures, and `WEB_PROVIDER_CREDENTIAL_MISSING` for a missing key. API keys are redacted from every error surface, responses are size-limited (2 MiB search, 10 MiB contents), and retrieved text is stripped of terminal escape/control sequences and bidi controls before the model sees it.
149
+
150
+ ## Safety
151
+
152
+ Treat every search result and retrieved page as untrusted external data. The model-facing tools already tell the model this; the providers additionally never follow instructions found in retrieved content and never return content as an answer.
153
+
154
+ ## Development
155
+
156
+ ```bash
157
+ npm install
158
+ npm run check # typecheck src + tests
159
+ npm test # vitest: host providers + settings form model + card render smoke tests
160
+ npm run build # tsc -> lib/ plus the browser bundle -> lib/card.js
161
+ ```
162
+
163
+ The settings card's form logic lives in `src/form-model.js` (unit-tested); `scripts/build-client.mjs` inlines it into the loader-wrapped browser bundle `src/card.js` and writes `lib/card.js`. The bundle deliberately does not overwrite `lib/client.js`, which tsc produces from `src/client.ts` (the host-side HTTP client) — that collision breaks the host imports. `tests/card-render.test.mjs` renders the built card with `react-dom/server` and asserts its controls; run `npm run build` before `npm test`. To exercise the card in the browser, restart the profile and open **Settings → Plugins → Plugin configuration**.
164
+
165
+ ## Packaging notes
166
+
167
+ The `peerDependencies` are declared **optional**: the harness provides them at runtime (the profile boot resolves them through the flat module fallback under `$DSH_HOME/profiles/node_modules`), not through the profile's own pnpm graph — so `dsh plugin add` finishes without installing peers and prints no peer warnings.
168
+
169
+ ## License
170
+
171
+ MIT
package/cordis.patch.yml CHANGED
@@ -1,25 +1,25 @@
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. Removing the package
4
- # (`dsh plugin remove dsh-querit`) drops this whole layer, so every entry
5
- # below — including the DeepSeek disable — reverts to the base behavior.
6
- #
7
- # A patch replaces the targeted row's whole `config`, so the `web` row below
8
- # restates every key it owns (search + fetch selection).
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
20
-
21
- # This package IS the search backend: stop mounting the DeepSeek provider row.
22
- # Override with `- id: web-search-deepseek / disabled: false` in a later layer
23
- # (profile cordis.patch.yml) to re-enable it while keeping Querit selected.
24
- - id: web-search-deepseek
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. Removing the package
4
+ # (`dsh plugin remove dsh-querit`) drops this whole layer, so every entry
5
+ # below — including the DeepSeek disable — reverts to the base behavior.
6
+ #
7
+ # A patch replaces the targeted row's whole `config`, so the `web` row below
8
+ # restates every key it owns (search + fetch selection).
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: web-search-querit
19
+ fetchProvider: web-search-querit
20
+
21
+ # This package IS the search backend: stop mounting the DeepSeek provider row.
22
+ # Override with `- id: web-search-deepseek / disabled: false` in a later layer
23
+ # (profile cordis.patch.yml) to re-enable it while keeping Querit selected.
24
+ - id: web-search-deepseek
25
25
  disabled: true