fix(hub): ship checklist via cph_hub todo_write MCP tool

Native Claude TodoWrite is not registered in headless agent mode even with
--tools default. Add mcp__cph_hub__todo_write (always enabled), mirror the
TodoWrite schema, instruct multi-step runs to use it, and keep the Feishu
progress panel parsing both native and hub tool names.
This commit is contained in:
2026-07-23 23:08:42 +08:00
parent ceaf64c4f9
commit e3b463d390
9 changed files with 99 additions and 11 deletions
+14 -3
View File
@@ -43,6 +43,7 @@ const TOOL_ICONS: Record<string, string> = {
grep: "search-filled",
edit: "edit-filled",
todowrite: "todo-filled",
todo_write: "todo-filled",
send_file: "send-filled",
request_approval: "thumb-up-filled",
feishu_read_context: "search-filled",
@@ -52,10 +53,20 @@ const TOOL_ICONS: Record<string, string> = {
};
function toolIcon(toolName: string): string {
const normalized = toolName.toLowerCase().replace(/^mcp_/, "");
const normalized = toolName.toLowerCase().replace(/^mcp_/, "").replace(/^cph_hub__/, "");
return TOOL_ICONS[normalized] ?? "tool-filled";
}
function isTodoToolName(toolName: string): boolean {
const lower = toolName.toLowerCase();
return (
lower === "todowrite" ||
lower === "todo_write" ||
lower.endsWith("__todo_write") ||
lower.endsWith("__todowrite")
);
}
// ---------------------------------------------------------------------------
// Card builder
// ---------------------------------------------------------------------------
@@ -80,8 +91,8 @@ export function buildAgentCard(params: {
elements.push(buildTodoPanel(todos, phase !== "complete"));
}
// Tool-use panel (exclude TodoWrite itself — already shown as checklist)
const visibleToolSteps = toolUseSteps.filter((step) => step.toolName.toLowerCase() !== "todowrite");
// Tool-use panel (exclude todo tools — already shown as checklist)
const visibleToolSteps = toolUseSteps.filter((step) => !isTodoToolName(step.toolName));
if (visibleToolSteps.length > 0) {
elements.push(buildToolUsePanel(visibleToolSteps, toolUseElapsedMs, phase !== "complete"));
} else if (