@@ -680,6 +680,26 @@ function M.undo(messageId)
680680 end )
681681end
682682
683+ function M .timeline ()
684+ local user_messages = {}
685+ for _ , msg in ipairs (state .messages or {}) do
686+ if msg .info .role == ' user' then
687+ table.insert (user_messages , msg )
688+ end
689+ end
690+ if # user_messages == 0 then
691+ vim .notify (' No user messages in the current session' , vim .log .levels .WARN )
692+ return
693+ end
694+
695+ local timeline_picker = require (' opencode.ui.timeline_picker' )
696+ timeline_picker .pick (user_messages , function (selected_msg )
697+ if selected_msg then
698+ require (' opencode.ui.navigation' ).goto_message_by_id (selected_msg .info .id )
699+ end
700+ end )
701+ end
702+
683703-- Returns the ID of the next user message after the current undo point
684704-- This is a port of the opencode tui logic
685705-- https://github.com/sst/opencode/blob/dev/packages/tui/internal/components/chat/messages.go#L1199
@@ -1074,6 +1094,11 @@ M.commands = {
10741094 end
10751095 end ,
10761096 },
1097+
1098+ timeline = {
1099+ desc = ' Open timeline picker to navigate/undo/redo/fork to message' ,
1100+ fn = M .timeline ,
1101+ },
10771102}
10781103
10791104M .slash_commands_map = {
@@ -1089,6 +1114,7 @@ M.slash_commands_map = {
10891114 [' /redo' ] = { fn = M .redo , desc = ' Redo last action' },
10901115 [' /sessions' ] = { fn = M .select_session , desc = ' Select session' },
10911116 [' /share' ] = { fn = M .share , desc = ' Share current session' },
1117+ [' /timeline' ] = { fn = M .timeline , desc = ' Open timeline picker' },
10921118 [' /undo' ] = { fn = M .undo , desc = ' Undo last action' },
10931119 [' /unshare' ] = { fn = M .unshare , desc = ' Unshare current session' },
10941120}
0 commit comments