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)]
/// Provider-independent agent loop.
pub mod agent;
/// Bounded, cancellable shell execution.
pub mod bash;
/// Checksummed session framing.
pub mod frame;
/// Branching session state.
pub mod session;
/// Durable session storage.
pub mod store;
/// Tool registry, validation, and recorded effects.
pub mod tools;
/// Provider-free replay evidence.
pub mod trace;
pub use agent::{
Agent, AgentEvent, CompactionSummary, Delivery, QueuedInput, SecretProxy, TurnOutcome,
};
pub use bash::{BashResult, execute};
pub use frame::{Frame, Recovery, read_frames, write_frame};
pub use session::{Branch, COMPACTION_KIND, Entry, EntryContent, Session, SessionHeader};
pub use store::{
OpenSession, SessionWriter, create_session, fork_session, load_session, open_session,
repair_session,
};
pub use tools::{ToolOutcome, ToolRegistry, ToolSession};
pub use trace::{TraceKind, TraceRecord, replay};
#[cfg(test)]
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);
}
}