feat: update README and documentation for new tools and features

- Updated README.md to reflect the addition of 3 new built-in tools, bringing the total to 37.
- Revised architecture documentation to indicate the increase in tool count.
- Enhanced backend documentation with updated line counts for various modules.
- Modified data documentation to change edit log format from JSON to JSONL.
- Updated dependencies documentation to reflect version upgrades for several crates.
- Improved prompts for auto-reviewer, division implementer, planner, tester, and quality reviewer to enforce stricter coding standards regarding linter bypasses.
- Refactored code in various modules to improve clarity and performance, including updates to error handling and tool execution logic.
- Added comprehensive tests for IPC frame serialization and deserialization.
This commit is contained in:
asepharyana
2026-07-13 14:39:39 +07:00
parent 00e29139c5
commit 1d50b94eec
23 changed files with 327 additions and 176 deletions
+5 -5
View File
@@ -28,7 +28,7 @@ Zesdex is a single-process terminal AI coding agent with optional daemon/client
│ │ │ │
│ ┌─────▼──┐ ┌───▼────┐ │
│ │ Tools │ │Sub- │ │
│ │ (28) │ │agents │ │
│ │ (37) │ │agents │ │
│ └────────┘ └────────┘ │
└───────────────────────────────────────────────────────┘
```
@@ -55,7 +55,7 @@ User keystroke → Controller (KeyEvent → Action)
| File | Lines | Role |
|------|-------|------|
| `src/main.rs` | 530 | Entry, TUI setup, daemon loop, attach loop |
| `src/app/runtime/actions/mod.rs` | 1022 | Action dispatch + LLM stream loop + tool execution |
| `src/controller/input.rs` | 281 | Key event → Action mapping |
| `src/view/mod.rs` | 623 | TUI rendering (ratatui) |
| `src/main.rs` | 647 | Entry, TUI setup, daemon loop, attach loop |
| `src/app/runtime/actions/mod.rs` | 1815 | Action dispatch + LLM stream loop + tool execution |
| `src/controller/input.rs` | 365 | Key event → Action mapping |
| `src/view/mod.rs` | 975 | TUI rendering (ratatui) |
+23 -16
View File
@@ -4,7 +4,7 @@
## AI Provider
`src/service/provider.rs` (258 lines)
`src/service/provider.rs` (310 lines)
- `LlmClient::new(api_key, model, base_url)` — constructs blocking reqwest client
- `chat_with_tools()` — non-streaming with tool definitions
- `chat_stream()` — SSE streaming, returns `SseParser` yielding `StreamEvent`
@@ -18,51 +18,58 @@
## IPC / Daemon
`src/ipc/` (7 files, ~300 lines total)
`src/ipc/` (7 files, ~350 lines total)
- Unix domain socket, length-prefixed JSON frames
- Daemon sends `DaemonFrame { state: StatePayload, diff, tasks }` to clients
- Clients send `ClientRequest { action: Action }` back
- State sync uses snapshots + binary diffs (rsync-style, not git)
- Daemon sends `DaemonFrame` (state payload, stream tokens, system notes)
- Clients send `ClientRequest` (key presses, resize, submit, scroll)
- State sync uses full-state push from daemon to client after each action
## Workflow Engine
`src/app/workflow/engine.rs` (251 lines) + `script.rs`
`src/app/workflow/engine.rs` (648 lines) + `script.rs`
- Inline JS-style DSL executed by a lightweight runtime
- `agent()`, `parallel()`, `pipeline()`, `phase()`, `log()` — spawns sub-agents
- Max concurrency configurable via `workflow_max_concurrency` setting
- Company pipeline orchestrator in `company.rs` (406 lines): full 5-division or quick 3-division pipelines
## Sub-Agent System
`src/app/subagent/` (4 files, ~250 lines)
- `run_subagent()` — spawns independent agent with its own tool set & context
`src/app/subagent/` (6 files: `spawn.rs`, `engine.rs`, `context.rs`, `event.rs`, `division.rs`, `auto.rs`, ~450 lines total)
- `run_subagent()` — spawns independent agent with its own tool set and context
- Communicates via `mpsc<SubagentEvent>` channel (tool calls, results, completion)
- Uses `LlmClient` (same as main agent) with tool-use API
- Auto-healing: on build/test failure, spawns auto-fix sub-agent
- Division roles: Strategy, Engineering, Quality, Security, Documentation
## MCP Client
`src/app/mcp/manager.rs` (371 lines)
`src/app/mcp/manager.rs` (441+ lines)
- Stdio transport: spawns child process, JSON-RPC via stdin/stdout
- HTTP transport: streaming HTTP with JSON-RPC
- Tool registration: `tools/list``McpToolAdapter` implements `crate::tool::Tool`
- Dynamic tool list refresh and error recovery
- Persistent child handle for stdio (reuses connection across calls)
## Self-Review
`src/app/review/mod.rs` (437 lines)
`src/app/review/mod.rs` (495 lines)
- Post-tool execution quality check against learned lessons
- Invokes `run_subagent()` with reviewer prompt
- Staleness detection: skips review after N consecutive empty results
- Three review types: code quality, architecture, security
## Background Bash
`src/app/bgbash/` (2 files)
`src/app/bgbash/` (2 files: `job.rs`, `control.rs`)
- `spawn_bash_job()` — runs `sh -c` in a thread, collects stdout line-by-line
- Channels: output via `mpsc<String>`, PID via `mpsc<u32>`
- Killable via PID
- Killable via PID (SIGTERM)
- Output buffering capped at 10,000 lines to prevent memory issues
## Gate Guard / Harness
`src/app/harness.rs` (127 lines)
`src/app/harness.rs` (495 lines)
- `Harness::gate_tool_call()` — verdict-based tool gating (allow/block)
- Parses LLM verdicts (JSON or plain-text)
- `test_parse_verdict_*` tests for 6 verdict formats
- Path traversal, credential read, and destructive command detection
- Pattern detection for stub code, denial language, and assumptions in write/edit content
- Reason validation for mutating tools (minimum 8 characters, rejects generic non-answers)
- Includes 8 unit tests for verdict parsing formats
+3 -3
View File
@@ -16,7 +16,7 @@ Base directory: `~/.config/zesdex/` (via `dirs::data_dir()`)
│ └── *.md # Markdown with YAML frontmatter
├── sessions/ # Per-session data
│ └── <session-uuid>/
│ ├── editlog.json # Edit history
│ ├── edits.jsonl # Edit history (JSONL, append-only)
│ ├── msglog.db # SQLite message log
│ ├── transcript.json # Chat transcript
│ ├── session.json # Session metadata
@@ -34,8 +34,8 @@ Base directory: `~/.config/zesdex/` (via `dirs::data_dir()`)
| `src/model/store.rs` | ~50 | File-system storage (ensure_dirs, base_dir resolution) |
| `src/model/settings.rs` | ~60 | `Settings` — load/save JSON, API keys map |
| `src/model/app_config.rs` | ~80 | `AppConfig` — provider definitions, model roles, auth |
| `src/model/memory.rs` | 332 | Memory CRUD — markdown files with frontmatter |
| `src/model/editlog.rs` | 121 | Edit log — append-only JSON array |
| `src/model/memory.rs` | 440 | Memory CRUD — markdown files with frontmatter |
| `src/model/editlog.rs` | 161 | Edit log — append-only JSONL (not JSON array) |
| `src/model/msglog/` | 4 files | SQLite-backed message log (schema, query, blobs) |
| `src/model/session.rs` | ~60 | Session CRUD, listing, archival |
| `src/model/session_lock.rs` | ~50 | flock-based session lock |
+5 -5
View File
@@ -7,23 +7,23 @@
| Crate | Version | Purpose |
|-------|---------|---------|
| ratatui | 0.30 | TUI framework (tui-rs successor) |
| crossterm | 0.28 | Terminal manipulation (raw mode, alt screen) |
| crossterm | 0.29 | Terminal manipulation (raw mode, alt screen) |
| tokio | 1 | Async runtime (daemon, OAuth loopback) |
| reqwest | 0.12 | HTTP client (blocking + streaming, vendored native-tls) |
| serde / serde_json | 1 | JSON serialization (state, DTOs, IPC, config) |
| serde_yaml_ng | 0.9 | YAML frontmatter parsing (memory files) |
| serde_yaml_ng | 0.10 | YAML frontmatter parsing (memory files) |
| anyhow | 1 | Error handling (no custom error types) |
| tracing / tracing-subscriber | 0.1/0.3 | Structured logging → file |
| rusqlite | 0.32 | SQLite (bundled, for message log) |
| rusqlite | 0.40 | SQLite (bundled, for message log) |
| pulldown-cmark | 0.13 | Markdown → HTML (chat rendering) |
| syntect | 5 | Syntax highlighting (code blocks in chat) |
| sha2 | 0.10 | SHA-256 for PKCE challenge |
| base64 | 0.22 | URL-safe base64 for PKCE |
| libc | 0.2 | daemon PID file locking |
| rmcp | 1.8 | MCP client (stdio + HTTP transports) |
| rmcp | 2.2 | MCP client (stdio + HTTP transports) |
| uuid | 1 | Session IDs, job IDs |
| chrono | 0.4 | Timestamps (ISO 8601, millis) |
| dirs | 5 | Platform data directories |
| dirs | 6 | Platform data directories |
| dom_smoothie | 0.18 | HTML → plain text (web scraping) |
| scraper | 0.27 | HTML parsing (web scraping) |
| ignore | 0.4 | .gitignore-aware file walking (glob tool) |