Skip to main content

Crate deepseek_harness_sdk_rs

Crate deepseek_harness_sdk_rs 

Source
Expand description

§deepseek-harness-sdk-rs

Drive a DeepSeek Harness runtime from Rust. The SDK spawns the packaged dsh CLI (--profile sdk) as a subprocess and speaks the line-delimited JSON-RPC 2.0 protocol over its stdio (protocol reference); the CLI is distributed in the deepseek-harness-runtime-bin wheel also used by the Python SDK.

use std::path::PathBuf;
use deepseek_harness_sdk_rs::{DeepSeekHarness, DeepSeekHarnessConfig, RunOptions};

let harness = DeepSeekHarness::new(DeepSeekHarnessConfig {
    dsh_home: Some(PathBuf::from("/absolute/path/to/isolated-dsh-home")),
    ..Default::default()
});
let result = harness.run("say hi", &RunOptions::default()).await?;
println!("{}", result.final_response);
harness.close().await;

The runtime launches as the packaged dsh CLI with --profile sdk. Managed launches require an explicit Harness home (dsh_home or a non-empty DSH_HOME); the SDK never discovers ~/.dsh. Without any launch configuration the runtime-download feature (on by default) fetches the platform runtime wheel from PyPI, verifies its SHA-256 digest, and caches the executable and its sidecars. Callers who spawn their own runtime pass runtime_bin or launch_args_override and can disable the feature. A blocking facade (DeepSeekHarnessSync) covers synchronous callers.

Re-exports§

pub use api::DeepSeekHarness;
pub use api::DeepSeekHarnessConfig;
pub use api::DeepSeekHarnessSync;
pub use api::Input;
pub use api::RunOptions;
pub use api::RunResult;
pub use api::Session;
pub use client::ApprovalOutcome;
pub use client::ApprovalRequestParams;
pub use client::ApprovalRequestResult;
pub use client::HarnessClient;
pub use client::HarnessClientOptions;
pub use client::IncomingRequest;
pub use client::InitializeParams;
pub use client::InitializeResult;
pub use client::Notification;
pub use client::ServerInfo;
pub use client::UserQuestionAnswer;
pub use client::UserQuestionAnswerItem;
pub use client::UserQuestionCancellation;
pub use client::UserQuestionHandler;
pub use client::UserQuestionRequest;
pub use error::SdkError;

Modules§

api
The high-level own-runtime API: DeepSeekHarness, Session, and run — the design twin of the Python SDK’s DeepSeekHarness / Session / run, with an async core and a thin blocking facade (DeepSeekHarnessSync).
client
The low-level HarnessClient: the SDK protocol client underneath the high-level crate::api::DeepSeekHarness API. It owns the runtime subprocess, the initialize/session_prompt/shutdown requests, the notification subscription fan-out with session-tree scoping, native user questions, and the shutdown ladder.
error
Error taxonomy of the SDK client, mirroring the Python SDK’s error classes.
events
Structural extraction over the opaque session-event stream.
runtime
Runtime acquisition: the feature-gated downloader that fetches the platform runtime wheel from a PyPI-style index, verifies its SHA-256 digest, and extracts the packaged dsh executable, its sidecars, and the platform resource directory into a versioned cache.

Structs§

NotificationSubscription
A notification subscription; next() waits for the next matching notification and try_next() polls without blocking. When the runtime closes, the subscription delivers the terminal error after draining queued notifications, mirroring the Python SDK’s per-subscriber queues.

Type Aliases§

NotificationFilter
Per-subscription predicate, evaluated by the reader task.