fix(cloud-agent): 布局工具参数错误按字段归类,审批卡补整理徽标

- canvas_arrange_nodes 的参数契约错误改用上游既有的 cloudAgentFieldError:
  snapshotHash 缺失按 required、mode/align/gap/nodeIds/groups 非法按 invalid_value、
  nodeIds/groups 超限按 item_count。原先一律 BadAuthRequest(*AppError),按上游运行期的
  errors.As 顺序会走 failCloudAgentAdmission 把整轮判死,模型拿不到可纠正回执。
- 审批卡补 .canvas-agent-approval-operation-arrange_nodes 徽标配色(与新增/修改/连线同一组),
  并补一条前端用例:arrange_nodes 预览项不得被 operation() 当成未知值丢掉。
This commit is contained in:
AetherNo2332
2026-09-22 01:40:43 +08:00
parent 6a216dddc2
commit 1637bb9536
4 changed files with 29 additions and 12 deletions

View File

@@ -64,6 +64,20 @@ describe("Agent approval presentation", () => {
expect(JSON.stringify(view)).not.toContain("private");
});
it("keeps an arrange_nodes preview item instead of dropping it as an unknown operation", () => {
// 未知 operation 会被 operation() 判成 null 并丢掉整条预览项,因此新增的
// arrange_nodes 必须同时进联合类型与判据,否则审批卡只剩"生成"这个兜底标签。
const view = agentApprovalPresentation({ preview: {
kind: "canvas_mutation",
title: "确认整理画布",
description: "请确认要整理的节点。",
items: [{ operation: "arrange_nodes", nodeId: "text-1", nodeTitle: "开场分镜", nodeTypeLabel: "文本", summary: "整理《开场分镜》" }],
} });
expect(view.items).toHaveLength(1);
expect(view.items[0].operation).toBe("arrange_nodes");
expect(view.items[0].nodeTitle).toBe("开场分镜");
});
it("states when an unknown approval cannot identify a target", () => {
const view = agentApprovalPresentation({ toolName: "unknown_tool", arguments: {} });
expect(view.items).toHaveLength(0);