qwencode

package
v0.1.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 21, 2026 License: Apache-2.0 Imports: 12 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package qwen adapts the Qwen Code CLI (`qwen`) into an inference backend.

The CLI is launched non-interactively in an empty scratch directory with a sanitized environment and a generated settings file that leaves it no tools: agent2api uses it as a plain LLM, never as an agent that touches the machine.

How the tools get turned off, and why it takes this much

The other three adapters disable tools with a flag. Qwen Code has none, and the settings that do the job come with two traps its own documentation names.

An allowlist looks like the answer — `tools.core` is fail-closed over the core tool set — but an *empty* one "is treated as unset and disables nothing", so `tools.core: []` would leave every tool live. A non-empty list of a name that matches nothing is what actually closes it.

That alone is not enough. The tools it removes stay reachable through `tool_search`, which is not a core tool and so survives the allowlist: asked to list a directory under `tools.core` alone, the CLI found `glob` and `run_shell_command` again and read the directory. The non-core tools have to be denied by name as well.

A denylist has the failure mode the project cannot accept — the docs warn it "must be re-audited per release", because a built-in added later registers until explicitly denied. So the deny list is not the guarantee. The guarantee is [parser], which reads the tool list the CLI reports on startup and fails the run if it is not empty. A future release that adds a tool breaks loudly instead of quietly handing the model a shell.

`--safe-mode` is deliberately not passed. It disables customisations, and the settings file below is one: with it the CLI came back with all 23 tools live.

Index

Constants

View Source
const ID = "qwen-code"

ID is the adapter id used to namespace this backend's models.

Variables

This section is empty.

Functions

func New

func New(opts adapter.Options) (adapter.Adapter, error)

New builds the adapter from its resolved configuration.

Types

type Adapter

type Adapter struct {
	// contains filtered or unexported fields
}

Adapter is the Qwen Code backend.

func (*Adapter) ID

func (a *Adapter) ID() string

ID implements adapter.Adapter.

func (*Adapter) Probe

func (a *Adapter) Probe(ctx context.Context) (adapter.Health, error)

Probe checks that the CLI is installed and exposes the flags agent2api needs.

It reports no account, and says nothing about why. `qwen auth` describes itself as removed and the CLI offers no equivalent of `claude auth status --json`, so the only way to learn whether it is logged in is to send a prompt — which costs tokens, and probing is meant to be free. An unauthenticated install fails its first real request with the CLI's own explanation instead.

That could be a note, and was one. But Health.Notes is for remarks about a particular install — a flag this version lacks, a sandbox loosened in config — and a note that fires on every healthy run is not a remark, it is a permanent footnote under a table that is otherwise all `ok`. The empty account column carries the same information for anyone who looks.

func (*Adapter) Run

func (a *Adapter) Run(ctx context.Context, req ir.Request) (<-chan ir.Event, error)

Run executes one request as a fresh CLI process.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL