@@ -1123,7 +1123,8 @@ Set NEW-SESSION to start a separate new session."
11231123                                                :on-frame-update 
11241124                                                (lambda  (frame  status )
11251125                                                  (when  (get-buffer-window  shell-buffer)
1126-                                                     (agent-shell--update-header-and-mode-line))
1126+                                                     (with-current-buffer  shell-buffer
1127+                                                       (agent-shell--update-header-and-mode-line)))
11271128                                                  (cond 
11281129                                                   ((eq  status 'started )
11291130                                                    0 )
@@ -1329,18 +1330,9 @@ STATE should contain :agent-config with :icon-name, :buffer-name, and
13291330:session with :mode-id and :modes for displaying the current session mode."  
13301331  (unless  state
13311332    (error  " STATE is required " ))
1332-   (let*  ((text-header (format  "  %s%s   @ %s  " 
1333+   (let*  ((text-header (format  "  %s  @ %s  " 
13331334                              (propertize  (concat  (map-nested-elt  state '(:agent-config  :buffer-name )) "  Agent" 
13341335                                          'font-lock-face  'font-lock-variable-name-face )
1335-                               (if-let  ((mode-id (map-nested-elt  state '(:session  :mode-id ))))
1336-                                   (concat 
1337-                                    "  " 
1338-                                    (propertize  (format  " [%s ] " 
1339-                                                        (agent-shell--resolve-session-mode-name
1340-                                                         mode-id
1341-                                                         (map-nested-elt  state '(:session  :modes ))))
1342-                                                'font-lock-face  'font-lock-type-face ))
1343-                                 " " 
13441336                              (propertize  (string-remove-suffix  " /" abbreviate-file-name  default-directory))
13451337                                          'font-lock-face  'font-lock-string-face ))))
13461338    (pcase  agent-shell-header-style
@@ -1413,11 +1405,15 @@ STATE should contain :agent-config with :icon-name, :buffer-name, and
14131405      (_ text-header))))
14141406
14151407(defun  agent-shell--update-header-and-mode-line  ()
1416-   " Update header and mode line." 
1408+   " Update header and mode line based on  `agent-shell-header-style' ." 
14171409  (unless  (derived-mode-p  'agent-shell-mode )
14181410    (error  " Not in a shell " ))
1419-   (setq  header-line-format (agent-shell--make-header (agent-shell--state)))
1420-   (force-mode-line-update ))
1411+   (cond 
1412+    ((eq  agent-shell-header-style 'graphical )
1413+     (setq  header-line-format (agent-shell--make-header (agent-shell--state))))
1414+    ((memq  agent-shell-header-style '(text none nil ))
1415+     (setq  header-line-format (agent-shell--make-header (agent-shell--state)))
1416+     (force-mode-line-update ))))
14211417
14221418(defun  agent-shell--fetch-agent-icon  (icon-name )
14231419  " Download icon with ICON-NAME from GitHub, only if it exists, and save as binary.
@@ -2439,7 +2435,8 @@ See https://agentclientprotocol.com/protocol/session-modes for details."
24392435Typically includes the session mode and activity or nil if unavailable. 
24402436
24412437For example: \"  [Accept Edits] ░░░ \" ."  
2442-   (when-let*  (((derived-mode-p  'agent-shell-mode )))
2438+   (when-let*  (((derived-mode-p  'agent-shell-mode ))
2439+               ((memq  agent-shell-header-style '(text none nil ))))
24432440    (concat  (when-let  ((mode-name  (agent-shell--resolve-session-mode-name
24442441                                   (map-nested-elt  (agent-shell--state) '(:session  :mode-id ))
24452442                                   (map-nested-elt  (agent-shell--state) '(:session  :modes )))))
0 commit comments