修复顾问态切换游戏后的策划分流
统一 runtime mode 下的 planningStartMode 游戏运行态拒绝策划 Agent 续轮与阶段审批 补充游戏态运行时守卫测试
This commit is contained in:
@@ -767,6 +767,7 @@ pub(crate) async fn continue_design_agent_at(
|
||||
input: DesignInput,
|
||||
emit: impl FnMut(DesignEvent) + Send,
|
||||
) -> Result<DesignView, String> {
|
||||
ensure_design_runtime_active(root)?;
|
||||
let project_id = design_project_id(root)?;
|
||||
ensure_design_workspace(root)?;
|
||||
let active = try_open_game_creator_agent_runtime_task_lock_file(root, DESIGN_ACTIVE_LOCK)?
|
||||
@@ -798,6 +799,7 @@ pub(crate) async fn decide_design_phase_at(
|
||||
approved: bool,
|
||||
emit: impl FnMut(DesignEvent) + Send,
|
||||
) -> Result<DesignView, String> {
|
||||
ensure_design_runtime_active(root)?;
|
||||
let project_id = design_project_id(root)?;
|
||||
ensure_design_workspace(root)?;
|
||||
let active = try_open_game_creator_agent_runtime_task_lock_file(root, DESIGN_ACTIVE_LOCK)?
|
||||
@@ -810,6 +812,16 @@ pub(crate) async fn decide_design_phase_at(
|
||||
finish_design_command(root, resources, session, active, run, emit).await
|
||||
}
|
||||
|
||||
fn ensure_design_runtime_active(root: &Path) -> Result<(), String> {
|
||||
if read_design_runtime_mode(root)?
|
||||
.as_ref()
|
||||
.is_some_and(|mode| mode.active_runtime == "game")
|
||||
{
|
||||
return Err("当前项目已切换到游戏运行态,不能继续策划 Agent".into());
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub(crate) fn hydrate_design_agent_session(
|
||||
project_path: String,
|
||||
@@ -961,6 +973,16 @@ mod fake_provider {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn design_runtime_rejects_design_execution_in_game_mode() {
|
||||
let temporary = tempfile::tempdir().expect("create runtime mode root");
|
||||
let root = temporary.path();
|
||||
write_design_runtime_mode(root, "game").expect("write game runtime mode");
|
||||
|
||||
let error = ensure_design_runtime_active(root).expect_err("game mode must reject design");
|
||||
assert!(error.contains("游戏运行态"));
|
||||
}
|
||||
use serde_json::json;
|
||||
use std::fs;
|
||||
|
||||
|
||||
@@ -383,6 +383,7 @@ export function WorkspaceLauncherShell({
|
||||
orchestrationMode="single-supervisor"
|
||||
projectSupervisorOnly
|
||||
planningStartMode={
|
||||
agentRuntimeMode === 'design' &&
|
||||
currentProjectContext.startMode === 'planning'
|
||||
}
|
||||
playRequest={playRequest}
|
||||
|
||||
Reference in New Issue
Block a user