@max-null/dsh-plugin-center 0.2.2 → 0.2.3
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/client.js +1 -5
- package/dist/engine.d.ts +8 -3
- package/dist/engine.js +41 -13
- package/dist/market.js +4 -1
- package/package.json +2 -2
package/client.js
CHANGED
|
@@ -1089,11 +1089,7 @@ function CenterPanel({ variant = "section" }) {
|
|
|
1089
1089
|
}, children: [
|
|
1090
1090
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "awesome", children: "awesome-dsh-plugin" }),
|
|
1091
1091
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "oh-my-dsh", children: "Oh-My-DSH" }),
|
|
1092
|
-
/* @__PURE__ */ (0, import_jsx_runtime.
|
|
1093
|
-
"dsh-market\uFF08",
|
|
1094
|
-
counts.dshMarket,
|
|
1095
|
-
"\uFF09"
|
|
1096
|
-
] }),
|
|
1092
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "dsh-market", children: "dsh-market" }),
|
|
1097
1093
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "all", children: t("allMarkets") })
|
|
1098
1094
|
] }),
|
|
1099
1095
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "pc-spacer" }),
|
package/dist/engine.d.ts
CHANGED
|
@@ -45,12 +45,17 @@ export declare class PluginCenterEngine extends Service {
|
|
|
45
45
|
private awesomeCache;
|
|
46
46
|
private awesomeDone;
|
|
47
47
|
private awesomeFetching;
|
|
48
|
+
/** 上次 fetch 失败时刻(0=未失败过):失败后冷却 60s 再重试,
|
|
49
|
+
* 防止瞬时网络故障让源永久失效(2026-08-22 dsh-market(0)实测)。 */
|
|
50
|
+
private awesomeFailedAt;
|
|
48
51
|
private ohMyDshCache;
|
|
49
52
|
private ohMyDshDone;
|
|
50
53
|
private ohMyDshFetching;
|
|
54
|
+
private ohMyDshFailedAt;
|
|
51
55
|
private dshMarketCache;
|
|
52
56
|
private dshMarketDone;
|
|
53
57
|
private dshMarketFetching;
|
|
58
|
+
private dshMarketFailedAt;
|
|
54
59
|
/** README-extracted screenshot URL per plugin name (lazy, P2). */
|
|
55
60
|
private readonly screenshotCache;
|
|
56
61
|
private installedNamesCache;
|
|
@@ -74,15 +79,15 @@ export declare class PluginCenterEngine extends Service {
|
|
|
74
79
|
dshVersion(): Promise<string>;
|
|
75
80
|
/** Non-group Loader entries, cross-matched with market categories. */
|
|
76
81
|
listInstalled(): Promise<InstalledPlugin[]>;
|
|
77
|
-
/** Start the awesome catalog fetch
|
|
82
|
+
/** Start the awesome catalog fetch (with failed-retry cooldown). */
|
|
78
83
|
private prefetchAwesome;
|
|
79
84
|
/** Backfill npm latest versions into the awesome cache (best-effort, concurrent). */
|
|
80
85
|
private fillNpmVersions;
|
|
81
86
|
/** Single-registry latest version for the market bulk backfill (npmmirror is fast). */
|
|
82
87
|
private fastNpmVersion;
|
|
83
|
-
/** Start the Oh-My-DSH fetch
|
|
88
|
+
/** Start the Oh-My-DSH fetch (single PLUGINS.md parse, with failed-retry cooldown). */
|
|
84
89
|
private prefetchOhMyDsh;
|
|
85
|
-
/** Start the dsh-market fetch
|
|
90
|
+
/** Start the dsh-market fetch (2BingLing/dsh-market, ~3900 plugins, trimmed, with failed-retry cooldown). */
|
|
86
91
|
private prefetchDshMarket;
|
|
87
92
|
/** Installed plugin names (no file IO) — cached so market polling stays cheap. */
|
|
88
93
|
private installedNames;
|
package/dist/engine.js
CHANGED
|
@@ -63,12 +63,17 @@ export class PluginCenterEngine extends Service {
|
|
|
63
63
|
awesomeCache = [];
|
|
64
64
|
awesomeDone = false;
|
|
65
65
|
awesomeFetching = false;
|
|
66
|
+
/** 上次 fetch 失败时刻(0=未失败过):失败后冷却 60s 再重试,
|
|
67
|
+
* 防止瞬时网络故障让源永久失效(2026-08-22 dsh-market(0)实测)。 */
|
|
68
|
+
awesomeFailedAt = 0;
|
|
66
69
|
ohMyDshCache = [];
|
|
67
70
|
ohMyDshDone = false;
|
|
68
71
|
ohMyDshFetching = false;
|
|
72
|
+
ohMyDshFailedAt = 0;
|
|
69
73
|
dshMarketCache = [];
|
|
70
74
|
dshMarketDone = false;
|
|
71
75
|
dshMarketFetching = false;
|
|
76
|
+
dshMarketFailedAt = 0;
|
|
72
77
|
/** README-extracted screenshot URL per plugin name (lazy, P2). */
|
|
73
78
|
screenshotCache = new Map();
|
|
74
79
|
installedNamesCache = null;
|
|
@@ -156,11 +161,16 @@ export class PluginCenterEngine extends Service {
|
|
|
156
161
|
.map(p => ({ ...p, categories: categoryByName.get(p.name) ?? [] }))
|
|
157
162
|
.sort((a, b) => SOURCE_ORDER[a.source] - SOURCE_ORDER[b.source]);
|
|
158
163
|
}
|
|
159
|
-
/** Start the awesome catalog fetch
|
|
164
|
+
/** Start the awesome catalog fetch (with failed-retry cooldown). */
|
|
160
165
|
prefetchAwesome() {
|
|
161
|
-
if (this.awesomeFetching
|
|
166
|
+
if (this.awesomeFetching)
|
|
167
|
+
return;
|
|
168
|
+
if (this.awesomeDone && this.awesomeCache.length > 0)
|
|
169
|
+
return;
|
|
170
|
+
if (this.awesomeDone && Date.now() - this.awesomeFailedAt < 60_000)
|
|
162
171
|
return;
|
|
163
172
|
this.awesomeFetching = true;
|
|
173
|
+
this.awesomeDone = false;
|
|
164
174
|
void (async () => {
|
|
165
175
|
try {
|
|
166
176
|
const [plugins, overrides] = await Promise.all([fetchAwesomePluginsJson(), fetchOhMyDshOverrides()]);
|
|
@@ -173,7 +183,9 @@ export class PluginCenterEngine extends Service {
|
|
|
173
183
|
this.awesomeCache = merged;
|
|
174
184
|
await this.fillNpmVersions();
|
|
175
185
|
}
|
|
176
|
-
catch {
|
|
186
|
+
catch {
|
|
187
|
+
this.awesomeFailedAt = Date.now();
|
|
188
|
+
}
|
|
177
189
|
this.awesomeDone = true;
|
|
178
190
|
this.awesomeFetching = false;
|
|
179
191
|
})();
|
|
@@ -206,30 +218,44 @@ export class PluginCenterEngine extends Service {
|
|
|
206
218
|
return null;
|
|
207
219
|
}
|
|
208
220
|
}
|
|
209
|
-
/** Start the Oh-My-DSH fetch
|
|
221
|
+
/** Start the Oh-My-DSH fetch (single PLUGINS.md parse, with failed-retry cooldown). */
|
|
210
222
|
prefetchOhMyDsh() {
|
|
211
|
-
if (this.ohMyDshFetching
|
|
223
|
+
if (this.ohMyDshFetching)
|
|
224
|
+
return;
|
|
225
|
+
if (this.ohMyDshDone && this.ohMyDshCache.length > 0)
|
|
226
|
+
return;
|
|
227
|
+
if (this.ohMyDshDone && Date.now() - this.ohMyDshFailedAt < 60_000)
|
|
212
228
|
return;
|
|
213
229
|
this.ohMyDshFetching = true;
|
|
230
|
+
this.ohMyDshDone = false;
|
|
214
231
|
void (async () => {
|
|
215
232
|
try {
|
|
216
233
|
this.ohMyDshCache = mergePlugins([await fetchOhMyDshPlugins()]);
|
|
217
234
|
}
|
|
218
|
-
catch {
|
|
235
|
+
catch {
|
|
236
|
+
this.ohMyDshFailedAt = Date.now();
|
|
237
|
+
}
|
|
219
238
|
this.ohMyDshDone = true;
|
|
220
239
|
this.ohMyDshFetching = false;
|
|
221
240
|
})();
|
|
222
241
|
}
|
|
223
|
-
/** Start the dsh-market fetch
|
|
242
|
+
/** Start the dsh-market fetch (2BingLing/dsh-market, ~3900 plugins, trimmed, with failed-retry cooldown). */
|
|
224
243
|
prefetchDshMarket() {
|
|
225
|
-
if (this.dshMarketFetching
|
|
244
|
+
if (this.dshMarketFetching)
|
|
245
|
+
return;
|
|
246
|
+
if (this.dshMarketDone && this.dshMarketCache.length > 0)
|
|
247
|
+
return;
|
|
248
|
+
if (this.dshMarketDone && Date.now() - this.dshMarketFailedAt < 60_000)
|
|
226
249
|
return;
|
|
227
250
|
this.dshMarketFetching = true;
|
|
251
|
+
this.dshMarketDone = false;
|
|
228
252
|
void (async () => {
|
|
229
253
|
try {
|
|
230
254
|
this.dshMarketCache = mergePlugins([await fetchDshMarketPlugins()]);
|
|
231
255
|
}
|
|
232
|
-
catch {
|
|
256
|
+
catch {
|
|
257
|
+
this.dshMarketFailedAt = Date.now();
|
|
258
|
+
}
|
|
233
259
|
this.dshMarketDone = true;
|
|
234
260
|
this.dshMarketFetching = false;
|
|
235
261
|
})();
|
|
@@ -252,18 +278,18 @@ export class PluginCenterEngine extends Service {
|
|
|
252
278
|
const decorate = (plugins) => plugins.map(p => ({ ...p, installed: installedNames.has(p.name) || installedNames.has(p.spec) }));
|
|
253
279
|
if (source === 'awesome') {
|
|
254
280
|
this.prefetchAwesome();
|
|
255
|
-
return { plugins: decorate(this.awesomeCache), done: this.awesomeDone };
|
|
281
|
+
return { plugins: decorate(this.awesomeCache), done: this.awesomeDone && this.awesomeCache.length > 0 };
|
|
256
282
|
}
|
|
257
283
|
if (source === 'oh-my-dsh') {
|
|
258
284
|
this.prefetchOhMyDsh();
|
|
259
|
-
return { plugins: decorate(this.ohMyDshCache), done: this.ohMyDshDone };
|
|
285
|
+
return { plugins: decorate(this.ohMyDshCache), done: this.ohMyDshDone && this.ohMyDshCache.length > 0 };
|
|
260
286
|
}
|
|
261
287
|
if (source === 'dsh-market') {
|
|
262
288
|
this.prefetchDshMarket();
|
|
263
289
|
// Score-first order (best first) so the big catalog reads usefully.
|
|
264
290
|
return {
|
|
265
291
|
plugins: decorate(this.dshMarketCache).sort((a, b) => (b.score?.total ?? 0) - (a.score?.total ?? 0)),
|
|
266
|
-
done: this.dshMarketDone,
|
|
292
|
+
done: this.dshMarketDone && this.dshMarketCache.length > 0,
|
|
267
293
|
};
|
|
268
294
|
}
|
|
269
295
|
this.prefetchAwesome();
|
|
@@ -271,7 +297,9 @@ export class PluginCenterEngine extends Service {
|
|
|
271
297
|
this.prefetchDshMarket();
|
|
272
298
|
return {
|
|
273
299
|
plugins: decorate(mergePlugins([this.awesomeCache, this.ohMyDshCache, this.dshMarketCache])),
|
|
274
|
-
done: this.awesomeDone && this.
|
|
300
|
+
done: (this.awesomeDone && this.awesomeCache.length > 0)
|
|
301
|
+
&& (this.ohMyDshDone && this.ohMyDshCache.length > 0)
|
|
302
|
+
&& (this.dshMarketDone && this.dshMarketCache.length > 0),
|
|
275
303
|
};
|
|
276
304
|
}
|
|
277
305
|
/** Detect updates for every installed third-party/local plugin, TTL-cached. */
|
package/dist/market.js
CHANGED
|
@@ -108,9 +108,12 @@ function categorizeTags(tags) {
|
|
|
108
108
|
* file is ~10 MB, so the trimmed result (~1.5 MB) is what the engine caches.
|
|
109
109
|
*/
|
|
110
110
|
export async function fetchDshMarketPlugins() {
|
|
111
|
+
// 10MB 聚合文件 + raw.githubusercontent 不稳定:60s 曾实测超时失败
|
|
112
|
+
// (2026-08-22 用户看到 dsh-market(0)——失败后无重试,永远空),
|
|
113
|
+
// 超时放宽到 120s。
|
|
111
114
|
const res = await fetch('https://raw.githubusercontent.com/2BingLing/dsh-market/master/data/plugins.json', {
|
|
112
115
|
headers: UA,
|
|
113
|
-
signal: AbortSignal.timeout(
|
|
116
|
+
signal: AbortSignal.timeout(120000),
|
|
114
117
|
});
|
|
115
118
|
if (!res.ok)
|
|
116
119
|
throw new Error(`dsh-market plugins.json: HTTP ${res.status}`);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@max-null/dsh-plugin-center",
|
|
3
|
-
"version": "0.2.
|
|
4
|
-
"description": "Plugin center for DeepSeek Harness
|
|
3
|
+
"version": "0.2.3",
|
|
4
|
+
"description": "Plugin center for DeepSeek Harness 閳?installed metadata, community market, update detection, and What\u0027s New",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|