From 5ffd7dcd0aa8dccb4ec0fdc44962211486c3fc70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=BE=B7=E5=AE=87?= Date: Fri, 2 Oct 2026 16:36:35 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=20AGC=20=E9=80=80=E5=BD=B9?= =?UTF-8?q?=E5=90=8E=20prompt=20=E8=BE=B9=E7=95=8C=E9=97=A8=E7=A6=81?= =?UTF-8?q?=E7=94=A8=E4=BE=8B=E5=BC=95=E7=94=A8=E5=B7=B2=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E6=BA=90=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - prompt_source_boundaries.rs 移除 src/agent/prompt.rs、runtime_actions/provider_request_builders.rs、runtime_actions/provider_tool_plan.rs、agent_native_tools.rs、context_compaction.rs、goal.rs、generation/run_lifecycle.rs、generation/role_briefs.rs、runtime_protocol/autonomous_completion.rs、runtime_driver/task_start.rs 等已随自建 Runtime 退役的条目 - prompt_source_boundaries.rs 的常量门禁与工具描述门禁同步移除 runtime_driver.rs、agent_native_tools.rs 条目 - runtime_prompt_bundle_build.rs 删除 provider_request_builders.rs、provider_tool_plan.rs、agent/prompt.rs 三个已退役文件的断言;「不得再内联 prompt 正文」由 src 全树 include_str! 扫描继续兜底 --- .../tests/prompt_source_boundaries.rs | 90 +------------------ .../tests/runtime_prompt_bundle_build.rs | 59 +----------- 2 files changed, 4 insertions(+), 145 deletions(-) diff --git a/apps/ai-game-creator-shell/src-tauri/tests/prompt_source_boundaries.rs b/apps/ai-game-creator-shell/src-tauri/tests/prompt_source_boundaries.rs index 5ed98b980..f73e2f53f 100644 --- a/apps/ai-game-creator-shell/src-tauri/tests/prompt_source_boundaries.rs +++ b/apps/ai-game-creator-shell/src-tauri/tests/prompt_source_boundaries.rs @@ -191,18 +191,6 @@ fn prompt_entry_points_load_their_prose_from_external_files() { "build_direct_codex_system_prompt_with_search", ], ), - ( - "src/agent/prompt.rs", - &[ - "render_agent_runtime_prompt_context_for_session", - "game_creator_chat_agent_system_prompt", - "game_creator_role_agent_chat_system_prompt", - "game_creator_design_foundation_tool_plan_prompt", - "game_creator_art_director_tool_plan_prompt", - "game_creator_art_asset_plan_tool_plan_prompt", - "game_creator_agent_runtime_tool_plan_system_prompt_for_platform", - ], - ), ( "src/agent/generation/prompt_context.rs", &[ @@ -213,49 +201,11 @@ fn prompt_entry_points_load_their_prose_from_external_files() { "render_local_asset_prompt_context", ], ), - ( - "src/agent/runtime_actions/provider_request_builders.rs", - &[ - "provider_command_exec_contract", - "provider_command_start_contract", - "game_creator_agent_context_preload_notice", - ], - ), ("src/agent/design_tools.rs", &["phase_context"]), - ( - "src/agent_native_tools.rs", - &[ - "runtime_tool_description", - "runtime_tool_input_schema", - "plan_update_function_tool", - "response_function_tool", - ], - ), - ( - "src/context_compaction.rs", - &[ - "build_game_creator_agent_runtime_context_compaction_request", - "merge_context_compaction_summary_with_pinned_constraints", - ], - ), - ( - "src/agent/runtime_actions/provider_tool_plan.rs", - &[ - "provider_collaboration_repair_instruction", - "root_goal_contract_repair_instruction", - ], - ), ( "src/repository_context.rs", &["render_repository_startup_context_for_prompt"], ), - ( - "src/goal.rs", - &[ - "render_agent_goal_prompt_context_at", - "render_agent_goal_edit_instruction", - ], - ), ( "src/agent/direct_codex_user_item/wire.rs", &["ui_design_code_context_for"], @@ -264,10 +214,6 @@ fn prompt_entry_points_load_their_prose_from_external_files() { "src/commands.rs", &["build_local_project_prompt_polish_prompt"], ), - ( - "src/agent/generation/run_lifecycle.rs", - &["resumed_agent_run_prompt"], - ), ( "src/agent/codex_cli.rs", &[ @@ -275,19 +221,6 @@ fn prompt_entry_points_load_their_prose_from_external_files() { "render_game_creator_codex_cli_prompt", ], ), - ( - "src/agent/runtime_protocol/autonomous_completion.rs", - &["autonomous_playtest_contract_prompt"], - ), - ( - "src/agent/runtime_driver/task_start.rs", - &[ - "render_autonomous_manifest_ready_task_owner_prompt", - "render_autonomous_manifest_ready_task_background_prompt", - "render_relaxed_autonomous_manifest_ready_task_background_prompt", - "render_manifest_ready_task_background_prompt", - ], - ), ( "src/agent/generation/canvas_generation.rs", &[ @@ -295,15 +228,6 @@ fn prompt_entry_points_load_their_prose_from_external_files() { "build_platform_art_asset_prompt", ], ), - ( - "src/agent/generation/role_briefs.rs", - &[ - "game_creator_role_agent_system_prompt", - "render_local_agent_role_brief", - "local_role_downstream_constraint", - "local_role_acceptance_risk", - ], - ), ( "../../../server-rs/crates/platform-editor-agent/src/agent/prompt.rs", &[ @@ -351,10 +275,8 @@ fn prompt_entry_points_load_their_prose_from_external_files() { #[test] fn tool_description_fields_use_external_text_references() { let root = Path::new(env!("CARGO_MANIFEST_DIR")); - let mut paths = vec![ - root.join("src/agent/direct_tools_mcp.rs"), - root.join("src/agent_native_tools.rs"), - ]; + // 只保留现役工具源:`src/agent_native_tools.rs` 已随自建 Runtime 一并退役。 + let mut paths = vec![root.join("src/agent/direct_tools_mcp.rs")]; for entry in std::fs::read_dir( root.join("../../../server-rs/crates/platform-editor-agent/src/agent/tools"), ) @@ -420,14 +342,6 @@ fn prompt_and_fallback_constants_reference_external_texts() { "DIRECT_CODEX_BASE_INSTRUCTIONS_FALLBACK", ], ), - ( - "src/agent/runtime_driver.rs", - vec!["AGENT_RUNTIME_AUTONOMOUS_TOOL_PLAN_PAYLOAD_GUIDANCE"], - ), - ( - "src/agent/runtime_actions/provider_request_builders.rs", - vec!["AGENT_RUNTIME_COMPLETION_BLOCKER_TOOL_PLAN_PROTOCOL"], - ), ] { let source = read(&root.join(path)); let (masked, literals) = mask_literals_and_comments(&source); diff --git a/apps/ai-game-creator-shell/src-tauri/tests/runtime_prompt_bundle_build.rs b/apps/ai-game-creator-shell/src-tauri/tests/runtime_prompt_bundle_build.rs index 5ec4b79e8..c0be2efbf 100644 --- a/apps/ai-game-creator-shell/src-tauri/tests/runtime_prompt_bundle_build.rs +++ b/apps/ai-game-creator-shell/src-tauri/tests/runtime_prompt_bundle_build.rs @@ -904,61 +904,6 @@ fn production_sources_cannot_restore_parallel_prompt_or_agent_catalog_truths() { "main.rs must not restore generated catalog symbol {forbidden}" ); } - let provider_request_source = fs::read_to_string( - crate_root.join("src/agent/runtime_actions/provider_request_builders.rs"), - ) - .expect("read provider request builder"); - let provider_tool_plan_source = - fs::read_to_string(crate_root.join("src/agent/runtime_actions/provider_tool_plan.rs")) - .expect("read provider tool plan"); - let provider_request_production = provider_request_source - .split_once("#[cfg(test)]") - .map(|(production, _)| production) - .unwrap_or(&provider_request_source); - let provider_tool_plan_production = provider_tool_plan_source - .split_once("#[cfg(test)]") - .map(|(production, _)| production) - .unwrap_or(&provider_tool_plan_source); - for forbidden in [ - "一次性建立完整首批合同", - "完整的 agent.delegate / agent.spawn_isolated 批次", - "请在本次修复一次性建立完整首批协作", - "当前父 run 已有 ready 未认领回执", - "当前正式 manifest DAG 仍有专业 task 在运行", - "向 code-prototype 创建一个新的后续修复委派", - ] { - assert!( - !provider_tool_plan_production.contains(forbidden), - "provider_tool_plan.rs must consume generated fragment for {forbidden}" - ); - } - for forbidden in [ - "agent.spawn_isolated 使用", - "正式 manifest 任务图是唯一首轮专业执行链", - "你是项目唯一面向用户的总控 Agent", - "你拥有最终回复权", - ] { - assert!( - !provider_request_production.contains(forbidden), - "provider_request_builders.rs must consume generated fragment for {forbidden}" - ); - } - let prompt_source = - fs::read_to_string(crate_root.join("src/agent/prompt.rs")).expect("read prompt source"); - let prompt_production = prompt_source - .split_once("#[cfg(test)]") - .map(|(production, _)| production) - .unwrap_or(&prompt_source); - assert!( - !prompt_production.contains("唯一默认面向用户的总控 Agent"), - "prompt.rs must consume the generated Supervisor chat system fragment" - ); - assert!( - !prompt_production.contains("你拥有最终回复权"), - "prompt.rs must compose the generated Supervisor final reply fragment" - ); - assert!( - !prompt_production.contains("合法 templateAgentId 仅限以下静态模板 taskId"), - "prompt.rs must consume the generated isolated template catalog intro" - ); + // provider_request_builders.rs / provider_tool_plan.rs / agent/prompt.rs 已随自建 Runtime 退役, + // 这里不再有对应主体;对「不得再内联 prompt 正文」的约束由上面的 src 全树扫描兜底。 }