Skip to main content

CommitBuilder

Struct CommitBuilder 

Source
pub struct CommitBuilder { /* private fields */ }
Expand description

Builder for creating commits. The commit ID is computed on build.

Implementations§

Source§

impl CommitBuilder

Source

pub fn new( state_root: ObjectId, agent_id: impl Into<AgentId>, authority: Authority, intent: Intent, ) -> Self

Start building a commit with the required fields.

Source

pub fn parents(self, parents: Vec<ObjectId>) -> Self

Set parent commits.

Source

pub fn parent(self, parent: ObjectId) -> Self

Set a single parent commit (most common case).

Source

pub fn reasoning(self, reasoning: impl Into<String>) -> Self

Set the reasoning trace.

Source

pub fn confidence(self, confidence: f64) -> Self

Set the confidence score.

Source

pub fn tool_calls(self, calls: Vec<ToolCall>) -> Self

Add tool calls.

Source

pub fn build(self) -> Commit

Build the commit, computing its content-addressed ID.

Silently truncates overlong provenance fields to their caps — MAX_DESCRIPTION_LEN, MAX_REASONING_LEN, MAX_AGENT_ID_LEN, MAX_TOOL_CALLS. Truncation uses chars() so UTF-8 codepoints are never split.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.