Skip to main content

imp_core/
sdk.rs

1//! Curated Rust SDK surface for embedding imp in other hosts.
2//!
3//! This module is the first stable-shaped entry point for using imp as a
4//! reusable runtime instead of only through the CLI or TUI. It intentionally
5//! wraps the existing `imp_session`, `agent`, and `ui` pieces in one place so
6//! host applications can depend on a small public surface.
7//!
8//! Current SDK v1 focus:
9//! - create and manage an [`ImpSession`]
10//! - prompt, steer, follow up, cancel, and wait for completion
11//! - consume the runtime [`AgentEvent`] stream
12//! - provide a host-side [`UserInterface`] bridge
13//! - switch models and thinking levels for later prompts
14//!
15//! Explicitly out of scope for this first slice:
16//! - extension/runtime loading
17//! - packaged customization discovery
18//! - a higher-level runtime/session-replacement wrapper above [`ImpSession`]
19//! - CLI/TUI-specific orchestration helpers
20//! - provider registration and broader host lifecycle policy
21//!
22//! # Example
23//! ```no_run
24//! use imp_core::sdk::{AgentEvent, ImpSession, Result, SessionOptions};
25//!
26//! #[tokio::main]
27//! async fn main() -> Result<()> {
28//!     let mut session = ImpSession::create(SessionOptions {
29//!         cwd: std::env::current_dir()?,
30//!         ..Default::default()
31//!     })
32//!     .await?;
33//!
34//!     session.prompt("Summarize the project in this directory.").await?;
35//!
36//!     while let Some(event) = session.recv_event().await {
37//!         match event {
38//!             AgentEvent::MessageDelta { .. } => {}
39//!             AgentEvent::AgentEnd { .. } => break,
40//!             _ => {}
41//!         }
42//!     }
43//!
44//!     session.wait().await
45//! }
46//! ```
47
48pub use crate::agent::{AgentCommand, AgentEvent, TimingEvent, TimingStage};
49pub use crate::error::{Error, Result};
50pub use crate::imp_session::{
51    ImpSession, ResolvedRuntimeConnection, RuntimeConnectionIntent, SessionChoice, SessionOptions,
52};
53pub use crate::mana_review::{ManaReviewState, TurnManaReview};
54pub use crate::ui::{
55    ComponentSpec, NotifyLevel, NullInterface, SelectOption, UserInterface, WidgetContent,
56};
57pub use imp_llm::{Model, ThinkingLevel};