Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions docs/design/agent-plugins-v1-native-support.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Agent Plugins v1 Native Support

## Context

Qwen Code currently loads `qwen-extension.json` packages directly and converts
Gemini, Claude, and Qoder packages before loading them. Agent Plugins v1 is a
portable format with a root `plugin.json`, direct-child skills under `skills/`,
and an optional root `mcp.json`. Converting it would change the package format
and its runtime semantics.

This design matches the portable runtime capabilities implemented by Codex at
`646f7c0a91b8e327d263335da68ae8ef212895ce`: skills, stdio MCP, and Streamable
HTTP MCP. Agent Plugin commands, agents, hooks, context, settings, channels,
apps, client-extension namespaces, and legacy SSE MCP are not activated.

## Design

Agent Plugins v1 is a native extension package format, not another converter.
A format-aware manifest loader recognizes only the canonical v1 schema, maps
portable metadata into the existing in-memory `ExtensionConfig`, and leaves all
standard files unchanged. Existing install sources and the install metadata
sidecar remain unchanged.

The Agent Plugin loader discovers only immediate `skills/*/SKILL.md` files and
validates their portable Agent Skills metadata. Invalid skills are skipped
independently. The optional `allowed-tools` field is validated but does not
grant Qwen permissions. Other Qwen-specific skill fields are ignored.

The root `mcp.json` is validated in two stages. A top-level error disables MCP
for the plugin; an invalid server disables only that entry. Stdio servers use a
stable data directory outside the package and receive client-controlled
`PLUGIN_ROOT` and `PLUGIN_DATA` values. Streamable HTTP servers receive the
portable URL and literal-header checks and stop redirects when a configured or
authorization header is present. Legacy SSE entries are reported and skipped.

## Package boundary

Every discovered, read, or executed package path is checked after resolving
symlinks and existing path prefixes. A plugin manifest escape rejects the
plugin, a component-directory escape disables that component, and a skill or
MCP-entry escape skips only that entry. Copied Agent Plugin installs do not
follow symlinks; linked installs apply the same checks at load time.

## Compatibility

A root `plugin.json` whose schema belongs to Agent Plugins takes precedence
over other extension manifests. Unsupported Agent Plugins schema versions fail
explicitly; unrelated root `plugin.json` files do not affect existing format
detection. Missing or blank portable versions use the internal version
`1.0.0`.

The shared origin union gains `AgentPlugins`. Native Agent Plugins still use
the normal extension security consent, but they do not show the converted
third-party-format compatibility warning. Existing Qwen, Gemini, Claude, and
Qoder behavior remains unchanged.
1 change: 1 addition & 0 deletions docs/users/extension/_meta.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export default {
introduction: 'Introduction',
'agent-plugins': 'Agent Plugins v1',
'getting-started-extensions': {
display: 'hidden',
},
Expand Down
50 changes: 50 additions & 0 deletions docs/users/extension/agent-plugins.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Agent Plugins v1

Qwen Code natively loads portable [Agent Plugins v1](https://agent-plugins.org/)
packages. The package keeps its standard `plugin.json`, `mcp.json`, and
`SKILL.md` files: installation does not generate `qwen-extension.json` or
rewrite portable files.

Use the existing extension commands with a local directory, link, archive,
Git repository, archive URL, or scoped npm package:

```bash
qwen extensions install ./my-agent-plugin
qwen extensions link ./my-agent-plugin
qwen extensions install owner/my-agent-plugin
```

The root manifest must target the canonical v1 schema:

```json
{
"$schema": "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json",
"name": "my-agent-plugin",
"version": "1.0.0"
}
```

## Supported capabilities

| Capability | Support |
| ------------------------------------------ | ---------------------------------------- |
| Direct-child `skills/*/SKILL.md` | Yes |
| stdio MCP servers | Yes |
| Streamable HTTP MCP servers | Yes |
| Legacy HTTP+SSE MCP servers | No; the entry is skipped |
| Commands, agents, and hooks | No; these directories are ignored |
| Qwen context, settings, channels, and apps | No |
| `extensions.*` client namespaces | No; unimplemented namespaces are ignored |

Skills follow the [Agent Skills specification](https://agentskills.io/specification).
An invalid skill is skipped without disabling valid sibling skills. The
experimental `allowed-tools` field is recognized as a string but does not grant
pre-approved Qwen tools.

For stdio MCP servers, Qwen Code expands `${PLUGIN_ROOT}` and `${PLUGIN_DATA}`
once in `args`, environment values, and `cwd`. `PLUGIN_DATA` is a writable
per-installation directory whose contents persist across updates and reinstall.
Remote MCP endpoints must use HTTPS, except for loopback HTTP endpoints.

Agent Plugins v1 is a package format, not a marketplace integration. Install
packages through Qwen Code's existing extension sources.
6 changes: 3 additions & 3 deletions docs/users/extension/extension-releasing.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ To ensure Qwen Code can automatically find the correct release asset for each pl

#### Archive structure

Archives must be fully contained extensions and have all the standard requirements - specifically the `qwen-extension.json` file must be at the root of the archive.
Archives must be fully contained extensions and have a supported root manifest: `qwen-extension.json` for a native Qwen extension, or `plugin.json` for an [Agent Plugins v1](./agent-plugins.md) package.

The rest of the layout should look exactly the same as a typical extension, see [introduction.md](./introduction.md).

Expand Down Expand Up @@ -131,7 +131,7 @@ You can publish Qwen Code extensions as scoped npm packages (e.g. `@your-org/my-

### Package requirements

Your npm package must include a `qwen-extension.json` file at the package root. This is the same config file used by all Qwen Code extensions — the npm tarball is simply another delivery mechanism.
Your npm package must include a supported manifest at the package root: `qwen-extension.json` for a native Qwen extension, or `plugin.json` for an [Agent Plugins v1](./agent-plugins.md) package. The npm tarball is simply another delivery mechanism.

A minimal package structure looks like:

Expand All @@ -145,7 +145,7 @@ my-extension/
└── agents/ # optional custom subagents
```

Make sure `qwen-extension.json` is included in your published package (i.e. not excluded by `.npmignore` or the `files` field in `package.json`).
Make sure the selected root manifest and all referenced package files are included in your published package (i.e. not excluded by `.npmignore` or the `files` field in `package.json`).

### Publishing

Expand Down
20 changes: 17 additions & 3 deletions docs/users/extension/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Qwen Code extensions package prompts, MCP servers, subagents, skills and custom commands into a familiar and user-friendly format. With extensions, you can expand the capabilities of Qwen Code and share those capabilities with others. They are designed to be easily installable and shareable.

Extensions and plugins from [Gemini CLI Extensions Gallery](https://geminicli.com/extensions/), [Claude Code Marketplace](https://claudemarketplaces.com/), and Qoder can be directly installed into Qwen Code. This cross-platform compatibility gives you access to a rich ecosystem of extensions and plugins, dramatically expanding Qwen Code's capabilities without requiring extension authors to maintain separate versions.
Extensions and plugins from [Gemini CLI Extensions Gallery](https://geminicli.com/extensions/), [Claude Code Marketplace](https://claudemarketplaces.com/), Qoder, and the portable [Agent Plugins v1](./agent-plugins.md) format can be directly installed into Qwen Code. This cross-platform compatibility gives you access to a rich ecosystem of extensions and plugins, dramatically expanding Qwen Code's capabilities without requiring extension authors to maintain separate versions.

## Extension management

Expand Down Expand Up @@ -113,6 +113,18 @@ The installer converts the Qoder manifest to `qwen-extension.json` and preserves

When a Qoder plugin contains `system-prompt.md` at its root, Qwen Code loads it as extension context. If the plugin also contains `QWEN.md` or declares other context files, all context files are retained and deduplicated.

#### From Agent Plugins v1

Qwen Code natively loads portable Agent Plugins v1 packages without converting or rewriting `plugin.json`, `mcp.json`, or `SKILL.md` files:

```bash
qwen extensions install ./my-agent-plugin
qwen extensions link ./my-agent-plugin
qwen extensions install owner/my-agent-plugin
```

The portable runtime supports Agent Skills plus stdio and Streamable HTTP MCP servers. Commands, agents, hooks, client namespaces, and legacy SSE MCP are not activated. See [Agent Plugins v1](./agent-plugins.md) for the complete support matrix.

#### From npm Registry

Qwen Code supports installing extensions from npm registries using scoped package names. This is ideal for teams with private registries that already have auth, versioning, and publishing infrastructure in place.
Expand All @@ -139,7 +151,7 @@ Only scoped packages (`@scope/package-name`) are supported to avoid ambiguity wi

**Authentication** is handled automatically via the `NPM_TOKEN` environment variable or registry-specific `_authToken` entries in your `.npmrc` file.

> **Note:** npm extensions must include a `qwen-extension.json` file at the package root, following the same format as any other Qwen Code extension. See [Extension Releasing](./extension-releasing.md#releasing-through-npm-registry) for packaging details.
> **Note:** npm extensions must include either a native `qwen-extension.json` or an Agent Plugins v1 `plugin.json` at the package root. See [Extension Releasing](./extension-releasing.md#releasing-through-npm-registry) for packaging details.

#### From Git Repository

Expand Down Expand Up @@ -237,7 +249,9 @@ qwen extensions update --all

On startup, Qwen Code looks for extensions in `<home>/.qwen/extensions`

Extensions exist as a directory that contains a `qwen-extension.json` file. For example:
Native Qwen extensions exist as a directory that contains a `qwen-extension.json` file. Agent Plugins v1 packages instead retain their root `plugin.json`; see [Agent Plugins v1](./agent-plugins.md).

For example, a native Qwen extension is stored at:

`<home>/.qwen/extensions/my-extension/qwen-extension.json`

Expand Down
3 changes: 2 additions & 1 deletion packages/acp-bridge/src/status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1082,7 +1082,8 @@ export type ServeExtensionOriginSource =
| 'QwenCode'
| 'Claude'
| 'Gemini'
| 'Qoder';
| 'Qoder'
| 'AgentPlugins';

export interface ServeExtensionCapabilities {
mcpServerCount: number;
Expand Down
27 changes: 27 additions & 0 deletions packages/cli/src/commands/extensions/consent.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,33 @@ describe('extensionConsentString', () => {
expect(result).toContain('Extensions may introduce unexpected behavior');
});

it('treats Agent Plugins as a native format while keeping safety details', () => {
const result = extensionConsentString(
{
name: 'portable-plugin',
version: '1.0.0',
mcpServers: { local: { command: 'node', args: ['server.js'] } },
},
[],
[
{
name: 'direct',
description: 'Direct skill',
level: 'extension',
filePath: '/test/direct/SKILL.md',
body: 'Instructions',
},
],
[],
'AgentPlugins',
);

expect(result).not.toContain('Some features may not work perfectly');
expect(result).toContain('Extensions may introduce unexpected behavior');
expect(result).toContain('local');
expect(result).toContain('direct');
});

it('should include MCP servers when present', () => {
const config: ExtensionConfig = {
name: 'test-extension',
Expand Down
6 changes: 2 additions & 4 deletions packages/cli/src/commands/extensions/consent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ export function extensionConsentString(
originSource: string = 'QwenCode',
): string {
const output: string[] = [];
if (originSource !== 'QwenCode') {
if (originSource !== 'QwenCode' && originSource !== 'AgentPlugins') {
output.push(
t(
'You are installing an extension from {{originSource}}. Some features may not work perfectly with Qwen Code.',
Expand All @@ -163,9 +163,7 @@ export function extensionConsentString(
}
const mcpServerEntries = Object.entries(extensionConfig.mcpServers || {});
const displayLabel = extensionConfig.displayName ?? extensionConfig.name;
output.push(
t('Installing extension "{{name}}".', { name: displayLabel }),
);
output.push(t('Installing extension "{{name}}".', { name: displayLabel }));
if (
typeof extensionConfig.description === 'string' &&
extensionConfig.description
Expand Down
18 changes: 18 additions & 0 deletions packages/cli/src/commands/extensions/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,4 +229,22 @@ describe('extensionToOutputString', () => {
expect(result).not.toContain('user');
expect(result).not.toContain('token');
});

it('should display the native Agent Plugins origin', () => {
const extension = createMockExtension({
installMetadata: {
type: 'local',
source: '/path/to/portable-plugin',
originSource: 'AgentPlugins',
},
});

const result = extensionToOutputString(
extension,
mockExtensionManager,
'/workspace',
);

expect(result).toContain('Origin: AgentPlugins');
});
});
3 changes: 3 additions & 0 deletions packages/cli/src/commands/extensions/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ export function extensionToOutputString(
output += `\n ${t('Path:')} ${extension.path}`;
if (extension.installMetadata) {
output += `\n ${t('Source:')} ${redactUrlCredentials(extension.installMetadata.source)} (${t('Type:')} ${extension.installMetadata.type})`;
if (extension.installMetadata.originSource) {
output += `\n ${t('Origin:')} ${extension.installMetadata.originSource}`;
}
if (extension.installMetadata.ref) {
output += `\n ${t('Ref:')} ${extension.installMetadata.ref}`;
}
Expand Down
34 changes: 34 additions & 0 deletions packages/cli/src/services/FileCommandLoader.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -604,6 +604,40 @@ describe('FileCommandLoader', () => {
expect(extCommand?.description).toMatch(/^\[test-ext\]/);
});

it('ignores commands bundled in Agent Plugins', async () => {
const extensionDir = path.join(
process.cwd(),
'.qwen/extensions/agent-plugin',
);
mock({
[extensionDir]: {
commands: {
'deploy.toml': 'prompt = "Unconsented command"',
},
},
});
const mockConfig = {
getProjectRoot: vi.fn(() => process.cwd()),
getExtensions: vi.fn(() => [
{
name: 'agent-plugin',
version: '1.0.0',
isActive: true,
path: extensionDir,
installMetadata: { originSource: 'AgentPlugins' },
},
]),
getFolderTrustFeature: vi.fn(() => false),
getFolderTrust: vi.fn(() => false),
} as unknown as Config;

const commands = await new FileCommandLoader(mockConfig).loadCommands(
signal,
);

expect(commands).toEqual([]);
});

it('extension commands have extensionName metadata for conflict resolution', async () => {
const userCommandsDir = Storage.getUserCommandsDir();
const projectCommandsDir = new Storage(
Expand Down
6 changes: 5 additions & 1 deletion packages/cli/src/services/FileCommandLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,11 @@ export class FileCommandLoader implements ICommandLoader {
if (this.config) {
const activeExtensions = this.config
.getExtensions()
.filter((ext) => ext.isActive)
.filter(
(ext) =>
ext.isActive &&
ext.installMetadata?.originSource !== 'AgentPlugins',
Comment thread
callmeYe marked this conversation as resolved.
Resolved
)
.sort((a, b) => a.name.localeCompare(b.name)); // Sort alphabetically for deterministic loading

// Collect command directories from each extension
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,11 @@ export const PluginDetailView = ({
{redactUrlCredentials(ext.installMetadata.source)}
</InfoRow>
)}
{ext.installMetadata?.originSource && (
<InfoRow label={t('Origin:')}>
{ext.installMetadata.originSource}
</InfoRow>
)}
<InfoRow label={t('Components:')}>{componentSummary(ext)}</InfoRow>
</Box>

Expand Down
8 changes: 7 additions & 1 deletion packages/core/src/config/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,12 @@ function normalizeGitCoAuthor(value: GitCoAuthorParam | undefined): {
};
}

export type ExtensionOriginSource = 'QwenCode' | 'Claude' | 'Gemini' | 'Qoder';
export type ExtensionOriginSource =
| 'QwenCode'
| 'Claude'
| 'Gemini'
| 'Qoder'
| 'AgentPlugins';
export type ExtensionNetworkPolicy = 'public';

export interface ExtensionInstallMetadata {
Expand Down Expand Up @@ -844,6 +849,7 @@ export class MCPServerConfig {
*/
readonly scope?: McpServerScope,
readonly alwaysLoadTools?: boolean,
readonly agentPluginV1?: boolean,
) {}
}

Expand Down
9 changes: 9 additions & 0 deletions packages/core/src/extension/agent-plugins-v1/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/**
* @license
* Copyright 2026 Qwen Team
* SPDX-License-Identifier: Apache-2.0
*/

export * from './manifest.js';
export * from './mcp.js';
export * from './skills.js';
Loading
Loading