Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions rust/examples/single_doc_challenge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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?",
Expand Down Expand Up @@ -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);
Expand Down
7 changes: 5 additions & 2 deletions rust/src/agent/orchestrator/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
5 changes: 4 additions & 1 deletion rust/src/agent/orchestrator/replan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion rust/src/agent/orchestrator/supervisor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 1 addition & 3 deletions rust/src/agent/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<Vec<_>>()
.join("\n\n")
}
Expand Down
5 changes: 4 additions & 1 deletion rust/src/agent/tools/worker/cat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)),
}
Expand Down
9 changes: 4 additions & 5 deletions rust/src/agent/worker/execute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
}
Expand Down
4 changes: 2 additions & 2 deletions rust/src/agent/worker/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
43 changes: 15 additions & 28 deletions rust/src/agent/worker/navigation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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?;

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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"));
Expand Down
10 changes: 5 additions & 5 deletions rust/src/client/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -367,10 +367,7 @@ impl Engine {
) -> (Vec<IndexItem>, Vec<FailedItem>) {
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 {
Expand Down Expand Up @@ -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) => {
Expand Down
3 changes: 2 additions & 1 deletion rust/src/rerank/dedup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
];
Expand Down
Loading