Skip to content

Repository files navigation

dsh-agent-sdk

@compforge/dsh-agent-sdk is a session-first TypeScript SDK for embedding DeepSeek Harness in another application. It owns the DSH JSON-RPC runtime process, keeps native sessions reusable, and exposes each turn as both a live event stream and a completion result.

The SDK is intentionally independent of Baton. Baton, another TUI, an IDE, or a service can translate the same native DSH events into its own interaction model.

Install

pnpm add @compforge/dsh-agent-sdk

Node.js 22.19 or newer is required. The caller must also provide a DSH JSON-RPC runtime executable and a Cordis configuration containing @deepseek-ai/dsh-sdk-jsonrpc-server.

Quick start

import { DshClient } from "@compforge/dsh-agent-sdk";

await using dsh = new DshClient({
  runtime: {
    command: "dsh-jsonrpc-agent",
    args: ["/path/to/cordis.yml"],
  },
  cwd: process.cwd(),
  provider: "deepseek-official",
  model: "deepseek-v4-flash",
});

const session = dsh.session();
const turn = session.send("Inspect this repository and explain its architecture.");

for await (const event of turn) {
  console.log(event.method, event.params);
}

const result = await turn.result;
console.log(result.finalResponse);

Pass a known native session id to continue it:

const session = dsh.session("existing-session-id");
const result = await session.run("Continue from the previous result.");

Only one SDK-owned turn may be active on a session. Different sessions can run concurrently on the same DSH runtime.

Current protocol capabilities

The underlying DSH stdio protocol currently supports reusable sessions, streaming root and subagent notifications, and graceful runtime shutdown. It does not yet expose mid-turn cancel, queue steering, or server-to-client approval and question requests. DSH_AGENT_SDK_CAPABILITIES reports these limits explicitly so hosts do not advertise controls the runtime cannot honor.

The public client and session API does not expose JSON-RPC details. When the upstream protocol gains those controls, they can be added without changing how callers create clients or select sessions.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages