Files
Genarrative/apps/ai-game-creator-shell/src-tauri/src/swarm_cli.rs
T
kdletters 02fff8f308 修复AGC无人值守游戏生成阻断
普通Web工作台默认使用单Supervisor自主生成链路

补齐安全默认返工、结构化诊断与同Run恢复

绑定当前revision、入口摘要和双视口试玩完成凭证

增强Runner跨boot单飞恢复与game-chat来源隔离

新增真实Provider验收入口及确定性回归

同步更新技术方案、开发流程和共享决策
2026-08-14 07:14:25 +08:00

73 lines
1.8 KiB
Rust

use super::*;
use std::collections::{BTreeMap, BTreeSet};
use std::io::{BufRead, Write};
use std::sync::mpsc::{self, Receiver, RecvTimeoutError};
use std::time::{Duration, Instant};
mod commands;
mod conversation;
mod goal_commands;
mod input;
mod observer;
mod report;
mod terminal_classification;
mod turn_dispatch;
mod turn_wait;
use commands::*;
use conversation::*;
use goal_commands::*;
use input::*;
use observer::*;
use report::*;
use terminal_classification::*;
use turn_dispatch::*;
use turn_wait::*;
#[cfg(test)]
mod tests;
pub(crate) fn run_game_creator_swarm_chat_at(
root: &Path,
parent_agent_id: &str,
run_profile: &str,
supervisor_source: &'static str,
) -> Result<(), String> {
let (input_tx, input_rx) = mpsc::channel();
std::thread::spawn(move || {
let stdin = std::io::stdin();
let mut input = stdin.lock();
loop {
let mut line = String::new();
match input.read_line(&mut line) {
Ok(0) => {
let _ = input_tx.send(SwarmInputEvent::Eof);
break;
}
Ok(_) => {
if input_tx
.send(SwarmInputEvent::Line(line.trim().to_string()))
.is_err()
{
break;
}
}
Err(error) => {
let _ = input_tx.send(SwarmInputEvent::Error(error.to_string()));
break;
}
}
}
});
let stdout = std::io::stdout();
let mut output = stdout.lock();
run_game_creator_swarm_chat_with_input(
root,
parent_agent_id,
run_profile,
supervisor_source,
&input_rx,
&mut output,
)
}