Skip to content

Feature: Tool window toolbar with session history #9

@bommerts

Description

@bommerts

Summary

Add a toolbar to the Copilot CLI embedded terminal tool window with buttons for viewing session history, starting a new session, and (eventually) deleting sessions. This mirrors the toolbar that VS's native Copilot Chat window already has.

Motivation

VS's native Copilot Chat has three toolbar buttons in the upper-right corner:

  1. Circular arrow -- "View chat history"
  2. Speech bubble with green + overlay -- "Create new thread"
  3. Hamburger lines with red X overlay -- "Delete thread"

The Copilot CLI tool window currently has no toolbar at all. Adding one would let users resume previous CLI sessions without having to manually run copilot --resume, and it brings the UX closer to what VS users already expect from the native Copilot Chat.

How it could work

Copilot CLI stores all sessions in ~/.copilot/session-store.db (SQLite). Each session has a cwd (working directory) and repository field, so we can filter sessions to only show ones relevant to the current VS project.

View session history (button 1)

  • Read session-store.db in read-only mode
  • Filter sessions by the current workspace path
  • Show a VS-themed picker dialog listing sessions with summary and date
  • Resume the selected session with copilot --resume=<session-id>
  • If no sessions exist for the workspace, show "No previous sessions for this project"

New session (button 2)

  • Restart the terminal with a fresh copilot (no --resume flag)
  • Same as current restart behavior, just exposed as a toolbar button

Delete session (button 3, future)

  • Could be added later. Deleting from Copilot CLI's session store needs investigation.

Implementation notes

  • Toolbar defined in .vsct with KnownMonikers icons (theme-aware, no custom bitmaps)
  • KnownMonikers.History for the circular arrow icon
  • Toolbar associated with TerminalToolWindow via the ToolBar property
  • Session picker uses Microsoft.VisualStudio.PlatformUI.DialogWindow for VS-native look
  • Microsoft.Data.Sqlite NuGet package for lightweight read-only DB access
  • Gracefully handles missing DB, locked DB, and empty results

Questions

  • Is adding Microsoft.Data.Sqlite as a dependency acceptable?
  • Any preference on the session picker dialog style?

Volunteering to implement

I would like to implement this and open a PR. Builds on the embedded terminal from PR #7 and the native terminal refactor in PR #8.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions