e0a5f57793
Vendor the rebranded BoosAPI Desktop client (Tauri + Vue) into metapi as a monorepo subdirectory under desktop/. Source only — node_modules, dist, Cargo target and the upstream .git history are excluded. desktop/ keeps its own independent Cargo workspace (desktop/src-tauri with crates/*); it is not part of the backend boosapi crate, so a `cargo check` at the metapi root still compiles only the backend. Build the desktop app from desktop/src-tauri per desktop/README.md. Note: app icons are still placeholder assets pending the final BoosAPI logo. The updater signing keys live outside the repo and are not included.
38 lines
982 B
Rust
38 lines
982 B
Rust
// Example 4: Blocking Prompt API
|
|
//
|
|
// Uses agent.prompt() for a quick one-shot query without streaming.
|
|
//
|
|
// Run: cargo run --example 04-prompt-api
|
|
|
|
use open_agent_sdk::{Agent, AgentOptions};
|
|
|
|
#[tokio::main]
|
|
async fn main() {
|
|
println!("--- Example 4: Prompt API ---");
|
|
|
|
let mut agent = Agent::new(AgentOptions {
|
|
max_turns: Some(5),
|
|
..Default::default()
|
|
})
|
|
.await
|
|
.unwrap();
|
|
|
|
match agent
|
|
.prompt("Run 'rustc --version' and 'cargo --version' using Bash, and tell me the versions.")
|
|
.await
|
|
{
|
|
Ok(result) => {
|
|
println!("\nResponse: {}", result.text);
|
|
println!("\nTurns: {}", result.num_turns);
|
|
println!(
|
|
"Tokens: {} in / {} out",
|
|
result.usage.input_tokens, result.usage.output_tokens
|
|
);
|
|
println!("Duration: {}ms", result.duration_ms);
|
|
}
|
|
Err(e) => eprintln!("Error: {}", e),
|
|
}
|
|
|
|
agent.close().await;
|
|
}
|