Skip to main content

soothe_client/
lib.rs

1//! Soothe WebSocket client for talking to a running soothe-daemon.
2//!
3//! Public surface mirrors Python / Go / TypeScript RFC-629 tiers:
4//!
5//! ```text
6//! Need                         → Entry point
7//! One conversation, stream     → appkit::DaemonSession
8//! Jobs / cron one-shots        → CommandClient
9//! Raw protocol / custom        → Client
10//! Multi-user HTTP backend      → appkit::ConnectionPool + TurnRunner
11//! ```
12
13#![deny(missing_docs)]
14#![allow(clippy::result_large_err)]
15
16pub mod appkit;
17pub mod client;
18pub mod command_client;
19pub mod config;
20pub mod errors;
21pub mod events;
22pub mod heartbeat;
23pub mod helpers;
24pub mod intent_hints;
25pub mod protocol;
26pub mod session;
27pub mod stream_terminal;
28pub mod turn_boundary;
29pub mod verbosity;
30
31pub use client::{Client, ClientConfig, SendInputOptions};
32pub use command_client::{AsyncCommandClient, CommandClient};
33pub use config::{load_config_from_env, Config};
34pub use errors::{
35    disconnect_cause_name, ConnectionError, DaemonError, DisconnectCause, ReconnectError,
36    StaleLoopError, TimeoutError,
37};
38pub use events::{
39    classify_event_verbosity, is_completion_event, is_subagent_progress_event, parse_namespace,
40    ParsedNamespace, EVENT_AUTOPILOT_DREAMING_ENTERED, EVENT_AUTOPILOT_DREAMING_EXITED,
41    EVENT_AUTOPILOT_GOAL_BLOCKED, EVENT_AUTOPILOT_GOAL_COMPLETED, EVENT_AUTOPILOT_GOAL_CREATED,
42    EVENT_AUTOPILOT_GOAL_PROGRESS, EVENT_AUTOPILOT_GOAL_SUSPENDED, EVENT_AUTOPILOT_STATUS_CHANGED,
43    EVENT_BRANCH_CREATED, EVENT_BRANCH_RETRY_STARTED, EVENT_CARD_CREATED, EVENT_CARD_REPLAY_BEGIN,
44    EVENT_CARD_REPLAY_END, EVENT_DEEP_RESEARCH_COMPLETED, EVENT_DEEP_RESEARCH_CRAWL_SUMMARY,
45    EVENT_DEEP_RESEARCH_GATHER_SUMMARY, EVENT_DEEP_RESEARCH_PROGRESS, EVENT_DEEP_RESEARCH_STARTED,
46    EVENT_DEEP_RESEARCH_STEP_COMPLETED, EVENT_EXPLORER_COMPLETED, EVENT_EXPLORER_MILESTONE,
47    EVENT_EXPLORER_STARTED, EVENT_EXPLORER_STEP_COMPLETED, EVENT_FINAL_REPORT,
48    EVENT_GENERAL_FAILED, EVENT_GOAL_BATCH_STARTED, EVENT_GOAL_COMPLETED, EVENT_GOAL_CREATED,
49    EVENT_GOAL_DEFERRED, EVENT_GOAL_DIRECTIVES_APPLIED, EVENT_GOAL_FAILED, EVENT_GOAL_REPORTED,
50    EVENT_LOOP_REATTACHED_WIRE, EVENT_MESSAGE_RECEIVED, EVENT_MESSAGE_SENT,
51    EVENT_PLAN_BATCH_STARTED, EVENT_PLAN_CREATED, EVENT_PLAN_REFLECTED, EVENT_REPLAY_COMPLETE,
52    EVENT_STRANGE_LOOP_COMPLETED, EVENT_STRANGE_LOOP_CONTEXT_COMPACTED,
53    EVENT_STRANGE_LOOP_PLAN_DECISION, EVENT_STRANGE_LOOP_REASONED, EVENT_STRANGE_LOOP_STARTED,
54    EVENT_STRANGE_LOOP_STEP_COMPLETED, EVENT_STRANGE_LOOP_STEP_QUEUED,
55    EVENT_STRANGE_LOOP_STEP_STARTED, EVENT_STREAM_TOOL_CALL_UPDATE, EVENT_TOOL_CALL_UPDATES_BATCH,
56    EVENT_TOOL_COMPLETED, EVENT_TOOL_ERROR, EVENT_TOOL_STARTED,
57};
58pub use heartbeat::{DaemonHealth, HeartbeatTracker};
59pub use helpers::{
60    check_daemon_status, fetch_config_section, fetch_loop_cards, fetch_loop_history,
61    fetch_skills_catalog, is_daemon_live, protocol1_rpc, request_auth, request_auth_refresh,
62    request_daemon_config_reload, request_daemon_shutdown, websocket_url_from_env,
63};
64pub use intent_hints::{
65    validate_loop_input_intent_hint, DEFAULT_DELIVERABLE_PHASES, EMBED, IMAGE_TO_TEXT, OCR,
66    TEXT_COMPLETION,
67};
68pub use protocol::{
69    decode_message, expand_wire_messages, new_connection_init, new_notification, new_ping,
70    new_pong, new_request, new_request_id, new_subscribe, new_unsubscribe, Envelope, ErrorObject,
71    MessageType, CLIENT_VERSION, DEFAULT_CLIENT_CAPABILITIES, PROTO_VERSION,
72};
73pub use session::{bootstrap_loop_session, connect_with_retries, BootstrapOptions};
74pub use stream_terminal::{
75    extract_loop_id_from_inbound, inbound_needs_delivery_ack, is_turn_end_custom_data,
76    is_turn_progress_chunk, stale_pending_frame_label, STREAM_END,
77};
78pub use turn_boundary::{format_turn_id, frame_seq, frame_turn_id, parse_turn_generation};
79pub use verbosity::{
80    is_valid_verbosity_level, should_show, VerbosityTier, VERBOSITY_DEBUG, VERBOSITY_NORMAL,
81    VERBOSITY_QUIET,
82};
83
84/// Crate version reported in `connection_init`.
85pub const VERSION: &str = env!("CARGO_PKG_VERSION");