84926ee0cd
由 Prompt Bundle manifest 统一驱动 section、composition、变体和 role overlay 由构建脚本生成 Supervisor 与六组专业 Agent 的静态节点目录 构建期失败关闭校验路径、引用、selector、alias 与 seed DAG 一致性 补充平台、Editor、Provider 请求、节点快照和非法 manifest 回归 同步 Runtime 技术方案与项目决策记录
69 lines
2.4 KiB
Rust
69 lines
2.4 KiB
Rust
#[path = "build_support/runtime_prompt_bundle.rs"]
|
|
mod runtime_prompt_bundle;
|
|
|
|
use std::collections::BTreeSet;
|
|
use std::env;
|
|
use std::fs;
|
|
use std::path::PathBuf;
|
|
|
|
fn seed_task_group_id(
|
|
group: &shared_contracts::game_creation_app::GameCreationAppAgentGroup,
|
|
) -> &'static str {
|
|
use shared_contracts::game_creation_app::GameCreationAppAgentGroup;
|
|
match group {
|
|
GameCreationAppAgentGroup::Design => "design",
|
|
GameCreationAppAgentGroup::Art => "art",
|
|
GameCreationAppAgentGroup::Code => "code",
|
|
GameCreationAppAgentGroup::Balance => "balance",
|
|
GameCreationAppAgentGroup::Audio => "audio",
|
|
GameCreationAppAgentGroup::Publishing => "publishing",
|
|
}
|
|
}
|
|
|
|
fn validate_seed_task_catalog(compiled: &runtime_prompt_bundle::CompiledPromptBundle) {
|
|
let actual = compiled
|
|
.specialist_nodes
|
|
.iter()
|
|
.map(|node| {
|
|
(
|
|
node.task_id.clone(),
|
|
node.group_id.clone(),
|
|
node.role.clone(),
|
|
)
|
|
})
|
|
.collect::<BTreeSet<_>>();
|
|
let expected = shared_contracts::game_creation_app::new_game_creation_app_seed_tasks()
|
|
.into_iter()
|
|
.map(|task| {
|
|
(
|
|
task.id,
|
|
seed_task_group_id(&task.group).to_string(),
|
|
task.role,
|
|
)
|
|
})
|
|
.collect::<BTreeSet<_>>();
|
|
if actual != expected {
|
|
panic!(
|
|
"Prompt Bundle agentCatalog 与正式 seed DAG 的 taskId/group/role 不一致\nactual={actual:#?}\nexpected={expected:#?}"
|
|
);
|
|
}
|
|
}
|
|
|
|
fn main() {
|
|
let manifest_dir = PathBuf::from(
|
|
env::var_os("CARGO_MANIFEST_DIR").expect("CARGO_MANIFEST_DIR must be available"),
|
|
);
|
|
let manifest_path = manifest_dir.join("prompts/runtime/manifest.json");
|
|
let compiled = runtime_prompt_bundle::compile_manifest(&manifest_path)
|
|
.unwrap_or_else(|error| panic!("Prompt Bundle 编译失败:{error}"));
|
|
validate_seed_task_catalog(&compiled);
|
|
for dependency in &compiled.dependencies {
|
|
println!("cargo:rerun-if-changed={}", dependency.display());
|
|
}
|
|
let output_path = PathBuf::from(env::var_os("OUT_DIR").expect("OUT_DIR must be available"))
|
|
.join("agent_runtime_prompt_bundle.rs");
|
|
fs::write(&output_path, compiled.rust_source)
|
|
.unwrap_or_else(|error| panic!("写入 Prompt Bundle 生成代码失败:{error}"));
|
|
tauri_build::build()
|
|
}
|