cli: add --state-dir flag to agent run
Override the agent output/input directory for manual testing.
Sets POC_AGENT_OUTPUT_DIR so output() writes there and
{{input:key}} reads from there.
Co-Authored-By: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
parent
4b32716d3e
commit
e176639437
2 changed files with 18 additions and 4 deletions
|
|
@ -3,12 +3,18 @@
|
|||
use crate::store;
|
||||
use crate::agents::llm;
|
||||
|
||||
pub fn cmd_run_agent(agent: &str, count: usize, target: &[String], query: Option<&str>, dry_run: bool, local: bool) -> Result<(), String> {
|
||||
pub fn cmd_run_agent(agent: &str, count: usize, target: &[String], query: Option<&str>, dry_run: bool, local: bool, state_dir: Option<&str>) -> Result<(), String> {
|
||||
// Mark as agent so tool calls (e.g. poc-memory render) don't
|
||||
// pollute the user's seen set as a side effect
|
||||
// SAFETY: single-threaded at this point (CLI startup, before any agent work)
|
||||
unsafe { std::env::set_var("POC_AGENT", "1"); }
|
||||
|
||||
// Override agent output/state directory if specified
|
||||
if let Some(dir) = state_dir {
|
||||
std::fs::create_dir_all(dir).map_err(|e| format!("create state dir: {}", e))?;
|
||||
unsafe { std::env::set_var("POC_AGENT_OUTPUT_DIR", dir); }
|
||||
}
|
||||
|
||||
if dry_run {
|
||||
unsafe { std::env::set_var("POC_MEMORY_DRY_RUN", "1"); }
|
||||
}
|
||||
|
|
@ -86,7 +92,12 @@ pub fn cmd_consolidate_batch(count: usize, auto: bool, agent: Option<String>) ->
|
|||
|
||||
if let Some(agent_name) = agent {
|
||||
let batch = crate::agents::prompts::agent_prompt(&store, &agent_name, count)?;
|
||||
println!("{}", batch.prompt);
|
||||
for (i, p) in batch.prompts.iter().enumerate() {
|
||||
if batch.prompts.len() > 1 {
|
||||
println!("=== STEP {} ===\n", i + 1);
|
||||
}
|
||||
println!("{}", p);
|
||||
}
|
||||
Ok(())
|
||||
} else {
|
||||
crate::agents::prompts::consolidation_batch(&store, count, auto)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue