Skip to main content

dshcode/packages/bundle/headless

90Stars8Forks0Issues1Watchers

Adds a one-shot task profile to dsh: runs the Agent with a given task text, prints the final response, then exits. Designed for scripts and CI pipelines.

Evidence5/5methodologySourceInstallMaintenanceDSH versionSecurity scan
Machine-auditedInstall commandRepo verifieddsh-plugin topicLicenseREADMEAI wiki

ⓘ This plugin is a sub-package of the whitelonng/dshcode monorepo — stars and activity count the whole repository.

Language
TypeScript
License
MIT
Branch
master
agentdeepseekdeepseekharness-plugindsh-pluginharness

Install

cmdweb profile
$ dsh plugin --profile web add @deepseek-ai/dsh-headless

Run the command above in your terminal to install this plugin via the dsh CLI. You can switch Profile in the top-right corner. New to dsh? Read the beginner tutorial

Install via your agent

Install the DeepSeek Harness plugin whitelonng/dshcode/packages/bundle/headless for me: review the repository at https://github.com/whitelonng/dshcode first, then run the install command and verify the plugin loads successfully.

Paste this instruction to the DSH Web GUI assistant — it will install and verify for you.

Entry package name: @deepseek-ai/dsh-headless, landing page ID: whitelonng/dshcode/packages/bundle/headless. Referred to as "headless bundle" below.

One-Line Positioning

Built on top of the dsh-base bundle, it adds a "one-shot task" driver, allowing users to hand a task to the Agent via dsh --profile headless "<task text>". The Agent completes the task (or errors out), prints the final response, and exits directly. It does not start Host, HTTP server, Web runtime, or browser, making it the thinnest form for invoking dsh in CI and scripts.

Core Capabilities

  • Stacks directly on dsh-base, providing the coding persona and tools mode (cordis.patch.yml:7-20)
  • Disables HMR,挂载 Code Mode's worker as the core execution capability (cordis.patch.yml:14-20、:23-26)
  • One process accepts only one task: parses positional argument task via commander (multiple words merged with space), prints usage error and exits 1 when missing or pure whitespace (src/startup.ts:31-57)
  • Creates a brand new persistent Agent, submits the task as a regular user message, and flushes the session after Agent returns to idle (src/index.ts:96-127)
  • Extracts the last non-empty assistant text within this task interval and writes to stdout; exits 0 when final turn/end reason is completed, exits 1 for other cases; on error, appends code: message to stderr (src/index.ts:60-134)

Technical Implementation

  • Language: TypeScript (ESM modules)
  • Key Dependencies: @deepseek-ai/dsh-cmdline (CLI host), @deepseek-ai/dsh-code-runtime-worker-thread (Code Mode worker), @deepseek-ai/schemastery (Config schema), commander (CLI parsing) (package.json:46-51)
  • Architecture Pattern: Cordis bundle patch — declares cordis.patch.yml via package.json#dsh.bundle.patch, inserts override lines for system-prompt/hmr/tools and three insert lines (code-runtime / headless-startup / headless-runner) on top of base; headless-runner is a regular function plugin, headless-startup provides headlessStartup service for lazy config reading by the former (cordis.patch.yml:1-35、src/startup.ts:19)
  • Entry Files: src/index.ts (runner, name = 'headless-runner'), src/startup.ts (CLI provider, name = 'headless-startup'), cordis.patch.yml (bundle injection)

Use Cases

Use dsh as a command-line tool — for example, let Agent run a code review in CI, temporarily ask about file writing in a shell script, or hang daily report generation on dsh in cron, rather than opening Web UI interaction. It fits the "one task - one response - process ends" scenario, not multi-turn conversations requiring follow-up questions.

Prerequisites & Compatibility

DependencyMinimum VersionDescription
DSHNot declared separately; released with dsh 1.0.5Only activates when installed to a profile already using dsh launcher; runner forcibly depends on launcher-provided ctx.appExit
Node^22.19.0 || >=24.0.0From engines field in repository root package.json:8-10
PlatformmacOS / Linux / WindowsCross-platform; this package has no native modules
Native ModulesNoneThis package introduces no native modules; base's sandbox and similar lines may introduce some

This package depends on workspace packages @deepseek-ai/dsh-agent / @deepseek-ai/dsh-llm / @deepseek-ai/dsh-session and other base packages (package.json:52-59), which are indirectly installed via dsh-base.

Installation

dsh plugin --profile web add github:whitelonng/dshcode/packages/bundle/headless

Configuration

This plugin does not expose a separate configuration surface to users; the only adjustable field is the "task text" it reads from the launcher:

ConfigTypeDescriptionDefault
headless-runner.taskstringThe prompt text this runner should execute; automatically populated from the positional argument of launcher --profile headless "..."; blank tasks are rejected at startupProvided by command line dsh --profile headless "<task>"
system-prompt.personastringTemplate string, injects {{model}} and {{cwd}} into system prompt. Normal users don't need to change it; overridden by their own profile"You are a coding agent powered by the {{model}} model. Your working directory is {{cwd}}."
hmr.disabledbooleanheadless profile forcibly disables HMR (cordis.patch.yml:14-15)true
tools.mode (env DSH_TOOLS_MODE)stringCode Mode process-level switch, same origin as Web profileFrom process.env.DSH_TOOLS_MODE

FAQ

Q: What's the difference between this bundle and dsh-base?

A: base injects 60+ capabilities including basic tools, models, persistence, etc. as a "factory default set"; headless only stacks a minimal driver layer on top of base — no Host, HTTP server, Web runtime, or browser plugins; each process accepts only one task, prints final assistant text after running, then exits 0/1.

Q: What do the process exit codes mean?

A: Exit 0 when the final turn's reason is completed; exit 1 when aborted or error. In error cases, stderr additionally outputs a line dsh: <code>: <message>; on success, stderr is empty (see src/index.ts:130-133).

Q: What happens if I run it without task text?

A: The launcher first prints usage error a task is required, for example: dsh --profile headless "run the tests" and exits 1; the runner is rejected before receiving the service and won't start an Agent (see src/startup.ts:53-55、tests/startup.spec.ts:91-97).

Q: Can I use this profile outside dsh launcher?

A: No. The runner must obtain the exit request service from the host before mounting; starting outside the launcher throws directly during activation: headless-runner: the launcher must provide ctx.appExit before the tree mounts (see src/index.ts:144-147、tests/headless.spec.ts:243-246).

Q: Can I run multiple tasks in one process?

A: No. Each dsh --profile headless call only submits one task and waits for it to return to idle; to run again you must restart a new process. The profile is nominally an interactive backend, but actually a single-shot task runner (see README.md:19).

Q: What are the default HMR and Code Mode states?

A: HMR is explicitly disabled under headless profile; Code Mode is controlled by the DSH_TOOLS_MODE environment variable — the value determines whether to enable worker thread code execution, same origin as Web profile (see cordis.patch.yml:14-20).

Q: Where is session data stored?

A: Handled by dsh-base's session-persistence-jsonl layer, stored in $DSH_HOME/sessions; headless does not have its own storage layer.

Q: Which model does the Agent use?

A: Follows dsh-base's agent-default-model default (deepseek-official / deepseek-v4-flash). To change models, override this line by ID in your profile's cordis.patch.yml.

Learning Curve

Beginner — the command itself is a positional argument; if running only once, you don't even need to look at configuration; to customize default model or persona, just override in your profile's patch file.

Known Issues & Limitations

  • One task per process: The runner has no interactive follow-up input; after submitting the task, it waits for Agent to return to idle, then prints the last non-empty assistant text within the interval (README.md:19)
  • ctx.appExit is held by launcher: Starting headless profile outside dsh launcher throws an error directly at activation until the host provides that exit request (README.md:20、src/index.ts:144-147)
  • Blank tasks rejected at startup: Purely blank or missing task doesn't start Agent; process exits with 1 (src/startup.ts:53、tests/startup.spec.ts:91-97)
  • HMR not enabled in headless profile: Single-shot processes don't need hot updates; patch explicitly sets disabled: true (cordis.patch.yml:14-15)

Read the usage guide →

Install steps, key points, FAQ and compatibility for this plugin — auto-derived from indexed fields.

Listing badge

Listed on deepseek-plugin.org
[![Listed on deepseek-plugin.org](https://img.shields.io/badge/listed_on-deepseek--plugin.org-007EC6)](https://deepseek-plugin.org/plugins/whitelonng/dshcode/packages/bundle/headless)

Paste this markdown into your GitHub README to link back to this listing. The badge only states the listing — not a security endorsement.

← Back to plugin directory