bob_rs/lib.rs
1//! Shared bob CLI integration logic.
2//!
3//! Two consumers:
4//! * `src-tauri` (production desktop runtime, via Tauri commands)
5//! * `bob-api` (axum HTTP server used by browser-preview dev)
6//!
7//! Both call into this crate's public API directly. Streaming
8//! operations (install, run_bob) take callback closures so each
9//! consumer can adapt to its own transport — Tauri `Channel<T>`
10//! on one side, axum SSE on the other.
11//!
12//! Wire shapes (`InstallEvent`, `BobReadinessSnapshot`, etc.) are
13//! `#[derive(Serialize)]` so both transports emit identical JSON.
14//! Keep their field names stable — the TypeScript front-end
15//! consumes them verbatim and doesn't reach back through TS-→Rust
16//! type generation today.
17
18pub mod check;
19pub mod error;
20pub mod install;
21pub mod keychain;
22pub mod run;
23
24pub use check::{get_readiness, BobReadinessSnapshot};
25pub use error::BobError;
26pub use install::install_bob;
27pub use keychain::{
28 auth_source, delete_api_key, read_api_key, resolve_api_key, write_api_key, KeySource,
29};
30pub use run::{spawn_bob, spawn_bob_raw, BobApprovalMode, BobChatMode, RunBobOptions};
31// The generic subprocess engine + install/process event shapes live in the
32// `cli-stream` leaf; re-export them here so existing `bob_rs::…` paths in
33// the hosts keep compiling unchanged. (bob-rs depends only on cli-stream —
34// not on the harness framework — so it stays a standalone SDK.)
35pub use cli_stream::{
36 augmented_node_path, spawn_streaming, InstallEvent, ProcessEvent, ProcessHandle,
37};
38
39/// Bob's documented minimum Node.js version. Mirrored in
40/// `scripts/install-bob.sh`'s `REQUIRED_NODE_MAJOR` default.
41/// Bumping this string also requires updating the bob installer.
42pub const BOB_MIN_NODE_VERSION: &str = "22.15.0";
43
44/// Service + account keys used to identify the bob API-key entry in
45/// the OS keychain. The service is `"bob"` (this is the bob SDK; the
46/// slot belongs to the bob tool, not to any host product), the
47/// account is bob's documented env var name. Both transports hit the
48/// exact same slot — switching either string orphans stored keys.
49pub const KEYCHAIN_SERVICE: &str = "bob";
50pub const KEYCHAIN_ACCOUNT: &str = "BOBSHELL_API_KEY";