defs.rs: async conversion, remove block_in_place

Convert resolve(), resolve_placeholders(), run_agent() to async.
Use memory_render/memory_query directly with .await instead of
block_in_place wrappers.

Propagate async to callers:
- config.rs: resolve(), load_session(), reload_for_model()
- identity.rs: load_memory_files(), assemble_context_message()
- oneshot.rs: run_one_agent()
- prompts.rs: agent_prompt()

Co-Authored-By: Proof of Concept <poc@bcachefs.org>
This commit is contained in:
Kent Overstreet 2026-04-13 14:55:41 -04:00
parent 9bb07bc26a
commit 359955f838
10 changed files with 44 additions and 64 deletions

View file

@ -260,7 +260,7 @@ impl AutoAgent {
.map_err(|e| format!("config: {}", e))?;
let personality = crate::config::reload_for_model(
&app, &app.prompts.other,
).map_err(|e| format!("config: {}", e))?;
).await.map_err(|e| format!("config: {}", e))?;
let agent = Agent::new(
client, personality,
@ -381,7 +381,7 @@ pub struct AgentResult {
/// Run an agent. If keys are provided, use them directly (bypassing the
/// agent's query). Otherwise, run the query to select target nodes.
pub fn run_one_agent(
pub async fn run_one_agent(
store: &mut Store,
agent_name: &str,
count: usize,
@ -406,7 +406,7 @@ pub fn run_one_agent(
for step in &def.steps {
let (prompt, extra_keys) = defs::resolve_placeholders(
&step.prompt, store, keys, count,
);
).await;
all_keys.extend(extra_keys);
resolved_steps.push(prompts::ResolvedStep {
prompt,
@ -420,7 +420,7 @@ pub fn run_one_agent(
batch
} else {
let effective_count = def.count.unwrap_or(count);
defs::run_agent(store, &def, effective_count, &Default::default())?
defs::run_agent(store, &def, effective_count, &Default::default()).await?
};
// Base memory tools + extras from agent def (matching unconscious.rs pattern)