use std::sync::Arc;
use theway_core::{AgentHarness, AgentHarnessOptions};
use theway_daemon::{AgentSession, RetrySettings};
use theway_llm_provider::{Api, Model, ModelCost, Provider};
use theway_storage::sqlite_repo::SqliteSessionRepo;
use theway_transport::commands::Registry;
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let repo = Arc::new(SqliteSessionRepo::new(
std::env::temp_dir().join("sdk-demo-sessions"),
));
let store = theway_storage::session::create(&repo, std::env::current_dir()?.as_path()).await?;
let session = theway_core::Session::from_store(Arc::new(store));
let model = Model {
id: "faux".into(),
name: "Faux".into(),
api: Api::from("faux"),
provider: Provider::from("faux"),
base_url: String::new(),
reasoning: false,
thinking_level_map: None,
input: vec![],
cost: ModelCost::default(),
context_window: 0,
max_tokens: 0,
headers: None,
compat: None,
};
let harness = Arc::new(AgentHarness::new(AgentHarnessOptions::new(model, session)));
let agent = AgentSession::new(harness.clone(), RetrySettings::default());
println!(
"sdk: AgentSession ready (harness refcount={})",
Arc::strong_count(&harness)
);
let _registry = Registry::<()>::new(); let _repo = Arc::new(SqliteSessionRepo::new(
std::env::temp_dir().join("theway-demo-sessions"),
));
println!("sdk: registry + session repo OK — SDK usable from external project");
let _ = agent;
Ok(())
}