diff --git a/rust/examples/single_doc_challenge.rs b/rust/examples/single_doc_challenge.rs index 332c241..cb174ac 100644 --- a/rust/examples/single_doc_challenge.rs +++ b/rust/examples/single_doc_challenge.rs @@ -152,19 +152,15 @@ const CHALLENGE_QUESTIONS: &[&str] = &[ // Requires: cross-reference Lab B's device characterization needs with // Lab A's FR-02 specs, then connect to the CapEx table for FR-02 cost "How much did the only refrigerator capable of characterizing Lab B's devices cost, and where is it located?", - // Requires: trace Lab C's below-threshold result → depends on Lab A's T1 // improvement → depends on tantalum junction transition "What specific materials change in another lab made Lab C's error correction milestone possible?", - // Requires: find the firmware bug in Lab D section, then look at the // Lab A FR-01 qubit count, then compute the impact window "How many qubits were affected by the firmware bug, and for how many days?", - // Requires: Lab B gap/target ratio (70%) × theoretical target (0.5meV) // → actual gap = 0.35meV, compare with 2026 goal of 0.45meV "What is the gap between Lab B's current topological gap achievement and the 2026 target, in meV?", - // Requires: trace the dependency chain: 256-qubit goal → need FR-03 → // cost $9-11M → government contracts are largest revenue source at $19.8M "If the 2026 qubit scaling goal requires a new refrigerator, can the largest revenue source category alone cover its estimated cost?", @@ -205,7 +201,10 @@ async fn main() -> vectorless::Result<()> { } else { println!("Indexing research report..."); let result = engine - .index(IndexContext::from_content(REPORT, DocumentFormat::Markdown).with_name(doc_name)) + .index( + IndexContext::from_content(REPORT, DocumentFormat::Markdown) + .with_name(doc_name), + ) .await?; let id = result.doc_id().unwrap().to_string(); println!(" doc_id: {}\n", id); diff --git a/rust/src/agent/orchestrator/mod.rs b/rust/src/agent/orchestrator/mod.rs index 6bb6bc2..643ca0f 100644 --- a/rust/src/agent/orchestrator/mod.rs +++ b/rust/src/agent/orchestrator/mod.rs @@ -144,8 +144,11 @@ impl<'a> Agent for Orchestrator<'a> { .await?; orch_llm_calls += outcome.llm_calls; - let confidence = - compute_confidence(outcome.eval_sufficient, outcome.iteration, state.all_evidence.is_empty()); + let confidence = compute_confidence( + outcome.eval_sufficient, + outcome.iteration, + state.all_evidence.is_empty(), + ); // --- Phase 3: Finalize — rerank + synthesize --- if state.all_evidence.is_empty() { diff --git a/rust/src/agent/orchestrator/replan.rs b/rust/src/agent/orchestrator/replan.rs index 507c171..58ce32b 100644 --- a/rust/src/agent/orchestrator/replan.rs +++ b/rust/src/agent/orchestrator/replan.rs @@ -59,7 +59,10 @@ pub async fn replan( &find_text, ); - info!(evidence = collected_evidence.len(), "Replanning dispatch targets..."); + info!( + evidence = collected_evidence.len(), + "Replanning dispatch targets..." + ); let response = llm .complete(&system, &user) .await diff --git a/rust/src/agent/orchestrator/supervisor.rs b/rust/src/agent/orchestrator/supervisor.rs index 9dd4a37..664d06c 100644 --- a/rust/src/agent/orchestrator/supervisor.rs +++ b/rust/src/agent/orchestrator/supervisor.rs @@ -13,10 +13,10 @@ use super::super::events::EventEmitter; use super::super::prompts::DispatchEntry; use super::super::state::OrchestratorState; use super::super::tools::orchestrator as orch_tools; +use super::MAX_SUPERVISOR_ITERATIONS; use super::dispatch; use super::evaluate::evaluate; use super::replan::replan; -use super::MAX_SUPERVISOR_ITERATIONS; /// Outcome of the supervisor loop. pub struct SupervisorOutcome { diff --git a/rust/src/agent/state.rs b/rust/src/agent/state.rs index e0deb3b..9e0612a 100644 --- a/rust/src/agent/state.rs +++ b/rust/src/agent/state.rs @@ -158,9 +158,7 @@ impl WorkerState { } self.evidence .iter() - .map(|e| { - format!("[{}]\n{}", e.node_title, e.content) - }) + .map(|e| format!("[{}]\n{}", e.node_title, e.content)) .collect::>() .join("\n\n") } diff --git a/rust/src/agent/tools/worker/cat.rs b/rust/src/agent/tools/worker/cat.rs index 3792290..107aafa 100644 --- a/rust/src/agent/tools/worker/cat.rs +++ b/rust/src/agent/tools/worker/cat.rs @@ -53,7 +53,10 @@ pub fn cat(target: &str, ctx: &DocContext, state: &mut WorkerState) -> ToolResul state.collected_nodes.insert(node_id); state.visited.insert(node_id); - ToolResult::ok(format!("[Evidence collected: {}]\n{}", title, content_string)) + ToolResult::ok(format!( + "[Evidence collected: {}]\n{}", + title, content_string + )) } None => ToolResult::fail(format!("No content available for '{}'.", target)), } diff --git a/rust/src/agent/worker/execute.rs b/rust/src/agent/worker/execute.rs index c4fa8c1..66c4025 100644 --- a/rust/src/agent/worker/execute.rs +++ b/rust/src/agent/worker/execute.rs @@ -133,12 +133,11 @@ pub async fn execute_command( results.len() ); for (title, node_id, depth) in &results { - output.push_str(&format!( - " - {} (depth {})", - title, depth - )); + output.push_str(&format!(" - {} (depth {})", title, depth)); if let Some(content) = ctx.cat(*node_id) { - if let Some(snippet) = super::super::tools::content_snippet(content, keyword, 300) { + if let Some(snippet) = + super::super::tools::content_snippet(content, keyword, 300) + { output.push_str(&format!("\n \"{}\"", snippet)); } } diff --git a/rust/src/agent/worker/mod.rs b/rust/src/agent/worker/mod.rs index f0577c8..b906d30 100644 --- a/rust/src/agent/worker/mod.rs +++ b/rust/src/agent/worker/mod.rs @@ -165,8 +165,8 @@ impl<'a> Agent for Worker<'a> { ) .await?; - let budget_exhausted = state.remaining == 0 - || (config.max_llm_calls > 0 && llm_calls >= config.max_llm_calls); + let budget_exhausted = + state.remaining == 0 || (config.max_llm_calls > 0 && llm_calls >= config.max_llm_calls); let output = state.into_worker_output(llm_calls, budget_exhausted, ctx.doc_name); diff --git a/rust/src/agent/worker/navigation.rs b/rust/src/agent/worker/navigation.rs index c41f0bf..29b1a68 100644 --- a/rust/src/agent/worker/navigation.rs +++ b/rust/src/agent/worker/navigation.rs @@ -71,13 +71,13 @@ pub async fn run_navigation_loop( max_rounds = config.max_rounds, "Navigation round: calling LLM..." ); - let llm_output = - llm.complete(&system, &user) - .await - .map_err(|e| Error::LlmReasoning { - stage: "worker/navigation".to_string(), - detail: format!("Nav loop LLM call failed (round {round_num}): {e}"), - })?; + let llm_output = llm + .complete(&system, &user) + .await + .map_err(|e| Error::LlmReasoning { + stage: "worker/navigation".to_string(), + detail: format!("Nav loop LLM call failed (round {round_num}): {e}"), + })?; *llm_calls += 1; // Parse command @@ -91,28 +91,11 @@ pub async fn run_navigation_loop( let is_check = matches!(command, Command::Check); // Execute - let step = execute_command( - &command, - ctx, - state, - query, - llm, - llm_calls, - emitter, - ) - .await; + let step = execute_command(&command, ctx, state, query, llm, llm_calls, emitter).await; // Dynamic re-planning after insufficient check handle_replan( - is_check, - query, - task, - ctx, - llm, - state, - emitter, - llm_calls, - max_llm, + is_check, query, task, ctx, llm, state, emitter, llm_calls, max_llm, ) .await?; @@ -250,7 +233,10 @@ async fn handle_replan( return Ok(()); } - if !state.missing_info.is_empty() && state.remaining >= 3 && (max_llm == 0 || *llm_calls < max_llm) { + if !state.missing_info.is_empty() + && state.remaining >= 3 + && (max_llm == 0 || *llm_calls < max_llm) + { let missing = state.missing_info.clone(); info!(doc = ctx.doc_name, missing = %missing, "Re-planning navigation..."); let replan = build_replan_prompt(query, task, state, ctx); @@ -323,7 +309,8 @@ mod tests { }; let mut state = WorkerState::new(root, 10); - let (_cmd, is_failure) = handle_parse_failure("random garbage text", ctx.doc_name, &mut state); + let (_cmd, is_failure) = + handle_parse_failure("random garbage text", ctx.doc_name, &mut state); assert!(is_failure); assert!(state.last_feedback.contains("not recognized")); assert!(state.history.last().unwrap().contains("unrecognized")); diff --git a/rust/src/client/engine.rs b/rust/src/client/engine.rs index cc95a5f..47ad9bf 100644 --- a/rust/src/client/engine.rs +++ b/rust/src/client/engine.rs @@ -367,10 +367,7 @@ impl Engine { ) -> (Vec, Vec) { let item = Self::build_index_item(&doc); - info!( - "[index] Persisting document '{}'...", - doc.name, - ); + info!("[index] Persisting document '{}'...", doc.name,); let persisted = IndexerClient::to_persisted(doc, pipeline_options).await; if let Err(e) = self.workspace.save(&persisted).await { @@ -1036,7 +1033,10 @@ impl Engine { match result { Ok(Some(doc)) => loaded_docs.push(doc), Ok(None) => { - warn!(doc_id, "Document in meta index but not in backend during graph rebuild"); + warn!( + doc_id, + "Document in meta index but not in backend during graph rebuild" + ); failed_count += 1; } Err(e) => { diff --git a/rust/src/rerank/dedup.rs b/rust/src/rerank/dedup.rs index c54fc0a..8644a93 100644 --- a/rust/src/rerank/dedup.rs +++ b/rust/src/rerank/dedup.rs @@ -161,7 +161,8 @@ mod tests { Evidence { source_path: "root/section_a".to_string(), node_title: "A2".to_string(), - content: "different content but same source path that should be deduped".to_string(), + content: "different content but same source path that should be deduped" + .to_string(), doc_name: None, }, ];