@@ -6,22 +6,22 @@ import (
66 "github.com/coder/agentapi/lib/msgfmt"
77)
88
9- func calcAmpDynamicHeader (newLines []string ) (int , bool ) {
9+ func calcAmpDynamicHeader (lines []string ) (int , bool ) {
1010 dynamicHeaderEnd := - 1
1111 firstTextEncountered := false
1212 continueRemoving := true
1313
1414 // search for the first 3 consecutive empty lines after the first text encountered.
15- if len (newLines ) > 3 {
16- for i := 0 ; i < len (newLines )- 3 ; i ++ {
17- if ! firstTextEncountered && len (strings .Trim (newLines [i ], " \n " )) != 0 {
18- if strings .HasPrefix (strings .TrimSpace (newLines [i ]), "┃" ) {
15+ if len (lines ) > 3 {
16+ for i := 0 ; i < len (lines )- 3 ; i ++ {
17+ if ! firstTextEncountered && len (strings .Trim (lines [i ], " \n " )) != 0 {
18+ if strings .HasPrefix (strings .TrimSpace (lines [i ]), "┃" ) {
1919 continueRemoving = false
2020 }
2121 firstTextEncountered = true
2222 }
23- if firstTextEncountered && len (strings .Trim (newLines [i ], " \n " )) == 0 && len (strings .Trim (newLines [i + 1 ], " \n " )) == 0 &&
24- len (strings .Trim (newLines [i + 2 ], " \n " )) == 0 {
23+ if firstTextEncountered && len (strings .Trim (lines [i ], " \n " )) == 0 && len (strings .Trim (lines [i + 1 ], " \n " )) == 0 &&
24+ len (strings .Trim (lines [i + 2 ], " \n " )) == 0 {
2525 dynamicHeaderEnd = i
2626 break
2727
@@ -31,14 +31,14 @@ func calcAmpDynamicHeader(newLines []string) (int, bool) {
3131 return dynamicHeaderEnd , continueRemoving
3232}
3333
34- func calcOpencodeDynamicHeader (newLines []string ) (int , bool ) {
34+ func calcOpencodeDynamicHeader (lines []string ) (int , bool ) {
3535 // Skip header lines for Opencode agent type to avoid false positives
3636 // The header contains dynamic content (token count, context percentage, cost)
3737 // that changes between screens, causing line comparison mismatches:
3838 //
3939 // ┃ # Getting Started with Claude CLI ┃
4040 // ┃ /share to create a shareable link 12.6K/6% ($0.05) ┃
41- if len (newLines ) >= 2 {
41+ if len (lines ) >= 2 {
4242 return 2 , true
4343 }
4444 return - 1 , true
0 commit comments