@liangjiehappy/dsh-deepseekbase 0.1.1 → 0.2.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/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # @liangjiehappy/dsh-deepseekbase
1
+ # dsh-deepseekbase
2
2
 
3
3
  English | [中文](README.zh.md)
4
4
 
@@ -72,7 +72,7 @@ Restart Harness. Four tools become available.
72
72
  From npm (once published):
73
73
 
74
74
  ```bash
75
- dsh plugin --profile web add @liangjiehappy/dsh-deepseekbase
75
+ dsh plugin --profile web add dsh-deepseekbase
76
76
  ```
77
77
 
78
78
  ---
package/README.zh.md CHANGED
@@ -1,4 +1,4 @@
1
- # @liangjiehappy/dsh-deepseekbase
1
+ # dsh-deepseekbase
2
2
 
3
3
  [English](README.md) | 中文
4
4
 
@@ -72,7 +72,7 @@ dsh plugin --profile web add github:moldkey/dsh-deepseekbase
72
72
  從 npm 安裝(發布後):
73
73
 
74
74
  ```bash
75
- dsh plugin --profile web add @liangjiehappy/dsh-deepseekbase
75
+ dsh plugin --profile web add dsh-deepseekbase
76
76
  ```
77
77
 
78
78
  ---
package/cordis.patch.yml CHANGED
@@ -3,4 +3,4 @@
3
3
  # overrides, disables, and insert lists; `!!js` expressions allowed).
4
4
  - insert:
5
5
  - id: dsh-deepseekbase
6
- name: '@liangjiehappy/dsh-deepseekbase'
6
+ name: "@liangjiehappy/dsh-deepseekbase"
package/lib/index.js CHANGED
@@ -83,10 +83,229 @@ export function apply(ctx) {
83
83
  order: 120,
84
84
  text:
85
85
  "Use the deepseekbase_* tools for DeepSeek pricing, plugin discovery with sandbox " +
86
- "test results, model specs and token-volume trends. Data is a third-party index " +
86
+ "test results, model specs and token-volume trends. Also use " +
87
+ "deepseekbase_test_plugin to submit a plugin for a real sandbox install test and " +
88
+ "deepseekbase_test_result to read the verdict. Data is a third-party index " +
87
89
  "(deepseekbase.com), not official DeepSeek output — cite it as such.",
88
90
  });
89
91
 
92
+ // ── TESTING HELPERS ──────────────────────────────────────────────────────
93
+ const BASE = "https://deepseekbase.com";
94
+ const VERSIONS = ["0.2.2-rc.1", "0.2.2-alpha.3", "0.2.1-rc.5", "0.2.1-rc.4", "0.1.1-rc.2"];
95
+
96
+ async function jfetch(url, opts, signal) {
97
+ const controller = new AbortController();
98
+ const timer = setTimeout(() => controller.abort(), 20000);
99
+ if (signal) {
100
+ if (signal.aborted) controller.abort();
101
+ else signal.addEventListener("abort", () => controller.abort(), { once: true });
102
+ }
103
+ try {
104
+ const res = await fetch(url, Object.assign({ signal: controller.signal }, opts || {}));
105
+ const text = await res.text();
106
+ let body = null;
107
+ try { body = JSON.parse(text); } catch { body = null; }
108
+ return { status: res.status, body, text };
109
+ } finally {
110
+ clearTimeout(timer);
111
+ }
112
+ }
113
+
114
+ function verdictLabel(v, zh) {
115
+ const m = {
116
+ pass: ["已测通过", "tested: pass"],
117
+ install_failed: ["装不上", "install fails"],
118
+ config_failed: ["挂载失败", "mount fails"],
119
+ installs_but_not_registered: ["装了没注册", "mounts, not registered"],
120
+ boot_failed: ["启动失败", "boot fails"],
121
+ error: ["执行出错", "runner error"],
122
+ };
123
+ const x = m[v] || [v, v];
124
+ return zh ? x[0] : x[1];
125
+ }
126
+
127
+ function renderTestResult(r, zh) {
128
+ const lines = [];
129
+ lines.push(`plugin: ${r.plugin}`);
130
+ lines.push(`verdict: ${verdictLabel(r.verdict, zh)} (${r.verdict})`);
131
+ if (r.dsh_version) lines.push(`dsh_version: ${r.dsh_version}`);
132
+ if (r.tested_at) lines.push(`tested_at: ${r.tested_at}`);
133
+ if (r.install_ok !== undefined && r.install_ok !== null) lines.push(`install_ok: ${r.install_ok}`);
134
+ if (r.node_modules_mb != null) lines.push(`node_modules: ${r.node_modules_mb} MB`);
135
+ if (r.install_sec != null) lines.push(`install_time: ${r.install_sec}s`);
136
+ if (r.error) lines.push(`first_error: ${r.error}`);
137
+ lines.push("");
138
+ lines.push(`Details: ${BASE}/plugins/${r.slug || ""}`);
139
+ return lines.join("\n");
140
+ }
141
+
142
+ // ── 5. Submit a plugin for testing ───────────────────────────────────────
143
+ ctx.tools.register(
144
+ defineTool({
145
+ name: "deepseekbase_test_plugin",
146
+ description:
147
+ "Submit a DSH plugin to deepseekbase's sandbox for a real four-stage install test " +
148
+ "(install → list → mount → boot). Free tier: 3 tests per IP per day. Returns a queue id " +
149
+ "and the remaining quota. Use when the user asks to test whether their plugin installs. " +
150
+ "After the run finishes, call deepseekbase_test_result to read the verdict.",
151
+ parameters: {
152
+ plugin: {
153
+ type: "string",
154
+ required: true,
155
+ description:
156
+ "npm package name (e.g. dsh-pet, @scope/name) or github:owner/repo.",
157
+ },
158
+ dsh_version: {
159
+ type: "string",
160
+ description:
161
+ "DSH version to test on. Defaults to 0.2.2-rc.1. Allowed: " +
162
+ VERSIONS.join(", "),
163
+ },
164
+ note: {
165
+ type: "string",
166
+ description: "Optional note (max 300 chars), e.g. what you installed alongside.",
167
+ },
168
+ },
169
+ output: TEXT_OUTPUT,
170
+ isConcurrencySafe: () => false,
171
+ async execute(args, exec) {
172
+ const ver = (args.dsh_version || "0.2.2-rc.1").trim();
173
+ if (!VERSIONS.includes(ver)) {
174
+ return {
175
+ text:
176
+ `Unsupported dsh_version "${ver}". Allowed: ${VERSIONS.join(", ")}.`,
177
+ };
178
+ }
179
+ const r = await jfetch(
180
+ BASE + "/test/submit",
181
+ {
182
+ method: "POST",
183
+ headers: { "Content-Type": "application/json" },
184
+ body: JSON.stringify({
185
+ plugin: (args.plugin || "").trim(),
186
+ dsh_version: ver,
187
+ note: (args.note || "").slice(0, 300),
188
+ }),
189
+ },
190
+ exec && exec.signal,
191
+ );
192
+ if (r.status === 200 && r.body && r.body.ok) {
193
+ return {
194
+ text:
195
+ `Queued.\n` +
196
+ `id: ${r.body.id}\n` +
197
+ `plugin: ${args.plugin}\n` +
198
+ `dsh_version: ${ver}\n` +
199
+ `free tier left today: ${r.body.left_today}/${r.body.free_tier_per_day}\n\n` +
200
+ `It usually runs within a few minutes. ` +
201
+ `Call deepseekbase_test_result with plugin="${args.plugin}" to read the verdict.`,
202
+ };
203
+ }
204
+ if (r.status === 429) {
205
+ const b = r.body || {};
206
+ return {
207
+ text:
208
+ `Daily free quota used up (${b.used_today || 3}/3 tests today).\n` +
209
+ `Resets in about ${Math.round((b.resets_in_seconds || 0) / 3600)}h.\n` +
210
+ `Higher quotas: ${BASE}/plugin-pricing/`,
211
+ };
212
+ }
213
+ if (r.status === 400 && r.body) {
214
+ if (r.body.error === "unsupported dsh_version") {
215
+ return { text: `Unsupported version. Allowed: ${(r.body.allowed || []).join(", ")}` };
216
+ }
217
+ return {
218
+ text:
219
+ `Rejected: ${r.body.error || "invalid request"}. ` +
220
+ `Use an npm package name (dsh-pet) or github:owner/repo.`,
221
+ };
222
+ }
223
+ return { text: `Submit failed (HTTP ${r.status}). ${r.text.slice(0, 200)}` };
224
+ },
225
+ }),
226
+ );
227
+
228
+ // ── 6. Read a test result ────────────────────────────────────────────────
229
+ ctx.tools.register(
230
+ defineTool({
231
+ name: "deepseekbase_test_result",
232
+ description:
233
+ "Read the sandbox test verdict for a plugin on deepseekbase: four stages " +
234
+ "(install / list / mount / boot), node_modules size, install time and the first error " +
235
+ "if it failed. Works for any plugin we have tested (3,400+ so far), not only the ones " +
236
+ "you submitted.",
237
+ parameters: {
238
+ plugin: {
239
+ type: "string",
240
+ required: true,
241
+ description: "npm package name or github:owner/repo to look up.",
242
+ },
243
+ },
244
+ output: TEXT_OUTPUT,
245
+ isConcurrencySafe: () => true,
246
+ async execute(args, exec) {
247
+ const wanted = (args.plugin || "").trim().toLowerCase();
248
+ if (!wanted) return { text: "plugin is required." };
249
+ const [all, slugs, queue] = await Promise.all([
250
+ jfetch(BASE + "/data/plugin-tests-all.json", {}, exec && exec.signal),
251
+ jfetch(BASE + "/data/plugin-slugs.json", {}, exec && exec.signal),
252
+ jfetch(BASE + "/data/test-queue.json", {}, exec && exec.signal),
253
+ ]);
254
+ const slugMap = (slugs.body && typeof slugs.body === "object") ? slugs.body : {};
255
+ const rows = (all.body && all.body.results) || [];
256
+ const hit = rows.find((r) => String(r.plugin || "").toLowerCase() === wanted);
257
+ if (hit) {
258
+ const out = Object.assign({}, hit, { slug: slugMap[hit.plugin] || "" });
259
+ return { text: renderTestResult(out, false) };
260
+ }
261
+ const qi = (queue.body && queue.body.items) || [];
262
+ const pend = qi.find(
263
+ (x) => String(x.plugin || "").toLowerCase() === wanted && x.status === "queued",
264
+ );
265
+ if (pend) {
266
+ return {
267
+ text:
268
+ `plugin: ${pend.plugin}\nstatus: queued (submitted ${pend.queued_at})\n` +
269
+ `Not tested yet — it is in the queue. Try again shortly.`,
270
+ };
271
+ }
272
+ return {
273
+ text:
274
+ `No test result for "${args.plugin}" yet.\n` +
275
+ `Submit one with deepseekbase_test_plugin, or browse ${rows.length} existing ` +
276
+ `results at ${BASE}/ecosystem/plugin-tests/`,
277
+ };
278
+ },
279
+ }),
280
+ );
281
+
282
+ // ── 7. Remaining free quota ──────────────────────────────────────────────
283
+ ctx.tools.register(
284
+ defineTool({
285
+ name: "deepseekbase_quota",
286
+ description:
287
+ "Check the caller's remaining free sandbox-test quota for today " +
288
+ "(free tier: 3 tests per IP per day).",
289
+ parameters: {},
290
+ output: TEXT_OUTPUT,
291
+ isConcurrencySafe: () => true,
292
+ async execute(_args, exec) {
293
+ const r = await jfetch(BASE + "/test/quota", {}, exec && exec.signal);
294
+ if (r.status !== 200 || !r.body) {
295
+ return { text: `Could not read quota (HTTP ${r.status}).` };
296
+ }
297
+ const b = r.body;
298
+ return {
299
+ text:
300
+ `free tier: ${b.free_tier_per_day} tests per IP per day\n` +
301
+ `used today: ${b.used_today}\n` +
302
+ `left today: ${b.left_today}\n` +
303
+ `resets in: ${Math.round((b.resets_in_seconds || 0) / 60)} min`,
304
+ };
305
+ },
306
+ }),
307
+ );
308
+
90
309
  // ── 1. Prices ────────────────────────────────────────────────────────────
91
310
  ctx.tools.register(
92
311
  defineTool({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@liangjiehappy/dsh-deepseekbase",
3
- "version": "0.1.1",
3
+ "version": "0.2.1",
4
4
  "description": "DeepSeek prices, plugins with sandbox test results, model specs and token trends inside DeepSeek Harness — powered by deepseekbase.com",
5
5
  "keywords": [
6
6
  "deepseek-harness",
@@ -58,8 +58,5 @@
58
58
  "@deepseek-ai/dsh-tools": {
59
59
  "optional": true
60
60
  }
61
- },
62
- "publishConfig": {
63
- "access": "public"
64
61
  }
65
62
  }