refactor/类型化工具调用错误 #568
@@ -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);
|
||||
|
||||
@@ -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 全树扫描兜底。
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user