dsh-plugin 2.0.1 → 2.0.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-plugin",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.3",
|
|
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",
|
|
@@ -14,7 +14,7 @@ import type { MouseEvent } from 'react'
|
|
|
14
14
|
import styles from '../../styles/Modal.module.css'
|
|
15
15
|
import type { EnvInfo, Translate } from '../../types.ts'
|
|
16
16
|
import type { NotificationRecord } from '../../logic/failures.ts'
|
|
17
|
-
import { actionOfRecord, classifyFailure, missingRegistryPackageOf, npmTooLowVersion, pnpmPolicyHintOf, pnpmPolicyHintParams, registryMissingHintOf, unreachableTargetOf, registryHostOf } from '../../logic/failures.ts'
|
|
17
|
+
import { actionOfRecord, classifyFailure, formatFailureMessage, missingRegistryPackageOf, npmTooLowVersion, pnpmPolicyHintOf, pnpmPolicyHintParams, registryMissingHintOf, unreachableTargetOf, registryHostOf } from '../../logic/failures.ts'
|
|
18
18
|
import type { PendingRestart, QueueTask } from '../../hooks/useTaskQueue.ts'
|
|
19
19
|
import { pluginIssueUrl, pluginSiteUrl, hubIssueUrl } from '../../logic/urls.ts'
|
|
20
20
|
import { CloseIcon } from '../ui/icons.tsx'
|
|
@@ -221,7 +221,7 @@ export function NotificationsModal({ records, tasks, pendingRestarts, t, env, on
|
|
|
221
221
|
: null,
|
|
222
222
|
!r.ok && h('button', {
|
|
223
223
|
className: styles.failCopy,
|
|
224
|
-
onClick: () => onCopy(r.message),
|
|
224
|
+
onClick: () => onCopy(formatFailureMessage(r.message)),
|
|
225
225
|
}, t('failCopy')),
|
|
226
226
|
// 成功通知:时间戳在行右侧,与图标/文字垂直居中,卡片保持单行内容
|
|
227
227
|
r.ok
|
|
@@ -15,7 +15,7 @@ import { CloseIcon, ConfirmIcon, CopyIcon, LinkIcon } from '../ui/icons.tsx'
|
|
|
15
15
|
import { ProgressView } from './ProgressView.tsx'
|
|
16
16
|
import { installCommandOf } from '../../logic/install-command.ts'
|
|
17
17
|
import { pluginDetailUrl, pluginIssueUrl, pluginSiteUrl, hubIssueUrl } from '../../logic/urls.ts'
|
|
18
|
-
import { classifyFailure, missingRegistryPackageOf, npmTooLowVersion, pnpmPolicyHintOf, pnpmPolicyHintParams, registryMissingHintOf, unreachableTargetOf, registryHostOf } from '../../logic/failures.ts'
|
|
18
|
+
import { classifyFailure, formatFailureMessage, missingRegistryPackageOf, npmTooLowVersion, pnpmPolicyHintOf, pnpmPolicyHintParams, registryMissingHintOf, unreachableTargetOf, registryHostOf } from '../../logic/failures.ts'
|
|
19
19
|
import type { FailureAction } from '../../logic/failures.ts'
|
|
20
20
|
|
|
21
21
|
/** 完成结果视图:绿色对勾 + 标题/描述;
|
|
@@ -359,10 +359,13 @@ export function ErrorModal({ message, repo, action, command, attempts, t, env, o
|
|
|
359
359
|
// 复制完整错误:实际执行/尝试过的安装命令(如有)+ 完整错误正文。
|
|
360
360
|
// 只复制 message 会丢上下文 —— 命令行安装输入的目标、执行过的命令都在 command/attempts 里,
|
|
361
361
|
// 光拷一句「unsupported install target」出去没人看得懂
|
|
362
|
+
// 展示与复制都用展开后的文本:宿主门禁消息里的 peerDependencies 是压缩 JSON,
|
|
363
|
+
// 原样展示会挤成一整行;格式化只影响可读性,不改变归类与上报逻辑
|
|
364
|
+
const displayMessage = formatFailureMessage(message)
|
|
362
365
|
const copyText = [
|
|
363
366
|
...(command ? [command] : []),
|
|
364
367
|
...(attempts ?? []),
|
|
365
|
-
|
|
368
|
+
displayMessage,
|
|
366
369
|
].join('\n')
|
|
367
370
|
return h('div', {
|
|
368
371
|
className: styles.overlay,
|
|
@@ -403,7 +406,7 @@ export function ErrorModal({ message, repo, action, command, attempts, t, env, o
|
|
|
403
406
|
h('button', { className: styles.errorCopySoft, onClick: () => onCopy(copyText) }, t('errorCopy')),
|
|
404
407
|
),
|
|
405
408
|
// 报错信息完整展示(可滚动),比失败记录的预览看得更多
|
|
406
|
-
h('pre', { className: styles.errorBox },
|
|
409
|
+
h('pre', { className: styles.errorBox }, displayMessage),
|
|
407
410
|
// 统一失败卡片头部:报错类型 + 一句话原因(各类型的具体指引仍在下面的分支里)
|
|
408
411
|
h('div', { className: styles.failKindTitle }, t(`failKind_${failureKind}`, failureKind === 'hostIncompatible'
|
|
409
412
|
? { version: /incompatible with dsh\s+([^\s:;,]+)/i.exec(message)?.[1] ?? '' }
|
|
@@ -291,7 +291,7 @@ export function npmTooLowVersion(message: string): string | null {
|
|
|
291
291
|
}
|
|
292
292
|
|
|
293
293
|
/** 核心行特征:错误代码 / 生命周期脚本失败 / prepare 失败 / 描述性报错(子模块缺失、找不到等)/ 退出与宿主提示信息。 */
|
|
294
|
-
const CORE_LINE_RE = /ERR_[A-Z_]+|ELIFECYCLE|Command failed|prepare-guard|Failed to prepare|exit code|\bprepare\b|pnpm failed in profile|git-hosted plugins build|submodule|not found|cannot find|no such|unable to|fatal|missing|error/i
|
|
294
|
+
const CORE_LINE_RE = /ERR_[A-Z_]+|ELIFECYCLE|Command failed|prepare-guard|Failed to prepare|exit code|\bprepare\b|pnpm failed in profile|git-hosted plugins build|incompatible with dsh|submodule|not found|cannot find|no such|unable to|fatal|missing|error/i
|
|
295
295
|
/** pnpm 的 peer 依赖告警行(`missing peer …` / `Issues with peer dependencies found` /
|
|
296
296
|
* `Peer dependencies that should be installed`):宿主提供的 peer(@deepseek-ai/*、react、
|
|
297
297
|
* dsh-client-* 等,DSH profile 用 autoInstallPeers:false 不自动装)缺失是无害噪音,与插件本身
|
|
@@ -305,6 +305,20 @@ export const MAX_CORE_CHARS = 5000
|
|
|
305
305
|
/** 摘要里单行上限:允许构建 key 等长行也被截短。 */
|
|
306
306
|
const MAX_LINE_CHARS = 400
|
|
307
307
|
|
|
308
|
+
/**
|
|
309
|
+
* 展示用格式化:宿主门禁消息里的 peerDependencies 是压缩成一行的 JSON,
|
|
310
|
+
* 直接展示像一团乱码;展开成缩进格式,解析失败则原样返回。
|
|
311
|
+
*/
|
|
312
|
+
export function formatFailureMessage(message: string): string {
|
|
313
|
+
return message.replace(/peerDependencies (\{.*?\})/g, (whole: string, json: string) => {
|
|
314
|
+
try {
|
|
315
|
+
return `peerDependencies ${JSON.stringify(JSON.parse(json), null, 2)}`
|
|
316
|
+
} catch {
|
|
317
|
+
return whole
|
|
318
|
+
}
|
|
319
|
+
})
|
|
320
|
+
}
|
|
321
|
+
|
|
308
322
|
/**
|
|
309
323
|
* 核心错误收集器:从完整安装输出里挑出真正说明问题的行(错误代码、构建脚本失败、
|
|
310
324
|
* 退出与宿主提示),去重后拼接,单行与总量都截断 —— 只把「重点 + 原因」带进 issue 正文,
|