pub struct CliAgentBuilder { /* private fields */ }Expand description
Default AgentCore assembly builder for the defect CLI.
Implementations§
Source§impl CliAgentBuilder
impl CliAgentBuilder
Sourcepub fn new(
cwd: PathBuf,
load_options: LoadConfigOptions,
config: LoadedConfig,
) -> Self
pub fn new( cwd: PathBuf, load_options: LoadConfigOptions, config: LoadedConfig, ) -> Self
Creates a CLI agent builder with the full default feature set.
Sourcepub fn features(self, features: DefaultFeatureSet) -> Self
pub fn features(self, features: DefaultFeatureSet) -> Self
Replace the default feature set.
Sourcepub fn local_sessions(self) -> Self
pub fn local_sessions(self) -> Self
Use the project-local session directory.
Sourcepub fn resume(self, session_id: Option<String>) -> Self
pub fn resume(self, session_id: Option<String>) -> Self
Set the resume parameter. None means bare --resume, which looks up the most
recent session by cwd.
Sourcepub fn provider_registry(self, registry: Arc<ProviderRegistry>) -> Self
pub fn provider_registry(self, registry: Arc<ProviderRegistry>) -> Self
Overrides the provider registry directly.
Sourcepub fn add_provider_entry(self, entry: ProviderEntry) -> Self
pub fn add_provider_entry(self, entry: ProviderEntry) -> Self
Appends a provider entry after the default provider entries.
Sourcepub fn process_tools(self, tools: Arc<dyn ToolRegistry>) -> Self
pub fn process_tools(self, tools: Arc<dyn ToolRegistry>) -> Self
Overrides the process-level tool registry directly.
Sourcepub fn add_tool(self, tool: Arc<dyn Tool>) -> Self
pub fn add_tool(self, tool: Arc<dyn Tool>) -> Self
Adds a tool on top of the default process-level tools. When names conflict, the added tool takes precedence.
Sourcepub fn add_tool_registry(self, registry: Arc<dyn ToolRegistry>) -> Self
pub fn add_tool_registry(self, registry: Arc<dyn ToolRegistry>) -> Self
Overlay a registry onto the default process-level tools. Registries added later take higher priority.
Sourcepub fn policy(self, policy: Arc<dyn SandboxPolicy>) -> Self
pub fn policy(self, policy: Arc<dyn SandboxPolicy>) -> Self
Overrides the sandbox policy.
Sourcepub fn non_interactive(self) -> Self
pub fn non_interactive(self) -> Self
Wraps the final policy with NonInteractivePolicy: downgrades inner Ask to
Deny to prevent hanging on permission prompts in non‑TTY environments
(--message single‑turn mode). Allow / Deny pass through unchanged.
Sourcepub fn goal(self, objective: impl Into<String>) -> Self
pub fn goal(self, objective: impl Into<String>) -> Self
Enable the --goal goal-driven loop: registers the goal_done tool, installs a
goal-gate hook (before_turn_end), and attaches GoalState to the session.
The agent runs autonomously for multiple turns until goal_done is called
(success) or the max_hook_continues limit (--max-turns) is reached.
Sourcepub fn max_turns(self, max_turns: u32) -> Self
pub fn max_turns(self, max_turns: u32) -> Self
--max-turns: the maximum number of times before_turn_end can extend the
session in goal mode (mapped to
TurnConfig::max_hook_continues). When the limit is reached, the session is
forcibly stopped and exits with Exhausted.
Sourcepub fn modes(self, modes: ModeCatalog) -> Self
pub fn modes(self, modes: ModeCatalog) -> Self
Override the permission mode catalog.
Sourcepub fn hook_engine(self, hook_engine: Arc<dyn HookEngine>) -> Self
pub fn hook_engine(self, hook_engine: Arc<dyn HookEngine>) -> Self
Override the hook engine.
Sourcepub fn builtin_registry(self, registry: BuiltinRegistry) -> Self
pub fn builtin_registry(self, registry: BuiltinRegistry) -> Self
Registers a builtin hook factory.
Sourcepub fn session_tool_factory(self, factory: Arc<dyn SessionToolFactory>) -> Self
pub fn session_tool_factory(self, factory: Arc<dyn SessionToolFactory>) -> Self
Override the session-level tool factory, e.g. for custom MCP integration.
Sourcepub fn observe_session(self, observer: Arc<dyn SessionObserver>) -> Self
pub fn observe_session(self, observer: Arc<dyn SessionObserver>) -> Self
Adds a session observer. The observer can subscribe to the event stream after session creation and push events to an external system.
Sourcepub async fn build(self) -> Result<BuiltCliAgent>
pub async fn build(self) -> Result<BuiltCliAgent>
Auto Trait Implementations§
impl !RefUnwindSafe for CliAgentBuilder
impl !UnwindSafe for CliAgentBuilder
impl Freeze for CliAgentBuilder
impl Send for CliAgentBuilder
impl Sync for CliAgentBuilder
impl Unpin for CliAgentBuilder
impl UnsafeUnpin for CliAgentBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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 moreSource§impl<T> IntoMaybeUndefined<T> for T
impl<T> IntoMaybeUndefined<T> for T
fn into_maybe_undefined(self) -> MaybeUndefined<T>
Source§impl<T> IntoOption<T> for T
impl<T> IntoOption<T> for T
fn into_option(self) -> Option<T>
Source§impl<D> OwoColorize for D
impl<D> OwoColorize for D
Source§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
Source§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
Source§fn black(&self) -> FgColorDisplay<'_, Black, Self>
fn black(&self) -> FgColorDisplay<'_, Black, Self>
Source§fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
Source§fn red(&self) -> FgColorDisplay<'_, Red, Self>
fn red(&self) -> FgColorDisplay<'_, Red, Self>
Source§fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
Source§fn green(&self) -> FgColorDisplay<'_, Green, Self>
fn green(&self) -> FgColorDisplay<'_, Green, Self>
Source§fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
Source§fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
Source§fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
Source§fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
Source§fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
Source§fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
Source§fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
Source§fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
Source§fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
Source§fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
Source§fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
Source§fn white(&self) -> FgColorDisplay<'_, White, Self>
fn white(&self) -> FgColorDisplay<'_, White, Self>
Source§fn on_white(&self) -> BgColorDisplay<'_, White, Self>
fn on_white(&self) -> BgColorDisplay<'_, White, Self>
Source§fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
Source§fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
Source§fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
Source§fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
Source§fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
Source§fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
Source§fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
Source§fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
Source§fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
Source§fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
Source§fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
Source§fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
Source§fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Source§fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Source§fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Source§fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Source§fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
Source§fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
Source§fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
Source§fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
Source§fn bold(&self) -> BoldDisplay<'_, Self>
fn bold(&self) -> BoldDisplay<'_, Self>
Source§fn dimmed(&self) -> DimDisplay<'_, Self>
fn dimmed(&self) -> DimDisplay<'_, Self>
Source§fn italic(&self) -> ItalicDisplay<'_, Self>
fn italic(&self) -> ItalicDisplay<'_, Self>
Source§fn underline(&self) -> UnderlineDisplay<'_, Self>
fn underline(&self) -> UnderlineDisplay<'_, Self>
Source§fn blink(&self) -> BlinkDisplay<'_, Self>
fn blink(&self) -> BlinkDisplay<'_, Self>
Source§fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
Source§fn reversed(&self) -> ReversedDisplay<'_, Self>
fn reversed(&self) -> ReversedDisplay<'_, Self>
Source§fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
Source§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::fg or
a color-specific method, such as OwoColorize::green, Read moreSource§fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::bg or
a color-specific method, such as OwoColorize::on_yellow, Read more