dshmarket 1.73.6 → 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 +10 -0
- package/README.zh.md +9 -0
- package/client/client.js +100 -27
- package/lib/backup.js +27 -2
- package/lib/discovery-compatibility.js +10 -0
- package/lib/index.js +5 -1
- package/lib/official-desktop.js +49 -6
- package/lib/patch.js +25 -1
- package/lib/pending-updates.js +28 -1
- package/lib/pnpm-compat.js +13 -2
- package/lib/routes.js +19 -10
- package/lib/themes.js +5 -2
- package/lib/types/discovery-compatibility.d.ts +3 -0
- package/lib/types/patch.d.ts +21 -0
- package/lib/types/pending-updates.d.ts +15 -0
- package/lib/types/registry.d.ts +12 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -32,6 +32,14 @@ One-click themes: install, switch live, no restart.
|
|
|
32
32
|
profile name: `dsh plugin --profile <profile> add dshmarket`. Follow your
|
|
33
33
|
host's restart instructions.
|
|
34
34
|
|
|
35
|
+
- **From the GitHub source (no build):** `add github:dsh-market/dsh-market`
|
|
36
|
+
makes pnpm ask before running the package's build scripts. The prebuilt
|
|
37
|
+
tarball attached to the same release installs without that step:
|
|
38
|
+
|
|
39
|
+
```sh
|
|
40
|
+
dsh plugin --profile <profile> add https://github.com/dsh-market/dsh-market/releases/download/v<version>/dshmarket-<version>.tgz
|
|
41
|
+
```
|
|
42
|
+
|
|
35
43
|
On a machine with DSH Desktop, running `dsh plugin --profile web add dshmarket`
|
|
36
44
|
may report success but installs the market into `profiles/web`, **not** the
|
|
37
45
|
profile used by the Desktop app. It will not appear in Desktop. Install through
|
|
@@ -135,6 +143,8 @@ Installs prefer repo-verified npm packages, then author-supplied prebuilt GitHub
|
|
|
135
143
|
|
|
136
144
|
## Data source
|
|
137
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
|
+
|
|
138
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.
|
|
139
149
|
|
|
140
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
|
@@ -30,6 +30,13 @@
|
|
|
30
30
|
- **自定义 profile:** 把命令里的 `web` 换成宿主实际使用的 profile 名称:
|
|
31
31
|
`dsh plugin --profile <profile> add dshmarket`。之后按宿主的说明重启。
|
|
32
32
|
|
|
33
|
+
- **从 GitHub 源码安装(免构建):** `add github:dsh-market/dsh-market` 会让
|
|
34
|
+
pnpm 先征求构建脚本授权。改用同一版本 Release 附带的预构建包,就不需要这一步:
|
|
35
|
+
|
|
36
|
+
```sh
|
|
37
|
+
dsh plugin --profile <profile> add https://github.com/dsh-market/dsh-market/releases/download/v<version>/dshmarket-<version>.tgz
|
|
38
|
+
```
|
|
39
|
+
|
|
33
40
|
在装有 DSH Desktop 的电脑上执行 `dsh plugin --profile web add dshmarket`,
|
|
34
41
|
命令可能提示成功,但市场装进的是 `profiles/web`,**不是**桌面应用使用的
|
|
35
42
|
profile,因此不会出现在桌面端。请通过应用内的 **设置 → 插件** 安装;桌面端
|
|
@@ -126,6 +133,8 @@ profile,因此不会出现在桌面端。请通过应用内的 **设置 →
|
|
|
126
133
|
|
|
127
134
|
## 数据源
|
|
128
135
|
|
|
136
|
+
目录统计保留来源与口径:npm 显示注明日期范围的近 30 天下载量;仅通过 GitHub 发行的插件可显示仓库所有公开发行附件的累计下载量,包括安装包、校验和配套文件。两者不会相加,也不表示安装次数或用户数。提示中保留可用的采集时间,npm 下载排序仍使用原有时间窗口。目录提供的宿主声明仅用于完全匹配的固定安装地址,旧目录继续按需读取包清单。
|
|
137
|
+
|
|
129
138
|
每次打开都实时请求 [awesome-dsh-plugin.com/plugins.json](https://awesome-dsh-plugin.com/plugins.json)——精选条目、npm 映射、star 数由 CI 每日刷新,不使用过期缓存兜底;连不上时会给出具体原因和耗时,并提供「重试」按钮。
|
|
130
139
|
|
|
131
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}
|
|
584
|
-
catalogVersionUndated: "
|
|
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
|
|
1366
|
-
catalogVersionUndated: "the
|
|
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: "
|
|
2147
|
-
catalogVersionUndated: "
|
|
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
|
|
4885
|
-
if (
|
|
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);
|
|
@@ -8724,6 +8758,38 @@ window.__ModuleLoader__.load({ id: "dshmarket", factory: (require) => {
|
|
|
8724
8758
|
* already-downloaded image shown bigger — there is no separate "thumbnail"
|
|
8725
8759
|
* vs "full size" asset to fetch.
|
|
8726
8760
|
*/
|
|
8761
|
+
/**
|
|
8762
|
+
* The full-size screenshot, loaded through the configured GitHub route (#1070).
|
|
8763
|
+
*
|
|
8764
|
+
* Screenshots are GitHub-hosted, and on a mainland connection
|
|
8765
|
+
* `raw.githubusercontent.com` is the slowest part of the page — the avatars
|
|
8766
|
+
* next to them already go through the proxy the user chose, while this one
|
|
8767
|
+
* still went direct. The thumbnail keeps its own resizer; this is the one
|
|
8768
|
+
* place that wants the original bytes, so it is the one place the proxy
|
|
8769
|
+
* itself is worth a hop.
|
|
8770
|
+
*
|
|
8771
|
+
* The route order is the same one avatars use: the prefix that last worked
|
|
8772
|
+
* first, then the region's other prefixes, then direct. A failed load walks
|
|
8773
|
+
* the list rather than leaving a blank image.
|
|
8774
|
+
*/
|
|
8775
|
+
function LightboxImage({ src, className, onClick }) {
|
|
8776
|
+
const [routeIndex, setRouteIndex] = (0, react.useState)(0);
|
|
8777
|
+
(0, react.useEffect)(() => {
|
|
8778
|
+
setRouteIndex(0);
|
|
8779
|
+
}, [src]);
|
|
8780
|
+
const candidates = githubRouteCandidates("raw", src);
|
|
8781
|
+
const candidate = candidates[Math.min(routeIndex, candidates.length - 1)];
|
|
8782
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("img", {
|
|
8783
|
+
className,
|
|
8784
|
+
src: candidate.url,
|
|
8785
|
+
alt: "",
|
|
8786
|
+
onClick,
|
|
8787
|
+
onLoad: () => rememberGithubRoute("raw", candidate.proxy),
|
|
8788
|
+
onError: () => {
|
|
8789
|
+
if (routeIndex + 1 < candidates.length) setRouteIndex((current) => current + 1);
|
|
8790
|
+
}
|
|
8791
|
+
});
|
|
8792
|
+
}
|
|
8727
8793
|
function ScreenshotLightbox({ shots, startIndex, onClose, t }) {
|
|
8728
8794
|
const [index, setIndex] = useAutoCarousel(shots.length, startIndex, 0);
|
|
8729
8795
|
const titlebarHeight = useWindowTitlebarHeight();
|
|
@@ -8755,10 +8821,9 @@ window.__ModuleLoader__.load({ id: "dshmarket", factory: (require) => {
|
|
|
8755
8821
|
onClick: onClose,
|
|
8756
8822
|
children: "×"
|
|
8757
8823
|
}),
|
|
8758
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
8824
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(LightboxImage, {
|
|
8759
8825
|
className: Market_module_css_default.lightboxImg,
|
|
8760
8826
|
src: shots[index],
|
|
8761
|
-
alt: "",
|
|
8762
8827
|
onClick: (e) => e.stopPropagation()
|
|
8763
8828
|
}),
|
|
8764
8829
|
shots.length > 1 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
@@ -9020,9 +9085,23 @@ window.__ModuleLoader__.load({ id: "dshmarket", factory: (require) => {
|
|
|
9020
9085
|
})
|
|
9021
9086
|
});
|
|
9022
9087
|
}
|
|
9023
|
-
/** Compact
|
|
9088
|
+
/** Compact count; hover names the exact figure, source and reporting scope. */
|
|
9024
9089
|
function DownloadCount({ plugin, t }) {
|
|
9025
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);
|
|
9026
9105
|
if (tip === null) return null;
|
|
9027
9106
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CardTip, {
|
|
9028
9107
|
label: tip,
|
|
@@ -9030,7 +9109,7 @@ window.__ModuleLoader__.load({ id: "dshmarket", factory: (require) => {
|
|
|
9030
9109
|
className: Market_module_css_default.star,
|
|
9031
9110
|
tabIndex: 0,
|
|
9032
9111
|
"aria-label": tip,
|
|
9033
|
-
children: "·
|
|
9112
|
+
children: "· ★ " + formatCount(plugin.stars)
|
|
9034
9113
|
})
|
|
9035
9114
|
});
|
|
9036
9115
|
}
|
|
@@ -13836,12 +13915,9 @@ window.__ModuleLoader__.load({ id: "dshmarket", factory: (require) => {
|
|
|
13836
13915
|
plugin: p,
|
|
13837
13916
|
t
|
|
13838
13917
|
}),
|
|
13839
|
-
|
|
13840
|
-
|
|
13841
|
-
|
|
13842
|
-
className: Market_module_css_default.star,
|
|
13843
|
-
children: "· ★ " + formatCount(p.stars)
|
|
13844
|
-
})
|
|
13918
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(StarCount, {
|
|
13919
|
+
plugin: p,
|
|
13920
|
+
t
|
|
13845
13921
|
})
|
|
13846
13922
|
]
|
|
13847
13923
|
})]
|
|
@@ -13990,12 +14066,9 @@ window.__ModuleLoader__.load({ id: "dshmarket", factory: (require) => {
|
|
|
13990
14066
|
plugin: p,
|
|
13991
14067
|
t
|
|
13992
14068
|
}),
|
|
13993
|
-
|
|
13994
|
-
|
|
13995
|
-
|
|
13996
|
-
className: Market_module_css_default.star,
|
|
13997
|
-
children: "· ★ " + formatCount(p.stars)
|
|
13998
|
-
})
|
|
14069
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(StarCount, {
|
|
14070
|
+
plugin: p,
|
|
14071
|
+
t
|
|
13999
14072
|
})
|
|
14000
14073
|
]
|
|
14001
14074
|
})]
|
|
@@ -16493,9 +16566,9 @@ window.__ModuleLoader__.load({ id: "dshmarket", factory: (require) => {
|
|
|
16493
16566
|
plugin: confirming,
|
|
16494
16567
|
t
|
|
16495
16568
|
}),
|
|
16496
|
-
|
|
16497
|
-
|
|
16498
|
-
|
|
16569
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(StarCount, {
|
|
16570
|
+
plugin: confirming,
|
|
16571
|
+
t
|
|
16499
16572
|
}),
|
|
16500
16573
|
confirming.added && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
16501
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
|
-
|
|
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}
|
|
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
|
-
|
|
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?.();
|
package/lib/official-desktop.js
CHANGED
|
@@ -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.
|
|
17
|
-
*
|
|
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 =
|
|
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
|
-
|
|
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();
|
package/lib/patch.js
CHANGED
|
@@ -243,6 +243,30 @@ export function userPatchPackageReferences(patchPath, packageName) {
|
|
|
243
243
|
}
|
|
244
244
|
return [...insertedNames].filter(reference => reference === packageName || reference.startsWith(`${packageName}/`));
|
|
245
245
|
}
|
|
246
|
+
/**
|
|
247
|
+
* A loader entry's id as a string, or '' when it has none.
|
|
248
|
+
*
|
|
249
|
+
* `EntryOptions.id` is a TypeScript interface, not a runtime check: an
|
|
250
|
+
* unquoted `- id: 1` in `cordis.patch.yml` is parsed by YAML as the NUMBER 1,
|
|
251
|
+
* the host's loader accepts it, and every `.split(':')` on it then throws —
|
|
252
|
+
* `/dsh-market/installed` answered 400 with an empty body and the UI showed
|
|
253
|
+
* "no community plugins installed" (#1071). The market's own regex parser
|
|
254
|
+
* only ever produces strings, so this is reachable only through the loader.
|
|
255
|
+
*
|
|
256
|
+
* Numbers are stringified rather than dropped: `id: 1` names the same entry
|
|
257
|
+
* the user wrote, and the market's own row comparisons are string-keyed.
|
|
258
|
+
*
|
|
259
|
+
* @param entry - a host loader entry.
|
|
260
|
+
* @returns the id as a string, '' when absent or not a string/number.
|
|
261
|
+
*/
|
|
262
|
+
export function loaderEntryId(entry) {
|
|
263
|
+
const id = entry?.options?.id;
|
|
264
|
+
if (typeof id === 'string')
|
|
265
|
+
return id;
|
|
266
|
+
if (typeof id === 'number' && Number.isFinite(id))
|
|
267
|
+
return String(id);
|
|
268
|
+
return '';
|
|
269
|
+
}
|
|
246
270
|
/** The include entry's id prefix (loader entry ids look like `include:X`). */
|
|
247
271
|
function includePrefix(host) {
|
|
248
272
|
for (const entry of host.loader.entries()) {
|
|
@@ -289,7 +313,7 @@ export function rowIdsForPackage(host, profileDirectory, packageName) {
|
|
|
289
313
|
for (const entry of host.loader.entries()) {
|
|
290
314
|
if (entry.options?.name !== packageName)
|
|
291
315
|
continue;
|
|
292
|
-
let id = entry
|
|
316
|
+
let id = loaderEntryId(entry);
|
|
293
317
|
if (id === '')
|
|
294
318
|
continue;
|
|
295
319
|
if (prefix !== '' && id.startsWith(prefix))
|
package/lib/pending-updates.js
CHANGED
|
@@ -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
|
package/lib/pnpm-compat.js
CHANGED
|
@@ -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
|
-
|
|
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';
|
|
@@ -51,7 +51,7 @@ import { readJsonBody, refuseUnadmitted, sameOrigin, sendJson } from './http.js'
|
|
|
51
51
|
import { resolveDshHome } from './home-paths.js';
|
|
52
52
|
import { detectedDebugger, detectedSupervisor, restartAllowed, scheduleRestart, servingPort, trustedRestartRequest, trustedDownloadRequest, trustedSelfUninstallRequest, selfUninstallReachableFrom, restartReachableFrom } from './restart.js';
|
|
53
53
|
import { activationAfterReplace, brokenClientBundles, bundlePatchIsEmpty, checkClientBundle, defaultHostRuntimeFacts, findUnservedConfigNamespaces, hasHostHalf, hostPeerGate, isDeclaredLibraryDsh, newlyBrokenBundles, peerGateRemedy, verifyActivation } from './verify.js';
|
|
54
|
-
import { carrierRowIds, disableRow, enableRow, findUserPatchPath, foreignRowIds, isProtectedModule, packagePatchFlags, readUserPatchState, removeRowBlocks, rowIdsForPackage, userPatchPackageReferences, } from './patch.js';
|
|
54
|
+
import { carrierRowIds, disableRow, enableRow, findUserPatchPath, foreignRowIds, isProtectedModule, loaderEntryId, packagePatchFlags, readUserPatchState, removeRowBlocks, rowIdsForPackage, userPatchPackageReferences, } from './patch.js';
|
|
55
55
|
import { createProfileBackup, downloadWebdav, MAX_BACKUP_BYTES, mergeRestoreManifest, restoreProfileBackup, unportableDeps, uploadWebdav, WebdavUrlError, } from './backup.js';
|
|
56
56
|
import { createGist, fitsGistLimit, GistError, gistErrorCode, parseGistId, readGist, resolveGistTokenSource, updateGist, verifyGistToken, } from './gist.js';
|
|
57
57
|
import { MAX_UPDATE_OPERATIONS_V1, UpdateOperationStoreV1, UPDATE_API_V1_SCHEMA } from './update-api-v1.js';
|
|
@@ -1250,11 +1250,15 @@ export function mountMarketRoutes(host, config, commandRuntime, agentsLookup, ho
|
|
|
1250
1250
|
// here — but the id it created does, and that id is unique to its
|
|
1251
1251
|
// patch. Verification needs both, and putting them in one set means
|
|
1252
1252
|
// no call site can pass the names and forget the ids.
|
|
1253
|
-
|
|
1254
|
-
|
|
1253
|
+
// `id: 1` in the patch file is a NUMBER by the time the loader holds
|
|
1254
|
+
// it, and `.split` on it took the whole `/installed` handler down with
|
|
1255
|
+
// a 400 and an empty body (#1071).
|
|
1256
|
+
const entryId = loaderEntryId(entry);
|
|
1257
|
+
if (entryId !== '') {
|
|
1258
|
+
live.add(`#${entryId}`);
|
|
1255
1259
|
// Loader ids may carry an include prefix (`include:archify-…`).
|
|
1256
|
-
const bare =
|
|
1257
|
-
if (bare !== undefined && bare !==
|
|
1260
|
+
const bare = entryId.split(':').pop();
|
|
1261
|
+
if (bare !== undefined && bare !== entryId)
|
|
1258
1262
|
live.add(`#${bare}`);
|
|
1259
1263
|
}
|
|
1260
1264
|
}
|
|
@@ -3005,11 +3009,15 @@ export function mountMarketRoutes(host, config, commandRuntime, agentsLookup, ho
|
|
|
3005
3009
|
const host = dshHostInfo();
|
|
3006
3010
|
const hostVersion = host?.version ?? null;
|
|
3007
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
|
+
}));
|
|
3008
3016
|
const [npmFacts, githubFacts] = await Promise.all([
|
|
3009
3017
|
discoveryManifests.lookup(packages, routesFor(region).npmRegistry),
|
|
3010
|
-
githubDiscoveryManifests.lookupGitHub(entries),
|
|
3018
|
+
githubDiscoveryManifests.lookupGitHub(entries.filter(entry => catalogFacts[entry.url] === undefined)),
|
|
3011
3019
|
]);
|
|
3012
|
-
const facts = { ...npmFacts, ...githubFacts };
|
|
3020
|
+
const facts = { ...npmFacts, ...githubFacts, ...catalogFacts };
|
|
3013
3021
|
const plugins = Object.fromEntries([...packages, ...urls].map(name => [
|
|
3014
3022
|
name,
|
|
3015
3023
|
deriveHostCompatibility(facts[name] ?? null, hostVersion, hostPackages),
|
|
@@ -3168,8 +3176,9 @@ export function mountMarketRoutes(host, config, commandRuntime, agentsLookup, ho
|
|
|
3168
3176
|
for (const id of ids)
|
|
3169
3177
|
servedEntryIds.add(id);
|
|
3170
3178
|
for (const entry of host.loader.entries()) {
|
|
3171
|
-
|
|
3172
|
-
|
|
3179
|
+
// Same numeric-id trap as `liveNames()` (#1071).
|
|
3180
|
+
const id = loaderEntryId(entry);
|
|
3181
|
+
if (id === '')
|
|
3173
3182
|
continue;
|
|
3174
3183
|
servedEntryIds.add(id);
|
|
3175
3184
|
const bare = id.split(':').pop();
|
package/lib/themes.js
CHANGED
|
@@ -9,6 +9,7 @@ import { join } from 'node:path';
|
|
|
9
9
|
import { loadRegistry, pluginCategories } from './registry.js';
|
|
10
10
|
import { hotMount, hotUnmount, listHotMounts, writeDisabled } from './hot.js';
|
|
11
11
|
import { logEvent } from './log.js';
|
|
12
|
+
import { loaderEntryId } from './patch.js';
|
|
12
13
|
import { LifecyclePendingError, LifecycleWaitError, waitForLifecycle } from './lifecycle.js';
|
|
13
14
|
import { nameMatchesPackage } from './entry-identity.js';
|
|
14
15
|
import { bundlePatchInsertedIds, profileDir, readInstalled } from './profile.js';
|
|
@@ -54,8 +55,10 @@ function ownsLoaderEntry(entry, packageName, ownedIds) {
|
|
|
54
55
|
const entryName = entry.options.name;
|
|
55
56
|
if (nameMatchesPackage(entryName, packageName))
|
|
56
57
|
return true;
|
|
57
|
-
|
|
58
|
-
|
|
58
|
+
// A YAML `id: 1` reaches the loader as a NUMBER (#1071); `.split` on it
|
|
59
|
+
// threw and took the caller down.
|
|
60
|
+
const id = loaderEntryId(entry);
|
|
61
|
+
if (id === '')
|
|
59
62
|
return false;
|
|
60
63
|
// Loader ids may carry an include prefix (`include:<key>:<id>`); the bare
|
|
61
64
|
// id is what a bundle patch declares.
|
|
@@ -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
|
/**
|
package/lib/types/patch.d.ts
CHANGED
|
@@ -74,6 +74,27 @@ export declare function readUserPatchState(patchPath: string): PatchState;
|
|
|
74
74
|
* that as indeterminate and refuse the destructive step.
|
|
75
75
|
*/
|
|
76
76
|
export declare function userPatchPackageReferences(patchPath: string, packageName: string): string[] | null;
|
|
77
|
+
/**
|
|
78
|
+
* A loader entry's id as a string, or '' when it has none.
|
|
79
|
+
*
|
|
80
|
+
* `EntryOptions.id` is a TypeScript interface, not a runtime check: an
|
|
81
|
+
* unquoted `- id: 1` in `cordis.patch.yml` is parsed by YAML as the NUMBER 1,
|
|
82
|
+
* the host's loader accepts it, and every `.split(':')` on it then throws —
|
|
83
|
+
* `/dsh-market/installed` answered 400 with an empty body and the UI showed
|
|
84
|
+
* "no community plugins installed" (#1071). The market's own regex parser
|
|
85
|
+
* only ever produces strings, so this is reachable only through the loader.
|
|
86
|
+
*
|
|
87
|
+
* Numbers are stringified rather than dropped: `id: 1` names the same entry
|
|
88
|
+
* the user wrote, and the market's own row comparisons are string-keyed.
|
|
89
|
+
*
|
|
90
|
+
* @param entry - a host loader entry.
|
|
91
|
+
* @returns the id as a string, '' when absent or not a string/number.
|
|
92
|
+
*/
|
|
93
|
+
export declare function loaderEntryId(entry: {
|
|
94
|
+
options?: {
|
|
95
|
+
id?: unknown;
|
|
96
|
+
};
|
|
97
|
+
} | null | undefined): string;
|
|
77
98
|
/**
|
|
78
99
|
* The user-patch row ids one installed package owns: its bundle patch's
|
|
79
100
|
* insert rows, plus the loader entries currently carrying its name.
|
|
@@ -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
|
*
|
package/lib/types/registry.d.ts
CHANGED
|
@@ -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.
|
|
4
|
+
"version": "1.73.8",
|
|
5
5
|
"icon": "assets/logo.svg",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "lib/index.js",
|