@@ -209,10 +209,10 @@ function M._format_revert_message(stats)
209209 end
210210 if # file_diff > 0 then
211211 local line_str = string.format (icons .get (' file' ) .. ' %s: %s' , file , table.concat (file_diff , ' ' ))
212- local line_idx = M .output :add_line (line_str ) --- @type number
213- local col = # (' ' .. file .. ' : ' ) --- @type number
212+ local line_idx = M .output :add_line (line_str )
213+ local col = # (' ' .. file .. ' : ' )
214214 for _ , diff in ipairs (file_diff ) do
215- local hl_group = diff :sub (1 , 1 ) == ' +' and ' OpencodeDiffAddText' or ' OpencodeDiffDeleteText' --- @type string
215+ local hl_group = diff :sub (1 , 1 ) == ' +' and ' OpencodeDiffAddText' or ' OpencodeDiffDeleteText'
216216 M .output :add_extmark (line_idx , {
217217 virt_text = { { diff , hl_group } },
218218 virt_text_pos = ' inline' ,
@@ -310,15 +310,11 @@ function M._format_message_header(message, msg_idx)
310310 M .output :add_empty_line ()
311311 M .output :add_metadata ({ msg_idx = msg_idx , part_idx = 1 , role = role , type = ' header' })
312312
313- -- Use the mode field from the message (stable label from CLI)
314313 local display_name
315314 if role == ' assistant' then
316315 local mode = message .mode
317- -- For the most recent assistant message, show current_mode if mode is missing
318- -- This handles new messages that haven't been stamped yet
319- local is_last_message = msg_idx == # state .messages
320- if is_last_message and state .current_mode and state .current_mode ~= ' ' then
321- display_name = state .current_mode :upper ()
316+ if mode and mode ~= ' ' then
317+ display_name = mode :upper ()
322318 else
323319 display_name = ' ASSISTANT'
324320 end
@@ -376,7 +372,7 @@ function M._format_user_message(text, message)
376372 context = context_module .extract_from_opencode_message (message )
377373 end
378374
379- local start_line = M .output :get_line_count () - 1 --- @type number
375+ local start_line = M .output :get_line_count () - 1
380376
381377 M .output :add_empty_line ()
382378 M .output :add_lines (vim .split (context .prompt , ' \n ' ))
@@ -394,7 +390,7 @@ function M._format_user_message(text, message)
394390 M .output :add_line (string.format (' [%s](%s)' , path , context .current_file ))
395391 end
396392
397- local end_line = M .output :get_line_count () --- @type number
393+ local end_line = M .output :get_line_count ()
398394
399395 M ._add_vertical_border (start_line , end_line , ' OpencodeMessageRoleUser' , - 3 )
400396end
@@ -539,10 +535,6 @@ function M._format_tool(part)
539535 local metadata = (part .state and part .state .metadata ) or {}
540536 local output = (part .state and part .state .output ) or ' '
541537
542- if state .current_permission and state .current_permission .messageID == part .messageID then
543- metadata = state .current_permission .metadata or metadata
544- end
545-
546538 if tool == ' bash' then
547539 M ._format_bash_tool (input --[[ @as BashToolInput]] , metadata --[[ @as BashToolMetadata]] )
548540 elseif tool == ' read' or tool == ' edit' or tool == ' write' then
@@ -573,7 +565,7 @@ function M._format_tool(part)
573565
574566 M .output :add_empty_line ()
575567
576- local end_line = M .output :get_line_count () --- @type number
568+ local end_line = M .output :get_line_count ()
577569 if end_line - start_line > 1 then
578570 M ._add_vertical_border (start_line , end_line - 1 , ' OpencodeToolBorder' , - 1 )
579571 end
@@ -602,7 +594,7 @@ function M._format_task_tool(input, metadata, output)
602594 end
603595 end
604596
605- local end_line = M .output :get_line_count () --- @type number
597+ local end_line = M .output :get_line_count ()
606598 M .output :add_action ({
607599 text = ' [S]elect Child Session' ,
608600 type = ' select_child_session' ,
0 commit comments