chore(agc): 清理跨分支耦合后失去消费者的退役 DTO/常量/函数(甲组,bin 24 → 9)

main.rs:删 `use platform_agent::{build_game_creation_seed_task_graph, plan_game_creation_agent_pass, route_game_creation_repair_issues};` 与 shared-contracts 列表中已无消费者的 `GAME_CREATION_AGENT_RUN_SCHEMA_VERSION`。

main.rs:删退役 DTO/结构 `GenerateLocalGameDraftResult`、`AgentPassArtifactPaths`、`AgentPassAgenda`、`LlmGameDraft`、`LlmAgentHandoff`、`GameCreatorAgentLoopResult`(后三者互引,一并删除后无级联孤儿)。

main.rs:删退役常量 `GAME_CREATOR_AGENT_LOOP_MAX_PASSES`、`GAME_CREATOR_CONVERSATION_CONTEXT_MAX_MESSAGES`。

platform_session.rs:删 `platform_session_is_available`。

project/agent_db.rs:删 `append_jsonl_line`(其内部 `append_jsonl_line_unlocked` 仍有其他使用者)。

project/conversation.rs:删 `append_markdown_entry`。

project/manifest.rs:删 `record_draft_task_progress`。

config.rs:删 `build_game_creator_llm_client_without_redirects_from_llm_config`。

验证:bin 口径 warning 24 → 9,EXIT=0,无 error 行;每个符号删前均以 Git 全树引用矩阵确认(见 local://rust-warning-coupling-report-20261006.md §3a)。
This commit is contained in:
2026-10-06 17:32:10 +08:00
parent f83cf1b9bf
commit 98cecdfc5e
6 changed files with 2 additions and 164 deletions
@@ -151,15 +151,6 @@ pub(crate) fn build_game_creator_llm_client_from_llm_config(
LlmClient::new(config).map_err(|error| format!("LLM client 初始化失败:{error}"))
}
pub(crate) fn build_game_creator_llm_client_without_redirects_from_llm_config(
llm: &GameCreatorLlmConfig,
config_path: &str,
) -> Result<LlmClient, String> {
let config = build_game_creator_platform_llm_config(llm, config_path)?;
LlmClient::new_without_redirects(config)
.map_err(|error| format!("LLM client 初始化失败:{error}"))
}
fn build_game_creator_platform_llm_config(
llm: &GameCreatorLlmConfig,
config_path: &str,
@@ -25,10 +25,6 @@ use std::time::{Duration, SystemTime, UNIX_EPOCH};
// crate 根的 trait 导入会被 `use super::*` 的子模块继承(template_library 的流式下载依赖
// `StreamExt`,通知与 Agent 事件依赖 `Emitter`),不要因为根模块自身不再直接用到就删掉。
use futures::StreamExt;
use platform_agent::{
build_game_creation_seed_task_graph, plan_game_creation_agent_pass,
route_game_creation_repair_issues,
};
use platform_llm::{
LlmApiKind, LlmClient, LlmConfig, LlmMessage, LlmProvider, LlmRunRequest,
DEFAULT_RETRY_BACKOFF_MS,
@@ -51,8 +47,8 @@ use shared_contracts::game_creation_app::{
GameIterationVersionResourceBinding, ProjectResourceCanvasLayout,
ProjectResourceCanvasLayoutMode, ProjectResourceCanvasPosition,
UpdateProjectResourceCanvasLayoutResult, UpdateProjectResourceCanvasLayoutStatus,
GAME_CREATION_AGENT_RUN_SCHEMA_VERSION, GAME_CREATION_AGENT_TOOL_CALL_MAX,
GAME_CREATION_APP_COMMANDS, GAME_CREATION_RESOURCE_LAYOUT_SCHEMA_VERSION,
GAME_CREATION_AGENT_TOOL_CALL_MAX, GAME_CREATION_APP_COMMANDS,
GAME_CREATION_RESOURCE_LAYOUT_SCHEMA_VERSION,
};
// `Emitter` 同时被 `use super::*` 的子模块依赖(通知、Agent 事件等都从 crate 根取该 trait),
// 不要因为根模块自身不再直接 `.emit(..)` 就删掉它。
@@ -229,17 +225,6 @@ struct LocalGameProjectRevisionStatus {
revision: u64,
}
#[derive(Debug, Eq, PartialEq, Serialize)]
#[serde(rename_all = "camelCase")]
struct GenerateLocalGameDraftResult {
project_path: String,
game_index_path: String,
design_path: String,
short_memory_path: String,
long_memory_path: String,
manifest: GameCreationAppManifest,
}
#[derive(Clone, Debug, Eq, PartialEq, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
struct GameCreatorManifestInvalidatedEvent {
@@ -794,7 +779,6 @@ const GAME_CREATOR_REQUIRED_LLM_AGENT_IDS: [&str; 3] = [
];
const MIN_GAME_CREATOR_LLM_REQUEST_TIMEOUT_MS: u64 = 1_000;
const GAME_CREATOR_LLM_REQUEST_TIMEOUT_MS: u64 = 180_000;
const GAME_CREATOR_AGENT_LOOP_MAX_PASSES: u8 = 3;
const GAME_CREATOR_AGENT_TOOL_CALL_MAX: u16 = GAME_CREATION_AGENT_TOOL_CALL_MAX;
const GAME_CREATOR_AGENT_RUN_HISTORY_MAX_COUNT: usize = 100;
const GAME_CREATOR_AGENT_DB_SCHEMA_VERSION: &str = "game-creator-agent-db.v1";
@@ -807,7 +791,6 @@ const AGENT_CONVERSATION_SESSION_SCHEMA_VERSION: &str = "game-creator-agent-sess
const AGENT_RUNTIME_RUN_PROFILE_STANDARD: &str = "standard";
const AGENT_RUNTIME_AUTONOMOUS_SOURCE_FIELD_MAX_CHARS: usize = 8_000;
const AGENT_RUNTIME_AUTONOMOUS_SOURCE_TOTAL_MAX_CHARS: usize = 10_000;
const GAME_CREATOR_CONVERSATION_CONTEXT_MAX_MESSAGES: usize = 12;
fn default_agent_runtime_run_profile() -> String {
AGENT_RUNTIME_RUN_PROFILE_STANDARD.to_string()
@@ -948,18 +931,6 @@ fn game_creator_llm_agent_status_definitions() -> Vec<GameCreatorLlmAgentStatusD
agents
}
#[derive(Clone, Debug)]
struct AgentPassArtifactPaths {
draft_json: String,
design_markdown: String,
balance_json: String,
art_manifest_json: String,
audio_manifest_json: String,
publish_readme: String,
game_html: String,
handoff_markdown: String,
}
#[derive(Clone, Debug)]
struct AgentRoleBrief {
group_definition: AgentGroupDefinition,
@@ -980,42 +951,6 @@ struct AgentGroupBrief {
role_briefs: Vec<AgentRoleBrief>,
}
#[derive(Clone, Debug)]
struct AgentPassAgenda {
relative_path: String,
task_graph_relative_path: String,
active_task_ids: Vec<String>,
carried_task_ids: Vec<String>,
dependency_waves: Vec<Vec<String>>,
repair_focus: Vec<String>,
repair_routes: Vec<GameCreationAgentRepairRouteTrace>,
summary: String,
}
#[derive(Clone, Debug, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
struct LlmGameDraft {
title: String,
design_markdown: String,
balance: serde_json::Value,
art_manifest: serde_json::Value,
audio_manifest: serde_json::Value,
publish_readme: String,
handoffs: Vec<LlmAgentHandoff>,
game_html: String,
handoff_summary: String,
}
#[derive(Clone, Debug, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
struct LlmAgentHandoff {
group: String,
role: String,
summary: String,
outputs: Vec<String>,
next: String,
}
const DIAGNOSTIC_LOG_MAX_BYTES: u64 = 256 * 1024;
static DIAGNOSTIC_LOG_LOCK: OnceLock<Mutex<()>> = OnceLock::new();
static STARTUP_ERROR_DIALOG_SHOWN: AtomicBool = AtomicBool::new(false);
@@ -1344,16 +1279,6 @@ impl StartupLogSlot {
}
}
#[derive(Clone, Debug)]
struct GameCreatorAgentLoopResult {
run_id: String,
draft: LlmGameDraft,
spec_markdown: String,
findings_markdown: String,
passes: u8,
steps: Vec<GameCreationAgentRunStep>,
}
fn game_creator_gui_run_event_requests_runner_shutdown(event: &tauri::RunEvent) -> bool {
matches!(event, tauri::RunEvent::Exit)
}
@@ -482,10 +482,6 @@ pub(crate) fn acquire_platform_session_identity_lease(
Ok(ValidatedPlatformSessionLease { _guard: current })
}
pub(crate) fn platform_session_is_available() -> bool {
current_platform_session().is_some()
}
#[cfg(test)]
static PLATFORM_SESSION_TEST_LOCK: OnceLock<Mutex<()>> = OnceLock::new();
@@ -4364,12 +4364,6 @@ fn repair_truncated_jsonl_tail_unlocked(
})
}
pub(crate) fn append_jsonl_line(path: &Path, line: &str, error_label: &str) -> Result<(), String> {
let append_lock = project_append_lock_for(path)?;
let _append_guard = append_lock.lock(error_label)?;
append_jsonl_line_unlocked(path, line, error_label)
}
fn agent_db_has_conversation_message_audit_unlocked(
file: &mut File,
path: &Path,
@@ -1212,31 +1212,6 @@ pub(crate) fn normalize_game_creator_runtime_agent_id(agent_id: &str) -> Result<
normalize_conversation_agent_id(agent_id)
}
pub(crate) fn append_markdown_entry(
path: &Path,
header: &str,
entry: &str,
error_label: &str,
) -> Result<(), String> {
if let Some(parent) = path.parent() {
ensure_game_creator_private_directory_tree(parent, error_label)?;
prepare_game_creator_private_path_for_read(parent, true, error_label)?;
}
prepare_game_creator_private_path_for_read(path, false, error_label)?;
let needs_header = fs::metadata(path)
.map(|metadata| metadata.len() == 0)
.unwrap_or(true);
let bytes = if needs_header {
let mut bytes = Vec::with_capacity(header.len() + entry.len());
bytes.extend_from_slice(header.as_bytes());
bytes.extend_from_slice(entry.as_bytes());
bytes
} else {
entry.as_bytes().to_vec()
};
append_game_creator_private_file(path, &bytes, error_label)
}
#[cfg(not(test))]
pub(crate) fn append_local_permission_log_at(
root: &Path,
@@ -1092,49 +1092,6 @@ pub(crate) fn ensure_manifest_has_seed_tasks(
})
}
pub(crate) fn record_draft_task_progress(
root: &Path,
goal: &str,
updated_at: u64,
agent_log_path: &Path,
) -> Result<GameCreationAppManifest, String> {
let (manifest_path, mut manifest) = read_or_create_manifest(root)?;
ensure_manifest_seed_tasks(&mut manifest);
manifest.goal = Some(goal.to_string());
for completed_task_id in [
"design-director",
"balance-director",
"balance-seed",
"art-director",
"art-polish",
"audio-director",
"audio-asset-plan",
"code-director",
"code-prototype",
"quality-review",
] {
set_task_status(
&mut manifest,
completed_task_id,
GameCreationAppTaskStatus::Completed,
);
}
set_task_status(
&mut manifest,
"preview-readiness",
GameCreationAppTaskStatus::WaitingForConfirmation,
);
manifest.command_runs.push(GameCreationAppCommandRunState {
command_id: "game.generate_draft".to_string(),
status: GameCreationAppCommandRunStatus::Completed,
output: "已完成 Planner/Generator/Evaluator loop、记忆写入和本地原型生成".to_string(),
log_path: agent_log_path.to_string_lossy().into_owned(),
updated_at,
});
write_manifest(&manifest_path, &manifest)?;
Ok(manifest)
}
pub(crate) fn ensure_manifest_seed_tasks(manifest: &mut GameCreationAppManifest) {
let seed_tasks = new_game_creation_app_seed_tasks();
if manifest.tasks.is_empty() {