按 rustfmt 修正 V1 删除后残留的格式偏差
Repository checks 门禁的 cargo fmt --check 要求,仅格式化、无行为变化
This commit is contained in:
@@ -679,8 +679,7 @@ fn validate_agent_catalog(catalog: &AgentCatalog) -> Result<(), String> {
|
||||
return Err("agentCatalog.groups 不能为空".to_string());
|
||||
}
|
||||
let mut group_brief_names = BTreeSet::new();
|
||||
for group in std::iter::once(&catalog.supervisor).chain(catalog.groups.iter())
|
||||
{
|
||||
for group in std::iter::once(&catalog.supervisor).chain(catalog.groups.iter()) {
|
||||
if !group_brief_names.insert(group.brief_path_name.as_str()) {
|
||||
return Err(format!(
|
||||
"agent group briefPathName 重复:{}",
|
||||
|
||||
@@ -128,7 +128,6 @@ pub(crate) fn agent_runtime_tool_allowed_for_agent(agent_id: &str, tool: &str) -
|
||||
game_creator_agent_runtime_tool_command_id(tool.trim()).is_some()
|
||||
}
|
||||
|
||||
|
||||
#[cfg(test)]
|
||||
mod identity_tests {
|
||||
use super::*;
|
||||
|
||||
+13
-13
@@ -514,19 +514,19 @@ pub(crate) async fn prepare_game_creator_agent_runtime_provider_action_batch(
|
||||
AGENT_RUNTIME_PROVIDER_ACTION_BATCH_STATUS_READY
|
||||
};
|
||||
let batch_id = agent_runtime_provider_action_batch_id(
|
||||
&project_id,
|
||||
&runtime.agent_id,
|
||||
&runtime.task_id,
|
||||
&runtime.session_id,
|
||||
&runtime.run_id,
|
||||
runtime.loop_iteration,
|
||||
runtime.applied_steer_cursor,
|
||||
&batch_plan,
|
||||
project_revision_before,
|
||||
planned_repository_context_fingerprint,
|
||||
&actions,
|
||||
collaboration_preflight.contract.as_ref(),
|
||||
)?;
|
||||
&project_id,
|
||||
&runtime.agent_id,
|
||||
&runtime.task_id,
|
||||
&runtime.session_id,
|
||||
&runtime.run_id,
|
||||
runtime.loop_iteration,
|
||||
runtime.applied_steer_cursor,
|
||||
&batch_plan,
|
||||
project_revision_before,
|
||||
planned_repository_context_fingerprint,
|
||||
&actions,
|
||||
collaboration_preflight.contract.as_ref(),
|
||||
)?;
|
||||
let now = unix_timestamp();
|
||||
let batch = AgentRuntimeProviderActionBatch {
|
||||
schema_version: AGENT_RUNTIME_PROVIDER_ACTION_BATCH_SCHEMA_VERSION.to_string(),
|
||||
|
||||
+6
-8
@@ -3,7 +3,6 @@ use platform_llm::LlmFunctionTool;
|
||||
|
||||
const AGENT_RUNTIME_COMPLETION_BLOCKER_TOOL_PLAN_PROTOCOL: &str = "通用完成阻断规则:如果最新 observation 的 tool 为 runtime.autonomous_completion 且 status 为 blocked,本轮禁止调用 respond_to_user;必须先读取该 observation.detail 的 nextRequiredAction,并据此调用合适的读取、修复和验证工具。只有完成要求的动作、取得后续可信 observation 且完成门禁不再阻断后,才能给最终回复;不得反复提交 final response,也不得按项目正文硬编码某一种 blocker 的处理方式。";
|
||||
|
||||
|
||||
#[derive(Clone, Copy)]
|
||||
enum AgentBackgroundContextMode {
|
||||
ToolPlan,
|
||||
@@ -425,8 +424,7 @@ fn build_game_creator_agent_background_tool_plan_request_at(
|
||||
let protocol_prompt = format!(
|
||||
"必须直接调用当前请求提供的原生函数:需要更新持久计划时调用 update_agent_plan,需要行动时调用对应动作工具,已有观察足够时调用 respond_to_user。只有步骤或状态真实变化时才单独调用 update_agent_plan;当前 in_progress 步骤已具备执行条件时必须在同一响应调用对应动作工具,不能只改计划解释。不要调用未广告的旧 submit_agent_tool_plan,也不要把计划或动作放在普通文本中。\n\n{AGENT_RUNTIME_COMPLETION_BLOCKER_TOOL_PLAN_PROTOCOL}"
|
||||
);
|
||||
let mut system_prompt =
|
||||
game_creator_agent_runtime_tool_plan_system_prompt_for_agent(agent_id);
|
||||
let mut system_prompt = game_creator_agent_runtime_tool_plan_system_prompt_for_agent(agent_id);
|
||||
if autonomous_game_build {
|
||||
system_prompt.push_str("\n\n");
|
||||
system_prompt.push_str(required_runtime_prompt_section(
|
||||
@@ -824,11 +822,11 @@ mod tests {
|
||||
AgentRuntimeTaskLink, AgentRuntimeToolObservation, AgentRuntimeToolPlan,
|
||||
AgentRuntimeToolPlanRequestSnapshot, GameCreatorLlmConfig,
|
||||
AGENT_RUNTIME_AUTONOMOUS_PRE_MUTATION_LOOP_LIMIT,
|
||||
AGENT_RUNTIME_COMPLETION_BLOCKER_TOOL_PLAN_PROTOCOL,
|
||||
AGENT_RUNTIME_RESPOND_FUNCTION_NAME, AGENT_RUNTIME_RUN_PROFILE_AUTONOMOUS_GAME_BUILD,
|
||||
AGENT_RUNTIME_RUN_PROFILE_STANDARD, AGENT_RUNTIME_SUPERVISOR_CLI_SOURCE,
|
||||
AGENT_RUNTIME_SUPERVISOR_GUI_SOURCE, AGENT_RUNTIME_UPDATE_PLAN_FUNCTION_NAME,
|
||||
GAME_CREATOR_PROJECT_SUPERVISOR_AGENT_ID, RUNTIME_PROMPT_SUPERVISOR_CHAT_COMPOSITION,
|
||||
AGENT_RUNTIME_COMPLETION_BLOCKER_TOOL_PLAN_PROTOCOL, AGENT_RUNTIME_RESPOND_FUNCTION_NAME,
|
||||
AGENT_RUNTIME_RUN_PROFILE_AUTONOMOUS_GAME_BUILD, AGENT_RUNTIME_RUN_PROFILE_STANDARD,
|
||||
AGENT_RUNTIME_SUPERVISOR_CLI_SOURCE, AGENT_RUNTIME_SUPERVISOR_GUI_SOURCE,
|
||||
AGENT_RUNTIME_UPDATE_PLAN_FUNCTION_NAME, GAME_CREATOR_PROJECT_SUPERVISOR_AGENT_ID,
|
||||
RUNTIME_PROMPT_SUPERVISOR_CHAT_COMPOSITION,
|
||||
};
|
||||
|
||||
fn build_game_creator_agent_background_tool_plan_request_for_test(
|
||||
|
||||
+1
-4
@@ -118,9 +118,7 @@ fn provider_collaboration_repair_instruction(protocol_error: &str, section_id: &
|
||||
)
|
||||
}
|
||||
|
||||
fn restrict_root_goal_contract_repair_request(
|
||||
request: &mut LlmRunRequest,
|
||||
) -> Result<(), String> {
|
||||
fn restrict_root_goal_contract_repair_request(request: &mut LlmRunRequest) -> Result<(), String> {
|
||||
restrict_agent_runtime_root_goal_contract_tools(request)
|
||||
}
|
||||
|
||||
@@ -1392,5 +1390,4 @@ mod supervisor_collaboration_repair_tests {
|
||||
|
||||
assert_eq!(merged, vec![replacement]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -14,7 +14,6 @@ mod canvas_asset_kind_contract_tests {
|
||||
&["game-art", "icon-spec", "ui-prototype", "art-spritesheet"]
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
pub(crate) fn agent_runtime_executable_tools() -> Vec<&'static str> {
|
||||
|
||||
@@ -97,9 +97,10 @@ mod tests {
|
||||
fn game_creator_runtime_agent_catalog_matches_the_existing_role_directory() {
|
||||
let catalog = game_creator_runtime_agent_catalog().expect("agent catalog");
|
||||
// catalog 恰好是「一个组外单节点(Supervisor)+ 各专业组角色」。
|
||||
let mut expected = std::collections::BTreeSet::from([
|
||||
GAME_CREATOR_PROJECT_SUPERVISOR_AGENT_ID.to_string(),
|
||||
]);
|
||||
let mut expected =
|
||||
std::collections::BTreeSet::from(
|
||||
[GAME_CREATOR_PROJECT_SUPERVISOR_AGENT_ID.to_string()],
|
||||
);
|
||||
for group in GAME_CREATOR_AGENT_GROUP_DEFINITIONS {
|
||||
expected.extend(group.roles.iter().map(|role| role.task_id.to_string()));
|
||||
}
|
||||
|
||||
@@ -1051,7 +1051,6 @@ fn verify_replace_target_is_safe(target: &Path, label: &str) -> Result<(), Plann
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// Return the fixed UTC millisecond timestamp used by Runtime-owned planning
|
||||
/// projections. Keeping this helper here makes tests able to inject a fixed
|
||||
/// timestamp while production callers can use the same formatting contract.
|
||||
|
||||
@@ -10,9 +10,8 @@ use serde_json::{json, Value};
|
||||
|
||||
use crate::agent::{
|
||||
agent_runtime_native_executable_tools, AgentRuntimePlanUpdate, AgentRuntimeToolAction,
|
||||
AgentRuntimeToolPlan,
|
||||
AGENT_RUNTIME_BACKGROUND_TOOL_ACTION_LIMIT, AGENT_RUNTIME_CANVAS_ASSET_KINDS,
|
||||
AGENT_RUNTIME_PLAN_STEP_LIMIT,
|
||||
AgentRuntimeToolPlan, AGENT_RUNTIME_BACKGROUND_TOOL_ACTION_LIMIT,
|
||||
AGENT_RUNTIME_CANVAS_ASSET_KINDS, AGENT_RUNTIME_PLAN_STEP_LIMIT,
|
||||
};
|
||||
#[cfg(test)]
|
||||
use crate::GAME_CREATOR_PROJECT_SUPERVISOR_AGENT_ID;
|
||||
@@ -299,7 +298,6 @@ pub(crate) fn build_agent_runtime_native_function_tools_for_agent(
|
||||
Ok(functions)
|
||||
}
|
||||
|
||||
|
||||
pub(crate) fn agent_runtime_native_tool_allowed_for_agent(tool: &str) -> bool {
|
||||
agent_runtime_native_capability_registry()
|
||||
.ok()
|
||||
@@ -1797,7 +1795,6 @@ mod tests {
|
||||
["required"],
|
||||
json!(["agentId", "runId", "actionId"])
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -155,9 +155,7 @@ impl CliCommand {
|
||||
pub(crate) fn is_read_only_status(&self) -> bool {
|
||||
matches!(
|
||||
self,
|
||||
Self::AgentRuntimeStatus { .. }
|
||||
| Self::AgentGoalStatus { .. }
|
||||
| Self::RunnerStatus
|
||||
Self::AgentRuntimeStatus { .. } | Self::AgentGoalStatus { .. } | Self::RunnerStatus
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -1291,9 +1291,9 @@ fn validate_agent_db_lifecycle_record_semantics(
|
||||
let audit_schema = agent_db_provider_lifecycle_schema_version(record)?;
|
||||
if audit_schema == AGENT_DB_PROVIDER_REQUEST_LIFECYCLE_SCHEMA_V2
|
||||
&& record
|
||||
.get("webSearchEnabled")
|
||||
.and_then(serde_json::Value::as_bool)
|
||||
.is_none()
|
||||
.get("webSearchEnabled")
|
||||
.and_then(serde_json::Value::as_bool)
|
||||
.is_none()
|
||||
{
|
||||
return Err("Agent DB Provider lifecycle webSearchEnabled 必须为 bool".to_string());
|
||||
}
|
||||
@@ -2077,7 +2077,6 @@ pub(crate) fn append_agent_db_process_reconciliation_if_missing_for_action(
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
pub(crate) fn append_agent_db_record_if_missing_for_action_with_before_lock<F>(
|
||||
root: &Path,
|
||||
record_type: &str,
|
||||
|
||||
@@ -534,7 +534,8 @@ fn visual_specialist_prompts_require_real_registered_image_deliveries() {
|
||||
);
|
||||
}
|
||||
|
||||
let director_prompt = game_creator_agent_runtime_tool_plan_system_prompt_for_agent("art-director");
|
||||
let director_prompt =
|
||||
game_creator_agent_runtime_tool_plan_system_prompt_for_agent("art-director");
|
||||
for expected in [
|
||||
"assets/art-spec.png",
|
||||
"assetKind=icon-spec",
|
||||
@@ -582,7 +583,8 @@ fn visual_specialist_prompts_require_real_registered_image_deliveries() {
|
||||
);
|
||||
}
|
||||
|
||||
let ordinary_prompt = game_creator_agent_runtime_tool_plan_system_prompt_for_agent("quality-review");
|
||||
let ordinary_prompt =
|
||||
game_creator_agent_runtime_tool_plan_system_prompt_for_agent("quality-review");
|
||||
assert!(!ordinary_prompt.contains("assets/ui-prototype.png"));
|
||||
assert!(!ordinary_prompt.contains("assets/art-spritesheet.png"));
|
||||
}
|
||||
|
||||
@@ -308,7 +308,6 @@ fn agent_runtime_context_window_applies_to_every_lane() {
|
||||
assert_eq!(checkpoint, AgentRuntimeContextCheckpoint::Continue);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -109,8 +109,7 @@ pub(super) use crate::{
|
||||
AGENT_RUNTIME_BACKGROUND_LOOP_LIMIT, AGENT_RUNTIME_LOCK_STALE_AFTER_SECONDS,
|
||||
AGENT_RUNTIME_PENDING_ACTION_SCHEMA_VERSION, AGENT_RUNTIME_PENDING_ACTION_STATUS_APPROVED,
|
||||
AGENT_RUNTIME_PENDING_ACTION_STATUS_EXECUTING,
|
||||
AGENT_RUNTIME_PENDING_ACTION_STATUS_OBSERVED_APPROVED,
|
||||
AGENT_RUNTIME_PLAN_STATUS_COMPLETED,
|
||||
AGENT_RUNTIME_PENDING_ACTION_STATUS_OBSERVED_APPROVED, AGENT_RUNTIME_PLAN_STATUS_COMPLETED,
|
||||
AGENT_RUNTIME_RESPOND_FUNCTION_NAME, AGENT_RUNTIME_RUN_PROFILE_AUTONOMOUS_GAME_BUILD,
|
||||
AGENT_RUNTIME_RUN_PROFILE_STANDARD, AGENT_RUNTIME_SCHEMA_VERSION,
|
||||
AGENT_RUNTIME_SUPERVISOR_CLI_SOURCE, AGENT_RUNTIME_SUPERVISOR_GUI_SOURCE,
|
||||
@@ -118,7 +117,6 @@ pub(super) use crate::{
|
||||
AGENT_RUNTIME_UI_PROTOTYPE_INSPECTION_KIND,
|
||||
AGENT_RUNTIME_UI_PROTOTYPE_LEGACY_VALIDATION_PROFILE, AGENT_RUNTIME_UI_PROTOTYPE_PATH,
|
||||
AGENT_RUNTIME_UI_PROTOTYPE_VALIDATION_PROFILE, AGENT_RUNTIME_UPDATE_PLAN_FUNCTION_NAME,
|
||||
GAME_CREATOR_CONFIG_FILE_NAME,
|
||||
GAME_CREATOR_PROJECT_SUPERVISOR_AGENT_ID, GAME_CREATOR_USER_INPUT_REQUEST_TOOL,
|
||||
PROJECT_BLACKBOARD_MEMORY_PATH,
|
||||
GAME_CREATOR_CONFIG_FILE_NAME, GAME_CREATOR_PROJECT_SUPERVISOR_AGENT_ID,
|
||||
GAME_CREATOR_USER_INPUT_REQUEST_TOOL, PROJECT_BLACKBOARD_MEMORY_PATH,
|
||||
};
|
||||
|
||||
@@ -240,9 +240,7 @@ fn runtime_task_reader_accepts_rare_persisted_phases() {
|
||||
// 引用的同一个常量,漏登记会在这条用例上先红。
|
||||
fs::write(
|
||||
&path,
|
||||
format!(
|
||||
"{brief}\n{parent_link_missing}\n{public_status_write_failed}\n"
|
||||
),
|
||||
format!("{brief}\n{parent_link_missing}\n{public_status_write_failed}\n"),
|
||||
)
|
||||
.expect("write rare persisted task phases");
|
||||
|
||||
|
||||
@@ -1260,5 +1260,4 @@ mod tests {
|
||||
assert!(!metadata.contains("response-private"));
|
||||
assert!(metadata.contains("answerChars=12"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -601,8 +601,7 @@ fn overlay_fixture() -> Fixture {
|
||||
"SECTION:codeDirectorRoleBrief\n",
|
||||
)
|
||||
.expect("write overlay section");
|
||||
fixture.manifest["sections"]["codeDirectorRoleBrief"] =
|
||||
json!("roles/code-director-brief.md");
|
||||
fixture.manifest["sections"]["codeDirectorRoleBrief"] = json!("roles/code-director-brief.md");
|
||||
fixture.manifest["roleOverlays"] = json!([{
|
||||
"agentId": "code-director",
|
||||
"sections": ["codeDirectorRoleBrief"]
|
||||
|
||||
Reference in New Issue
Block a user