dsh-plugin 1.1.1 → 1.1.2

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.
Files changed (64) hide show
  1. package/README.en.md +5 -5
  2. package/README.md +5 -5
  3. package/client/client.js +242 -153
  4. package/client/client.js.map +1 -1
  5. package/lib/http/routes.js +15 -8
  6. package/lib/index.js +4 -0
  7. package/lib/services/install-types.js +8 -2
  8. package/lib/services/install.js +1 -1
  9. package/lib/services/installed-versions.js +5 -1
  10. package/lib/services/loader.js +4 -0
  11. package/lib/services/npm-resolve.js +4 -0
  12. package/lib/services/pending-restart.js +1 -1
  13. package/lib/services/preflight.js +9 -4
  14. package/lib/services/profile.js +30 -3
  15. package/lib/services/progress.js +4 -0
  16. package/lib/services/task-queue.js +13 -7
  17. package/lib/types/index.d.ts +4 -0
  18. package/lib/types/services/install-types.d.ts +10 -4
  19. package/lib/types/services/install.d.ts +5 -1
  20. package/lib/types/services/loader.d.ts +4 -0
  21. package/lib/types/services/pending-restart.d.ts +8 -2
  22. package/lib/types/services/profile.d.ts +4 -2
  23. package/lib/types/services/progress.d.ts +4 -0
  24. package/package.json +1 -1
  25. package/src/client/components/AboutModal.tsx +4 -0
  26. package/src/client/components/CatalogControls.tsx +4 -0
  27. package/src/client/components/CatalogHeader.tsx +4 -0
  28. package/src/client/components/CatalogList.tsx +4 -0
  29. package/src/client/components/CategoryTabs.tsx +4 -0
  30. package/src/client/components/Dropdown.tsx +4 -0
  31. package/src/client/components/HubUpdateModal.tsx +4 -0
  32. package/src/client/components/NotificationsModal.tsx +4 -0
  33. package/src/client/components/PluginCard.tsx +5 -1
  34. package/src/client/components/PluginHubSection.tsx +5 -1
  35. package/src/client/components/ProgressView.tsx +4 -0
  36. package/src/client/components/icons.tsx +4 -0
  37. package/src/client/components/modals.tsx +4 -0
  38. package/src/client/hooks/useCatalog.ts +9 -5
  39. package/src/client/hooks/useTaskQueue.ts +13 -9
  40. package/src/client/index.tsx +4 -0
  41. package/src/client/lib/catalog.ts +27 -6
  42. package/src/client/lib/env.ts +4 -0
  43. package/src/client/lib/failures.ts +5 -1
  44. package/src/client/lib/format.ts +4 -0
  45. package/src/client/lib/renderMarkdown.ts +4 -0
  46. package/src/client/locales.ts +7 -1
  47. package/src/client/styles/Dropdown.module.css +5 -1
  48. package/src/client/styles/Header.module.css +5 -1
  49. package/src/client/styles/List.module.css +5 -1
  50. package/src/client/styles/Modal.module.css +5 -1
  51. package/src/client/styles/tokens.module.css +5 -1
  52. package/src/client/types.ts +5 -1
  53. package/src/server/http/routes.ts +14 -8
  54. package/src/server/index.ts +4 -0
  55. package/src/server/services/install-types.ts +10 -4
  56. package/src/server/services/install.ts +5 -1
  57. package/src/server/services/installed-versions.ts +5 -1
  58. package/src/server/services/loader.ts +4 -0
  59. package/src/server/services/npm-resolve.ts +4 -0
  60. package/src/server/services/pending-restart.ts +8 -2
  61. package/src/server/services/preflight.ts +9 -4
  62. package/src/server/services/profile.ts +27 -3
  63. package/src/server/services/progress.ts +4 -0
  64. package/src/server/services/task-queue.ts +13 -7
@@ -1,4 +1,8 @@
1
1
  /**
2
+ * DSH-Plugin Hub — the community plugin marketplace for DeepSeek Harness.
3
+ * Website: https://dsh-plugin.org
4
+ * GitHub: https://github.com/dshplugin/dsh-plugin-hub
5
+ *
2
6
  * 后台安装/卸载任务队列:内存任务注册表 + FIFO 串行 worker + 子进程生命周期管理。
3
7
  * 每个任务一次 `dsh plugin --profile <profile> <action> <target>` 子进程,
4
8
  * 输出流式收集到任务上;卸载成功时尝试从运行中 loader 即时停用(见 loader.ts)。
@@ -12,7 +16,7 @@ import { cleanLine, estimateProgress } from './progress.ts'
12
16
  import type { LoaderHandle } from './loader.ts'
13
17
  import { removeLoadedEntry } from './loader.ts'
14
18
  import { addPendingRestart, clearPendingRestart } from './pending-restart.ts'
15
- import { addAllowBuildsKey, parseAllowBuildsKey, profileDirectory } from './profile.ts'
19
+ import { addAllowBuildsKey, githubRepoOf, parseAllowBuildsKey, profileDirectory } from './profile.ts'
16
20
 
17
21
  /** In-memory task registry, keyed by task id. */
18
22
  const tasks = new Map<number, InstallTask>()
@@ -223,7 +227,7 @@ function spawnMutation(options: {
223
227
  const { action, profile, target, timeoutMs = 5 * 60 * 1000, env, task, displayTarget, uninstallLoader } = options
224
228
  const invocation = cliInvocation()
225
229
  const args = [...invocation.prefixArgs, 'plugin', '--profile', profile, action, target]
226
- // 记录实际执行的命令(npm 通道显示包名,git 通道显示 github: 源):失败提 Issue 时
230
+ // 记录实际执行的命令(npm 通道显示包名,git 通道显示 HTTPS 源):失败提 Issue 时
227
231
  // 「已尝试的安装方式」如实展示完整命令链,作者一眼看清我们跑过什么
228
232
  const executed = `dsh plugin --profile ${profile} ${action} ${target}`
229
233
  if (task && !task.attempts.includes(executed)) {
@@ -305,8 +309,7 @@ function spawnMutation(options: {
305
309
 
306
310
  child.once('exit', () => {
307
311
  // dsh 内部会 fork pnpm:pnpm 退出后仍攥着 stdout/stderr 管道时,
308
- // close 事件永不到来(历史队列卡死根因——取消路径曾因此卡死,用整组 SIGKILL 解决;
309
- // 自然失败路径没有兜底)。exit 后给 close 一段宽限,未按时触发则整组清理强制结束,
312
+ // close 事件不会到来。exit 后给 close 一段宽限,未按时触发则整组清理强制结束,
310
313
  // 保证任务必然进入终态、后续排队任务自动启动。
311
314
  exitWatch = setTimeout(() => {
312
315
  if (settled) return
@@ -385,8 +388,11 @@ export function verifyInstalledEntry(profile: string, target: string): { name: s
385
388
  return { name: null, missing: null }
386
389
  }
387
390
  const deps = (profilePkg?.dependencies ?? {}) as Record<string, string>
388
- // target 自身是依赖名(npm 包),或通过 github: specifier 反查依赖名
389
- const name = deps[target] !== undefined ? target : Object.keys(deps).find((k) => deps[k] === target)
391
+ // target 自身是依赖名(npm 包),或通过 Git specifier 反查依赖名
392
+ const targetRepo = githubRepoOf(target)?.toLowerCase()
393
+ const name = targetRepo !== undefined
394
+ ? Object.keys(deps).find((k) => githubRepoOf(deps[k])?.toLowerCase() === targetRepo)
395
+ : deps[target] !== undefined ? target : Object.keys(deps).find((k) => deps[k] === target)
390
396
  if (!name) return { name: null, missing: null }
391
397
  const pkgDir = join(profileDirectory(profile), 'node_modules', name)
392
398
  let entry: string | null = null
@@ -465,7 +471,7 @@ export async function runPluginMutation(options: {
465
471
  // 输出解析不到时回退用目标名(插件自身构建脚本被拦的 npm 场景)。
466
472
  if (output.includes('ERR_PNPM_IGNORED_BUILDS')) {
467
473
  const keys = ignoredBuildKeys(output)
468
- if (keys.length === 0 && !options.target.startsWith('github:')) keys.push(options.target)
474
+ if (keys.length === 0 && githubRepoOf(options.target) === null) keys.push(options.target)
469
475
  if (keys.length > 0) {
470
476
  if (options.task) {
471
477
  options.task.status = 'running'