fix: deep audit round 2 — non-streaming mode config + ClarificationCard + settings restructure
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
HIGH fixes: - H-NS-1: Non-streaming agent_chat now builds ChatModeConfig and calls send_message_with_chat_mode(), matching the streaming path - H-FE-1: ClarificationCard component renders structured clarification questions with type badge, question text, and numbered options - H-SEM-1: SemanticSkillRouter annotated as @reserved (Phase 3 wiring) MEDIUM fixes: - M-SETTINGS-1: Settings menu restructured with "高级" section separator; skills/audit/tasks/heartbeat/semantic-memory grouped under advanced - M-MAN-1: LoopEvent→StreamChatEvent mapping completeness checklist added as documentation comment in agent_chat_stream loop - M-ORPH-1: Deleted orphaned Automation/ and SkillMarket/ files, plus transitively orphaned types, hooks, and adapters
This commit is contained in:
@@ -18,6 +18,18 @@ use crate::intelligence::validation::validate_string_length;
|
||||
pub struct ChatRequest {
|
||||
pub agent_id: String,
|
||||
pub message: String,
|
||||
/// Enable extended thinking/reasoning
|
||||
#[serde(default)]
|
||||
pub thinking_enabled: Option<bool>,
|
||||
/// Reasoning effort level (low/medium/high)
|
||||
#[serde(default)]
|
||||
pub reasoning_effort: Option<String>,
|
||||
/// Enable plan mode
|
||||
#[serde(default)]
|
||||
pub plan_mode: Option<bool>,
|
||||
/// Enable sub-agent delegation (Ultra mode only)
|
||||
#[serde(default)]
|
||||
pub subagent_enabled: Option<bool>,
|
||||
}
|
||||
|
||||
/// Chat response
|
||||
@@ -88,7 +100,23 @@ pub async fn agent_chat(
|
||||
let id: AgentId = request.agent_id.parse()
|
||||
.map_err(|_| "Invalid agent ID format".to_string())?;
|
||||
|
||||
let response = kernel.send_message(&id, request.message)
|
||||
// Build chat mode config from request fields
|
||||
let chat_mode = if request.thinking_enabled.is_some()
|
||||
|| request.reasoning_effort.is_some()
|
||||
|| request.plan_mode.is_some()
|
||||
|| request.subagent_enabled.is_some()
|
||||
{
|
||||
Some(zclaw_kernel::ChatModeConfig {
|
||||
thinking_enabled: request.thinking_enabled,
|
||||
reasoning_effort: request.reasoning_effort.clone(),
|
||||
plan_mode: request.plan_mode,
|
||||
subagent_enabled: request.subagent_enabled,
|
||||
})
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
||||
let response = kernel.send_message_with_chat_mode(&id, request.message, chat_mode)
|
||||
.await
|
||||
.map_err(|e| format!("Chat failed: {}", e))?;
|
||||
|
||||
@@ -258,6 +286,24 @@ pub async fn agent_chat_stream(
|
||||
let stream_timeout = tokio::time::Duration::from_secs(300);
|
||||
|
||||
loop {
|
||||
// === LoopEvent → StreamChatEvent mapping ===
|
||||
//
|
||||
// COMPLETENESS CHECKLIST: When adding a new LoopEvent variant, you MUST:
|
||||
// 1. Add a match arm below
|
||||
// 2. Add the corresponding StreamChatEvent variant (see struct defs above)
|
||||
// 3. Add the TypeScript type in desktop/src/lib/kernel-types.ts
|
||||
// 4. Add a handler in desktop/src/lib/kernel-chat.ts
|
||||
//
|
||||
// Current mapping (LoopEvent → StreamChatEvent):
|
||||
// Delta → Delta
|
||||
// ThinkingDelta → ThinkingDelta
|
||||
// ToolStart → ToolStart / HandStart (if name starts with "hand_")
|
||||
// ToolEnd → ToolEnd / HandEnd (if name starts with "hand_")
|
||||
// SubtaskStatus → SubtaskStatus
|
||||
// IterationStart → IterationStart
|
||||
// Complete → Complete
|
||||
// Error → Error
|
||||
// ============================================
|
||||
// Check cancellation flag before each recv
|
||||
if cancel_clone.load(std::sync::atomic::Ordering::SeqCst) {
|
||||
tracing::info!("[agent_chat_stream] Stream cancelled for session: {}", session_id);
|
||||
|
||||
Reference in New Issue
Block a user