dsh-web-search-workbuddy 0.1.0 → 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.
Files changed (2) hide show
  1. package/README.md +98 -12
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -2,27 +2,113 @@
2
2
 
3
3
  WorkBuddy gateway-backed search provider for the DeepSeek Harness web capability
4
4
  seam (`ctx.web`). Bridges the model-facing `web_search` tool to the
5
- workbuddy2api-go gateway's agenttool web-search passthrough (`0057-web-search-tool.patch`):
5
+ workbuddy2api-go gateway's agenttool web-search passthrough, with
6
+ [workbuddy-manager](https://github.com/WaveBird/workbuddy-manager) as the
7
+ entry proxy — so **one `wbk_` key serves both the chat route and `web_search`**.
6
8
 
7
9
  ```
8
- DSH session ── ctx.web.search() ──▶ this provider ──▶ POST {gateway}/v1/tools/search
9
- │ account-pool rotation + 15001 cooldown
10
- ▼
11
- https://www.workbuddy.cn/agenttool/v1/search
10
+ DSH session ── ctx.web.search() ──▶ this provider
11
+ │ POST {manager}:7864/v1/tools/search (wbk_ key)
12
+ ▼
13
+ workbuddy-manager (auth + upstream resolve + logging)
14
+ │ POST {wb2api-go}:7863/v1/tools/search
15
+ ▼
16
+ wb2api-go (account-pool rotation + 15001 quota cooldown)
17
+ ▼
18
+ https://www.workbuddy.cn/agenttool/v1/search
12
19
  ```
13
20
 
14
- - Provider id: `workbuddy-gateway`
15
- - Pin: `web.searchProvider: workbuddy-gateway` in `cordis.patch.yml`
16
- - Credential: `apiKeyEnv` (default `WORKBUDDY_MANNAGER_CN_API_KEY`), resolved via
17
- the credentials service or the launch environment
18
- - Result: `{code:0, results:[{title,url,snippet}]}` envelope mapped to
19
- `{url,title,snippet,summary}` sources; `maxResults` truncation is owned by the seam
21
+ ## ⚠️ Compatibility requirements(兼容性要求)
22
+
23
+ This plugin is **not standalone**. It depends on a specific feature set that
24
+ landed in the WorkBuddy ecosystem at pinned versions; running against an
25
+ unpatched stack fails with `404` (route missing) or `401` (search endpoint
26
+ expecting the gateway key):
27
+
28
+ | Component | Required version / state | Why |
29
+ |---|---|---|
30
+ | **workbuddy-manager** | **≥ the `feat/web-search-passthrough` branch** ([PR #2](https://github.com/WaveBird/workbuddy-manager/pull/2)). Baseline tested: `v2.11.14` + the PR's 3 commits (`dce9acc` route, `5e88629` realm fix, `c33e122` docs). It will ship in a release **after v2.11.14** — until then, deploy the branch or cherry-pick. | The `POST /v1/tools/search` passthrough route **does not exist** in upstream releases ≤ v2.11.14. Older managers return `405` and this provider cannot work through them. |
31
+ | **workbuddy2api-go gateway** | Built from the upstream snapshot **`upstream-id 801cebba` (v2.11.14 / 0056 patches)** plus [`0057-web-search-tool.patch`](https://github.com/WaveBird/workbuddy-manager/blob/feat/web-search-passthrough/dev/upstream-patches/0057-web-search-tool.patch) (shipped inside the manager PR above). | The `POST /v1/tools/search` handler, account-pool rotation, and 15001 quota cooldown live in this patch; the stock gateway has no agenttool route. |
32
+ | **DeepSeek Harness (DSH)** | `0.2.2-rc.2` (web seam contract `ctx.web.registerSearchProvider` / `WebSearchProvider` shape). Tested against `0.2.2-rc.1` and `rc.2`; any version keeping that seam shape works. | The provider registers into `ctx.web`; a breaking seam change would require a plugin update. |
33
+
34
+ Quick self-check per component:
35
+
36
+ ```bash
37
+ # manager: route exists and accepts the wbk_ key (405/401 → wrong manager version)
38
+ curl -s -o /dev/null -w '%{http_code}\n' -X POST http://127.0.0.1:7864/v1/tools/search \
39
+ -H "Authorization: Bearer <wbk_ key>" -H 'content-type: application/json' \
40
+ -d '{"query":"ping"}'
41
+
42
+ # gateway (bypassing manager): 401 with the gateway's own api_key configured means alive
43
+ curl -s -o /dev/null -w '%{http_code}\n' -X POST http://127.0.0.1:7863/v1/tools/search \
44
+ -H 'content-type: application/json' -d '{"query":"ping"}'
45
+ ```
46
+
47
+ ## Install
48
+
49
+ ```bash
50
+ npm install dsh-web-search-workbuddy
51
+ # or inside the DSH profile (recommended):
52
+ cd ~/.dsh/profiles/web && pnpm add dsh-web-search-workbuddy
53
+ ```
54
+
55
+ Peer dependencies (`@deepseek-ai/dsh-web`, `@deepseek-ai/dsh-credentials`,
56
+ `@deepseek-ai/cordis`) resolve from the DSH profile's own `node_modules` when
57
+ installed this way; `@deepseek-ai/schemastery` ships as a direct dependency.
58
+
59
+ ## DSH profile assembly
60
+
61
+ ```yaml
62
+ # ~/.dsh/profiles/web/cordis.patch.yml
63
+ - insert:
64
+ - id: web-search-workbuddy
65
+ name: dsh-web-search-workbuddy
66
+ config:
67
+ baseURL: http://127.0.0.1:7864 # workbuddy-manager address
68
+ apiKeyEnv: WORKBUDDY_MANNAGER_CN_API_KEY # same wbk_ key as the chat route
69
+ timeoutMs: 30000
70
+ maxResults: 5
71
+ - id: web
72
+ name: '@deepseek-ai/dsh-web'
73
+ config:
74
+ fetchProvider: http
75
+ searchProvider: workbuddy-gateway # ← pin this provider
76
+ - id: tool-web
77
+ name: '@deepseek-ai/dsh-tool-web'
78
+ config: { fetch: true, search: true, searchTimeoutMs: 60000 }
79
+ # also set search: true in every agent preset's tool-web entry
80
+ ```
81
+
82
+ Fully restart `dsh web` afterwards (patch changes do not HMR). The model's tool
83
+ catalog gains `web_search` in new sessions.
84
+
85
+ ## Protocol
86
+
87
+ ```json
88
+ POST {baseURL}/v1/tools/search
89
+ Authorization: Bearer <wbk_ key>
90
+ { "query": "...", "max_results": 5, "blocked_domains": [...], "freshness": "d1|m1|y1" }
91
+ ```
92
+
93
+ Response is the upstream agenttool envelope passed through verbatim:
94
+
95
+ ```json
96
+ { "code": 0, "msg": "", "results": [{ "title": "...", "url": "...", "snippet": "..." }],
97
+ "total_results": 3, "response_time_ms": 616, "provider": "1" }
98
+ ```
99
+
100
+ This provider maps it to the seam's normalized result (`{url,title,snippet,summary}`
101
+ sources; url-scheme filter + dedupe; `maxResults` truncation owned by the seam).
20
102
 
21
103
  ## Error vocabulary
22
104
 
23
105
  | Situation | WebError code |
24
106
  |---|---|
25
107
  | No gateway key configured | `WEB_PROVIDER_CREDENTIAL_MISSING` |
26
- | Gateway unreachable / non-2xx / upstream business code ≠ 0 | `WEB_PROVIDER_ERROR` |
108
+ | Manager unreachable / non-2xx / upstream business code ≠ 0 | `WEB_PROVIDER_ERROR` |
27
109
  | All-pool search quota exhausted (15001, gateway 429 `quota_web_search`) | `WEB_PROVIDER_ERROR` (message says quota) |
28
110
  | Caller cancellation | `WEB_ABORTED` |
111
+
112
+ ## License
113
+
114
+ MIT — see the upstream projects' licenses for their respective code.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "dsh-web-search-workbuddy",
3
3
  "description": "WorkBuddy gateway-backed search provider (agenttool /v1/tools/search passthrough via the account-pool gateway) for the DeepSeek Harness web capability seam (ctx.web)",
4
- "version": "0.1.0",
4
+ "version": "0.2.0",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
7
7
  "types": "lib/types/index.d.ts",