TurnResult: remove text field, simplify oneshot loop
- Remove TurnResult.text (was dead code - Agent::turn handles text internally) - Simplify run_with_backend to just iterate over steps (Agent::turn loops for tool calls and handles empty responses internally) - Change run/run_shared/run_forked_shared to return Result<(), String> - Remove AgentResult.output field (no callers used it) - Stub out legacy text-parsing code (audit, compare) that needs redesign - Update digest.rs to not depend on text return - Add level parameter to journal_new/journal_update for digest support Co-Authored-By: Proof of Concept <poc@bcachefs.org>
This commit is contained in:
parent
ef80398466
commit
f00532bdb7
11 changed files with 82 additions and 422 deletions
|
|
@ -284,14 +284,13 @@ fn generate_digest(
|
|||
.filter(|t| def.tools.iter().any(|w| w == &t.name))
|
||||
.collect()
|
||||
};
|
||||
let digest = crate::agent::oneshot::call_api_with_tools_sync(
|
||||
// Agent writes digest via memory_write tool - we just run it
|
||||
crate::agent::oneshot::call_api_with_tools_sync(
|
||||
&def.agent, &prompts, &phases, def.temperature, def.priority,
|
||||
&tools, None)?;
|
||||
|
||||
let key = digest_node_key(level.name, label);
|
||||
store.upsert_provenance(&key, &digest, "digest:write")?;
|
||||
|
||||
// Structural links: connect all source entries to this digest
|
||||
let key = digest_node_key(level.name, label);
|
||||
let mut linked = 0;
|
||||
for source_key in source_keys {
|
||||
// Skip if link already exists
|
||||
|
|
@ -299,10 +298,17 @@ fn generate_digest(
|
|||
!r.deleted && r.source_key == *source_key && r.target_key == key);
|
||||
if exists { continue; }
|
||||
|
||||
// Reload store to pick up agent's writes
|
||||
*store = Store::load().map_err(|e| format!("reload: {}", e))?;
|
||||
|
||||
let source_uuid = store.nodes.get(source_key)
|
||||
.map(|n| n.uuid).unwrap_or([0u8; 16]);
|
||||
let target_uuid = store.nodes.get(&key)
|
||||
.map(|n| n.uuid).unwrap_or([0u8; 16]);
|
||||
if target_uuid == [0u8; 16] {
|
||||
println!(" Warning: digest key {} not found after agent run", key);
|
||||
continue;
|
||||
}
|
||||
let mut rel = new_relation(
|
||||
source_uuid, target_uuid,
|
||||
store::RelationType::Link, 0.8,
|
||||
|
|
@ -314,12 +320,10 @@ fn generate_digest(
|
|||
}
|
||||
if linked > 0 {
|
||||
println!(" Linked {} source entries → {}", linked, key);
|
||||
store.save()?;
|
||||
}
|
||||
|
||||
store.save()?;
|
||||
println!(" Stored: {}", key);
|
||||
|
||||
println!(" Done: {} lines", digest.lines().count());
|
||||
println!(" Done");
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue