English · 简体中文
Structured event output for dsh
(DeepSeek Harness) headless runs — the --json that dsh does not have yet.
dsh --profile headless "<task>" prints exactly one line: the final assistant
message. Everything that happened on the way — files read, commands run,
streaming text, token usage — is thrown away.
Not because dsh lacks the data. Its session event bus carries all of it; the headless bundle just summarises and drops it. This plugin subscribes to that bus and mirrors a documented, versioned subset as NDJSON:
{"v":1,"seq":4,"ts":1755690000123,"type":"turn.start","turn":1}
{"v":1,"seq":20,"ts":1755690001456,"type":"tool.call","turn":1,"step":1,"callId":"ab30…","name":"write","arguments":"{\"file_path\":\"note.txt\"}"}
{"v":1,"seq":21,"ts":1755690001789,"type":"tool.result","turn":1,"step":1,"callId":"ab30…","ok":true,"text":"Created file","diffs":[]}
{"v":1,"seq":36,"ts":1755690002012,"type":"text.delta","turn":1,"step":3,"index":0,"text":"hello"}
{"v":1,"seq":42,"ts":1755690002345,"type":"turn.end","turn":1,"ok":true}
stdout is left untouched — the final-message line still goes there, so every existing consumer keeps working. Events go to stderr (or a file).
Every other agent CLI already has this: Claude Code has
--output-format stream-json, Codex has --json, OpenCode has --format json.
If you want to put dsh behind a GUI, an editor extension, CI, or a progress
indicator, you need the same thing.
Persistent — install once, every headless run emits events:
dsh plugin --profile headless add dsh-eventsthen append to ~/.dsh/profiles/headless/cordis.patch.yml:
- insert:
- id: dsh-events
name: 'dsh-events'One-shot — no profile changes:
npm i -g dsh-events
dsh-events "run the tests" # events to stderr
dsh-events --out events.ndjson "run the tests" # events to a file| env | effect |
|---|---|
DSH_EVENTS_OUT |
stderr (default), stdout, or a file path |
DSH_EVENTS_RAW=1 |
also emit untouched dsh events as raw — see the warning in SCHEMA.md before turning this on |
See SCHEMA.md for the full vocabulary and the compatibility
contract. The short version: v only increases on breaking changes, and
consumers must ignore event types and fields they do not recognise.
This plugin was built for OpenLess's voice-agent feature: it needed to show live progress while dsh works, but headless only prints a single line at the end.
OpenLess ships this plugin in production — the same file, pinned to a version. It is listed as an OpenLess affiliated project.
Please file issues here, not on the OpenLess or dsh trackers.
An independent third-party plugin. Not affiliated with or endorsed by DeepSeek.
MIT