use anyhow::Result;
use bmux_client::BmuxClient;
use tokio::sync::oneshot;
pub use crate::runtime::attach::adapters::{
AttachAdapterFuture, AttachClock, AttachEventBus, AttachEventEnvelope, AttachRenderSink,
AttachScheduledWake, AttachScheduler, AttachServiceCall, AttachServiceHost, AttachStorage,
AttachStorageKey, AttachTerminalInputSource, FixedAttachClock, SystemAttachClock,
};
pub use crate::runtime::attach::input::{
TerminalGeometry, TerminalInputEvent, TerminalKeyCode, TerminalKeyEvent, TerminalKeyPhase,
TerminalModifiers, TerminalMouseButton, TerminalMouseEvent, TerminalMousePhase,
};
pub use crate::runtime::{
ActionDispatchError, ActionDispatchRequest, AttachExitReason, AttachRunOutcome, PromptEvent,
PromptField, PromptOption, PromptPolicy, PromptRequest, PromptResponse, PromptSubmitError,
PromptValidation, PromptValue, PromptWidth,
};
pub async fn run_with_client(
client: BmuxClient,
target: Option<&str>,
follow: Option<&str>,
global: bool,
) -> Result<AttachRunOutcome> {
crate::runtime::run_attach_with_client(client, target, follow, global).await
}
pub fn submit_prompt(
request: PromptRequest,
) -> std::result::Result<oneshot::Receiver<PromptResponse>, PromptSubmitError> {
crate::runtime::submit_prompt_request(request)
}
pub fn submit_prompt_with_events(
request: PromptRequest,
) -> std::result::Result<
(
oneshot::Receiver<PromptResponse>,
tokio::sync::mpsc::UnboundedReceiver<PromptEvent>,
),
PromptSubmitError,
> {
crate::runtime::submit_prompt_request_with_events(request)
}
pub async fn request_prompt(
request: PromptRequest,
) -> std::result::Result<PromptResponse, PromptSubmitError> {
crate::runtime::request_prompt_response(request).await
}
pub async fn request_prompt_with_events(
request: PromptRequest,
) -> std::result::Result<
(
PromptResponse,
tokio::sync::mpsc::UnboundedReceiver<PromptEvent>,
),
PromptSubmitError,
> {
crate::runtime::request_prompt_response_with_events(request).await
}
pub fn dispatch_action(action: impl Into<String>) -> std::result::Result<(), ActionDispatchError> {
crate::runtime::dispatch_action(action)
}