Rename ResumeSessionPicker to StandaloneSessionPicker and add documentation

This commit is contained in:
Alexander Farber
2025-12-13 13:33:44 +01:00
parent 56a62bcb2a
commit 4504c7a0ac
6 changed files with 87 additions and 3 deletions

View File

@@ -93,6 +93,16 @@ Slash commands provide meta-level control over the CLI itself.
- **Usage:** `/restore [tool_call_id]` - **Usage:** `/restore [tool_call_id]`
- **Note:** Only available if the CLI is invoked with the `--checkpointing` option or configured via [settings](./configuration.md). See [Checkpointing documentation](../checkpointing.md) for more details. - **Note:** Only available if the CLI is invoked with the `--checkpointing` option or configured via [settings](./configuration.md). See [Checkpointing documentation](../checkpointing.md) for more details.
- **`/resume`**
- **Description:** Resume a previous conversation session. Opens a session picker dialog to browse and select from saved sessions.
- **Usage:** `/resume`
- **Features:**
- Browse all saved sessions for the current project
- Filter sessions by git branch with the **B** key
- Sessions show first prompt, message count, and timestamp
- Navigate with arrow keys or **j/k**, select with **Enter**
- **Note:** For command-line session resumption, see `--resume` and `--continue` flags. For more details, see [Session Resume](../features/session-resume.md).
- **`/settings`** - **`/settings`**
- **Description:** Open the settings editor to view and modify Qwen Code settings. - **Description:** Open the settings editor to view and modify Qwen Code settings.
- **Details:** This command provides a user-friendly interface for changing settings that control the behavior and appearance of Qwen Code. It is equivalent to manually editing the `.qwen/settings.json` file, but with validation and guidance to prevent errors. - **Details:** This command provides a user-friendly interface for changing settings that control the behavior and appearance of Qwen Code. It is equivalent to manually editing the `.qwen/settings.json` file, but with validation and guidance to prevent errors.

View File

@@ -0,0 +1,74 @@
# Session Resume
Qwen Code automatically saves your conversation history, allowing you to resume previous sessions at any time.
## Overview
Sessions are saved automatically as you work. You can resume them either from the command line when starting Qwen Code, or from within an active session using the `/resume` command.
## How Sessions Are Stored
Sessions are stored as JSONL files (one JSON record per line) at:
```
~/.qwen/tmp/<project_hash>/chats/<sessionId>.jsonl
```
Each session captures:
- User messages and assistant responses
- Tool calls and their results
- Metadata: timestamps, git branch, working directory, model used
## Resuming Sessions
### From the Command Line
**Resume most recent session:**
```bash
qwen --continue
```
**Show session picker:**
```bash
qwen --resume
```
**Resume specific session by ID:**
```bash
qwen --resume <sessionId>
```
### From Within the App
Use the `/resume` slash command to open a session picker dialog:
```
/resume
```
### Session Picker Controls
- **Arrow keys** or **j/k**: Navigate between sessions
- **Enter**: Select and resume the highlighted session
- **B**: Toggle branch filter (show only sessions from current git branch)
- **Escape**: Cancel and return to current session
## Session List Display
Each session shows:
- First prompt text (truncated if long)
- Number of messages
- Last modified timestamp
- Git branch name (if available)
Sessions are sorted by last modified time, with most recent first.
## Related Features
- [Welcome Back](./welcome-back.md) - Automatic session context restoration
- [/summary command](../cli/commands.md) - Generate project summaries for future reference

View File

@@ -58,7 +58,7 @@ import { getUserStartupWarnings } from './utils/userStartupWarnings.js';
import { getCliVersion } from './utils/version.js'; import { getCliVersion } from './utils/version.js';
import { computeWindowTitle } from './utils/windowTitle.js'; import { computeWindowTitle } from './utils/windowTitle.js';
import { validateNonInteractiveAuth } from './validateNonInterActiveAuth.js'; import { validateNonInteractiveAuth } from './validateNonInterActiveAuth.js';
import { showResumeSessionPicker } from './ui/components/ResumeSessionPicker.js'; import { showResumeSessionPicker } from './ui/components/StandaloneSessionPicker.js';
export function validateDnsResolutionOrder( export function validateDnsResolutionOrder(
order: string | undefined, order: string | undefined,

View File

@@ -6,7 +6,7 @@
import { render } from 'ink-testing-library'; import { render } from 'ink-testing-library';
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'; import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
import { SessionPicker } from './ResumeSessionPicker.js'; import { SessionPicker } from './StandaloneSessionPicker.js';
import type { import type {
SessionListItem, SessionListItem,
ListSessionsResult, ListSessionsResult,

View File

@@ -8,7 +8,7 @@ import { useState, useEffect } from 'react';
import { render, Box, Text, useApp } from 'ink'; import { render, Box, Text, useApp } from 'ink';
import { SessionService, getGitBranch } from '@qwen-code/qwen-code-core'; import { SessionService, getGitBranch } from '@qwen-code/qwen-code-core';
import { theme } from '../semantic-colors.js'; import { theme } from '../semantic-colors.js';
import { useSessionPicker } from '../hooks/useSessionPicker.js'; import { useSessionPicker } from '../hooks/useStandaloneSessionPicker.js';
import { SessionListItemView } from './SessionListItem.js'; import { SessionListItemView } from './SessionListItem.js';
// Exported for testing // Exported for testing