Built-in tooling for managing multiple concurrent CLI sessions
- 主要語言
- Shell
- 星號
- 11.2k
- 分支
- 1.9k
- 平均合併
- 14 小時 16 分鐘
- 30 天內合併 PR
- 6
描述
### Describe the feature or problem you'd like to solve
The Copilot CLI is excellent for one focused session at a time, but power users frequently keep **many concurrent sessions** running across multiple repos/branches/tasks (especially with `--yolo --autopilot`). Today the CLI offers no first-class way to see, switch between, or manage that fleet:
- `/resume` lists historical sessions but doesn't surface which ones are *currently running* (a `copilot` process holding `session.db` open), and on busy days recent sessions can scroll off (see #2883).
- There's no built-in way to see at-a-glance what each running session is doing right now (mid-turn vs. waiting for input vs. exited), what its summary is, what repo/branch it's working on, or what PR it's tied to.
- There's no way to jump back to an existing terminal/tab that already has a given session open — users end up either spawning duplicates with `copilot --resume=` (and losing scrollback / live state) or hunting through tabs by hand.
- Permissions, autopilot flags, and refresh/timing are all per-invocation; there's no central place to manage defaults across the fleet.
I prototyped a third-party tool that addresses this for Windows Terminal users — **[copilot-dashboard](https://github.com/JoshLove-msft/copilot-dashboard)** — and it has been useful enough that I think first-party tooling for fleet management would benefit a much wider audience.
### Proposed solution
A built-in CLI command (e.g. `copilot sessions` or `copilot dashboard`) that opens a TUI for browsing and managing all local sessions, with at minimum:
1. **Live process awareness** — for each session, show whether a `copilot` process is currently holding it open (LIVE), and what the agent is doing right now (`working` / `waiting` / `done`), derived from `events.jsonl`.
2. **Sortable, filterable, groupable list** — by recency, repo, branch, summary, agent state; quick filter (`/`); group-by-repo with collapsible groups.
3. **Jump-to-tab** — pressing Enter on a row should focus the existing terminal tab/window already running that session (instead of spawning a duplicate). On Windows this is doable via UI Automation against `WindowsTerminal.exe`; equivalents exist on macOS (iTerm2 AppleScript) and Linux (tmux/wezterm IPC).
4. **Launch / resume** — `n` to start a fresh session in a new tab in the user's preferred terminal; Enter to focus-or-launch a resumed session.
5. **Per-session metadata** — show summary, repo/branch, cwd, turn count, linked PR (with click-to-open), last-updated timestamp.
6. **Persistent preferences** — defaults like `--yolo`, `--autopilot`, refresh interval, terminal-launch strategy, stored in a config file the user can edit.
7. **Auto-refresh** with a visible countdown so the user can trust what they're looking at.
The dashboard could ship as an optional `copilot` subcommand or as a separate small binary that's installed alongside, similar to `gh dash` for the GitHub CLI.
### Example prompts or workflows
1. **Multitasking across repos.** I have 6 sessions running with `--yolo --autopilot` against different repos. I run `copilot sessions`, see at a glance which 2 are mid-turn and which 4 are waiting on me, hit Enter on a waiting one, and the existing tab pops to the foreground — no duplicate session.
2. **"Where did I leave that thing?"** A session from yesterday morning was about a build failure but I don't remember the ID. I open the dashboard, type `/build` to filter by summary, find it in 2 seconds, hit Enter, and it resumes (or focuses if still alive).
3. **Triaging finished autopilot runs.** I left 5 `--autopilot` sessions running overnight. In the morning I open the dashboard, sort by Agent state, see which finished cleanly (`done`), which are blocked (`waiting`), and which crashed (no recent events). I jump straight to the ones that need attention.
4. **Per-repo focus.** I press `g` to group by repo and `→` to collapse the noise from repos I don't care about right now, leaving just the 3 sessions in the repo I'm focused on.
5. **One-keystroke "new yolo session here."** From the dashboard, `n` opens a brand-new `copilot --yolo --autopilot` tab pre-cd'd to the selected row's working directory.
### Additional context
I've been running a working prototype of this on Windows: **https://github.com/JoshLove-msft/copilot-dashboard**
It implements all of the above for Windows Terminal:
- Reads `~/.copilot/session-state//workspace.yaml` and `events.jsonl` for metadata + live agent state.
- Uses `psutil` to detect which `copilot` processes are holding a `session.db` open (LIVE detection).
- Uses UI Automation against `WindowsTerminal.exe` to find and focus the right tab by title (the WT tab title equals the session summary because `copilot` sets it via OSC 0).
- Spawns new tabs via `wt -w 0 new-tab --title "" -d -- pwsh -NoExit -Command "copilot --yolo --autopilot --resume="`.
- For brand-new sessions the tab title initially says `copilot:new` and then auto-renames to the session summary once the workspace summary is computed (a `Start-ThreadJob` polls `session-state/` and emits an OSC title sequence).
- Settings (yolo / autopilot / refresh interval) persist to `~/.copilot-dashboard/config.json`.
Happy to contribute the design or relevant pieces if useful. The cross-platform parts (TUI, session metadata reading, agent-state derivation) are reusable; only the "find/launch the user's terminal tab" piece needs platform-specific backends.
Thanks for considering!
貢獻指南
研究方向
Start by examining the proposed `copilot sessions` or `copilot dashboard` entry point and the existing `/resume` behavior. Read `~/.copilot/session-state//workspace.yaml` and `events.jsonl`, then consider how `session.db` and the prototype's `config.json` represent live sessions and preferences. Done would require an agreed cross-platform design covering listing, state display, launch/resume, and terminal-tab focus.
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- powershell, shell
- 領域
- cli, tooling
- Issue 類型
- 功能
- 難度
- 5/5
- 預估耗時
- 一週以上
- 活躍度
- 冷清
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100