Skip to main content

Crate coralstack_cmd_ipc

Crate coralstack_cmd_ipc 

Source
Expand description

Rust port of @coralstack/cmd-ipc.

The wire protocol is byte-identical to the TypeScript library, so Rust and Node.js processes can exchange commands over any channel that carries JSON.

This crate is runtime-agnostic: it depends on the futures primitives only, and does not pull in tokio, async-std, or smol. Users drive the per-channel pump future returned by CommandRegistry::register_channel with the executor of their choice.

See message for the wire format, ttl_map for the storage primitive shared by the registry’s reply/route/event tables, and command / command_service / event / payload for the attribute macros that let you register commands and events next to the code that implements them.

Re-exports§

pub use channel::CommandChannel;
pub use channel::InMemoryChannel;
pub use command::BoxedDynCommand;
pub use command::BoxedHandler;
pub use command::Command;
pub use command::DynCommand;
pub use error::ChannelError;
pub use error::CommandError;
pub use error::ExecuteErrorCode;
pub use error::RegisterErrorCode;
pub use event::DynEvent;
pub use event::Event;
pub use message::CommandDef;
pub use message::CommandSchema;
pub use message::ExecuteError;
pub use message::ExecuteResult;
pub use message::False;
pub use message::Message;
pub use message::MessageId;
pub use message::RegisterResult;
pub use message::True;
pub use registry::CommandRegistry;
pub use registry::Config;
pub use schema::normalize_schema;
pub use ttl_map::TtlMap;
pub use schemars;
pub use serde;
pub use serde_json;

Modules§

channel
Transport abstraction for the command registry.
command
The Command trait and the DynCommand helper.
error
Error types for the command registry.
event
The Event trait and the DynEvent helper.
message
Wire protocol for the command registry.
prelude
Curated re-exports for the common public API.
registry
The CommandRegistry — core routing and execution hub.
schema
Utilities for normalizing JSON Schema values produced by the #[command] macro into language-agnostic JSON Schema suitable for MCP tool schemas and remote GET /cmd.json-style consumers.
ttl_map
A map whose entries expire after a configurable time-to-live.

Attribute Macros§

command
Attach to an async fn (free-standing or inside a #[command_service] impl block) to register it as a typed command.
command_service
Attach to an impl block whose methods are tagged with #[command].
event
Attach to a payload struct to register it as a typed event.
payload
Attach to a plain data struct to auto-derive Serialize, Deserialize, and JsonSchema. Use for command request / response types (and any other struct you want those traits on) so user crates only need to depend on coralstack-cmd-ipc.