Skip to content
Closed
Show file tree
Hide file tree
Changes from 29 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
979c49a
Add RFC for Qwen-Code CLI Output Formats and IPC Stream JSON Capability
x22x22 Oct 14, 2025
3b6d07d
Add RFC for Qwen-Code CLI output format and IPC Stream JSON capabilities
x22x22 Oct 14, 2025
98e26c9
Implement new feature for user authentication and improve error handling
x22x22 Oct 14, 2025
004d3ee
refactor: update IPC mode documentation and enhance CLI parameter han…
x22x22 Oct 14, 2025
ad2df66
refactor: streamline Qwen-Code Agent framework documentation and clar…
x22x22 Oct 14, 2025
468d59d
Implement feature X to enhance user experience and fix bug Y in module Z
x22x22 Oct 14, 2025
b760680
refactor: update Qwen-Code Agent SDK documentation for clarity and ac…
x22x22 Oct 14, 2025
77e29bc
refactor: clarify Qwen-Code Agent SDK documentation and improve compo…
x22x22 Oct 14, 2025
8cb242f
refactor: enhance Qwen-Code Agent SDK documentation for clarity and c…
x22x22 Oct 15, 2025
dc7e7b9
refactor: enhance bidirectional communication documentation for Qwen-…
x22x22 Oct 15, 2025
01cbcd8
Refactor RFC documentation for Qwen-Code CLI output formats
x22x22 Oct 15, 2025
185b1e6
refactor: add structured input/output specification for Qwen-Code CLI
x22x22 Oct 15, 2025
2709e96
refactor: add structured input/output specification for Qwen-Code CLI
x22x22 Oct 15, 2025
6605d02
refactor: enhance OpenTelemetry integration and clarify IPC communica…
x22x22 Oct 16, 2025
52a6302
refactor: enhance documentation for Qwen-Code Agent SDK and CLI, deta…
x22x22 Oct 16, 2025
0ec36da
refactor: update Qwen-Code Agent framework documentation to clarify c…
x22x22 Oct 16, 2025
877413e
refactor: enhance Qwen-Code Agent framework documentation with Hook s…
x22x22 Oct 16, 2025
5f17e5f
refactor: enhance Qwen-Code Agent framework documentation with detail…
x22x22 Oct 16, 2025
ecb1c46
refactor: enhance Qwen-Code CLI documentation with structured input/o…
x22x22 Oct 16, 2025
dc094f3
refactor: enhance Qwen-Code CLI documentation with detailed event pay…
x22x22 Oct 16, 2025
1fc24fe
refactor: update Qwen-Code CLI documentation to include console_level…
x22x22 Oct 16, 2025
61ff232
refactor: enhance Qwen-Code CLI documentation with detailed integrati…
x22x22 Oct 16, 2025
2154212
refactor: enhance Qwen-Code CLI documentation with session control de…
x22x22 Oct 16, 2025
dff5d32
Enhance Qwen Code Agent Framework Documentation
x22x22 Oct 16, 2025
f042c04
Refine Qwen-Code Agent Framework RFC: Enhance clarity and structure
x22x22 Oct 16, 2025
76c4e73
feat: add RFC for Qwen-Code CLI structured input/output specification
x22x22 Oct 16, 2025
fee3ee6
feat: Implement stream-json input/output support in CLI
x22x22 Oct 17, 2025
ed8dbe5
refactor: update stream-json session command in CLI documentation
x22x22 Oct 17, 2025
10ebf3d
feat: Enhance StreamJsonSession with control context and prompt queue…
x22x22 Oct 18, 2025
c3b7193
refactor: Clean up .gitignore by removing unnecessary entries
x22x22 Oct 22, 2025
67f99d8
feat: Update examples and scripts to use glm-4.6 model and improve in…
x22x22 Oct 29, 2025
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
219 changes: 218 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,221 @@ logs/
# GHA credentials
gha-creds-*.json

QWEN.md
QWEN.md

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[codz]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py.cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
# Pipfile.lock

# UV
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# uv.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
# poetry.lock
# poetry.toml

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
# pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
# https://pdm-project.org/en/latest/usage/project/#working-with-version-control
# pdm.lock
# pdm.toml
.pdm-python
.pdm-build/

# pixi
# Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
# pixi.lock
# Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
# in the .venv directory. It is recommended not to include this directory in version control.
.pixi

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# Redis
*.rdb
*.aof
*.pid

# RabbitMQ
mnesia/
rabbitmq/
rabbitmq-data/

# ActiveMQ
activemq-data/

# SageMath parsed files
*.sage.py

# Environments
.env
.envrc
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
# .idea/

# Abstra
# Abstra is an AI-powered process automation framework.
# Ignore directories containing user credentials, local state, and settings.
# Learn more at https://abstra.io/docs
.abstra/

# Visual Studio Code
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
# and can be added to the global gitignore or merged into this file. However, if you prefer,
# you could uncomment the following to ignore the entire vscode folder
# .vscode/

# Ruff stuff:
.ruff_cache/

# PyPI configuration file
.pypirc

# Marimo
marimo/_static/
marimo/_lsp/
__marimo__/

# Streamlit
.streamlit/secrets.toml
Comment thread
x22x22 marked this conversation as resolved.
Resolved
39 changes: 39 additions & 0 deletions docs/cli/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,42 @@ Qwen Code executes the command and prints the output to your terminal. Note that
```bash
qwen -p "What is fine tuning?"
```

### Structured stream-json mode

For programmatic integrations, Qwen Code supports structured JSON Lines input and output:

- `--output-format stream-json` switches stdout to emit Claude-compatible envelopes (`user`, `assistant`, `result`, etc.).
- `--input-format stream-json` lets you pipe newline-delimited JSON requests into stdin (e.g., control requests and user messages).
- `--include-partial-messages` enables incremental `stream_event` deltas alongside the final assistant message.

Example one-shot invocation:

```bash
echo '{"type":"user","message":{"content":"List supported flags"}}' \
| qwen --input-format stream-json --output-format stream-json
```

When run in this mode, every stdout line is a standalone JSON object you can parse reliably. Control responses (for example, acknowledging `control_request.initialize`) are also written using the same envelope schema.

To keep a session open for multiple messages, omit `--prompt` and keep stdin open (for example, by running the CLI directly and typing JSON lines):

```bash
npm run stream-json-session
```

The process will remain active until EOF (`Ctrl+D`) or an explicit `control_request.interrupt`, making it suitable for SDK transports that maintain a persistent subprocess connection.

The repository also provides a minimal Python client sample at
`docs/examples/stream-json/simple_stream_json_client.py`. The script is adapted
from `third-party/anthropics/claude-agent-sdk-python/examples/quick_start.py`
and illustrates how to drive the session lifecycle with `control_request`, while
showcasing a short multi-turn exchange (sending several `user` messages in a
row):

```bash
python docs/examples/stream-json/simple_stream_json_client.py
```

Each log entry is separated with `------` and prefixed with `[client]` or `[cli]`
to make debugging the JSON stream easier.
Loading