Skip to content

Commit f550b7c

Browse files
authored
Merge pull request #107 from vectorlessflow/dev
refactor: format code for better readability
2 parents 45273b3 + ae1c769 commit f550b7c

11 files changed

Lines changed: 47 additions & 54 deletions

File tree

rust/examples/single_doc_challenge.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -152,19 +152,15 @@ const CHALLENGE_QUESTIONS: &[&str] = &[
152152
// Requires: cross-reference Lab B's device characterization needs with
153153
// Lab A's FR-02 specs, then connect to the CapEx table for FR-02 cost
154154
"How much did the only refrigerator capable of characterizing Lab B's devices cost, and where is it located?",
155-
156155
// Requires: trace Lab C's below-threshold result → depends on Lab A's T1
157156
// improvement → depends on tantalum junction transition
158157
"What specific materials change in another lab made Lab C's error correction milestone possible?",
159-
160158
// Requires: find the firmware bug in Lab D section, then look at the
161159
// Lab A FR-01 qubit count, then compute the impact window
162160
"How many qubits were affected by the firmware bug, and for how many days?",
163-
164161
// Requires: Lab B gap/target ratio (70%) × theoretical target (0.5meV)
165162
// → actual gap = 0.35meV, compare with 2026 goal of 0.45meV
166163
"What is the gap between Lab B's current topological gap achievement and the 2026 target, in meV?",
167-
168164
// Requires: trace the dependency chain: 256-qubit goal → need FR-03 →
169165
// cost $9-11M → government contracts are largest revenue source at $19.8M
170166
"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<()> {
205201
} else {
206202
println!("Indexing research report...");
207203
let result = engine
208-
.index(IndexContext::from_content(REPORT, DocumentFormat::Markdown).with_name(doc_name))
204+
.index(
205+
IndexContext::from_content(REPORT, DocumentFormat::Markdown)
206+
.with_name(doc_name),
207+
)
209208
.await?;
210209
let id = result.doc_id().unwrap().to_string();
211210
println!(" doc_id: {}\n", id);

rust/src/agent/orchestrator/mod.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,11 @@ impl<'a> Agent for Orchestrator<'a> {
144144
.await?;
145145
orch_llm_calls += outcome.llm_calls;
146146

147-
let confidence =
148-
compute_confidence(outcome.eval_sufficient, outcome.iteration, state.all_evidence.is_empty());
147+
let confidence = compute_confidence(
148+
outcome.eval_sufficient,
149+
outcome.iteration,
150+
state.all_evidence.is_empty(),
151+
);
149152

150153
// --- Phase 3: Finalize — rerank + synthesize ---
151154
if state.all_evidence.is_empty() {

rust/src/agent/orchestrator/replan.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,10 @@ pub async fn replan(
5959
&find_text,
6060
);
6161

62-
info!(evidence = collected_evidence.len(), "Replanning dispatch targets...");
62+
info!(
63+
evidence = collected_evidence.len(),
64+
"Replanning dispatch targets..."
65+
);
6366
let response = llm
6467
.complete(&system, &user)
6568
.await

rust/src/agent/orchestrator/supervisor.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ use super::super::events::EventEmitter;
1313
use super::super::prompts::DispatchEntry;
1414
use super::super::state::OrchestratorState;
1515
use super::super::tools::orchestrator as orch_tools;
16+
use super::MAX_SUPERVISOR_ITERATIONS;
1617
use super::dispatch;
1718
use super::evaluate::evaluate;
1819
use super::replan::replan;
19-
use super::MAX_SUPERVISOR_ITERATIONS;
2020

2121
/// Outcome of the supervisor loop.
2222
pub struct SupervisorOutcome {

rust/src/agent/state.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,7 @@ impl WorkerState {
158158
}
159159
self.evidence
160160
.iter()
161-
.map(|e| {
162-
format!("[{}]\n{}", e.node_title, e.content)
163-
})
161+
.map(|e| format!("[{}]\n{}", e.node_title, e.content))
164162
.collect::<Vec<_>>()
165163
.join("\n\n")
166164
}

rust/src/agent/tools/worker/cat.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,10 @@ pub fn cat(target: &str, ctx: &DocContext, state: &mut WorkerState) -> ToolResul
5353
state.collected_nodes.insert(node_id);
5454
state.visited.insert(node_id);
5555

56-
ToolResult::ok(format!("[Evidence collected: {}]\n{}", title, content_string))
56+
ToolResult::ok(format!(
57+
"[Evidence collected: {}]\n{}",
58+
title, content_string
59+
))
5760
}
5861
None => ToolResult::fail(format!("No content available for '{}'.", target)),
5962
}

rust/src/agent/worker/execute.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -133,12 +133,11 @@ pub async fn execute_command(
133133
results.len()
134134
);
135135
for (title, node_id, depth) in &results {
136-
output.push_str(&format!(
137-
" - {} (depth {})",
138-
title, depth
139-
));
136+
output.push_str(&format!(" - {} (depth {})", title, depth));
140137
if let Some(content) = ctx.cat(*node_id) {
141-
if let Some(snippet) = super::super::tools::content_snippet(content, keyword, 300) {
138+
if let Some(snippet) =
139+
super::super::tools::content_snippet(content, keyword, 300)
140+
{
142141
output.push_str(&format!("\n \"{}\"", snippet));
143142
}
144143
}

rust/src/agent/worker/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,8 @@ impl<'a> Agent for Worker<'a> {
165165
)
166166
.await?;
167167

168-
let budget_exhausted = state.remaining == 0
169-
|| (config.max_llm_calls > 0 && llm_calls >= config.max_llm_calls);
168+
let budget_exhausted =
169+
state.remaining == 0 || (config.max_llm_calls > 0 && llm_calls >= config.max_llm_calls);
170170

171171
let output = state.into_worker_output(llm_calls, budget_exhausted, ctx.doc_name);
172172

rust/src/agent/worker/navigation.rs

Lines changed: 15 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,13 @@ pub async fn run_navigation_loop(
7171
max_rounds = config.max_rounds,
7272
"Navigation round: calling LLM..."
7373
);
74-
let llm_output =
75-
llm.complete(&system, &user)
76-
.await
77-
.map_err(|e| Error::LlmReasoning {
78-
stage: "worker/navigation".to_string(),
79-
detail: format!("Nav loop LLM call failed (round {round_num}): {e}"),
80-
})?;
74+
let llm_output = llm
75+
.complete(&system, &user)
76+
.await
77+
.map_err(|e| Error::LlmReasoning {
78+
stage: "worker/navigation".to_string(),
79+
detail: format!("Nav loop LLM call failed (round {round_num}): {e}"),
80+
})?;
8181
*llm_calls += 1;
8282

8383
// Parse command
@@ -91,28 +91,11 @@ pub async fn run_navigation_loop(
9191
let is_check = matches!(command, Command::Check);
9292

9393
// Execute
94-
let step = execute_command(
95-
&command,
96-
ctx,
97-
state,
98-
query,
99-
llm,
100-
llm_calls,
101-
emitter,
102-
)
103-
.await;
94+
let step = execute_command(&command, ctx, state, query, llm, llm_calls, emitter).await;
10495

10596
// Dynamic re-planning after insufficient check
10697
handle_replan(
107-
is_check,
108-
query,
109-
task,
110-
ctx,
111-
llm,
112-
state,
113-
emitter,
114-
llm_calls,
115-
max_llm,
98+
is_check, query, task, ctx, llm, state, emitter, llm_calls, max_llm,
11699
)
117100
.await?;
118101

@@ -250,7 +233,10 @@ async fn handle_replan(
250233
return Ok(());
251234
}
252235

253-
if !state.missing_info.is_empty() && state.remaining >= 3 && (max_llm == 0 || *llm_calls < max_llm) {
236+
if !state.missing_info.is_empty()
237+
&& state.remaining >= 3
238+
&& (max_llm == 0 || *llm_calls < max_llm)
239+
{
254240
let missing = state.missing_info.clone();
255241
info!(doc = ctx.doc_name, missing = %missing, "Re-planning navigation...");
256242
let replan = build_replan_prompt(query, task, state, ctx);
@@ -323,7 +309,8 @@ mod tests {
323309
};
324310
let mut state = WorkerState::new(root, 10);
325311

326-
let (_cmd, is_failure) = handle_parse_failure("random garbage text", ctx.doc_name, &mut state);
312+
let (_cmd, is_failure) =
313+
handle_parse_failure("random garbage text", ctx.doc_name, &mut state);
327314
assert!(is_failure);
328315
assert!(state.last_feedback.contains("not recognized"));
329316
assert!(state.history.last().unwrap().contains("unrecognized"));

rust/src/client/engine.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -367,10 +367,7 @@ impl Engine {
367367
) -> (Vec<IndexItem>, Vec<FailedItem>) {
368368
let item = Self::build_index_item(&doc);
369369

370-
info!(
371-
"[index] Persisting document '{}'...",
372-
doc.name,
373-
);
370+
info!("[index] Persisting document '{}'...", doc.name,);
374371
let persisted = IndexerClient::to_persisted(doc, pipeline_options).await;
375372

376373
if let Err(e) = self.workspace.save(&persisted).await {
@@ -1036,7 +1033,10 @@ impl Engine {
10361033
match result {
10371034
Ok(Some(doc)) => loaded_docs.push(doc),
10381035
Ok(None) => {
1039-
warn!(doc_id, "Document in meta index but not in backend during graph rebuild");
1036+
warn!(
1037+
doc_id,
1038+
"Document in meta index but not in backend during graph rebuild"
1039+
);
10401040
failed_count += 1;
10411041
}
10421042
Err(e) => {

0 commit comments

Comments
 (0)