repositories / smith
smith
There are many coding harnesses - but this one is fast
owned by bugabinga
smith-core/src/lib.rs
RawFile outline
//! Provider-independent Smith agent core.
//!
//! Session persistence, CBOR framing, configurable runtime, replay traces,
//! and tool lifecycle events.
#![forbid(unsafe_code)]
#![warn(missing_docs, unused_mut)]
#![allow(
clippy::all,
clippy::pedantic,
clippy::style,
clippy::unwrap_used,
clippy::expect_used,
clippy::manual_map,
clippy::redundant_clone,
clippy::use_self,
clippy::option_if_let_else,
clippy::missing_const_for_fn,
clippy::needless_pass_by_ref_mut,
clippy::too_long_first_doc_paragraph,
missing_docs,
dead_code
)]
pub mod bash;
pub mod config;
pub mod frame;
pub mod session;
pub mod store;
pub mod tools;
pub mod trace;
pub use bash::{BashResult, execute};
pub use config::Config;
pub use frame::{DecodeOutcome, Frame, decode_frame, write_frame};
pub use session::{Branch, Entry, EntryContent, Session};
pub use store::{SessionWriter, load_session, repair_session};
pub use tools::{ToolOutcome, ToolRegistry, ToolSession};
pub use trace::{TraceKind, TraceRecord, replay};
#[cfg(test)]
#[allow(clippy::unwrap_used, clippy::expect_used)]
mod tests {
use super::*;
use smith::message::{Message, Role};
#[test]
fn session_creates_and_appends() {
let mut session = Session::new();
let msg = Message::with_text(Role::User, "hello");
let entry = Entry::message(msg, None);
session.append_to_active(entry);
assert_eq!(session.active_branch().entries.len(), 1);
}
#[test]
fn config_validates_bounds() {
let mut cfg = Config::default_valid();
cfg.max_frame_bytes = 100;
assert!(cfg.validate().is_err());
cfg.max_frame_bytes = 1024;
assert!(cfg.validate().is_ok());
}
}