diff --git a/agent-node/src/agent_node/core/regex_patterns.py b/agent-node/src/agent_node/core/regex_patterns.py index 5756ce7..ad4d0dd 100644 --- a/agent-node/src/agent_node/core/regex_patterns.py +++ b/agent-node/src/agent_node/core/regex_patterns.py @@ -24,7 +24,7 @@ # Echo Suppression Patterns (M9/M7) ECHO_START_PATTERN = re.compile(r'echo \s*\[\[1337;Task\^Start;id=[a-zA-Z0-9-]*\]\]\s*&\s*') -ECHO_END_PATTERN = re.compile(r'\s*&\s*echo \s*\[\[1337;Task\^End;id=[a-zA-Z0-9-]*;exit=%(__ctx_err|errorlevel)%\]\]') +ECHO_END_PATTERN = re.compile(r'\s*&\s*echo \s*\[\[1337;Task\^End;id=[a-zA-Z0-9-]*;exit=\d+\]\]') ECHO_CLEANUP_ANSI = re.compile(r'echo \x1b]1337;TaskEnd;.*') ECHO_CLEANUP_BRACKET = re.compile(r'echo \[\[1337;TaskEnd;.*') @@ -35,8 +35,8 @@ # Windows ConPTY stream noise filters # Matches Windows ConHost title-set sequences: "0;......" lines -WIN_TITLE_RE = re.compile(r'^\s*0;.*$', re.MULTILINE) -# Matches the '@call "...bat"' invocation line echoed by cmd.exe (accounting for optional @) -BAT_CALL_RE = re.compile(r'^\s*@?call\s+".+\.bat".*$', re.MULTILINE | re.IGNORECASE) -# Matches the '@del /Q ...' cleanup echo (accounting for optional @) -DEL_RE = re.compile(r'^\s*@?del\s+/Q\s+".+\.bat".*$', re.MULTILINE | re.IGNORECASE) +WIN_TITLE_RE = re.compile(r'\x1b]0;.*?\x07', re.MULTILINE) +# Matches the '@call "...bat"' invocation line echoed by cmd.exe (accounting for optional @ and merges) +BAT_CALL_RE = re.compile(r'@?call\s+".+?\.bat".*?(?=\s*&|$)', re.IGNORECASE) +# Matches the '@del /Q ...' cleanup echo (accounting for optional @ and merges) +DEL_RE = re.compile(r'@?del\s+/Q\s+".+?\.bat".*?$', re.IGNORECASE)