DeepSeek Harness (Rust)

August 13, 2026 · View on GitHub

English | 中文

Made by BitFun.

Rust implementation of DeepSeek Harness: an append-only session log, a turn/step agent loop, capability ports, and a DeepSeek streaming adapter. Crate layout follows BitFun's layered backend (contracts → execution → services → adapters → assembly → apps).

This is not a Cordis port. Composition is Cargo features plus an assembly crate. Live extension uses typed events and waterfalls. Concrete OS and provider behavior stays behind ports.

Requirements

  • Rust 1.88+
  • A DeepSeek API key for live runs (DEEPSEEK_API_KEY)

Quick start

cp .env.example .env   # set DEEPSEEK_API_KEY
cargo run -p dsh-cli -- --profile headless "Summarize this repository."

Dump the assembled runtime without calling a model:

cargo run -p dsh-cli -- --dump-config

ACP stdio server:

cargo run -p dsh-cli -- acp

Tests use an in-process mock LLM and do not need a key:

cargo test --workspace
cargo clippy --workspace --all-targets -- -D warnings
python3 scripts/check-crate-boundaries.py

Layout

Dependencies flow downward only. See docs/architecture.md.

LayerPathOwns
Appssrc/apps/clidsh CLI and ACP stdio entry
Interfacessrc/crates/interfaces/acpAgent Client Protocol server
Assemblysrc/crates/assembly/coreDelivery profiles and wiring
Adapterssrc/crates/adaptersDeepSeek SSE + mock LLM
Servicessrc/crates/servicesFS, subprocess, shell, credentials, JSONL persist
Executionsrc/crates/executionSession log, loop, tools, prompt, stream assembler
Contractssrc/crates/contractsDTOs, events, ports

Configuration

Environment (also loaded from .env in cwd and the harness home):

VariableMeaning
DEEPSEEK_API_KEYCredential reference target (never stored in config)
DEEPSEEK_BASE_URLChat-completions base; /chat/completions is appended
DSH_MODELWire model id (default deepseek-chat)
DSH_PROVIDERProvider route (default deepseek)
DSH_HOMEHarness home (default ~/.dsh-rust)

dsh --profile headless selects the headless delivery profile: agent loop, local FS/shell tools, JSONL persistence, DeepSeek adapter.

License

MIT. Session-log and loop semantics follow DeepSeek Harness; crate boundaries follow BitFun.