Zene Core Optimization Plan
Based on feedback from the Celadon team, Zene is undergoing a major architectural refactor to become a cloud-native, high-performance AI coding engine suitable for embedding in async web frameworks (like Axum).
1. Async Native (Non-blocking IO)
Goal: Eliminate all blocking operations to prevent thread starvation in async runtimes (Tokio).
- [x] Replace
std::fswithtokio::fs:src/engine/tools.rs:read_file,write_file,apply_patchconverted to async.src/engine/session/store.rs:load,save,load_allconverted to async usingtokio::fs.
- [x] Replace
std::processwithtokio::process:src/engine/tools.rs:run_commandvalidated/updated to usetokio::process::Command.
- [x] Mutex Migration:
- Replaced
std::sync::Mutexwithtokio::sync::MutexinInMemorySessionStoreandToolManagercalls.
- Replaced
2. Streaming Event Architecture
Goal: Provide real-time feedback (Typewriter effect) for DevPage.
- [x] Enhanced
AgentEventEnum:- Added
ThoughtDelta,ToolOutputDelta,FileStateChanged.
- Added
- [x] Streaming Interface:
- Implemented
ZeneEngine::run_streamreturningmpsc::UnboundedReceiver<AgentEvent>.
- Implemented
- [x] Event Emission:
- Wired up
Executorto emitThoughtDeltausingllm-connectorv0.6.1 streaming capabilities. - Wired up
ToolManagerto emitToolOutputDelta(viaToolResultevent).
- Wired up
3. Structured File State (Workspace Awareness)
Goal: Enable "IDE-like" file tree updates in the frontend.
- [x] File Change Tracking:
- Defined
FileChangestruct.
- Defined
- [x] Tool Instrumentation:
- Modify
write_fileandapply_patchinToolManagerto broadcastFileStateChanged.
- Modify
Execution Strategy
- Phase 1 (Completed): Refactored
tools.rsandsession/store.rsto be fully async. - Phase 2 (Completed): Implemented
run_streamand event definitions. Integratedllm-connectorstreaming to support real-timeThoughtDeltaemission. - Phase 3 (Completed): Implement file state tracking in
ToolManagerand release v0.5.0.
