feat(token): add refresh token verification to TokenService
feat(bootstrap): create temporary settings and config files to prevent data loss refactor(edit_log): switch from Vec to VecDeque for efficient memory management fix(gateway): ensure store directories are created before starting the API server refactor(bgbash): implement a global singleton for BashControl feat(auth): enhance session authentication middleware to use SessionRepository fix(edit_log_repo): update to use VecDeque for in-memory edit log storage fix(memory_repo): add newline escaping for frontmatter fields fix(session_lock_repo): improve error handling for lock file operations fix(bash_tools): prevent path traversal in job_id argument refactor(delete): enforce empty directory deletion in file system tools fix(edit): optimize string replacement to only replace the first occurrence fix(git_cred): improve credential management with piped input to git commands feat(git_operator): add safety filter to block destructive git operations fix(shell): register background jobs in Bash control feat(spawn): add access tier specification for pipeline stages refactor(hive_mind): run directives concurrently for improved performance fix(auth): update refresh token verification in the refresh handler fix(chat): optimize LLM client usage based on model matching fix(conversations): enhance message deletion to target specific indices feat(api): add JWT authentication middleware for all API routes fix(state): implement refresh token verification in JwtTokenService fix(daemon): improve usage tracking with saturating addition fix(tui): handle compacted messages in the TUI state management
This commit is contained in:
@@ -1,379 +1,250 @@
|
||||
# Zesdex
|
||||
# Zesdex — Autonomous AI Coding Agent
|
||||
|
||||
> Autonomous AI coding agent in a terminal-based TUI.
|
||||
Zesdex is an autonomous AI coding agent with a Terminal UI (TUI). It acts as an
|
||||
OpenAI/Anthropic-compatible LLM client wrapped in a tool-use harness with **37
|
||||
built-in tools** — file operations, git, shell execution, LSP integration, MCP,
|
||||
subagent orchestration, and more.
|
||||
|
||||
Zesdex is a Rust-powered AI assistant that operates directly in your terminal via a rich TUI interface. It combines large language model intelligence with a comprehensive set of tools to explore, understand, and modify codebases autonomously — with built-in guardrails at every layer.
|
||||
```
|
||||
┌──────────────────────────────────────────────────────────────┐
|
||||
│ Mode Selector │
|
||||
│ TUI (default) ─── Daemon ─── Attach ─── API ─── WS/gRPC/Web │
|
||||
└──────────────────────────────────────────────────────────────┘
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Features
|
||||
## Quick Start
|
||||
|
||||
### Core
|
||||
```bash
|
||||
# Run the TUI (default mode)
|
||||
cargo run
|
||||
|
||||
- **TUI Interface** — Full-screen terminal UI with chat panel, input bar, and status bar built with [ratatui](https://github.com/ratatui-org/ratatui) and [crossterm](https://github.com/crossterm-rs/crossterm).
|
||||
- **Daemon Architecture** — Run as a background daemon with client attach/detach via Unix domain sockets. The daemon processes state; clients only render.
|
||||
- **IPC Protocol** — Bidirectional state synchronization between daemon and client processes with diff-based updates.
|
||||
- **Provider Agnostic** — Configurable AI model providers with dynamic model selection, per-role temperature/token limits, and API key management.
|
||||
# Run the REST API server
|
||||
cargo run -- --api --api-port 8080
|
||||
|
||||
### Tool System (37 built-in tools)
|
||||
# Run in daemon mode (background + IPC)
|
||||
cargo run -- --daemon
|
||||
|
||||
| Category | Tools |
|
||||
|----------|-------|
|
||||
| **Filesystem** | `read`, `write`, `edit`, `delete` |
|
||||
| **Search** | `grep` (recursive text), `glob` (file patterns) |
|
||||
| **Shell** | `bash`, `bash_output`, `bash_kill` |
|
||||
| **Git** | `git_operator`, `git_worktree`, `git_cred` |
|
||||
| **Memory** | `remember`, `recall`, `forget` |
|
||||
| **Planning** | `plan_enter`, `plan_ready`, `seqthink` |
|
||||
| **Workflow** | `workflow_run`, `note_finding`, `read_findings`, `hive_mind` |
|
||||
| **Utility** | `cd`, `dir_list`, `dir_cache_update`, `pong`, `todowrite`, `todofinish` |
|
||||
| **Agent** | `spawn_agents`, `spawn_pipeline` |
|
||||
| **LSP** | `lsp_connect`, `lsp_diagnostics`, `lsp_hover`, `lsp_completion`, `lsp_definition`, `lsp_references`, `lsp_disconnect` |
|
||||
# Attach TUI to a running daemon session
|
||||
cargo run -- --attach <session-id>
|
||||
|
||||
### Intelligence
|
||||
# Seed initial data (first run)
|
||||
cargo run --bin bootstrap
|
||||
```
|
||||
|
||||
- **Hive-Mind Orchestration** — Autonomous agent orchestration modeled as a distributed machine intelligence (à la Stellaris). The Core Intelligence (main agent) compiles a cognitive cycle plan per task — an ordered list of cycles, each a set of anonymous processing nodes that run in parallel. Every node carries only a directive (what to do) and an access tier (`read`/`write`/`full`); cycle count and nodes-per-cycle are decided per task, not fixed. Every node's output merges into a shared collective state the instant it completes, and a final synthesis node reconciles it into one consensus. Every convergence is written to `docs/runs/*.md`. Manual entry point: the `hive_mind` tool.
|
||||
### Prerequisites
|
||||
|
||||
- **Workflow Engine** — Orchestrate complex multi-step tasks with parallel sub-agents, pipelines, and phased execution. Spawn independent workers that share findings in real-time.
|
||||
- **Self-Learning** — Persistent memory system that stores lessons, references, and project knowledge across sessions. Memories include provenance tracking, lifecycle management, and scope isolation.
|
||||
- **Self-Review** — Review subagents trigger automatically after each code edit (inline) and at turn completion (background). Three types: code quality, architecture, and security.
|
||||
- **Self-Healing** — On build/test failures, spawns a sub-agent with the error context to autonomously fix issues before reporting them to the user.
|
||||
- **MCP Support** — [Model Context Protocol](https://modelcontextprotocol.io/) integration for connecting to external AI tool servers.
|
||||
- **Sequential Thinking** — Chain-of-thought reasoning tool for step-by-step problem decomposition.
|
||||
- **Session Locking** — Prevents multiple processes from operating on the same session directory.
|
||||
- **Rust** 1.81+ (edition 2021)
|
||||
- **Linux** or **macOS** (Unix domain sockets required for daemon mode)
|
||||
- An **API key** for an OpenAI/Anthropic-compatible LLM provider (set via
|
||||
settings or environment variable)
|
||||
|
||||
### Session Management
|
||||
---
|
||||
|
||||
- Multiple concurrent sessions with history, rewind, and transcript persistence.
|
||||
- Per-session edit logs with full change tracking.
|
||||
- Session archival and summary generation.
|
||||
## Modes
|
||||
|
||||
| Flag | Mode | Description |
|
||||
|------|------|-------------|
|
||||
| *(none)* | **TUI** | Full terminal UI with chat, overlays, and agent loop in one process |
|
||||
| `--daemon` | **Daemon** | Background daemon with IPC socket; clients attach separately |
|
||||
| `--attach <id>` | **Attach** | Connect TUI to an existing daemon session via Unix socket |
|
||||
| `--api` | **REST API** | HTTP server with session management and chat endpoints |
|
||||
| `--ws` | **WebSocket** | WebSocket server for real-time communication |
|
||||
| `--grpc` | **gRPC** | gRPC server for programmatic access |
|
||||
| `--web` | **Web** | Serves the web frontend |
|
||||
| `--api-port`, `--ws-port`, `--grpc-port`, `--web-port` | *(ports)* | Configure server ports (defaults: 8080, 8081, 50051, 3000) |
|
||||
|
||||
---
|
||||
|
||||
## Architecture
|
||||
|
||||
### Clean Architecture Layering
|
||||
|
||||
```
|
||||
src/
|
||||
├── main.rs # Entry point: single-process, daemon, or attach mode
|
||||
├── resources.rs # Embedded resources (help text, system prompts)
|
||||
├── app/
|
||||
│ ├── state/ # AppStateRest — immutable-rest state model
|
||||
│ │ ├── rest.rs # Core state struct
|
||||
│ │ ├── types.rs # Overlay, Toast, Origin enums
|
||||
│ │ ├── snapshot.rs # State snapshots for IPC
|
||||
│ │ ├── diff.rs # Diff-based state synchronization
|
||||
│ │ ├── runtime.rs # Runtime state mutations
|
||||
│ │ └── misc.rs # DirCache and miscellaneous state helpers
|
||||
│ ├── runtime/ # Action dispatch and event loop
|
||||
│ │ ├── actions/ # Action enum and apply_action reducer
|
||||
│ │ ├── stream/ # LLM streaming and tool execution
|
||||
│ │ │ └── tools/ # Tool harness integration
|
||||
│ │ │ └── turn.rs # Turn orchestration
|
||||
│ │ ├── event_loop/ # Main event loop and shortsend
|
||||
│ │ ├── commands.rs # Slash command dispatch
|
||||
│ │ └── shortsend.rs # Short-lived async send helper
|
||||
│ ├── mode/ # UI modes and overlays (13 modes)
|
||||
│ │ ├── bash.rs # Bash panel mode
|
||||
│ │ ├── editor.rs # Multi-line editor mode
|
||||
│ │ ├── effort.rs # Effort level selector
|
||||
│ │ ├── help.rs # Help overlay
|
||||
│ │ ├── key_input.rs # Raw key input mode
|
||||
│ │ ├── learning.rs # Lesson management overlay
|
||||
│ │ ├── loading.rs # Loading spinner overlay
|
||||
│ │ ├── mcp.rs # MCP server management
|
||||
│ │ ├── quit_confirm.rs # Quit confirmation dialog
|
||||
│ │ ├── rewind.rs # Session rewind mode
|
||||
│ │ ├── settings.rs # Settings panel
|
||||
│ │ ├── todo.rs # Task list overlay
|
||||
│ │ └── workflow.rs # Workflow visualization
|
||||
│ ├── harness.rs # Tool harness for agent execution
|
||||
│ ├── workflow/ # Workflow engine
|
||||
│ │ ├── script.rs # Workflow script DSL
|
||||
│ │ ├── engine.rs # Workflow executor
|
||||
│ │ ├── hive_mind.rs # Hive-mind orchestrator
|
||||
│ │ └── docs.rs # Deterministic docs/runs/*.md writer
|
||||
│ ├── mcp/ # MCP client manager
|
||||
│ │ └── manager.rs # MCP server lifecycle and tool exposure
|
||||
│ ├── subagent/ # Sub-agent management
|
||||
│ │ ├── spawn.rs # AgentDefinition and spawning
|
||||
│ │ ├── engine.rs # Sub-agent event loop
|
||||
│ │ ├── context.rs # Context construction for sub-agents
|
||||
│ │ └── event.rs # Progress event types
|
||||
│ ├── bgbash/ # Background bash job management
|
||||
│ │ ├── job.rs # Background job handle
|
||||
│ │ └── control.rs # Bash control (bg/fg/kill)
|
||||
│ ├── lsp/ # LSP client management
|
||||
│ │ ├── client.rs # LSP client connection wrapper
|
||||
│ │ └── provisioner.rs # Auto-provisioning of LSP servers
|
||||
│ └── review/ # Self-review quality system
|
||||
├── controller/
|
||||
│ ├── input.rs # Key event → Action mapping
|
||||
│ └── command.rs # Slash command parser
|
||||
├── dto/
|
||||
│ ├── chat/ # Message, ToolCall, Role types
|
||||
│ │ ├── message.rs # Chat message types
|
||||
│ │ ├── tool.rs # Tool call/result types
|
||||
│ │ └── mod.rs
|
||||
│ └── provider/ # AI provider request/response/usage types
|
||||
│ ├── request.rs # Provider request schema
|
||||
│ ├── response.rs # Provider response schema
|
||||
│ └── usage.rs # Token usage tracking
|
||||
├── ipc/
|
||||
│ ├── protocol.rs # ClientRequest, DaemonFrame, StatePayload
|
||||
│ ├── server.rs # Unix socket server
|
||||
│ ├── client.rs # Unix socket client
|
||||
│ ├── conn.rs # Framed connection
|
||||
│ ├── frame.rs # Length-prefixed frame encoding
|
||||
│ ├── snapshot.rs # State snapshot serialization
|
||||
│ └── diff.rs # Binary diff for state sync
|
||||
├── model/
|
||||
│ ├── store.rs # File-based storage (~/.config/zesdex/)
|
||||
│ ├── session.rs # Session CRUD and listing
|
||||
│ ├── settings.rs # User settings (provider, model, tokens)
|
||||
│ ├── app_config.rs # Provider definitions and model roles
|
||||
│ ├── memory.rs # Persistent memory with frontmatter
|
||||
│ ├── editlog.rs # Edit history tracking
|
||||
│ ├── msglog/ # Message log (SQLite-backed)
|
||||
│ │ ├── schema.rs # SQLite schema
|
||||
│ │ ├── query.rs # Query helpers
|
||||
│ │ ├── blobs.rs # Large blob storage
|
||||
│ │ └── summary.rs # Session summarization
|
||||
│ ├── agent_def/ # Agent definitions (builtin, global, session)
|
||||
│ │ ├── builtin.rs # Built-in agent profiles
|
||||
│ │ ├── global.rs # Global agent config
|
||||
│ │ └── session.rs # Per-session agent config
|
||||
│ ├── conversation.rs # Conversation helpers
|
||||
│ └── session_lock.rs # Flock-based session locking
|
||||
├── service/
|
||||
│ ├── provider.rs # AI provider abstraction
|
||||
│ └── oauth/ # OAuth PKCE flow with loopback server
|
||||
│ ├── loopback.rs # Local HTTP server for OAuth redirect
|
||||
│ ├── manager.rs # OAuth token manager
|
||||
│ ├── pkce.rs # PKCE code challenge/verifier
|
||||
│ └── mod.rs
|
||||
├── tool/ # 34 tool implementations
|
||||
│ ├── fs/ # read, write, edit, delete
|
||||
│ │ ├── read.rs
|
||||
│ │ ├── write.rs
|
||||
│ │ ├── edit.rs
|
||||
│ │ ├── delete.rs
|
||||
│ │ └── helpers.rs # Path resolution and validation
|
||||
│ ├── search.rs # grep, glob
|
||||
│ ├── shell.rs # bash
|
||||
│ ├── bash_tools.rs # bash_output, bash_kill
|
||||
│ ├── git_operator.rs # git operations
|
||||
│ ├── git_worktree.rs # git worktree management
|
||||
│ ├── git_cred.rs # git credential store/get/erase
|
||||
│ ├── memory/ # remember, forget, recall
|
||||
│ │ ├── remember.rs
|
||||
│ │ ├── forget.rs
|
||||
│ │ └── recall.rs
|
||||
│ ├── plan.rs # plan_enter, plan_ready
|
||||
│ ├── seqthink.rs # Sequential thinking
|
||||
│ ├── workflow.rs # workflow_run, note_finding
|
||||
│ ├── utility/ # cd, dir_list, dir_cache_update, pong, todowrite, todofinish
|
||||
│ │ ├── cd.rs
|
||||
│ │ ├── dir_list.rs
|
||||
│ │ ├── dir_cache_update.rs
|
||||
│ │ ├── pong.rs
|
||||
│ │ ├── todowrite.rs
|
||||
│ │ └── todofinish.rs
|
||||
│ ├── lsp/ # LSP tools (connect, diagnostics, hover, etc.)
|
||||
│ │ └── mod.rs
|
||||
│ └── shell_filter/ # Shell output filtering (credentials, git)
|
||||
│ ├── credentials.rs
|
||||
│ ├── git.rs
|
||||
│ └── mod.rs
|
||||
└── view/ # TUI rendering
|
||||
├── chat.rs # Chat transcript with markdown
|
||||
├── markdown.rs # Markdown → ratatui spans
|
||||
├── status.rs # Status bar
|
||||
├── theme.rs # Color scheme
|
||||
└── workflow.rs # Workflow visualization
|
||||
apps/
|
||||
├── domain/ # Pure entities, value objects, repository/service traits
|
||||
│ # Zero framework deps — only serde + chrono + uuid
|
||||
├── application/ # Use-case services (auth, sessions, conversations, memory)
|
||||
│ # Depends only on domain-layer trait interfaces
|
||||
├── infrastructure/ # All I/O: LLM client, IPC, persistence, LSP, MCP, tools
|
||||
│ # Implements domain/application port interfaces
|
||||
└── interfaces/ # Entry points
|
||||
├── tui/ # Ratatui terminal UI
|
||||
├── api/ # Axum REST API
|
||||
├── daemon/ # Unix socket daemon + client
|
||||
├── ws/ # WebSocket server
|
||||
├── grpc/ # gRPC server
|
||||
└── web/ # Web frontend (static file server)
|
||||
```
|
||||
|
||||
---
|
||||
### Tool System
|
||||
|
||||
## Usage
|
||||
37 tools across 9 categories:
|
||||
|
||||
```bash
|
||||
# Run in single-process mode (default)
|
||||
zesdex
|
||||
| Category | Tools |
|
||||
|----------|-------|
|
||||
| **File System** | `read`, `write`, `edit`, `delete`, `dir_list`, `dir_cache_update` |
|
||||
| **Shell** | `bash`, `bash_interactive`, `bash_kill`, `bash_output` |
|
||||
| **Git** | `git_operator`, `git_cred`, `git_worktree` |
|
||||
| **Search** | `search`, `grep`, `glob`, `semantic_search` |
|
||||
| **LSP** | `lsp_connect`, `lsp_hover`, `lsp_completion`, `lsp_definition`, `lsp_references`, `lsp_diagnostics`, `lsp_disconnect` |
|
||||
| **Memory** | `remember`, `recall`, `forget` |
|
||||
| **Workflow** | `spawn_agents`, `spawn_pipeline`, `plan`, `sequential_think`, `hive_mind` |
|
||||
| **Utility** | `todo_write`, `todo_finish`, `pong`, `cd` |
|
||||
| **Background** | Background bash jobs with `cancel/status/list` |
|
||||
|
||||
# Run as a background daemon
|
||||
zesdex --daemon
|
||||
|
||||
# Attach to a running daemon session
|
||||
zesdex --attach <session-id>
|
||||
|
||||
# Set log level
|
||||
RUST_LOG=debug zesdex
|
||||
```
|
||||
|
||||
### Key Bindings
|
||||
|
||||
| Binding | Action |
|
||||
|---------|--------|
|
||||
| `Ctrl+Q` | Quit |
|
||||
| `Ctrl+H` | Help overlay |
|
||||
| `Ctrl+P` | Settings overlay |
|
||||
| `Ctrl+B` | Bash panel |
|
||||
| `Ctrl+S` | Session hub |
|
||||
| `Ctrl+T` | Task list |
|
||||
| `Ctrl+W` | Workflow view |
|
||||
| `Ctrl+K` | Key input mode |
|
||||
| `Esc` | Cancel / back |
|
||||
| `Tab` | Autocomplete |
|
||||
| `↑/↓` | History / navigation |
|
||||
| `Scroll` | Mouse scroll in chat |
|
||||
|
||||
### Slash Commands
|
||||
|
||||
| Command | Description |
|
||||
|---------|-------------|
|
||||
| `/help` | Show help |
|
||||
| `/clear` | Clear transcript |
|
||||
| `/model` | Select AI model provider |
|
||||
| `/workflow` | Open the workflow panel |
|
||||
| `/workflow run <script>` | Run a JSON-encoded workflow script |
|
||||
| `/mcp` | Open MCP server manager |
|
||||
| `/mcp add <name> <command>` | Add an MCP server |
|
||||
| `/login [provider]` | Authenticate with a provider |
|
||||
| `/edit [path]` | Open a file/dir in the external editor |
|
||||
| `/compact` | Compact the conversation transcript |
|
||||
| `/lesson` | Interactive lesson/memory review |
|
||||
| `/quit` | Exit application |
|
||||
| `Any text` | Sent to the AI assistant as a prompt |
|
||||
|
||||
---
|
||||
|
||||
## Configuration
|
||||
|
||||
All configuration lives in `~/.config/zesdex/` (or platform equivalent via the `dirs` crate).
|
||||
|
||||
| File | Purpose |
|
||||
|------|---------|
|
||||
| `settings.json` | Provider selection, model, temperature, max tokens, review settings, workflow concurrency |
|
||||
| `app_config.json` | AI provider definitions (name, API base URL, auth type, default model) |
|
||||
| `memory/` | Persistent lesson and reference storage (Markdown with YAML frontmatter) |
|
||||
| `sessions/` | Per-session transcripts, edit logs, and activity data |
|
||||
| `run/` | Unix domain sockets for daemon mode |
|
||||
|
||||
### Provider Configuration
|
||||
|
||||
Providers are defined in `app_config.json`:
|
||||
|
||||
```json
|
||||
{
|
||||
"providers": {
|
||||
"my-provider": {
|
||||
"api_base": "https://api.example.com/v1",
|
||||
"api_key_env": "MY_API_KEY",
|
||||
"default_model": "model-name"
|
||||
}
|
||||
},
|
||||
"model_roles": {
|
||||
"default": {
|
||||
"provider": "my-provider",
|
||||
"model": "model-name",
|
||||
"max_tokens": 8192,
|
||||
"temperature": 0.7
|
||||
}
|
||||
},
|
||||
"default_provider": "my-provider",
|
||||
"default_model": "model-name"
|
||||
Each tool implements the `Tool` trait:
|
||||
```rust
|
||||
pub trait Tool: Send + Sync {
|
||||
fn name(&self) -> &'static str;
|
||||
fn description(&self) -> &'static str;
|
||||
fn parameters(&self) -> Value;
|
||||
fn run(&self, ctx: &ToolCtx, args: &Value) -> Result<String>;
|
||||
}
|
||||
```
|
||||
|
||||
### Settings
|
||||
### Hive Mind Orchestration
|
||||
|
||||
Key settings in `settings.json`:
|
||||
The multi-agent orchestration system compiles a **cognitive cycle plan** per
|
||||
task — ordered cycles of parallel processing nodes. Each node has a directive
|
||||
and an **access tier** (`read` / `write` / `full`). Node outputs merge into a
|
||||
shared collective state in real time, and a final **consensus synthesis**
|
||||
produces the unified result.
|
||||
|
||||
| Setting | Default | Description |
|
||||
|---------|---------|-------------|
|
||||
| `review_enabled` | `true` | Enable self-review after tool execution |
|
||||
| `review_max_lessons_per_run` | `5` | Max lessons loaded per review cycle |
|
||||
| `adaptive_review_max_skip` | `3` | Consecutive passes before skipping review |
|
||||
| `verify_command` | `null` | Optional command to verify changes |
|
||||
| `workflow_max_concurrency` | `5` | Max parallel sub-agents in workflows |
|
||||
| `session_archive_enabled` | `true` | Auto-archive completed sessions |
|
||||
- **Auto-trigger**: Complex requests automatically use the hive mind
|
||||
- **Manual entry**: The `hive_mind` tool lets the LLM specify cycles explicitly
|
||||
- **Live progress**: TUI panel shows each node's status and current tool
|
||||
- **Guaranteed docs**: Every convergence writes to `docs/runs/`
|
||||
|
||||
### IPC Protocol (Daemon Mode)
|
||||
|
||||
```
|
||||
┌──────────┐ Unix socket ┌──────────┐
|
||||
│ Client │ ◄──────────────► │ Daemon │
|
||||
│ (TUI) │ length-prefixed│ │
|
||||
└──────────┘ serde_json └──────────┘
|
||||
|
||||
Frame format: [4-byte BE length][JSON payload]
|
||||
```
|
||||
|
||||
The daemon holds `AppStateRest` and drives the agent loop. Clients are stateless
|
||||
renderers that receive full state snapshots after each action.
|
||||
|
||||
---
|
||||
|
||||
## Installation
|
||||
## Built-in Features
|
||||
|
||||
### Prerequisites
|
||||
| Feature | Description |
|
||||
|---------|-------------|
|
||||
| **LLM Provider** | OpenAI/Anthropic-compatible API (streaming + non-streaming) with automatic retry and fallback |
|
||||
| **Tool Harness** | Safety-gated tool execution with graduated review checks |
|
||||
| **Subagents** | Auto-inline review, background test-gen, arch-review, security-review |
|
||||
| **OAuth 2.0** | PKCE flow for LLM provider authentication |
|
||||
| **MCP** | Model Context Protocol server management (stdio + HTTP transport) |
|
||||
| **LSP** | Language Server Protocol integration (completion, hover, diagnostics, references) |
|
||||
| **Session Mgmt** | SQLite-persisted sessions with lock-based concurrency control |
|
||||
| **Memory** | File-based memory system with frontmatter metadata |
|
||||
| **Edit Log** | Append-only edit history with configurable retention |
|
||||
| **Rate Limiting** | Sliding-window per-client rate limiter |
|
||||
| **JWT Auth** | HS256 JWT access/refresh tokens (API mode) |
|
||||
| **Password Auth** | Argon2 password hashing with pepper |
|
||||
| **OAuth Loopback** | Localhost HTTP server for OAuth redirect capture |
|
||||
| **Background Jobs** | Long-running shell jobs with cancellation and output collection |
|
||||
| **Settings** | JSON-persisted settings with hot-reload |
|
||||
|
||||
- **Rust** 2021 edition toolchain ([rustup](https://rustup.rs/))
|
||||
---
|
||||
|
||||
### Build from Source
|
||||
## TUI Overlays
|
||||
|
||||
16 overlays accessible from the terminal UI:
|
||||
|
||||
| Overlay | Purpose |
|
||||
|---------|---------|
|
||||
| Chat Input | Main input bar with autocomplete |
|
||||
| Bash Panel | Interactive shell panel |
|
||||
| File Editor | Built-in file editor |
|
||||
| Effort Selector | LLM reasoning effort selector |
|
||||
| Help | Keybindings reference |
|
||||
| Key Input | Custom key binding configuration |
|
||||
| Learning | Lesson viewer |
|
||||
| Loading | Generating spinner |
|
||||
| MCP Manager | MCP server management |
|
||||
| Model Selector | LLM model picker |
|
||||
| Quit Confirm | Exit confirmation dialog |
|
||||
| Rewind | Message/history rewind |
|
||||
| Settings | Settings panel |
|
||||
| Todo | Task/TODO list |
|
||||
| Usage | Token usage statistics |
|
||||
| Workflow | Hive-mind node progress |
|
||||
|
||||
---
|
||||
|
||||
## Data & Persistence
|
||||
|
||||
All data lives under the platform's data directory (`~/.local/share/zesdex/`):
|
||||
|
||||
```bash
|
||||
git clone <repository-url>
|
||||
cd zesdex
|
||||
cargo build --release
|
||||
./target/release/zesdex
|
||||
```
|
||||
|
||||
~/.local/share/zesdex/
|
||||
├── settings.json # User settings (provider, model, keys)
|
||||
├── app_config.json # Provider definitions (endpoints, env vars)
|
||||
├── sessions/ # Chat sessions (one subdirectory per session)
|
||||
│ └── <uuid>/
|
||||
│ ├── session.json # Session metadata
|
||||
│ ├── messages.jsonl # Message log
|
||||
│ └── .lock # Session lock file
|
||||
└── memories/ # Memory files with frontmatter metadata
|
||||
└── *.md
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Development
|
||||
|
||||
### Commit Convention
|
||||
```bash
|
||||
# Build all crates
|
||||
cargo build
|
||||
|
||||
Project ini menggunakan **Conventional Commits** untuk otomatis menentukan versi rilis (melalui semantic-release).
|
||||
# Run all unit tests (8 tests across 11 crates)
|
||||
cargo test
|
||||
|
||||
Format:
|
||||
```
|
||||
<type>(<scope>): <description>
|
||||
# Run clippy linting
|
||||
cargo clippy --all-targets
|
||||
|
||||
[optional body]
|
||||
|
||||
[optional footer]
|
||||
# Run with verbose logging
|
||||
RUST_LOG=debug cargo run
|
||||
```
|
||||
|
||||
**`<type>` — menentukan bump version:**
|
||||
### Workspace Crates
|
||||
|
||||
| Type | Bump | Keterangan |
|
||||
|-------------|---------|-------------------------------------------|
|
||||
| `feat` | minor | Fitur baru |
|
||||
| `fix` | patch | Perbaikan bug |
|
||||
| `chore` | patch | Tugas maintenance, refactor ringan |
|
||||
| `docs` | patch | Perubahan dokumentasi |
|
||||
| `refactor` | patch | Refactor kode (tanpa perubahan fungsional)|
|
||||
| `test` | patch | Penambahan atau perbaikan test |
|
||||
| `style` | patch | Perubahan formatting, whitespace, dll |
|
||||
| `perf` | patch | Optimasi performa |
|
||||
| `ci` | patch | Perubahan CI/CD |
|
||||
| Crate | Path | Layer |
|
||||
|-------|------|-------|
|
||||
| `zesdex-domain` | `apps/domain/` | Pure domain entities & traits |
|
||||
| `zesdex-application` | `apps/application/` | Use-case services |
|
||||
| `zesdex-infrastructure` | `apps/infrastructure/` | All I/O & tool implementations |
|
||||
| `zesdex-tui` | `apps/interfaces/tui/` | Ratatui terminal interface |
|
||||
| `zesdex-api` | `apps/interfaces/api/` | Axum REST API |
|
||||
| `zesdex-daemon` | `apps/interfaces/daemon/` | Unix socket daemon |
|
||||
| `zesdex-ws` | `apps/interfaces/ws/` | WebSocket server |
|
||||
| `zesdex-grpc` | `apps/interfaces/grpc/` | gRPC server |
|
||||
| `zesdex-web` | `apps/interfaces/web/` | Web frontend |
|
||||
| `zesdex-gateway` | `apps/gateway/` | CLI entry point & dispatcher |
|
||||
| `zesdex-bootstrap` | `apps/bootstrap/` | Initial data seeder |
|
||||
|
||||
**`BREAKING CHANGE`** pada body commit → **major** (apa pun typenya).
|
||||
### Code Map
|
||||
|
||||
Contoh:
|
||||
```
|
||||
feat(agent): add workspace-aware file search
|
||||
Detailed architecture documentation is in `docs/CODEMAPS/`:
|
||||
|
||||
Implement context-aware search scoped to current workspace directory.
|
||||
|
||||
BREAKING CHANGE: search results now filter by workspace scope.
|
||||
```
|
||||
|
||||
```
|
||||
fix(ipc): handle partial frame on unix socket reconnect
|
||||
```
|
||||
|
||||
```
|
||||
chore: update rustls to 0.23
|
||||
```
|
||||
|
||||
### Release Workflow
|
||||
|
||||
Push ke branch `main` akan memicu:
|
||||
1. **CI** — `cargo build --release` + `cargo test`
|
||||
2. **Semantic Release** — analisis commit → update `Cargo.toml` + `CHANGELOG.md` → git tag → GitHub Release dengan binary
|
||||
| File | Covers |
|
||||
|------|--------|
|
||||
| `docs/CODEMAPS/architecture.md` | System layout, process modes, data flow |
|
||||
| `docs/CODEMAPS/backend.md` | Provider, OAuth, IPC, workflow engine, MCP, LSP, review |
|
||||
| `docs/CODEMAPS/frontend.md` | TUI render pipeline, 16 overlays, toasts, input handling |
|
||||
| `docs/CODEMAPS/data.md` | Persistence, SQLite msglog, memory files, settings/config |
|
||||
| `docs/CODEMAPS/dependencies.md` | All Rust crates and external services |
|
||||
|
||||
---
|
||||
|
||||
## License
|
||||
|
||||
See [LICENSE](LICENSE) for details.
|
||||
See `CHANGELOG.md` for release history.
|
||||
|
||||
Reference in New Issue
Block a user