pub struct AppBuilder { /* private fields */ }Implementations§
Source§impl AppBuilder
impl AppBuilder
pub fn new() -> Self
pub fn with_config(self, cfg: Config) -> Self
pub fn with_cwd(self, cwd: impl Into<PathBuf>) -> Self
pub fn with_permission_gate(self, gate: Arc<dyn PermissionGate>) -> Self
Sourcepub fn with_builtin_tools(self) -> Self
pub fn with_builtin_tools(self) -> Self
Install Capo’s builtin tools (read, bash).
This is mutually exclusive with with_custom_tools_factory /
build_with_custom_tools; build() returns a configuration error if
both are set.
pub fn with_max_iterations(self, n: usize) -> Self
pub fn with_llm(self, llm: Arc<dyn LlmClient>) -> Self
pub fn with_permissions_config(self, path: PathBuf) -> Self
pub fn with_ui_channel(self, tx: Sender<UiEvent>) -> Self
Sourcepub fn with_settings(self, settings: Settings) -> Self
pub fn with_settings(self, settings: Settings) -> Self
M3: install user Settings. Replaces with_config for new code.
Sourcepub fn disable_context_discovery(self) -> Self
pub fn disable_context_discovery(self) -> Self
M3: disable AGENTS.md / CLAUDE.md discovery for this App.
Opt-out — discovery is on by default in build().
Sourcepub fn with_session_store(self, store: Arc<dyn SessionStore>) -> Self
pub fn with_session_store(self, store: Arc<dyn SessionStore>) -> Self
M3 Phase A: install a SessionStore (e.g. motosan_agent_loop::FileSessionStore)
for persistence. When omitted, sessions are ephemeral (no jsonl on disk).
Sourcepub fn with_autocompact(self) -> Self
pub fn with_autocompact(self) -> Self
M3 Phase A: enable autocompact at the Settings::session.compact_at_context_pct
threshold. Requires with_settings to have been called; otherwise uses
Settings::default(). Settings provide max_context_tokens and
keep_turns. No-op when settings.session.compact_at_context_pct == 0.0.
Sourcepub fn with_skills(self, skills: Vec<Skill>) -> Self
pub fn with_skills(self, skills: Vec<Skill>) -> Self
M4 Phase A: register skills. Pass an empty Vec (or omit the call,
or call without_skills()) to disable skill injection. Skills are
rendered into the system prompt’s <available_skills> block when
the read tool is available, and matched against /skill:<name>
expansion before user messages reach the LLM.
pub fn without_skills(self) -> Self
Sourcepub fn with_extra_tools(self, tools: Vec<Arc<dyn Tool>>) -> Self
pub fn with_extra_tools(self, tools: Vec<Arc<dyn Tool>>) -> Self
M4 Phase B: register additional tools (typically MCP). Unlike
with_custom_tools_factory, this APPENDS to the builtin tools
and does NOT replace them.
Sourcepub fn with_mcp_servers(
self,
servers: Vec<(String, Arc<dyn McpServer>)>,
) -> Self
pub fn with_mcp_servers( self, servers: Vec<(String, Arc<dyn McpServer>)>, ) -> Self
M4 Phase B: register MCP server handles so App::disconnect_mcp
can iterate them on shutdown. Storage only — does not connect.
Sourcepub fn with_custom_tools_factory(
self,
factory: impl FnOnce(ToolCtx) -> Vec<Arc<dyn Tool>> + 'static,
) -> Self
pub fn with_custom_tools_factory( self, factory: impl FnOnce(ToolCtx) -> Vec<Arc<dyn Tool>> + 'static, ) -> Self
Install a custom tool set for this app.
This is mutually exclusive with with_builtin_tools; build() returns
a configuration error if both are set.
Sourcepub async fn build_with_custom_tools(
self,
factory: impl FnOnce(ToolCtx) -> Vec<Arc<dyn Tool>> + 'static,
) -> Result<App>
pub async fn build_with_custom_tools( self, factory: impl FnOnce(ToolCtx) -> Vec<Arc<dyn Tool>> + 'static, ) -> Result<App>
Convenience wrapper for with_custom_tools_factory(...).build().
This is mutually exclusive with with_builtin_tools.
Sourcepub async fn build_with_session(self, resume: Option<SessionId>) -> Result<App>
pub async fn build_with_session(self, resume: Option<SessionId>) -> Result<App>
M3 Phase A: build the App with an optional resume session id.
Some(id)+session_store: Some(_)→AgentSession::resume(id, store, engine, llm), then replay history intoToolCtx.read_files.Some(id)+session_store: None→ error (resume requires a store).None+session_store: Some(_)→AgentSession::new_with_store(fresh_id, store, engine, llm).None+session_store: None→AgentSession::new(engine, llm)(ephemeral).