From 4188d6bfc1cb022768d63519fbab354fb9bbaccb Mon Sep 17 00:00:00 2001 From: Lasmar Khalifa Date: Fri, 5 Jun 2026 19:42:16 -0400 Subject: [PATCH] add taskupdate tool use formatter --- .../cogs/agent/providers/claude/tool_use.rb | 19 +++++++++++++++++++ .../agent/providers/claude/tool_use_test.rb | 10 ++++++++++ 2 files changed, 29 insertions(+) diff --git a/lib/roast/cogs/agent/providers/claude/tool_use.rb b/lib/roast/cogs/agent/providers/claude/tool_use.rb index eb701c4f..8b02a7b6 100644 --- a/lib/roast/cogs/agent/providers/claude/tool_use.rb +++ b/lib/roast/cogs/agent/providers/claude/tool_use.rb @@ -293,6 +293,25 @@ def format_agent details.empty? ? "AGENT #{description}" : "AGENT #{description} (#{details})" end + # Formats a TaskUpdate tool-use line. + # + # Input fields: + # :taskId (Integer) – id of the task to update [required] + # :status (String) – the task's new status [required] + # + # Output: "TASKUPDATE #" — the id is prefixed with + # "#" and joined to the status with " → ". Both fields are always + # shown and neither is truncated. + # + # Examples: + # TASKUPDATE #1 → completed + # TASKUPDATE #2 → in_progress + # + #: () -> String + def format_taskupdate + "TASKUPDATE ##{input[:taskId]} → #{input[:status]}" + end + #: () -> String def format_unknown "UNKNOWN [#{name}] #{input.inspect}" diff --git a/test/roast/cogs/agent/providers/claude/tool_use_test.rb b/test/roast/cogs/agent/providers/claude/tool_use_test.rb index 158feede..a7c1f55e 100644 --- a/test/roast/cogs/agent/providers/claude/tool_use_test.rb +++ b/test/roast/cogs/agent/providers/claude/tool_use_test.rb @@ -368,6 +368,16 @@ class ToolUseTest < ActiveSupport::TestCase assert_equal "AGENT #{truncated} (#{long})", output end + # format_taskupdate + + test "format_taskupdate renders the task id and status" do + tool_use = ToolUse.new(name: :taskupdate, input: { taskId: 1, status: "completed" }) + + output = tool_use.format + + assert_equal "TASKUPDATE #1 → completed", output + end + test "format calls format_unknown for unknown tool" do tool_use = ToolUse.new(name: :unknown_tool, input: { arg: "value" })