移除旧 UI HTML Agent 工具
删除 ui.design.to_html 与 agc_ui_design_to_html 的工具目录和分发逻辑 清理 Runtime policy、native catalog 与 DirectProject prompt 引用 保留 UI 编辑器直接生成代码能力
This commit is contained in:
@@ -3656,7 +3656,6 @@ fn build_direct_codex_system_prompt_with_search(
|
||||
"工作区边界:只在当前项目目录内工作;不要读取或输出凭据、Token、Cookie、auth.json、.env 或宿主私密路径。遇到阻断必须说明具体原因、文件和下一步,不要声称未验证的成功。".to_string(),
|
||||
"AGC 工具授权边界:DirectProject 的 agc_tools 由当前客户端桥接到 AGC 后端,使用客户端已有登录会话和受控凭据完成授权。用户不需要、也不得向你提供、配置、粘贴或创建 API Key、Token、Cookie、URL 或 .env。工具返回 401/403 时,只说明 AGC 客户端登录或权限状态异常并停止,不要索要凭据、猜测外部 API,也不要暴露内部 URL。".to_string(),
|
||||
DIRECT_AGC_ENGINEERING_GUIDANCE.to_string(),
|
||||
"UI 设计 HTML 转换工具 `agc_tools.agc_ui_design_to_html` 当前暂未实现。".to_string(),
|
||||
"工程执行要求:优先复用现有结构;按需读取真实文件,不依赖客户端预注入源码快照;修改后运行与改动相关的本地验证。不要创建 Supervisor、专业 Agent 或平行项目。".to_string(),
|
||||
format!("提示词与技能:{skill_index}"),
|
||||
];
|
||||
@@ -4573,7 +4572,6 @@ mod tests {
|
||||
assert!(prompt.contains("agc_tools.taonier_prepare_game_art"));
|
||||
assert!(prompt.contains("agc_tools.agc_generate_image"));
|
||||
assert!(prompt.contains("agc_tools.agc_browser_playtest"));
|
||||
assert!(prompt.contains("agc_tools.agc_ui_design_to_html"));
|
||||
assert!(prompt.contains("DirectProject 提供 Codex 原生文件、搜索、命令、图片查看、Skill"));
|
||||
assert!(!prompt.contains("客户端会在系统上下文提供有界的当前游戏文件快照"));
|
||||
assert!(prompt.contains("Codex 不直接保存或伪造项目版本"));
|
||||
|
||||
@@ -356,23 +356,6 @@ fn direct_tools_mcp_specs_for(controlled_web_search: bool) -> Value {
|
||||
"additionalProperties": false
|
||||
}
|
||||
}),
|
||||
json!({
|
||||
"name": "agc_ui_design_to_html",
|
||||
"description": "UI 设计 HTML 转换工具当前暂未实现。",
|
||||
"inputSchema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"assetId": {
|
||||
"type": "string",
|
||||
"minLength": 1,
|
||||
"maxLength": 160,
|
||||
"description": "当前项目 manifest 中 kind=UI 的 JSON 设计资源 assetId"
|
||||
}
|
||||
},
|
||||
"required": ["assetId"],
|
||||
"additionalProperties": false
|
||||
}
|
||||
}),
|
||||
];
|
||||
let mut tools = tools;
|
||||
if controlled_web_search {
|
||||
@@ -1014,15 +997,6 @@ async fn call_agc_browser_playtest(arguments: &Value) -> Value {
|
||||
call_client_tool_bridge("agc_browser_playtest", arguments).await
|
||||
}
|
||||
|
||||
fn call_agc_ui_design_to_html(root: &Path, arguments: &Value) -> Value {
|
||||
let _ = (root, arguments);
|
||||
mcp_tool_result(
|
||||
"agc_ui_design_to_html 暂未实现".to_string(),
|
||||
Vec::new(),
|
||||
true,
|
||||
)
|
||||
}
|
||||
|
||||
async fn call_agc_web_search(arguments: &Value) -> Value {
|
||||
if !controlled_web_search_enabled() {
|
||||
return mcp_tool_result("AGC 受控联网搜索未启用".to_string(), Vec::new(), true);
|
||||
@@ -1094,7 +1068,6 @@ async fn handle_direct_tools_mcp_request(root: &Path, request: Value) -> Option<
|
||||
}
|
||||
"agc_remove_background" => call_agc_remove_background(&arguments).await,
|
||||
"agc_browser_playtest" => call_agc_browser_playtest(&arguments).await,
|
||||
"agc_ui_design_to_html" => call_agc_ui_design_to_html(root, &arguments),
|
||||
"agc_web_search" => call_agc_web_search(&arguments).await,
|
||||
_ => mcp_tool_result("未知或未审核的 AGC 工具".to_string(), Vec::new(), true),
|
||||
};
|
||||
@@ -1230,7 +1203,6 @@ mod tests {
|
||||
"agc_create_or_derive_resource",
|
||||
"agc_remove_background",
|
||||
"agc_browser_playtest",
|
||||
"agc_ui_design_to_html"
|
||||
]
|
||||
);
|
||||
let serialized = specs.to_string();
|
||||
|
||||
@@ -421,7 +421,6 @@ pub(crate) async fn execute_game_creator_agent_runtime_tool_action_with_pending_
|
||||
"ui.workflow.run" => {
|
||||
observe_agent_runtime_ui_workflow(root, agent_id, run_id, task, &action.input).await
|
||||
}
|
||||
"ui.design.to_html" => observe_agent_runtime_ui_design_to_html(root, &action.input),
|
||||
"blackboard.write" => {
|
||||
observe_agent_runtime_blackboard_write(root, agent_id, run_id, &action.input)
|
||||
}
|
||||
|
||||
@@ -1097,7 +1097,6 @@ pub(in crate::agent) fn validate_agent_runtime_autonomous_read_only_delivery_pla
|
||||
| "command.output_read"
|
||||
| "command.poll"
|
||||
| "image.inspect" => false,
|
||||
"ui.design.to_html" => false,
|
||||
"preview.validate" => agent_id != "preview-playtest" && agent_id != "code-prototype",
|
||||
"command.run_limited" => {
|
||||
agent_id != "preview-readiness" && agent_id != "code-prototype"
|
||||
|
||||
@@ -12,7 +12,6 @@ pub(crate) fn agent_runtime_tool_is_parallel_safe_read(tool: &str) -> bool {
|
||||
| "file.list"
|
||||
| "file.read"
|
||||
| "task.list"
|
||||
| "ui.design.to_html"
|
||||
)
|
||||
}
|
||||
|
||||
@@ -101,7 +100,6 @@ pub(in crate::agent) fn game_creator_agent_runtime_tool_command_id(
|
||||
"image.inspect" => Some("image.inspect"),
|
||||
"canvas.asset_generate" => Some("canvas.asset_generate"),
|
||||
"ui.workflow.run" => Some("asset.register"),
|
||||
"ui.design.to_html" => Some("ui.design.to_html"),
|
||||
"blackboard.write" => Some("memory.write"),
|
||||
"agent.message" => Some("conversation.write"),
|
||||
"agent.delegate" => Some("agent.delegate"),
|
||||
|
||||
@@ -100,7 +100,6 @@ pub(crate) fn agent_runtime_executable_tools() -> Vec<&'static str> {
|
||||
"image.inspect",
|
||||
"canvas.asset_generate",
|
||||
"ui.workflow.run",
|
||||
"ui.design.to_html",
|
||||
"blackboard.write",
|
||||
"agent.message",
|
||||
"agent.delegate",
|
||||
@@ -340,7 +339,6 @@ pub(crate) fn agent_runtime_autonomous_design_foundation_command_is_allowed(
|
||||
| "image.inspect"
|
||||
| "canvas.asset_generate"
|
||||
| "canvas.asset_import"
|
||||
| "ui.design.to_html"
|
||||
| "agent.audit"
|
||||
| "agent.run_status"
|
||||
)
|
||||
|
||||
@@ -17,7 +17,6 @@ mod project_ops;
|
||||
mod run_status;
|
||||
mod task_ops;
|
||||
mod ui_workflow;
|
||||
mod ui_html;
|
||||
|
||||
pub(in crate::agent) use action_history::*;
|
||||
pub(in crate::agent) use command_ops::*;
|
||||
@@ -36,7 +35,6 @@ pub(in crate::agent) use project_ops::*;
|
||||
pub(in crate::agent) use run_status::*;
|
||||
pub(in crate::agent) use task_ops::*;
|
||||
pub(in crate::agent) use ui_workflow::*;
|
||||
pub(in crate::agent) use ui_html::*;
|
||||
|
||||
#[cfg(test)]
|
||||
pub(crate) use delegation::observe_agent_runtime_agent_delegate_at_locked;
|
||||
|
||||
@@ -49,7 +49,6 @@ fn autonomous_design_foundation_command_is_allowed(command_id: &str) -> bool {
|
||||
| "canvas.asset_import"
|
||||
| "asset.register"
|
||||
| "ui.workflow.run"
|
||||
| "ui.design.to_html"
|
||||
| "agent.audit"
|
||||
| "agent.action_history"
|
||||
| "agent.run_status"
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
use super::*;
|
||||
use serde_json::Value;
|
||||
|
||||
pub(in crate::agent) fn observe_agent_runtime_ui_design_to_html(
|
||||
root: &Path,
|
||||
input: &Value,
|
||||
) -> AgentRuntimeToolObservation {
|
||||
AgentRuntimeToolObservation {
|
||||
tool: "ui.design.to_html".to_string(),
|
||||
status: "error".to_string(),
|
||||
summary: "ui.design.to_html 暂未实现".to_string(),
|
||||
detail: None,
|
||||
}
|
||||
}
|
||||
@@ -1391,9 +1391,6 @@ fn runtime_tool_description(tool: &str) -> &'static str {
|
||||
"ui.workflow.run" => {
|
||||
"先用 discover 从受控 game/ui-pages.json 或页面声明标记自动发现全部功能页面,再把已登记 ui-prototype 与每个页面的设计图桥接成独立 UI JSON State;可同时载入已登记图片、图标和项目字体,执行 Provider 结构识别、多树合并与分批组件绑定、回读阶段,并且只有所有页面已绑定且已应用到 game/ 后才允许 finalize。项目根目录由 Runtime 注入,模型不得传入宿主路径。"
|
||||
}
|
||||
"ui.design.to_html" => {
|
||||
"UI 设计 HTML 转换工具当前暂未实现。"
|
||||
}
|
||||
"blackboard.write" => "向项目级共享黑板追加稳定结论。",
|
||||
"agent.message" => "向一个目标 Agent 写入定向上下文消息。",
|
||||
"agent.delegate" => {
|
||||
@@ -1686,14 +1683,6 @@ fn runtime_tool_input_schema(tool: &str) -> Value {
|
||||
}
|
||||
}
|
||||
}),
|
||||
"ui.design.to_html" => json!({
|
||||
"type": "object",
|
||||
"required": ["assetId"],
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"assetId": { "type": "string", "minLength": 1, "maxLength": 160 }
|
||||
}
|
||||
}),
|
||||
"blackboard.write" => two_string_input_schema("title", "content"),
|
||||
"agent.message" => two_string_input_schema("agentId", "content"),
|
||||
"agent.delegate" => json!({
|
||||
|
||||
@@ -107,16 +107,15 @@ pub(crate) fn render_ui_design_state_js(
|
||||
let escaped = escape_template_literal(&pretty_html_fragment(&fragment));
|
||||
modules.push(format!("export const {export_name} = `\n{escaped}\n`;"));
|
||||
}
|
||||
let mut output = String::from(
|
||||
"// UI 设计生成模块:仅导出 HTML 片段,不执行任何注入逻辑。\n\
|
||||
// 重新生成会覆盖本文件中的手动修改。\n\
|
||||
// 可通过宿主页面设置 --ui-scale 调整整体像素缩放,例如:\n\
|
||||
// document.documentElement.style.setProperty('--ui-scale', '0.85');\n\
|
||||
// 注入示例(仅供 Agent 按需修改):\n\
|
||||
// import { tree_example } from './generated-xxx.js';\n\
|
||||
// document.body.insertAdjacentHTML('beforeend', tree_example);\n\
|
||||
// const node = document.querySelector('[ui-node-id=\"...\"]');\n\n",
|
||||
);
|
||||
let mut output = String::from(concat!(
|
||||
"// UI 设计生成模块:仅导出 HTML 片段,不执行任何注入逻辑。\n",
|
||||
"// 重新生成会覆盖本文件中的手动修改。\n",
|
||||
"// 每个 tree 根节点已按对应 UI design 尺寸直接设置 --ui-scale。\n",
|
||||
"// 注入示例(仅供 Agent 按需修改):\n",
|
||||
"// import { tree_example } from '/ui/generated-xxx.js';\n",
|
||||
"// document.body.insertAdjacentHTML('beforeend', tree_example);\n",
|
||||
"// const node = document.querySelector('[ui-node-id=\"...\"]');\n\n",
|
||||
));
|
||||
output.push_str(&modules.join("\n\n"));
|
||||
if !output.ends_with('\n') {
|
||||
output.push('\n');
|
||||
|
||||
Reference in New Issue
Block a user