@@ -640,7 +640,7 @@ def count_lines_by_section(self) -> Dict[str, int]:
640640
641641 # --- markdown rendering with filter ---
642642 def to_markdown (self , section_filter : Optional [Dict [str , bool ]] = None ,
643- clean_content : bool = False , output_cap : int = 0 , user_cap : int = 0 , agent_cap : int = 0 , reasoning_cap : int = 0 ) -> str :
643+ clean_content : bool = False , output_cap : int = 0 , user_cap : int = 0 , agent_cap : int = 0 , reasoning_cap : int = 0 , internal_cap : int = 0 ) -> str :
644644 if section_filter is None :
645645 section_filter = {s [0 ]: True for s in SECTION_DEFS }
646646
@@ -655,7 +655,7 @@ def _cap_text(text: str) -> str:
655655 return f'... ({ len (lines ) - output_cap } lines trimmed) ...\n ' + '\n ' .join (kept )
656656
657657 keep_indices = set (range (len (self .data )))
658- counts = {'user_message' : 0 , 'agent_message' : 0 , 'reasoning_group ' : 0 }
658+ counts = {'user_message' : 0 , 'agent_message' : 0 , 'agent_reasoning' : 0 , 'reasoning ' : 0 }
659659
660660 for i in range (len (self .data ) - 1 , - 1 , - 1 ):
661661 itype = self .data [i ]['type' ]
@@ -665,9 +665,12 @@ def _cap_text(text: str) -> str:
665665 elif itype == 'agent_message' and agent_cap > 0 :
666666 if counts ['agent_message' ] >= agent_cap : keep_indices .remove (i )
667667 counts ['agent_message' ] += 1
668- elif itype in ('agent_reasoning' , 'reasoning' ) and reasoning_cap > 0 :
669- if counts ['reasoning_group' ] >= reasoning_cap : keep_indices .remove (i )
670- counts ['reasoning_group' ] += 1
668+ elif itype == 'agent_reasoning' and reasoning_cap > 0 :
669+ if counts ['agent_reasoning' ] >= reasoning_cap : keep_indices .remove (i )
670+ counts ['agent_reasoning' ] += 1
671+ elif itype == 'reasoning' and internal_cap > 0 :
672+ if counts ['reasoning' ] >= internal_cap : keep_indices .remove (i )
673+ counts ['reasoning' ] += 1
671674
672675 md : List [str ] = []
673676 md .append (f"# { self .title } \n " )
@@ -829,12 +832,12 @@ def read_key() -> str:
829832def interactive_filter (parsers : List [SessionParser ]) -> Tuple [Dict [str , bool ], bool , int , int , int , int ]:
830833 """
831834 Full-screen interactive filter.
832- Returns (section_filter, clean_content, output_cap, user_cap, agent_cap, reasoning_cap).
835+ Returns (section_filter, clean_content, output_cap, user_cap, agent_cap, reasoning_cap, internal_cap ).
833836 """
834837 _line_cache = {}
835838
836- def get_lines_for_state (cap_out : int , cap_user : int , cap_agent : int , cap_reason : int , cc : bool ):
837- cache_key = (cap_out , cap_user , cap_agent , cap_reason , cc )
839+ def get_lines_for_state (cap_out : int , cap_user : int , cap_agent : int , cap_reason : int , cap_internal : int , cc : bool ):
840+ cache_key = (cap_out , cap_user , cap_agent , cap_reason , cap_internal , cc )
838841 if cache_key in _line_cache :
839842 return _line_cache [cache_key ]
840843
@@ -845,7 +848,7 @@ def get_lines_for_state(cap_out: int, cap_user: int, cap_agent: int, cap_reason:
845848
846849 for parser in parsers :
847850 keep_indices = set (range (len (parser .data )))
848- chat_counts = {'u' : 0 , 'a' : 0 , 'r' : 0 }
851+ chat_counts = {'u' : 0 , 'a' : 0 , 'r' : 0 , 'i' : 0 }
849852
850853 for i in range (len (parser .data ) - 1 , - 1 , - 1 ):
851854 itype = parser .data [i ]['type' ]
@@ -855,9 +858,12 @@ def get_lines_for_state(cap_out: int, cap_user: int, cap_agent: int, cap_reason:
855858 elif itype == 'agent_message' and cap_agent > 0 :
856859 if chat_counts ['a' ] >= cap_agent : keep_indices .remove (i )
857860 chat_counts ['a' ] += 1
858- elif itype in ( 'agent_reasoning' , 'reasoning' ) and cap_reason > 0 :
861+ elif itype == 'agent_reasoning' and cap_reason > 0 :
859862 if chat_counts ['r' ] >= cap_reason : keep_indices .remove (i )
860863 chat_counts ['r' ] += 1
864+ elif itype == 'reasoning' and cap_internal > 0 :
865+ if chat_counts ['i' ] >= cap_internal : keep_indices .remove (i )
866+ chat_counts ['i' ] += 1
861867
862868 for i , item in enumerate (parser .data ):
863869 if i not in keep_indices : continue
@@ -919,17 +925,21 @@ def get_lines_for_state(cap_out: int, cap_user: int, cap_agent: int, cap_reason:
919925
920926 reason_cap = 0
921927 r_idx = 0
928+
929+ internal_cap = 0
930+ i_idx = 0
922931
923932 cursor = 0
924933 ROW_CLEAN = len (SECTION_DEFS )
925934 ROW_CAP = len (SECTION_DEFS ) + 1
926935 ROW_USER = len (SECTION_DEFS ) + 2
927936 ROW_AGENT = len (SECTION_DEFS ) + 3
928937 ROW_REASON = len (SECTION_DEFS ) + 4
929- num_items = len (SECTION_DEFS ) + 5
938+ ROW_INTERNAL = len (SECTION_DEFS ) + 5
939+ num_items = len (SECTION_DEFS ) + 6
930940
931941 while True :
932- agg_lines , agg_msgs = get_lines_for_state (output_cap , user_cap , agent_cap , reason_cap , clean_content )
942+ agg_lines , agg_msgs = get_lines_for_state (output_cap , user_cap , agent_cap , reason_cap , internal_cap , clean_content )
933943 total_lines = sum (agg_lines .get (s [0 ], 0 ) for s in SECTION_DEFS )
934944 selected_lines = sum (agg_lines .get (s [0 ], 0 ) for s in SECTION_DEFS if fstate .get (s [0 ], False ))
935945 pct = (selected_lines / total_lines * 100 ) if total_lines > 0 else 0
@@ -1013,6 +1023,14 @@ def get_lines_for_state(cap_out: int, cap_user: int, cap_agent: int, cap_reason:
10131023 r_hint = f' { Style .DIM } ◀▶{ Style .RESET } ' if r_cur else ''
10141024 print (f' { r_arrow } { r_st } 🧠 Agent Reasoning Cap{ Style .RESET } { Style .DIM } (blocks){ Style .RESET } { r_label } { r_hint } ' )
10151025
1026+ # Internal Reasoning Cap
1027+ i_cur = (cursor == ROW_INTERNAL )
1028+ i_arrow = f'{ Style .BOLD } { Style .YELLOW } ▸{ Style .RESET } ' if i_cur else ' '
1029+ i_st = f'{ Style .BOLD } ' if i_cur else Style .DIM
1030+ i_label = f'{ Style .DIM } ALL{ Style .RESET } ' if internal_cap == 0 else f'{ Style .YELLOW } Last { internal_cap } { Style .RESET } '
1031+ i_hint = f' { Style .DIM } ◀▶{ Style .RESET } ' if i_cur else ''
1032+ print (f' { i_arrow } { i_st } 🔒 Internal Reasoning Cap{ Style .RESET } { Style .DIM } (blocks){ Style .RESET } { i_label } { i_hint } ' )
1033+
10161034 print (f'\n { Style .DIM } { "━" * 62 } { Style .RESET } ' )
10171035 bar_w = 30
10181036 filled = int (bar_w * pct / 100 )
@@ -1044,6 +1062,9 @@ def get_lines_for_state(cap_out: int, cap_user: int, cap_agent: int, cap_reason:
10441062 elif cursor == ROW_REASON :
10451063 r_idx = max (0 , r_idx - 1 )
10461064 reason_cap = MSG_CAP_STEPS [r_idx ]
1065+ elif cursor == ROW_INTERNAL :
1066+ i_idx = max (0 , i_idx - 1 )
1067+ internal_cap = MSG_CAP_STEPS [i_idx ]
10471068 elif key == 'RIGHT' :
10481069 if cursor == ROW_CAP :
10491070 cap_idx = min (len (CAP_STEPS ) - 1 , cap_idx + 1 )
@@ -1057,6 +1078,9 @@ def get_lines_for_state(cap_out: int, cap_user: int, cap_agent: int, cap_reason:
10571078 elif cursor == ROW_REASON :
10581079 r_idx = min (len (MSG_CAP_STEPS ) - 1 , r_idx + 1 )
10591080 reason_cap = MSG_CAP_STEPS [r_idx ]
1081+ elif cursor == ROW_INTERNAL :
1082+ i_idx = min (len (MSG_CAP_STEPS ) - 1 , i_idx + 1 )
1083+ internal_cap = MSG_CAP_STEPS [i_idx ]
10601084 elif key == 'A' :
10611085 for s in SECTION_DEFS : fstate [s [0 ]] = True
10621086 elif key == 'N' :
@@ -1074,6 +1098,8 @@ def get_lines_for_state(cap_out: int, cap_user: int, cap_agent: int, cap_reason:
10741098 a_idx = 0
10751099 reason_cap = 0
10761100 r_idx = 0
1101+ internal_cap = 0
1102+ i_idx = 0
10771103 elif key == 'Q' or key == 'ESC' :
10781104 break
10791105 elif key .isdigit ():
@@ -1086,7 +1112,7 @@ def get_lines_for_state(cap_out: int, cap_user: int, cap_agent: int, cap_reason:
10861112 for s in SECTION_DEFS : fstate [s [0 ]] = s [0 ] in pkeys
10871113 clean_content = pclean
10881114
1089- return fstate , clean_content , output_cap , user_cap , agent_cap , reason_cap
1115+ return fstate , clean_content , output_cap , user_cap , agent_cap , reason_cap , internal_cap
10901116
10911117# ──────────────────────────────────────────────────────────────
10921118# Session List & Main Loop
@@ -1216,7 +1242,7 @@ def process_conversion(indices_str: str, files: List[Path]):
12161242 return
12171243
12181244 # Interactive filter
1219- section_filter , clean_content , output_cap , user_cap , agent_cap , reason_cap = interactive_filter (parsers )
1245+ section_filter , clean_content , output_cap , user_cap , agent_cap , reason_cap , internal_cap = interactive_filter (parsers )
12201246
12211247 # Check anything is selected
12221248 if not any (section_filter .values ()):
@@ -1256,6 +1282,7 @@ def process_conversion(indices_str: str, files: List[Path]):
12561282 user_cap = user_cap ,
12571283 agent_cap = agent_cap ,
12581284 reasoning_cap = reason_cap ,
1285+ internal_cap = internal_cap ,
12591286 )
12601287
12611288 date_prefix = datetime .fromtimestamp (
0 commit comments