pub struct AgentsConfig { /* private fields */ }Expand description
The effective agent config: the built-in agents with any voro.toml
merged on top, plus the user’s default_agent and viewers. Each agent
carries its Provenance so agent list can show where it came from.
Implementations§
Source§impl AgentsConfig
impl AgentsConfig
Sourcepub fn default_path() -> PathBuf
pub fn default_path() -> PathBuf
The config path dispatch reads: $XDG_CONFIG_HOME/voro/voro.toml,
defaulting to ~/.config. A fresh install resolves here even before
the file exists — that is the path agent init writes.
Sourcepub fn load(path: &Path) -> Result<AgentsConfig>
pub fn load(path: &Path) -> Result<AgentsConfig>
Load the effective config: the built-in agents, with the user file
layered on top if it exists. A missing file is not an error — the
built-ins alone dispatch — so a fresh install needs no agent init.
Sourcepub fn costs(&self) -> AttentionCosts
pub fn costs(&self) -> AttentionCosts
The attention price band the queue ranks by (DESIGN.md §7).
Sourcepub fn max_running(&self) -> i64
pub fn max_running(&self) -> i64
The dispatch WIP cap (DESIGN.md §7): how many tasks may be running before the queue stops offering dispatches.
Sourcepub fn max_running_from_file(&self) -> Option<i64>
pub fn max_running_from_file(&self) -> Option<i64>
The cap as voro.toml spells it, None when the file names none — the
provenance the Config screen’s settings list shows beside the value
(DESIGN.md §5), which the resolved max_running
alone cannot tell apart from a cap that happens to equal the default.
Sourcepub fn default_agent_from_file(&self) -> Option<&str>
pub fn default_agent_from_file(&self) -> Option<&str>
default_agent as the file spells it, before the PATH probe that
default_name falls back to.
Sourcepub fn default_viewer_from_file(&self) -> Option<&str>
pub fn default_viewer_from_file(&self) -> Option<&str>
default_viewer as the file spells it, before the resolution rules
default_viewer_name falls back to.
Sourcepub fn agent_names(&self) -> Vec<String>
pub fn agent_names(&self) -> Vec<String>
Every agent name defined in the config, for the TUI’s dispatch picker
(DESIGN.md §8/§9). agents is a BTreeMap, so this is already sorted.
Sourcepub fn agent(&self, name: &str) -> Option<&AgentTemplate>
pub fn agent(&self, name: &str) -> Option<&AgentTemplate>
The verb templates of a named agent, if it is configured. Used where a session already records which agent ran it — jump-in, reconciliation — so no default/override resolution applies.
Sourcepub fn resolve(&self, task_override: Option<&str>) -> Result<ResolvedAgent>
pub fn resolve(&self, task_override: Option<&str>) -> Result<ResolvedAgent>
The agent for a task: its agent override if set, otherwise the
resolved default (§8). An override or default naming an agent absent
from the config is an error here, not a panic at spawn time.
Sourcepub fn viewer_names(&self) -> Vec<String>
pub fn viewer_names(&self) -> Vec<String>
The names of the user’s [viewers.*] tables, sorted: the editable
set, which is why the built-ins are not in it. Everything that offers a
viewer to run — the TUI’s viewer picker, viewer list — wants
viewer_entries instead.
Sourcepub fn viewer_entries(&self) -> Vec<(&str, &str, Provenance)>
pub fn viewer_entries(&self) -> Vec<(&str, &str, Provenance)>
Every effective viewer as (name, cmd, provenance), sorted by name —
the built-ins with the user’s tables layered over them, mirroring the
agents’ entries. What viewer list, the Config
screen and the default/review-action pickers show, since a built-in is
a legitimate thing to run, star, or pin a project to.
Sourcepub fn anonymous_viewer_cmd(&self) -> Option<&str>
pub fn anonymous_viewer_cmd(&self) -> Option<&str>
The anonymous [viewer] table’s command, if the file defines one — the
legacy default the Config screen surfaces read-only, since it carries no
name to edit or delete by.
Sourcepub fn default_viewer_name(&self) -> Option<String>
pub fn default_viewer_name(&self) -> Option<String>
The name of the viewer open will run when nothing picks one by name,
for viewer list and the Config screen to star: the user’s
default_viewer when set (honoured even if it names a missing viewer),
else the sole [viewers.*] entry, else the first built-in found on
PATH. The anonymous [viewer] table has no name, so it yields None
here even though it resolves.
Sourcepub fn viewer_cmd(&self, name: Option<&str>) -> Result<&str>
pub fn viewer_cmd(&self, name: Option<&str>) -> Result<&str>
Resolve a viewer command (DESIGN.md §11a). User configuration always
wins: with a name, the [viewers.<name>] table, falling back to the
built-in of that name; without one, default_viewer, else the anonymous
[viewer] table, else the sole [viewers.*] entry, else the first
built-in viewer found on PATH. Errors carry what to install or run.
Sourcepub fn default_name(&self) -> Option<String>
pub fn default_name(&self) -> Option<String>
The name of the agent used when a task has no override, for the CLI’s
agent list to flag it. None when no default is set and no
built-in is on PATH — the same condition resolve errors on.
Sourcepub fn provenance(&self, name: &str) -> Option<Provenance>
pub fn provenance(&self, name: &str) -> Option<Provenance>
The provenance of a named agent, if it is configured.
Sourcepub fn override_missing_verbs(&self, name: &str) -> Vec<&'static str>
pub fn override_missing_verbs(&self, name: &str) -> Vec<&'static str>
For a user override of a built-in, the verbs the built-in defines that
the override drops — the one case layering can’t fix (§8), so
agent list can warn that those verbs stopped working. Empty for
built-in or purely-additive user agents.
Sourcepub fn entries(
&self,
) -> impl Iterator<Item = (&str, &AgentTemplate, Provenance)>
pub fn entries( &self, ) -> impl Iterator<Item = (&str, &AgentTemplate, Provenance)>
Every agent as (name, template, provenance), sorted by name, for
agent list.
Sourcepub fn write_starter(path: &Path) -> Result<()>
pub fn write_starter(path: &Path) -> Result<()>
Write the [starter_config] skeleton to path, creating parent
directories. Refuses to overwrite an existing file so a hand-tuned
config is never clobbered.
Trait Implementations§
Source§impl Clone for AgentsConfig
impl Clone for AgentsConfig
Source§fn clone(&self) -> AgentsConfig
fn clone(&self) -> AgentsConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more