diff --git a/README.md b/README.md index e34f9ed..ba8d8ec 100644 --- a/README.md +++ b/README.md @@ -81,7 +81,7 @@ require('goose').setup({ window = { submit = '', -- Submit prompt close = '', -- Close UI windows - stop = '', -- Stop a running job + stop = '', -- Stop goose while it is running next_message = ']]', -- Navigate to next message in the conversation prev_message = '[[', -- Navigate to previous message in the conversation mention_file = '@', -- Pick a file and add to context. See File Mentions section diff --git a/lua/goose/session.lua b/lua/goose/session.lua index 9cb08fe..482f116 100644 --- a/lua/goose/session.lua +++ b/lua/goose/session.lua @@ -14,6 +14,8 @@ function M.get_all_sessions() return { workspace = session.metadata.working_dir, description = session.metadata.description, + message_count = session.metadata.message_count, + tokens = session.metadata.total_tokens, modified = session.modified, name = session.id, path = session.path @@ -21,7 +23,6 @@ function M.get_all_sessions() end, sessions) end --- Helper function to get all sessions as JSON function M.get_all_workspace_sessions() local sessions = M.get_all_sessions() if not sessions then return nil end diff --git a/lua/goose/ui/output_renderer.lua b/lua/goose/ui/output_renderer.lua index a6f030d..eb973c2 100644 --- a/lua/goose/ui/output_renderer.lua +++ b/lua/goose/ui/output_renderer.lua @@ -261,7 +261,13 @@ end function M.render_session_bar() local function update_winbar(desc) - -- content + --[[ ** TODO: use this right side win bar text with something useful + local winwidth = vim.api.nvim_win_get_width(state.windows.output_win) + local txt = "txt content here" + local padding = string.rep(" ", winwidth - #desc - #txt - 1) + local right_side_txt = padding .. txt + ]] + vim.wo[state.windows.output_win].winbar = " " .. desc -- Add our winbar highlights while preserving existing highlights diff --git a/lua/goose/ui/session_formatter.lua b/lua/goose/ui/session_formatter.lua index ade07a3..b3a657a 100644 --- a/lua/goose/ui/session_formatter.lua +++ b/lua/goose/ui/session_formatter.lua @@ -62,12 +62,13 @@ function M._format_message(message) for _, part in ipairs(message.content) do if part.type == 'text' and part.text and part.text ~= "" then + local text = vim.trim(part.text) has_content = true if message.role == 'user' then - M._format_user_message(lines, part.text) + M._format_user_message(lines, text) elseif message.role == 'assistant' then - for _, line in ipairs(vim.split(part.text, "\n")) do + for _, line in ipairs(vim.split(text, "\n")) do table.insert(lines, line) end end diff --git a/lua/goose/ui/ui.lua b/lua/goose/ui/ui.lua index df32a8b..9fd929e 100644 --- a/lua/goose/ui/ui.lua +++ b/lua/goose/ui/ui.lua @@ -170,12 +170,22 @@ function M.select_session(sessions, cb) vim.ui.select(sessions, { prompt = "", format_item = function(session) - if not session.modified then - return session.description + local parts = {} + + if session.description then + table.insert(parts, session.description) + end + + if session.message_count then + table.insert(parts, session.message_count .. " messages") end local modified = util.time_ago(session.modified) - return session.description .. " ~ " .. modified + if modified then + table.insert(parts, modified) + end + + return table.concat(parts, " ~ ") end }, function(session_choice) cb(session_choice)