IrisAgentService

Struct IrisAgentService 

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

High-level service for executing agent tasks with structured context.

This is the primary interface for all agent-based operations in git-iris. It handles:

  • Configuration management
  • Agent lifecycle
  • Task context validation and formatting
  • Environment validation

§Example

let service = IrisAgentService::from_common_params(&params, None)?;
let context = TaskContext::for_gen();
let result = service.execute_task("commit", context).await?;

Implementations§

Source§

impl IrisAgentService

Source

pub fn new( config: Config, provider: String, model: String, fast_model: String, ) -> Self

Create a new service with explicit provider configuration

Source

pub fn from_common_params( common_params: &CommonParams, repository_url: Option<String>, ) -> Result<Self>

Create service from common CLI parameters

This is the primary constructor for CLI usage. It:

  • Loads and applies configuration
  • Sets up the git repository (local or remote)
  • Validates the environment
Source

pub fn check_environment(&self) -> Result<()>

Check that the environment is properly configured

Source

pub async fn execute_task( &self, capability: &str, context: TaskContext, ) -> Result<StructuredResponse>

Execute an agent task with structured context

§Arguments
  • capability - The capability to invoke (e.g., “commit”, “review”, “pr”)
  • context - Structured context describing what to analyze
§Returns

The structured response from the agent

Source

pub async fn execute_task_with_prompt( &self, capability: &str, task_prompt: &str, ) -> Result<StructuredResponse>

Execute a task with a custom prompt (for backwards compatibility)

Source

pub async fn execute_task_with_style( &self, capability: &str, context: TaskContext, preset: Option<&str>, use_gitmoji: Option<bool>, instructions: Option<&str>, ) -> Result<StructuredResponse>

Execute an agent task with style overrides

Allows runtime override of preset and gitmoji settings without modifying the underlying config. Useful for UI flows where the user can change settings per-invocation.

§Arguments
  • capability - The capability to invoke
  • context - Structured context describing what to analyze
  • preset - Optional preset name override (e.g., “conventional”, “cosmic”)
  • use_gitmoji - Optional gitmoji setting override
  • instructions - Optional custom instructions from the user
Source

pub async fn execute_chat_with_updates( &self, task_prompt: &str, content_update_sender: ContentUpdateSender, ) -> Result<StructuredResponse>

Execute a chat task with content update capabilities

This is used by Studio to enable Iris to update content via tool calls.

Source

pub async fn execute_chat_streaming<F>( &self, task_prompt: &str, content_update_sender: ContentUpdateSender, on_chunk: F, ) -> Result<StructuredResponse>
where F: FnMut(&str, &str) + Send,

Execute a chat task with streaming and content update capabilities

Combines streaming output with tool-based content updates for the TUI chat.

Source

pub async fn execute_task_streaming<F>( &self, capability: &str, context: TaskContext, on_chunk: F, ) -> Result<StructuredResponse>
where F: FnMut(&str, &str) + Send,

Execute an agent task with streaming

This method streams LLM output in real-time, calling the callback with each text chunk as it arrives. Ideal for TUI display of generation progress.

§Arguments
  • capability - The capability to invoke (e.g., “review”, “pr”, “changelog”)
  • context - Structured context describing what to analyze
  • on_chunk - Callback receiving (chunk, aggregated_text) for each delta
§Returns

The final structured response after streaming completes

Source

pub fn config(&self) -> &Config

Get the configuration

Source

pub fn config_mut(&mut self) -> &mut Config

Get a mutable reference to the configuration

Source

pub fn git_repo(&self) -> Option<&Arc<GitRepo>>

Get the git repository if available

Source

pub fn provider(&self) -> &str

Get the provider name

Source

pub fn model(&self) -> &str

Get the model name

Source

pub fn fast_model(&self) -> &str

Get the fast model name (for subagents and simple tasks)

Source

pub fn api_key(&self) -> Option<String>

Get the API key for the current provider from config

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> WasmCompatSend for T
where T: Send,

Source§

impl<T> WasmCompatSync for T
where T: Sync,