DeepSeek Harness Plugin

ninetyhe-90/dsh-assistant-stream

Stars ★ 0 Category Development & Runtime Added 2026-10-22

Mirrors assistant streaming frames (deltas, blocks, commits, turn fences) to a configurable NDJSON sink for external consumers.

Install

# from GitHub (first run asks for allowBuilds approval — follow the hint, retry)

dsh plugin --profile web add github:ninetyhe-90/dsh-assistant-stream

Any plugin you install runs third-party code with your own permissions — it can read your files, use your credentials, and reach the network, and tool approvals don’t sandbox it. GitHub-sourced plugins also run build scripts at install time — pnpm blocks those until you allow them, so an install can stop with ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED or ERR_PNPM_IGNORED_BUILDS; dsh prints the exact key to add under allowBuilds in your profile’s pnpm-workspace.yaml, and the install works on the next run. Allowing a build is a trust decision: only install sources you trust, and pin a commit (github:owner/repo#sha).

README

[!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.

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

dsh plugin --profile <name> add dsh-assistant-stream
dsh plugin --profile <name> add /path/to/dsh-assistant-stream
dsh plugin --profile <name> add github:ninetyhe-90/dsh-assistant-stream

Configuration

Field Type Default Description
readTurnId () => string | undefined DSH_TURN_ID Request id for the current turn
write (line: string) => void stderr Receives each NDJSON line

When readTurnId is missing or returns empty, requestId falls back to session.id.

Compatibility

  • Node.js 20.11+
  • DeepSeek Harness 0.2.x (agent/assistant-stream, session/event)
  • Builds without session.requestContext skip the usage fence; other frames are unaffected

Layout

src/assistant-stream.mjs        plugin entry and frame export
test/assistant-stream.test.mjs  behaviour tests (node:test)
cordis.patch.yml                bundle layer

Development

npm test
npm run check

Roadmap

  • Text and reasoning deltas
  • Turn boundaries and tool fences
  • Subagent isolation
  • Bundle packaging
  • npm release
  • Browser consumer example

License

MIT

Content from the project README on GitHub ↗

Links

More in this category

View the whole category →

Community comments

Comments are public GitHub Discussions. Loading them connects to GitHub and Giscus; a GitHub account is required to post.