File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -1944,10 +1944,22 @@ export class Task extends EventEmitter<TaskEvents> implements TaskLike {
19441944 }
19451945
19461946 switch ( chunk . type ) {
1947- case "reasoning" :
1947+ case "reasoning" : {
19481948 reasoningMessage += chunk . text
1949- await this . say ( "reasoning" , reasoningMessage , undefined , true )
1949+ // Only apply formatting if the message contains sentence-ending punctuation followed by **
1950+ let formattedReasoning = reasoningMessage
1951+ if ( reasoningMessage . includes ( "**" ) ) {
1952+ // Add line breaks before **Title** patterns that appear after sentence endings
1953+ // This targets section headers like "...end of sentence.**Title Here**"
1954+ // Handles periods, exclamation marks, and question marks
1955+ formattedReasoning = reasoningMessage . replace (
1956+ / ( [ . ! ? ] ) \* \* ( [ ^ * \n ] + ) \* \* / g,
1957+ "$1\n\n**$2**" ,
1958+ )
1959+ }
1960+ await this . say ( "reasoning" , formattedReasoning , undefined , true )
19501961 break
1962+ }
19511963 case "usage" :
19521964 inputTokens += chunk . inputTokens
19531965 outputTokens += chunk . outputTokens
You can’t perform that action at this time.
0 commit comments