@@ -913,8 +913,16 @@ def _probe_config_health(cfg: dict) -> str:
913913
914914
915915def _session_info (agent ) -> dict :
916+ reasoning_config = getattr (agent , "reasoning_config" , None )
917+ reasoning_effort = ""
918+ if isinstance (reasoning_config , dict ) and reasoning_config .get ("enabled" ) is not False :
919+ reasoning_effort = str (reasoning_config .get ("effort" , "" ) or "" )
920+ service_tier = getattr (agent , "service_tier" , None ) or ""
916921 info : dict = {
917922 "model" : getattr (agent , "model" , "" ),
923+ "reasoning_effort" : reasoning_effort ,
924+ "service_tier" : service_tier ,
925+ "fast" : service_tier == "priority" ,
918926 "tools" : {},
919927 "skills" : {},
920928 "cwd" : os .getcwd (),
@@ -1013,7 +1021,7 @@ def _tool_summary(name: str, result: str, duration_s: float | None) -> str | Non
10131021 if n is not None :
10141022 text = f"Extracted { n } { 'page' if n == 1 else 'pages' } "
10151023
1016- return f"{ text or 'Completed' } { suffix } " if ( text or dur ) else None
1024+ return f"{ text } { suffix } " if text else None
10171025
10181026
10191027def _on_tool_start (sid : str , tool_call_id : str , name : str , args : dict ):
@@ -1029,10 +1037,13 @@ def _on_tool_start(sid: str, tool_call_id: str, name: str, args: dict):
10291037 pass
10301038 session .setdefault ("tool_started_at" , {})[tool_call_id ] = time .time ()
10311039 if _tool_progress_enabled (sid ):
1040+ payload = {"tool_id" : tool_call_id , "name" : name , "context" : _tool_ctx (name , args )}
1041+ if name == "todo" and isinstance (args , dict ) and isinstance (args .get ("todos" ), list ):
1042+ payload ["todos" ] = args .get ("todos" )
10321043 _emit (
10331044 "tool.start" ,
10341045 sid ,
1035- { "tool_id" : tool_call_id , "name" : name , "context" : _tool_ctx ( name , args )} ,
1046+ payload ,
10361047 )
10371048
10381049
@@ -1050,6 +1061,13 @@ def _on_tool_complete(sid: str, tool_call_id: str, name: str, args: dict, result
10501061 summary = _tool_summary (name , result , duration_s )
10511062 if summary :
10521063 payload ["summary" ] = summary
1064+ if name == "todo" :
1065+ try :
1066+ data = json .loads (result )
1067+ if isinstance (data , dict ) and isinstance (data .get ("todos" ), list ):
1068+ payload ["todos" ] = data .get ("todos" )
1069+ except Exception :
1070+ pass
10531071 try :
10541072 from agent .display import render_edit_diff_with_delta
10551073
@@ -1698,7 +1716,8 @@ def _(rid, params: dict) -> dict:
16981716 try :
16991717 db .reopen_session (target )
17001718 history = db .get_messages_as_conversation (target )
1701- messages = _history_to_messages (history )
1719+ display_history = db .get_messages_as_conversation (target , include_ancestors = True )
1720+ messages = _history_to_messages (display_history )
17021721 tokens = _set_session_context (target )
17031722 try :
17041723 agent = _make_agent (sid , target , session_id = target )
@@ -1746,11 +1765,20 @@ def _(rid, params: dict) -> dict:
17461765@method ("session.history" )
17471766def _ (rid , params : dict ) -> dict :
17481767 session , err = _sess (params , rid )
1749- return err or _ok (
1768+ if err :
1769+ return err
1770+ history = list (session .get ("history" , []))
1771+ db = _get_db ()
1772+ if db is not None and session .get ("session_key" ):
1773+ try :
1774+ history = db .get_messages_as_conversation (session ["session_key" ], include_ancestors = True )
1775+ except Exception :
1776+ pass
1777+ return _ok (
17501778 rid ,
17511779 {
17521780 "count" : len (session .get ("history" , [])),
1753- "messages" : _history_to_messages (list ( session . get ( " history" , [])) ),
1781+ "messages" : _history_to_messages (history ),
17541782 },
17551783 )
17561784
0 commit comments