fix(desktop): resolve all remaining P1 defects (P1-02/05/06, P1-01 experimental)
Some checks failed
CI / Build Frontend (push) Has been cancelled
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (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

- P1-02: Heartbeat auto-initialized in kernel_init for default agent
- P1-05: CloneManager shows warning when deleting active agent + auto-switch
- P1-06: AgentInfo returns soul/system_prompt/temperature/max_tokens
- P1-01: Browser Hand marked experimental (requires Fantoccini bridge)
- Updated DEFECT_LIST.md: all P1 resolved (0 active)
- Updated RELEASE_READINESS.md: all P1 sections reflect current status
This commit is contained in:
iven
2026-04-05 21:21:33 +08:00
parent e65b49c821
commit bcaab50c56
8 changed files with 89 additions and 32 deletions

View File

@@ -250,7 +250,7 @@ impl HeartbeatEngine {
}
/// Restore heartbeat history from VikingStorage metadata (called during init)
async fn restore_history(&self) {
pub async fn restore_history(&self) {
let key = format!("heartbeat:history:{}", self.agent_id);
match crate::viking_commands::get_storage().await {
Ok(storage) => {
@@ -730,7 +730,7 @@ pub async fn heartbeat_init(
/// Restore the last interaction timestamp for an agent from VikingStorage.
/// Called during heartbeat_init so the idle-greeting check works after restart.
async fn restore_last_interaction(agent_id: &str) {
pub async fn restore_last_interaction(agent_id: &str) {
let key = format!("heartbeat:last_interaction:{}", agent_id);
match crate::viking_commands::get_storage().await {
Ok(storage) => {

View File

@@ -4,6 +4,9 @@ use serde::{Deserialize, Serialize};
use tauri::State;
use super::{KernelState, SchedulerState};
use crate::intelligence::heartbeat::{HeartbeatEngine, HeartbeatEngineState};
const DEFAULT_HEARTBEAT_AGENT: &str = "zclaw-main";
// ---------------------------------------------------------------------------
// Request / Response types
@@ -59,6 +62,7 @@ pub struct KernelStatusResponse {
pub async fn kernel_init(
state: State<'_, KernelState>,
scheduler_state: State<'_, SchedulerState>,
heartbeat_state: State<'_, HeartbeatEngineState>,
config_request: Option<KernelConfigRequest>,
) -> Result<KernelStatusResponse, String> {
let mut kernel_lock = state.lock().await;
@@ -193,6 +197,20 @@ pub async fn kernel_init(
*sched_lock = Some(scheduler);
}
// Auto-initialize heartbeat engine for the default agent
{
let mut engines = heartbeat_state.lock().await;
if !engines.contains_key(DEFAULT_HEARTBEAT_AGENT) {
let agent_id = DEFAULT_HEARTBEAT_AGENT.to_string();
let engine = HeartbeatEngine::new(agent_id.clone(), None);
crate::intelligence::heartbeat::restore_last_interaction(&agent_id).await;
engine.restore_history().await;
engine.start().await;
engines.insert(agent_id, engine);
tracing::info!("[kernel_init] Heartbeat engine auto-initialized and started for '{}'", DEFAULT_HEARTBEAT_AGENT);
}
}
Ok(KernelStatusResponse {
initialized: true,
agent_count,