agents: extract run_and_apply, eliminate dead split-plan.md
- Add run_and_apply() — combines run_one_agent + action application into one call. Used by daemon job_consolidation_agent and consolidate_full, which had identical run+apply loops. - Port split_plan_prompt() to use split.agent via defs::resolve_placeholders instead of loading the separate split-plan.md template. Make resolve_placeholders public for this. - Delete prompts/split-plan.md — superseded by agents/split.agent which was already the canonical definition.
This commit is contained in:
parent
abab85d249
commit
945865f594
6 changed files with 35 additions and 127 deletions
|
|
@ -83,7 +83,7 @@ pub fn consolidate_full_with_progress(
|
|||
*store = Store::load()?;
|
||||
}
|
||||
|
||||
let result = match knowledge::run_one_agent(store, agent_type, *count, "consolidate") {
|
||||
let (total, applied) = match knowledge::run_and_apply(store, agent_type, *count, "consolidate") {
|
||||
Ok(r) => r,
|
||||
Err(e) => {
|
||||
let msg = format!(" ERROR: {}", e);
|
||||
|
|
@ -93,19 +93,10 @@ pub fn consolidate_full_with_progress(
|
|||
continue;
|
||||
}
|
||||
};
|
||||
|
||||
let ts = store::compact_timestamp();
|
||||
let mut applied = 0;
|
||||
for action in &result.actions {
|
||||
if knowledge::apply_action(store, action, agent_type, &ts, 0) {
|
||||
applied += 1;
|
||||
}
|
||||
}
|
||||
total_actions += result.actions.len();
|
||||
total_actions += total;
|
||||
total_applied += applied;
|
||||
|
||||
let msg = format!(" Done: {} actions ({} applied, {} no-ops)",
|
||||
result.actions.len(), applied, result.no_ops);
|
||||
let msg = format!(" Done: {} actions ({} applied)", total, applied);
|
||||
log_line(&mut log_buf, &msg);
|
||||
on_progress(&msg);
|
||||
println!("{}", msg);
|
||||
|
|
@ -246,7 +237,7 @@ pub fn apply_consolidation(store: &mut Store, do_apply: bool, report_key: Option
|
|||
return Ok(());
|
||||
}
|
||||
|
||||
let ts = store::format_datetime(store::now_epoch()).replace([':', '-', 'T'], "");
|
||||
let ts = store::compact_timestamp();
|
||||
let mut applied = 0;
|
||||
for action in &all_actions {
|
||||
if knowledge::apply_action(store, action, "consolidate", &ts, 0) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue