-
Notifications
You must be signed in to change notification settings - Fork 2
Decompose Agent struct: extract ProviderState, SessionState, UiState, OrchestrationState #1731
Copy link
Copy link
Closed
Labels
archArchitecture and designArchitecture and designrefactorCode refactoring without functional changesCode refactoring without functional changes
Description
Problem
Agent<C> in crates/zeph-core/src/agent/mod.rs has 40+ fields and 9 #[allow(clippy::too_many_lines)] suppressions. While sub-structs (MemoryState, SkillState, McpState, IndexState, RuntimeConfig, SecurityState, DebugState) were extracted previously, many fields remain directly on the struct.
Proposed Changes
Extract additional sub-structs:
- ProviderState —
provider,summary_provider,judge_provider,judge_detector,server_compaction_active,provider_override - SessionState —
messages,pending_image_parts,cached_prompt_tokens,message_queue - UiState —
metrics_tx,cancel_signal,cancel_token,start_time,warmup_ready,cost_tracker - OrchestrationState —
pending_graph,plan_cancel_token,subagent_manager,subagent_config,orchestration_config
Motivation
- Reduce cognitive load when reading the agent struct
- Enable isolated unit testing of sub-components
- Align with the established pattern already used for MemoryState, SecurityState, etc.
- Remove
clippy::too_many_linessuppressions by making method bodies smaller
Acceptance Criteria
- Agent struct has <= 15 top-level fields (composed from sub-structs)
- No new
#[allow(clippy::too_many_lines)]suppressions added - All existing tests pass
- Builder API remains backward-compatible
Files
crates/zeph-core/src/agent/mod.rs(3377 lines)crates/zeph-core/src/agent/builder.rs
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
archArchitecture and designArchitecture and designrefactorCode refactoring without functional changesCode refactoring without functional changes