open-design/packages/dsh-runtime

88.2kStars10.2kForks815Issues264Watchers

Open Design injects into dsh's profile, using JSONL stdio driver to forward text, thoughts, tools, and usage via dsh, with resumption support.

Language
TypeScript
License
Apache-2.0
Branch
main
agent-skillsai-designbyokclaude-code-for-designclaude-designcodex-designcoding-agentscursor-design

Install

$ dsh plugin --profile web add github:nexu-io/open-design/packages/dsh-runtime

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

One-Line Description

open-design-runtime is a JSONL stdio protocol adapter layer that Open Design injects into the user's local DeepSeek Harness. It allows Open Design to drive the user's locally installed official dsh CLI for design generation tasks without storing credentials or downloading dsh.

Core Features

  • Injects as open-design profile into DeepSeek Harness, using commander to接管启动模式 (take over startup modes: --probe / --models / --stdio)
  • Structures messages like "execute / cancel / session / text / thinking / tool_call / tool_result / usage / result / protocol_error" into a structured protocol via JSONL frames on stdin/stdout
  • Real-time forwarding of Harness text, thinking, tool calls, tool results, and token usage to the host; text folding ignores empty deltas
  • Startup-phase read-only probing of protocol compatibility and model directory (with provider, model name, inference strength options and defaults); keys are never written to frames
  • Cross-process cold resume: session ID is stored by Harness itself; host only needs to provide resume_session_id in the next run
  • Supports mid-flight cancellation: cancel received before execute activation is recorded and immediately replayed when AbortController initializes

Technical Implementation

  • Language: TypeScript (ESM)
  • Key Dependencies:
    • @deepseek-ai/dsh-cordis 4.0.1 (plugin container)
    • @deepseek-ai/dsh-cmdline 0.1.0-rc.6 (command line parsing)
    • commander 15.0.0 (CLI framework)
  • Architecture Pattern: Uses cordis.patch.yml to rewrite dsh's system-prompt as Open Design's avatar and disables hmr; simultaneously registers two Cordis services with the host: open-design-startup (mode setting) and open-design-runtime (session driving)
  • Entry Files: packages/dsh-runtime/src/index.ts (apply), packages/dsh-runtime/src/startup.ts (startup mode parsing), packages/dsh-runtime/src/protocol.ts (frame definitions)

Use Cases

Users who have already installed and configured DeepSeek Harness and want to integrate the model capabilities from dsh into Open Design. This allows Open Design to uniformly manage prompts, model switching, session resumption, and mid-flight cancellation, while keeping the API Key in dsh's Web UI. Open Design no longer stores secrets additionally; files are written by Harness directly to OD's current project directory, which can be directly consumed by OD's existing real-time preview pipeline.

Prerequisites & Compatibility

DependencyMinimum VersionDescription
DeepSeek Harness0.1.0-rc.6+Provided by the user's locally installed official dsh CLI; not included with this plugin
Node.js>=24Plugin runtime itself (inside dsh process)
PlatformCross-platformDepends on user's local dsh installation; README provides bootstrap installation scripts for both macOS/Linux and Windows
Native ModulesNonePure Node stdio protocol, no native dependencies like better-sqlite3 / node-pty

Installation

dsh plugin --profile web add github:nexu-io/open-design

Configuration

This plugin has no standalone configuration options for end users; runtime parameters such as cwd, prompt, model, and inference strength are sent by the host (Open Design main program) via the JSONL protocol, and the plugin itself only accepts runtime mode switches:

ConfigTypeDescriptionDefault
Startup ModeEnumThree mutually exclusive switches: --probe exits after outputting protocol compatibility info; --models exports model directory and exits; --stdio enters formal dialogue loopDetermined by host at launch
Cancel RequestProtocol CommandUpon receiving cancel { request_id }, immediately terminates the corresponding request; requests already in the pipeline are delayed until execute activation for replayNone

FAQ

Q: Do I have to install DeepSeek Harness first?

A: Yes. The plugin does not download or install dsh itself. Users need to first use the bootstrap installation script provided by Open Design (macOS/Linux: curl … install-dsh.sh; Windows: irm install-dsh.ps1) to install the official dsh and configure the model API Key in Harness's Web UI.

Q: Will my API Key be stored in Open Design?

A: No. Open Design only stores credentials in dsh's Web UI in write-only mode; Open Design neither reads nor writes back Key plaintext. At runtime, dsh is asked to read its own configured key on demand.

Q: Will each design task start a new dsh process?

A: Yes. Open Design starts a short-lived dsh --profile open-design --stdio process for each run. Harness session storage handles cross-process cold resume, so there's no need to carry session ID in CLI parameters.

Q: What if I want to stop halfway?

A: The protocol layer supports mid-flight cancellation. The host sends cancel command to abort immediately; the plugin also preserves request-level intent during the window when AbortController is not yet initialized and replays when execute activates.

Q: Can one process run multiple tasks simultaneously?

A: No. Each profile process accepts exactly one execute command; the second one will be rejected with DSH_PROFILE_BUSY. For concurrency, the host should spawn multiple processes.

Q: How do I uninstall this connector?

A: Uninstall via od agent setup deepseek-harness or DSH's own dsh plugin --profile open-design remove. DSH's own installation, credentials, and model configurations will not be affected.

Q: Will generated files stay in the Open Design project?

A: Yes. Harness writes files to OD's current project working directory; file watching and real-time preview are handled by Open Design's existing artifact pipeline.

Q: What happens if protocol handshake fails?

A: The probing phase only prints a JSON object with failure info; Open Design still keeps DeepSeek Harness in the "Installed CLI" list and shows "Connector Installation Required". Users need to confirm again to reinstall via this plugin's dsh.

Difficulty

Advanced — Users need to first independently install and configure DeepSeek Harness (including API Key), and understand that Open Design does not copy secrets. After understanding, users only need to let Open Design auto-discover dsh to start using it.

Known Issues & Limitations

  • Each dsh --profile open-design --stdio process only accepts one execute command; sending a second command will be rejected with DSH_PROFILE_BUSY (src/index.ts:422-431)
  • Process exit has a 1-second minimum fallback: rc.6 may have root release precede launcher's file watcher attachment when host stdin is still open; the plugin kicks in a process.exit fallback (src/index.ts:124-135)
  • Harness-reported exceptions like blocked / missing turn_end / already aborted are all normalized to DSH_PROFILE_TURN_FAILED / DSH_PROFILE_TURN_BLOCKED / DSH_PROFILE_MISSING_TURN_END error codes; host needs to prompt users to retry at the UI layer
  • The plugin itself does not carry dsh executables, Node.js, credentials, or provider configurations; users need to supplement any missing items on the other side