@czj-git/dsh-plugin-hub 0.1.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 +21 -0
- package/README.en.md +357 -0
- package/README.md +357 -0
- package/cordis.patch.yml +8 -0
- package/dist/api.d.ts +246 -0
- package/dist/api.js +243 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.js +107 -0
- package/dist/render.d.ts +11 -0
- package/dist/render.js +41 -0
- package/dist/tool-schema.d.ts +281 -0
- package/dist/tool-schema.js +129 -0
- package/package.json +75 -0
package/README.md
ADDED
|
@@ -0,0 +1,357 @@
|
|
|
1
|
+
# DSH Plugin Hub 插件
|
|
2
|
+
|
|
3
|
+
[English](README.en.md) | 中文
|
|
4
|
+
|
|
5
|
+
把 [DSH Plugin Hub](https://dshpluginhub.dev) 的公开、只读搜索 API 接入 DeepSeek Harness。Agent 可以在对话中搜索已发布且通过验证的插件,查看排行榜,并取得安装命令、兼容性、社区指标和来源链接。
|
|
6
|
+
|
|
7
|
+
## 能做什么
|
|
8
|
+
|
|
9
|
+
- `dsh_plugin_search`:按任务、功能、插件名、仓库或作者搜索插件。
|
|
10
|
+
- `dsh_plugin_rankings`:查询日增长、Star 总榜、最新上架和最近活跃榜单。
|
|
11
|
+
- 支持中文和英文描述,以及分类、运行形态、安装来源、排序和分页筛选。
|
|
12
|
+
- Native 模式向模型返回紧凑、便于后续操作的文本;Code Mode 返回完整结构化结果。
|
|
13
|
+
- 校验公网 API 的每个返回字段,并暴露分页、数据更新时间和匿名限流信息。
|
|
14
|
+
- 支持 Harness 取消信号、可配置超时、429 重试信息和稳定的错误分类。
|
|
15
|
+
|
|
16
|
+
插件只调用公开的 `GET /api/v1/plugins/search`,不需要 API Key,不读取用户身份、收藏或私有数据,也不执行安装或其他写操作。安装命令只是结果数据,是否执行仍由 Harness 的 Shell、权限和审批策略控制。
|
|
17
|
+
|
|
18
|
+
## 安装与启动
|
|
19
|
+
|
|
20
|
+
从 npm 安装到 Web profile:
|
|
21
|
+
|
|
22
|
+
```sh
|
|
23
|
+
dsh plugin --profile web add @czj-git/dsh-plugin-hub
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
检查最终组合并启动:
|
|
27
|
+
|
|
28
|
+
```sh
|
|
29
|
+
dsh --profile web --dump-config
|
|
30
|
+
dsh --profile web
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## 配置
|
|
34
|
+
|
|
35
|
+
Bundle 默认配置:
|
|
36
|
+
|
|
37
|
+
```yaml
|
|
38
|
+
- id: dsh-plugin-hub
|
|
39
|
+
name: '@czj-git/dsh-plugin-hub'
|
|
40
|
+
config:
|
|
41
|
+
baseUrl: https://dshpluginhub.dev
|
|
42
|
+
locale: en
|
|
43
|
+
timeoutMs: 15000
|
|
44
|
+
maxResults: 10
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
| 字段 | 类型 | 默认值 | 约束与行为 |
|
|
48
|
+
|---|---|---:|---|
|
|
49
|
+
| `baseUrl` | `string` | `https://dshpluginhub.dev` | API 服务地址;只接受 HTTP(S),不能包含用户名、密码、查询参数或 URL 片段,末尾 `/` 会被移除。 |
|
|
50
|
+
| `locale` | `zh \| en` | `en` | 工具调用没有传入 `locale` 时使用的描述语言。 |
|
|
51
|
+
| `timeoutMs` | `integer` | `15000` | 每次 HTTP 请求的超时,范围为 1–120000 毫秒。 |
|
|
52
|
+
| `maxResults` | `integer` | `10` | 工具允许的最大 `limit`,范围为 1–50;同时也是每次调用的默认 `limit`。 |
|
|
53
|
+
|
|
54
|
+
后续 profile patch 覆盖配置时需要完整重述该行的全部 `config` 字段,因为 Cordis patch 替换整个配置对象而不是深度合并。
|
|
55
|
+
|
|
56
|
+
## 工具输入
|
|
57
|
+
|
|
58
|
+
### `dsh_plugin_search`
|
|
59
|
+
|
|
60
|
+
搜索已发布且通过验证的插件。`query` 会去除首尾空白并把连续空白合并成一个空格;规范化后为空会在发出网络请求前失败。
|
|
61
|
+
|
|
62
|
+
| 参数 | 必填 | 类型/可选值 | 默认值 | 说明 |
|
|
63
|
+
|---|---|---|---|---|
|
|
64
|
+
| `query` | 是 | `string` | — | 用户需求、功能、插件名、作者或仓库;规范化后必须非空,最长 100 个字符。 |
|
|
65
|
+
| `locale` | 否 | `zh`, `en` | 配置中的 `locale` | 返回本地化描述。 |
|
|
66
|
+
| `category` | 否 | 见“枚举值” | 全部分类 | 限定市场分类。 |
|
|
67
|
+
| `type` | 否 | `host`, `client`, `hybrid` | 全部形态 | 限定插件运行形态。 |
|
|
68
|
+
| `source` | 否 | `npm`, `github` | 全部来源 | 限定安装包来源。 |
|
|
69
|
+
| `sort` | 否 | `relevance`, `growth`, `stars`, `newest`, `active` | `relevance` | 控制稳定排序;非空关键词默认按相关性排序。 |
|
|
70
|
+
| `page` | 否 | `integer` | `1` | 页码,范围为 1–1000。 |
|
|
71
|
+
| `limit` | 否 | `integer` | 配置中的 `maxResults` | 本页条数,范围为 1–`maxResults`,且服务端上限为 50。 |
|
|
72
|
+
|
|
73
|
+
示例输入:
|
|
74
|
+
|
|
75
|
+
```json
|
|
76
|
+
{
|
|
77
|
+
"query": "让纯文本 Agent 看懂截图",
|
|
78
|
+
"locale": "zh",
|
|
79
|
+
"category": "multimodal-creative",
|
|
80
|
+
"type": "hybrid",
|
|
81
|
+
"source": "npm",
|
|
82
|
+
"sort": "relevance",
|
|
83
|
+
"page": 1,
|
|
84
|
+
"limit": 5
|
|
85
|
+
}
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
自然语言示例:
|
|
89
|
+
|
|
90
|
+
```text
|
|
91
|
+
帮我找一个能让纯文本 Agent 分析截图的 DeepSeek Harness 插件,优先返回 npm 包,并给出安装命令。
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### `dsh_plugin_rankings`
|
|
95
|
+
|
|
96
|
+
使用同一个公开搜索端点的排序能力列出榜单。该工具没有关键词、`type` 或 `source` 参数。
|
|
97
|
+
|
|
98
|
+
| 参数 | 必填 | 类型/可选值 | 默认值 | 说明 |
|
|
99
|
+
|---|---|---|---|---|
|
|
100
|
+
| `ranking` | 是 | `growth`, `stars`, `newest`, `active` | — | 选择榜单口径。 |
|
|
101
|
+
| `locale` | 否 | `zh`, `en` | 配置中的 `locale` | 返回本地化描述。 |
|
|
102
|
+
| `category` | 否 | 见“枚举值” | 全部分类 | 只排列指定分类。 |
|
|
103
|
+
| `page` | 否 | `integer` | `1` | 页码,范围为 1–1000。 |
|
|
104
|
+
| `limit` | 否 | `integer` | 配置中的 `maxResults` | 本页条数,范围为 1–`maxResults`。 |
|
|
105
|
+
|
|
106
|
+
`ranking` 的含义:
|
|
107
|
+
|
|
108
|
+
| 值 | 榜单 | 排序依据 |
|
|
109
|
+
|---|---|---|
|
|
110
|
+
| `growth` | 日增长 | 两个最近成功快照之间的 GitHub Star 变化。无上一份快照时 `starsDelta1d` 为 `null`。 |
|
|
111
|
+
| `stars` | Star 总榜 | GitHub Stars 总数。 |
|
|
112
|
+
| `newest` | 最新上架 | DSH Plugin Hub 首次收录时间。 |
|
|
113
|
+
| `active` | 最近活跃 | GitHub 最近推送时间。 |
|
|
114
|
+
|
|
115
|
+
示例输入:
|
|
116
|
+
|
|
117
|
+
```json
|
|
118
|
+
{
|
|
119
|
+
"ranking": "stars",
|
|
120
|
+
"locale": "zh",
|
|
121
|
+
"category": "coding-tools",
|
|
122
|
+
"page": 1,
|
|
123
|
+
"limit": 10
|
|
124
|
+
}
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
## 枚举值
|
|
128
|
+
|
|
129
|
+
分类 `category`:
|
|
130
|
+
|
|
131
|
+
| 值 | 含义 |
|
|
132
|
+
|---|---|
|
|
133
|
+
| `agent-workflow` | Agent 与工作流 |
|
|
134
|
+
| `coding-tools` | 编程与工具 |
|
|
135
|
+
| `models-data` | 模型与数据 |
|
|
136
|
+
| `ui-experience` | 界面与体验 |
|
|
137
|
+
| `integrations` | 连接与集成 |
|
|
138
|
+
| `security-governance` | 安全与治理 |
|
|
139
|
+
| `multimodal-creative` | 多模态与创作 |
|
|
140
|
+
| `observability-cost` | 监控与用量 |
|
|
141
|
+
| `other` | 其他 |
|
|
142
|
+
|
|
143
|
+
排序 `sort`:
|
|
144
|
+
|
|
145
|
+
- `relevance`:名称、仓库和作者匹配优先,其次是简介匹配;同级结果使用 Stars 和插件 ID 保持稳定顺序。
|
|
146
|
+
- `growth`、`stars`、`newest`、`active`:与排行榜工具中的同名口径一致。
|
|
147
|
+
|
|
148
|
+
## 工具输出
|
|
149
|
+
|
|
150
|
+
两个工具返回同一份结构化数据。Code Mode 可以读取全部字段;Native 模式使用下面的文本投影,避免把大量 JSON 填入模型上下文。
|
|
151
|
+
|
|
152
|
+
### 完整字段
|
|
153
|
+
|
|
154
|
+
| 路径 | 类型 | 说明 |
|
|
155
|
+
|---|---|---|
|
|
156
|
+
| `items` | `Plugin[]` | 当前页的插件。空结果为 `[]`,不是错误。 |
|
|
157
|
+
| `items[].id` | `string` | 插件的稳定公开 ID。 |
|
|
158
|
+
| `items[].slug` | `string` | `owner/repository` 形式的公开标识。 |
|
|
159
|
+
| `items[].name` | `string` | 插件显示名称。 |
|
|
160
|
+
| `items[].owner` | `string` | GitHub 仓库所有者。 |
|
|
161
|
+
| `items[].repo` | `string` | GitHub 仓库名。 |
|
|
162
|
+
| `items[].description` | `string` | 按 `locale` 返回的插件简介。 |
|
|
163
|
+
| `items[].type` | `host \| client \| hybrid` | 插件运行形态。 |
|
|
164
|
+
| `items[].category` | `string` | 市场分类枚举值。 |
|
|
165
|
+
| `items[].topics` | `string[]` | 仓库主题标签。 |
|
|
166
|
+
| `items[].language` | `string` | 仓库主要语言。 |
|
|
167
|
+
| `items[].license` | `string` | 许可证标识。 |
|
|
168
|
+
| `items[].package.name` | `string` | 包或安装目标名称。 |
|
|
169
|
+
| `items[].package.version` | `string` | 已验证版本。 |
|
|
170
|
+
| `items[].package.source` | `npm \| github` | 安装来源。 |
|
|
171
|
+
| `items[].package.sourceSpec` | `string` | 固定到已验证来源/版本的安装说明符。 |
|
|
172
|
+
| `items[].package.installCommand` | `string` | 可复制的 DSH 安装命令;返回命令不会自动执行。 |
|
|
173
|
+
| `items[].package.profile` | `string` | 建议安装的 Harness profile。 |
|
|
174
|
+
| `items[].compatibility.harnessVersion` | `string` | 验证时使用或要求的 Harness 版本。 |
|
|
175
|
+
| `items[].compatibility.verificationLevel` | `static-checked \| runtime-verified` | 静态检查或运行时验证级别。 |
|
|
176
|
+
| `items[].compatibility.smokeStatus` | `static-passed \| passed \| manual-step-required \| failed \| not-run` | Smoke 检查结果。 |
|
|
177
|
+
| `items[].compatibility.validatedAt` | `string` | 兼容性验证时间。 |
|
|
178
|
+
| `items[].metrics.stars` | `integer` | GitHub Stars。 |
|
|
179
|
+
| `items[].metrics.starsDelta1d` | `integer \| null` | 最近两个成功快照之间的 Star 变化;缺少基线时为 `null`。 |
|
|
180
|
+
| `items[].metrics.forks` | `integer` | GitHub Forks。 |
|
|
181
|
+
| `items[].metrics.openIssues` | `integer` | GitHub Open Issues。 |
|
|
182
|
+
| `items[].metrics.views` | `integer` | DSH Plugin Hub 公开浏览量。 |
|
|
183
|
+
| `items[].timestamps.listedAt` | `string` | 市场首次收录时间。 |
|
|
184
|
+
| `items[].timestamps.lastPushedAt` | `string` | GitHub 最近推送时间。 |
|
|
185
|
+
| `items[].timestamps.sourceUpdatedAt` | `string` | 来源数据最近更新时间。 |
|
|
186
|
+
| `items[].links.detail` | `string` | DSH Plugin Hub 详情页 URL。 |
|
|
187
|
+
| `items[].links.repository` | `string` | GitHub 仓库 URL。 |
|
|
188
|
+
| `pagination.page` | `integer` | 当前页码。 |
|
|
189
|
+
| `pagination.perPage` | `integer` | 服务端返回的每页条数。 |
|
|
190
|
+
| `pagination.total` | `integer` | 符合条件的插件总数。 |
|
|
191
|
+
| `pagination.totalPages` | `integer` | 总页数。 |
|
|
192
|
+
| `meta.apiVersion` | `v1` | 公网 API 版本。 |
|
|
193
|
+
| `meta.locale` | `zh \| en` | 实际使用的描述语言。 |
|
|
194
|
+
| `meta.query` | `string` | 服务端接收的规范化关键词;排行榜通常为空字符串。 |
|
|
195
|
+
| `meta.sort` | `string` | 实际使用的排序。 |
|
|
196
|
+
| `meta.dataUpdatedAt` | `string` | 此响应所基于的数据更新时间。 |
|
|
197
|
+
| `rateLimit.limit` | `integer \| null` | 响应头中的匿名额度上限;响应头缺失或无效时为 `null`。 |
|
|
198
|
+
| `rateLimit.remaining` | `integer \| null` | 响应头中的剩余额度;缺失或无效时为 `null`。 |
|
|
199
|
+
| `rateLimit.reset` | `string \| null` | `RateLimit-Reset` 响应头的原始值。 |
|
|
200
|
+
| `rateLimit.retryAfterSeconds` | `integer \| null` | `Retry-After` 的非负整数秒数;通常只在 429 时出现。 |
|
|
201
|
+
|
|
202
|
+
### 完整结构化输出示例
|
|
203
|
+
|
|
204
|
+
```json
|
|
205
|
+
{
|
|
206
|
+
"items": [
|
|
207
|
+
{
|
|
208
|
+
"id": "123",
|
|
209
|
+
"slug": "owner/plugin",
|
|
210
|
+
"name": "plugin",
|
|
211
|
+
"owner": "owner",
|
|
212
|
+
"repo": "plugin",
|
|
213
|
+
"description": "一个已通过验证的 DeepSeek Harness 插件。",
|
|
214
|
+
"type": "host",
|
|
215
|
+
"category": "coding-tools",
|
|
216
|
+
"topics": ["dsh-plugin", "developer-tools"],
|
|
217
|
+
"language": "TypeScript",
|
|
218
|
+
"license": "MIT",
|
|
219
|
+
"package": {
|
|
220
|
+
"name": "dsh-plugin-example",
|
|
221
|
+
"version": "1.0.0",
|
|
222
|
+
"source": "npm",
|
|
223
|
+
"sourceSpec": "dsh-plugin-example@1.0.0",
|
|
224
|
+
"installCommand": "dsh plugin --profile web add dsh-plugin-example",
|
|
225
|
+
"profile": "web"
|
|
226
|
+
},
|
|
227
|
+
"compatibility": {
|
|
228
|
+
"harnessVersion": "0.1.0-rc.7",
|
|
229
|
+
"verificationLevel": "runtime-verified",
|
|
230
|
+
"smokeStatus": "passed",
|
|
231
|
+
"validatedAt": "2026-08-27T00:00:00.000Z"
|
|
232
|
+
},
|
|
233
|
+
"metrics": {
|
|
234
|
+
"stars": 42,
|
|
235
|
+
"starsDelta1d": 3,
|
|
236
|
+
"forks": 4,
|
|
237
|
+
"openIssues": 1,
|
|
238
|
+
"views": 20
|
|
239
|
+
},
|
|
240
|
+
"timestamps": {
|
|
241
|
+
"listedAt": "2026-08-20T00:00:00.000Z",
|
|
242
|
+
"lastPushedAt": "2026-08-26T00:00:00.000Z",
|
|
243
|
+
"sourceUpdatedAt": "2026-08-27T00:00:00.000Z"
|
|
244
|
+
},
|
|
245
|
+
"links": {
|
|
246
|
+
"detail": "https://dshpluginhub.dev/zh/plugins/owner/plugin",
|
|
247
|
+
"repository": "https://github.com/owner/plugin"
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
],
|
|
251
|
+
"pagination": {
|
|
252
|
+
"page": 1,
|
|
253
|
+
"perPage": 5,
|
|
254
|
+
"total": 1,
|
|
255
|
+
"totalPages": 1
|
|
256
|
+
},
|
|
257
|
+
"meta": {
|
|
258
|
+
"apiVersion": "v1",
|
|
259
|
+
"locale": "zh",
|
|
260
|
+
"query": "截图分析",
|
|
261
|
+
"sort": "relevance",
|
|
262
|
+
"dataUpdatedAt": "2026-08-27T00:00:00.000Z"
|
|
263
|
+
},
|
|
264
|
+
"rateLimit": {
|
|
265
|
+
"limit": 60,
|
|
266
|
+
"remaining": 58,
|
|
267
|
+
"reset": "42",
|
|
268
|
+
"retryAfterSeconds": null
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
### Native 模式文本示例
|
|
274
|
+
|
|
275
|
+
```text
|
|
276
|
+
Plugin search: 1 matches; showing 1 on page 1.
|
|
277
|
+
1. plugin (owner/plugin)
|
|
278
|
+
一个已通过验证的 DeepSeek Harness 插件。
|
|
279
|
+
coding-tools · host · 42 stars · 1d growth +3
|
|
280
|
+
Install: dsh plugin --profile web add dsh-plugin-example
|
|
281
|
+
Details: https://dshpluginhub.dev/zh/plugins/owner/plugin
|
|
282
|
+
Repository: https://github.com/owner/plugin
|
|
283
|
+
Anonymous API quota remaining: 58/60.
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
空结果会返回有效的 `items: []`。Native 模式显示:
|
|
287
|
+
|
|
288
|
+
```text
|
|
289
|
+
Plugin search: no published, verified plugins matched. Try a broader query or remove a filter.
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
## 错误与取消
|
|
293
|
+
|
|
294
|
+
工具输入校验、网络访问、服务端错误和返回校验失败都会结束本次工具调用,不会把不完整数据伪装成成功结果。底层客户端抛出 `PluginHubApiError`,包含以下可编程字段:
|
|
295
|
+
|
|
296
|
+
| 字段 | 类型 | 说明 |
|
|
297
|
+
|---|---|---|
|
|
298
|
+
| `message` | `string` | 面向调用者的稳定错误说明。 |
|
|
299
|
+
| `code` | `string` | 本地错误码或服务端公开错误码。 |
|
|
300
|
+
| `status` | `integer \| null` | HTTP 状态码;请求未取得响应时为 `null`。 |
|
|
301
|
+
| `fields` | `Record<string, string>` | 服务端返回的字段级错误;没有时为空对象。 |
|
|
302
|
+
| `retryAfterSeconds` | `integer \| null` | 可重试等待秒数;只接受有效的非负整数响应头。 |
|
|
303
|
+
|
|
304
|
+
本地错误码:
|
|
305
|
+
|
|
306
|
+
| `code` | 触发条件 |
|
|
307
|
+
|---|---|
|
|
308
|
+
| `CANCELLED` | Harness 取消了正在进行的工具调用。 |
|
|
309
|
+
| `TIMEOUT` | 请求超过配置中的 `timeoutMs`。 |
|
|
310
|
+
| `NETWORK_ERROR` | DNS、TLS、连接或其他网络访问失败。 |
|
|
311
|
+
| `INVALID_RESPONSE` | 服务返回非 JSON,或成功响应不符合完整字段定义。 |
|
|
312
|
+
| `HTTP_<status>` | 非成功响应没有可识别的公开错误对象。 |
|
|
313
|
+
|
|
314
|
+
服务端错误码会原样保留,例如参数不合法的 `INVALID_QUERY` 或匿名额度耗尽的 `RATE_LIMITED`。429 响应同时读取 `Retry-After`。
|
|
315
|
+
|
|
316
|
+
程序化处理示例:
|
|
317
|
+
|
|
318
|
+
```ts
|
|
319
|
+
import { PluginHubApiError, PluginHubClient } from '@czj-git/dsh-plugin-hub/api'
|
|
320
|
+
|
|
321
|
+
const client = new PluginHubClient({
|
|
322
|
+
baseUrl: 'https://dshpluginhub.dev',
|
|
323
|
+
timeoutMs: 15_000,
|
|
324
|
+
})
|
|
325
|
+
|
|
326
|
+
try {
|
|
327
|
+
const result = await client.search(
|
|
328
|
+
{ query: 'memory', locale: 'zh', page: 1, perPage: 5 },
|
|
329
|
+
new AbortController().signal,
|
|
330
|
+
)
|
|
331
|
+
console.log(result.items)
|
|
332
|
+
} catch (error) {
|
|
333
|
+
if (error instanceof PluginHubApiError) {
|
|
334
|
+
console.error(error.code, error.status, error.retryAfterSeconds)
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
## 开发与验证
|
|
340
|
+
|
|
341
|
+
```sh
|
|
342
|
+
npm install
|
|
343
|
+
npm run check
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
`npm run check` 依次运行严格类型检查、无网络单元测试和生产构建。GitHub 源安装会执行 `prepare` 生成 `dist/`;pnpm 10+ 会要求用户明确允许该构建脚本。若不希望授予安装期构建权限,请发布包含预构建 `dist/` 的 npm 包或 tarball。
|
|
347
|
+
|
|
348
|
+
## 限制
|
|
349
|
+
|
|
350
|
+
- 当前公开 API 只有搜索端点;排行榜工具通过同一端点的稳定排序参数实现。
|
|
351
|
+
- 插件详情正文、评论、收藏和用户数据不在公开 API 中,因此本插件不读取这些内容。
|
|
352
|
+
- 返回的安装命令不会自动执行,也不表示插件适用于所有 profile;调用者应检查 `package.profile` 和兼容性字段。
|
|
353
|
+
- 匿名额度由服务端控制;默认策略可能调整,工具只报告当前响应中的实际限流头。
|
|
354
|
+
|
|
355
|
+
## 许可证
|
|
356
|
+
|
|
357
|
+
MIT
|
package/cordis.patch.yml
ADDED
package/dist/api.d.ts
ADDED
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/** Locales supported by the public DSH Plugin Hub API. */
|
|
3
|
+
export declare const pluginHubLocales: readonly ["zh", "en"];
|
|
4
|
+
/** Public plugin categories exposed by DSH Plugin Hub. */
|
|
5
|
+
export declare const pluginHubCategories: readonly ["agent-workflow", "coding-tools", "models-data", "ui-experience", "integrations", "security-governance", "multimodal-creative", "observability-cost", "other"];
|
|
6
|
+
/** Plugin runtime shapes supported by the public API. */
|
|
7
|
+
export declare const pluginHubTypes: readonly ["host", "client", "hybrid"];
|
|
8
|
+
/** Install sources supported by the public API. */
|
|
9
|
+
export declare const pluginHubSources: readonly ["npm", "github"];
|
|
10
|
+
/** Ordering modes supported by the public API. */
|
|
11
|
+
export declare const pluginHubSorts: readonly ["relevance", "growth", "stars", "newest", "active"];
|
|
12
|
+
export type PluginHubLocale = (typeof pluginHubLocales)[number];
|
|
13
|
+
export type PluginHubCategory = (typeof pluginHubCategories)[number];
|
|
14
|
+
export type PluginHubType = (typeof pluginHubTypes)[number];
|
|
15
|
+
export type PluginHubSource = (typeof pluginHubSources)[number];
|
|
16
|
+
export type PluginHubSort = (typeof pluginHubSorts)[number];
|
|
17
|
+
declare const pluginSchema: z.ZodObject<{
|
|
18
|
+
id: z.ZodString;
|
|
19
|
+
slug: z.ZodString;
|
|
20
|
+
name: z.ZodString;
|
|
21
|
+
owner: z.ZodString;
|
|
22
|
+
repo: z.ZodString;
|
|
23
|
+
description: z.ZodString;
|
|
24
|
+
type: z.ZodEnum<{
|
|
25
|
+
host: "host";
|
|
26
|
+
client: "client";
|
|
27
|
+
hybrid: "hybrid";
|
|
28
|
+
}>;
|
|
29
|
+
category: z.ZodEnum<{
|
|
30
|
+
"agent-workflow": "agent-workflow";
|
|
31
|
+
"coding-tools": "coding-tools";
|
|
32
|
+
"models-data": "models-data";
|
|
33
|
+
"ui-experience": "ui-experience";
|
|
34
|
+
integrations: "integrations";
|
|
35
|
+
"security-governance": "security-governance";
|
|
36
|
+
"multimodal-creative": "multimodal-creative";
|
|
37
|
+
"observability-cost": "observability-cost";
|
|
38
|
+
other: "other";
|
|
39
|
+
}>;
|
|
40
|
+
topics: z.ZodArray<z.ZodString>;
|
|
41
|
+
language: z.ZodString;
|
|
42
|
+
license: z.ZodString;
|
|
43
|
+
package: z.ZodObject<{
|
|
44
|
+
name: z.ZodString;
|
|
45
|
+
version: z.ZodString;
|
|
46
|
+
source: z.ZodEnum<{
|
|
47
|
+
npm: "npm";
|
|
48
|
+
github: "github";
|
|
49
|
+
}>;
|
|
50
|
+
sourceSpec: z.ZodString;
|
|
51
|
+
installCommand: z.ZodString;
|
|
52
|
+
profile: z.ZodString;
|
|
53
|
+
}, z.core.$strip>;
|
|
54
|
+
compatibility: z.ZodObject<{
|
|
55
|
+
harnessVersion: z.ZodString;
|
|
56
|
+
verificationLevel: z.ZodEnum<{
|
|
57
|
+
"static-checked": "static-checked";
|
|
58
|
+
"runtime-verified": "runtime-verified";
|
|
59
|
+
}>;
|
|
60
|
+
smokeStatus: z.ZodEnum<{
|
|
61
|
+
"static-passed": "static-passed";
|
|
62
|
+
passed: "passed";
|
|
63
|
+
"manual-step-required": "manual-step-required";
|
|
64
|
+
failed: "failed";
|
|
65
|
+
"not-run": "not-run";
|
|
66
|
+
}>;
|
|
67
|
+
validatedAt: z.ZodString;
|
|
68
|
+
}, z.core.$strip>;
|
|
69
|
+
metrics: z.ZodObject<{
|
|
70
|
+
stars: z.ZodNumber;
|
|
71
|
+
starsDelta1d: z.ZodNullable<z.ZodNumber>;
|
|
72
|
+
forks: z.ZodNumber;
|
|
73
|
+
openIssues: z.ZodNumber;
|
|
74
|
+
views: z.ZodNumber;
|
|
75
|
+
}, z.core.$strip>;
|
|
76
|
+
timestamps: z.ZodObject<{
|
|
77
|
+
listedAt: z.ZodString;
|
|
78
|
+
lastPushedAt: z.ZodString;
|
|
79
|
+
sourceUpdatedAt: z.ZodString;
|
|
80
|
+
}, z.core.$strip>;
|
|
81
|
+
links: z.ZodObject<{
|
|
82
|
+
detail: z.ZodURL;
|
|
83
|
+
repository: z.ZodURL;
|
|
84
|
+
}, z.core.$strip>;
|
|
85
|
+
}, z.core.$strip>;
|
|
86
|
+
declare const responseSchema: z.ZodObject<{
|
|
87
|
+
items: z.ZodArray<z.ZodObject<{
|
|
88
|
+
id: z.ZodString;
|
|
89
|
+
slug: z.ZodString;
|
|
90
|
+
name: z.ZodString;
|
|
91
|
+
owner: z.ZodString;
|
|
92
|
+
repo: z.ZodString;
|
|
93
|
+
description: z.ZodString;
|
|
94
|
+
type: z.ZodEnum<{
|
|
95
|
+
host: "host";
|
|
96
|
+
client: "client";
|
|
97
|
+
hybrid: "hybrid";
|
|
98
|
+
}>;
|
|
99
|
+
category: z.ZodEnum<{
|
|
100
|
+
"agent-workflow": "agent-workflow";
|
|
101
|
+
"coding-tools": "coding-tools";
|
|
102
|
+
"models-data": "models-data";
|
|
103
|
+
"ui-experience": "ui-experience";
|
|
104
|
+
integrations: "integrations";
|
|
105
|
+
"security-governance": "security-governance";
|
|
106
|
+
"multimodal-creative": "multimodal-creative";
|
|
107
|
+
"observability-cost": "observability-cost";
|
|
108
|
+
other: "other";
|
|
109
|
+
}>;
|
|
110
|
+
topics: z.ZodArray<z.ZodString>;
|
|
111
|
+
language: z.ZodString;
|
|
112
|
+
license: z.ZodString;
|
|
113
|
+
package: z.ZodObject<{
|
|
114
|
+
name: z.ZodString;
|
|
115
|
+
version: z.ZodString;
|
|
116
|
+
source: z.ZodEnum<{
|
|
117
|
+
npm: "npm";
|
|
118
|
+
github: "github";
|
|
119
|
+
}>;
|
|
120
|
+
sourceSpec: z.ZodString;
|
|
121
|
+
installCommand: z.ZodString;
|
|
122
|
+
profile: z.ZodString;
|
|
123
|
+
}, z.core.$strip>;
|
|
124
|
+
compatibility: z.ZodObject<{
|
|
125
|
+
harnessVersion: z.ZodString;
|
|
126
|
+
verificationLevel: z.ZodEnum<{
|
|
127
|
+
"static-checked": "static-checked";
|
|
128
|
+
"runtime-verified": "runtime-verified";
|
|
129
|
+
}>;
|
|
130
|
+
smokeStatus: z.ZodEnum<{
|
|
131
|
+
"static-passed": "static-passed";
|
|
132
|
+
passed: "passed";
|
|
133
|
+
"manual-step-required": "manual-step-required";
|
|
134
|
+
failed: "failed";
|
|
135
|
+
"not-run": "not-run";
|
|
136
|
+
}>;
|
|
137
|
+
validatedAt: z.ZodString;
|
|
138
|
+
}, z.core.$strip>;
|
|
139
|
+
metrics: z.ZodObject<{
|
|
140
|
+
stars: z.ZodNumber;
|
|
141
|
+
starsDelta1d: z.ZodNullable<z.ZodNumber>;
|
|
142
|
+
forks: z.ZodNumber;
|
|
143
|
+
openIssues: z.ZodNumber;
|
|
144
|
+
views: z.ZodNumber;
|
|
145
|
+
}, z.core.$strip>;
|
|
146
|
+
timestamps: z.ZodObject<{
|
|
147
|
+
listedAt: z.ZodString;
|
|
148
|
+
lastPushedAt: z.ZodString;
|
|
149
|
+
sourceUpdatedAt: z.ZodString;
|
|
150
|
+
}, z.core.$strip>;
|
|
151
|
+
links: z.ZodObject<{
|
|
152
|
+
detail: z.ZodURL;
|
|
153
|
+
repository: z.ZodURL;
|
|
154
|
+
}, z.core.$strip>;
|
|
155
|
+
}, z.core.$strip>>;
|
|
156
|
+
pagination: z.ZodObject<{
|
|
157
|
+
page: z.ZodNumber;
|
|
158
|
+
perPage: z.ZodNumber;
|
|
159
|
+
total: z.ZodNumber;
|
|
160
|
+
totalPages: z.ZodNumber;
|
|
161
|
+
}, z.core.$strip>;
|
|
162
|
+
meta: z.ZodObject<{
|
|
163
|
+
apiVersion: z.ZodLiteral<"v1">;
|
|
164
|
+
locale: z.ZodEnum<{
|
|
165
|
+
zh: "zh";
|
|
166
|
+
en: "en";
|
|
167
|
+
}>;
|
|
168
|
+
query: z.ZodString;
|
|
169
|
+
sort: z.ZodEnum<{
|
|
170
|
+
relevance: "relevance";
|
|
171
|
+
growth: "growth";
|
|
172
|
+
stars: "stars";
|
|
173
|
+
newest: "newest";
|
|
174
|
+
active: "active";
|
|
175
|
+
}>;
|
|
176
|
+
dataUpdatedAt: z.ZodString;
|
|
177
|
+
}, z.core.$strip>;
|
|
178
|
+
}, z.core.$strip>;
|
|
179
|
+
export type PluginHubPlugin = z.infer<typeof pluginSchema>;
|
|
180
|
+
export interface PluginHubRateLimit {
|
|
181
|
+
limit: number | null;
|
|
182
|
+
remaining: number | null;
|
|
183
|
+
reset: string | null;
|
|
184
|
+
retryAfterSeconds: number | null;
|
|
185
|
+
}
|
|
186
|
+
export interface PluginHubSearchResult extends z.infer<typeof responseSchema> {
|
|
187
|
+
rateLimit: PluginHubRateLimit;
|
|
188
|
+
}
|
|
189
|
+
export interface PluginHubSearchInput {
|
|
190
|
+
query?: string;
|
|
191
|
+
locale?: PluginHubLocale;
|
|
192
|
+
category?: PluginHubCategory;
|
|
193
|
+
type?: PluginHubType;
|
|
194
|
+
source?: PluginHubSource;
|
|
195
|
+
sort?: PluginHubSort;
|
|
196
|
+
page?: number;
|
|
197
|
+
perPage?: number;
|
|
198
|
+
}
|
|
199
|
+
export interface PluginHubClientOptions {
|
|
200
|
+
baseUrl: string;
|
|
201
|
+
timeoutMs: number;
|
|
202
|
+
fetch?: typeof globalThis.fetch;
|
|
203
|
+
}
|
|
204
|
+
/** An HTTP or response-validation failure returned by DSH Plugin Hub. */
|
|
205
|
+
export declare class PluginHubApiError extends Error {
|
|
206
|
+
readonly code: string;
|
|
207
|
+
readonly status: number | null;
|
|
208
|
+
readonly fields: Readonly<Record<string, string>>;
|
|
209
|
+
readonly retryAfterSeconds: number | null;
|
|
210
|
+
/**
|
|
211
|
+
* Create one stable public-API failure.
|
|
212
|
+
* @param message - Human-readable failure.
|
|
213
|
+
* @param options - Structured HTTP and API diagnostics.
|
|
214
|
+
*/
|
|
215
|
+
constructor(message: string, options: {
|
|
216
|
+
code: string;
|
|
217
|
+
status?: number;
|
|
218
|
+
fields?: Record<string, string>;
|
|
219
|
+
retryAfterSeconds?: number | null;
|
|
220
|
+
cause?: unknown;
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Validate and canonicalize the configured service origin.
|
|
225
|
+
* @param raw - User-configured base URL.
|
|
226
|
+
* @returns An HTTP(S) origin without a trailing slash.
|
|
227
|
+
*/
|
|
228
|
+
export declare function normalizePluginHubBaseUrl(raw: string): string;
|
|
229
|
+
/** Read-only client for the versioned DSH Plugin Hub search endpoint. */
|
|
230
|
+
export declare class PluginHubClient {
|
|
231
|
+
#private;
|
|
232
|
+
/**
|
|
233
|
+
* Create a client with one deployment's network policy.
|
|
234
|
+
* @param options - Service origin, request timeout, and optional test transport.
|
|
235
|
+
*/
|
|
236
|
+
constructor(options: PluginHubClientOptions);
|
|
237
|
+
/**
|
|
238
|
+
* Search published, verified plugins.
|
|
239
|
+
* @param input - Public search filters and page controls.
|
|
240
|
+
* @param signal - Caller-owned cancellation signal.
|
|
241
|
+
* @returns Validated API data plus anonymous quota headers.
|
|
242
|
+
*/
|
|
243
|
+
search(input: PluginHubSearchInput, signal: AbortSignal): Promise<PluginHubSearchResult>;
|
|
244
|
+
}
|
|
245
|
+
export {};
|
|
246
|
+
//# sourceMappingURL=api.d.ts.map
|