megacode_agent_sdk/lib.rs
1//! Drive a MEGA harness agent session from a Rust program.
2//!
3//! A [`Client`] holds one session: [`Client::start`] (or
4//! [`Client::resume`]) begins it, [`Client::send`] runs one turn and returns
5//! its events, and the other methods steer, abort, compact or inspect it
6//! while a turn's events are read. [`query`] is one prompt, one turn, then
7//! the end. A [`Tool`] given to [`Options::tool`] runs in this program when
8//! the model calls it; an approval request is answered by
9//! [`Options::on_approval`]'s callback, or else by the
10//! [`ApprovalRequest`] event itself. Spec: `docs/specs/slice-ar.md` R8, R9.
11
12mod binary;
13mod client;
14mod error;
15mod options;
16mod process;
17mod tools;
18mod wire;
19
20pub use client::{Client, Compaction, Events, TurnStream, query};
21pub use error::{Diagnostics, Error};
22pub use options::{Mode, Options, Sandbox, SystemPrompt};
23pub use tools::{CancelSignal, Tool, ToolContext, ToolOutput};
24pub use wire::{
25 Approval, ApprovalDecision, ApprovalKind, ApprovalRequest, Choice, Compacted, ContextState,
26 Cost, Decision, Denied, Disposition, Escape, Event, Info, Outcome, State, Text, ToolResult,
27 ToolStatus, ToolUse, TurnResult, TurnState, Usage, UserKind, UserMessage,
28};
29
30/// Test support: a release with injected pins, for the download tests
31/// (`tests/binary.rs`). Not part of the API.
32#[doc(hidden)]
33#[cfg(all(unix, feature = "download"))]
34pub mod __testing {
35 pub use crate::binary::Release;
36}