88// ───────────────
99// >
1010// ───────────────
11- // Used by Claude Code, Goose, and Aider.
11+ // Used by Goose, and Aider.
1212func findGreaterThanMessageBox (lines []string ) int {
1313 for i := len (lines ) - 1 ; i >= max (len (lines )- 6 , 0 ); i -- {
1414 if strings .Contains (lines [i ], ">" ) {
@@ -25,7 +25,6 @@ func findGreaterThanMessageBox(lines []string) int {
2525// ───────────────
2626// |
2727// ───────────────
28- // Used by OpenAI Codex.
2928func findGenericSlimMessageBox (lines []string ) int {
3029 for i := len (lines ) - 3 ; i >= max (len (lines )- 9 , 0 ); i -- {
3130 if strings .Contains (lines [i ], "───────────────" ) &&
@@ -52,40 +51,12 @@ func removeMessageBox(msg string) string {
5251 return strings .Join (lines , "\n " )
5352}
5453
55- func removeCodexMessageBox (msg string ) string {
54+ func removeCodexInputBox (msg string ) string {
5655 lines := strings .Split (msg , "\n " )
57- messageBoxEndIdx := - 1
58- messageBoxStartIdx := - 1
59-
60- for i := len (lines ) - 1 ; i >= 0 ; i -- {
61- if messageBoxEndIdx == - 1 {
62- if strings .Contains (lines [i ], "╰────────" ) && strings .Contains (lines [i ], "───────╯" ) {
63- messageBoxEndIdx = i
64- }
65- } else {
66- // We reached the start of the message box (we don't want to show this line), also exit the loop
67- if strings .Contains (lines [i ], "╭" ) && strings .Contains (lines [i ], "───────╮" ) {
68- // We only want this to be i in case the top of the box is visible
69- messageBoxStartIdx = i
70- break
71- }
72-
73- // We are in between the start and end of the message box, so remove the │ from the start and end of the line, let the trimEmptyLines handle the rest
74- if strings .HasPrefix (lines [i ], "│" ) {
75- lines [i ] = strings .TrimPrefix (lines [i ], "│" )
76- }
77- if strings .HasSuffix (lines [i ], "│" ) {
78- lines [i ] = strings .TrimSuffix (lines [i ], "│" )
79- lines [i ] = strings .TrimRight (lines [i ], " \t " )
80- }
81- }
82- }
83-
84- // If we didn't find messageBoxEndIdx, set it to the end of the lines
85- if messageBoxEndIdx == - 1 {
86- messageBoxEndIdx = len (lines )
56+ // Remove the input box, we need to match the exact pattern, because thinking follows the same pattern of ▌ followed by text
57+ if len (lines )- 2 >= 0 && strings .Contains (lines [len (lines )- 2 ], "▌ Ask Codex to do anything" ) {
58+ idx := len (lines ) - 2
59+ lines = append (lines [:idx ], lines [idx + 1 :]... )
8760 }
88-
89- return strings .Join (lines [messageBoxStartIdx + 1 :messageBoxEndIdx ], "\n " )
90-
61+ return strings .Join (lines , "\n " )
9162}
0 commit comments