Skip to main content

soothe_client/
lib.rs

1//! Soothe WebSocket client for talking to a running soothe-daemon.
2//!
3//! Entry points by need:
4//! - One conversation, stream → `appkit::DaemonSession`
5//! - Jobs / cron one-shots → `CommandClient`
6//! - Raw protocol / custom → `Client`
7//! - Multi-user HTTP backend → `appkit::ConnectionPool`
8
9#![deny(missing_docs)]
10#![allow(clippy::result_large_err)]
11
12pub mod appkit;
13pub mod card_projection;
14pub mod client;
15pub mod command_client;
16pub mod config;
17pub mod errors;
18pub mod events;
19pub mod heartbeat;
20pub mod helpers;
21pub mod inbound_priority;
22pub mod intent_hints;
23pub mod protocol;
24pub mod send_methods;
25pub mod session;
26pub mod stream_terminal;
27pub mod turn_boundary;
28pub mod verbosity;
29
30pub use card_projection::{
31    card_step_context_pct, card_step_reason, parse_card_custom_payload, CardProjection,
32    ParsedCardFrame,
33};
34pub use client::{Client, ClientConfig, SendInputOptions};
35pub use command_client::{AsyncCommandClient, CommandClient};
36pub use config::{load_config_from_env, Config};
37pub use errors::{
38    disconnect_cause_name, ConnectionError, DaemonError, DisconnectCause, HeartbeatError,
39    ReconnectError, StaleLoopError, TimeoutError,
40};
41pub use events::{
42    classify_event_verbosity, is_completion_event, is_subagent_progress_event, parse_namespace,
43    ParsedNamespace, EVENT_BRANCH_CREATED, EVENT_BRANCH_RETRY_STARTED, EVENT_CARD_CREATED,
44    EVENT_CARD_FINALIZED, EVENT_CARD_REPLAY_BEGIN, EVENT_CARD_REPLAY_END, EVENT_CARD_UPDATED,
45    EVENT_DEEP_RESEARCH_COMPLETED, EVENT_DEEP_RESEARCH_CRAWL_SUMMARY,
46    EVENT_DEEP_RESEARCH_GATHER_SUMMARY, EVENT_DEEP_RESEARCH_PROGRESS, EVENT_DEEP_RESEARCH_STARTED,
47    EVENT_DEEP_RESEARCH_STEP_COMPLETED, EVENT_GENERAL_FAILED, EVENT_GOAL_BATCH_STARTED,
48    EVENT_GOAL_COMPLETED, EVENT_GOAL_CREATED, EVENT_GOAL_DEFERRED, EVENT_GOAL_DIRECTIVES_APPLIED,
49    EVENT_GOAL_FAILED, EVENT_GOAL_REPORTED, EVENT_LOOP_REATTACHED_WIRE, EVENT_PLAN_CREATED,
50    EVENT_PLAN_REFLECTED, EVENT_REPLAY_COMPLETE, EVENT_STRANGE_LOOP_COMPLETED,
51    EVENT_STRANGE_LOOP_CONTEXT_COMPACTED, EVENT_STRANGE_LOOP_PLAN_DECISION,
52    EVENT_STRANGE_LOOP_REASONED, EVENT_STRANGE_LOOP_STARTED, EVENT_STRANGE_LOOP_STEP_COMPLETED,
53    EVENT_STRANGE_LOOP_STEP_QUEUED, EVENT_STRANGE_LOOP_STEP_STARTED, EVENT_STREAM_TOOL_CALL_UPDATE,
54    EVENT_TOOL_CALL_UPDATES_BATCH, EVENT_TOOL_COMPLETED, EVENT_TOOL_ERROR, EVENT_TOOL_STARTED,
55    TOOL_BUDGET_EXHAUSTED,
56};
57pub use heartbeat::{DaemonHealth, HeartbeatTracker};
58pub use helpers::{
59    check_daemon_status, fetch_config_section, fetch_execution_state, fetch_loop_history,
60    fetch_skills_catalog, is_daemon_live, protocol1_rpc, request_auth, request_auth_refresh,
61    request_daemon_config_reload, request_daemon_shutdown, websocket_url_from_env,
62};
63pub use inbound_priority::{
64    inbound_frame_drop_priority, DEFAULT_INBOUND_MAX_SIZE, DROP_PRIORITY_CRITICAL,
65    DROP_PRIORITY_HIGH, DROP_PRIORITY_NORMAL,
66};
67pub use intent_hints::{DEFAULT_DELIVERABLE_PHASES, EMBED, IMAGE_TO_TEXT, OCR, TEXT_COMPLETION};
68pub use protocol::{
69    as_str, decode_message, decode_message_typed, expand_wire_messages, extract_soothe_loop_id,
70    is_loop_assistant_phase, new_connection_init, new_notification, new_ping, new_pong,
71    new_request, new_request_id, new_request_with_id, new_subscribe, new_unsubscribe,
72    next_to_event_message, params_map, split_wire_payload, BaseMessage, Envelope, ErrorObject,
73    EventMessage, LoopAIMessage, MessageType, StatusResponse, TypedMessage, CLIENT_VERSION,
74    DEFAULT_CLIENT_CAPABILITIES, PROTO_VERSION,
75};
76pub use session::{bootstrap_loop_session, connect_with_retries, BootstrapOptions};
77pub use stream_terminal::{
78    extract_loop_id_from_inbound, inbound_needs_delivery_ack, is_stream_terminal_data,
79    is_stream_terminal_wire_dict, is_turn_end_custom_data, is_turn_progress_chunk,
80    stale_pending_frame_label, STREAM_END, STREAM_TERMINAL_FIELD,
81};
82pub use turn_boundary::{
83    format_turn_id, frame_seq, frame_turn_id, is_idle_terminal_allowed, is_turn_terminal_allowed,
84    parse_turn_generation, turn_ids_match,
85};
86pub use verbosity::{
87    is_valid_verbosity_level, should_show, VerbosityTier, VERBOSITY_DEBUG, VERBOSITY_NORMAL,
88    VERBOSITY_QUIET,
89};
90
91/// Crate version reported in `connection_init`.
92pub const VERSION: &str = env!("CARGO_PKG_VERSION");