DSH Desktop embeds the server in the Electron main process. Invoking the built-in pwsh or shell returns a completely empty result: the command is not executed, it has no side effects (no files are created, no processes are started), and the GUI displays a blank screen or “(no output)”.
This plugin is intended to fix this issue. It uses a self-healing mechanism to repair the missing environment variable injection in the DSH sandbox runner and provides a pwsh_direct tool that directly invokes PowerShell through a Node.js child process before the fix takes effect or after an upgrade overwrites the patch.
Plugin Overview¶
- Plugin name:
dsh-pwsh-direct - One-line description: Bug fix for empty
pwsh/shellresults in DSH Desktop (Windows) +pwsh_directdirect-invocation fallback tool - Maintainer: 0x1a27
- Category: Client
- License: MIT
Core Features¶
1. Self-healing (root fix)¶
Each time DSH starts, the plugin patches the installed dsh-subprocess-local (including the copy in the installation directory and all profile copies). It injects ELECTRON_RUN_AS_NODE=1 into the sandbox runner’s spawn environment. After restarting DSH Desktop, the built-in pwsh/shell works normally again.
2. pwsh_direct fallback tool (workaround)¶
During the window before a restart takes effect, or when a DSH upgrade removes the patch, you can use pwsh_direct to spawn the PowerShell executable directly. This approach completely bypasses the DSH subprocess service layer and executes commands directly with DSH process permissions.
Installation and Enablement¶
The installation command is as follows:
dsh plugin --profile web add <插件目录路径>
Notes:
* You must use the --profile parameter during installation (the local path generates a link: dependency).
* After installation, you must restart DSH Desktop for the self-healing mechanism to take effect.
Uninstallation command:
dsh plugin --profile web remove dsh-pwsh-direct
Usage Examples¶
Check the self-healing status:
node lib\electron-runner-heal.mjs
Use the fallback tool to execute a simple command:
pwsh_direct { "command": "Write-Output ok" }
Run the smoke test:
node smoke-test.mjs
Environment and Limitations¶
- Platform: Windows only.
- Node version: Node.js >= 20.
- Permission requirements:
- The plugin modifies files under the DSH installation directory (
Program Files) and profile directories. Ifwrite-failedoccurs, run DSH Desktop once as an administrator. pwsh_directhas no sandbox and executes commands directly with DSH process permissions. Please be careful when performing high-risk operations.
- The plugin modifies files under the DSH installation directory (
- Dependencies:
@deepseek-ai/dsh-tools(optional peer dependency, provided by the DSH host environment).@chaggle/dsh-powershell-check(optional peer dependency, used for PowerShell pitfall gating).
Common Troubleshooting¶
| Symptom | Possible Cause | Resolution |
|---|---|---|
Built-in pwsh still returns empty results after restart |
The installed copy was not patched (write-failed), or the restart did not truly take effect |
Run node lib\electron-runner-heal.mjs to check the status. If write-failed appears, run DSH Desktop once as an administrator and restart. |
| Host logs report that a peer dependency cannot be parsed | The plugin is not installed in the profile that provides that peer dependency | Use dsh plugin --profile <name> add <path> to install the plugin into the correct profile. |