Skip to main content

lilo_rm_core/
lib.rs

1//! Runtime Matters core protocol types and JSON line transport helpers.
2//!
3//! This crate is the stable contract shared by `rtm` clients and rtmd. The
4//! daemon, CLI, platform, launcher, and store crates remain private
5//! implementation details.
6//!
7//! ## Events contract
8//!
9//! v0.2 events use [`RuntimeRpc::Events`] and
10//! [`RuntimeResponse::Events { events }`](RuntimeResponse::Events). The response
11//! is the current daemon process vector in append order. rtmd appends
12//! [`RuntimeEvent::Running`] when shim ready is stored, then appends
13//! [`RuntimeEvent::Terminated`] or [`RuntimeEvent::Lost`] when exit or loss
14//! evidence is observed.
15//!
16//! Events are kept only in the current daemon process memory. There is no v0.2
17//! cursor, retention window, sqlite replay, or limit policy. Clients such as
18//! session-matters should poll, filter to their session set, and dedupe by
19//! session id plus full event content. Cursor based
20//! `Events { since } -> { cursor, events }` support is deferred to v0.3.
21
22pub mod admin;
23pub mod error;
24pub mod launcher;
25pub mod mcp;
26pub mod proto;
27pub mod spawn_context;
28pub mod tool_contracts;
29pub mod types;
30mod version;
31
32pub use admin::{
33    DoctorResponse, KillByPidRequest, KillByPidResponse, LauncherStatus, LifecycleCounts,
34    MigrationState, RecentLostEvent, StatusFilter, StatusResponse, TmuxStatus, WatcherCounts,
35};
36pub use error::{ErrorCode, ProtocolError, RuntimeKindParseError};
37pub use launcher::{LaunchEnv, LaunchSpec, LauncherError, RuntimeLauncher};
38pub use mcp::{
39    JsonRpcError, JsonRpcRequest, JsonRpcResponse, MCP_PROTOCOL_VERSION, McpBridgeRequest,
40    McpBridgeResponse, json_rpc_error, json_rpc_failure, json_rpc_result, tool_error, tool_success,
41};
42pub use proto::{
43    RuntimeResponse, RuntimeRpc, StatusRequest, read_json_line, read_json_line_blocking,
44    write_json_line, write_json_line_blocking,
45};
46pub use spawn_context::{
47    CALLER_ENV_DENYLIST, CALLER_ENV_DENYLIST_PREFIXES, capture_caller_cwd, capture_caller_env,
48    capture_env_from, capture_env_from_os, launcher_probe_cwd,
49};
50pub use types::{
51    HeadlessSpawnTarget, KillRequest, Lifecycle, LifecycleState, LostEvidence, NudgeFailureReason,
52    NudgeOutcome, NudgeRequest, NudgeResponse, RuntimeEvent, RuntimeExit, RuntimeKind,
53    RuntimeSignal, RuntimeSignalParseError, ShimExit, ShimLaunchRequest, ShimReady, SpawnRequest,
54    SpawnTarget, SpawnTargetParseError, TerminationEvidence, TmuxAddress, TmuxAddressParseError,
55    TmuxSpawnTarget, ValidateTargetOutcome, ValidateTargetRequest, ValidateTargetResponse,
56};
57pub use version::{
58    RUNTIME_PROTOCOL_CAPABILITIES, RUNTIME_PROTOCOL_VERSION, RuntimeCapability, VersionInfo,
59    version_info,
60};