pub struct Runtime {
pub config: ConfigToml,
pub thread_manager: ThreadManager,
pub tool_registry: Arc<ToolRegistry>,
pub mcp_manager: Arc<McpManager>,
pub exec_policy: ExecPolicyEngine,
pub hooks: HookDispatcher,
pub jobs: JobManager,
}Expand description
Top-level runtime combining config, threads, tools, MCP, and hooks.
Fields§
§config: ConfigTomlResolved application configuration.
thread_manager: ThreadManagerManages conversation thread lifecycle.
tool_registry: Arc<ToolRegistry>Registry of callable tools.
mcp_manager: Arc<McpManager>Manager for MCP server connections.
exec_policy: ExecPolicyEngineEngine for evaluating execution policy decisions.
hooks: HookDispatcherDispatcher for lifecycle hooks.
jobs: JobManagerManager for background job lifecycle.
Implementations§
Source§impl Runtime
impl Runtime
Sourcepub fn new(
config: ConfigToml,
state: StateStore,
tool_registry: Arc<ToolRegistry>,
mcp_manager: Arc<McpManager>,
exec_policy: ExecPolicyEngine,
hooks: HookDispatcher,
) -> Self
pub fn new( config: ConfigToml, state: StateStore, tool_registry: Arc<ToolRegistry>, mcp_manager: Arc<McpManager>, exec_policy: ExecPolicyEngine, hooks: HookDispatcher, ) -> Self
Constructs a new Runtime, loading existing jobs from the state store.
Sourcepub fn update_config(&mut self, config: ConfigToml)
pub fn update_config(&mut self, config: ConfigToml)
Update the live configuration in-place so the next turn picks up
changes without a restart. Called by the app-server after
ConfigSet or ConfigUnset.
Only config.toml is touched by those operations, so the sibling
permissions.toml (and therefore exec_policy) is left unchanged.
Fields that the TUI caches on its App struct (api_provider,
reasoning_effort, mcp_config_path, skills_dir, …) are read
live from self.config here via resolve_runtime_options, so they
take effect on the next prompt turn without any extra plumbing.
Sourcepub fn reload_config_and_policy(
&mut self,
config: ConfigToml,
exec_policy: ExecPolicyEngine,
)
pub fn reload_config_and_policy( &mut self, config: ConfigToml, exec_policy: ExecPolicyEngine, )
Reload the live configuration and the exec policy from a
freshly-loaded ConfigStore. Used by the app-server’s
ConfigReload request, which re-reads both config.toml and the
sibling permissions.toml from disk.
Unlike update_config, this also refreshes self.exec_policy so
externally edited permission rules take effect without a restart.
Mirrors the TUI reload_runtime_config codepath for everything
that is reachable from the headless Runtime. The TUI-only caches
(last_effective_reasoning_effort, model_compaction_budget,
ui_locale, …) do not exist on Runtime and need no work here.
Not refreshed by this call:
mcp_manager— MCP server connections are loaded once at startup frommcp_config_path. Changingmcp_config_pathor the referencedmcp.jsonstill requires a headless-runtime restart; the TUI owns a separate explicit/mcp reloadoperation.tool_registry— built once at startup.
Sourcepub async fn handle_thread(
&mut self,
req: ThreadRequest,
) -> Result<ThreadResponse>
pub async fn handle_thread( &mut self, req: ThreadRequest, ) -> Result<ThreadResponse>
Dispatches a thread request (create, start, resume, fork, list, read, etc.).
Sourcepub async fn invoke_tool(
&self,
call: ToolCall,
approval_mode: AskForApproval,
cwd: &Path,
) -> Result<Value>
pub async fn invoke_tool( &self, call: ToolCall, approval_mode: AskForApproval, cwd: &Path, ) -> Result<Value>
Evaluates execution policy and dispatches a tool call.
Sourcepub async fn mcp_startup(&self) -> McpStartupCompleteEvent
pub async fn mcp_startup(&self) -> McpStartupCompleteEvent
Starts all configured MCP servers and emits startup events via hooks.
Sourcepub fn app_status(&self) -> AppResponse
pub fn app_status(&self) -> AppResponse
Returns the current application status including all jobs and their history.
Sourcepub fn provider_default(&self) -> ProviderKind
pub fn provider_default(&self) -> ProviderKind
Returns the default model provider from the resolved configuration.