diff --git a/.github/workflows/release-sdk.yml b/.github/workflows/release-sdk.yml
index ccdc24b77..c7e2e3619 100644
--- a/.github/workflows/release-sdk.yml
+++ b/.github/workflows/release-sdk.yml
@@ -348,15 +348,32 @@ jobs:
CLI_SOURCE_DESC="CLI built from source (same branch/ref as SDK)"
fi
- # Create release notes with CLI version info
- NOTES="## Bundled CLI Version\n\nThis SDK release bundles CLI version: \`${CLI_VERSION}\`\n\nSource: ${CLI_SOURCE_DESC}\n\n---\n\n"
+ # Create release notes file
+ NOTES_FILE=$(mktemp)
+ {
+ echo "## Bundled CLI Version"
+ echo ""
+ echo "This SDK release bundles CLI version: ${CLI_VERSION}"
+ echo ""
+ echo "Source: ${CLI_SOURCE_DESC}"
+ echo ""
+ echo "---"
+ echo ""
+ } > "${NOTES_FILE}"
+ # Get previous release notes if available
+ PREVIOUS_NOTES=$(gh release view "sdk-typescript-${PREVIOUS_RELEASE_TAG}" --json body -q '.body' 2>/dev/null || echo 'See commit history for changes.')
+ printf '%s\n' "${PREVIOUS_NOTES}" >> "${NOTES_FILE}"
+
+ # Create GitHub release
gh release create "sdk-typescript-${RELEASE_TAG}" \
--target "${TARGET}" \
--title "SDK TypeScript Release ${RELEASE_TAG}" \
- --notes-start-tag "sdk-typescript-${PREVIOUS_RELEASE_TAG}" \
- --notes "${NOTES}$(gh release view "sdk-typescript-${PREVIOUS_RELEASE_TAG}" --json body -q '.body' 2>/dev/null || echo 'See commit history for changes.')" \
- "${PRERELEASE_FLAG}"
+ --notes-file "${NOTES_FILE}" \
+ ${PRERELEASE_FLAG}
+
+ # Cleanup
+ rm -f "${NOTES_FILE}"
- name: 'Create PR to merge release branch into main'
if: |-
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index ffcda3dc0..617cf9553 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -206,13 +206,22 @@ jobs:
RELEASE_BRANCH: '${{ steps.release_branch.outputs.BRANCH_NAME }}'
RELEASE_TAG: '${{ steps.version.outputs.RELEASE_TAG }}'
PREVIOUS_RELEASE_TAG: '${{ steps.version.outputs.PREVIOUS_RELEASE_TAG }}'
+ IS_NIGHTLY: '${{ steps.vars.outputs.is_nightly }}'
+ IS_PREVIEW: '${{ steps.vars.outputs.is_preview }}'
run: |-
+ # Set prerelease flag for nightly and preview releases
+ PRERELEASE_FLAG=""
+ if [[ "${IS_NIGHTLY}" == "true" || "${IS_PREVIEW}" == "true" ]]; then
+ PRERELEASE_FLAG="--prerelease"
+ fi
+
gh release create "${RELEASE_TAG}" \
dist/cli.js \
--target "$RELEASE_BRANCH" \
--title "Release ${RELEASE_TAG}" \
--notes-start-tag "$PREVIOUS_RELEASE_TAG" \
- --generate-notes
+ --generate-notes \
+ ${PRERELEASE_FLAG}
- name: 'Create Issue on Failure'
if: |-
diff --git a/.gitignore b/.gitignore
index 0e7dc1528..cd7c11a11 100644
--- a/.gitignore
+++ b/.gitignore
@@ -52,6 +52,9 @@ packages/vscode-ide-companion/*.vsix
# Qwen Code Configs
+.qwen/
+!.qwen/commands/
+!.qwen/skills/
logs/
# GHA credentials
gha-creds-*.json
diff --git a/README.md b/README.md
index 4c9d28179..ab598666c 100644
--- a/README.md
+++ b/README.md
@@ -18,6 +18,8 @@
+> 🎉 **News (2026-02-16)**: Qwen3.5-Plus is now live! Sign in via Qwen OAuth to use it directly, or get an API key from [Alibaba Cloud ModelStudio](https://modelstudio.console.alibabacloud.com?tab=doc#/doc/?type=model&url=2840914_2&modelId=group-qwen3.5-plus) to access it through the OpenAI-compatible API.
+
Qwen Code is an open-source AI agent for the terminal, optimized for [Qwen3-Coder](https://github.com/QwenLM/Qwen3-Coder). It helps you understand large codebases, automate tedious work, and ship faster.

@@ -123,7 +125,231 @@ Use this if you want more flexibility over which provider and model to use. Supp
- **Anthropic**: Claude models
- **Google GenAI**: Gemini models
-For full details (including `modelProviders` configuration, `.env` file loading, environment variable priorities, and security notes), see the [authentication guide](https://qwenlm.github.io/qwen-code-docs/en/users/configuration/auth/).
+The **recommended** way to configure models and providers is by editing `~/.qwen/settings.json` (create it if it doesn't exist). This file lets you define all available models, API keys, and default settings in one place.
+
+##### Quick Setup in 3 Steps
+
+**Step 1:** Create or edit `~/.qwen/settings.json`
+
+Here is a complete example:
+
+```json
+{
+ "modelProviders": {
+ "openai": [
+ {
+ "id": "qwen3-coder-plus",
+ "name": "qwen3-coder-plus",
+ "baseUrl": "https://dashscope.aliyuncs.com/compatible-mode/v1",
+ "description": "Qwen3-Coder via Dashscope",
+ "envKey": "DASHSCOPE_API_KEY"
+ }
+ ]
+ },
+ "env": {
+ "DASHSCOPE_API_KEY": "sk-xxxxxxxxxxxxx"
+ },
+ "security": {
+ "auth": {
+ "selectedType": "openai"
+ }
+ },
+ "model": {
+ "name": "qwen3-coder-plus"
+ }
+}
+```
+
+**Step 2:** Understand each field
+
+| Field | What it does |
+| ---------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- |
+| `modelProviders` | Declares which models are available and how to connect to them. Keys like `openai`, `anthropic`, `gemini` represent the API protocol. |
+| `modelProviders[].id` | The model ID sent to the API (e.g. `qwen3-coder-plus`, `gpt-4o`). |
+| `modelProviders[].envKey` | The name of the environment variable that holds your API key. |
+| `modelProviders[].baseUrl` | The API endpoint URL (required for non-default endpoints). |
+| `env` | A fallback place to store API keys (lowest priority; prefer `.env` files or `export` for sensitive keys). |
+| `security.auth.selectedType` | The protocol to use on startup (`openai`, `anthropic`, `gemini`, `vertex-ai`). |
+| `model.name` | The default model to use when Qwen Code starts. |
+
+**Step 3:** Start Qwen Code — your configuration takes effect automatically:
+
+```bash
+qwen
+```
+
+Use the `/model` command at any time to switch between all configured models.
+
+##### More Examples
+
+
+Coding Plan (Alibaba Cloud Bailian) — fixed monthly fee, higher quotas
+
+```json
+{
+ "modelProviders": {
+ "openai": [
+ {
+ "id": "qwen3.5-plus",
+ "name": "qwen3.5-plus (Coding Plan)",
+ "baseUrl": "https://coding.dashscope.aliyuncs.com/v1",
+ "description": "qwen3.5-plus with thinking enabled from Bailian Coding Plan",
+ "envKey": "BAILIAN_CODING_PLAN_API_KEY",
+ "generationConfig": {
+ "extra_body": {
+ "enable_thinking": true
+ }
+ }
+ },
+ {
+ "id": "qwen3-coder-plus",
+ "name": "qwen3-coder-plus (Coding Plan)",
+ "baseUrl": "https://coding.dashscope.aliyuncs.com/v1",
+ "description": "qwen3-coder-plus from Bailian Coding Plan",
+ "envKey": "BAILIAN_CODING_PLAN_API_KEY"
+ },
+ {
+ "id": "qwen3-coder-next",
+ "name": "qwen3-coder-next (Coding Plan)",
+ "baseUrl": "https://coding.dashscope.aliyuncs.com/v1",
+ "description": "qwen3-coder-next with thinking enabled from Bailian Coding Plan",
+ "envKey": "BAILIAN_CODING_PLAN_API_KEY",
+ "generationConfig": {
+ "extra_body": {
+ "enable_thinking": true
+ }
+ }
+ },
+ {
+ "id": "glm-4.7",
+ "name": "glm-4.7 (Coding Plan)",
+ "baseUrl": "https://coding.dashscope.aliyuncs.com/v1",
+ "description": "glm-4.7 with thinking enabled from Bailian Coding Plan",
+ "envKey": "BAILIAN_CODING_PLAN_API_KEY",
+ "generationConfig": {
+ "extra_body": {
+ "enable_thinking": true
+ }
+ }
+ },
+ {
+ "id": "kimi-k2.5",
+ "name": "kimi-k2.5 (Coding Plan)",
+ "baseUrl": "https://coding.dashscope.aliyuncs.com/v1",
+ "description": "kimi-k2.5 with thinking enabled from Bailian Coding Plan",
+ "envKey": "BAILIAN_CODING_PLAN_API_KEY",
+ "generationConfig": {
+ "extra_body": {
+ "enable_thinking": true
+ }
+ }
+ }
+ ]
+ },
+ "env": {
+ "BAILIAN_CODING_PLAN_API_KEY": "sk-xxxxxxxxxxxxx"
+ },
+ "security": {
+ "auth": {
+ "selectedType": "openai"
+ }
+ },
+ "model": {
+ "name": "qwen3-coder-plus"
+ }
+}
+```
+
+> Subscribe to the Coding Plan and get your API key at [Alibaba Cloud Bailian](https://modelstudio.console.aliyun.com/?tab=dashboard#/efm/coding_plan).
+
+
+
+
+Multiple providers (OpenAI + Anthropic + Gemini)
+
+```json
+{
+ "modelProviders": {
+ "openai": [
+ {
+ "id": "gpt-4o",
+ "name": "GPT-4o",
+ "envKey": "OPENAI_API_KEY",
+ "baseUrl": "https://api.openai.com/v1"
+ }
+ ],
+ "anthropic": [
+ {
+ "id": "claude-sonnet-4-20250514",
+ "name": "Claude Sonnet 4",
+ "envKey": "ANTHROPIC_API_KEY"
+ }
+ ],
+ "gemini": [
+ {
+ "id": "gemini-2.5-pro",
+ "name": "Gemini 2.5 Pro",
+ "envKey": "GEMINI_API_KEY"
+ }
+ ]
+ },
+ "env": {
+ "OPENAI_API_KEY": "sk-xxxxxxxxxxxxx",
+ "ANTHROPIC_API_KEY": "sk-ant-xxxxxxxxxxxxx",
+ "GEMINI_API_KEY": "AIzaxxxxxxxxxxxxx"
+ },
+ "security": {
+ "auth": {
+ "selectedType": "openai"
+ }
+ },
+ "model": {
+ "name": "gpt-4o"
+ }
+}
+```
+
+
+
+
+Enable thinking mode (for supported models like qwen3.5-plus)
+
+```json
+{
+ "modelProviders": {
+ "openai": [
+ {
+ "id": "qwen3.5-plus",
+ "name": "qwen3.5-plus (thinking)",
+ "envKey": "DASHSCOPE_API_KEY",
+ "baseUrl": "https://dashscope.aliyuncs.com/compatible-mode/v1",
+ "generationConfig": {
+ "extra_body": {
+ "enable_thinking": true
+ }
+ }
+ }
+ ]
+ },
+ "env": {
+ "DASHSCOPE_API_KEY": "sk-xxxxxxxxxxxxx"
+ },
+ "security": {
+ "auth": {
+ "selectedType": "openai"
+ }
+ },
+ "model": {
+ "name": "qwen3.5-plus"
+ }
+}
+```
+
+
+
+> **Tip:** You can also set API keys via `export` in your shell or `.env` files, which take higher priority than `settings.json` → `env`. See the [authentication guide](https://qwenlm.github.io/qwen-code-docs/en/users/configuration/auth/) for full details.
+
+> **Security note:** Never commit API keys to version control. The `~/.qwen/settings.json` file is in your home directory and should stay private.
## Usage
@@ -191,10 +417,21 @@ Build on top of Qwen Code with the TypeScript SDK:
Qwen Code can be configured via `settings.json`, environment variables, and CLI flags.
-- **User settings**: `~/.qwen/settings.json`
-- **Project settings**: `.qwen/settings.json`
+| File | Scope | Description |
+| ----------------------- | ------------- | --------------------------------------------------------------------------------------- |
+| `~/.qwen/settings.json` | User (global) | Applies to all your Qwen Code sessions. **Recommended for `modelProviders` and `env`.** |
+| `.qwen/settings.json` | Project | Applies only when running Qwen Code in this project. Overrides user settings. |
-See [settings](https://qwenlm.github.io/qwen-code-docs/en/users/configuration/settings/) for available options and precedence.
+The most commonly used top-level fields in `settings.json`:
+
+| Field | Description |
+| ---------------------------- | ---------------------------------------------------------------------------------------------------- |
+| `modelProviders` | Define available models per protocol (`openai`, `anthropic`, `gemini`, `vertex-ai`). |
+| `env` | Fallback environment variables (e.g. API keys). Lower priority than shell `export` and `.env` files. |
+| `security.auth.selectedType` | The protocol to use on startup (e.g. `openai`). |
+| `model.name` | The default model to use when Qwen Code starts. |
+
+> See the [Authentication](#api-key-flexible) section above for complete `settings.json` examples, and the [settings reference](https://qwenlm.github.io/qwen-code-docs/en/users/configuration/settings/) for all available options.
## Benchmark Results
diff --git a/SECURITY.md b/SECURITY.md
index 4e7d8ce79..d4ae9df9e 100644
--- a/SECURITY.md
+++ b/SECURITY.md
@@ -1,5 +1,9 @@
-# Reporting Security Issues
+# Security Policy
-Please report any security issue or Higress crash report to [ASRC](https://security.alibaba.com/) (Alibaba Security Response Center) where the issue will be triaged appropriately.
+## Reporting a Vulnerability
-Thank you for helping keep our project secure.
+If you believe you have discovered a security vulnerability, please report it to us through the following portal: [Report Security Issue](https://yundun.console.aliyun.com/?p=xznew#/taskmanagement/tasks/detail/151)
+
+> **Note:** This channel is strictly for reporting security-related issues. Non-security vulnerabilities or general bug reports will not be addressed here.
+
+We sincerely appreciate your responsible disclosure and your contribution to helping us keep our project secure.
diff --git a/docs/developers/roadmap.md b/docs/developers/roadmap.md
index 125a4d36e..83cd42355 100644
--- a/docs/developers/roadmap.md
+++ b/docs/developers/roadmap.md
@@ -2,13 +2,13 @@
> **Objective**: Catch up with Claude Code's product functionality, continuously refine details, and enhance user experience.
-| Category | Phase 1 | Phase 2 |
-| ------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- |
-| User Experience | ✅ Terminal UI
✅ Support OpenAI Protocol
✅ Settings
✅ OAuth
✅ Cache Control
✅ Memory
✅ Compress
✅ Theme | Better UI
OnBoarding
LogView
✅ Session
Permission
🔄 Cross-platform Compatibility |
-| Coding Workflow | ✅ Slash Commands
✅ MCP
✅ PlanMode
✅ TodoWrite
✅ SubAgent
✅ Multi Model
✅ Chat Management
✅ Tools (WebFetch, Bash, TextSearch, FileReadFile, EditFile) | 🔄 Hooks
SubAgent (enhanced)
✅ Skill
✅ Headless Mode
✅ Tools (WebSearch) |
-| Building Open Capabilities | ✅ Custom Commands | ✅ QwenCode SDK
Extension |
-| Integrating Community Ecosystem | | ✅ VSCode Plugin
🔄 ACP/Zed
✅ GHA |
-| Administrative Capabilities | ✅ Stats
✅ Feedback | Costs
Dashboard |
+| Category | Phase 1 | Phase 2 |
+| ------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| User Experience | ✅ Terminal UI
✅ Support OpenAI Protocol
✅ Settings
✅ OAuth
✅ Cache Control
✅ Memory
✅ Compress
✅ Theme | Better UI
OnBoarding
LogView
✅ Session
Permission
🔄 Cross-platform Compatibility
✅ Coding Plan
✅ Anthropic Provider
✅ Multimodal Input
✅ Unified WebUI |
+| Coding Workflow | ✅ Slash Commands
✅ MCP
✅ PlanMode
✅ TodoWrite
✅ SubAgent
✅ Multi Model
✅ Chat Management
✅ Tools (WebFetch, Bash, TextSearch, FileReadFile, EditFile) | 🔄 Hooks
✅ Skill
✅ Headless Mode
✅ Tools (WebSearch)
✅ LSP Support
✅ Concurrent Runner |
+| Building Open Capabilities | ✅ Custom Commands | ✅ QwenCode SDK
✅ Extension System |
+| Integrating Community Ecosystem | | ✅ VSCode Plugin
✅ ACP/Zed
✅ GHA |
+| Administrative Capabilities | ✅ Stats
✅ Feedback | Costs
Dashboard
✅ User Feedback Dialog |
> For more details, please see the list below.
@@ -16,39 +16,48 @@
#### Completed Features
-| Feature | Version | Description | Category |
-| ----------------------- | --------- | ------------------------------------------------------- | ------------------------------- |
-| Skill | `V0.6.0` | Extensible custom AI skills | Coding Workflow |
-| Github Actions | `V0.5.0` | qwen-code-action and automation | Integrating Community Ecosystem |
-| VSCode Plugin | `V0.5.0` | VSCode extension plugin | Integrating Community Ecosystem |
-| QwenCode SDK | `V0.4.0` | Open SDK for third-party integration | Building Open Capabilities |
-| Session | `V0.4.0` | Enhanced session management | User Experience |
-| i18n | `V0.3.0` | Internationalization and multilingual support | User Experience |
-| Headless Mode | `V0.3.0` | Headless mode (non-interactive) | Coding Workflow |
-| ACP/Zed | `V0.2.0` | ACP and Zed editor integration | Integrating Community Ecosystem |
-| Terminal UI | `V0.1.0+` | Interactive terminal user interface | User Experience |
-| Settings | `V0.1.0+` | Configuration management system | User Experience |
-| Theme | `V0.1.0+` | Multi-theme support | User Experience |
-| Support OpenAI Protocol | `V0.1.0+` | Support for OpenAI API protocol | User Experience |
-| Chat Management | `V0.1.0+` | Session management (save, restore, browse) | Coding Workflow |
-| MCP | `V0.1.0+` | Model Context Protocol integration | Coding Workflow |
-| Multi Model | `V0.1.0+` | Multi-model support and switching | Coding Workflow |
-| Slash Commands | `V0.1.0+` | Slash command system | Coding Workflow |
-| Tool: Bash | `V0.1.0+` | Shell command execution tool (with is_background param) | Coding Workflow |
-| Tool: FileRead/EditFile | `V0.1.0+` | File read/write and edit tools | Coding Workflow |
-| Custom Commands | `V0.1.0+` | Custom command loading | Building Open Capabilities |
-| Feedback | `V0.1.0+` | Feedback mechanism (/bug command) | Administrative Capabilities |
-| Stats | `V0.1.0+` | Usage statistics and quota display | Administrative Capabilities |
-| Memory | `V0.0.9+` | Project-level and global memory management | User Experience |
-| Cache Control | `V0.0.9+` | Prompt caching control (Anthropic, DashScope) | User Experience |
-| PlanMode | `V0.0.14` | Task planning mode | Coding Workflow |
-| Compress | `V0.0.11` | Chat compression mechanism | User Experience |
-| SubAgent | `V0.0.11` | Dedicated sub-agent system | Coding Workflow |
-| TodoWrite | `V0.0.10` | Task management and progress tracking | Coding Workflow |
-| Tool: TextSearch | `V0.0.8+` | Text search tool (grep, supports .qwenignore) | Coding Workflow |
-| Tool: WebFetch | `V0.0.7+` | Web content fetching tool | Coding Workflow |
-| Tool: WebSearch | `V0.0.7+` | Web search tool (using Tavily API) | Coding Workflow |
-| OAuth | `V0.0.5+` | OAuth login authentication (Qwen OAuth) | User Experience |
+| Feature | Version | Description | Category | Phase |
+| ----------------------- | --------- | ------------------------------------------------------- | ------------------------------- | ----- |
+| **Coding Plan** | `V0.10.0` | Bailian Coding Plan authentication & models | User Experience | 2 |
+| Unified WebUI | `V0.9.0` | Shared WebUI component library for VSCode/CLI | User Experience | 2 |
+| Export Chat | `V0.8.0` | Export sessions to Markdown/HTML/JSON/JSONL | User Experience | 2 |
+| Extension System | `V0.8.0` | Full extension management with slash commands | Building Open Capabilities | 2 |
+| LSP Support | `V0.7.0` | Experimental LSP service (`--experimental-lsp`) | Coding Workflow | 2 |
+| Anthropic Provider | `V0.7.0` | Anthropic API provider support | User Experience | 2 |
+| User Feedback Dialog | `V0.7.0` | In-app feedback collection with fatigue mechanism | Administrative Capabilities | 2 |
+| Concurrent Runner | `V0.6.0` | Batch CLI execution with Git integration | Coding Workflow | 2 |
+| Multimodal Input | `V0.6.0` | Image, PDF, audio, video input support | User Experience | 2 |
+| Skill | `V0.6.0` | Extensible custom AI skills (experimental) | Coding Workflow | 2 |
+| Github Actions | `V0.5.0` | qwen-code-action and automation | Integrating Community Ecosystem | 1 |
+| VSCode Plugin | `V0.5.0` | VSCode extension plugin | Integrating Community Ecosystem | 1 |
+| QwenCode SDK | `V0.4.0` | Open SDK for third-party integration | Building Open Capabilities | 1 |
+| Session | `V0.4.0` | Enhanced session management | User Experience | 1 |
+| i18n | `V0.3.0` | Internationalization and multilingual support | User Experience | 1 |
+| Headless Mode | `V0.3.0` | Headless mode (non-interactive) | Coding Workflow | 1 |
+| ACP/Zed | `V0.2.0` | ACP and Zed editor integration | Integrating Community Ecosystem | 1 |
+| Terminal UI | `V0.1.0+` | Interactive terminal user interface | User Experience | 1 |
+| Settings | `V0.1.0+` | Configuration management system | User Experience | 1 |
+| Theme | `V0.1.0+` | Multi-theme support | User Experience | 1 |
+| Support OpenAI Protocol | `V0.1.0+` | Support for OpenAI API protocol | User Experience | 1 |
+| Chat Management | `V0.1.0+` | Session management (save, restore, browse) | Coding Workflow | 1 |
+| MCP | `V0.1.0+` | Model Context Protocol integration | Coding Workflow | 1 |
+| Multi Model | `V0.1.0+` | Multi-model support and switching | Coding Workflow | 1 |
+| Slash Commands | `V0.1.0+` | Slash command system | Coding Workflow | 1 |
+| Tool: Bash | `V0.1.0+` | Shell command execution tool (with is_background param) | Coding Workflow | 1 |
+| Tool: FileRead/EditFile | `V0.1.0+` | File read/write and edit tools | Coding Workflow | 1 |
+| Custom Commands | `V0.1.0+` | Custom command loading | Building Open Capabilities | 1 |
+| Feedback | `V0.1.0+` | Feedback mechanism (/bug command) | Administrative Capabilities | 1 |
+| Stats | `V0.1.0+` | Usage statistics and quota display | Administrative Capabilities | 1 |
+| Memory | `V0.0.9+` | Project-level and global memory management | User Experience | 1 |
+| Cache Control | `V0.0.9+` | Prompt caching control (Anthropic, DashScope) | User Experience | 1 |
+| PlanMode | `V0.0.14` | Task planning mode | Coding Workflow | 1 |
+| Compress | `V0.0.11` | Chat compression mechanism | User Experience | 1 |
+| SubAgent | `V0.0.11` | Dedicated sub-agent system | Coding Workflow | 1 |
+| TodoWrite | `V0.0.10` | Task management and progress tracking | Coding Workflow | 1 |
+| Tool: TextSearch | `V0.0.8+` | Text search tool (grep, supports .qwenignore) | Coding Workflow | 1 |
+| Tool: WebFetch | `V0.0.7+` | Web content fetching tool | Coding Workflow | 1 |
+| Tool: WebSearch | `V0.0.7+` | Web search tool (using Tavily API) | Coding Workflow | 1 |
+| OAuth | `V0.0.5+` | OAuth login authentication (Qwen OAuth) | User Experience | 1 |
#### Features to Develop
@@ -60,7 +69,6 @@
| Cross-platform Compatibility | P1 | In Progress | Windows/Linux/macOS compatibility | User Experience |
| LogView | P2 | Planned | Log viewing and debugging feature | User Experience |
| Hooks | P2 | In Progress | Extension hooks system | Coding Workflow |
-| Extension | P2 | Planned | Extension system | Building Open Capabilities |
| Costs | P2 | Planned | Cost tracking and analysis | Administrative Capabilities |
| Dashboard | P2 | Planned | Management dashboard | Administrative Capabilities |
diff --git a/docs/users/configuration/auth.md b/docs/users/configuration/auth.md
index 0a5b700ea..1d5d30240 100644
--- a/docs/users/configuration/auth.md
+++ b/docs/users/configuration/auth.md
@@ -31,6 +31,52 @@ qwen
Use this if you want more flexibility over which provider and model to use. Supports multiple protocols and providers, including OpenAI, Anthropic, Google GenAI, Alibaba Cloud Bailian, Azure OpenAI, OpenRouter, ModelScope, or a self-hosted compatible endpoint.
+### Recommended: One-file setup via `settings.json`
+
+The simplest way to get started with API-KEY authentication is to put everything in a single `~/.qwen/settings.json` file. Here's a complete, ready-to-use example:
+
+```json
+{
+ "modelProviders": {
+ "openai": [
+ {
+ "id": "qwen3-coder-plus",
+ "name": "qwen3-coder-plus",
+ "baseUrl": "https://dashscope.aliyuncs.com/compatible-mode/v1",
+ "description": "Qwen3-Coder via Dashscope",
+ "envKey": "DASHSCOPE_API_KEY"
+ }
+ ]
+ },
+ "env": {
+ "DASHSCOPE_API_KEY": "sk-xxxxxxxxxxxxx"
+ },
+ "security": {
+ "auth": {
+ "selectedType": "openai"
+ }
+ },
+ "model": {
+ "name": "qwen3-coder-plus"
+ }
+}
+```
+
+What each field does:
+
+| Field | Description |
+| ---------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
+| `modelProviders` | Declares which models are available and how to connect to them. Keys (`openai`, `anthropic`, `gemini`, `vertex-ai`) represent the API protocol. |
+| `env` | Stores API keys directly in `settings.json` as a fallback (lowest priority — shell `export` and `.env` files take precedence). |
+| `security.auth.selectedType` | Tells Qwen Code which protocol to use on startup (e.g. `openai`, `anthropic`, `gemini`). Without this, you'd need to run `/auth` interactively. |
+| `model.name` | The default model to activate when Qwen Code starts. Must match one of the `id` values in your `modelProviders`. |
+
+After saving the file, just run `qwen` — no interactive `/auth` setup needed.
+
+> [!tip]
+>
+> The sections below explain each part in more detail. If the quick example above works for you, feel free to skip ahead to [Security notes](#security-notes).
+
### Option1: Coding Plan(Aliyun Bailian)
Use this if you want predictable costs with higher usage quotas for the qwen3-coder-plus model.
@@ -48,10 +94,45 @@ After entering, select `Coding Plan`:

-Enter your `sk-sp-xxxxxxxxx` key, then use the `/model` command to switch between all Bailian `Coding Plan` supported models:
+Enter your `sk-sp-xxxxxxxxx` key, then use the `/model` command to switch between all Bailian `Coding Plan` supported models (including qwen3.5-plus, qwen3-coder-plus, qwen3-coder-next, qwen3-max, glm-4.7, and kimi-k2.5):

+**Alternative: configure Coding Plan via `settings.json`**
+
+If you prefer to skip the interactive `/auth` flow, add the following to `~/.qwen/settings.json`:
+
+```json
+{
+ "modelProviders": {
+ "openai": [
+ {
+ "id": "qwen3-coder-plus",
+ "name": "qwen3-coder-plus (Coding Plan)",
+ "baseUrl": "https://coding.dashscope.aliyuncs.com/v1",
+ "description": "qwen3-coder-plus from Bailian Coding Plan",
+ "envKey": "BAILIAN_CODING_PLAN_API_KEY"
+ }
+ ]
+ },
+ "env": {
+ "BAILIAN_CODING_PLAN_API_KEY": "sk-sp-xxxxxxxxx"
+ },
+ "security": {
+ "auth": {
+ "selectedType": "openai"
+ }
+ },
+ "model": {
+ "name": "qwen3-coder-plus"
+ }
+}
+```
+
+> [!note]
+>
+> The Coding Plan uses a dedicated endpoint (`https://coding.dashscope.aliyuncs.com/v1`) that is different from the standard Dashscope endpoint. Make sure to use the correct `baseUrl`.
+
### Option2: Third-party API-KEY
Use this if you want to connect to third-party providers such as OpenAI, Anthropic, Google, Azure OpenAI, OpenRouter, ModelScope, or a self-hosted endpoint.
@@ -67,7 +148,7 @@ The key concept is **Model Providers** (`modelProviders`): Qwen Code supports mu
| Google GenAI | `gemini` | `GEMINI_API_KEY`, `GEMINI_MODEL` | Google Gemini |
| Google Vertex AI | `vertex-ai` | `GOOGLE_API_KEY`, `GOOGLE_MODEL` | Google Vertex AI |
-#### Step 1: Configure `modelProviders` in `~/.qwen/settings.json`
+#### Step 1: Configure models and providers in `~/.qwen/settings.json`
Define which models are available for each protocol. Each model entry requires at minimum an `id` and an `envKey` (the environment variable name that holds your API key).
@@ -75,7 +156,7 @@ Define which models are available for each protocol. Each model entry requires a
>
> It is recommended to define `modelProviders` in the user-scope `~/.qwen/settings.json` to avoid merge conflicts between project and user settings.
-Edit `~/.qwen/settings.json` (create it if it doesn't exist):
+Edit `~/.qwen/settings.json` (create it if it doesn't exist). You can mix multiple protocols in a single file — here is a multi-provider example showing just the `modelProviders` section:
```json
{
@@ -106,7 +187,11 @@ Edit `~/.qwen/settings.json` (create it if it doesn't exist):
}
```
-You can mix multiple protocols and models in a single configuration. The `ModelConfig` fields are:
+> [!tip]
+>
+> Don't forget to also set `env`, `security.auth.selectedType`, and `model.name` alongside `modelProviders` — see the [complete example above](#recommended-one-file-setup-via-settingsjson) for reference.
+
+**`ModelConfig` fields (each entry inside `modelProviders`):**
| Field | Required | Description |
| ------------------ | -------- | -------------------------------------------------------------------- |
@@ -118,9 +203,9 @@ You can mix multiple protocols and models in a single configuration. The `ModelC
> [!note]
>
-> Credentials are **never** stored in `settings.json`. The runtime reads them from the environment variable specified in `envKey`.
+> When using the `env` field in `settings.json`, credentials are stored in plain text. For better security, prefer `.env` files or shell `export` — see [Step 2](#step-2-set-environment-variables).
-For the full `modelProviders` schema and advanced options like `generationConfig`, `customHeaders`, and `extra_body`, see [Settings Reference → modelProviders](settings.md#modelproviders).
+For the full `modelProviders` schema and advanced options like `generationConfig`, `customHeaders`, and `extra_body`, see [Model Providers Reference](model-providers.md).
#### Step 2: Set environment variables
@@ -165,25 +250,19 @@ If nothing is found, it falls back to your **home directory**:
**3. `settings.json` → `env` field (lowest priority)**
-You can also define environment variables directly in `~/.qwen/settings.json` under the `env` key. These are loaded as the **lowest-priority fallback** — only applied when a variable is not already set by the system environment or `.env` files.
+You can also define API keys directly in `~/.qwen/settings.json` under the `env` key. These are loaded as the **lowest-priority fallback** — only applied when a variable is not already set by the system environment or `.env` files.
```json
{
"env": {
- "DASHSCOPE_API_KEY":"sk-...",
+ "DASHSCOPE_API_KEY": "sk-...",
"OPENAI_API_KEY": "sk-...",
- "ANTHROPIC_API_KEY": "sk-ant-...",
- "GEMINI_API_KEY": "AIza..."
- },
- "modelProviders": {
- ...
+ "ANTHROPIC_API_KEY": "sk-ant-..."
}
}
```
-> [!note]
->
-> This is useful when you want to keep all configuration (providers + credentials) in a single file. However, be mindful that `settings.json` may be shared or synced — prefer `.env` files for sensitive secrets.
+This is the approach used in the [one-file setup example](#recommended-one-file-setup-via-settingsjson) above. It's convenient for keeping everything in one place, but be mindful that `settings.json` may be shared or synced — prefer `.env` files for sensitive secrets.
**Priority summary:**
diff --git a/docs/users/configuration/model-providers.md b/docs/users/configuration/model-providers.md
new file mode 100644
index 000000000..2e6265917
--- /dev/null
+++ b/docs/users/configuration/model-providers.md
@@ -0,0 +1,521 @@
+# Model Providers
+
+Qwen Code allows you to configure multiple model providers through the `modelProviders` setting in your `settings.json`. This enables you to switch between different AI models and providers using the `/model` command.
+
+## Overview
+
+Use `modelProviders` to declare curated model lists per auth type that the `/model` picker can switch between. Keys must be valid auth types (`openai`, `anthropic`, `gemini`, `vertex-ai`, etc.). Each entry requires an `id` and **must include `envKey`**, with optional `name`, `description`, `baseUrl`, and `generationConfig`. Credentials are never persisted in settings; the runtime reads them from `process.env[envKey]`. Qwen OAuth models remain hard-coded and cannot be overridden.
+
+> [!note]
+> Only the `/model` command exposes non-default auth types. Anthropic, Gemini, Vertex AI, etc., must be defined via `modelProviders`. The `/auth` command intentionally lists only the built-in Qwen OAuth and OpenAI flows.
+
+> [!warning]
+> **Duplicate model IDs within the same authType:** Defining multiple models with the same `id` under a single `authType` (e.g., two entries with `"id": "gpt-4o"` in `openai`) is currently not supported. If duplicates exist, **the first occurrence wins** and subsequent duplicates are skipped with a warning. Note that the `id` field is used both as the configuration identifier and as the actual model name sent to the API, so using unique IDs (e.g., `gpt-4o-creative`, `gpt-4o-balanced`) is not a viable workaround. This is a known limitation that we plan to address in a future release.
+
+## Configuration Examples by Auth Type
+
+Below are comprehensive configuration examples for different authentication types, showing the available parameters and their combinations.
+
+### Supported Auth Types
+
+The `modelProviders` object keys must be valid `authType` values. Currently supported auth types are:
+
+| Auth Type | Description |
+| ------------ | --------------------------------------------------------------------------------------- |
+| `openai` | OpenAI-compatible APIs (OpenAI, Azure OpenAI, local inference servers like vLLM/Ollama) |
+| `anthropic` | Anthropic Claude API |
+| `gemini` | Google Gemini API |
+| `vertex-ai` | Google Vertex AI |
+| `qwen-oauth` | Qwen OAuth (hard-coded, cannot be overridden in `modelProviders`) |
+
+> [!warning]
+> If an invalid auth type key is used (e.g., a typo like `"openai-custom"`), the configuration will be **silently skipped** and the models will not appear in the `/model` picker. Always use one of the supported auth type values listed above.
+
+### SDKs Used for API Requests
+
+Qwen Code uses the following official SDKs to send requests to each provider:
+
+| Auth Type | SDK Package |
+| ---------------------- | ----------------------------------------------------------------------------------------------- |
+| `openai` | [`openai`](https://www.npmjs.com/package/openai) - Official OpenAI Node.js SDK |
+| `anthropic` | [`@anthropic-ai/sdk`](https://www.npmjs.com/package/@anthropic-ai/sdk) - Official Anthropic SDK |
+| `gemini` / `vertex-ai` | [`@google/genai`](https://www.npmjs.com/package/@google/genai) - Official Google GenAI SDK |
+| `qwen-oauth` | [`openai`](https://www.npmjs.com/package/openai) with custom provider (DashScope-compatible) |
+
+This means the `baseUrl` you configure should be compatible with the corresponding SDK's expected API format. For example, when using `openai` auth type, the endpoint must accept OpenAI API format requests.
+
+### OpenAI-compatible providers (`openai`)
+
+This auth type supports not only OpenAI's official API but also any OpenAI-compatible endpoint, including aggregated model providers like OpenRouter.
+
+```json
+{
+ "modelProviders": {
+ "openai": [
+ {
+ "id": "gpt-4o",
+ "name": "GPT-4o",
+ "envKey": "OPENAI_API_KEY",
+ "baseUrl": "https://api.openai.com/v1",
+ "generationConfig": {
+ "timeout": 60000,
+ "maxRetries": 3,
+ "enableCacheControl": true,
+ "contextWindowSize": 128000,
+ "customHeaders": {
+ "X-Client-Request-ID": "req-123"
+ },
+ "extra_body": {
+ "enable_thinking": true,
+ "service_tier": "priority"
+ },
+ "samplingParams": {
+ "temperature": 0.2,
+ "top_p": 0.8,
+ "max_tokens": 4096,
+ "presence_penalty": 0.1,
+ "frequency_penalty": 0.1
+ }
+ }
+ },
+ {
+ "id": "gpt-4o-mini",
+ "name": "GPT-4o Mini",
+ "envKey": "OPENAI_API_KEY",
+ "baseUrl": "https://api.openai.com/v1",
+ "generationConfig": {
+ "timeout": 30000,
+ "samplingParams": {
+ "temperature": 0.5,
+ "max_tokens": 2048
+ }
+ }
+ },
+ {
+ "id": "openai/gpt-4o",
+ "name": "GPT-4o (via OpenRouter)",
+ "envKey": "OPENROUTER_API_KEY",
+ "baseUrl": "https://openrouter.ai/api/v1",
+ "generationConfig": {
+ "timeout": 120000,
+ "maxRetries": 3,
+ "samplingParams": {
+ "temperature": 0.7
+ }
+ }
+ }
+ ]
+ }
+}
+```
+
+### Anthropic (`anthropic`)
+
+```json
+{
+ "modelProviders": {
+ "anthropic": [
+ {
+ "id": "claude-3-5-sonnet",
+ "name": "Claude 3.5 Sonnet",
+ "envKey": "ANTHROPIC_API_KEY",
+ "baseUrl": "https://api.anthropic.com/v1",
+ "generationConfig": {
+ "timeout": 120000,
+ "maxRetries": 3,
+ "contextWindowSize": 200000,
+ "samplingParams": {
+ "temperature": 0.7,
+ "max_tokens": 8192,
+ "top_p": 0.9
+ }
+ }
+ },
+ {
+ "id": "claude-3-opus",
+ "name": "Claude 3 Opus",
+ "envKey": "ANTHROPIC_API_KEY",
+ "baseUrl": "https://api.anthropic.com/v1",
+ "generationConfig": {
+ "timeout": 180000,
+ "samplingParams": {
+ "temperature": 0.3,
+ "max_tokens": 4096
+ }
+ }
+ }
+ ]
+ }
+}
+```
+
+### Google Gemini (`gemini`)
+
+```json
+{
+ "modelProviders": {
+ "gemini": [
+ {
+ "id": "gemini-2.0-flash",
+ "name": "Gemini 2.0 Flash",
+ "envKey": "GEMINI_API_KEY",
+ "baseUrl": "https://generativelanguage.googleapis.com",
+ "capabilities": {
+ "vision": true
+ },
+ "generationConfig": {
+ "timeout": 60000,
+ "maxRetries": 2,
+ "contextWindowSize": 1000000,
+ "schemaCompliance": "auto",
+ "samplingParams": {
+ "temperature": 0.4,
+ "top_p": 0.95,
+ "max_tokens": 8192,
+ "top_k": 40
+ }
+ }
+ }
+ ]
+ }
+}
+```
+
+### Google Vertex AI (`vertex-ai`)
+
+```json
+{
+ "modelProviders": {
+ "vertex-ai": [
+ {
+ "id": "gemini-1.5-pro-vertex",
+ "name": "Gemini 1.5 Pro (Vertex AI)",
+ "envKey": "GOOGLE_API_KEY",
+ "baseUrl": "https://generativelanguage.googleapis.com",
+ "generationConfig": {
+ "timeout": 90000,
+ "contextWindowSize": 2000000,
+ "samplingParams": {
+ "temperature": 0.2,
+ "max_tokens": 8192
+ }
+ }
+ }
+ ]
+ }
+}
+```
+
+### Local Self-Hosted Models (via OpenAI-compatible API)
+
+Most local inference servers (vLLM, Ollama, LM Studio, etc.) provide an OpenAI-compatible API endpoint. Configure them using the `openai` auth type with a local `baseUrl`:
+
+```json
+{
+ "modelProviders": {
+ "openai": [
+ {
+ "id": "qwen2.5-7b",
+ "name": "Qwen2.5 7B (Ollama)",
+ "envKey": "OLLAMA_API_KEY",
+ "baseUrl": "http://localhost:11434/v1",
+ "generationConfig": {
+ "timeout": 300000,
+ "maxRetries": 1,
+ "contextWindowSize": 32768,
+ "samplingParams": {
+ "temperature": 0.7,
+ "top_p": 0.9,
+ "max_tokens": 4096
+ }
+ }
+ },
+ {
+ "id": "llama-3.1-8b",
+ "name": "Llama 3.1 8B (vLLM)",
+ "envKey": "VLLM_API_KEY",
+ "baseUrl": "http://localhost:8000/v1",
+ "generationConfig": {
+ "timeout": 120000,
+ "maxRetries": 2,
+ "contextWindowSize": 128000,
+ "samplingParams": {
+ "temperature": 0.6,
+ "max_tokens": 8192
+ }
+ }
+ },
+ {
+ "id": "local-model",
+ "name": "Local Model (LM Studio)",
+ "envKey": "LMSTUDIO_API_KEY",
+ "baseUrl": "http://localhost:1234/v1",
+ "generationConfig": {
+ "timeout": 60000,
+ "samplingParams": {
+ "temperature": 0.5
+ }
+ }
+ }
+ ]
+ }
+}
+```
+
+For local servers that don't require authentication, you can use any placeholder value for the API key:
+
+```bash
+# For Ollama (no auth required)
+export OLLAMA_API_KEY="ollama"
+
+# For vLLM (if no auth is configured)
+export VLLM_API_KEY="not-needed"
+```
+
+> [!note]
+> The `extra_body` parameter is **only supported for OpenAI-compatible providers** (`openai`, `qwen-oauth`). It is ignored for Anthropic, Gemini, and Vertex AI providers.
+
+## Bailian Coding Plan
+
+Bailian Coding Plan provides a pre-configured set of Qwen models optimized for coding tasks. This feature is available for users with Bailian API access and offers a simplified setup experience with automatic model configuration updates.
+
+### Overview
+
+When you authenticate with a Bailian Coding Plan API key using the `/auth` command, Qwen Code automatically configures the following models:
+
+| Model ID | Name | Description |
+| ---------------------- | -------------------- | -------------------------------------- |
+| `qwen3.5-plus` | qwen3.5-plus | Advanced model with thinking enabled |
+| `qwen3-coder-plus` | qwen3-coder-plus | Optimized for coding tasks |
+| `qwen3-max-2026-01-23` | qwen3-max-2026-01-23 | Latest max model with thinking enabled |
+
+### Setup
+
+1. Obtain a Bailian Coding Plan API key:
+ - **China**:
+ - **International**:
+2. Run the `/auth` command in Qwen Code
+3. Select the API-KEY authentication method
+4. Select your region (China or Global/International)
+5. Enter your API key when prompted
+
+The models will be automatically configured and added to your `/model` picker.
+
+### Regions
+
+Bailian Coding Plan supports two regions:
+
+| Region | Endpoint | Description |
+| -------------------- | ----------------------------------------------- | ----------------------- |
+| China | `https://coding.dashscope.aliyuncs.com/v1` | Mainland China endpoint |
+| Global/International | `https://coding-intl.dashscope.aliyuncs.com/v1` | International endpoint |
+
+The region is selected during authentication and stored in `settings.json` under `codingPlan.region`. To switch regions, re-run the `/auth` command and select a different region.
+
+### API Key Storage
+
+When you configure Coding Plan through the `/auth` command, the API key is stored using the reserved environment variable name `BAILIAN_CODING_PLAN_API_KEY`. By default, it is stored in the `settings.env` field of your `settings.json` file.
+
+> [!warning]
+> **Security Recommendation**: For better security, it is recommended to move the API key from `settings.json` to a separate `.env` file and load it as an environment variable. For example:
+>
+> ```bash
+> # ~/.qwen/.env
+> BAILIAN_CODING_PLAN_API_KEY=your-api-key-here
+> ```
+>
+> Then ensure this file is added to your `.gitignore` if you're using project-level settings.
+
+### Automatic Updates
+
+Coding Plan model configurations are versioned. When Qwen Code detects a newer version of the model template, you will be prompted to update. Accepting the update will:
+
+- Replace the existing Coding Plan model configurations with the latest versions
+- Preserve any custom model configurations you've added manually
+- Automatically switch to the first model in the updated configuration
+
+The update process ensures you always have access to the latest model configurations and features without manual intervention.
+
+### Manual Configuration (Advanced)
+
+If you prefer to manually configure Coding Plan models, you can add them to your `settings.json` like any OpenAI-compatible provider:
+
+```json
+{
+ "modelProviders": {
+ "openai": [
+ {
+ "id": "qwen3-coder-plus",
+ "name": "qwen3-coder-plus",
+ "description": "Qwen3-Coder via Bailian Coding Plan",
+ "envKey": "YOUR_CUSTOM_ENV_KEY",
+ "baseUrl": "https://coding.dashscope.aliyuncs.com/v1"
+ }
+ ]
+ }
+}
+```
+
+> [!note]
+> When using manual configuration:
+
+> - You can use any environment variable name for `envKey`
+> - You do not need to configure `codingPlan.*`
+> - **Automatic updates will not apply** to manually configured Coding Plan models
+
+> [!warning]
+> If you also use automatic Coding Plan configuration, automatic updates may overwrite your manual configurations if they use the same `envKey` and `baseUrl` as the automatic configuration. To avoid this, ensure your manual configuration uses a different `envKey` if possible.
+
+## Resolution Layers and Atomicity
+
+The effective auth/model/credential values are chosen per field using the following precedence (first present wins). You can combine `--auth-type` with `--model` to point directly at a provider entry; these CLI flags run before other layers.
+
+| Layer (highest → lowest) | authType | model | apiKey | baseUrl | apiKeyEnvKey | proxy |
+| -------------------------- | ----------------------------------- | ----------------------------------------------- | --------------------------------------------------- | ---------------------------------------------------- | ---------------------- | --------------------------------- |
+| Programmatic overrides | `/auth` | `/auth` input | `/auth` input | `/auth` input | — | — |
+| Model provider selection | — | `modelProvider.id` | `env[modelProvider.envKey]` | `modelProvider.baseUrl` | `modelProvider.envKey` | — |
+| CLI arguments | `--auth-type` | `--model` | `--openaiApiKey` (or provider-specific equivalents) | `--openaiBaseUrl` (or provider-specific equivalents) | — | — |
+| Environment variables | — | Provider-specific mapping (e.g. `OPENAI_MODEL`) | Provider-specific mapping (e.g. `OPENAI_API_KEY`) | Provider-specific mapping (e.g. `OPENAI_BASE_URL`) | — | — |
+| Settings (`settings.json`) | `security.auth.selectedType` | `model.name` | `security.auth.apiKey` | `security.auth.baseUrl` | — | — |
+| Default / computed | Falls back to `AuthType.QWEN_OAUTH` | Built-in default (OpenAI ⇒ `qwen3-coder-plus`) | — | — | — | `Config.getProxy()` if configured |
+
+\*When present, CLI auth flags override settings. Otherwise, `security.auth.selectedType` or the implicit default determine the auth type. Qwen OAuth and OpenAI are the only auth types surfaced without extra configuration.
+
+> [!warning]
+> **Deprecation of `security.auth.apiKey` and `security.auth.baseUrl`:** Directly configuring API credentials via `security.auth.apiKey` and `security.auth.baseUrl` in `settings.json` is deprecated. These settings were used in historical versions for credentials entered through the UI, but the credential input flow was removed in version 0.10.1. These fields will be fully removed in a future release. **It is strongly recommended to migrate to `modelProviders`** for all model and credential configurations. Use `envKey` in `modelProviders` to reference environment variables for secure credential management instead of hardcoding credentials in settings files.
+
+## Generation Config Layering: The Impermeable Provider Layer
+
+The configuration resolution follows a strict layering model with one crucial rule: **the modelProvider layer is impermeable**.
+
+### How it works
+
+1. **When a modelProvider model IS selected** (e.g., via `/model` command choosing a provider-configured model):
+ - The entire `generationConfig` from the provider is applied **atomically**
+ - **The provider layer is completely impermeable** — lower layers (CLI, env, settings) do not participate in generationConfig resolution at all
+ - All fields defined in `modelProviders[].generationConfig` use the provider's values
+ - All fields **not defined** by the provider are set to `undefined` (not inherited from settings)
+ - This ensures provider configurations act as a complete, self-contained "sealed package"
+
+2. **When NO modelProvider model is selected** (e.g., using `--model` with a raw model ID, or using CLI/env/settings directly):
+ - The resolution falls through to lower layers
+ - Fields are populated from CLI → env → settings → defaults
+ - This creates a **Runtime Model** (see next section)
+
+### Per-field precedence for `generationConfig`
+
+| Priority | Source | Behavior |
+| -------- | --------------------------------------------- | -------------------------------------------------------------------------------------------------------- |
+| 1 | Programmatic overrides | Runtime `/model`, `/auth` changes |
+| 2 | `modelProviders[authType][].generationConfig` | **Impermeable layer** - completely replaces all generationConfig fields; lower layers do not participate |
+| 3 | `settings.model.generationConfig` | Only used for **Runtime Models** (when no provider model is selected) |
+| 4 | Content-generator defaults | Provider-specific defaults (e.g., OpenAI vs Gemini) - only for Runtime Models |
+
+### Atomic field treatment
+
+The following fields are treated as atomic objects - provider values completely replace the entire object, no merging occurs:
+
+- `samplingParams` - Temperature, top_p, max_tokens, etc.
+- `customHeaders` - Custom HTTP headers
+- `extra_body` - Extra request body parameters
+
+### Example
+
+```json
+// User settings (~/.qwen/settings.json)
+{
+ "model": {
+ "generationConfig": {
+ "timeout": 30000,
+ "samplingParams": { "temperature": 0.5, "max_tokens": 1000 }
+ }
+ }
+}
+
+// modelProviders configuration
+{
+ "modelProviders": {
+ "openai": [{
+ "id": "gpt-4o",
+ "envKey": "OPENAI_API_KEY",
+ "generationConfig": {
+ "timeout": 60000,
+ "samplingParams": { "temperature": 0.2 }
+ }
+ }]
+ }
+}
+```
+
+When `gpt-4o` is selected from modelProviders:
+
+- `timeout` = 60000 (from provider, overrides settings)
+- `samplingParams.temperature` = 0.2 (from provider, completely replaces settings object)
+- `samplingParams.max_tokens` = **undefined** (not defined in provider, and provider layer does not inherit from settings — fields are explicitly set to undefined if not provided)
+
+When using a raw model via `--model gpt-4` (not from modelProviders, creates a Runtime Model):
+
+- `timeout` = 30000 (from settings)
+- `samplingParams.temperature` = 0.5 (from settings)
+- `samplingParams.max_tokens` = 1000 (from settings)
+
+The merge strategy for `modelProviders` itself is REPLACE: the entire `modelProviders` from project settings will override the corresponding section in user settings, rather than merging the two.
+
+## Provider Models vs Runtime Models
+
+Qwen Code distinguishes between two types of model configurations:
+
+### Provider Model
+
+- Defined in `modelProviders` configuration
+- Has a complete, atomic configuration package
+- When selected, its configuration is applied as an impermeable layer
+- Appears in `/model` command list with full metadata (name, description, capabilities)
+- Recommended for multi-model workflows and team consistency
+
+### Runtime Model
+
+- Created dynamically when using raw model IDs via CLI (`--model`), environment variables, or settings
+- Not defined in `modelProviders`
+- Configuration is built by "projecting" through resolution layers (CLI → env → settings → defaults)
+- Automatically captured as a **RuntimeModelSnapshot** when a complete configuration is detected
+- Allows reuse without re-entering credentials
+
+### RuntimeModelSnapshot lifecycle
+
+When you configure a model without using `modelProviders`, Qwen Code automatically creates a RuntimeModelSnapshot to preserve your configuration:
+
+```bash
+# This creates a RuntimeModelSnapshot with ID: $runtime|openai|my-custom-model
+qwen --auth-type openai --model my-custom-model --openaiApiKey $KEY --openaiBaseUrl https://api.example.com/v1
+```
+
+The snapshot:
+
+- Captures model ID, API key, base URL, and generation config
+- Persists across sessions (stored in memory during runtime)
+- Appears in the `/model` command list as a runtime option
+- Can be switched to using `/model $runtime|openai|my-custom-model`
+
+### Key differences
+
+| Aspect | Provider Model | Runtime Model |
+| ----------------------- | --------------------------------- | ------------------------------------------ |
+| Configuration source | `modelProviders` in settings | CLI, env, settings layers |
+| Configuration atomicity | Complete, impermeable package | Layered, each field resolved independently |
+| Reusability | Always available in `/model` list | Captured as snapshot, appears if complete |
+| Team sharing | Yes (via committed settings) | No (user-local) |
+| Credential storage | Reference via `envKey` only | May capture actual key in snapshot |
+
+### When to use each
+
+- **Use Provider Models** when: You have standard models shared across a team, need consistent configurations, or want to prevent accidental overrides
+- **Use Runtime Models** when: Quickly testing a new model, using temporary credentials, or working with ad-hoc endpoints
+
+## Selection Persistence and Recommendations
+
+> [!important]
+> Define `modelProviders` in the user-scope `~/.qwen/settings.json` whenever possible and avoid persisting credential overrides in any scope. Keeping the provider catalog in user settings prevents merge/override conflicts between project and user scopes and ensures `/auth` and `/model` updates always write back to a consistent scope.
+
+- `/model` and `/auth` persist `model.name` (where applicable) and `security.auth.selectedType` to the closest writable scope that already defines `modelProviders`; otherwise they fall back to the user scope. This keeps workspace/user files in sync with the active provider catalog.
+- Without `modelProviders`, the resolver mixes CLI/env/settings layers, creating Runtime Models. This is fine for single-provider setups but cumbersome when frequently switching. Define provider catalogs whenever multi-model workflows are common so that switches stay atomic, source-attributed, and debuggable.
diff --git a/docs/users/configuration/settings.md b/docs/users/configuration/settings.md
index 0094f411d..82db2b319 100644
--- a/docs/users/configuration/settings.md
+++ b/docs/users/configuration/settings.md
@@ -148,8 +148,7 @@ Settings are organized into categories. All settings should be placed within the
"contextWindowSize": 128000,
"enableCacheControl": true,
"customHeaders": {
- "X-Request-ID": "req-123",
- "X-User-ID": "user-456"
+ "X-Client-Request-ID": "req-123"
},
"extra_body": {
"enable_thinking": true
@@ -180,102 +179,6 @@ The `extra_body` field allows you to add custom parameters to the request body s
- `"./custom-logs"` - Logs to `./custom-logs` relative to current directory
- `"/tmp/openai-logs"` - Logs to absolute path `/tmp/openai-logs`
-#### modelProviders
-
-Use `modelProviders` to declare curated model lists per auth type that the `/model` picker can switch between. Keys must be valid auth types (`openai`, `anthropic`, `gemini`, `vertex-ai`, etc.). Each entry requires an `id` and **must include `envKey`**, with optional `name`, `description`, `baseUrl`, and `generationConfig`. Credentials are never persisted in settings; the runtime reads them from `process.env[envKey]`. Qwen OAuth models remain hard-coded and cannot be overridden.
-
-##### Example
-
-```json
-{
- "modelProviders": {
- "openai": [
- {
- "id": "gpt-4o",
- "name": "GPT-4o",
- "envKey": "OPENAI_API_KEY",
- "baseUrl": "https://api.openai.com/v1",
- "generationConfig": {
- "timeout": 60000,
- "maxRetries": 3,
- "customHeaders": {
- "X-Model-Version": "v1.0",
- "X-Request-Priority": "high"
- },
- "extra_body": {
- "enable_thinking": true
- },
- "samplingParams": { "temperature": 0.2 }
- }
- }
- ],
- "anthropic": [
- {
- "id": "claude-3-5-sonnet",
- "envKey": "ANTHROPIC_API_KEY",
- "baseUrl": "https://api.anthropic.com/v1"
- }
- ],
- "gemini": [
- {
- "id": "gemini-2.0-flash",
- "name": "Gemini 2.0 Flash",
- "envKey": "GEMINI_API_KEY",
- "baseUrl": "https://generativelanguage.googleapis.com"
- }
- ],
- "vertex-ai": [
- {
- "id": "gemini-1.5-pro-vertex",
- "envKey": "GOOGLE_API_KEY",
- "baseUrl": "https://generativelanguage.googleapis.com"
- }
- ]
- }
-}
-```
-
-> [!note]
-> Only the `/model` command exposes non-default auth types. Anthropic, Gemini, Vertex AI, etc., must be defined via `modelProviders`. The `/auth` command intentionally lists only the built-in Qwen OAuth and OpenAI flows.
-
-##### Resolution layers and atomicity
-
-The effective auth/model/credential values are chosen per field using the following precedence (first present wins). You can combine `--auth-type` with `--model` to point directly at a provider entry; these CLI flags run before other layers.
-
-| Layer (highest → lowest) | authType | model | apiKey | baseUrl | apiKeyEnvKey | proxy |
-| -------------------------- | ----------------------------------- | ----------------------------------------------- | --------------------------------------------------- | ---------------------------------------------------- | ---------------------- | --------------------------------- |
-| Programmatic overrides | `/auth ` | `/auth` input | `/auth` input | `/auth` input | — | — |
-| Model provider selection | — | `modelProvider.id` | `env[modelProvider.envKey]` | `modelProvider.baseUrl` | `modelProvider.envKey` | — |
-| CLI arguments | `--auth-type` | `--model` | `--openaiApiKey` (or provider-specific equivalents) | `--openaiBaseUrl` (or provider-specific equivalents) | — | — |
-| Environment variables | — | Provider-specific mapping (e.g. `OPENAI_MODEL`) | Provider-specific mapping (e.g. `OPENAI_API_KEY`) | Provider-specific mapping (e.g. `OPENAI_BASE_URL`) | — | — |
-| Settings (`settings.json`) | `security.auth.selectedType` | `model.name` | `security.auth.apiKey` | `security.auth.baseUrl` | — | — |
-| Default / computed | Falls back to `AuthType.QWEN_OAUTH` | Built-in default (OpenAI ⇒ `qwen3-coder-plus`) | — | — | — | `Config.getProxy()` if configured |
-
-\*When present, CLI auth flags override settings. Otherwise, `security.auth.selectedType` or the implicit default determine the auth type. Qwen OAuth and OpenAI are the only auth types surfaced without extra configuration.
-
-Model-provider sourced values are applied atomically: once a provider model is active, every field it defines is protected from lower layers until you manually clear credentials via `/auth`. The final `generationConfig` is the projection across all layers—lower layers only fill gaps left by higher ones, and the provider layer remains impenetrable.
-
-The merge strategy for `modelProviders` is REPLACE: the entire `modelProviders` from project settings will override the corresponding section in user settings, rather than merging the two.
-
-##### Generation config layering
-
-Per-field precedence for `generationConfig`:
-
-1. Programmatic overrides (e.g. runtime `/model`, `/auth` changes)
-2. `modelProviders[authType][].generationConfig`
-3. `settings.model.generationConfig`
-4. Content-generator defaults (`getDefaultGenerationConfig` for OpenAI, `getParameterValue` for Gemini, etc.)
-
-`samplingParams`, `customHeaders`, and `extra_body` are all treated atomically; provider values replace the entire object. If `modelProviders[].generationConfig` defines these fields, they are used directly; otherwise, values from `model.generationConfig` are used. No merging occurs between provider and global configuration levels. Defaults from the content generator apply last so each provider retains its tuned baseline.
-
-##### Selection persistence and recommendations
-
-> [!important]
-> Define `modelProviders` in the user-scope `~/.qwen/settings.json` whenever possible and avoid persisting credential overrides in any scope. Keeping the provider catalog in user settings prevents merge/override conflicts between project and user scopes and ensures `/auth` and `/model` updates always write back to a consistent scope.
-
-- `/model` and `/auth` persist `model.name` (where applicable) and `security.auth.selectedType` to the closest writable scope that already defines `modelProviders`; otherwise they fall back to the user scope. This keeps workspace/user files in sync with the active provider catalog.
-- Without `modelProviders`, the resolver mixes CLI/env/settings layers, which is fine for single-provider setups but cumbersome when frequently switching. Define provider catalogs whenever multi-model workflows are common so that switches stay atomic, source-attributed, and debuggable.
-
#### context
| Setting | Type | Description | Default |
diff --git a/docs/users/reference/keyboard-shortcuts.md b/docs/users/reference/keyboard-shortcuts.md
index fc2f86286..f0cbd7b16 100644
--- a/docs/users/reference/keyboard-shortcuts.md
+++ b/docs/users/reference/keyboard-shortcuts.md
@@ -42,7 +42,7 @@ This document lists the available keyboard shortcuts in Qwen Code.
| `Ctrl+R` | Reverse search through input/shell history. |
| `Ctrl+Right Arrow` / `Meta+Right Arrow` / `Meta+F` | Move the cursor one word to the right. |
| `Ctrl+U` | Delete from the cursor to the beginning of the line. |
-| `Ctrl+V` | Paste clipboard content. If the clipboard contains an image, it will be saved and a reference to it will be inserted in the prompt. |
+| `Ctrl+V` (Windows: `Alt+V`) | Paste clipboard content. If the clipboard contains an image, it will be saved and a reference to it will be inserted in the prompt. |
| `Ctrl+W` / `Meta+Backspace` / `Ctrl+Backspace` | Delete the word to the left of the cursor. |
| `Ctrl+X` / `Meta+Enter` | Open the current input in an external editor. |
diff --git a/esbuild.config.js b/esbuild.config.js
index 12ab39d58..2b532b44e 100644
--- a/esbuild.config.js
+++ b/esbuild.config.js
@@ -33,6 +33,13 @@ const external = [
'@lydell/node-pty-linux-x64',
'@lydell/node-pty-win32-arm64',
'@lydell/node-pty-win32-x64',
+ '@teddyzhu/clipboard',
+ '@teddyzhu/clipboard-darwin-arm64',
+ '@teddyzhu/clipboard-darwin-x64',
+ '@teddyzhu/clipboard-linux-x64-gnu',
+ '@teddyzhu/clipboard-linux-arm64-gnu',
+ '@teddyzhu/clipboard-win32-x64-msvc',
+ '@teddyzhu/clipboard-win32-arm64-msvc',
];
esbuild
diff --git a/integration-tests/acp-integration.test.ts b/integration-tests/acp-integration.test.ts
index 35397da26..93389d605 100644
--- a/integration-tests/acp-integration.test.ts
+++ b/integration-tests/acp-integration.test.ts
@@ -648,6 +648,101 @@ function setupAcpTest(
}
});
+ it('blocks write tools in plan mode (issue #1806)', async () => {
+ const rig = new TestRig();
+ rig.setup('acp plan mode enforcement');
+
+ const toolCallEvents: Array<{
+ toolName: string;
+ status: string;
+ error?: string;
+ }> = [];
+
+ const { sendRequest, cleanup, stderr, sessionUpdates } = setupAcpTest(rig, {
+ permissionHandler: () => ({ optionId: 'proceed_once' }),
+ });
+
+ try {
+ await sendRequest('initialize', {
+ protocolVersion: 1,
+ clientCapabilities: { fs: { readTextFile: true, writeTextFile: true } },
+ });
+ await sendRequest('authenticate', { methodId: 'openai' });
+
+ const newSession = (await sendRequest('session/new', {
+ cwd: rig.testDir!,
+ mcpServers: [],
+ })) as { sessionId: string };
+
+ // Set mode to 'plan'
+ const setModeResult = (await sendRequest('session/set_mode', {
+ sessionId: newSession.sessionId,
+ modeId: 'plan',
+ })) as { modeId: string };
+ expect(setModeResult.modeId).toBe('plan');
+
+ // Try to create a file - this should be blocked by plan mode
+ const promptResult = await sendRequest('session/prompt', {
+ sessionId: newSession.sessionId,
+ prompt: [
+ {
+ type: 'text',
+ text: 'Create a file called test.txt with content "Hello World"',
+ },
+ ],
+ });
+ expect(promptResult).toBeDefined();
+
+ // Give time for tool calls to be processed
+ await delay(2000);
+
+ // Collect tool call events from session updates
+ sessionUpdates.forEach((update) => {
+ if (update.update?.sessionUpdate === 'tool_call_update') {
+ const toolUpdate = update.update as {
+ sessionUpdate: string;
+ toolName?: string;
+ status?: string;
+ error?: { message?: string };
+ };
+ if (toolUpdate.toolName) {
+ toolCallEvents.push({
+ toolName: toolUpdate.toolName,
+ status: toolUpdate.status ?? 'unknown',
+ error: toolUpdate.error?.message,
+ });
+ }
+ }
+ });
+
+ // Verify that if write_file was attempted, it was blocked
+ const writeFileEvents = toolCallEvents.filter(
+ (e) => e.toolName === 'write_file',
+ );
+
+ // If the LLM tried to call write_file in plan mode, it should have been blocked
+ if (writeFileEvents.length > 0) {
+ const blockedEvent = writeFileEvents.find(
+ (e) => e.status === 'error' && e.error?.includes('Plan mode'),
+ );
+ expect(blockedEvent).toBeDefined();
+ expect(blockedEvent?.error).toContain('Plan mode is active');
+ }
+
+ // Verify the file was NOT created
+ const fs = await import('fs');
+ const path = await import('path');
+ const testFilePath = path.join(rig.testDir!, 'test.txt');
+ const fileExists = fs.existsSync(testFilePath);
+ expect(fileExists).toBe(false);
+ } catch (e) {
+ if (stderr.length) console.error('Agent stderr:', stderr.join(''));
+ throw e;
+ } finally {
+ await cleanup();
+ }
+ });
+
it('receives usage metadata in agent_message_chunk updates', async () => {
const rig = new TestRig();
rig.setup('acp usage metadata');
diff --git a/integration-tests/concurrent-runner/config.example.json b/integration-tests/concurrent-runner/config.example.json
index 7042e7eb6..f1937fe07 100644
--- a/integration-tests/concurrent-runner/config.example.json
+++ b/integration-tests/concurrent-runner/config.example.json
@@ -31,5 +31,9 @@
]
}
],
- "models": ["claude-3-5-sonnet-20241022", "qwen3-coder-plus"]
+ "models": [
+ "qwen3-coder-plus",
+ { "name": "glm-4.7", "auth_type": "anthropic" },
+ { "name": "claude-4-5-sonnet-20260219", "auth_type": "anthropic" }
+ ]
}
diff --git a/integration-tests/concurrent-runner/runner.py b/integration-tests/concurrent-runner/runner.py
index c27a221e0..6eb2b8e0f 100644
--- a/integration-tests/concurrent-runner/runner.py
+++ b/integration-tests/concurrent-runner/runner.py
@@ -50,11 +50,18 @@ class Task:
prompts: List[str]
+@dataclass
+class ModelSpec:
+ """One model to run: name and optional auth_type (e.g. anthropic)."""
+ name: str
+ auth_type: Optional[str] = None
+
+
@dataclass
class RunConfig:
"""Configuration for the concurrent execution."""
tasks: List[Task]
- models: List[str]
+ models: List[ModelSpec] # name + optional auth_type per model
concurrency: int = 4
yolo: bool = True
source_repo: Path = field(default_factory=lambda: Path.cwd())
@@ -84,6 +91,7 @@ class RunRecord:
task_name: str
model: str
status: RunStatus
+ auth_type: Optional[str] = None # e.g. "anthropic" for qwen --auth-type
worktree_path: Optional[str] = None
output_dir: Optional[str] = None
logs_dir: Optional[str] = None
@@ -104,6 +112,7 @@ class RunRecord:
"task_name": self.task_name,
"model": self.model,
"status": self.status.value,
+ "auth_type": self.auth_type,
"worktree_path": self.worktree_path,
"output_dir": self.output_dir,
"logs_dir": self.logs_dir,
@@ -136,6 +145,7 @@ class RunRecord:
task_name=data["task_name"],
model=data["model"],
status=RunStatus(data["status"]),
+ auth_type=data.get("auth_type"),
worktree_path=data.get("worktree_path"),
output_dir=data.get("output_dir"),
logs_dir=data.get("logs_dir"),
@@ -806,6 +816,10 @@ class QwenRunner:
# Add model
cmd.extend(["--model", run.model])
+ # Add auth-type when model uses non-OpenAI protocol (e.g. anthropic for glm-4.7)
+ if run.auth_type:
+ cmd.extend(["--auth-type", run.auth_type])
+
# Add yolo if enabled
if self.config.yolo:
cmd.append("--yolo")
@@ -829,27 +843,41 @@ def generate_run_matrix(config: RunConfig) -> List[RunRecord]:
runs = []
for task in config.tasks:
for model in config.models:
- run_id = str(uuid.uuid4())[:8]
runs.append(RunRecord(
- run_id=run_id,
+ run_id=str(uuid.uuid4())[:8],
task_id=task.id,
task_name=task.name,
- model=model,
+ model=model.name,
status=RunStatus.QUEUED,
+ auth_type=model.auth_type,
))
return runs
+def _parse_models(data_models: List[Any]) -> List[ModelSpec]:
+ """Parse models: string or {name, auth_type/authType}; returns list of ModelSpec."""
+ specs: List[ModelSpec] = []
+ for item in data_models or []:
+ if isinstance(item, str):
+ name, auth = item, None
+ elif isinstance(item, dict) and item.get("name"):
+ name = item["name"]
+ auth = item.get("auth_type") or item.get("authType")
+ else:
+ continue
+ specs.append(ModelSpec(name=name, auth_type=auth))
+ return specs
+
+
def load_config(config_path: Path) -> RunConfig:
"""Load configuration from JSON file."""
with open(config_path, 'r') as f:
data = json.load(f)
-
tasks = [Task(**t) for t in data.get("tasks", [])]
-
+ models = _parse_models(data.get("models", []))
return RunConfig(
tasks=tasks,
- models=data.get("models", []),
+ models=models,
concurrency=data.get("concurrency", 4),
yolo=data.get("yolo", True),
source_repo=Path(data.get("source_repo", ".")).resolve(),
diff --git a/integration-tests/sdk-typescript/session-id.test.ts b/integration-tests/sdk-typescript/session-id.test.ts
index 6b9136503..7a2ab435d 100644
--- a/integration-tests/sdk-typescript/session-id.test.ts
+++ b/integration-tests/sdk-typescript/session-id.test.ts
@@ -377,8 +377,8 @@ describe('Session ID Support (E2E)', () => {
describe('Session ID Duplicate Detection', () => {
it('should reject duplicate sessionId with error', async () => {
- // Valid UUID v4
- const customSessionId = 'dddddddd-eeee-4fff-aaaa-bbbbbbbbbbbb';
+ // Generate a unique UUID for this test
+ const customSessionId = crypto.randomUUID();
// First query: create a session with the custom session ID
const q1 = query({
@@ -387,7 +387,9 @@ describe('Session ID Support (E2E)', () => {
...SHARED_TEST_OPTIONS,
cwd: testDir,
sessionId: customSessionId,
- debug: false,
+ env: {
+ SANDBOX_SET_UID_GID: 'true',
+ },
},
});
@@ -409,7 +411,9 @@ describe('Session ID Support (E2E)', () => {
...SHARED_TEST_OPTIONS,
cwd: testDir,
sessionId: customSessionId,
- debug: false,
+ env: {
+ SANDBOX_SET_UID_GID: 'true',
+ },
},
});
@@ -426,8 +430,8 @@ describe('Session ID Support (E2E)', () => {
});
it('should throw error when CLI exits with non-zero code', async () => {
- // Valid UUID v4
- const customSessionId = 'eeeeeeee-ffff-4aaa-bbbb-cccccccccccc';
+ // Generate a unique UUID for this test
+ const customSessionId = crypto.randomUUID();
// First query: create a session and properly close it after completion
const q1 = query({
@@ -436,7 +440,9 @@ describe('Session ID Support (E2E)', () => {
...SHARED_TEST_OPTIONS,
cwd: testDir,
sessionId: customSessionId,
- debug: false,
+ env: {
+ SANDBOX_SET_UID_GID: 'true',
+ },
},
});
@@ -456,7 +462,9 @@ describe('Session ID Support (E2E)', () => {
...SHARED_TEST_OPTIONS,
cwd: testDir,
sessionId: customSessionId,
- debug: false,
+ env: {
+ SANDBOX_SET_UID_GID: 'true',
+ },
},
});
diff --git a/package-lock.json b/package-lock.json
index 9a49d849e..5a2359a5d 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "@qwen-code/qwen-code",
- "version": "0.10.1",
+ "version": "0.10.5",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@qwen-code/qwen-code",
- "version": "0.10.1",
+ "version": "0.10.5",
"workspaces": [
"packages/*"
],
@@ -3834,6 +3834,119 @@
"node": ">=6"
}
},
+ "node_modules/@teddyzhu/clipboard": {
+ "version": "0.0.5",
+ "resolved": "https://registry.npmjs.org/@teddyzhu/clipboard/-/clipboard-0.0.5.tgz",
+ "integrity": "sha512-XA6MG7nLPZzj51agCwDYaVnVVrt0ByJ3G9rl3ar6N4GETAjUKKup6u76SLp2C5yHRWYV9hwMYDn04OGLar0MVg==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 10.16.0 < 11 || >= 11.8.0 < 12 || >= 12.0.0"
+ },
+ "optionalDependencies": {
+ "@teddyzhu/clipboard-darwin-arm64": "0.0.5",
+ "@teddyzhu/clipboard-darwin-x64": "0.0.5",
+ "@teddyzhu/clipboard-linux-arm64-gnu": "0.0.5",
+ "@teddyzhu/clipboard-linux-x64-gnu": "0.0.5",
+ "@teddyzhu/clipboard-win32-arm64-msvc": "0.0.5",
+ "@teddyzhu/clipboard-win32-x64-msvc": "0.0.5"
+ }
+ },
+ "node_modules/@teddyzhu/clipboard-darwin-arm64": {
+ "version": "0.0.5",
+ "resolved": "https://registry.npmjs.org/@teddyzhu/clipboard-darwin-arm64/-/clipboard-darwin-arm64-0.0.5.tgz",
+ "integrity": "sha512-FB3yykRAcw0VLmSjIGFddgew2t20UnLp80NZvi5e/lbsy/3mruHibMHkxHWqzCncuZsHdRsRXS/FmR/ggepW9A==",
+ "cpu": [
+ "arm64"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": ">= 10.16.0 < 11 || >= 11.8.0 < 12 || >= 12.0.0"
+ }
+ },
+ "node_modules/@teddyzhu/clipboard-darwin-x64": {
+ "version": "0.0.5",
+ "resolved": "https://registry.npmjs.org/@teddyzhu/clipboard-darwin-x64/-/clipboard-darwin-x64-0.0.5.tgz",
+ "integrity": "sha512-tiDazMpLf2dS7BZUif3da3DLJima8E/CnexB3CNgjQf12CFJ+D1cPcj/CgfvMYZgFQSsYyACpQNfXn4hmVbymA==",
+ "cpu": [
+ "x64"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": ">= 10.16.0 < 11 || >= 11.8.0 < 12 || >= 12.0.0"
+ }
+ },
+ "node_modules/@teddyzhu/clipboard-linux-arm64-gnu": {
+ "version": "0.0.5",
+ "resolved": "https://registry.npmjs.org/@teddyzhu/clipboard-linux-arm64-gnu/-/clipboard-linux-arm64-gnu-0.0.5.tgz",
+ "integrity": "sha512-qcokM+BaXn4iG4o4nYGHdfC04pr54S2F7x2o5osFhG3hMVYHZLR/8NKcYDKELnebpH612nW2bNRoWWy14lM45g==",
+ "cpu": [
+ "arm64"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">= 10.16.0 < 11 || >= 11.8.0 < 12 || >= 12.0.0"
+ }
+ },
+ "node_modules/@teddyzhu/clipboard-linux-x64-gnu": {
+ "version": "0.0.5",
+ "resolved": "https://registry.npmjs.org/@teddyzhu/clipboard-linux-x64-gnu/-/clipboard-linux-x64-gnu-0.0.5.tgz",
+ "integrity": "sha512-Ogh4zYM9s537WJszSvKrPAoKQZ2grnY7Xy6szyJp2+84uQKWNbvZkATODAsRUn48zr9gqL3PZeUqkIBaz8sCpQ==",
+ "cpu": [
+ "x64"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">= 10.16.0 < 11 || >= 11.8.0 < 12 || >= 12.0.0"
+ }
+ },
+ "node_modules/@teddyzhu/clipboard-win32-arm64-msvc": {
+ "version": "0.0.5",
+ "resolved": "https://registry.npmjs.org/@teddyzhu/clipboard-win32-arm64-msvc/-/clipboard-win32-arm64-msvc-0.0.5.tgz",
+ "integrity": "sha512-TuU+7e8qYc0T++sIArHTmqr+nfqiTfJ6gdrb1e8yDJb6MM3EFxCd2VonTqLQL1YpUdfcH+/rdMarG2rvCwvEhQ==",
+ "cpu": [
+ "arm64"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": ">= 10.16.0 < 11 || >= 11.8.0 < 12 || >= 12.0.0"
+ }
+ },
+ "node_modules/@teddyzhu/clipboard-win32-x64-msvc": {
+ "version": "0.0.5",
+ "resolved": "https://registry.npmjs.org/@teddyzhu/clipboard-win32-x64-msvc/-/clipboard-win32-x64-msvc-0.0.5.tgz",
+ "integrity": "sha512-f1Br5bI+INNDifjkOI1woZsIxsoW0rRej/4kaaJvZcMxxkSG9TMT2LYOjTF2g+DtXw32lsGvWICN6c3JiHeG7Q==",
+ "cpu": [
+ "x64"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": ">= 10.16.0 < 11 || >= 11.8.0 < 12 || >= 12.0.0"
+ }
+ },
"node_modules/@testing-library/dom": {
"version": "10.4.1",
"resolved": "https://registry.npmjs.org/@testing-library/dom/-/dom-10.4.1.tgz",
@@ -18655,12 +18768,13 @@
},
"packages/cli": {
"name": "@qwen-code/qwen-code",
- "version": "0.10.1",
+ "version": "0.10.5",
"dependencies": {
"@google/genai": "1.30.0",
"@iarna/toml": "^2.2.5",
"@modelcontextprotocol/sdk": "^1.25.1",
"@qwen-code/qwen-code-core": "file:../core",
+ "@teddyzhu/clipboard": "^0.0.5",
"@types/update-notifier": "^6.0.8",
"ansi-regex": "^6.2.2",
"command-exists": "^1.2.9",
@@ -19274,7 +19388,7 @@
},
"packages/core": {
"name": "@qwen-code/qwen-code-core",
- "version": "0.10.1",
+ "version": "0.10.5",
"hasInstallScript": true,
"dependencies": {
"@anthropic-ai/sdk": "^0.36.1",
@@ -22754,7 +22868,7 @@
},
"packages/test-utils": {
"name": "@qwen-code/qwen-code-test-utils",
- "version": "0.10.1",
+ "version": "0.10.5",
"dev": true,
"license": "Apache-2.0",
"devDependencies": {
@@ -22766,7 +22880,7 @@
},
"packages/vscode-ide-companion": {
"name": "qwen-code-vscode-ide-companion",
- "version": "0.10.1",
+ "version": "0.10.5",
"license": "LICENSE",
"dependencies": {
"@modelcontextprotocol/sdk": "^1.25.1",
@@ -23013,7 +23127,7 @@
},
"packages/webui": {
"name": "@qwen-code/webui",
- "version": "0.10.1",
+ "version": "0.10.5",
"license": "MIT",
"dependencies": {
"markdown-it": "^14.1.0"
diff --git a/package.json b/package.json
index 1605e1aeb..f6b3fa51c 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "@qwen-code/qwen-code",
- "version": "0.10.1",
+ "version": "0.10.5",
"engines": {
"node": ">=20.0.0"
},
@@ -13,7 +13,7 @@
"url": "git+https://github.com/QwenLM/qwen-code.git"
},
"config": {
- "sandboxImageUri": "ghcr.io/qwenlm/qwen-code:0.10.1"
+ "sandboxImageUri": "ghcr.io/qwenlm/qwen-code:0.10.5"
},
"scripts": {
"start": "cross-env node scripts/start.js",
diff --git a/packages/cli/package.json b/packages/cli/package.json
index 7ec5da972..153a51376 100644
--- a/packages/cli/package.json
+++ b/packages/cli/package.json
@@ -1,6 +1,6 @@
{
"name": "@qwen-code/qwen-code",
- "version": "0.10.1",
+ "version": "0.10.5",
"description": "Qwen Code",
"repository": {
"type": "git",
@@ -34,7 +34,7 @@
"dist"
],
"config": {
- "sandboxImageUri": "ghcr.io/qwenlm/qwen-code:0.10.1"
+ "sandboxImageUri": "ghcr.io/qwenlm/qwen-code:0.10.5"
},
"dependencies": {
"@google/genai": "1.30.0",
@@ -81,12 +81,12 @@
"@types/diff": "^7.0.2",
"@types/dotenv": "^6.1.1",
"@types/node": "^20.11.24",
+ "@types/prompts": "^2.4.9",
"@types/react": "^19.1.8",
"@types/react-dom": "^19.1.6",
"@types/semver": "^7.7.0",
"@types/shell-quote": "^1.7.5",
"@types/yargs": "^17.0.32",
- "@types/prompts": "^2.4.9",
"archiver": "^7.0.1",
"ink-testing-library": "^4.0.0",
"jsdom": "^26.1.0",
@@ -95,6 +95,15 @@
"typescript": "^5.3.3",
"vitest": "^3.1.1"
},
+ "optionalDependencies": {
+ "@teddyzhu/clipboard": "^0.0.5",
+ "@teddyzhu/clipboard-darwin-arm64": "0.0.5",
+ "@teddyzhu/clipboard-darwin-x64": "0.0.5",
+ "@teddyzhu/clipboard-linux-x64-gnu": "0.0.5",
+ "@teddyzhu/clipboard-linux-arm64-gnu": "0.0.5",
+ "@teddyzhu/clipboard-win32-x64-msvc": "0.0.5",
+ "@teddyzhu/clipboard-win32-arm64-msvc": "0.0.5"
+ },
"engines": {
"node": ">=20"
}
diff --git a/packages/cli/src/acp-integration/service/filesystem.ts b/packages/cli/src/acp-integration/service/filesystem.ts
index 17a0cdbcf..2afae0457 100644
--- a/packages/cli/src/acp-integration/service/filesystem.ts
+++ b/packages/cli/src/acp-integration/service/filesystem.ts
@@ -84,7 +84,8 @@ export class AcpFileSystemService implements FileSystemService {
limit: 1,
});
// Check if content starts with BOM character (U+FEFF)
- return response.content.charCodeAt(0) === 0xfeff;
+ // Use codePointAt for better Unicode support and check content length first
+ return response.content.length > 0 && response.content.codePointAt(0) === 0xfeff;
} catch {
// Fall through to fallback if ACP read fails
}
diff --git a/packages/cli/src/acp-integration/session/Session.ts b/packages/cli/src/acp-integration/session/Session.ts
index d7a5e7395..702f66a07 100644
--- a/packages/cli/src/acp-integration/session/Session.ts
+++ b/packages/cli/src/acp-integration/session/Session.ts
@@ -516,6 +516,18 @@ export class Session implements SessionContext {
? await invocation.shouldConfirmExecute(abortSignal)
: false;
+ // Check for plan mode enforcement - block non-read-only tools
+ const isPlanMode = this.config.getApprovalMode() === ApprovalMode.PLAN;
+ if (isPlanMode && !isExitPlanModeTool && confirmationDetails) {
+ // In plan mode, block any tool that requires confirmation (write operations)
+ return errorResponse(
+ new Error(
+ `Plan mode is active. The tool "${fc.name}" cannot be executed because it modifies the system. ` +
+ 'Please use the exit_plan_mode tool to present your plan and exit plan mode before making changes.',
+ ),
+ );
+ }
+
if (confirmationDetails) {
const content: acp.ToolCallContent[] = [];
diff --git a/packages/cli/src/config/keyBindings.ts b/packages/cli/src/config/keyBindings.ts
index 8737866ea..226727c5b 100644
--- a/packages/cli/src/config/keyBindings.ts
+++ b/packages/cli/src/config/keyBindings.ts
@@ -78,6 +78,7 @@ export interface KeyBinding {
command?: boolean;
/** Paste operation requirement: true=must be paste, false=must not be paste, undefined=ignore */
paste?: boolean;
+ meta?: boolean;
}
/**
@@ -152,7 +153,16 @@ export const defaultKeyBindings: KeyBindingConfig = {
{ key: 'x', ctrl: true },
{ sequence: '\x18', ctrl: true },
],
- [Command.PASTE_CLIPBOARD_IMAGE]: [{ key: 'v', ctrl: true }],
+ [Command.PASTE_CLIPBOARD_IMAGE]:
+ process.platform === 'win32'
+ ? [
+ { key: 'v', command: true },
+ { key: 'v', meta: true },
+ ]
+ : [
+ { key: 'v', ctrl: true },
+ { key: 'v', command: true },
+ ],
// App level bindings
[Command.TOGGLE_TOOL_DESCRIPTIONS]: [{ key: 't', ctrl: true }],
diff --git a/packages/cli/src/constants/codingPlan.ts b/packages/cli/src/constants/codingPlan.ts
index e55aeb93d..72e7fc1b0 100644
--- a/packages/cli/src/constants/codingPlan.ts
+++ b/packages/cli/src/constants/codingPlan.ts
@@ -7,6 +7,14 @@
import { createHash } from 'node:crypto';
import type { ProviderModelConfig as ModelConfig } from '@qwen-code/qwen-code-core';
+/**
+ * Coding plan regions
+ */
+export enum CodingPlanRegion {
+ CHINA = 'china',
+ GLOBAL = 'global',
+}
+
/**
* Coding plan template - array of model configurations
* When user provides an api-key, these configs will be cloned with envKey pointing to the stored api-key
@@ -14,48 +22,282 @@ import type { ProviderModelConfig as ModelConfig } from '@qwen-code/qwen-code-co
export type CodingPlanTemplate = ModelConfig[];
/**
- * Environment variable key for storing the coding plan API key
+ * Environment variable key for storing the coding plan API key.
+ * Unified key for both regions since they are mutually exclusive.
*/
export const CODING_PLAN_ENV_KEY = 'BAILIAN_CODING_PLAN_API_KEY';
-/**
- * CODING_PLAN_MODELS defines the model configurations for coding-plan mode.
- */
-export const CODING_PLAN_MODELS: CodingPlanTemplate = [
- {
- id: 'qwen3-coder-plus',
- name: 'qwen3-coder-plus',
- baseUrl: 'https://coding.dashscope.aliyuncs.com/v1',
- description: 'qwen3-coder-plus model from Bailian Coding Plan',
- envKey: CODING_PLAN_ENV_KEY,
- },
- {
- id: 'qwen3-max-2026-01-23',
- name: 'qwen3-max-2026-01-23',
- description:
- 'qwen3-max model with thinking enabled from Bailian Coding Plan',
- baseUrl: 'https://coding.dashscope.aliyuncs.com/v1',
- envKey: CODING_PLAN_ENV_KEY,
- generationConfig: {
- extra_body: {
- enable_thinking: true,
- },
- },
- },
-];
-
/**
* Computes the version hash for the coding plan template.
* Uses SHA256 of the JSON-serialized template for deterministic versioning.
+ * @param template - The template to compute version for
* @returns Hexadecimal string representing the template version
*/
-export function computeCodingPlanVersion(): string {
- const templateString = JSON.stringify(CODING_PLAN_MODELS);
+export function computeCodingPlanVersion(template: CodingPlanTemplate): string {
+ const templateString = JSON.stringify(template);
return createHash('sha256').update(templateString).digest('hex');
}
/**
- * Current version of the coding plan template.
- * Computed at runtime from the template content.
+ * Generate the complete coding plan template for a specific region.
+ * China region uses legacy description to maintain backward compatibility.
+ * Global region uses new description with region indicator.
+ * @param region - The region to generate template for
+ * @returns Complete model configuration array for the region
*/
-export const CODING_PLAN_VERSION = computeCodingPlanVersion();
+export function generateCodingPlanTemplate(
+ region: CodingPlanRegion,
+): CodingPlanTemplate {
+ if (region === CodingPlanRegion.CHINA) {
+ // China region uses legacy fields to maintain backward compatibility
+ // This ensures existing users don't get prompted for unnecessary updates
+ return [
+ {
+ id: 'qwen3.5-plus',
+ name: '[Bailian Coding Plan] qwen3.5-plus',
+ baseUrl: 'https://coding.dashscope.aliyuncs.com/v1',
+ envKey: CODING_PLAN_ENV_KEY,
+ generationConfig: {
+ extra_body: {
+ enable_thinking: true,
+ },
+ },
+ },
+ {
+ id: 'qwen3-coder-plus',
+ name: '[Bailian Coding Plan] qwen3-coder-plus',
+ baseUrl: 'https://coding.dashscope.aliyuncs.com/v1',
+ envKey: CODING_PLAN_ENV_KEY,
+ },
+ {
+ id: 'qwen3-coder-next',
+ name: '[Bailian Coding Plan] qwen3-coder-next',
+ baseUrl: 'https://coding.dashscope.aliyuncs.com/v1',
+ envKey: CODING_PLAN_ENV_KEY,
+ },
+ {
+ id: 'qwen3-max-2026-01-23',
+ name: '[Bailian Coding Plan] qwen3-max-2026-01-23',
+ baseUrl: 'https://coding.dashscope.aliyuncs.com/v1',
+ envKey: CODING_PLAN_ENV_KEY,
+ generationConfig: {
+ extra_body: {
+ enable_thinking: true,
+ },
+ },
+ },
+ {
+ id: 'glm-4.7',
+ name: '[Bailian Coding Plan] glm-4.7',
+ baseUrl: 'https://coding.dashscope.aliyuncs.com/v1',
+ envKey: CODING_PLAN_ENV_KEY,
+ generationConfig: {
+ extra_body: {
+ enable_thinking: true,
+ },
+ },
+ },
+ {
+ id: 'glm-5',
+ name: '[Bailian Coding Plan] glm-5',
+ baseUrl: 'https://coding.dashscope.aliyuncs.com/v1',
+ envKey: CODING_PLAN_ENV_KEY,
+ generationConfig: {
+ extra_body: {
+ enable_thinking: true,
+ },
+ },
+ },
+ {
+ id: 'MiniMax-M2.5',
+ name: '[Bailian Coding Plan] MiniMax-M2.5',
+ baseUrl: 'https://coding.dashscope.aliyuncs.com/v1',
+ envKey: CODING_PLAN_ENV_KEY,
+ generationConfig: {
+ extra_body: {
+ enable_thinking: true,
+ },
+ },
+ },
+ {
+ id: 'kimi-k2.5',
+ name: '[Bailian Coding Plan] kimi-k2.5',
+ baseUrl: 'https://coding.dashscope.aliyuncs.com/v1',
+ envKey: CODING_PLAN_ENV_KEY,
+ generationConfig: {
+ extra_body: {
+ enable_thinking: true,
+ },
+ },
+ },
+ ];
+ }
+
+ // Global region uses Bailian Coding Plan branding for Global/Intl
+ return [
+ {
+ id: 'qwen3.5-plus',
+ name: '[Bailian Coding Plan for Global/Intl] qwen3.5-plus',
+ baseUrl: 'https://coding-intl.dashscope.aliyuncs.com/v1',
+ envKey: CODING_PLAN_ENV_KEY,
+ generationConfig: {
+ extra_body: {
+ enable_thinking: true,
+ },
+ },
+ },
+ {
+ id: 'qwen3-coder-plus',
+ name: '[Bailian Coding Plan for Global/Intl] qwen3-coder-plus',
+ baseUrl: 'https://coding-intl.dashscope.aliyuncs.com/v1',
+ envKey: CODING_PLAN_ENV_KEY,
+ },
+ {
+ id: 'qwen3-coder-next',
+ name: '[Bailian Coding Plan for Global/Intl] qwen3-coder-next',
+ baseUrl: 'https://coding-intl.dashscope.aliyuncs.com/v1',
+ envKey: CODING_PLAN_ENV_KEY,
+ },
+ {
+ id: 'qwen3-max-2026-01-23',
+ name: '[Bailian Coding Plan for Global/Intl] qwen3-max-2026-01-23',
+ baseUrl: 'https://coding-intl.dashscope.aliyuncs.com/v1',
+ envKey: CODING_PLAN_ENV_KEY,
+ generationConfig: {
+ extra_body: {
+ enable_thinking: true,
+ },
+ },
+ },
+ {
+ id: 'glm-4.7',
+ name: '[Bailian Coding Plan for Global/Intl] glm-4.7',
+ baseUrl: 'https://coding-intl.dashscope.aliyuncs.com/v1',
+ envKey: CODING_PLAN_ENV_KEY,
+ generationConfig: {
+ extra_body: {
+ enable_thinking: true,
+ },
+ },
+ },
+ {
+ id: 'glm-5',
+ name: '[Bailian Coding Plan for Global/Intl] glm-5',
+ baseUrl: 'https://coding-intl.dashscope.aliyuncs.com/v1',
+ envKey: CODING_PLAN_ENV_KEY,
+ generationConfig: {
+ extra_body: {
+ enable_thinking: true,
+ },
+ },
+ },
+ {
+ id: 'MiniMax-M2.5',
+ name: '[Bailian Coding Plan for Global/Intl] MiniMax-M2.5',
+ baseUrl: 'https://coding-intl.dashscope.aliyuncs.com/v1',
+ envKey: CODING_PLAN_ENV_KEY,
+ generationConfig: {
+ extra_body: {
+ enable_thinking: true,
+ },
+ },
+ },
+ {
+ id: 'kimi-k2.5',
+ name: '[Bailian Coding Plan for Global/Intl] kimi-k2.5',
+ baseUrl: 'https://coding-intl.dashscope.aliyuncs.com/v1',
+ envKey: CODING_PLAN_ENV_KEY,
+ generationConfig: {
+ extra_body: {
+ enable_thinking: true,
+ },
+ },
+ },
+ ];
+}
+
+/**
+ * Get the complete configuration for a specific region.
+ * @param region - The region to use
+ * @returns Object containing template, baseUrl, and version
+ */
+export function getCodingPlanConfig(region: CodingPlanRegion) {
+ const template = generateCodingPlanTemplate(region);
+ const baseUrl =
+ region === CodingPlanRegion.CHINA
+ ? 'https://coding.dashscope.aliyuncs.com/v1'
+ : 'https://coding-intl.dashscope.aliyuncs.com/v1';
+ const regionName =
+ region === CodingPlanRegion.CHINA
+ ? 'Coding Plan (Bailian, China)'
+ : 'Coding Plan (Bailian, Global/Intl)';
+
+ return {
+ template,
+ baseUrl,
+ regionName,
+ version: computeCodingPlanVersion(template),
+ };
+}
+
+/**
+ * Get all unique base URLs for coding plan (used for filtering/config detection).
+ * @returns Array of base URLs
+ */
+export function getCodingPlanBaseUrls(): string[] {
+ return [
+ 'https://coding.dashscope.aliyuncs.com/v1',
+ 'https://coding-intl.dashscope.aliyuncs.com/v1',
+ ];
+}
+
+/**
+ * Check if a config belongs to Coding Plan (any region).
+ * Returns the region if matched, or false if not a Coding Plan config.
+ * @param baseUrl - The baseUrl to check
+ * @param envKey - The envKey to check
+ * @returns The region if matched, false otherwise
+ */
+export function isCodingPlanConfig(
+ baseUrl: string | undefined,
+ envKey: string | undefined,
+): CodingPlanRegion | false {
+ if (!baseUrl || !envKey) {
+ return false;
+ }
+
+ // Must use the unified envKey
+ if (envKey !== CODING_PLAN_ENV_KEY) {
+ return false;
+ }
+
+ // Check which region's baseUrl matches
+ if (baseUrl === 'https://coding.dashscope.aliyuncs.com/v1') {
+ return CodingPlanRegion.CHINA;
+ }
+ if (baseUrl === 'https://coding-intl.dashscope.aliyuncs.com/v1') {
+ return CodingPlanRegion.GLOBAL;
+ }
+
+ return false;
+}
+
+/**
+ * Get region from baseUrl.
+ * @param baseUrl - The baseUrl to check
+ * @returns The region if matched, null otherwise
+ */
+export function getRegionFromBaseUrl(
+ baseUrl: string | undefined,
+): CodingPlanRegion | null {
+ if (!baseUrl) return null;
+
+ if (baseUrl === 'https://coding.dashscope.aliyuncs.com/v1') {
+ return CodingPlanRegion.CHINA;
+ }
+ if (baseUrl === 'https://coding-intl.dashscope.aliyuncs.com/v1') {
+ return CodingPlanRegion.GLOBAL;
+ }
+
+ return null;
+}
diff --git a/packages/cli/src/i18n/locales/de.js b/packages/cli/src/i18n/locales/de.js
index 5757b135f..431b70910 100644
--- a/packages/cli/src/i18n/locales/de.js
+++ b/packages/cli/src/i18n/locales/de.js
@@ -11,6 +11,12 @@ export default {
// ============================================================================
// Help / UI Components
// ============================================================================
+ // Attachment hints
+ '↑ to manage attachments': '↑ Anhänge verwalten',
+ '← → select, Delete to remove, ↓ to exit':
+ '← → auswählen, Entf zum Löschen, ↓ beenden',
+ 'Attachments: ': 'Anhänge: ',
+
'Basics:': 'Grundlagen:',
'Add context': 'Kontext hinzufügen',
'Use {{symbol}} to specify files for context (e.g., {{example}}) to target specific files or folders.':
@@ -1030,8 +1036,8 @@ export default {
'(not set)': '(nicht gesetzt)',
"Failed to switch model to '{{modelId}}'.\n\n{{error}}":
"Modell konnte nicht auf '{{modelId}}' umgestellt werden.\n\n{{error}}",
- 'The latest Qwen Coder model from Alibaba Cloud ModelStudio (version: qwen3-coder-plus-2025-09-23)':
- 'Das neueste Qwen Coder Modell von Alibaba Cloud ModelStudio (Version: qwen3-coder-plus-2025-09-23)',
+ 'Qwen 3.5 Plus — efficient hybrid model with leading coding performance':
+ 'Qwen 3.5 Plus — effizientes Hybridmodell mit führender Programmierleistung',
'The latest Qwen Vision model from Alibaba Cloud ModelStudio (version: qwen3-vl-plus-2025-09-23)':
'Das neueste Qwen Vision Modell von Alibaba Cloud ModelStudio (Version: qwen3-vl-plus-2025-09-23)',
@@ -1417,8 +1423,12 @@ export default {
// Auth Dialog - View Titles and Labels
// ============================================================================
'Coding Plan': 'Coding Plan',
+ 'Coding Plan (Bailian, China)': 'Coding Plan (Bailian, China)',
+ 'Coding Plan (Bailian, Global/Intl)': 'Coding Plan (Bailian, Global/Intl)',
"Paste your api key of Bailian Coding Plan and you're all set!":
'Fügen Sie Ihren Bailian Coding Plan API-Schlüssel ein und Sie sind bereit!',
+ "Paste your api key of Coding Plan (Bailian, Global/Intl) and you're all set!":
+ 'Fügen Sie Ihren Coding Plan (Bailian, Global/Intl) API-Schlüssel ein und Sie sind bereit!',
Custom: 'Benutzerdefiniert',
'More instructions about configuring `modelProviders` manually.':
'Weitere Anweisungen zur manuellen Konfiguration von `modelProviders`.',
@@ -1428,4 +1438,18 @@ export default {
'(Press Enter to submit, Escape to cancel)':
'(Enter zum Absenden, Escape zum Abbrechen)',
'More instructions please check:': 'Weitere Anweisungen finden Sie unter:',
+
+ // ============================================================================
+ // Coding Plan International Updates
+ // ============================================================================
+ 'New model configurations are available for {{region}}. Update now?':
+ 'Neue Modellkonfigurationen sind für {{region}} verfügbar. Jetzt aktualisieren?',
+ 'New model configurations are available for Bailian Coding Plan (China). Update now?':
+ 'Neue Modellkonfigurationen sind für Bailian Coding Plan (China) verfügbar. Jetzt aktualisieren?',
+ 'New model configurations are available for Coding Plan (Bailian, Global/Intl). Update now?':
+ 'Neue Modellkonfigurationen sind für Coding Plan (Bailian, Global/Intl) verfügbar. Jetzt aktualisieren?',
+ '{{region}} configuration updated successfully. Model switched to "{{model}}".':
+ '{{region}}-Konfiguration erfolgreich aktualisiert. Modell auf "{{model}}" umgeschaltet.',
+ 'Authenticated successfully with {{region}}. API key is stored in settings.env.':
+ 'Erfolgreich mit {{region}} authentifiziert. API-Schlüssel ist in settings.env gespeichert.',
};
diff --git a/packages/cli/src/i18n/locales/en.js b/packages/cli/src/i18n/locales/en.js
index aaa18b0e1..775f470b7 100644
--- a/packages/cli/src/i18n/locales/en.js
+++ b/packages/cli/src/i18n/locales/en.js
@@ -11,6 +11,12 @@ export default {
// ============================================================================
// Help / UI Components
// ============================================================================
+ // Attachment hints
+ '↑ to manage attachments': '↑ to manage attachments',
+ '← → select, Delete to remove, ↓ to exit':
+ '← → select, Delete to remove, ↓ to exit',
+ 'Attachments: ': 'Attachments: ',
+
'Basics:': 'Basics:',
'Add context': 'Add context',
'Use {{symbol}} to specify files for context (e.g., {{example}}) to target specific files or folders.':
@@ -1017,8 +1023,8 @@ export default {
'(not set)': '(not set)',
"Failed to switch model to '{{modelId}}'.\n\n{{error}}":
"Failed to switch model to '{{modelId}}'.\n\n{{error}}",
- 'The latest Qwen Coder model from Alibaba Cloud ModelStudio (version: qwen3-coder-plus-2025-09-23)':
- 'The latest Qwen Coder model from Alibaba Cloud ModelStudio (version: qwen3-coder-plus-2025-09-23)',
+ 'Qwen 3.5 Plus — efficient hybrid model with leading coding performance':
+ 'Qwen 3.5 Plus — efficient hybrid model with leading coding performance',
'The latest Qwen Vision model from Alibaba Cloud ModelStudio (version: qwen3-vl-plus-2025-09-23)':
'The latest Qwen Vision model from Alibaba Cloud ModelStudio (version: qwen3-vl-plus-2025-09-23)',
@@ -1418,8 +1424,12 @@ export default {
// Auth Dialog - View Titles and Labels
// ============================================================================
'Coding Plan': 'Coding Plan',
+ 'Coding Plan (Bailian, China)': 'Coding Plan (Bailian, China)',
+ 'Coding Plan (Bailian, Global/Intl)': 'Coding Plan (Bailian, Global/Intl)',
"Paste your api key of Bailian Coding Plan and you're all set!":
"Paste your api key of Bailian Coding Plan and you're all set!",
+ "Paste your api key of Coding Plan (Bailian, Global/Intl) and you're all set!":
+ "Paste your api key of Coding Plan (Bailian, Global/Intl) and you're all set!",
Custom: 'Custom',
'More instructions about configuring `modelProviders` manually.':
'More instructions about configuring `modelProviders` manually.',
@@ -1427,4 +1437,18 @@ export default {
'(Press Escape to go back)': '(Press Escape to go back)',
'(Press Enter to submit, Escape to cancel)':
'(Press Enter to submit, Escape to cancel)',
+
+ // ============================================================================
+ // Coding Plan International Updates
+ // ============================================================================
+ 'New model configurations are available for {{region}}. Update now?':
+ 'New model configurations are available for {{region}}. Update now?',
+ 'New model configurations are available for Bailian Coding Plan (China). Update now?':
+ 'New model configurations are available for Bailian Coding Plan (China). Update now?',
+ 'New model configurations are available for Coding Plan (Bailian, Global/Intl). Update now?':
+ 'New model configurations are available for Coding Plan (Bailian, Global/Intl). Update now?',
+ '{{region}} configuration updated successfully. Model switched to "{{model}}".':
+ '{{region}} configuration updated successfully. Model switched to "{{model}}".',
+ 'Authenticated successfully with {{region}}. API key is stored in settings.env.':
+ 'Authenticated successfully with {{region}}. API key is stored in settings.env.',
};
diff --git a/packages/cli/src/i18n/locales/ja.js b/packages/cli/src/i18n/locales/ja.js
index f9d95b34a..c00954858 100644
--- a/packages/cli/src/i18n/locales/ja.js
+++ b/packages/cli/src/i18n/locales/ja.js
@@ -731,8 +731,8 @@ export default {
// Dialogs - Model
'Select Model': 'モデルを選択',
'(Press Esc to close)': '(Esc で閉じる)',
- 'The latest Qwen Coder model from Alibaba Cloud ModelStudio (version: qwen3-coder-plus-2025-09-23)':
- 'Alibaba Cloud ModelStudioの最新Qwen Coderモデル(バージョン: qwen3-coder-plus-2025-09-23)',
+ 'Qwen 3.5 Plus — efficient hybrid model with leading coding performance':
+ 'Qwen 3.5 Plus — 効率的なハイブリッドモデル、業界トップクラスのコーディング性能',
'The latest Qwen Vision model from Alibaba Cloud ModelStudio (version: qwen3-vl-plus-2025-09-23)':
'Alibaba Cloud ModelStudioの最新Qwen Visionモデル(バージョン: qwen3-vl-plus-2025-09-23)',
// Dialogs - Permissions
@@ -928,8 +928,13 @@ export default {
// Auth Dialog - View Titles and Labels
// ============================================================================
'Coding Plan': 'Coding Plan',
+ 'Coding Plan (Bailian, China)': 'Coding Plan (Bailian, 中国)',
+ 'Coding Plan (Bailian, Global/Intl)':
+ 'Coding Plan (Bailian, グローバル/国際)',
"Paste your api key of Bailian Coding Plan and you're all set!":
'Bailian Coding PlanのAPIキーを貼り付けるだけで準備完了です!',
+ "Paste your api key of Coding Plan (Bailian, Global/Intl) and you're all set!":
+ 'Coding Plan (Bailian, グローバル/国際) のAPIキーを貼り付けるだけで準備完了です!',
Custom: 'カスタム',
'More instructions about configuring `modelProviders` manually.':
'`modelProviders`を手動で設定する方法の詳細はこちら。',
@@ -938,4 +943,18 @@ export default {
'(Press Enter to submit, Escape to cancel)':
'(Enterで送信、Escapeでキャンセル)',
'More instructions please check:': '詳細な手順はこちらをご確認ください:',
+
+ // ============================================================================
+ // Coding Plan International Updates
+ // ============================================================================
+ 'New model configurations are available for {{region}}. Update now?':
+ '{{region}} の新しいモデル設定が利用可能です。今すぐ更新しますか?',
+ 'New model configurations are available for Bailian Coding Plan (China). Update now?':
+ 'Bailian Coding Plan (中国) の新しいモデル設定が利用可能です。今すぐ更新しますか?',
+ 'New model configurations are available for Coding Plan (Bailian, Global/Intl). Update now?':
+ 'Coding Plan (Bailian, グローバル/国際) の新しいモデル設定が利用可能です。今すぐ更新しますか?',
+ '{{region}} configuration updated successfully. Model switched to "{{model}}".':
+ '{{region}} の設定が正常に更新されました。モデルが "{{model}}" に切り替わりました。',
+ 'Authenticated successfully with {{region}}. API key is stored in settings.env.':
+ '{{region}} での認証に成功しました。APIキーは settings.env に保存されています。',
};
diff --git a/packages/cli/src/i18n/locales/pt.js b/packages/cli/src/i18n/locales/pt.js
index 8613c3076..a6130b2fb 100644
--- a/packages/cli/src/i18n/locales/pt.js
+++ b/packages/cli/src/i18n/locales/pt.js
@@ -1039,8 +1039,8 @@ export default {
'(not set)': '(não definido)',
"Failed to switch model to '{{modelId}}'.\n\n{{error}}":
"Falha ao trocar o modelo para '{{modelId}}'.\n\n{{error}}",
- 'The latest Qwen Coder model from Alibaba Cloud ModelStudio (version: qwen3-coder-plus-2025-09-23)':
- 'O modelo Qwen Coder mais recente do Alibaba Cloud ModelStudio (versão: qwen3-coder-plus-2025-09-23)',
+ 'Qwen 3.5 Plus — efficient hybrid model with leading coding performance':
+ 'Qwen 3.5 Plus — modelo híbrido eficiente com desempenho líder em programação',
'The latest Qwen Vision model from Alibaba Cloud ModelStudio (version: qwen3-vl-plus-2025-09-23)':
'O modelo Qwen Vision mais recente do Alibaba Cloud ModelStudio (versão: qwen3-vl-plus-2025-09-23)',
@@ -1431,8 +1431,12 @@ export default {
// Auth Dialog - View Titles and Labels
// ============================================================================
'Coding Plan': 'Coding Plan',
+ 'Coding Plan (Bailian, China)': 'Coding Plan (Bailian, China)',
+ 'Coding Plan (Bailian, Global/Intl)': 'Coding Plan (Bailian, Global/Intl)',
"Paste your api key of Bailian Coding Plan and you're all set!":
'Cole sua chave de API do Bailian Coding Plan e pronto!',
+ "Paste your api key of Coding Plan (Bailian, Global/Intl) and you're all set!":
+ 'Cole sua chave de API do Coding Plan (Bailian, Global/Intl) e pronto!',
Custom: 'Personalizado',
'More instructions about configuring `modelProviders` manually.':
'Mais instruções sobre como configurar `modelProviders` manualmente.',
@@ -1442,4 +1446,18 @@ export default {
'(Press Enter to submit, Escape to cancel)':
'(Pressione Enter para enviar, Escape para cancelar)',
'More instructions please check:': 'Mais instruções, consulte:',
+
+ // ============================================================================
+ // Coding Plan International Updates
+ // ============================================================================
+ 'New model configurations are available for {{region}}. Update now?':
+ 'Novas configurações de modelo estão disponíveis para o {{region}}. Atualizar agora?',
+ 'New model configurations are available for Bailian Coding Plan (China). Update now?':
+ 'Novas configurações de modelo estão disponíveis para o Bailian Coding Plan (China). Atualizar agora?',
+ 'New model configurations are available for Coding Plan (Bailian, Global/Intl). Update now?':
+ 'Novas configurações de modelo estão disponíveis para o Coding Plan (Bailian, Global/Intl). Atualizar agora?',
+ '{{region}} configuration updated successfully. Model switched to "{{model}}".':
+ 'Configuração do {{region}} atualizada com sucesso. Modelo alterado para "{{model}}".',
+ 'Authenticated successfully with {{region}}. API key is stored in settings.env.':
+ 'Autenticado com sucesso com {{region}}. A chave de API está armazenada em settings.env.',
};
diff --git a/packages/cli/src/i18n/locales/ru.js b/packages/cli/src/i18n/locales/ru.js
index 92c9f8c50..a8299a762 100644
--- a/packages/cli/src/i18n/locales/ru.js
+++ b/packages/cli/src/i18n/locales/ru.js
@@ -11,6 +11,12 @@ export default {
// ============================================================================
// Справка / Компоненты интерфейса
// ============================================================================
+ // Attachment hints
+ '↑ to manage attachments': '↑ управление вложениями',
+ '← → select, Delete to remove, ↓ to exit':
+ '← → выбрать, Delete удалить, ↓ выйти',
+ 'Attachments: ': 'Вложения: ',
+
'Basics:': 'Основы:',
'Add context': 'Добавить контекст',
'Use {{symbol}} to specify files for context (e.g., {{example}}) to target specific files or folders.':
@@ -1032,8 +1038,8 @@ export default {
'(not set)': '(не задано)',
"Failed to switch model to '{{modelId}}'.\n\n{{error}}":
"Не удалось переключиться на модель '{{modelId}}'.\n\n{{error}}",
- 'The latest Qwen Coder model from Alibaba Cloud ModelStudio (version: qwen3-coder-plus-2025-09-23)':
- 'Последняя модель Qwen Coder от Alibaba Cloud ModelStudio (версия: qwen3-coder-plus-2025-09-23)',
+ 'Qwen 3.5 Plus — efficient hybrid model with leading coding performance':
+ 'Qwen 3.5 Plus — эффективная гибридная модель с лидирующей производительностью в программировании',
'The latest Qwen Vision model from Alibaba Cloud ModelStudio (version: qwen3-vl-plus-2025-09-23)':
'Последняя модель Qwen Vision от Alibaba Cloud ModelStudio (версия: qwen3-vl-plus-2025-09-23)',
@@ -1421,8 +1427,13 @@ export default {
// Auth Dialog - View Titles and Labels
// ============================================================================
'Coding Plan': 'Coding Plan',
+ 'Coding Plan (Bailian, China)': 'Coding Plan (Bailian, Китай)',
+ 'Coding Plan (Bailian, Global/Intl)':
+ 'Coding Plan (Bailian, Глобальный/Международный)',
"Paste your api key of Bailian Coding Plan and you're all set!":
'Вставьте ваш API-ключ Bailian Coding Plan и всё готово!',
+ "Paste your api key of Coding Plan (Bailian, Global/Intl) and you're all set!":
+ 'Вставьте ваш API-ключ Coding Plan (Bailian, Глобальный/Международный) и всё готово!',
Custom: 'Пользовательский',
'More instructions about configuring `modelProviders` manually.':
'Дополнительные инструкции по ручной настройке `modelProviders`.',
@@ -1431,4 +1442,18 @@ export default {
'(Press Enter to submit, Escape to cancel)':
'(Нажмите Enter для отправки, Escape для отмены)',
'More instructions please check:': 'Дополнительные инструкции см.:',
+
+ // ============================================================================
+ // Coding Plan International Updates
+ // ============================================================================
+ 'New model configurations are available for {{region}}. Update now?':
+ 'Доступны новые конфигурации моделей для {{region}}. Обновить сейчас?',
+ 'New model configurations are available for Bailian Coding Plan (China). Update now?':
+ 'Доступны новые конфигурации моделей для Bailian Coding Plan (Китай). Обновить сейчас?',
+ 'New model configurations are available for Coding Plan (Bailian, Global/Intl). Update now?':
+ 'Доступны новые конфигурации моделей для Coding Plan (Bailian, Глобальный/Международный). Обновить сейчас?',
+ '{{region}} configuration updated successfully. Model switched to "{{model}}".':
+ 'Конфигурация {{region}} успешно обновлена. Модель переключена на "{{model}}".',
+ 'Authenticated successfully with {{region}}. API key is stored in settings.env.':
+ 'Успешная аутентификация с {{region}}. API-ключ сохранён в settings.env.',
};
diff --git a/packages/cli/src/i18n/locales/zh.js b/packages/cli/src/i18n/locales/zh.js
index 09ba042ff..b0db2d0e5 100644
--- a/packages/cli/src/i18n/locales/zh.js
+++ b/packages/cli/src/i18n/locales/zh.js
@@ -10,6 +10,11 @@ export default {
// ============================================================================
// Help / UI Components
// ============================================================================
+ // Attachment hints
+ '↑ to manage attachments': '↑ 管理附件',
+ '← → select, Delete to remove, ↓ to exit': '← → 选择,Delete 删除,↓ 退出',
+ 'Attachments: ': '附件:',
+
'Basics:': '基础功能:',
'Add context': '添加上下文',
'Use {{symbol}} to specify files for context (e.g., {{example}}) to target specific files or folders.':
@@ -958,8 +963,8 @@ export default {
'(not set)': '(未设置)',
"Failed to switch model to '{{modelId}}'.\n\n{{error}}":
"无法切换到模型 '{{modelId}}'.\n\n{{error}}",
- 'The latest Qwen Coder model from Alibaba Cloud ModelStudio (version: qwen3-coder-plus-2025-09-23)':
- '来自阿里云 ModelStudio 的最新 Qwen Coder 模型(版本:qwen3-coder-plus-2025-09-23)',
+ 'Qwen 3.5 Plus — efficient hybrid model with leading coding performance':
+ 'Qwen 3.5 Plus — 高效混合架构,编程性能业界领先',
'The latest Qwen Vision model from Alibaba Cloud ModelStudio (version: qwen3-vl-plus-2025-09-23)':
'来自阿里云 ModelStudio 的最新 Qwen Vision 模型(版本:qwen3-vl-plus-2025-09-23)',
@@ -1253,12 +1258,30 @@ export default {
// ============================================================================
'API-KEY': 'API-KEY',
'Coding Plan': 'Coding Plan',
+ 'Coding Plan (Bailian, China)': 'Coding Plan (百炼, 中国)',
+ 'Coding Plan (Bailian, Global/Intl)': 'Coding Plan (百炼, 全球/国际)',
"Paste your api key of Bailian Coding Plan and you're all set!":
'粘贴您的百炼 Coding Plan API Key,即可完成设置!',
+ "Paste your api key of Coding Plan (Bailian, Global/Intl) and you're all set!":
+ '粘贴您的 Coding Plan (百炼, 全球/国际) API Key,即可完成设置!',
Custom: '自定义',
'More instructions about configuring `modelProviders` manually.':
'关于手动配置 `modelProviders` 的更多说明。',
'Select API-KEY configuration mode:': '选择 API-KEY 配置模式:',
'(Press Escape to go back)': '(按 Escape 键返回)',
'(Press Enter to submit, Escape to cancel)': '(按 Enter 提交,Escape 取消)',
+
+ // ============================================================================
+ // Coding Plan International Updates
+ // ============================================================================
+ 'New model configurations are available for {{region}}. Update now?':
+ '{{region}} 有新的模型配置可用。是否立即更新?',
+ 'New model configurations are available for Bailian Coding Plan (China). Update now?':
+ '百炼 Coding Plan (中国) 有新的模型配置可用。是否立即更新?',
+ 'New model configurations are available for Coding Plan (Bailian, Global/Intl). Update now?':
+ 'Coding Plan (百炼, 全球/国际) 有新的模型配置可用。是否立即更新?',
+ '{{region}} configuration updated successfully. Model switched to "{{model}}".':
+ '{{region}} 配置更新成功。模型已切换至 "{{model}}"。',
+ 'Authenticated successfully with {{region}}. API key is stored in settings.env.':
+ '成功通过 {{region}} 认证。API Key 已存储在 settings.env 中。',
};
diff --git a/packages/cli/src/ui/auth/AuthDialog.tsx b/packages/cli/src/ui/auth/AuthDialog.tsx
index 17d464eed..7f43fa582 100644
--- a/packages/cli/src/ui/auth/AuthDialog.tsx
+++ b/packages/cli/src/ui/auth/AuthDialog.tsx
@@ -17,6 +17,7 @@ import { useUIState } from '../contexts/UIStateContext.js';
import { useUIActions } from '../contexts/UIActionsContext.js';
import { useConfig } from '../contexts/ConfigContext.js';
import { t } from '../../i18n/index.js';
+import { CodingPlanRegion } from '../../constants/codingPlan.js';
const MODEL_PROVIDERS_DOCUMENTATION_URL =
'https://qwenlm.github.io/qwen-code-docs/en/users/configuration/settings/#modelproviders';
@@ -34,7 +35,7 @@ function parseDefaultAuthType(
}
// Sub-mode types for API-KEY authentication
-type ApiKeySubMode = 'coding-plan' | 'custom';
+type ApiKeySubMode = 'coding-plan' | 'coding-plan-intl' | 'custom';
// View level for navigation
type ViewLevel = 'main' | 'api-key-sub' | 'api-key-input' | 'custom-info';
@@ -52,6 +53,9 @@ export function AuthDialog(): React.JSX.Element {
const [selectedIndex, setSelectedIndex] = useState(null);
const [viewLevel, setViewLevel] = useState('main');
const [apiKeySubModeIndex, setApiKeySubModeIndex] = useState(0);
+ const [region, setRegion] = useState(
+ CodingPlanRegion.CHINA,
+ );
// Main authentication entries
const mainItems = [
@@ -71,9 +75,14 @@ export function AuthDialog(): React.JSX.Element {
const apiKeySubItems = [
{
key: 'coding-plan',
- label: t('Coding Plan (Bailian)'),
+ label: t('Coding Plan (Bailian, China)'),
value: 'coding-plan' as ApiKeySubMode,
},
+ {
+ key: 'coding-plan-intl',
+ label: t('Coding Plan (Bailian, Global/Intl)'),
+ value: 'coding-plan-intl' as ApiKeySubMode,
+ },
{
key: 'custom',
label: t('Custom'),
@@ -135,6 +144,10 @@ export function AuthDialog(): React.JSX.Element {
onAuthError(null);
if (subMode === 'coding-plan') {
+ setRegion(CodingPlanRegion.CHINA);
+ setViewLevel('api-key-input');
+ } else if (subMode === 'coding-plan-intl') {
+ setRegion(CodingPlanRegion.GLOBAL);
setViewLevel('api-key-input');
} else {
setViewLevel('custom-info');
@@ -149,8 +162,8 @@ export function AuthDialog(): React.JSX.Element {
return;
}
- // Submit to parent for processing
- await handleCodingPlanSubmit(apiKey);
+ // Submit to parent for processing with region info
+ await handleCodingPlanSubmit(apiKey, region);
};
const handleGoBack = () => {
@@ -246,10 +259,12 @@ export function AuthDialog(): React.JSX.Element {
- {apiKeySubItems[apiKeySubModeIndex]?.value === 'coding-plan'
- ? t("Paste your api key of Bailian Coding Plan and you're all set!")
- : t(
+ {apiKeySubItems[apiKeySubModeIndex]?.value === 'custom'
+ ? t(
'More instructions about configuring `modelProviders` manually.',
+ )
+ : t(
+ "Paste your api key of Bailian Coding Plan and you're all set!",
)}
@@ -264,7 +279,11 @@ export function AuthDialog(): React.JSX.Element {
// Render API key input for coding-plan mode
const renderApiKeyInputView = () => (
-
+
);
diff --git a/packages/cli/src/ui/auth/useAuth.ts b/packages/cli/src/ui/auth/useAuth.ts
index 0ea157af5..bb05172aa 100644
--- a/packages/cli/src/ui/auth/useAuth.ts
+++ b/packages/cli/src/ui/auth/useAuth.ts
@@ -30,9 +30,10 @@ import { AuthState, MessageType } from '../types.js';
import type { HistoryItem } from '../types.js';
import { t } from '../../i18n/index.js';
import {
- CODING_PLAN_MODELS,
+ getCodingPlanConfig,
+ isCodingPlanConfig,
+ CodingPlanRegion,
CODING_PLAN_ENV_KEY,
- CODING_PLAN_VERSION,
} from '../../constants/codingPlan.js';
export type { QwenAuthState } from '../hooks/useQwenAuth.js';
@@ -285,29 +286,35 @@ export const useAuthCommand = (
/**
* Handle coding plan submission - generates configs from template and stores api-key
+ * @param apiKey - The API key to store
+ * @param region - The region to use (default: CHINA)
*/
const handleCodingPlanSubmit = useCallback(
- async (apiKey: string) => {
+ async (
+ apiKey: string,
+ region: CodingPlanRegion = CodingPlanRegion.CHINA,
+ ) => {
try {
setIsAuthenticating(true);
setAuthError(null);
- const envKeyName = CODING_PLAN_ENV_KEY;
+ // Get configuration based on region
+ const { template, version, regionName } = getCodingPlanConfig(region);
// Get persist scope
const persistScope = getPersistScopeForModelSelection(settings);
- // Store api-key in settings.env
- settings.setValue(persistScope, `env.${envKeyName}`, apiKey);
+ // Store api-key in settings.env (unified env key)
+ settings.setValue(persistScope, `env.${CODING_PLAN_ENV_KEY}`, apiKey);
// Sync to process.env immediately so refreshAuth can read the apiKey
- process.env[envKeyName] = apiKey;
+ process.env[CODING_PLAN_ENV_KEY] = apiKey;
// Generate model configs from template
- const newConfigs: ProviderModelConfig[] = CODING_PLAN_MODELS.map(
+ const newConfigs: ProviderModelConfig[] = template.map(
(templateConfig) => ({
...templateConfig,
- envKey: envKeyName,
+ envKey: CODING_PLAN_ENV_KEY,
}),
);
@@ -317,17 +324,9 @@ export const useAuthCommand = (
settings.merged.modelProviders as ModelProvidersConfig | undefined
)?.[AuthType.USE_OPENAI] || [];
- // Identify Coding Plan configs by baseUrl + envKey
- // Remove existing Coding Plan configs to ensure template changes are applied
- const isCodingPlanConfig = (config: ProviderModelConfig) =>
- config.envKey === envKeyName &&
- CODING_PLAN_MODELS.some(
- (template) => template.baseUrl === config.baseUrl,
- );
-
- // Filter out existing Coding Plan configs, keep user custom configs
+ // Filter out all existing Coding Plan configs (mutually exclusive)
const nonCodingPlanConfigs = existingConfigs.filter(
- (existing) => !isCodingPlanConfig(existing),
+ (existing) => !isCodingPlanConfig(existing.baseUrl, existing.envKey),
);
// Add new Coding Plan configs at the beginning
@@ -347,12 +346,11 @@ export const useAuthCommand = (
AuthType.USE_OPENAI,
);
- // Persist coding plan version for future update detection
- settings.setValue(
- persistScope,
- 'codingPlan.version',
- CODING_PLAN_VERSION,
- );
+ // Persist coding plan region
+ settings.setValue(persistScope, 'codingPlan.region', region);
+
+ // Persist coding plan version (single field for backward compatibility)
+ settings.setValue(persistScope, 'codingPlan.version', version);
// If there are configs, use the first one as the model
if (updatedConfigs.length > 0 && updatedConfigs[0]?.id) {
@@ -386,7 +384,8 @@ export const useAuthCommand = (
{
type: MessageType.INFO,
text: t(
- 'Authenticated successfully with Coding Plan. API key is stored in settings.env.',
+ 'Authenticated successfully with {{region}}. API key is stored in settings.env.',
+ { region: regionName },
),
},
Date.now(),
diff --git a/packages/cli/src/ui/components/ApiKeyInput.tsx b/packages/cli/src/ui/components/ApiKeyInput.tsx
index e4082be3a..a702c2d21 100644
--- a/packages/cli/src/ui/components/ApiKeyInput.tsx
+++ b/packages/cli/src/ui/components/ApiKeyInput.tsx
@@ -11,23 +11,34 @@ import { TextInput } from './shared/TextInput.js';
import { theme } from '../semantic-colors.js';
import { useKeypress } from '../hooks/useKeypress.js';
import { t } from '../../i18n/index.js';
+import { CodingPlanRegion } from '../../constants/codingPlan.js';
import Link from 'ink-link';
interface ApiKeyInputProps {
onSubmit: (apiKey: string) => void;
onCancel: () => void;
+ region?: CodingPlanRegion;
}
const CODING_PLAN_API_KEY_URL =
'https://bailian.console.aliyun.com/?tab=model#/efm/coding_plan';
+const CODING_PLAN_INTL_API_KEY_URL =
+ 'https://modelstudio.console.alibabacloud.com/?tab=dashboard#/efm/coding_plan';
+
export function ApiKeyInput({
onSubmit,
onCancel,
+ region = CodingPlanRegion.CHINA,
}: ApiKeyInputProps): React.JSX.Element {
const [apiKey, setApiKey] = useState('');
const [error, setError] = useState(null);
+ const apiKeyUrl =
+ region === CodingPlanRegion.GLOBAL
+ ? CODING_PLAN_INTL_API_KEY_URL
+ : CODING_PLAN_API_KEY_URL;
+
useKeypress(
(key) => {
if (key.name === 'escape') {
@@ -59,9 +70,9 @@ export function ApiKeyInput({
{t('You can get your exclusive Coding Plan API-KEY here:')}
-
+
- {CODING_PLAN_API_KEY_URL}
+ {apiKeyUrl}
diff --git a/packages/cli/src/ui/components/InputPrompt.test.tsx b/packages/cli/src/ui/components/InputPrompt.test.tsx
index b8c83a132..d5ace1c53 100644
--- a/packages/cli/src/ui/components/InputPrompt.test.tsx
+++ b/packages/cli/src/ui/components/InputPrompt.test.tsx
@@ -370,6 +370,8 @@ describe('InputPrompt', () => {
});
describe('clipboard image paste', () => {
+ const isWindows = process.platform === 'win32';
+
beforeEach(() => {
vi.mocked(clipboardUtils.clipboardHasImage).mockResolvedValue(false);
vi.mocked(clipboardUtils.saveClipboardImage).mockResolvedValue(null);
@@ -378,10 +380,37 @@ describe('InputPrompt', () => {
);
});
- it('should handle Ctrl+V when clipboard has an image', async () => {
+ // Windows uses Alt+V (\x1Bv), non-Windows uses Ctrl+V (\x16)
+ const describeConditional = isWindows ? it.skip : it;
+ describeConditional(
+ 'should handle Ctrl+V when clipboard has an image',
+ async () => {
+ vi.mocked(clipboardUtils.clipboardHasImage).mockResolvedValue(true);
+ vi.mocked(clipboardUtils.saveClipboardImage).mockResolvedValue(
+ '/Users/mochi/.qwen/tmp/clipboard-123.png',
+ );
+
+ const { stdin, unmount } = renderWithProviders(
+ ,
+ );
+ await wait();
+
+ // Send Ctrl+V
+ stdin.write('\x16'); // Ctrl+V
+ await wait();
+
+ expect(clipboardUtils.clipboardHasImage).toHaveBeenCalled();
+ expect(clipboardUtils.saveClipboardImage).toHaveBeenCalled();
+ expect(clipboardUtils.cleanupOldClipboardImages).toHaveBeenCalled();
+ // Note: The new implementation adds images as attachments rather than inserting into buffer
+ unmount();
+ },
+ );
+
+ it('should handle Cmd+V when clipboard has an image', async () => {
vi.mocked(clipboardUtils.clipboardHasImage).mockResolvedValue(true);
vi.mocked(clipboardUtils.saveClipboardImage).mockResolvedValue(
- '/test/.qwen-clipboard/clipboard-123.png',
+ '/Users/mochi/.qwen/tmp/clipboard-456.png',
);
const { stdin, unmount } = renderWithProviders(
@@ -389,18 +418,15 @@ describe('InputPrompt', () => {
);
await wait();
- // Send Ctrl+V
- stdin.write('\x16'); // Ctrl+V
+ // Send Cmd+V (meta key) / Alt+V on Windows
+ // In terminals, Cmd+V or Alt+V is typically sent as ESC followed by 'v'
+ stdin.write('\x1Bv');
await wait();
expect(clipboardUtils.clipboardHasImage).toHaveBeenCalled();
- expect(clipboardUtils.saveClipboardImage).toHaveBeenCalledWith(
- props.config.getTargetDir(),
- );
- expect(clipboardUtils.cleanupOldClipboardImages).toHaveBeenCalledWith(
- props.config.getTargetDir(),
- );
- expect(mockBuffer.replaceRangeByOffset).toHaveBeenCalled();
+ expect(clipboardUtils.saveClipboardImage).toHaveBeenCalled();
+ expect(clipboardUtils.cleanupOldClipboardImages).toHaveBeenCalled();
+ // Note: The new implementation adds images as attachments rather than inserting into buffer
unmount();
});
@@ -412,7 +438,8 @@ describe('InputPrompt', () => {
);
await wait();
- stdin.write('\x16'); // Ctrl+V
+ // Use platform-appropriate key combination
+ stdin.write(isWindows ? '\x1Bv' : '\x16');
await wait();
expect(clipboardUtils.clipboardHasImage).toHaveBeenCalled();
@@ -430,7 +457,8 @@ describe('InputPrompt', () => {
);
await wait();
- stdin.write('\x16'); // Ctrl+V
+ // Use platform-appropriate key combination
+ stdin.write(isWindows ? '\x1Bv' : '\x16');
await wait();
expect(clipboardUtils.saveClipboardImage).toHaveBeenCalled();
@@ -439,11 +467,7 @@ describe('InputPrompt', () => {
});
it('should insert image path at cursor position with proper spacing', async () => {
- const imagePath = path.join(
- 'test',
- '.qwen-clipboard',
- 'clipboard-456.png',
- );
+ const imagePath = '/Users/mochi/.qwen/tmp/clipboard-456.png';
vi.mocked(clipboardUtils.clipboardHasImage).mockResolvedValue(true);
vi.mocked(clipboardUtils.saveClipboardImage).mockResolvedValue(imagePath);
@@ -451,27 +475,20 @@ describe('InputPrompt', () => {
mockBuffer.text = 'Hello world';
mockBuffer.cursor = [0, 5]; // Cursor after "Hello"
mockBuffer.lines = ['Hello world'];
- mockBuffer.replaceRangeByOffset = vi.fn();
const { stdin, unmount } = renderWithProviders(
,
);
await wait();
- stdin.write('\x16'); // Ctrl+V
+ // Use platform-appropriate key combination
+ stdin.write(isWindows ? '\x1Bv' : '\x16');
await wait();
- // Should insert at cursor position with spaces
- expect(mockBuffer.replaceRangeByOffset).toHaveBeenCalled();
-
- // Get the actual call to see what path was used
- const actualCall = vi.mocked(mockBuffer.replaceRangeByOffset).mock
- .calls[0];
- expect(actualCall[0]).toBe(5); // start offset
- expect(actualCall[1]).toBe(5); // end offset
- expect(actualCall[2]).toBe(
- ' @' + path.relative(path.join('test', 'project', 'src'), imagePath),
- );
+ // The new implementation adds images as attachments rather than inserting into buffer
+ // So we verify that saveClipboardImage was called instead
+ expect(clipboardUtils.saveClipboardImage).toHaveBeenCalled();
+ expect(clipboardUtils.clipboardHasImage).toHaveBeenCalled();
unmount();
});
@@ -485,7 +502,8 @@ describe('InputPrompt', () => {
);
await wait();
- stdin.write('\x16'); // Ctrl+V
+ // Use platform-appropriate key combination
+ stdin.write(isWindows ? '\x1Bv' : '\x16');
await wait();
// Should not throw and should not set buffer text on error
diff --git a/packages/cli/src/ui/components/InputPrompt.tsx b/packages/cli/src/ui/components/InputPrompt.tsx
index 8820e2126..09c2b27f1 100644
--- a/packages/cli/src/ui/components/InputPrompt.tsx
+++ b/packages/cli/src/ui/components/InputPrompt.tsx
@@ -22,7 +22,11 @@ import { useKeypress } from '../hooks/useKeypress.js';
import { keyMatchers, Command } from '../keyMatchers.js';
import type { CommandContext, SlashCommand } from '../commands/types.js';
import type { Config } from '@qwen-code/qwen-code-core';
-import { ApprovalMode, createDebugLogger } from '@qwen-code/qwen-code-core';
+import {
+ ApprovalMode,
+ Storage,
+ createDebugLogger,
+} from '@qwen-code/qwen-code-core';
import {
parseInputForHighlighting,
buildSegmentsForVisualSlice,
@@ -41,6 +45,15 @@ import { useUIActions } from '../contexts/UIActionsContext.js';
import { useKeypressContext } from '../contexts/KeypressContext.js';
import { FEEDBACK_DIALOG_KEYS } from '../FeedbackDialog.js';
+/**
+ * Represents an attachment (e.g., pasted image) displayed above the input prompt
+ */
+export interface Attachment {
+ id: string; // Unique identifier (timestamp)
+ path: string; // Full file path
+ filename: string; // Filename only (for display)
+}
+
const debugLogger = createDebugLogger('INPUT_PROMPT');
export interface InputPromptProps {
buffer: TextBuffer;
@@ -126,6 +139,10 @@ export const InputPrompt: React.FC = ({
const [recentPasteTime, setRecentPasteTime] = useState(null);
const pasteTimeoutRef = useRef(null);
+ // Attachment state for clipboard images
+ const [attachments, setAttachments] = useState([]);
+ const [isAttachmentMode, setIsAttachmentMode] = useState(false);
+ const [selectedAttachmentIndex, setSelectedAttachmentIndex] = useState(-1);
// Large paste placeholder handling
const [pendingPastes, setPendingPastes] = useState