@@ -16,7 +16,7 @@ const INTERNAL_TRACE_LINE_QUICK_RE =
1616const INTERNAL_TRACE_LINE_RE =
1717 / ^ (?: > \s * ) ? (?: ⚠ ️ \s * ) ? (?: 📊 | 🛠 ️ | 📖 | 📝 | 🔍 | 🔎 | ⚙ ️ ) \s * (?: S e s s i o n S t a t u s | E x e c | R e a d | E d i t | W r i t e | P a t c h | S e a r c h | O p e n | C l i c k | F i n d | S c r e e n s h o t | U p d a t e P l a n | T o o l C a l l | T o o l R e s u l t | F u n c t i o n C a l l | S h e l l | C o m m a n d ) \s * : / i;
1818const INTERNAL_COMPACT_FAILURE_TRACE_LINE_RE =
19- / ^ (?: > \s * ) ? ⚠ ️ \s * 🛠 ️ \s + \S [ \s \S ] * \s + \( a g e n t \) ` { 0 , 2 } \s + f a i l e d \s * $ / i;
19+ / ^ (?: > \s * ) ? ⚠ ️ \s * 🛠 ️ \s + \S [ \s \S ] * \s + \( a g e n t \) ` { 0 , 2 } \s + f a i l e d (?: \s * : . * ) ? \s * $ / i;
2020const INTERNAL_COMPACT_COMMAND_TRACE_LINE_RE =
2121 / ^ (?: > \s * ) ? 🛠 ️ \s * (?: (?: (?: e l e v a t e d | p t y ) \b \s * (?: · | , ) \s * ) + ) ? (?: ` { 1 , 2 } \s * \S | (?: r u n | c h e c k | f e t c h | p u l l | p u s h | v i e w | s h o w | l i s t | s w i t c h | c r e a t e | m e r g e | r e b a s e | s t a g e | r e s t o r e | r e s e t | s t a s h | s e a r c h | f i n d | p r i n t | c o p y | m o v e | r e m o v e | i n s t a l l | s t a r t | c d | g i t | p n p m | n p m | y a r n | b u n | n o d e | p y t h o n | p y t h o n 3 | b a s h | s h ) \b ) / i;
2222const INTERNAL_CHANNEL_TRACE_LINE_RE =
@@ -798,14 +798,19 @@ export function stripAssistantInternalTraceLines(text: string): string {
798798 return result ;
799799}
800800
801- export type AssistantVisibleTextSanitizerProfile = "delivery" | "history" | "internal-scaffolding" ;
801+ export type AssistantVisibleTextSanitizerProfile =
802+ | "delivery"
803+ | "history"
804+ | "internal-scaffolding"
805+ | "tool-progress" ;
802806
803807type AssistantVisibleTextPipelineOptions = {
804808 finalTrim : ReasoningTagTrim ;
805809 preserveDowngradedToolText ?: boolean ;
806810 preserveMinimaxToolXml ?: boolean ;
807811 stripFunctionCallsXmlPayloads ?: boolean ;
808812 stripFunctionResponseAfterPluralToolCalls ?: boolean ;
813+ stripInternalTraceLines ?: boolean ;
809814 reasoningMode : ReasoningTagMode ;
810815 reasoningTrim : ReasoningTagTrim ;
811816 stageOrder : "reasoning-first" | "reasoning-last" ;
@@ -836,6 +841,14 @@ const ASSISTANT_VISIBLE_TEXT_PIPELINE_OPTIONS: Record<
836841 reasoningTrim : "start" ,
837842 stageOrder : "reasoning-first" ,
838843 } ,
844+ "tool-progress" : {
845+ finalTrim : "both" ,
846+ stripFunctionCallsXmlPayloads : true ,
847+ stripInternalTraceLines : false ,
848+ reasoningMode : "strict" ,
849+ reasoningTrim : "both" ,
850+ stageOrder : "reasoning-last" ,
851+ } ,
839852} ;
840853
841854function applyAssistantVisibleTextStagePipeline (
@@ -871,7 +884,9 @@ function applyAssistantVisibleTextStagePipeline(
871884 stripFunctionCallsXmlPayloads : options . stripFunctionCallsXmlPayloads ,
872885 stripFunctionResponseAfterPluralToolCalls : options . stripFunctionResponseAfterPluralToolCalls ,
873886 } ) ;
874- cleaned = stripAssistantInternalTraceLines ( cleaned ) ;
887+ if ( options . stripInternalTraceLines !== false ) {
888+ cleaned = stripAssistantInternalTraceLines ( cleaned ) ;
889+ }
875890 cleaned = stripLegacyBracketToolCallBlocks ( cleaned ) ;
876891 cleaned = stripPlainTextToolCallBlocks ( cleaned ) ;
877892 if ( ! options . preserveDowngradedToolText ) {
0 commit comments