Skip to main content

upsert_agent

Function upsert_agent 

Source
pub fn upsert_agent(
    storage_root: &Path,
    agent: AgentDefinition,
) -> Result<(), String>
Expand description

Insert or update agent in the stored roster, keyed by slug, then persist.

If an agent with the same slug exists it is replaced in place (preserving its original created_at_unix); otherwise agent is appended. updated_at_unix is bumped to the current wall-clock in both cases. Because load_roster seeds the default local agent when the store is empty, the first upsert of a new agent also materialises that seed to disk.