DeepSeek Harness Plugin: dsh-plugin-pyrun

Running Python source code in a DSH environment often involves three pain points: a shell escaping nightmare (nested quotes), a two-step cost (write a script first, then execute it), and encoding issues (interference from GBK). dsh-plugin-pyrun is a plugin for DeepSeek Harness (DSH) that pipes model-generated Python source code directly via stdin into python -X utf8 -u -, returning the result in a single step.

Feature Overview

  • Direct stdin execution: source code bypasses the shell and is supplied directly via stdin, avoiding escaping issues and command-line length limits.
  • End-to-end UTF-8: uses python -X utf8 -u - by default, ensuring Chinese characters, emojis, and other symbols round-trip unchanged.
  • Foreground/background modes: supports synchronous foreground execution and asynchronous background execution.
  • Sandbox control: supports sandbox privilege escalation and permission approval, with output truncation handling and logged overflow files.
  • Job management: provides job_output, job_kill, and job_list interfaces for managing background jobs.

Installation

Install using the link: method:

dsh plugin --profile web add link:D:/Projects/dsh-plugin-pyrun

Installation notes:
- link: installation does not install any dependencies into the profile.
- After a successful installation, you must restart dsh for changes to take effect.

Usage

Tool name python; parameters are as follows:

Parameter Type Description
code string (required) Original Python program
workdir string Working directory; defaults to session cwd
timeout_ms number Foreground timeout; not applicable when running in background
run_in_background boolean Background execution mode
sandbox_permissions enum Sandbox privilege escalation mode
justification string Description for approval panel

Result Markers

  • [exit code: N]: non-zero exit code
  • [timed out after Nms]: timeout
  • [aborted]: aborted
  • [stderr]: standard error output
  • [output truncated; full output: <path>]: output truncated; full content is in the file

Background Job Management

  • job_output: collect job output
  • job_kill: stop job
  • job_list: view job roster

Notes

  • Version requirement: supports only DeepSeek Harness 0.2.x runtimes (0.1.x is rejected by the version gate).
  • Runtime environment: requires Node.js >= 22.
  • Dependency contract: core packages must be declared as peerDependencies to avoid tool-call crashes caused by symbol splits.
  • Timeout rules: timeout_ms applies when running in the foreground; it is not applicable in background mode.
  • GitHub: https://github.com/cup113/dsh-plugin-pyrun
  • Ecosystem directory: https://www.skillhub.cn/plugins/cup113/dsh-plugin-pyrun
羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye