Skip to main content

Crate exomonad_core

Crate exomonad_core 

Source
Expand description

ExoMonad Core: effect system, WASM hosting, MCP server, built-in handlers, shared types.

§Architecture

WASM Guest (Haskell) - pure logic
    │
    │ yield_effect(EffectEnvelope)
    ▼
PluginManager (single host function: yield_effect)
    │
    │ EffectRegistry::dispatch by namespace
    ▼
EffectHandler implementations (git, github, agent, fs, ...)

§Features

  • runtime (default): Full runtime with WASM hosting, effect handlers, MCP server, and all service integrations. This is what the exomonad binary uses.
  • Without runtime: Only lightweight UI protocol types (ui_protocol module). Used by exomonad-plugin (Zellij WASM target) which can’t link heavy native deps.

§Usage

use exomonad_core::{RuntimeBuilder, EffectHandler, EffectResult};
use async_trait::async_trait;

struct MyHandler;

#[async_trait]
impl EffectHandler for MyHandler {
    fn namespace(&self) -> &str { "my_domain" }
    async fn handle(&self, effect_type: &str, payload: &[u8]) -> EffectResult<Vec<u8>> {
        todo!()
    }
}

let runtime = RuntimeBuilder::new()
    .with_effect_handler(MyHandler)
    .with_wasm_bytes(wasm_bytes)
    .build()
    .await?;

Re-exports§

pub use common::ErrorCode;
pub use common::ErrorContext;
pub use common::HostError;
pub use common::HostResult;
pub use effects::EffectError;
pub use effects::EffectHandler;
pub use effects::EffectRegistry;
pub use effects::EffectResult;
pub use plugin_manager::PluginManager;
pub use domain::AbsolutePath;
pub use domain::DomainError;
pub use domain::GithubOwner;
pub use domain::GithubRepo;
pub use domain::IssueNumber;
pub use domain::PathError;
pub use domain::Role;
pub use domain::SessionId;
pub use domain::ToolName;
pub use domain::ToolPermission;
pub use error::ExoMonadError;
pub use error::Result;
pub use ffi::ErrorCode as FFIErrorCode;
pub use ffi::ErrorContext as FFIErrorContext;
pub use ffi::FFIBoundary;
pub use ffi::FFIError;
pub use ffi::FFIResult;
pub use hooks::HookConfig;
pub use logging::init_logging;
pub use logging::init_logging_with_default;
pub use protocol::ClaudePreToolUseOutput;
pub use protocol::ClaudeStopHookOutput;
pub use protocol::GeminiStopHookOutput;
pub use protocol::HookEventType;
pub use protocol::HookInput;
pub use protocol::HookSpecificOutput;
pub use protocol::InternalStopHookOutput;
pub use protocol::PermissionDecision;
pub use protocol::Runtime as ProtocolRuntime;
pub use protocol::StopDecision;
pub use util::build_prompt;
pub use util::find_exomonad_binary;
pub use util::shell_quote;
pub use handlers::AgentHandler;
pub use handlers::CopilotHandler;
pub use handlers::FilePRHandler;
pub use handlers::FsHandler;
pub use handlers::GitHandler;
pub use handlers::GitHubHandler;
pub use handlers::LogHandler;
pub use handlers::PopupHandler;
pub use services::Services;
pub use services::ValidatedServices;

Modules§

common
domain
Domain types with parse-at-edge validation.
effects
Extensible effects system with protobuf binary encoding.
error
Error types for exomonad.
ffi
handlers
Namespace-based effect handlers for the extensible effects system.
hooks
Hook configuration generation for Claude Code.
layout
Generate Zellij KDL layouts for ExoMonad agents.
logging
Logging utilities for exomonad.
mcp
MCP (Model Context Protocol) server.
plugin_manager
WASM plugin hosting with single yield_effect host function.
prelude
Prelude module for convenient imports.
protocol
Protocol types for the control envelope.
services
ui_protocol
UI protocol and types for ExoMonad TUI integration.
util
Shared utilities for exomonad binaries.

Structs§

Runtime
Configured runtime with WASM plugin and effect handlers.
RuntimeBuilder
Builder for constructing a runtime with custom effect handlers.

Functions§

register_builtin_handlers
Register all built-in handlers with a RuntimeBuilder.