dshbase-catalog 0.3.58 → 0.3.60

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/dist/index.js CHANGED
@@ -1,4 +1,3 @@
1
- import { defineTool } from '@deepseek-ai/dsh-tools';
2
1
  import catalog from './catalog.json' with { type: 'json' };
3
2
  export const name = 'dshbase-catalog';
4
3
  export const inject = ['tools'];
@@ -12,30 +11,71 @@ function text(v) {
12
11
  function pfTag(p) {
13
12
  return p.platform && p.platform !== 'any' ? ` · ${PF[p.platform] || p.platform}` : '';
14
13
  }
14
+ function takeLimit(value, fallback) {
15
+ if (typeof value === 'number' && Number.isFinite(value) && value > 0)
16
+ return Math.floor(value);
17
+ if (typeof value === 'string' && value.trim() !== '') {
18
+ const n = parseInt(value, 10);
19
+ if (Number.isFinite(n) && n > 0)
20
+ return n;
21
+ }
22
+ return fallback;
23
+ }
24
+ // `tools` is declared by the host's @deepseek-ai/dsh-tools augmentation of Context.
25
+ // This package does not import that module at runtime, so the register call is typed locally.
26
+ function registerTool(ctx, tool) {
27
+ ctx.tools.register(tool);
28
+ }
15
29
  // 按星数降序排好的副本
16
30
  const byStars = [...plugins].sort((a, b) => (b.stars || 0) - (a.stars || 0));
17
31
  // 按收录时间降序(新收录在前)
18
32
  const byNew = [...plugins].sort((a, b) => (b.added || '').localeCompare(a.added || ''));
33
+ function tierOf(p) {
34
+ return p.test === 'verified' ? 'verified' : p.test === 'listed' ? 'listed' : 'pending';
35
+ }
36
+ function statusZh(p) {
37
+ const t = tierOf(p);
38
+ return t === 'verified' ? '已验证' : t === 'listed' ? '已收录(未实测)' : '未验证';
39
+ }
40
+ function statusLabel(p) {
41
+ const t = tierOf(p);
42
+ if (t === 'verified')
43
+ return '✅ 已验证 (verified)';
44
+ if (t === 'listed')
45
+ return '📋 已收录(未实测) (listed (not yet install-tested))';
46
+ return '⏳ 未验证 (pending)';
47
+ }
48
+ function statusCounts(list) {
49
+ const c = { verified: 0, listed: 0, pending: 0 };
50
+ for (const p of list)
51
+ c[tierOf(p)]++;
52
+ return c;
53
+ }
19
54
  function fmtHit(p, i) {
20
55
  const idx = i !== undefined ? `${i + 1}. ` : '';
21
56
  const star = `★${p.stars || 0}`;
22
- // 两档:已验证 / 未验证(网站已从三档收敛,不再有 broken)
23
- const status = p.test === 'verified' ? '已验证' : '未验证';
57
+ // 三档:已验证 / 已收录(未实测)/ 未验证
58
+ const status = statusZh(p);
24
59
  return `${idx}${p.name} [${status}]${pfTag(p)} ${star}\n ${p.desc}\n Install: ${p.install}`;
25
60
  }
26
61
  export function apply(ctx) {
27
62
  // 1. 搜索插件
28
- ctx.tools.register(defineTool({
63
+ registerTool(ctx, {
29
64
  name: 'search_dsh_plugins',
30
65
  description: 'Search the dshbase plugin directory for DeepSeek Harness plugins by keyword. Matches against plugin name, category, or description (English & Chinese). Returns each hit with its install command and verification status so you can install it directly.',
31
66
  parameters: {
32
- query: { type: 'string', required: true, description: 'Keyword (e.g. "memory", "terminal", "视觉", "浏览器")' },
33
- limit: { type: 'string', description: 'Max results (default 10)' },
67
+ type: 'object',
68
+ properties: {
69
+ query: { type: 'string', description: 'Keyword (e.g. "memory", "terminal", "视觉", "浏览器")' },
70
+ limit: { type: 'number', description: 'Max results (default 10)' },
71
+ },
72
+ required: ['query'],
73
+ additionalProperties: false,
34
74
  },
35
75
  output: { schema: { type: 'string' }, render: (_a, v) => text(v) },
36
76
  async execute(args) {
37
77
  const q = (args.query || '').toLowerCase();
38
- const lim = parseInt(args.limit || '10', 10) || 10;
78
+ const lim = takeLimit(args.limit, 10);
39
79
  const hits = plugins.filter((p) => !q ||
40
80
  p.name.toLowerCase().includes(q) ||
41
81
  p.category.toLowerCase().includes(q) ||
@@ -45,20 +85,25 @@ export function apply(ctx) {
45
85
  return `No plugins matched "${args.query}". Try a broader keyword.`;
46
86
  return `Found ${hits.length} plugins (of ${plugins.length} on dshbase):\n\n${hits.map((p, i) => fmtHit(p, i)).join('\n\n')}`;
47
87
  },
48
- }));
88
+ });
49
89
  // 2. 插件详情 + 安装命令
50
- ctx.tools.register(defineTool({
90
+ registerTool(ctx, {
51
91
  name: 'get_dsh_plugin',
52
92
  description: 'Get details, verification status, and the exact install command for a specific DeepSeek Harness plugin from the dshbase directory.',
53
93
  parameters: {
54
- name: { type: 'string', required: true, description: 'Plugin name (e.g. "dsh-memory")' },
94
+ type: 'object',
95
+ properties: {
96
+ name: { type: 'string', description: 'Plugin name (e.g. "dsh-memory")' },
97
+ },
98
+ required: ['name'],
99
+ additionalProperties: false,
55
100
  },
56
101
  output: { schema: { type: 'string' }, render: (_a, v) => text(v) },
57
102
  async execute(args) {
58
103
  const p = plugins.find((x) => x.name === args.name);
59
104
  if (!p)
60
105
  return `Plugin "${args.name}" not found. Use search_dsh_plugins to find it.`;
61
- const status = p.test === 'verified' ? '✅ 已验证 (verified)' : '⏳ 未验证 (pending)';
106
+ const status = statusLabel(p);
62
107
  const src = p.npm ? `npm (${p.pkg})` : 'GitHub source';
63
108
  const pf = p.platform && p.platform !== 'any' ? (PF[p.platform] || p.platform) : 'any';
64
109
  return [
@@ -74,19 +119,23 @@ export function apply(ctx) {
74
119
  `More: ${p.url}`,
75
120
  ].filter((l) => l !== '').join('\n');
76
121
  },
77
- }));
122
+ });
78
123
  // 3. 列出插件(热门 / 新收录 / 分类)
79
- ctx.tools.register(defineTool({
124
+ registerTool(ctx, {
80
125
  name: 'list_dsh_plugins',
81
126
  description: 'List DeepSeek Harness plugins from dshbase. Use sort="hot" for most-starred, sort="new" for recently added, or pass a category to list plugins in that category.',
82
127
  parameters: {
83
- category: { type: 'string', description: 'Category name (e.g. "Developer"). Omit for all categories.' },
84
- sort: { type: 'string', description: 'Sort: "hot" (by stars, default) or "new" (recently added)' },
85
- limit: { type: 'string', description: 'Max results (default 20)' },
128
+ type: 'object',
129
+ properties: {
130
+ category: { type: 'string', description: 'Category name (e.g. "Developer"). Omit for all categories.' },
131
+ sort: { type: 'string', description: 'Sort: "hot" (by stars, default) or "new" (recently added)' },
132
+ limit: { type: 'number', description: 'Max results (default 20)' },
133
+ },
134
+ additionalProperties: false,
86
135
  },
87
136
  output: { schema: { type: 'string' }, render: (_a, v) => text(v) },
88
137
  async execute(args) {
89
- const lim = parseInt(args.limit || '20', 10) || 20;
138
+ const lim = takeLimit(args.limit, 20);
90
139
  let pool = args.sort === 'new' ? byNew : byStars;
91
140
  if (args.category) {
92
141
  const cat = String(args.category);
@@ -98,17 +147,20 @@ export function apply(ctx) {
98
147
  const label = args.sort === 'new' ? 'recently added' : 'most-starred';
99
148
  return `Top ${hits.length} ${label} plugins${args.category ? ` in "${args.category}"` : ''}:\n\n${hits.map((p, i) => fmtHit(p, i)).join('\n\n')}`;
100
149
  },
101
- }));
150
+ });
102
151
  // 4. 站点统计
103
- ctx.tools.register(defineTool({
152
+ registerTool(ctx, {
104
153
  name: 'get_dsh_stats',
105
154
  description: 'Get live stats of the dshbase plugin directory: total plugins, verification status counts, and category distribution.',
106
- parameters: {},
155
+ parameters: {
156
+ type: 'object',
157
+ properties: {},
158
+ additionalProperties: false,
159
+ },
107
160
  output: { schema: { type: 'string' }, render: (_a, v) => text(v) },
108
161
  async execute() {
109
162
  const total = plugins.length;
110
- const verified = plugins.filter((p) => p.test === 'verified').length;
111
- const pending = plugins.filter((p) => p.test === 'pending').length;
163
+ const { verified, listed, pending } = statusCounts(plugins);
112
164
  const npmCount = plugins.filter((p) => p.npm).length;
113
165
  const winCount = plugins.filter((p) => p.platform === 'win32').length;
114
166
  const macCount = plugins.filter((p) => p.platform === 'macos').length;
@@ -120,6 +172,7 @@ export function apply(ctx) {
120
172
  'dshbase plugin directory stats:',
121
173
  ` Total: ${total}`,
122
174
  ` ✅ Verified: ${verified}`,
175
+ ` 📋 Listed (not yet install-tested) / 已收录(未实测): ${listed}`,
123
176
  ` ⏳ Pending: ${pending}`,
124
177
  ` On npm: ${npmCount} · GitHub source: ${total - npmCount}`,
125
178
  ` Platform-specific: ${winCount} Windows · ${macCount} macOS`,
@@ -128,12 +181,16 @@ export function apply(ctx) {
128
181
  catLines,
129
182
  ].join('\n');
130
183
  },
131
- }));
184
+ });
132
185
  // 5. 分类列表
133
- ctx.tools.register(defineTool({
186
+ registerTool(ctx, {
134
187
  name: 'get_dsh_categories',
135
188
  description: 'List the plugin categories in the dshbase directory with their plugin counts. Use this to discover what categories exist before listing plugins.',
136
- parameters: {},
189
+ parameters: {
190
+ type: 'object',
191
+ properties: {},
192
+ additionalProperties: false,
193
+ },
137
194
  output: { schema: { type: 'string' }, render: (_a, v) => text(v) },
138
195
  async execute() {
139
196
  const lines = CATEGORIES.map((c) => {
@@ -142,5 +199,5 @@ export function apply(ctx) {
142
199
  });
143
200
  return `dshbase categories:\n\n${lines.join('\n')}`;
144
201
  },
145
- }));
202
+ });
146
203
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dshbase-catalog",
3
- "version": "0.3.58",
3
+ "version": "0.3.60",
4
4
  "description": "Query the dshbase plugin directory from inside DeepSeek Harness — search, list, and get install commands for 1700+ plugins.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -21,11 +21,13 @@
21
21
  "plugin-directory",
22
22
  "catalog"
23
23
  ],
24
- "dependencies": {
25
- "@deepseek-ai/cordis": "^4.0.1",
26
- "@deepseek-ai/dsh-tools": "^0.1.0-rc.6"
24
+ "peerDependencies": {
25
+ "@deepseek-ai/cordis": ">=4.0.4 <4.0.5-0 || >=4.0.5-alpha.1 <5",
26
+ "@deepseek-ai/dsh": ">=0.2.0-rc.2 <0.2.1-0 || >=0.2.1-alpha.1 <0.3.0-0",
27
+ "@deepseek-ai/dsh-tools": ">=0.2.0-rc.2 <0.2.1-0 || >=0.2.1-alpha.1 <0.3.0-0"
27
28
  },
28
29
  "devDependencies": {
30
+ "@deepseek-ai/cordis": "4.0.4",
29
31
  "typescript": "^5.0.0"
30
32
  },
31
33
  "scripts": {