pub struct SidAgent { /* private fields */ }Expand description
Top-level agent combining chat configuration, tool bindings, and sandbox policy.
Implementations§
Source§impl SidAgent
impl SidAgent
Sourcepub fn new(config: ChatConfig, workspace_root: Path<'static>) -> Self
pub fn new(config: ChatConfig, workspace_root: Path<'static>) -> Self
Create a new agent with default settings rooted at workspace_root.
The workspace root is used as both the configuration root and the
filesystem root. No rc.conf files are loaded; the agent operates
with the supplied ChatConfig only.
Sourcepub fn from_workspace(
root: &Path<'_>,
fallback: ChatConfig,
) -> Result<Self, SError>
pub fn from_workspace( root: &Path<'_>, fallback: ChatConfig, ) -> Result<Self, SError>
Load the default agent from a workspace’s configuration files.
When no configuration exists at root, the fallback chat config is
used with default settings.
§Errors
Returns an error when the configuration exists but is malformed, or when the default agent cannot be resolved.
Sourcepub fn from_workspace_with_config_root(
workspace_root: &Path<'_>,
config_root: &Path<'_>,
fallback: ChatConfig,
) -> Result<Self, SError>
pub fn from_workspace_with_config_root( workspace_root: &Path<'_>, config_root: &Path<'_>, fallback: ChatConfig, ) -> Result<Self, SError>
Load the default agent using separate workspace and configuration roots.
The config_root is the directory containing agents.conf and
tools.conf, while workspace_root is the directory exposed to tool
invocations and sandbox policies.
§Errors
Returns an error when the configuration exists but is malformed, or when the default agent cannot be resolved.
Sourcepub fn from_workspace_agent(
root: &Path<'_>,
agent: &str,
fallback: ChatConfig,
) -> Result<Self, SError>
pub fn from_workspace_agent( root: &Path<'_>, agent: &str, fallback: ChatConfig, ) -> Result<Self, SError>
Load a named agent from a workspace’s configuration files.
§Errors
Returns an error when the agent does not exist in the configuration or is disabled.
Sourcepub fn from_workspace_agent_with_config_root(
workspace_root: &Path<'_>,
config_root: &Path<'_>,
agent: &str,
fallback: ChatConfig,
) -> Result<Self, SError>
pub fn from_workspace_agent_with_config_root( workspace_root: &Path<'_>, config_root: &Path<'_>, agent: &str, fallback: ChatConfig, ) -> Result<Self, SError>
Load a named agent using separate workspace and configuration roots.
§Errors
Returns an error when the agent does not exist in the configuration or is disabled.
Sourcepub fn from_workspace_compactor_with_config_root(
workspace_root: &Path<'_>,
config_root: &Path<'_>,
fallback: ChatConfig,
) -> Result<Self, SError>
pub fn from_workspace_compactor_with_config_root( workspace_root: &Path<'_>, config_root: &Path<'_>, fallback: ChatConfig, ) -> Result<Self, SError>
Load the compaction agent using separate workspace and configuration roots.
If a compact agent is declared in the configuration it is used;
otherwise a default compactor is built from fallback with the
built-in compaction system prompt. The returned agent exposes
memory-only tools.
§Errors
Returns an error when the configuration exists but is malformed.
Sourcepub fn from_config(
config: &Config,
agent: &str,
filesystem: Path<'static>,
) -> Result<Self, SError>
pub fn from_config( config: &Config, agent: &str, filesystem: Path<'static>, ) -> Result<Self, SError>
Sourcepub fn requires_confirmation(&self) -> bool
pub fn requires_confirmation(&self) -> bool
Return true when the agent’s enablement switch is SwitchPosition::Manual.
Sourcepub fn with_session(self, session: Arc<SidSession>) -> Self
pub fn with_session(self, session: Arc<SidSession>) -> Self
Attach a session to this agent, making the session root writable.
Sourcepub fn with_memory_source(
self,
memory_source: Option<CompactionProvenance>,
) -> Self
pub fn with_memory_source( self, memory_source: Option<CompactionProvenance>, ) -> Self
Override the compaction provenance used for ask-an-expert memory chains.
Sourcepub fn compaction_snapshot(&self) -> CompactionExpertConfig
pub fn compaction_snapshot(&self) -> CompactionExpertConfig
Snapshot the agent’s identity and model for use as a compaction expert.
Sourcepub async fn bash_with_renderer(
&self,
command: &str,
restart: bool,
renderer: &mut dyn Renderer,
) -> Result<String, Error>
pub async fn bash_with_renderer( &self, command: &str, restart: bool, renderer: &mut dyn Renderer, ) -> Result<String, Error>
Execute a bash command in the agent’s PTY session, streaming output to renderer.
When restart is true the existing PTY is torn down and a fresh
session is started before executing command.
§Errors
Returns an I/O error when the PTY cannot be created or the command fails to execute.