qwen-code/packages/desktop
rockybot2026 732f4d8a29
feat(voice): support trusted private ASR base URLs (#8350)
* feat(voice): support trusted private ASR base URLs

* fix(voice): address private endpoint review findings

* test(voice): cover private endpoint edge cases

* test(voice): pin remaining endpoint edge cases

* fix(voice): address private endpoint review feedback

* fix(voice): clarify allowlist URL and normalize IPv6

* fix(voice): harden NAT64 address validation

* fix(voice): address managed endpoint review findings

* refactor(voice): extract shared IPv6 transition unwrap ladder (#8350)

Deduplicate the IPv6-transition unwrapping sequence (mapped, compatible,
NAT64, dotted-quad) that was repeated verbatim between isPrivateNetworkIp
and isAlwaysBlockedVoiceAddress on both CLI and Desktop surfaces. A single
unwrapIpv6TransitionStep helper now yields the next canonical address (or
'blocked' for unrecognized ::ffff: forms), and each predicate recurses
through it, preserving the exact re-check semantics at every unwrap level.

* test(voice): cover allowInsecureBaseUrl wiring through desktop default transports (#8350)

* fix(voice): add allowlist hint to private-network rejection error (#8350)

* fix(voice): reject always-blocked base URLs before offering the allowlist hint (#8350)

* fix(voice): resolve exact desktop voice provider before OAuth (#8350)

* fix(voice): address review feedback for trusted private base URLs (#8350)

* fix(voice): align desktop voice resolution with CLI semantics (#8350)

* fix(voice): scope desktop fail-closed resolution to policy-bearing entries (#8350)

* fix(voice): address round-8 review findings for trusted private base URLs (#8350)

Run the invasive process-global `mock.module('ws')` suite as
voice-ws-handler.isolated.ts so the desktop package's single-process
`bun test` run no longer leaks the fake socket into unrelated ws
consumers; the existing isolated loop runs it in its own process.

Shape-guard the desktop provider scan: non-object modelProviders
elements are skipped (falling through to OAuth instead of throwing a
raw TypeError), and non-string baseUrl/envKey/settings.env values on a
voice-model entry now surface the PROVIDER_ENTRY_REMEDY remediation
error instead of crashing.

Compute the DashScope-compatible /v1 rewrite before any allowlist
match in fromExactModelProvider so the stage-1 check, the remediation
messages, and the top-level recheck all compare the same final URL and
a single allowlist entry converges for split-horizon deployments.

Extend the CLI allowlist remediation messages to state which settings
scopes honor the entry, since serve mode never shows the interactive
workspace-strip warning. Thread providerProtocol through the CLI voice
model seams (createVoiceModelSource and the daemon buildModelsConfig)
so protocol-mapped custom provider groups resolve like the rest of the
CLI model surface, and document the remaining protocol-agnostic desktop
scan in the design doc. Correct the getHomeEnvFallback comment: it
adopts the narrower getHomeEnvFallbackVars candidate set on purpose.

Add multi-record DNS answer tests on both CLI and desktop net guards so
the records.some classification is pinned against the array shape
defaultLookupHost always produces in production.

* fix(voice): address round-9 review findings for trusted private base URLs (#8350)

* fix(voice): address round-10 review findings for trusted private base URLs (#8350)

* fix(voice): classify desktop voice duplicates before ambiguity check (#8350)

* fix(scripts): compare voice guard mirrors as parse trees (#8350)

---------

Co-authored-by: rockybot2026 <265985139+rockybot2026@users.noreply.github.com>
Co-authored-by: qwen-code-dev-bot <qwen-code-dev@service.alibaba.com>
Co-authored-by: qwen-code-ci-bot <qwen-code-ci-bot@users.noreply.github.com>
Co-authored-by: qwen-code-dev-bot <qwen-code-dev-bot@users.noreply.github.com>
Co-authored-by: Shaojin Wen <shaojin.wensj@alibaba-inc.com>
2026-08-06 14:04:57 +00:00
..
.agents/skills feat(desktop): compile macOS 26+ Liquid Glass Assets.car in brand-create (#5284) 2026-06-19 03:57:02 +08:00
.github feat(desktop): Add desktop app package with Qwen ACP SDK integration (#3778) 2026-06-11 21:57:20 +08:00
apps feat(web-shell): add native Live Voice (#7859) 2026-08-05 08:33:22 +00:00
docs/plans fix(desktop): isolate update feed from CLI releases (#5139) 2026-06-15 15:32:39 +08:00
packages feat(voice): support trusted private ASR base URLs (#8350) 2026-08-06 14:04:57 +00:00
scripts feat(web-shell): add native Live Voice (#7859) 2026-08-05 08:33:22 +00:00
.dockerignore feat(desktop): Add desktop app package with Qwen ACP SDK integration (#3778) 2026-06-11 21:57:20 +08:00
.gitignore feat(desktop): Add desktop app package with Qwen ACP SDK integration (#3778) 2026-06-11 21:57:20 +08:00
.nvmrc feat(desktop): Add desktop app package with Qwen ACP SDK integration (#3778) 2026-06-11 21:57:20 +08:00
bun.lock feat(voice): support trusted private ASR base URLs (#8350) 2026-08-06 14:04:57 +00:00
CODE_OF_CONDUCT.md feat(desktop): Add desktop app package with Qwen ACP SDK integration (#3778) 2026-06-11 21:57:20 +08:00
CONTRIBUTING.md feat(desktop): Add desktop app package with Qwen ACP SDK integration (#3778) 2026-06-11 21:57:20 +08:00
LICENSE feat(desktop): Add desktop app package with Qwen ACP SDK integration (#3778) 2026-06-11 21:57:20 +08:00
NOTICE feat(desktop): Add desktop app package with Qwen ACP SDK integration (#3778) 2026-06-11 21:57:20 +08:00
package.json feat(web-shell): add native Live Voice (#7859) 2026-08-05 08:33:22 +00:00
README.md feat(desktop): Add desktop app package with Qwen ACP SDK integration (#3778) 2026-06-11 21:57:20 +08:00
SECURITY.md feat(desktop): Add desktop app package with Qwen ACP SDK integration (#3778) 2026-06-11 21:57:20 +08:00
TRADEMARK.md feat(desktop): Add desktop app package with Qwen ACP SDK integration (#3778) 2026-06-11 21:57:20 +08:00
tsconfig.base.json feat(desktop): Add desktop app package with Qwen ACP SDK integration (#3778) 2026-06-11 21:57:20 +08:00
tsconfig.json feat(desktop): Add desktop app package with Qwen ACP SDK integration (#3778) 2026-06-11 21:57:20 +08:00

Qwen Code

Qwen Code is a desktop and headless agent workspace. It provides multi-session chat, source connections, skills, file previews, automations, and permission modes in a local-first application.

Backend

This fork is Qwen-only:

  • Agent sessions run through Qwen Code over ACP.
  • The app does not store third-party LLM API keys.
  • The built-in LLM connection is qwen-code.
  • Legacy multi-provider backends and package/runtime wiring have been removed.

Qwen Code CLI Runtime

The desktop app talks to the Qwen Code CLI over ACP. Treat the CLI as a runtime artifact, not as desktop source code. A packaged app must bundle a known CLI build so users can launch it without installing qwen separately.

Use one of these workflows depending on what you are developing:

Workflow Use it when Commands
Default desktop development You are developing desktop only. bun run dev
Published npm package You want a specific published CLI version for dev, CI, or release builds. QWEN_CODE_VERSION=0.15.12-acp.0 bun run dev
Local npm tarball You need to verify the exact package contents before publishing. QWEN_CODE_TARBALL=/path/to/qwen-code-0.15.12-acp.0.tgz bun run dev
Local qwen-code checkout You are changing ACP or other CLI behavior while testing desktop. QWEN_CODE_ROOT=/path/to/qwen-code bun run dev
Explicit CLI entry You need to point at a specific CLI file. QWEN_CODE_CLI=/path/to/qwen-code/scripts/dev.js bun run dev

electron:dev uses local overrides first. If no override is set and this repository is not inside the qwen-code monorepo, it vendors the default version from qwenCodeRuntime.version in package.json and points Electron at the vendored CLI automatically.

If you are preparing a package without publishing it, create the tarball from the Qwen Code repository and point desktop at it:

cd /path/to/qwen-code
npm run build
npm run bundle
npm run prepare:package
npm pack

cd /path/to/desktop
QWEN_CODE_TARBALL=/path/to/qwen-code/qwen-code-0.15.12-acp.0.tgz bun run dist:mac

Distribution builds run electron:vendor:qwen automatically. Set QWEN_CODE_VERSION or QWEN_CODE_TARBALL when you want the packaged app to use a published or packed CLI artifact. If neither is set, this monorepo builds from the local checkout; a standalone desktop checkout uses qwenCodeRuntime.version from package.json.

Development runtime resolution checks sources in this order:

QWEN_CODE_CLI / QWEN_CODE_ROOT / QWEN_CODE_PATH
QWEN_CODE_TARBALL
QWEN_CODE_VERSION
local monorepo checkout
existing vendored CLI
qwenCodeRuntime.version from package.json

Distribution vendoring checks sources in this order:

QWEN_CODE_TARBALL
QWEN_CODE_VERSION
QWEN_CODE_ROOT / QWEN_CODE_PATH
local monorepo checkout
qwenCodeRuntime.version from package.json

Installation

bun install
bun run dev

Common Commands

bun run typecheck:all
bun run test:shared
bun run dev
bun run server:start

Building for Distribution

All build commands run from packages/desktop/.

Prerequisites

  • Bun (see .bun-version for exact version)
  • bun install — install all workspace dependencies

Developer Build (no code signing)

Use this for local testing. Produces an ad-hoc signed app.

# macOS (arm64 + x64)
bun run electron:dist:dev:mac

# Windows
bun run electron:dist:dev:win

# Linux
bun run electron:dist:dev:linux

Release Build (with code signing)

bun run electron:dist:mac
bun run electron:dist:win
bun run electron:dist:linux

Release builds require signing credentials via environment variables:

Variable Purpose
CSC_LINK Path to signing certificate
APPLE_ID Apple ID for notarization
APPLE_APP_SPECIFIC_PASSWORD App-specific password
APPLE_TEAM_ID Team ID for notarization

Build Output

All artifacts are written to apps/electron/release/:

Platform Artifact
macOS Qwen-Code-Desktop-{arm64,x64}.dmg, Qwen-Code-Desktop-{arm64,x64}.zip
Windows Qwen-Code-Desktop-x64.exe
Linux Qwen-Code-Desktop-x64.AppImage

What the Build Does

Each electron:dist:* command runs three stages:

  1. electron:vendor:qwen — vendors a Qwen Code CLI runtime into vendor/qwen-code/. Set QWEN_CODE_VERSION to download a published npm version, or QWEN_CODE_TARBALL to use a local npm pack tarball. If neither is set in this monorepo, it builds from the local checkout.
  2. electron:build — compiles the app via esbuild (main + preload), Vite (renderer), and copies resources/assets.
  3. electron-builder — downloads the Electron runtime, packages the app, signs it, and produces distributable installers (DMG, NSIS, AppImage).

CLI

bun run apps/cli/src/index.ts run "Hello from Qwen"
bun run apps/cli/src/index.ts run --workspace-dir ./project "Summarize this repo"

The run command spawns a headless server, creates a temporary session, streams the response, and exits. Provider flags are accepted only for compatibility; the backend remains Qwen Code.

Repository Layout

apps/
  electron/     Desktop app
  cli/          Terminal client
  webui/        Web adapter
packages/
  shared/       Agent, config, prompts, sessions, sources
  server-core/  RPC handlers and session manager
  core/         Shared types
  ui/           Shared UI components
  session-tools-core/
  session-mcp-server/
scripts/        Build and packaging helpers

Capabilities

  • Multi-session inbox with streaming responses and tool visualization
  • Qwen Code model discovery through ACP
  • MCP, REST API, and local filesystem sources
  • Skills stored per workspace
  • Permission modes for planning, asking before edits, and autonomous execution
  • File attachments and in-app previews for images, PDFs, Office files, and diffs
  • Event-driven automations and messaging integrations

License

Apache 2.0. Third-party dependencies are listed in package manifests and are subject to their respective licenses.