Skip to content

Commit f4a7df8

Browse files
committed
refactor: remove dead code — agent_api.rs (521 lines), lsp/ module (3369 lines)
1 parent 2d4550e commit f4a7df8

12 files changed

Lines changed: 109 additions & 4038 deletions

File tree

README.md

Lines changed: 28 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,10 @@
2323
**A3S Code** is an embeddable Rust library (`a3s-code-core`) for building AI coding agents. All subsystems — hooks, security, memory, MCP/LSP, subagent delegation, planning — are wired into the core execution path and active by default. Configure via HCL or JSON, create an `Agent`, bind sessions to workspaces, and go.
2424

2525
```rust
26-
use a3s_code_core::{Agent, AgentSession, CodeConfig};
26+
use a3s_code_core::{Agent, AgentEvent};
2727

28-
// Load config (HCL or JSON)
29-
let config = CodeConfig::from_file("agent.hcl")?;
30-
31-
let agent = Agent::builder()
32-
.with_config(config)
33-
.build()
34-
.await?;
28+
// Load config (HCL or JSON) — one line
29+
let agent = Agent::new("agent.hcl").await?;
3530

3631
// Create a workspace-bound session
3732
let session = agent.session("/my-project");
@@ -182,41 +177,32 @@ let config = CodeConfig {
182177
..Default::default()
183178
};
184179

185-
let agent = Agent::builder()
186-
.with_config(config)
187-
.build()
188-
.await?;
189-
190-
// Or from file (auto-detects HCL/JSON)
191-
let agent = Agent::builder()
192-
.with_config_file("agent.hcl")?
193-
.build()
194-
.await?;
195-
196-
// Or from strings
197-
let agent = Agent::builder()
198-
.with_config_hcl(hcl_string)?
199-
.build()
200-
.await?;
201-
202-
let agent = Agent::builder()
203-
.with_config_json(json_string)?
204-
.build()
205-
.await?;
180+
let agent = Agent::from_config(config).await?;
181+
182+
// Or from file path (auto-detects HCL/JSON)
183+
let agent = Agent::new("agent.hcl").await?;
184+
185+
// Or from inline strings (auto-detects JSON vs HCL)
186+
let agent = Agent::new(r#"{"defaultProvider": "anthropic", ...}"#).await?;
206187
```
207188

208-
### Builder Options
189+
### Config Options
209190

210-
```rust
211-
let agent = Agent::builder()
212-
.with_config(config)
213-
.system_prompt("You are a senior Rust engineer.")
214-
.max_tool_rounds(20)
215-
.thinking_budget(4096)
216-
.with_hooks(hook_engine)
217-
.extra_tools(custom_tools)
218-
.build()
219-
.await?;
191+
```hcl
192+
default_provider = "anthropic"
193+
default_model = "claude-sonnet-4-20250514"
194+
system_prompt = "You are a senior Rust engineer."
195+
max_tool_rounds = 20
196+
197+
providers {
198+
name = "anthropic"
199+
api_key = "sk-ant-..."
200+
201+
models {
202+
id = "claude-sonnet-4-20250514"
203+
name = "Claude Sonnet 4"
204+
}
205+
}
220206
```
221207

222208
## Architecture
@@ -312,7 +298,7 @@ code/ # Cargo workspace root
312298
│ ├── skills/ # Built-in skills (tool definitions, skill discovery)
313299
│ └── src/
314300
│ ├── lib.rs # Library entry point + re-exports
315-
│ ├── agent_api.rs # Agent / AgentSession / AgentBuilder facade
301+
│ ├── agent_api.rs # Agent / AgentSession facade
316302
│ ├── agent.rs # Agentic loop execution engine
317303
│ ├── config.rs # Configuration (HCL + JSON)
318304
│ ├── session.rs # Session management
@@ -356,7 +342,7 @@ Core agent loop, 11 tools, multi-session management, permission system, HITL, sk
356342
### Phase 10: Library-First Architecture ✅
357343

358344
- [x] Extract all business logic into `a3s-code-core` — pure Rust library, zero server dependencies
359-
- [x] `Agent` / `AgentSession` facade with config-driven builder pattern
345+
- [x] `Agent::new()` / `Agent::from_config()` facade with config-driven constructors
360346
- [x] HCL and JSON configuration support with auto-detection by file extension
361347
- [x] Multi-provider LLM config (default model required, multiple providers optional)
362348
- [x] All 11 tools callable via direct function calls without serialization

0 commit comments

Comments
 (0)