Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions lib/roast/cogs/agent/providers/claude/tool_use.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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 #<taskId> → <status>" — 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}"
Expand Down
10 changes: 10 additions & 0 deletions test/roast/cogs/agent/providers/claude/tool_use_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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" })

Expand Down
Loading