Skip to content

Commit b5f1a54

Browse files
committed
style: run cargo fmt
1 parent ce95b6d commit b5f1a54

26 files changed

Lines changed: 593 additions & 330 deletions

core/examples/default_implementations.rs

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
//! context providers, and HITL confirmation.
55
66
use a3s_code_core::{
7-
Agent, SessionOptions,
87
context::{FileSystemContextConfig, FileSystemContextProvider},
9-
security::{DefaultSecurityProvider, DefaultSecurityConfig, SecurityProvider},
108
hitl::{ConfirmationManager, ConfirmationPolicy},
9+
security::{DefaultSecurityConfig, DefaultSecurityProvider, SecurityProvider},
10+
Agent, SessionOptions,
1111
};
1212
use std::sync::Arc;
1313
use tokio::sync::broadcast;
@@ -60,12 +60,15 @@ async fn main() -> anyhow::Result<()> {
6060
println!(" - Timeout action: Reject\n");
6161

6262
// 5. Create session with all default implementations
63-
let session = agent.session(".", Some(
64-
SessionOptions::new()
65-
.with_security_provider(security_provider.clone())
66-
.with_context_provider(fs_provider)
67-
.with_confirmation_manager(confirmation_manager.clone())
68-
))?;
63+
let session = agent.session(
64+
".",
65+
Some(
66+
SessionOptions::new()
67+
.with_security_provider(security_provider.clone())
68+
.with_context_provider(fs_provider)
69+
.with_confirmation_manager(confirmation_manager.clone()),
70+
),
71+
)?;
6972

7073
println!("✓ Session created with all default implementations\n");
7174

@@ -99,7 +102,9 @@ async fn main() -> anyhow::Result<()> {
99102
let pending = confirmation_manager_clone.pending_confirmations().await;
100103
if let Some((tool_id, tool_name, _)) = pending.first() {
101104
println!(" → User approved: {}", tool_name);
102-
let _ = confirmation_manager_clone.confirm(tool_id, true, None).await;
105+
let _ = confirmation_manager_clone
106+
.confirm(tool_id, true, None)
107+
.await;
103108
}
104109
});
105110

core/examples/integration_tests.rs

Lines changed: 56 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@ async fn main() -> Result<()> {
3131
.map(|p| p.join(".a3s/config.hcl"));
3232
project_root.filter(|p| p.exists())
3333
})
34-
.expect("Config file not found. Please create ~/.a3s/config.hcl or use project .a3s/config.hcl");
34+
.expect(
35+
"Config file not found. Please create ~/.a3s/config.hcl or use project .a3s/config.hcl",
36+
);
3537

3638
println!("📄 Using config: {}", config_path.display());
3739
println!("{}", "=".repeat(80));
@@ -61,8 +63,12 @@ async fn main() -> Result<()> {
6163
// Test 7: Queue Configuration
6264
test_queue_config(&agent).await?;
6365

64-
println!("{}", "
65-
".repeat(2));
66+
println!(
67+
"{}",
68+
"
69+
"
70+
.repeat(2)
71+
);
6672
println!("{}", "=".repeat(80));
6773
println!("✅ All integration tests completed successfully!");
6874
println!("{}", "=".repeat(80));
@@ -78,7 +84,9 @@ async fn test_basic_tools(agent: &Agent) -> Result<()> {
7884
let session = agent.session(".", None)?;
7985

8086
println!("Testing: List current directory...");
81-
let result = session.send("List the files in the current directory using ls", None).await?;
87+
let result = session
88+
.send("List the files in the current directory using ls", None)
89+
.await?;
8290
println!("✓ Result preview: {}", truncate(&result.text, 200));
8391

8492
println!("\nTesting: Read a file...");
@@ -94,17 +102,18 @@ async fn test_builtin_skills(agent: &Agent) -> Result<()> {
94102
println!("\n🧠 Test 2: Built-in Skills (7 skills)");
95103
println!("{}", "-".repeat(80));
96104

97-
let session = agent.session(".", Some(
98-
SessionOptions::new()
99-
.with_builtin_skills()
100-
))?;
105+
let session = agent.session(".", Some(SessionOptions::new().with_builtin_skills()))?;
101106

102107
println!("Testing: code-search skill...");
103-
let result = session.send("Search for all functions named 'new' in Rust files", None).await?;
108+
let result = session
109+
.send("Search for all functions named 'new' in Rust files", None)
110+
.await?;
104111
println!("✓ Result preview: {}", truncate(&result.text, 200));
105112

106113
println!("\nTesting: builtin-tools skill...");
107-
let result = session.send("What tools are available for file operations?", None).await?;
114+
let result = session
115+
.send("What tools are available for file operations?", None)
116+
.await?;
108117
println!("✓ Result preview: {}", truncate(&result.text, 200));
109118

110119
println!("\n✅ Test 2 passed: Built-in skills work correctly");
@@ -126,14 +135,18 @@ async fn test_file_operations(agent: &Agent) -> Result<()> {
126135
println!("✓ Result: {}", truncate(&result.text, 200));
127136

128137
println!("\nTesting: Read the test file...");
129-
let result = session.send("Read the file test_integration.txt", None).await?;
138+
let result = session
139+
.send("Read the file test_integration.txt", None)
140+
.await?;
130141
println!("✓ Result: {}", truncate(&result.text, 200));
131142

132143
println!("\nTesting: Edit the test file...");
133-
let result = session.send(
134-
"Edit test_integration.txt and replace 'Hello' with 'Greetings'",
135-
None
136-
).await?;
144+
let result = session
145+
.send(
146+
"Edit test_integration.txt and replace 'Hello' with 'Greetings'",
147+
None,
148+
)
149+
.await?;
137150
println!("✓ Result: {}", truncate(&result.text, 200));
138151

139152
println!("\nCleaning up: Remove test file...");
@@ -151,17 +164,18 @@ async fn test_search_operations(agent: &Agent) -> Result<()> {
151164
let session = agent.session(".", None)?;
152165

153166
println!("Testing: grep search...");
154-
let result = session.send(
155-
"Search for the word 'Agent' in all Rust files using grep",
156-
None
157-
).await?;
167+
let result = session
168+
.send(
169+
"Search for the word 'Agent' in all Rust files using grep",
170+
None,
171+
)
172+
.await?;
158173
println!("✓ Result preview: {}", truncate(&result.text, 200));
159174

160175
println!("\nTesting: glob pattern matching...");
161-
let result = session.send(
162-
"Find all .rs files in the src directory using glob",
163-
None
164-
).await?;
176+
let result = session
177+
.send("Find all .rs files in the src directory using glob", None)
178+
.await?;
165179
println!("✓ Result preview: {}", truncate(&result.text, 200));
166180

167181
println!("\n✅ Test 4 passed: Search operations work correctly");
@@ -200,11 +214,14 @@ async fn test_planning_mode(agent: &Agent) -> Result<()> {
200214
println!("\n🎯 Test 6: Planning Mode");
201215
println!("{}", "-".repeat(80));
202216

203-
let session = agent.session(".", Some(
204-
SessionOptions::new()
205-
.with_planning(true)
206-
.with_goal_tracking(true)
207-
))?;
217+
let session = agent.session(
218+
".",
219+
Some(
220+
SessionOptions::new()
221+
.with_planning(true)
222+
.with_goal_tracking(true),
223+
),
224+
)?;
208225

209226
println!("Testing: Multi-step task with planning...");
210227
let result = session.send(
@@ -225,7 +242,7 @@ async fn test_queue_config(agent: &Agent) -> Result<()> {
225242
println!("\n⚡ Test 7: Queue Configuration (A3S Lane v0.4.0)");
226243
println!("{}", "-".repeat(80));
227244

228-
use a3s_code_core::queue::{SessionQueueConfig, RetryPolicyConfig};
245+
use a3s_code_core::queue::{RetryPolicyConfig, SessionQueueConfig};
229246

230247
let queue_config = SessionQueueConfig {
231248
query_max_concurrency: 5,
@@ -241,16 +258,18 @@ async fn test_queue_config(agent: &Agent) -> Result<()> {
241258
..Default::default()
242259
};
243260

244-
let session = agent.session(".", Some(
245-
SessionOptions::new()
246-
.with_queue_config(queue_config)
247-
))?;
261+
let session = agent.session(
262+
".",
263+
Some(SessionOptions::new().with_queue_config(queue_config)),
264+
)?;
248265

249266
println!("Testing: Parallel query operations with queue...");
250-
let result = session.send(
251-
"List all .rs files and count how many contain the word 'async'",
252-
None
253-
).await?;
267+
let result = session
268+
.send(
269+
"List all .rs files and count how many contain the word 'async'",
270+
None,
271+
)
272+
.await?;
254273
println!("✓ Result preview: {}", truncate(&result.text, 200));
255274

256275
println!("\n✅ Test 7 passed: Queue configuration works correctly");

core/examples/sdk_chat.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,7 @@ async fn main() -> anyhow::Result<()> {
208208
// ── 8. Per-session agent_dirs ────────────────────────────
209209
println!("\n--- Session with per-session agent_dirs ---");
210210
let tmp4 = tempfile::tempdir()?;
211-
let opts2 = SessionOptions::new()
212-
.with_agent_dir("/tmp/my-agents");
211+
let opts2 = SessionOptions::new().with_agent_dir("/tmp/my-agents");
213212
match agent.session(tmp4.path().display().to_string(), Some(opts2)) {
214213
Ok(_session) => {
215214
println!("[ok] Session created with custom agent_dirs");

core/examples/session_workspace.rs

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,7 @@ fn main() {
113113
" Tokens: {} in / {} out / {} total",
114114
result.usage.prompt_tokens, result.usage.completion_tokens, result.usage.total_tokens
115115
);
116-
println!(
117-
" Tool calls: {}",
118-
result.tool_calls_count
119-
);
116+
println!(" Tool calls: {}", result.tool_calls_count);
120117
// The LLM should have used the read tool and found the number
121118
if result.text.contains("7742") {
122119
println!(" [ok] Magic number correctly extracted\n");
@@ -201,15 +198,24 @@ fn main() {
201198
println!();
202199
handle.abort();
203200

204-
println!(" Events: start={}, tool_use={}, end={}", saw_start, saw_tool, saw_end);
201+
println!(
202+
" Events: start={}, tool_use={}, end={}",
203+
saw_start, saw_tool, saw_end
204+
);
205205
assert!(saw_start, "should receive Start event");
206206
assert!(saw_end, "should receive End event");
207207
let lower = stream_text.to_lowercase();
208208
if lower.contains("pineapple") {
209209
println!(" [ok] Secret word correctly extracted via streaming\n");
210210
} else {
211-
println!(" [warn] Streaming response didn't contain 'pineapple', got: {}", stream_text.trim());
212-
println!(" (Workspace is still wired — tool_use event: {})\n", saw_tool);
211+
println!(
212+
" [warn] Streaming response didn't contain 'pineapple', got: {}",
213+
stream_text.trim()
214+
);
215+
println!(
216+
" (Workspace is still wired — tool_use event: {})\n",
217+
saw_tool
218+
);
213219
}
214220

215221
println!("=== All workspace checks passed ===");

core/examples/skills_demo.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
//! Demonstrates the Claude Code-compatible skill system.
44
55
use a3s_code_core::{
6-
skills::{Skill, SkillRegistry, builtin_skills},
6+
skills::{builtin_skills, Skill, SkillRegistry},
77
SessionOptions,
88
};
99
use std::sync::Arc;
@@ -106,7 +106,8 @@ You are a custom code analyzer. Look for specific patterns in the codebase.
106106
1. Use grep to search for patterns
107107
2. Read files to verify matches
108108
3. Report findings with file paths and line numbers
109-
"#.to_string(),
109+
"#
110+
.to_string(),
110111
tags: vec!["analysis".to_string(), "custom".to_string()],
111112
version: Some("1.0.0".to_string()),
112113
};
@@ -136,19 +137,16 @@ You are a custom code analyzer. Look for specific patterns in the codebase.
136137
println!("------------------------------");
137138

138139
// Method 1: Use built-in skills
139-
let _options1 = SessionOptions::new()
140-
.with_builtin_skills();
140+
let _options1 = SessionOptions::new().with_builtin_skills();
141141
println!("✓ Created SessionOptions with built-in skills");
142142

143143
// Method 2: Use custom registry
144144
let custom_registry = Arc::new(SkillRegistry::with_builtins());
145-
let _options2 = SessionOptions::new()
146-
.with_skill_registry(custom_registry);
145+
let _options2 = SessionOptions::new().with_skill_registry(custom_registry);
147146
println!("✓ Created SessionOptions with custom registry");
148147

149148
// Method 3: Load from directory
150-
let _options3 = SessionOptions::new()
151-
.with_skills_from_dir("core/skills");
149+
let _options3 = SessionOptions::new().with_skills_from_dir("core/skills");
152150
println!("✓ Created SessionOptions with skills from directory");
153151
println!();
154152

0 commit comments

Comments
 (0)