@@ -291,6 +291,57 @@ describe("NativeToolCallParser", () => {
291291 } )
292292 } )
293293 } )
294+ describe ( "new_task tool" , ( ) => {
295+ it ( "should carry the optional thinking_effort argument into nativeArgs (DTE series 5/5)" , ( ) => {
296+ const toolCall = {
297+ id : "toolu_new_task_effort" ,
298+ name : "new_task" as const ,
299+ arguments : JSON . stringify ( {
300+ mode : "ask" ,
301+ message : "Complete the delegated subtask" ,
302+ todos : "- [ ] step one" ,
303+ thinking_effort : "high" ,
304+ } ) ,
305+ }
306+
307+ const result = NativeToolCallParser . parseToolCall ( toolCall )
308+
309+ expect ( result ) . not . toBeNull ( )
310+ expect ( result ?. type ) . toBe ( "tool_use" )
311+ if ( result ?. type === "tool_use" ) {
312+ const nativeArgs = result . nativeArgs as {
313+ mode : string
314+ message : string
315+ todos ?: string
316+ thinking_effort ?: string
317+ }
318+ expect ( nativeArgs . mode ) . toBe ( "ask" )
319+ expect ( nativeArgs . message ) . toBe ( "Complete the delegated subtask" )
320+ expect ( nativeArgs . todos ) . toBe ( "- [ ] step one" )
321+ expect ( nativeArgs . thinking_effort ) . toBe ( "high" )
322+ }
323+ } )
324+
325+ it ( "should leave nativeArgs.thinking_effort undefined when the argument is omitted" , ( ) => {
326+ const toolCall = {
327+ id : "toolu_new_task_no_effort" ,
328+ name : "new_task" as const ,
329+ arguments : JSON . stringify ( {
330+ mode : "ask" ,
331+ message : "Complete the delegated subtask" ,
332+ } ) ,
333+ }
334+
335+ const result = NativeToolCallParser . parseToolCall ( toolCall )
336+
337+ expect ( result ) . not . toBeNull ( )
338+ expect ( result ?. type ) . toBe ( "tool_use" )
339+ if ( result ?. type === "tool_use" ) {
340+ const nativeArgs = result . nativeArgs as { thinking_effort ?: string }
341+ expect ( nativeArgs . thinking_effort ) . toBeUndefined ( )
342+ }
343+ } )
344+ } )
294345 } )
295346
296347 describe ( "processStreamingChunk" , ( ) => {
0 commit comments