dsh-assistant-stream
Export DeepSeek Harness assistant streaming frames as NDJSON.
Give gateways, desktop shells, and debug tools a stable stream to consume in real time.
简体中文 · English
> [!NOTE]
> This is a DSH bundle. `dsh plugin add` installs it, and `cordis.patch.yml` inserts the plugin row automatically.
## Why this plugin
DeepSeek Harness emits assistant output as an event stream: text and reasoning deltas, block ends,
message commits, turn boundaries, and tool fences. The host can subscribe directly, but external
processes cannot consume it in a stable format.
This plugin turns the stream into one JSON object per line. A consumer reads lines, rebuilds the
whole answer in order, and keeps commits and fences aligned.
```mermaid
flowchart LR
A[DSH session] --> B[agent/assistant-stream events]
B --> C[dsh-assistant-stream]
C --> D[NDJSON sink]
D --> E[Gateway preview]
D --> F[Web client]
D --> G[Recording and replay]
```
## Capabilities
| Capability | Behaviour |
| --- | --- |
| One frame format | One JSON object per line, prefixed with `ASSISTANT_STREAM_V1 ` |
| Full lifecycle | `start`, `delta`, `block`, `commit`, and `end` cover one attempt |
| Turn boundaries | `turn-start` and `turn-end` let consumers group by turn |
| Ordering fences | Tool calls, tool results, and usage commits each carry an increasing fence |
| Subagent isolation | Subagent sessions are never exported |
| Custom sink | stderr by default; pass `write` to capture elsewhere |
## Frame types
| `op` | Meaning |
| --- | --- |
| `turn-start` / `turn-end` | Turn boundaries for the root session |
| `start` | A model attempt began; `seq` restarts at 0 |
| `delta` | Incremental `text` or `reasoning` |
| `block` | A completed text or reasoning block |
| `commit` | The committed assistant message for this attempt |
| `event-fence` | Ordering marker for tool calls, results, and usage |
| `end` | The attempt finished, with its outcome |
## Install
```sh
dsh plugin --profile