File tree Expand file tree Collapse file tree 2 files changed +27
-1
lines changed
testdata/format/claude/remove-task-tool-call Expand file tree Collapse file tree 2 files changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -106,6 +106,7 @@ func removeClaudeReportTaskToolCall(msg string) string {
106106 lines := strings .Split (msg , "\n " )
107107
108108 toolCallStartIdx := - 1
109+ newLineAfterToolCallIdx := - 1
109110
110111 // Store all tool call start and end indices [[start, end], ...]
111112 var toolCallIdxs [][]int
@@ -121,7 +122,17 @@ func removeClaudeReportTaskToolCall(msg string) string {
121122
122123 // Reset to find the next tool call
123124 toolCallStartIdx = - 1
125+ newLineAfterToolCallIdx = - 1
124126 }
127+ if len (line ) == 0 && toolCallStartIdx != - 1 && newLineAfterToolCallIdx == - 1 {
128+ newLineAfterToolCallIdx = i
129+ }
130+ }
131+
132+ // Handle the case where the last tool call goes till the end of the message
133+ // And a failsafe when the next message is not prefixed with ●
134+ if toolCallStartIdx != - 1 && newLineAfterToolCallIdx != - 1 {
135+ toolCallIdxs = append (toolCallIdxs , []int {toolCallStartIdx , newLineAfterToolCallIdx })
125136 }
126137
127138 // If no tool calls found, return original message
Original file line number Diff line number Diff line change 5454 How to play:
5555 Open the HTML file in your web browser and use the arrow keys
5656 to move the snake. Collect the red food to grow and increase
57- your score!
57+ your score!
58+
59+ ● coder - coder_report_task (MCP)(summary: "Snake game created
60+ successfully at snake-game.html",
61+ link: "file:///home/coder/snake-ga
62+ me.html", state: "working")
63+ ⎿ {
64+ "message": "Thanks for reporting!"
65+ }
66+
67+
68+ ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
69+ >
70+ ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
71+ ? for shortcuts ⧉ In message_box.go
72+
You can’t perform that action at this time.
0 commit comments