0a562773f7 fix(core): match one sed character for . and bracket expressions (#15701)
* fix(core): match one sed character for . and bracket expressions

The simulated sed path compiled patterns without the s and u flags, so `.`
did not match `\r` in CRLF files and astral characters were matched as two
UTF-16 code units, leaving a lone surrogate that was written as U+FFFD.

Compile with su/gsu and escape a literal ] outside bracket expressions so
the stricter u mode still accepts patterns such as [\[\]].

Closes #15675

* ci: rerun the checks on the unchanged tree

* fix(core): decline sed escapes that mean something else under u

`\p{…}`, `\P{…}` and `\u{…}` are literals to sed but Unicode property and
code-point escapes to a `u`-flagged regex, so the simulator accepted patterns
real sed rejects or leaves alone and wrote the simulated bytes to disk. Widen
the divergent-escape guard and pin the declines, plus the `u`-only rejection
class the flag introduced.

* fix(core): judge a simulated sed edit by the bytes it will write

On a CRLF file, `s/.$//` consumes the trailing carriage return, but the write
path restores CRLF, so the edit reported success while the bytes on disk were
unchanged. Compare the prepared write content against the original instead of
the parser's intermediate string.

* fix(core): judge a simulated sed edit by the content a read-back returns

The write-back prediction decoded the prepared bytes as UTF-8 and compared
them with the read content, so a file carrying a BOM or a non-UTF-8 encoding
never matched and the false `sed edit applied` this PR removes survived.
Compare content strings instead, and only predict the CRLF normalization when
the writer applies it: a client-side write stores the content verbatim, so
`s/\r$//` is a real edit there and must not be suppressed.

* fix(core): decline \0 in simulated sed patterns

`\0` is NUL to a `u`-flagged regex but a literal `0` to sed, so the simulator
found no match and answered `sed edit made no changes` instead of falling back
to the real binary.

* fix(core): predict the CRLF restoration for every delegated write

* test(core): pin the \0 decline in simulated sed patterns

* fix(core): decline mixed POSIX bracket classes in simulated sed

* feat(cli): have an Ink TUI turn await its shared tool batch (#16385)

With experimental.unifiedAgentLoop on, the stream processor hands a
shared round's tool batch to the round's submitQuery, which awaits it,
its completion step and the round that step sends, once its own stream
and activity ended. While another stream is active, which may be the
stream that sent the round (a response of provider replays alone), the
batch completes on its own as before.

- The Ink executor takes a scheduler hold: the scheduler's completion
  callback returns once the completion step stopped the turn or is
  about to send the next round, as the current path holds it, up to the
  round whose calls need the scheduler.
- A batch whose executed calls history all answered no longer sends its
  replay answers alone.

The design doc describes PR 3b-2b.

* feat(serve): add atomic user Skill activation (#16186)

* feat(serve): add atomic user Skill activation

* test(serve): cover conditional user Skill activation capability

* docs(serve): index user Skill activation endpoint

* fix(serve): preserve User Skill refresh recovery

* feat(skills): add file-backed archive installation kernel (#16421)

* feat(skills): expose native archive routes and receipts (2/4) (#16422)

* feat(skills): add file-backed archive installation kernel

* feat(skills): expose native archive routes and receipts

* chore(release): sdk-typescript v0.1.28 (#16412)

* chore(release): v0.26.8

* chore(release): sdk-typescript v0.1.28

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Shaojin Wen <[email protected]>

* fix(core): keep plain bracket classes in simulated sed

Matching `[:`/`[.`/`[=` anywhere in the pattern rejected ordinary
classes such as `[.]` -- a common literal-dot idiom that sed and the
translator both handle. Only open a POSIX construct when the opening
bracket sits inside a bracket expression, so `[^[:space:]]` and
`[[=a=]]` stay declined while `s/[.]/X/g` keeps the simulated path.

* fix(core): decline an escaped `[` followed by a POSIX-looking class

`s/\\[[:alpha:]]/X/g` is a literal `[` and an ordinary class to BSD sed, so
the simulation rewrote the file. GNU sed rejects that pattern outright as
a malformed bracket expression, so a simulated edit writes a change the
user's own sed would have refused.

The bracket scanner skipped the escaped `[` and so never saw the nested
class. Decline the POSIX-shaped lookalike outside a bracket expression and
leave a plain escaped `[`, and an escaped `[` inside a class, on the fast
path they already had.

---------

Co-authored-by: 肖洪进 <[email protected]>
Co-authored-by: Shaojin Wen <[email protected]>
Co-authored-by: 2SinceJuly <[email protected]>
Co-authored-by: qqqys <[email protected]>
Co-authored-by: callmeYe <[email protected]>
Co-authored-by: Bob.qwencode <[email protected]>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2026-11-07 00:03:35 +00:00
2025-07-22 23:26:01 +08:00
2025-08-08 20:45:54 +08:00
2025-07-22 23:26:01 +08:00
2026-11-06 18:03:10 +00:00
2025-10-23 09:27:04 +08:00
2025-12-22 21:11:33 +08:00
2026-11-06 18:03:10 +00:00

npm version License Node.js Version Downloads

QwenLM%2Fqwen-code | Trendshift

The open-source AI coding agent for your terminal, editor, desktop, browser, and chat.

中文 | Deutsch | français | 日本語 | Русский | Português (Brasil) | 한국어

Qwen Code in the terminal, desktop app, browser, editor, and chat, with VS Code, Zed, JetBrains, Telegram, DingTalk, WeChat, and Feishu integrations

Why Qwen Code?

  • Agentic out of the box — Auto-Memory, Auto-Skills, SubAgents, Agent Teams, and MCP. Dynamic workflows, zero setup.
  • Open-source, inside and out — The framework and the Qwen models are open-source. They evolve together. No vendor lock-in.
  • Multi-protocol — Supports OpenAI, Anthropic, Gemini, and Qwen APIs. Any third-party provider or local model (Ollama / vLLM). Switch at runtime.
  • Beyond the terminal — IDE plugins, Desktop app, Web UI, SDKs, and chat integrations (Telegram / DingTalk / WeChat / Feishu).

Tip

Qwen Code is actively iterating on itself — using its own agent and models to file issues, submit PRs, review code, and run tests. Powered by the community, driven by AI.

Installation

Linux / macOS:

curl -fsSL https://qwen-code-assets.oss-cn-hangzhou.aliyuncs.com/installation/install-qwen-standalone.sh | bash

Windows:

irm https://qwen-code-assets.oss-cn-hangzhou.aliyuncs.com/installation/install-qwen-standalone.ps1 | iex

Restart your terminal after installation to ensure environment variables take effect.

NPM / Homebrew

NPM (requires Node.js 22+):

npm install -g @qwen-code/qwen-code@latest

Homebrew (macOS / Linux):

brew install qwen-code

Quick Start

Open a terminal in your project and start Qwen Code:

cd /path/to/your-project
qwen

Inside the session, run /auth and choose Qwen Account with Subscription to sign in with your Plus or Pro subscription, or configure a provider with an API key. Then try:

Explain this repository and show me where to start.

See the Authentication Guide and Settings Reference for detailed setup.

See the terminal interface

Qwen Code terminal interface

How to Use Qwen Code

Choose the interface that fits your workflow:

Interface Get started
Terminal Run qwen in your project — see Quick Start.
Desktop Download Qwen Code Desktop for macOS, Windows, and Linux.
Web Run qwen serve --open to open the Web UI in your browser. (experimental)
Editor Set up VS Code, Zed, or JetBrains.
Chat Connect Telegram, DingTalk, WeChat, or Feishu, then run qwen channel start.

For automation and custom integrations:

SDK example (Python)
import asyncio

from qwen_code_sdk import is_sdk_result_message, query


async def main() -> None:
    result = query(
        "Summarize the repository layout.",
        {
            "cwd": "/path/to/project",
            "path_to_qwen_executable": "qwen",
        },
    )

    async for message in result:
        if is_sdk_result_message(message):
            print(message["result"])


asyncio.run(main())

Daemon Mode

Run Qwen Code as a long-lived service when you want browser, editor, SDK, and automation clients to share agent sessions without each starting a separate process. The daemon provides the built-in Web Shell and an HTTP + SSE API, supports multiple workspaces, and lets clients reconnect to active sessions.

Start it in the foreground and open the Web Shell:

qwen serve --open

The default address is http://127.0.0.1:4170. To run and manage it in the background instead:

qwen daemon start
qwen daemon status
qwen daemon logs -f
qwen daemon stop

By default, the daemon listens on loopback without bearer authentication; any local process that can reach it can use the full API, including code execution. On shared or untrusted hosts, set QWEN_SERVER_TOKEN and use --require-auth. See the Daemon guide for workspaces, authentication, remote access, and the API.

Capabilities

If you know Claude Code, you already know Qwen Code — and then some. We've put significant effort into bringing Qwen Code to feature parity with Claude Code, improving both breadth and reliability across the board.

Feature Qwen Code Claude Code
SubAgents, Agent Teams, Dynamic Workflows ✓ ✓
Auto-Memory, Auto-Skills, Hooks ✓ ✓
Built-in Skills (/review, /batch, /loop, /bugfix…) ✓ ✓
MCP, Plan Mode, LSP Integration ✓ ✓
Auto Mode, Sandbox, Git Worktrees ✓ ✓
Computer Use (desktop automation) ✓ ✓
IDE Plugins (VS Code / JetBrains / Zed) ✓ ✓
SDK ✓ ✓
Headless Mode, Session Management ✓ ✓
Open-source — model and framework ✓ —
Multi-protocol (OpenAI / Anthropic / Gemini / Qwen + any provider) ✓ —
Agent Arena (multi-model head-to-head on same task) ✓ —
Daemon Mode — qwen serve (multi-client shared agent) ✓ —
IM Channels (Telegram / DingTalk / WeChat / Feishu) ✓ —

Qwen Code Evaluation

On SWE-bench Verified, seven Qwen Code versions scored 76.40%–77.80% on average using the same Qwen 3.7 Max model (500 tasks, three trials per version).

Average SWE-bench Verified scores by Qwen Code version: 0.0.14, 77.80%; 0.1.0, 76.73%; 0.5.0, 76.60%; 0.10.0, 76.47%; 0.15.0, 77.67%; 0.19.0, 76.40%; 0.22.0, 77.33%.

Full results and evaluation configuration →

Ecosystem

  • Qwen Code Desktop — Official desktop app for macOS, Windows, and Linux

  • AionUi — A modern GUI for command-line AI tools including Qwen Code

  • Gemini CLI Desktop — A cross-platform desktop/web/mobile UI for Qwen Code

  • qwen-audio-agent — Realtime full-duplex voice frontend for Qwen Code over ACP — talk hands-free with barge-in and a local wake word

  • 🦞 Qwen Code Claw — Let other agents (Claude, Codex, etc.) delegate coding tasks to Qwen Code via ACP. Paste this prompt into your agent:

Use Qwen Code as a coding agent. First, fetch and read this skill reference:
https://raw.githubusercontent.com/QwenLM/qwen-code/refs/heads/main/.qwen/skills/qwen-code-claw/SKILL.md
Then follow the instructions inside to install, authenticate, and use Qwen Code via acpx for all coding tasks.
  • Aliyun Model Studio CLI — Official CLI for Aliyun's AI platform (bailian-cli). Extends Qwen Code with image/video generation, knowledge retrieval, app orchestration, and model deployment

Privacy

See the Terms of Service and Privacy Notice, including Chrome extension and Browser Use data handling.

Contributing

Contributions are welcome! See CONTRIBUTING.md for guidelines.

Acknowledgments

This project was originally based on Google Gemini CLI v0.8.2. We gratefully acknowledge the Gemini CLI team's excellent work. Starting from Qwen Code v0.1, we stopped syncing with upstream and began independent development as a multi-protocol, multi-platform agent framework with deep integrations for Qwen models and beyond.

Languages
TypeScript 76.5%
Java 11.5%
JavaScript 5.4%
Rust 5%
Python 0.5%
Other 0.9%