1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
//! # `kimi-wire`
//!
//! Typed Rust client for the [Kimi Code CLI Wire protocol](https://www.kimi.com/code/docs/en/kimi-code-cli/customization/wire-protocol.html).
//!
//! ## 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 ([`protocol::event::Event`], [`protocol::request::Request`], [`protocol::method::PromptResult`], ...).
//! * A [`WireClient`] trait with high-level methods (`prompt`, `replay`, `steer`, ...).
//! * A [`transport::Transport`] abstraction for stdio, in-memory channels, or custom backends.
//! * Optional secret redaction for wire logs.
//!
//! ## Feature flags
//!
//! | Feature | Description |
//! |---------|-------------|
//! | `process` (default) | Enables [`transport::ChildProcessTransport`] for spawning `kimi --wire`. |
//! | `redact` (default) | Enables [`protocol::redact::redact_secrets`] for scrubbing secrets from JSON. |
//!
//! ## Example
//!
//! ```no_run
//! use kimi_wire::{InMemoryWireClient, WireClient};
//!
//! # async fn example() -> Result<(), Box<dyn std::error::Error>> {
//! let mut client = InMemoryWireClient::new();
//! let result = client.prompt("hello").await?;
//! # Ok(())
//! # }
//! ```
/// Client trait and in-memory implementation for the Wire protocol.
/// Extension traits for [`WireClient`].
/// Ready-made dispatch loop for wire conversations.
/// Error types for wire protocol failures.
/// Message parsing: `RawWireMessage` → typed [`WireMessage`](crate::message::WireMessage).
/// Protocol types: JSON-RPC, events, requests, methods, and content parts.
/// Transport implementations (child process, channels).
pub use ;
pub use ;
pub use WireError;
pub use redact_secrets;
/// The latest wire protocol version supported by this crate.
pub const WIRE_PROTOCOL_VERSION: &str = "1.10";
/// Legacy protocol version used when the server does not support `initialize`.
pub const WIRE_PROTOCOL_LEGACY_VERSION: &str = "legacy/no-handshake";