7f7bce3174 feat: chat transcript mr2a html export (#10076)
* feat(transcript): add cross-host document export pipeline

Establish a shared transcript model and document-mode projection so Web
Shell, VS Code, and HTML export can consume the same stable conversation
semantics without changing interactive rendering.

- Preserve daemon and ACP segment identity across replay and normalization
- Add export-safe previews and a versioned transcript document builder
- Add document-mode Web Shell rendering with bounded Mermaid processing
- Lock direct-daemon and ACP behavior with contract fixtures
- Cover render and export equivalence in integration tests

* feat(transcript): wire real VS Code and HTML export consumers

Move transcript prevalidation onto real product paths while preserving
the legacy VS Code timeline as the default fallback.

- Add version-bound document HTML with strict CSP and schema checks
- Add opt-in ACP projection with stable source identity
- Reuse product export code across hosts and the integration runner
- Remove test-only production probes and consolidate shared validation

Note: Browser, host-action, VSIX, and packaging gates remain pending.

* build(deps): sync transcript workspace dependencies

Keep the npm lockfile aligned with the VS Code and HTML export package
manifests added by the transcript consumer migration.

- Lock the VS Code Web Shell workspace dependency
- Lock Web Templates SDK, Web Shell, and React build dependencies

* fix(transcript): harden export and identity paths

Resolve review findings across document export and the VS Code ACP
timeline while preserving default interactive and readonly semantics.

- Preserve stable text and non-text identity across live and replay
- Harden export projection, budgets, URL handling, CSP, and nonces
- Make document rendering complete, inert, and browser-validated
- Keep VS Code transcript scope, theme, copy, and flags reactive
- Restore fixture, schema, hash, and compatibility contract locks

Note: The overall gate remains failed pending VSIX, host-action, and
packaged-artifact evidence.

* fix(transcript): harden identity and document export

Close the latest review findings across transcript identity, VS Code
rehydration, and the HTML export security boundary.

- Terminate discrete ACP segments and bind automatic turn provenance
- Reset VS Code transcript scopes across replay and reconnect lifecycles
- Align Markdown sanitization and envelope budgets with document rendering
- Run browser gates with Chromium and complete third-party notices

* fix(transcript): simplify adapters and preserve segment boundaries

Reduce the shared transcript review surface while keeping the VS Code and
HTML Export consumers and their security gates intact.

- Merge VS Code feature state into the ACP transcript hook
- Collect source identity once and strip it at the compatibility boundary
- Remove test-only export adapters, gate reports, and duplicate helpers
- Keep shell output separated when stable producer segments change
- Mark third-party notices as generated review content

* fix(transcript): address cross-host review regressions

* fix(transcript): harden export sanitization and user identity

Close the latest review findings around document resource safety and
recorded-user replay consistency.

- Redact local home paths structurally without corrupting remote URLs
- Sanitize nested Markdown images inside otherwise safe links
- Advance merged segment provenance without duplicating separators
- Keep recorded-user stable IDs anchored to durable record identity

* fix(web-shell): restore agent-only group predicate

* refactor(transcript): split HTML export from VS Code migration

Keep MR2A focused on the document export pipeline while preserving the legacy VS Code timeline.

- Retain VS Code /export html as a real document consumer
- Move live transcript adapters, identity wiring, and feature flag to MR2B
- Remove the direct Web Shell dependency and restore baseline notices
- Keep candidate identity evidence in integration-only helpers
- Document the MR1, MR2A, and MR2B delivery boundaries

* fix(web-shell): keep compact agent summaries separate

Preserve synthetic compact summary rows when parallel-agent grouping runs
after compact tool-group aggregation.

- Exclude summary rows from foreground agent-only grouping
- Exclude summary rows from background agent-only grouping

* fix(core): remove duplicate telemetry test mock

* refactor(sdk): share todo preview render fallback

* fix(web-shell): align document subtools with main

* fix(transcript): address HTML export review findings

* fix(transcript): address export review findings

* fix(transcript): close export boundary bypasses

Harden the document export boundary after the latest review found
mixed-path and Markdown parser/scanner gaps.

- Normalize dot segments and mixed separators before home redaction
- Align Markdown preflight with fences, HTML comments, and delimiters
- Remove the internal review report from the tracked repository

* fix(transcript): close export review findings

Close three Critical review findings in the document export and safe
transcript projection paths.

- Share percent-token decoding between home-path redaction and checks
- Reject parser/scanner divergence before Markdown parsing can stall
- Preserve todo entries carried by the document-safe projection
- Add regression witnesses for each reported failure mode

* fix(export): restore document parity and harden projections

Restore HTML export parity without weakening the sealed document
boundary.

- Reject recursively encoded and split home-path structures
- Keep synthesized todo identities unique from authored values
- Restore safe metadata, theme, and document-wide expansion controls

* fix(export): close home-path redaction entrances and restore safe-projection signals

- safePath: detect home segments at any depth (nested /usr/home, /export/home, UNC shares map to [home])
- redactor/validator: use a precise URL pattern (authority+path only) so URL-adjacent and URL-query home paths are no longer absorbed into the remote-URL span; allow quoted username segments
- exporter: dynamic-import the export API in main() with an ERR_MODULE_NOT_FOUND guard and a clear build-precondition message
- safe projection: propagate executionMode from block.background so foreground subagent launches stay separate and keep intervening thinking

* fix(export): close residual home-path leaks

Harden the sealed document boundary against path spellings that could
survive the existing surgical redaction pass.

- Detect residual home components independently after redaction
- Handle spaced usernames and URL-adjacent local paths
- Exempt validated raster thumbnails from visible-text scanning

* fix(export): handle Markdown fences across containers

Prevent document export from aborting or dropping valid code when
fenced Markdown uses non-LF endings or blockquote containers.

- Demote rich fences with CRLF and CR opening lines
- Track CommonMark blockquote ownership with bounded linear scanning
- Cover quoted, nested, HTML-container, and line-ending regressions

* fix(export): unify home-path grammar and keep cancelled safe results

Round 8 review found the export home-path boundary still open at two
entrances, and the document safe projection silently destroying a
cancelled sub-agent's terminal result.

- Derive the residual home-path detector from the redaction grammar
  instead of hand-modelling it, and redact bare plus line-initial
  relative home roots so ordinary text is no longer discarded wholesale
- Consume each remote URL as one token: verified remote paths pass
  through byte-identical, while a token whose ownership stays ambiguous
  after a delimiter or a malformed authority degrades as a whole
- Return typed omission signals from home redaction so encoded-content
  and URL degradation always set truncated/complete with a diagnostic,
  instead of inferring state from a marker string a transcript can forge
- Preserve a string terminal result when stamping the cancelled
  background-agent marker, and project that cancellation to failed plus
  wasCancelled only on the explicit safe projection path

Note: interactive and readonly callers keep the existing raw and status
compatibility, so a cancelled background agent still reconciles to
completed there.

* fix(export): strip URL credentials from exported command previews

`user_shell.command` and the `command` tool preview went into the document
through `budget.plainText`, which only applies home-path redaction and the byte
budget. A reachable `curl https://user:[email protected]/file?token=secret`
therefore carried both the URL userinfo and the secret query into the exported
JSON and the shareable HTML, against the contract that credentials never enter
the document.

Reuses the projector's own `normalizeNavigableUrl` — the same helper the typed
`web_fetch.url` and repository paths already go through, which clears
`username`, `password`, `search` and `hash` — rather than reaching for the
SDK's `sanitizeUrlsInText`, which is module-private in `daemon/ui/render.ts`
and would have needed a new public export. A command is free text that embeds a
URL rather than being one, so the new helper rewrites each embedded match and
reports `url_sanitized` / `url_rejected` through the existing diagnostics
counter.

Runs before `budget.plainText`: a URL truncated first may no longer match the
pattern, and the truncation boundary should be measured on the text that
actually ships.

Scope is http(s), matching `normalizeNavigableUrl`. A credential in a
non-navigable scheme (`ssh user:pw@host`) or a bare flag (`-pSECRET`) is not
covered; that needs argument-aware redaction, which this projector does not
attempt. The limit is stated on the helper so the contract is not read as
stronger than the code.

* test(web-shell): keep the render-mode provider across session-switch rerenders

Two of main's session-guard tests failed on this branch:
`ignores a stale polling response from the previous session` and
`ignores a workflow action that settles after switching sessions`, both with a
spy that must not fire being called once.

The component was not at fault. Its diff against main is only `documentMode`
guards, and `documentMode` is false throughout these tests, so the interactive
paths are main's unchanged. The cause is the shape of the React tree: this
branch's mount helper renders
`I18nProvider > TranscriptRenderModeProvider > TasksStatusMessage`, while those
tests simulate a session switch by calling `root.render` again with
`I18nProvider > TasksStatusMessage`. The element type at that position changes,
so React unmounts the subtree and mounts a fresh component instead of updating
it — which resets `expectedSessionIdRef` and re-runs the polling effect, and
the guard those tests exist to pin never gets the chance to suppress anything.

Wrapping the three bare `root.render` calls keeps the tree shape stable across
the rerender, with the same `interactive` value the helper defaults to, so the
component updates in place as the tests intend.

ToolGroup.test.tsx has the same bare-render shape in places but its tests pass —
those sites are fresh mounts, where a remount is not observable — so they are
left alone rather than churned.

* fix(web-shell): declare documentMode in the two workflow callback deps

`lint:ci` runs eslint with `--max-warnings 0`, so the two
`react-hooks/exhaustive-deps` warnings failed the job outright:

  TasksStatusMessage.tsx
    610:5  React Hook useCallback has a missing dependency: 'documentMode'
    655:5  React Hook useCallback has a missing dependency: 'documentMode'

`handleWorkflowAction` and `handleWorkflowHistoryDelete` gained a
`if (documentMode || busy) return;` guard during the merge, but their dependency
arrays sat outside the conflict regions and so kept main's list. Adding the
dependency is also the correct fix rather than a lint appeasement: both
callbacks close over `documentMode` now, and a stale closure would let a
document render run an action it must not.

Swept the file afterwards for any other hook whose body reads `documentMode`
without declaring it; these two were the only ones.

* fix(export): validate URL boundaries and raster signatures

Close verified document admission gaps without changing live transcript
semantics or discarding legitimate remote path examples.

- Reject missing and encoded home-path authorities before URL repair
- Check raster MIME signatures in the producer and envelope validator
- Remove redundant separator repetition and pin bounded regressions
- Preserve normal remote URLs and record undecidable decoding as loss

Note: Signatures check format headers, not full image or secret safety.

* ci: record e2e.yml growth in the workflow size baseline

e2e.yml is now 30022 bytes: 3610 bytes of drift already merged into
main within the 4096-byte allowance, plus this PR's transcript
document browser gate (the dedicated gate step, the
chat-transcript-document exclusions, and the nested Playwright CLI
install). Bump the ratchet in this PR as the gate requests, so the
growth stays a reviewed line.

Co-authored-by: Qwen-Coder <[email protected]>

* test(web-shell): scope workflow history visual assertion

Co-authored-by: Qwen-Coder <[email protected]>

---------

Co-authored-by: heyang.why <[email protected]>
Co-authored-by: 易良 <[email protected]>
Co-authored-by: jinjing.zzj <[email protected]>
Co-authored-by: Qwen-Coder <[email protected]>
Co-authored-by: yiliang114 <[email protected]>
2026-09-04 14:36: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-09-03 12:52:13 +00:00
2025-10-23 09:27:04 +08:00
2025-12-22 21:11:33 +08:00
2026-09-03 12:52:13 +00:00

npm version License Node.js Version Downloads

QwenLM%2Fqwen-code | Trendshift

The open-source AI coding agent that lives in your terminal.

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

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, daemon mode, SDKs, and IM bots (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

qwen          # Launch interactive terminal UI
# Inside the session:
/auth         # Configure your provider and API key

See the Authentication Guide and Settings Reference for detailed setup.

Qwen Code

How to Use Qwen Code

Mode Command Use Case
Interactive qwen Terminal UI with rich rendering, @file references, slash commands
Headless qwen -p "..." Scripts, CI/CD, batch processing — no UI
IDE — VS Code, Zed, JetBrains
Desktop — Qwen Code Desktop — GUI for macOS, Windows, Linux
Daemon qwen serve Shared agent session over HTTP+SSE (ACP). Multiple clients, one agent. (experimental) Docs
SDK — TypeScript, Python, Java
IM Bot qwen channel Connect to Telegram, DingTalk, WeChat, or Feishu
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())

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

Evaluation Configuration

Configuration Value
Dataset princeton-nlp/SWE-bench_Verified, 500 cases
Runs 3 trials per version, 1,500 jobs per version; 7 Qwen Code versions
Model Qwen 3.7 Max
Sampling temperature=1, top_p=0.95
Thinking / Reasoning interleaved_thinking=true, thinking_type=adaptive, reasoning_effort=high
Context / Output Limits context_1m=true, model_context_length=1,000,000, max_tokens=64,000, model_max_tokens=65,535
Harness Limits max_iterations=500, runtime_timeout_sec=7,200, agent_timeout_multiplier=3.0

Scores by Qwen Code Version

Version Avg Score Pass Rate pass@3 pass^3
0.0.14 77.80% 84.6% 84.6% 69.2%
0.1.0 76.73% 84.6% 84.6% 68.0%
0.5.0 76.60% 83.0% 83.0% 68.4%
0.10.0 76.47% 84.4% 84.4% 67.4%
0.15.0 77.67% 84.6% 84.6% 68.6%
0.19.0 76.40% 85.0% 85.0% 65.8%
0.22.0 77.33% 84.4% 84.4% 68.0%

Avg Score Trend

Qwen Code version Avg Score trend

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 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

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%