Skip to main content

vv_agent/memory/artifacts/
render.rs

1#[derive(Debug, Clone, PartialEq, Eq)]
2pub struct PersistedArtifact {
3    pub path: String,
4    pub tool_name: Option<String>,
5    pub arguments: Option<String>,
6}
7
8pub fn render_persisted_artifacts_section(artifacts: &[PersistedArtifact]) -> Option<String> {
9    if artifacts.is_empty() {
10        return None;
11    }
12    let mut lines = vec!["<Persisted Artifacts>".to_string()];
13    for artifact in artifacts {
14        let tool = artifact.tool_name.as_deref().unwrap_or("unknown");
15        let arguments = artifact.arguments.as_deref().unwrap_or("");
16        let hint = "retrieval_hint: use read_file on artifact_path if needed";
17        if arguments.is_empty() {
18            lines.push(format!("- {} (tool: {tool}, {hint})", artifact.path));
19        } else {
20            lines.push(format!(
21                "- {} (tool: {tool}, arguments: {arguments}, {hint})",
22                artifact.path
23            ));
24        }
25    }
26    lines.push("</Persisted Artifacts>".to_string());
27    Some(lines.join("\n"))
28}