kimi-wire
Typed Rust client for the Kimi Code CLI Wire protocol.
Overview
The Wire protocol is a JSON-RPC 2.0 based bidirectional communication protocol exposed by kimi --wire. This crate provides:
- Strongly typed protocol structs —
Event,Request,PromptResult,DisplayBlock,ContentPart, ... - A
WireClienttrait — high-level async methods (prompt,replay,steer,set_plan_mode,cancel). - A
Transportabstraction — stdio via child process, in-memory channels, or custom backends. - Optional secret redaction — scrub secrets from JSON wire logs.
Quick start
Add to your Cargo.toml:
[]
= "0.1"
Mock client (testing)
use ;
async
Process transport
use ;
async
Architecture
For protocol lifecycle, bidirectional request handling, object-safety notes, and design rationale, see docs/architecture.md.
Feature flags
| Feature | Default | Description |
|---|---|---|
process |
✅ | Enables ChildProcessTransport for spawning kimi --wire. |
redact |
✅ | Enables redact_secrets for scrubbing secrets from JSON. |
Protocol version
This crate targets Wire protocol version 1.10 as documented by Moonshot AI. It includes forward-compatible Option<T> fields for newer extensions.
MSRV
Rust 1.80 (required for std::sync::LazyLock).
License
MIT