pub struct ProfileManager { /* private fields */ }Expand description
Manages three context profiles: user, project, and active state. Profiles are always injected into the system prompt.
Implementations§
Source§impl ProfileManager
impl ProfileManager
Sourcepub fn new(user_dir: PathBuf, project_dir: PathBuf) -> Result<Self>
pub fn new(user_dir: PathBuf, project_dir: PathBuf) -> Result<Self>
Create a ProfileManager.
user_dir — user config directory (~/.tiny-agent/profile/)
project_dir — project config directory (.tiny-agent/profile/)
Sourcepub fn user_profile(&self) -> String
pub fn user_profile(&self) -> String
Read the user profile.
Sourcepub fn try_user_profile(&self) -> Result<String>
pub fn try_user_profile(&self) -> Result<String>
Read the user profile, returning filesystem errors except missing files.
Sourcepub fn project_profile(&self) -> String
pub fn project_profile(&self) -> String
Read the project profile.
Sourcepub fn try_project_profile(&self) -> Result<String>
pub fn try_project_profile(&self) -> Result<String>
Read the project profile, returning filesystem errors except missing files.
Sourcepub fn active_state(&self) -> String
pub fn active_state(&self) -> String
Read the active state.
Sourcepub fn try_active_state(&self) -> Result<String>
pub fn try_active_state(&self) -> Result<String>
Read the active state, returning filesystem errors except missing files.
Sourcepub fn set_user_profile(&self, content: &str) -> Result<()>
pub fn set_user_profile(&self, content: &str) -> Result<()>
Write/update the user profile.
Sourcepub fn set_project_profile(&self, content: &str) -> Result<()>
pub fn set_project_profile(&self, content: &str) -> Result<()>
Write/update the project profile.
Sourcepub fn update_active_state(&self, summary: &str) -> Result<()>
pub fn update_active_state(&self, summary: &str) -> Result<()>
Update the active state — called at session end with a summary.
Sourcepub fn consolidate_user_profile(&self) -> Result<()>
pub fn consolidate_user_profile(&self) -> Result<()>
Canonicalize the user profile file during a consolidation pass.
This lightweight implementation does not infer facts. It preserves any existing content, trims surrounding whitespace, and creates an empty profile skeleton when the file does not exist yet.
Sourcepub fn consolidate_project_profile(&self) -> Result<()>
pub fn consolidate_project_profile(&self) -> Result<()>
Canonicalize the project profile file during a consolidation pass.
This lightweight implementation does not infer project conventions. It preserves any existing content, trims surrounding whitespace, and creates an empty profile skeleton when the file does not exist yet.
Sourcepub fn render_all(&self) -> String
pub fn render_all(&self) -> String
Render all three profiles as a combined prompt section.
Sourcepub fn try_render_all(&self) -> Result<String>
pub fn try_render_all(&self) -> Result<String>
Render all three profiles as a combined prompt section.