Skip to content

fix(console): restore @deepseek-ai/dsh-tools peer + add dsh-client-ui-primitives to client inject - #7

Open
HuanLinOTO wants to merge 1 commit into
vlln:mainfrom
HuanLinOTO:fix/peer-deps-and-client-inject
Open

fix(console): restore @deepseek-ai/dsh-tools peer + add dsh-client-ui-primitives to client inject#7
HuanLinOTO wants to merge 1 commit into
vlln:mainfrom
HuanLinOTO:fix/peer-deps-and-client-inject

Conversation

@HuanLinOTO

Copy link
Copy Markdown

Problem

plugin-console crashes at runtime with two distinct bugs:

1. dsh web startup crash: ERR_MODULE_NOT_FOUND: @deepseek-ai/dsh-tools

lib/index.mjs imports defineTool / ToolDefinition from @deepseek-ai/dsh-tools (src/discovery/tools.ts:20), but commit 5ce6bb0 removed it from peerDependencies.

The commit's reasoning no longer applies. The commit message said:

bundle 插件声明官方包(未发布公共 npm)反而失败——git 源安装时 prepare 的 npm install 解析 peer 404。官方包由挂载环境(profile 闭包)注入,不需要也不应声明。

Two things have changed since then:

  • @deepseek-ai/dsh-tools is now on public npm (0.0.1-rc.10.1.0-rc.6), so peer resolution no longer 404s.
  • The plugin no longer has a prepare script (commit 987065d removed it; lib/ is pre-built and committed), so pnpm never runs npm install during git-source install — the peer-404-during-prepare scenario can't trigger.

Without the peer declaration, installation via link: (and on Windows, any path that creates a symlink outside the profile node_modules) causes Node to resolve the plugin's real path outside the profile module closure → ERR_MODULE_NOT_FOUND. The profile provides @deepseek-ai/dsh-tools via healProfilesModuleFallback (symlinks in ~/.dsh/profiles/node_modules/), but Node's parent-directory walk from a symlink target outside the profile never reaches that directory.

See also: #5 (existing issue reporting the same crash).

2. Browser panel crash: dsh.client.inject missing dsh-client-ui-primitives

lib/index.js (the client bundle) calls require("@deepseek-ai/dsh-client-ui-primitives")Panel.tsx imports Button, Input, Pill from it. But dsh.client.inject only listed dsh-client-runtime and dsh-client-ui-slots:

"inject": [
  "@deepseek-ai/dsh-client-runtime",
  "@deepseek-ai/dsh-client-ui-slots"
]

The DSSH module loader uses this list to decide which packages to inject as require()-able modules in the browser bundle. Without dsh-client-ui-primitives in the list, the require() call fails at runtime when the settings panel tries to render.

Fix

 "client": {
   "inject": [
     "@deepseek-ai/dsh-client-runtime",
+    "@deepseek-ai/dsh-client-ui-primitives",
     "@deepseek-ai/dsh-client-ui-slots"
   ],
   "platform": "web"
 }
 ...
 "peerDependencies": {
   "cordis": "^4.0.0-rc.7",
-  "react": "^18.2.0"
+  "react": "^18.2.0",
+  "@deepseek-ai/dsh-tools": "^0.1.0-rc.5"
 }

Verification

Applied these two fixes locally and verified:

  • node -e "import('@dsh-external/plugin-console')" succeeds (exports apply, inject, name — cordis plugin contract)
  • dsh web starts without the ERR_MODULE_NOT_FOUND crash
  • @deepseek-ai/dsh-tools resolves correctly via the profile module closure

Notes

  • Per the DSH plugin development guide (AGENTS.md F2): peerDependencies should include cordis + all used @deepseek-ai/* packages. This PR only restores @deepseek-ai/dsh-tools (the one causing the crash). The client-side @deepseek-ai/* packages (dsh-client-runtime, dsh-client-ui-primitives, dsh-client-ui-slots) could also be declared as peers for full F2 compliance, but they're provided by the host's DSSH module loader at runtime (not via Node module resolution), so they don't cause crashes when omitted. Leaving that as a follow-up decision for the maintainer.
  • The peer version range ^0.1.0-rc.5 matches both the current dsh source (0.1.0-rc.5) and the latest npm release (0.1.0-rc.6).

…-primitives to client inject

Two bugs that crash the plugin at runtime:

1. lib/index.mjs imports @deepseek-ai/dsh-tools but commit 5ce6bb0 removed it
   from peerDependencies (reason: '官方包未发布公共 npm'). The package is now
   on public npm (0.1.0-rc.6). Without the peer declaration, installation via
   link: or git source causes ERR_MODULE_NOT_FOUND when Node resolves the
   plugin's real path outside the profile module closure.

2. lib/index.js (client bundle) calls require('@deepseek-ai/dsh-client-ui-primitives')
   (Panel.tsx imports Button/Input/Pill from it), but dsh.client.inject only
   listed dsh-client-runtime and dsh-client-ui-slots. The DSSH module loader
   has no primitives module to inject → browser-side require fails.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant