dsh-plugin 2.0.3 → 2.0.4
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/client.js +314 -305
- package/client/client.js.map +1 -1
- package/package.json +1 -1
- package/src/client/components/modals/NotificationsModal.tsx +4 -0
- package/src/client/components/modals/modals.tsx +3 -0
- package/src/client/hooks/useTaskQueue.ts +4 -2
- package/src/client/locales.ts +6 -0
- package/src/client/logic/failures.ts +6 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-plugin",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.4",
|
|
4
4
|
"description": "A community plugin marketplace for DeepSeek Harness, built to the official plugin spec — browse, search and install 10000+ human-curated community plugins without leaving the app. · DeepSeek Harness 社区插件市场(遵循官方开发规范):10000+ 人工精选社区插件,每日更新。",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -296,6 +296,10 @@ export function NotificationsModal({ records, tasks, pendingRestarts, t, env, on
|
|
|
296
296
|
// 给安装指引,不引导提 Issue
|
|
297
297
|
return h('div', { className: styles.failPrepareHint }, t('failNpmMissingHint'))
|
|
298
298
|
}
|
|
299
|
+
if (kind === 'buildToolchainMissing') {
|
|
300
|
+
// 原生模块要本机编译,缺编译器属于用户环境,不引导提 Issue
|
|
301
|
+
return h('div', { className: styles.failPrepareHint }, t('failBuildToolchainHint'))
|
|
302
|
+
}
|
|
299
303
|
if (kind === 'pnpmWorkspace') {
|
|
300
304
|
// pnpm 拒绝把依赖装到 workspace 根目录(ERR_PNPM_ADDING_TO_ROOT):宿主在 profile
|
|
301
305
|
// 目录调 pnpm add 未声明在根操作,任何插件都会失败 ——
|
|
@@ -431,6 +431,9 @@ export function ErrorModal({ message, repo, action, command, attempts, t, env, o
|
|
|
431
431
|
: failureKind === 'npmMissing'
|
|
432
432
|
// 本机缺 npm,不是插件问题
|
|
433
433
|
? h('div', { className: styles.failPrepareHint }, t('failNpmMissingHint'))
|
|
434
|
+
: failureKind === 'buildToolchainMissing'
|
|
435
|
+
// 原生模块要本机编译,缺编译器属于用户环境,不引导提 Issue
|
|
436
|
+
? h('div', { className: styles.failPrepareHint }, t('failBuildToolchainHint'))
|
|
434
437
|
: failureKind === 'pnpmWorkspace'
|
|
435
438
|
// pnpm 拒绝把依赖装到 workspace 根目录(ERR_PNPM_ADDING_TO_ROOT):宿主在 profile 目录
|
|
436
439
|
// 调 pnpm add 时未声明在根操作,任何插件都会失败,不是插件问题 ——
|
|
@@ -502,8 +502,9 @@ export function useTaskQueue(opts: TaskQueueOptions) {
|
|
|
502
502
|
// 网络异常:移除乐观条目 + 兜底错误弹窗(附上底层原因,避免只剩一句笼统的「安装失败」)
|
|
503
503
|
applyQueue((prev) => prev.filter((x) => x.id !== tempId))
|
|
504
504
|
const aborted = (err as { name?: string } | null)?.name === 'AbortError'
|
|
505
|
+
// [request-timeout]:给分类器一个与界面语言无关的超时标记
|
|
505
506
|
const reason = aborted
|
|
506
|
-
? t('requestTimeout')
|
|
507
|
+
? `${t('requestTimeout')}\n[request-timeout]`
|
|
507
508
|
: err instanceof Error && err.message ? err.message : String(err ?? '')
|
|
508
509
|
// 自定义安装(带入口渠道):错误正文顶部精准提示「从哪张卡片发起」
|
|
509
510
|
const entry = entryLineOf(t, input.channel)
|
|
@@ -601,8 +602,9 @@ export function useTaskQueue(opts: TaskQueueOptions) {
|
|
|
601
602
|
} catch (err) {
|
|
602
603
|
// 网络异常:附上底层原因,避免只剩一句笼统的「卸载失败」
|
|
603
604
|
const aborted = (err as { name?: string } | null)?.name === 'AbortError'
|
|
605
|
+
// [request-timeout]:给分类器一个与界面语言无关的超时标记
|
|
604
606
|
const reason = aborted
|
|
605
|
-
? t('requestTimeout')
|
|
607
|
+
? `${t('requestTimeout')}\n[request-timeout]`
|
|
606
608
|
: err instanceof Error && err.message ? err.message : String(err ?? '')
|
|
607
609
|
onError(reason ? `${t('uninstallFail')} — ${reason}` : t('uninstallFail'), repo, 'uninstall')
|
|
608
610
|
} finally {
|
package/src/client/locales.ts
CHANGED
|
@@ -342,6 +342,7 @@ export const zh = {
|
|
|
342
342
|
failGitMissingHint: '系统找不到 git 命令(Git 未安装或未加入系统 PATH),无法从 GitHub 源安装插件。请先安装 Git(如 git-scm.com/downloads)或把 git 加入 PATH,重启 DSH 后重试。这不是插件本身的问题。',
|
|
343
343
|
failPnpmMissingHint: '安装器找到了 dsh,但系统里没有 pnpm 命令(dsh 用它来管理 profile 插件)。请先安装 pnpm(如 npm install -g pnpm),确认 pnpm 已加入 PATH 后重试。这不是插件本身的问题。',
|
|
344
344
|
failNpmMissingHint: '系统找不到 npm 命令(npm 未安装或未加入系统 PATH),无法执行全局安装。请先安装 Node.js(自带 npm),确认 npm 已加入 PATH 后重试。这不是插件本身的问题。',
|
|
345
|
+
failBuildToolchainHint: '这个插件依赖需要在本机编译的原生模块,但机器上缺少可用的编译工具链。请按系统安装后重试:Windows 安装 Visual Studio Build Tools(含「使用 C++ 的桌面开发」);macOS 执行 xcode-select --install;Linux 安装 build-essential、python3 与 make。若装好工具链后仍然失败,再向插件作者反馈,请其提供预构建产物。',
|
|
345
346
|
failPnpmStoreHint: '安装器调用 pnpm 时报「store 位置不匹配」(ERR_PNPM_UNEXPECTED_STORE):你的 profile 目录里旧插件依赖是用另一个大版本的 pnpm 生成的,当前 pnpm 出于安全不认旧目录,导致任何插件装进该 profile 都会失败。请删除该 profile 目录下的 node_modules 与 pnpm-lock.yaml(可先到「系统日志」或 ~/.dsh/profiles/<profile>/hub.log 查看完整报错),再重新安装。这不是插件本身的问题。',
|
|
346
347
|
failPnpmUnusedPatchHint: '安装器调用 pnpm 时报「有些补丁没有被使用」(ERR_PNPM_UNUSED_PATCH):你的 profile 里留着一条指向旧版本 dsh-plugin 的补丁声明(例如 dsh-plugin@1.4.2),而本次安装解析到的版本已经不是它,pnpm 出于安全直接中止整次安装,因此任何插件都装不进来。这不是插件本身的问题——请在 profile 目录(~/.dsh/profiles/<profile>)的 pnpm-workspace.yaml(pnpm 11 及以上)或 package.json 的 pnpm.patchedDependencies(pnpm 10)里删除该 dsh-plugin 补丁条目后重试。',
|
|
347
348
|
// 404 依赖:点名 registry 上不存在的那个包(取不到包名时跳过这行),再给删除条目的指引
|
|
@@ -364,6 +365,8 @@ export const zh = {
|
|
|
364
365
|
failReason_pnpmMissing: '安装器通过 pnpm 安装插件,但机器上找不到 pnpm。',
|
|
365
366
|
failKind_npmMissing: '本机缺少 npm',
|
|
366
367
|
failReason_npmMissing: '安装流程需要 npm,但机器上找不到它。',
|
|
368
|
+
failKind_buildToolchainMissing: '本机缺少原生构建工具链',
|
|
369
|
+
failReason_buildToolchainMissing: '这个插件依赖需要在本机编译的原生模块,但找不到可用的编译器。',
|
|
367
370
|
failKind_pnpmStore: 'pnpm store 版本不匹配',
|
|
368
371
|
failReason_pnpmStore: 'profile 里的依赖由另一大版本的 pnpm 生成,当前 pnpm 不认。',
|
|
369
372
|
failKind_pnpmWorkspace: 'workspace 根校验阻止了安装',
|
|
@@ -799,6 +802,7 @@ export const en = {
|
|
|
799
802
|
failGitMissingHint: 'The git command could not be found (Git is not installed or not on the system PATH), so GitHub-source plugins cannot be installed. Please install Git (e.g. from git-scm.com/downloads) or add git to your PATH, restart DSH, then retry. This is not a problem with the plugin itself.',
|
|
800
803
|
failPnpmMissingHint: 'The installer found dsh, but pnpm is missing on this machine (dsh uses it to manage profile plugins). Please install pnpm first (e.g. npm install -g pnpm), make sure it is on your PATH, then retry. This is not a problem with the plugin itself.',
|
|
801
804
|
failNpmMissingHint: 'The npm command could not be found (npm is not installed or not on the system PATH), so a global install cannot run. Please install Node.js (which bundles npm), make sure npm is on your PATH, then retry. This is not a problem with the plugin itself.',
|
|
805
|
+
failBuildToolchainHint: 'This plugin depends on a native module that must be compiled on your machine, but no usable build toolchain is available. Install one and retry: on Windows install Visual Studio Build Tools with the "Desktop development with C++" workload; on macOS run xcode-select --install; on Linux install build-essential, python3 and make. If it still fails after the toolchain is installed, report it to the plugin author and ask for a prebuilt package.',
|
|
802
806
|
failPnpmStoreHint: 'pnpm reported an unexpected store location (ERR_PNPM_UNEXPECTED_STORE): the profile directory was previously set up with a different major version of pnpm, and the current pnpm refuses to reuse it — no plugin can be installed into that profile. Delete node_modules and pnpm-lock.yaml under the profile directory (see System Logs or ~/.dsh/profiles/<profile>/hub.log for the full output), then reinstall. This is not a problem with the plugin itself.',
|
|
803
807
|
failPnpmUnusedPatchHint: 'pnpm reported that some patches were not used (ERR_PNPM_UNUSED_PATCH): your profile still holds a patch entry for an older dsh-plugin version (for example dsh-plugin@1.4.2), while this install resolved a different version, so pnpm aborts the whole install for safety — no plugin can be installed into that profile. This is not a problem with the plugin itself. Remove that dsh-plugin patch entry from pnpm-workspace.yaml (pnpm 11+) or from pnpm.patchedDependencies in package.json (pnpm 10) inside the profile directory (~/.dsh/profiles/<profile>), then retry.',
|
|
804
808
|
// 缺失依赖:点名 404 的包(解析不出时跳过该行),再给删除指引
|
|
@@ -821,6 +825,8 @@ export const en = {
|
|
|
821
825
|
failReason_pnpmMissing: 'The installer uses pnpm to add plugins, but pnpm cannot be found.',
|
|
822
826
|
failKind_npmMissing: 'npm is not installed on this machine',
|
|
823
827
|
failReason_npmMissing: 'The install flow needs npm, but it cannot be found.',
|
|
828
|
+
failKind_buildToolchainMissing: 'native build toolchain is missing',
|
|
829
|
+
failReason_buildToolchainMissing: 'A dependency of this plugin must be compiled locally, but no usable compiler was found.',
|
|
824
830
|
failKind_pnpmStore: 'pnpm store version mismatch',
|
|
825
831
|
failReason_pnpmStore: 'The profile dependencies were written by a different pnpm major, which the current pnpm does not accept.',
|
|
826
832
|
failKind_pnpmWorkspace: 'workspace-root check blocked the install',
|
|
@@ -148,7 +148,7 @@ export function removeNotification(id: number): NotificationRecord[] {
|
|
|
148
148
|
return next
|
|
149
149
|
}
|
|
150
150
|
|
|
151
|
-
export type FailureKind = 'npmTooOld' | 'dshMissing' | 'gitMissing' | 'pnpmMissing' | 'npmMissing' | 'pnpmStore' | 'pnpmWorkspace' | 'originRejected' | 'pnpmPolicy' | 'pnpmUnusedPatch' | 'pnpmMissingDep' | 'pluginMissingDep' | 'registryVersionStale' | 'pnpmLinkedDirMissing' | 'fileLocked' | 'accessDenied' | 'fsUnavailable' | 'pnpmIgnoredBuild' | 'pluginPrepare' | 'hostIncompatible' | 'network' | 'hostCliSpawn' | 'hubState' | 'timeout' | 'profileLock' | 'hub'
|
|
151
|
+
export type FailureKind = 'npmTooOld' | 'dshMissing' | 'gitMissing' | 'pnpmMissing' | 'npmMissing' | 'pnpmStore' | 'pnpmWorkspace' | 'originRejected' | 'pnpmPolicy' | 'pnpmUnusedPatch' | 'pnpmMissingDep' | 'pluginMissingDep' | 'registryVersionStale' | 'pnpmLinkedDirMissing' | 'fileLocked' | 'accessDenied' | 'fsUnavailable' | 'buildToolchainMissing' | 'pnpmIgnoredBuild' | 'pluginPrepare' | 'hostIncompatible' | 'network' | 'hostCliSpawn' | 'hubState' | 'timeout' | 'profileLock' | 'hub'
|
|
152
152
|
|
|
153
153
|
/** 失败动作口径:标题、上报正文与提示文案按安装/更新/卸载取词,不写死「安装」。 */
|
|
154
154
|
export type FailureAction = 'install' | 'update' | 'uninstall'
|
|
@@ -247,6 +247,8 @@ export function classifyFailure(message: string): FailureKind {
|
|
|
247
247
|
// 网络/代理/源配置问题。必须在 prepare 之前判:git fetch 失败常被外层包成 "Command failed"
|
|
248
248
|
// tarball 下载失败的括号里可能是数字码(pnpm 自己的)或符号码(undici 的 UND_ERR_*),两种都要认
|
|
249
249
|
if (/\[network\]|ERR_PNPM_GIT_FETCH_FAILED|ETIMEDOUT|ECONNREFUSED|ECONNRESET|ENOTFOUND|EAI_AGAIN|EPIPE|EHOSTUNREACH|ENETUNREACH|UND_ERR_[A-Z0-9_]+|getaddrinfo|Could not connect|Could not resolve host|Network unreachable|Failed to connect|socket hang up|CERT_HAS_EXPIRED|SSL certificate problem|\bTLS\b|\bSSL\b|fetch failed|failed to fetch|\bGET https?:\/\/\S+\.tgz\s+error \([A-Za-z0-9_]+\)/i.test(message)) return 'network'
|
|
250
|
+
// 浏览器端请求超时(客户端 fetch 被 abort):请求没到宿主,属于连不上网络,与插件无关
|
|
251
|
+
if (/\[request-timeout\]/i.test(message)) return 'network'
|
|
250
252
|
// 装后校验发现入口文件缺失([packaging])= 分发物缺构建产物
|
|
251
253
|
if (/\[packaging\]|entry file missing/i.test(message)) return 'pluginPrepare'
|
|
252
254
|
// registry 上不存在的依赖(404),profile 任何安装都会卡在这条。必须在 pluginPrepare 之前判
|
|
@@ -257,6 +259,9 @@ export function classifyFailure(message: string): FailureKind {
|
|
|
257
259
|
if (/\bERR_PNPM_NO_MATCHING_VERSION\b|\bETARGET\b|No matching version found/i.test(message)) return 'registryVersionStale'
|
|
258
260
|
// profile 残留指向不存在目录的本地依赖(link:/file:)。必须在 pluginPrepare 之前判
|
|
259
261
|
if (/\bERR_PNPM_LINKED_PKG_DIR_NOT_FOUND\b|Could not install from .+ as it does not exist/i.test(message)) return 'pnpmLinkedDirMissing'
|
|
262
|
+
// 原生模块需要本机编译,缺编译器/构建工具属于用户环境,不是插件的 prepare 失败。
|
|
263
|
+
// 必须排在 pluginPrepare 之前:这类日志同样带 ELIFECYCLE,否则会被推给作者。
|
|
264
|
+
if (/Unable to detect compiler type|gyp ERR!|Could not find any Visual Studio|No Xcode or CLT version detected|xcode-select|python(?:3)? is (?:not set|not found)|Could not find Python|\bmake: not found\b|\bgcc: not found\b|\bg\+\+: not found\b|\bMSB\d{4}\b/i.test(message)) return 'buildToolchainMissing'
|
|
260
265
|
// 构建脚本真的跑挂了才算插件问题。Command failed 区分大小写:只匹配 pnpm 的包装,
|
|
261
266
|
// 不匹配宿主那句小写 dsh: plugin command failed
|
|
262
267
|
if (/ERR_PNPM_PREPARE_PACKAGE|ELIFECYCLE|prepare-guard/i.test(message) || /Command failed/.test(message)) return 'pluginPrepare'
|