dshmarket 1.73.7 → 1.73.8

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
@@ -143,6 +143,8 @@ Installs prefer repo-verified npm packages, then author-supplied prebuilt GitHub
143
143
 
144
144
  ## Data source
145
145
 
146
+ Catalog statistics preserve their source: npm counts cover the stated 30-day window; GitHub-only releases can show lifetime downloads of all public repository Release assets, including packages, checksums and companion files. The counts are never added together or called installations/users. Tooltips include the available collection time; npm-download sorting keeps its existing window. Catalog host declarations are accepted only for the exact pinned install URL, with the existing on-demand manifest lookup retained for older catalogs.
147
+
146
148
  Fetched live on every open from [awesome-dsh-plugin.com/plugins.json](https://awesome-dsh-plugin.com/plugins.json) — curated entries, npm mapping, and star counts refreshed daily by CI, with no stale cache behind it. A failure reports the actual reason and elapsed time, with a Retry button.
147
149
 
148
150
  There is deliberately no bundled snapshot to fall back on: for a catalog that grows daily, a stale answer is not a degraded one but a wrong one — a plugin published this morning would read as "does not exist".
package/README.zh.md CHANGED
@@ -133,6 +133,8 @@ profile,因此不会出现在桌面端。请通过应用内的 **设置 →
133
133
 
134
134
  ## 数据源
135
135
 
136
+ 目录统计保留来源与口径:npm 显示注明日期范围的近 30 天下载量;仅通过 GitHub 发行的插件可显示仓库所有公开发行附件的累计下载量,包括安装包、校验和配套文件。两者不会相加,也不表示安装次数或用户数。提示中保留可用的采集时间,npm 下载排序仍使用原有时间窗口。目录提供的宿主声明仅用于完全匹配的固定安装地址,旧目录继续按需读取包清单。
137
+
136
138
  每次打开都实时请求 [awesome-dsh-plugin.com/plugins.json](https://awesome-dsh-plugin.com/plugins.json)——精选条目、npm 映射、star 数由 CI 每日刷新,不使用过期缓存兜底;连不上时会给出具体原因和耗时,并提供「重试」按钮。
137
139
 
138
140
  刻意不做本地快照兜底:目录每天都在增长,过期的答案不是「差一点」而是「错的」——今早刚发布的插件会显示成「不存在」。
package/client/client.js CHANGED
@@ -577,11 +577,14 @@ window.__ModuleLoader__.load({ id: "dshmarket", factory: (require) => {
577
577
  sortDownloads: "npm 下载量(近 30 天)",
578
578
  downloadsPeriod: "近30天",
579
579
  downloadsMeaning: "近 30 天 npm 下载:{0}",
580
+ githubReleaseDownloadsMeaning: "GitHub 发行附件累计下载:{0}(包括安装包、校验和配套文件)",
581
+ starsMeaning: "GitHub Star:{0}",
582
+ statisticCheckedAt: ";采集于 {0}",
580
583
  downloadsWindow: "({0} 至 {1})",
581
584
  /** Discover/theme card byline tooltip for catalog `version`. */
582
585
  catalogNpmLatest: "npm 当前 latest",
583
- catalogVersionDated: "目录({0} 刷新)记录的 npm 版本;之后发布的版本要等下次刷新才会出现",
584
- catalogVersionUndated: "目录记录的 npm 版本;目录每日刷新,可能滞后于 npm 上的实际 latest",
586
+ catalogVersionDated: "目录({0} 更新)记录的安装版本;新发行需等待目录更新",
587
+ catalogVersionUndated: "目录记录的安装版本;可能滞后于项目的新发行",
585
588
  sortStars: "Star 数",
586
589
  sortAdded: "收录时间",
587
590
  recentlyAdded: "最近收录",
@@ -1359,11 +1362,14 @@ window.__ModuleLoader__.load({ id: "dshmarket", factory: (require) => {
1359
1362
  sortDownloads: "npm downloads (30d)",
1360
1363
  downloadsPeriod: "30d",
1361
1364
  downloadsMeaning: "Last 30 days on npm: {0}",
1365
+ githubReleaseDownloadsMeaning: "GitHub Release asset downloads, all time: {0} (packages, checksums and companion files)",
1366
+ starsMeaning: "GitHub stars: {0}",
1367
+ statisticCheckedAt: "; checked {0}",
1362
1368
  downloadsWindow: " ({0} – {1})",
1363
1369
  /** Discover/theme card byline tooltip for catalog `version`. */
1364
1370
  catalogNpmLatest: "npm latest",
1365
- catalogVersionDated: "the npm version as of the catalog's last refresh ({0}); a release published since then appears after the next refresh",
1366
- catalogVersionUndated: "the npm version as of the catalog's last refresh — the catalog updates daily, so this can lag npm's actual latest",
1371
+ catalogVersionDated: "the installable version as of the catalog's last refresh ({0}); a release published since then appears after the next refresh",
1372
+ catalogVersionUndated: "the installable version as of the catalog's last refresh — the catalog updates daily, so newer project releases may not appear yet",
1367
1373
  sortStars: "Stars",
1368
1374
  sortAdded: "Date added",
1369
1375
  recentlyAdded: "Recently added",
@@ -2141,10 +2147,13 @@ window.__ModuleLoader__.load({ id: "dshmarket", factory: (require) => {
2141
2147
  sortDownloads: "npm ダウンロード数(直近 30 日)",
2142
2148
  downloadsPeriod: "30日",
2143
2149
  downloadsMeaning: "直近 30 日の npm ダウンロード:{0}",
2150
+ githubReleaseDownloadsMeaning: "GitHub Release 添付ファイルの累計ダウンロード:{0}(パッケージ、チェックサム、関連ファイルを含む)",
2151
+ starsMeaning: "GitHub Star:{0}",
2152
+ statisticCheckedAt: ";取得日時 {0}",
2144
2153
  downloadsWindow: "({0} ~ {1})",
2145
2154
  catalogNpmLatest: "npm の現在の latest",
2146
- catalogVersionDated: "カタログの前回更新({0})時点の npm バージョンです。それ以降に公開されたバージョンは、次回の更新後に現れます",
2147
- catalogVersionUndated: "カタログに記録された npm バージョンです。カタログは毎日更新されるため、npm の実際の latest より遅れていることがあります",
2155
+ catalogVersionDated: "カタログ({0} 更新)に記録されたインストール用バージョンです。新しいリリースはカタログ更新後に表示されます",
2156
+ catalogVersionUndated: "カタログに記録されたインストール用バージョンです。新しいリリースがまだ反映されていない場合があります",
2148
2157
  sortStars: "スター数",
2149
2158
  sortAdded: "収録日時",
2150
2159
  recentlyAdded: "最近の収録",
@@ -4873,6 +4882,29 @@ window.__ModuleLoader__.load({ id: "dshmarket", factory: (require) => {
4873
4882
  }
4874
4883
  //#endregion
4875
4884
  //#region src/client/download-stats.ts
4885
+ const validCount = (value) => typeof value === "number" && Number.isSafeInteger(value) && value >= 0;
4886
+ /** Keep the established npm window first; the two sources are never added together. */
4887
+ function downloadStatistic(plugin) {
4888
+ if (validCount(plugin.downloads)) return {
4889
+ count: plugin.downloads,
4890
+ source: "npm"
4891
+ };
4892
+ if (validCount(plugin.githubReleaseDownloads)) return {
4893
+ count: plugin.githubReleaseDownloads,
4894
+ source: "github"
4895
+ };
4896
+ return null;
4897
+ }
4898
+ function checkedAt(value, t) {
4899
+ if (dateOnly(value)) return t("statisticCheckedAt").replace("{0}", value);
4900
+ if (typeof value !== "string" || !/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/.test(value)) return "";
4901
+ const date = new Date(value);
4902
+ if (!Number.isFinite(date.getTime()) || date.toISOString() !== value) return "";
4903
+ return t("statisticCheckedAt").replace("{0}", value.slice(0, 16).replace("T", " ") + " UTC");
4904
+ }
4905
+ function starStatsText(plugin, t) {
4906
+ return validCount(plugin.stars) ? t("starsMeaning").replace("{0}", String(plugin.stars)) + checkedAt(plugin.starsCheckedAt, t) : null;
4907
+ }
4876
4908
  /** Date-only values stay date-only; never derive a window from today's date. */
4877
4909
  function dateOnly(value) {
4878
4910
  if (typeof value !== "string" || !/^\d{4}-\d{2}-\d{2}$/.test(value)) return false;
@@ -4881,8 +4913,10 @@ window.__ModuleLoader__.load({ id: "dshmarket", factory: (require) => {
4881
4913
  }
4882
4914
  /** Exact count and, when the catalog sent one, the 30-day window. */
4883
4915
  function downloadStatsText(plugin, t) {
4884
- const count = plugin.downloads;
4885
- if (typeof count !== "number" || !Number.isSafeInteger(count) || count < 0) return null;
4916
+ const statistic = downloadStatistic(plugin);
4917
+ if (statistic === null) return null;
4918
+ const { count, source } = statistic;
4919
+ if (source === "github") return t("githubReleaseDownloadsMeaning").replace("{0}", String(count)) + checkedAt(plugin.githubReleaseDownloadsCheckedAt, t);
4886
4920
  const meaning = t("downloadsMeaning").replace("{0}", String(count));
4887
4921
  if (!(dateOnly(plugin.downloadsStart) && dateOnly(plugin.downloadsEnd) && plugin.downloadsStart <= plugin.downloadsEnd)) return meaning;
4888
4922
  return meaning + t("downloadsWindow").replace("{0}", plugin.downloadsStart).replace("{1}", plugin.downloadsEnd);
@@ -9051,9 +9085,23 @@ window.__ModuleLoader__.load({ id: "dshmarket", factory: (require) => {
9051
9085
  })
9052
9086
  });
9053
9087
  }
9054
- /** Compact abbreviated count; hover names the exact figure and the 30-day window. */
9088
+ /** Compact count; hover names the exact figure, source and reporting scope. */
9055
9089
  function DownloadCount({ plugin, t }) {
9056
9090
  const tip = downloadStatsText(plugin, t);
9091
+ const statistic = downloadStatistic(plugin);
9092
+ if (tip === null || statistic === null) return null;
9093
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CardTip, {
9094
+ label: tip,
9095
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
9096
+ className: Market_module_css_default.star,
9097
+ tabIndex: 0,
9098
+ "aria-label": tip,
9099
+ children: "· " + (statistic.source === "github" ? "GitHub " : "") + "↓ " + formatCount(statistic.count)
9100
+ })
9101
+ });
9102
+ }
9103
+ function StarCount({ plugin, t }) {
9104
+ const tip = starStatsText(plugin, t);
9057
9105
  if (tip === null) return null;
9058
9106
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CardTip, {
9059
9107
  label: tip,
@@ -9061,7 +9109,7 @@ window.__ModuleLoader__.load({ id: "dshmarket", factory: (require) => {
9061
9109
  className: Market_module_css_default.star,
9062
9110
  tabIndex: 0,
9063
9111
  "aria-label": tip,
9064
- children: "· ↓ " + formatCount(plugin.downloads)
9112
+ children: "· ★ " + formatCount(plugin.stars)
9065
9113
  })
9066
9114
  });
9067
9115
  }
@@ -13867,12 +13915,9 @@ window.__ModuleLoader__.load({ id: "dshmarket", factory: (require) => {
13867
13915
  plugin: p,
13868
13916
  t
13869
13917
  }),
13870
- typeof p.stars === "number" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CardTip, {
13871
- label: String(p.stars),
13872
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
13873
- className: Market_module_css_default.star,
13874
- children: "· ★ " + formatCount(p.stars)
13875
- })
13918
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StarCount, {
13919
+ plugin: p,
13920
+ t
13876
13921
  })
13877
13922
  ]
13878
13923
  })]
@@ -14021,12 +14066,9 @@ window.__ModuleLoader__.load({ id: "dshmarket", factory: (require) => {
14021
14066
  plugin: p,
14022
14067
  t
14023
14068
  }),
14024
- typeof p.stars === "number" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CardTip, {
14025
- label: String(p.stars),
14026
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
14027
- className: Market_module_css_default.star,
14028
- children: "· ★ " + formatCount(p.stars)
14029
- })
14069
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StarCount, {
14070
+ plugin: p,
14071
+ t
14030
14072
  })
14031
14073
  ]
14032
14074
  })]
@@ -16524,9 +16566,9 @@ window.__ModuleLoader__.load({ id: "dshmarket", factory: (require) => {
16524
16566
  plugin: confirming,
16525
16567
  t
16526
16568
  }),
16527
- typeof confirming.stars === "number" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
16528
- className: Market_module_css_default.star,
16529
- children: "· ★ " + formatCount(confirming.stars)
16569
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StarCount, {
16570
+ plugin: confirming,
16571
+ t
16530
16572
  }),
16531
16573
  confirming.added && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
16532
16574
  className: Market_module_css_default.star,
package/lib/backup.js CHANGED
@@ -16,7 +16,29 @@ export const BACKUP_FORMAT = 'dsh-profile-backup';
16
16
  export const MAX_BACKUP_BYTES = 2 * 1024 * 1024;
17
17
  const MAX_FILES = 256;
18
18
  const SKIP_NAMES = new Set(['node_modules', '.dsh-market', '.git', 'pnpm-lock.yaml']);
19
- const BACKUP_TOO_LARGE = `这个 profile 的配置超过 ${MAX_BACKUP_BYTES / (1024 * 1024)} MB,整份备份放不下。可以只导出选中的插件。 / this profile's configuration is larger than ${MAX_BACKUP_BYTES / (1024 * 1024)} MB, which is too much for one whole-profile backup. Export selected plugins instead.`;
19
+ /**
20
+ * Directories that are caches by name, wherever they sit.
21
+ *
22
+ * The market's own cache is `.dsh-market` (skipped above), but another
23
+ * component writes `<profile>/cache` — not hidden, so the dot rule below let
24
+ * it through and the whole thing was read as configuration. With a few
25
+ * multi-megabyte json files in there the profile could not be backed up at
26
+ * all, and the error blamed the profile's own configuration (#1064).
27
+ *
28
+ * Only the exporter skips these; `validatedBackup` still accepts a document
29
+ * that carries them, because backups written before this rule put them in.
30
+ */
31
+ const SKIP_DIRS = new Set(['cache']);
32
+ /**
33
+ * Said when the profile does not fit: the way out has to be one that works.
34
+ *
35
+ * The old sentence offered "只导出选中的插件" unconditionally, but that path
36
+ * walks the same profile once "包含配置文件" is ticked and fails with the
37
+ * same words (#1064) — so it now names the trap as well.
38
+ */
39
+ const EXPORT_SELECTED_ZH = '可以改成只导出选中的插件,并且别勾「包含配置文件」,那会撞同一个上限';
40
+ const EXPORT_SELECTED_EN = 'export selected plugins instead, and leave "Include config files" unticked — ticking it hits the same cap';
41
+ const BACKUP_TOO_LARGE = `这个 profile 的配置超过 ${MAX_BACKUP_BYTES / (1024 * 1024)} MB,整份备份放不下。${EXPORT_SELECTED_ZH}。 / this profile's configuration is larger than ${MAX_BACKUP_BYTES / (1024 * 1024)} MB, which is too much for one whole-profile backup; ${EXPORT_SELECTED_EN}.`;
20
42
  /** File names that routinely contain credentials (backup exports).
21
43
  * Values are never masked in place — the export is one-to-one for
22
44
  * faithful restores — but presence is surfaced by the UI warning. */
@@ -46,6 +68,9 @@ function profileFiles(root, dir = root) {
46
68
  // `.env` and `.npmrc` are real profile config.
47
69
  if (entry.isDirectory() && entry.name.startsWith('.'))
48
70
  continue;
71
+ // Same rule, one name the dot check cannot cover (#1064).
72
+ if (entry.isDirectory() && SKIP_DIRS.has(entry.name))
73
+ continue;
49
74
  const path = resolve(dir, entry.name);
50
75
  if (entry.isSymbolicLink())
51
76
  continue;
@@ -56,7 +81,7 @@ function profileFiles(root, dir = root) {
56
81
  // Told in the user's words, with the way out: this is the cap a heavy
57
82
  // profile actually hits, and the per-plugin export is the answer.
58
83
  if (files.length > MAX_FILES) {
59
- throw new Error(`这个 profile 的配置文件超过 ${MAX_FILES} 个,整份备份放不下。可以只导出选中的插件。 / this profile has more than ${MAX_FILES} configuration files, which is too many for one whole-profile backup. Export selected plugins instead.`);
84
+ throw new Error(`这个 profile 的配置文件超过 ${MAX_FILES} 个,整份备份放不下。${EXPORT_SELECTED_ZH}。 / this profile has more than ${MAX_FILES} configuration files, which is too many for one whole-profile backup; ${EXPORT_SELECTED_EN}.`);
60
85
  }
61
86
  }
62
87
  return files;
@@ -22,6 +22,16 @@ const FETCH_TIMEOUT_MS = 8_000;
22
22
  const DEFAULT_CONCURRENCY = 8;
23
23
  const MAX_CACHE_ENTRIES = 5_000;
24
24
  const MAX_RANGE_LENGTH = 256;
25
+ /** Reuse catalog facts only for this repository's exact pinned install asset. */
26
+ export function catalogReleaseManifest(source) {
27
+ const facts = record(source.releaseManifest);
28
+ const repository = parseSourceUrl(source.url)?.repo;
29
+ const release = /^https:\/\/github\.com\/([^/]+\/[^/]+)\/releases\/download\/[^/]+\/[^/?#]+\.(?:tgz|tar\.gz)$/.exec(source.tarball ?? '');
30
+ if (facts === null || !repository || !release || release[1].toLowerCase() !== repository.toLowerCase()
31
+ || facts.tarball !== source.tarball || !validFacts(facts))
32
+ return null;
33
+ return { version: facts.version, enginesDsh: facts.enginesDsh, peerDependencies: facts.peerDependencies };
34
+ }
25
35
  /** Read the linked package at its selected release, never the repository root by accident. */
26
36
  async function githubManifest(source, fetcher) {
27
37
  const parsed = parseSourceUrl(source.url);
package/lib/index.js CHANGED
@@ -10,6 +10,7 @@ import { setRequestGateSource, setTrustedHostsSource } from './http.js';
10
10
  import { setLauncherInstallAnchorSource } from './dsh-install.js';
11
11
  import { mountMarketRoutes } from './routes.js';
12
12
  import { installDesktopMarketSettings, installMarketSettings } from './settings.js';
13
+ import { MAX_AUTO_REPAIR_ATTEMPTS } from './pending-updates.js';
13
14
  export const name = 'dsh-market';
14
15
  /**
15
16
  * How long after the market mounts an interrupted update is repaired.
@@ -282,7 +283,10 @@ export function apply(ctx, config) {
282
283
  void runtime.repairPendingUpdates().then(report => {
283
284
  if (report.reinstalled.length === 0 && report.failed.length === 0)
284
285
  return;
285
- console.warn(`dsh-market: ${report.reinstalled.length} interrupted update(s) reinstalled, ${report.failed.length} still pending`);
286
+ const abandoned = report.abandoned.length === 0
287
+ ? ''
288
+ : `, ${String(report.abandoned.length)} given up on after ${String(MAX_AUTO_REPAIR_ATTEMPTS)} starts — reinstall from Settings → Plugins: ${report.abandoned.join(', ')}`;
289
+ console.warn(`dsh-market: ${String(report.reinstalled.length)} interrupted update(s) reinstalled, ${String(report.failed.length)} still pending${abandoned}`);
286
290
  });
287
291
  }, PENDING_UPDATE_REPAIR_DELAY_MS);
288
292
  repairTimer.unref?.();
@@ -13,11 +13,29 @@ import { activeRegion, DEFAULT_NPM_REGISTRY, routesFor } from './regions.js';
13
13
  * resolve and the operation stays "updating" forever while holding the
14
14
  * profile's write lock. These deadlines cannot cancel the host, but they end
15
15
  * the market's wait, and the journal (`./pending-updates.ts`) makes the next
16
- * start finish the job. Removal is the short step (pnpm unlink + unload);
17
- * installation may legitimately download and build, so it gets the longer one.
16
+ * start finish the job.
17
+ *
18
+ * Both are the same length on purpose (#1057). Removal is short when pnpm
19
+ * only unlinks, but the host runs every command through the profile's
20
+ * supply-chain verification first, and that reaches the network: the reported
21
+ * update died at 90 s while pnpm was doing the right thing
22
+ * (`GET … UND_ERR_CONNECT_TIMEOUT. Will retry in 10 seconds. 2 retries left`),
23
+ * and the host's own manager then rewrote the manifest from its stale
24
+ * snapshot two minutes later. A deadline is here to end an infinite wait, not
25
+ * to race pnpm's retry budget — a transient that resolves by itself must not
26
+ * turn into a permanent failure.
18
27
  */
19
- const REMOVE_DEADLINE_MS = 90_000;
28
+ const REMOVE_DEADLINE_MS = 300_000;
20
29
  const INSTALL_DEADLINE_MS = 300_000;
30
+ /**
31
+ * The bound around a whole `add`, which may be an update and therefore holds
32
+ * two bounded phases in a row. It has to stay strictly longer than their sum:
33
+ * an outer bound equal to the inner one fires at the same instant and decides
34
+ * the answer instead — that is how a timeout stopped being reported as
35
+ * "the update did not finish" and started being reported as the plain
36
+ * operation refusal (#928's spec caught it).
37
+ */
38
+ const OPERATION_DEADLINE_MS = REMOVE_DEADLINE_MS + INSTALL_DEADLINE_MS;
21
39
  /**
22
40
  * What a user can actually do when the market cannot perform an operation on
23
41
  * the official Desktop profile: the app's own Plugins page runs the same
@@ -111,6 +129,14 @@ const REFUSAL_COPY = {
111
129
  zh: '这个版本与当前 DSH 不兼容,宿主拒绝安装',
112
130
  en: 'this version is not compatible with the running DSH, so the host refused it',
113
131
  },
132
+ // An ordinary install or uninstall that the manager never answered (#1066).
133
+ // Deliberately not `update-incomplete`: that sentence ("the plugin may
134
+ // already be removed while its replacement never installed") is about the
135
+ // remove-then-install pair and reads as nonsense on a plain uninstall.
136
+ 'operation-incomplete': {
137
+ zh: '桌面端没有在限定时间内答复这次操作:磁盘上可能已经改完了,市场只是没等到答复,所以没有回滚。重新打开 DSH 后市场会按磁盘状态核对;状态不对的话从「设置 → 插件」处理',
138
+ en: 'the desktop app did not answer this operation in time: the change may already be on disk, and the market got no reply, so it rolled nothing back. Reopen DSH and the market checks what is actually there; if it still looks wrong, use Settings → Plugins',
139
+ },
114
140
  'update-incomplete': {
115
141
  zh: '桌面端没有在限定时间内完成这次更新:插件可能已经被移除,新版本却还没装上。重新打开 DSH 后市场会自动补装;也可以现在从「设置 → 插件」重试',
116
142
  en: 'the desktop app did not finish this update in time: the plugin may already be removed while its replacement never installed. Reopen DSH and the market will finish the install, or retry from Settings → Plugins now',
@@ -455,9 +481,26 @@ packageManager) {
455
481
  // package: the journal must not put back what the user just removed.
456
482
  if (command === 'remove')
457
483
  updateContext?.journal.forget(profileName, target);
458
- operation = command === 'remove'
484
+ // The host's manager has no deadline of its own (#1066): a call that
485
+ // never settles held the profile's write lock and left the panel saying
486
+ // "working" forever, while its pnpm had in fact finished seconds later.
487
+ // The update path has had these deadlines for exactly that reason; an
488
+ // ordinary install or uninstall needs the same bound.
489
+ const deadline = command === 'remove' ? REMOVE_DEADLINE_MS : OPERATION_DEADLINE_MS;
490
+ operation = withDeadline(command === 'remove'
459
491
  ? manager.removeBundle(target)
460
- : installOrReinstall(manager, spec, options, updateContext);
492
+ : installOrReinstall(manager, spec, options, updateContext), deadline, `${command} ${target}`).catch((error) => {
493
+ if (!(error instanceof DeadlineExceeded))
494
+ throw error;
495
+ return {
496
+ application: 'failed',
497
+ // Neither "nothing happened" nor "undo it": the manager may have
498
+ // written the change already. The next start reconciles against
499
+ // disk instead of the market inventing an answer here.
500
+ repairOnRestart: true,
501
+ error: { code: 'operation-incomplete' },
502
+ };
503
+ });
461
504
  }
462
505
  catch (error) {
463
506
  progress.active = false;
@@ -520,7 +563,7 @@ packageManager) {
520
563
  return current.done;
521
564
  };
522
565
  const repairPendingUpdates = async () => {
523
- const empty = { reinstalled: [], finished: [], failed: [] };
566
+ const empty = { reinstalled: [], finished: [], failed: [], abandoned: [] };
524
567
  if (disposed || repairing || active !== undefined)
525
568
  return empty;
526
569
  const manager = managerLookup();
@@ -169,6 +169,23 @@ export async function withDeadline(work, ms, label) {
169
169
  }
170
170
  }
171
171
  export const REPAIR_INSTALL_TIMEOUT_MS = 300_000;
172
+ /**
173
+ * How many starts may each spend up to REPAIR_INSTALL_TIMEOUT_MS trying to put
174
+ * one package back before the market stops trying by itself.
175
+ *
176
+ * Retrying is right while the cause might be transient (offline, a registry
177
+ * briefly down, the host still shutting down). It stops being right when every
178
+ * start pays the full timeout for a spec that will never install — the shape a
179
+ * reporter lived through on the Desktop host (#1061: five days of failing
180
+ * reinstalls on every boot, all of it invisible). The record is kept, so the
181
+ * package is not forgotten; only the automatic attempt stops, and the user is
182
+ * told where to act.
183
+ */
184
+ export const MAX_AUTO_REPAIR_ATTEMPTS = 3;
185
+ /** What the user is told once the cap is reached: what, why, and what to do. */
186
+ function gaveUpCopy(name, attempts) {
187
+ return `${name} 还没装回来:之前 ${String(attempts)} 次启动都没能装好,市场不再自动重试。请到「设置 → 插件」重新安装它 / ${name} is still missing: ${String(attempts)} starts could not reinstall it, so the market stopped retrying — reinstall it from Settings → Plugins`;
188
+ }
172
189
  function managerSucceeded(result) {
173
190
  return result.application === 'applied'
174
191
  || result.application === 'restart-required'
@@ -253,7 +270,7 @@ export function clearStaleProfileLock(profileDirectory) {
253
270
  */
254
271
  export async function repairInterruptedUpdates(options) {
255
272
  const journal = options.journal ?? PendingUpdateJournal.forProfile(options.profileDirectory);
256
- const report = { reinstalled: [], finished: [], failed: [] };
273
+ const report = { reinstalled: [], finished: [], failed: [], abandoned: [] };
257
274
  const pending = journal.list().filter(entry => entry.profile === options.profile);
258
275
  for (const entry of pending) {
259
276
  const installed = readInstalledVersion(options.profile, entry.name, options.profileDirectory);
@@ -275,6 +292,16 @@ export async function repairInterruptedUpdates(options) {
275
292
  });
276
293
  continue;
277
294
  }
295
+ if (entry.attempts >= MAX_AUTO_REPAIR_ATTEMPTS) {
296
+ // Not bumped: the count is already the reason this start does nothing,
297
+ // and growing it would re-log the same sentence on every boot.
298
+ if (entry.attempts === MAX_AUTO_REPAIR_ATTEMPTS) {
299
+ logEvent('error', 'update-repair', gaveUpCopy(entry.name, entry.attempts));
300
+ }
301
+ report.failed.push({ name: entry.name, reason: gaveUpCopy(entry.name, entry.attempts) });
302
+ report.abandoned.push(entry.name);
303
+ continue;
304
+ }
278
305
  const spec = entry.to === '' ? entry.spec : `${entry.name}@${entry.to}`;
279
306
  try {
280
307
  // The interrupted update may have died holding the profile lock; its
@@ -410,9 +410,20 @@ export function classifyPnpmFailure(output, exitCode) {
410
410
  // `setupPolicyHandlers`, which an integration calling the CLI cannot wire,
411
411
  // so the only answer is the one-shot override. Classifying it here is what
412
412
  // connects it to that retry; without it the raw internal hint was surfaced.
413
- if (output.includes('ERR_PNPM_MINIMUM_RELEASE_AGE_VIOLATION')
413
+ // ...unless the lockfile is what is actually wrong (#1075). A profile whose
414
+ // lockfile is missing an entry makes pnpm re-resolve, and the resolver then
415
+ // applies the fresh-release policy from scratch — so the SAME log carries
416
+ // the lockfile's own error AND this policy code as collateral. Waiting or
417
+ // retrying cannot repair a missing lockfile entry, and the one-shot override
418
+ // this branch exists to trigger only lifts the age window, so classifying
419
+ // the pair as a wait names the wrong cause and promises a retry that must
420
+ // fail. The lockfile diagnoses below say what it is and how to repair it.
421
+ const lockfileContradictsItself = output.includes('ERR_PNPM_OUTDATED_LOCKFILE')
422
+ || output.includes('ERR_PNPM_LOCKFILE_MISSING_DEPENDENCY')
423
+ || /Broken lockfile/.test(output);
424
+ if (!lockfileContradictsItself && (output.includes('ERR_PNPM_MINIMUM_RELEASE_AGE_VIOLATION')
414
425
  || output.includes('ERR_PNPM_NO_MATURE_MATCHING_VERSION')
415
- || output.includes('ERR_PNPM_RESOLUTION_POLICY_VIOLATIONS_UNHANDLED')) {
426
+ || output.includes('ERR_PNPM_RESOLUTION_POLICY_VIOLATIONS_UNHANDLED'))) {
416
427
  return {
417
428
  code: 'release-age-violation',
418
429
  recoverable: false,
package/lib/routes.js CHANGED
@@ -17,7 +17,7 @@ import { settingsNamespaceState } from './settings.js';
17
17
  import { buildEnvFromUnknown, cleanHotDir, hotMount, hotUnmount, listHotMounts, MAX_BLOCKED, MAX_BLOCKED_NAME, MAX_FAVORITES, MAX_NOTE, MAX_UPDATE_EXEMPT, mountClientOnlyDeps, purgeMarketState, readMarketState, writeMarketState, } from './hot.js';
18
18
  import { createGroup, deleteGroup, removeFromGroups, renameGroup, setGroupMembers } from './groups.js';
19
19
  import { dshHostInfo, findDshInstallDir } from './dsh-install.js';
20
- import { deriveHostCompatibility, DiscoveryManifestIndex, findCompatibleVersion } from './discovery-compatibility.js';
20
+ import { catalogReleaseManifest, deriveHostCompatibility, DiscoveryManifestIndex, findCompatibleVersion } from './discovery-compatibility.js';
21
21
  import { configurePersistentLog, exportLogs, logEvent, readPersistentLog } from './log.js';
22
22
  import { marketFetch } from './net.js';
23
23
  import { diagnosePackageManifests } from './diagnostics.js';
@@ -3009,11 +3009,15 @@ export function mountMarketRoutes(host, config, commandRuntime, agentsLookup, ho
3009
3009
  const host = dshHostInfo();
3010
3010
  const hostVersion = host?.version ?? null;
3011
3011
  const hostPackages = corePackageNames(host?.directory ?? null);
3012
+ const catalogFacts = Object.fromEntries(entries.flatMap(entry => {
3013
+ const facts = catalogReleaseManifest(entry);
3014
+ return facts === null ? [] : [[entry.url, facts]];
3015
+ }));
3012
3016
  const [npmFacts, githubFacts] = await Promise.all([
3013
3017
  discoveryManifests.lookup(packages, routesFor(region).npmRegistry),
3014
- githubDiscoveryManifests.lookupGitHub(entries),
3018
+ githubDiscoveryManifests.lookupGitHub(entries.filter(entry => catalogFacts[entry.url] === undefined)),
3015
3019
  ]);
3016
- const facts = { ...npmFacts, ...githubFacts };
3020
+ const facts = { ...npmFacts, ...githubFacts, ...catalogFacts };
3017
3021
  const plugins = Object.fromEntries([...packages, ...urls].map(name => [
3018
3022
  name,
3019
3023
  deriveHostCompatibility(facts[name] ?? null, hostVersion, hostPackages),
@@ -35,7 +35,10 @@ type FetchLike = (url: string, init?: {
35
35
  export interface GitHubManifestSource {
36
36
  url: string;
37
37
  tarball?: string | null;
38
+ releaseManifest?: unknown;
38
39
  }
40
+ /** Reuse catalog facts only for this repository's exact pinned install asset. */
41
+ export declare function catalogReleaseManifest(source: GitHubManifestSource): NpmManifestFacts | null;
39
42
  /** Keep only the small public subset of an npm manifest needed by discovery. */
40
43
  export declare function manifestFacts(value: unknown): NpmManifestFacts;
41
44
  /**
@@ -120,8 +120,23 @@ export interface RepairReport {
120
120
  name: string;
121
121
  reason: string;
122
122
  }>;
123
+ /** Packages the market has stopped retrying by itself (see MAX_AUTO_REPAIR_ATTEMPTS). */
124
+ abandoned: string[];
123
125
  }
124
126
  export declare const REPAIR_INSTALL_TIMEOUT_MS = 300000;
127
+ /**
128
+ * How many starts may each spend up to REPAIR_INSTALL_TIMEOUT_MS trying to put
129
+ * one package back before the market stops trying by itself.
130
+ *
131
+ * Retrying is right while the cause might be transient (offline, a registry
132
+ * briefly down, the host still shutting down). It stops being right when every
133
+ * start pays the full timeout for a spec that will never install — the shape a
134
+ * reporter lived through on the Desktop host (#1061: five days of failing
135
+ * reinstalls on every boot, all of it invisible). The record is kept, so the
136
+ * package is not forgotten; only the automatic attempt stops, and the user is
137
+ * told where to act.
138
+ */
139
+ export declare const MAX_AUTO_REPAIR_ATTEMPTS = 3;
125
140
  /**
126
141
  * Drop a profile write lock whose owner is gone.
127
142
  *
@@ -14,6 +14,18 @@ export interface RegistryPlugin {
14
14
  npm?: string | null;
15
15
  tarball?: string | null;
16
16
  stars?: number | null;
17
+ starsCheckedAt?: string | null;
18
+ /** All public Release assets in this repository, lifetime count; never npm's window. */
19
+ githubReleaseDownloads?: number | null;
20
+ githubReleaseDownloadsCheckedAt?: string | null;
21
+ /** Public package declarations at this exact pinned install tag. */
22
+ releaseManifest?: {
23
+ tarball: string;
24
+ checkedAt: string;
25
+ version: string | null;
26
+ enginesDsh: string | null;
27
+ peerDependencies: Record<string, string>;
28
+ };
17
29
  /**
18
30
  * npm downloads in the last 30 days, when the entry has a published
19
31
  * package. `null`/absent means "no npm package" — a coverage gap, not a
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "dshmarket",
3
3
  "description": "Visual plugin market inside DeepSeek Harness — browse, search, and one-click install community plugins. · DSH 可视化插件市场:逛一逛,点一下,装好。",
4
- "version": "1.73.7",
4
+ "version": "1.73.8",
5
5
  "icon": "assets/logo.svg",
6
6
  "type": "module",
7
7
  "main": "lib/index.js",