merge poc-agent into poc-memory as agent/ module

Eliminates the circular dependency between poc-agent and poc-memory by
moving all poc-agent source into poc-memory/src/agent/. The poc-agent
binary now builds from poc-memory/src/bin/poc-agent.rs using library
imports. All poc_agent:: references updated to crate::agent::.

poc-agent/ directory kept for now (removed from workspace members).

Co-Authored-By: Proof of Concept <poc@bcachefs.org>
This commit is contained in:
ProofOfConcept 2026-03-25 00:52:41 -04:00
parent 01abd795ce
commit 891cca57f8
35 changed files with 9178 additions and 88 deletions

View file

@ -0,0 +1,51 @@
// tools/write.rs — Write file contents
use anyhow::{Context, Result};
use serde::Deserialize;
use serde_json::json;
use std::path::Path;
use crate::agent::types::ToolDef;
#[derive(Deserialize)]
struct Args {
file_path: String,
content: String,
}
pub fn definition() -> ToolDef {
ToolDef::new(
"write_file",
"Write content to a file. Creates the file if it doesn't exist, \
overwrites if it does. Creates parent directories as needed.",
json!({
"type": "object",
"properties": {
"file_path": {
"type": "string",
"description": "Absolute path to the file to write"
},
"content": {
"type": "string",
"description": "The content to write to the file"
}
},
"required": ["file_path", "content"]
}),
)
}
pub fn write_file(args: &serde_json::Value) -> Result<String> {
let args: Args = serde_json::from_value(args.clone())
.context("invalid write_file arguments")?;
if let Some(parent) = Path::new(&args.file_path).parent() {
std::fs::create_dir_all(parent)
.with_context(|| format!("Failed to create directories for {}", args.file_path))?;
}
std::fs::write(&args.file_path, &args.content)
.with_context(|| format!("Failed to write {}", args.file_path))?;
Ok(format!("Wrote {} lines to {}", args.content.lines().count(), args.file_path))
}