Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion lua/opencode/ui/formatter.lua
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,12 @@ function M.format_message_header(message, previous_message)

local time = message.info.time and message.info.time.created or nil
local role_hl = 'OpencodeMessageRole' .. role:sub(1, 1):upper() .. role:sub(2)
local model_text = message.info.modelID and ' ' .. message.info.modelID or ''
local model_text = message.info.providerID
and message.info.modelID
and (message.info.providerID .. '/' .. message.info.modelID)
or message.info.providerID
or message.info.modelID
or ''

local debug_text = config.debug.show_ids and ' [' .. message.info.id .. ']' or ''

Expand Down Expand Up @@ -299,6 +304,7 @@ function M.format_message_header(message, previous_message)
{ icon, role_hl },
{ ' ' },
{ display_name, role_hl },
{ ' ' },
{ model_text, 'OpencodeHint' },
{ debug_text, 'OpencodeHint' },
},
Expand Down
6 changes: 5 additions & 1 deletion tests/data/ansi-codes.expected.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@
"OpencodeMessageRoleAssistant"
],
[
" claude-sonnet-4.5",
" "
],
[
"github-copilot/claude-sonnet-4.5",
"OpencodeHint"
],
[
Expand Down Expand Up @@ -8574,6 +8577,7 @@
409,
0
],
"effective_bottom": 409,
"line_count": 410,
"visible_bottom": 410
}
Expand Down
227 changes: 226 additions & 1 deletion tests/data/api-abort.expected.json
Original file line number Diff line number Diff line change
@@ -1 +1,226 @@
{"lines":["----","","","can generate 10 numbers?","","[`a-empty.txt`](a-empty.txt)","","----","","","You asked if I can generate 10 numbers, and you referenced reading an empty file ( `a-empty.txt`). However, I'm currently in \"plan mode,\" which means I cannot write or modify any files—I'm only allowed to read, observe,","","> [!ERROR] The operation was aborted.","",""],"timestamp":1773947710,"window":{"cursor":[14,0],"line_count":15,"visible_bottom":15},"extmarks":[[1,1,0,{"virt_text_win_col":-3,"virt_text_pos":"win_col","virt_text":[["▌󰭻 ","OpencodeMessageRoleUser"],[" "],["USER","OpencodeMessageRoleUser"],["","OpencodeHint"],[" [msg_a27d8299d001nchmBunYlZcPyL]","OpencodeHint"]],"ns_id":3,"virt_text_hide":false,"priority":10,"virt_text_repeat_linebreak":false,"right_gravity":true}],[2,1,0,{"virt_text_pos":"right_align","virt_text":[[" 2025-10-27 22:44:29","OpencodeHint"]],"ns_id":3,"virt_text_hide":false,"priority":9,"virt_text_repeat_linebreak":false,"right_gravity":true}],[3,2,0,{"virt_text_win_col":-3,"virt_text_pos":"win_col","virt_text":[["▌","OpencodeMessageRoleUser"]],"ns_id":3,"virt_text_hide":false,"priority":4096,"virt_text_repeat_linebreak":true,"right_gravity":true}],[4,3,0,{"virt_text_win_col":-3,"virt_text_pos":"win_col","virt_text":[["▌","OpencodeMessageRoleUser"]],"ns_id":3,"virt_text_hide":false,"priority":4096,"virt_text_repeat_linebreak":true,"right_gravity":true}],[5,4,0,{"virt_text_win_col":-3,"virt_text_pos":"win_col","virt_text":[["▌","OpencodeMessageRoleUser"]],"ns_id":3,"virt_text_hide":false,"priority":4096,"virt_text_repeat_linebreak":true,"right_gravity":true}],[6,5,0,{"virt_text_win_col":-3,"virt_text_pos":"win_col","virt_text":[["▌","OpencodeMessageRoleUser"]],"ns_id":3,"virt_text_hide":false,"priority":4096,"virt_text_repeat_linebreak":true,"right_gravity":true}],[7,8,0,{"virt_text_win_col":-3,"virt_text_pos":"win_col","virt_text":[[" ","OpencodeMessageRoleAssistant"],[" "],["PLAN","OpencodeMessageRoleAssistant"],[" gpt-4.1","OpencodeHint"],[" [msg_a27d829f9002sfUFPslHq5P2b4]","OpencodeHint"]],"ns_id":3,"virt_text_hide":false,"priority":10,"virt_text_repeat_linebreak":false,"right_gravity":true}],[8,8,0,{"virt_text_pos":"right_align","virt_text":[[" 2025-10-27 22:44:29","OpencodeHint"]],"ns_id":3,"virt_text_hide":false,"priority":9,"virt_text_repeat_linebreak":false,"right_gravity":true}]],"actions":[]}
{
"actions": [],
"extmarks": [
[
1,
1,
0,
{
"ns_id": 3,
"priority": 10,
"right_gravity": true,
"virt_text": [
[
"▌󰭻 ",
"OpencodeMessageRoleUser"
],
[
" "
],
[
"USER",
"OpencodeMessageRoleUser"
],
[
" "
],
[
"",
"OpencodeHint"
],
[
" [msg_a27d8299d001nchmBunYlZcPyL]",
"OpencodeHint"
]
],
"virt_text_hide": false,
"virt_text_pos": "win_col",
"virt_text_repeat_linebreak": false,
"virt_text_win_col": -3
}
],
[
2,
1,
0,
{
"ns_id": 3,
"priority": 9,
"right_gravity": true,
"virt_text": [
[
" 2025-10-27 22:44:29",
"OpencodeHint"
]
],
"virt_text_hide": false,
"virt_text_pos": "right_align",
"virt_text_repeat_linebreak": false
}
],
[
3,
2,
0,
{
"ns_id": 3,
"priority": 4096,
"right_gravity": true,
"virt_text": [
[
"▌",
"OpencodeMessageRoleUser"
]
],
"virt_text_hide": false,
"virt_text_pos": "win_col",
"virt_text_repeat_linebreak": true,
"virt_text_win_col": -3
}
],
[
4,
3,
0,
{
"ns_id": 3,
"priority": 4096,
"right_gravity": true,
"virt_text": [
[
"▌",
"OpencodeMessageRoleUser"
]
],
"virt_text_hide": false,
"virt_text_pos": "win_col",
"virt_text_repeat_linebreak": true,
"virt_text_win_col": -3
}
],
[
5,
4,
0,
{
"ns_id": 3,
"priority": 4096,
"right_gravity": true,
"virt_text": [
[
"▌",
"OpencodeMessageRoleUser"
]
],
"virt_text_hide": false,
"virt_text_pos": "win_col",
"virt_text_repeat_linebreak": true,
"virt_text_win_col": -3
}
],
[
6,
5,
0,
{
"ns_id": 3,
"priority": 4096,
"right_gravity": true,
"virt_text": [
[
"▌",
"OpencodeMessageRoleUser"
]
],
"virt_text_hide": false,
"virt_text_pos": "win_col",
"virt_text_repeat_linebreak": true,
"virt_text_win_col": -3
}
],
[
7,
8,
0,
{
"ns_id": 3,
"priority": 10,
"right_gravity": true,
"virt_text": [
[
" ",
"OpencodeMessageRoleAssistant"
],
[
" "
],
[
"PLAN",
"OpencodeMessageRoleAssistant"
],
[
" "
],
[
"github-copilot/gpt-4.1",
"OpencodeHint"
],
[
" [msg_a27d829f9002sfUFPslHq5P2b4]",
"OpencodeHint"
]
],
"virt_text_hide": false,
"virt_text_pos": "win_col",
"virt_text_repeat_linebreak": false,
"virt_text_win_col": -3
}
],
[
8,
8,
0,
{
"ns_id": 3,
"priority": 9,
"right_gravity": true,
"virt_text": [
[
" 2025-10-27 22:44:29",
"OpencodeHint"
]
],
"virt_text_hide": false,
"virt_text_pos": "right_align",
"virt_text_repeat_linebreak": false
}
]
],
"lines": [
"----",
"",
"",
"can generate 10 numbers?",
"",
"[`a-empty.txt`](a-empty.txt)",
"",
"----",
"",
"",
"You asked if I can generate 10 numbers, and you referenced reading an empty file ( `a-empty.txt`). However, I'm currently in \"plan mode,\" which means I cannot write or modify any files—I'm only allowed to read, observe,",
"",
"> [!ERROR] The operation was aborted.",
"",
""
],
"timestamp": 1773947710,
"window": {
"cursor": [
14,
0
],
"effective_bottom": 14,
"line_count": 15,
"visible_bottom": 15
}
}
14 changes: 12 additions & 2 deletions tests/data/api-error.expected.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
"USER",
"OpencodeMessageRoleUser"
],
[
" "
],
[
"",
"OpencodeHint"
Expand Down Expand Up @@ -156,7 +159,10 @@
"OpencodeMessageRoleAssistant"
],
[
" claude-sonnet-4-5-20250929",
" "
],
[
"anthropic/claude-sonnet-4-5-20250929",
"OpencodeHint"
],
[
Expand Down Expand Up @@ -210,7 +216,10 @@
"OpencodeMessageRoleAssistant"
],
[
" claude-sonnet-4-5-20250929",
" "
],
[
"anthropic/claude-sonnet-4-5-20250929",
"OpencodeHint"
],
[
Expand Down Expand Up @@ -272,6 +281,7 @@
19,
0
],
"effective_bottom": 19,
"line_count": 20,
"visible_bottom": 20
}
Expand Down
7 changes: 7 additions & 0 deletions tests/data/apply-patch.expected.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
"USER",
"OpencodeMessageRoleUser"
],
[
" "
],
[
"",
"OpencodeHint"
Expand Down Expand Up @@ -56,6 +59,9 @@
"BUILD",
"OpencodeMessageRoleAssistant"
],
[
" "
],
[
"",
"OpencodeHint"
Expand Down Expand Up @@ -299,6 +305,7 @@
14,
0
],
"effective_bottom": 14,
"line_count": 15,
"visible_bottom": 15
}
Expand Down
9 changes: 8 additions & 1 deletion tests/data/compaction-after-messages.expected.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@
"USER",
"OpencodeMessageRoleUser"
],
[
" "
],
[
"",
"OpencodeHint"
Expand Down Expand Up @@ -127,7 +130,10 @@
"OpencodeMessageRoleAssistant"
],
[
" gpt-5.5",
" "
],
[
"openai/gpt-5.5",
"OpencodeHint"
],
[
Expand Down Expand Up @@ -184,6 +190,7 @@
14,
0
],
"effective_bottom": 14,
"line_count": 15,
"visible_bottom": 15
}
Expand Down
1 change: 1 addition & 0 deletions tests/data/compaction-summary-text.expected.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
5,
0
],
"effective_bottom": 5,
"line_count": 6,
"visible_bottom": 6
}
Expand Down
1 change: 1 addition & 0 deletions tests/data/compaction-user-marker.expected.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
2,
0
],
"effective_bottom": 2,
"line_count": 3,
"visible_bottom": 3
}
Expand Down
Loading
Loading