Commit graph

3801 commits

Author SHA1 Message Date
tanzhenxin
7f915be881 fix(shell): ensure CRLF line endings for .bat/.cmd files
- Add automatic LF to CRLF conversion when writing .bat/.cmd files
- Handle null encoding detection gracefully in shellExecutionService
- Add comprehensive tests for CRLF conversion edge cases

This ensures Windows batch files work correctly, as cmd.exe requires
CRLF line endings for proper parsing of multi-line constructs.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-16 14:29:31 +08:00
mingholy.lmh
b9baf183b0 feat: add qwen fallback pattern with 8k output token limit
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-16 14:00:38 +08:00
tanzhenxin
15b5f0224b fix(shell): force UTF-8 output decoding after codepage switch
Return forceUtf8Output flag from wrapCommandForWindowsEncoding to
signal that output should be decoded as UTF-8 when we've switched
the codepage to 65001. This ensures consistent encoding for both
command input and output on Windows with non-UTF-8 system codepage.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-16 12:45:26 +08:00
tanzhenxin
f8f189ebc2 fix(shell): always switch codepage on Windows for consistency
Simplify wrapCommandForWindowsEncoding to always prefix with chcp 65001
on Windows with non-UTF-8 codepage, rather than only for non-ASCII
commands. This ensures script files written by qwen-code are also
interpreted correctly by cmd.exe.

Add WINDOWS_UTF8_CODE_PAGE constant and update test script for
PowerShell 5.1 compatibility.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-16 12:37:18 +08:00
tanzhenxin
b917cf8e3c fix(shell): resolve Windows GBK encoding for non-ASCII commands
Add wrapCommandForWindowsEncoding() to prefix non-ASCII commands with
chcp 65001 on Windows with non-UTF-8 codepages. Fix CP936 mapping from
gb2312 to gbk (GBK is the correct superset). Update Windows encoding
test scripts to demonstrate the fix.

This ensures Chinese and other non-ASCII characters display correctly
when running commands on Windows systems with GBK/CP936 codepage.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-16 12:10:29 +08:00
LaZzyMan
939d6a6f32 fix: trust user-level extension dirs for read_file and ls permissions
User-level extensions (~/.qwen/extensions/) were not included in the
trusted path list, causing read_file and ls to prompt for confirmation
when a skill inside a user-installed extension tries to access files
within its own directory (e.g. reference docs bundled with the extension).

Project-level extensions (<project>/.qwen/extensions/) were already
covered implicitly by isPathWithinWorkspace(). The gap was only for
user-scope extensions.

Changes:
- packages/core/src/config/storage.ts: add static getUserExtensionsDir()
- packages/core/src/tools/read-file.ts: include userExtensionsDir in the
  allow path for getDefaultPermission()
- packages/core/src/tools/ls.ts: same, plus add missing Storage import
2026-03-16 12:06:35 +08:00
LaZzyMan
d129ddc489 Merge branch 'main' into feat/support-permission 2026-03-16 11:42:37 +08:00
LaZzyMan
02ea2ed70c fix settings 2026-03-16 11:28:05 +08:00
mingholy.lmh
b3b98540d5 feat: increase DEFAULT_OUTPUT_TOKEN_LIMIT from 8K to 16K
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-16 11:10:40 +08:00
tanzhenxin
58bee3dec9
Merge pull request #2388 from QwenLM/fix/remove-enableToolOutputTruncation-setting
fix(core): improve shell tool truncation, simplify tool output handling, and remove summarization
2026-03-16 09:51:37 +08:00
tanzhenxin
d0a4dcc89c
Merge pull request #2374 from QwenLM/fix/vscode-session-race-conditions
fix(vscode): prevent race conditions in prompt cancellation and streaming
2026-03-16 09:51:20 +08:00
tanzhenxin
e22a29c6a4
Merge pull request #2389 from QwenLM/fix/rapid-pty-output-capture
fix(core): correctly capture rapid pty outputs in interactive shell mode
2026-03-16 09:50:33 +08:00
pomelo
15424f263b
Merge pull request #2367 from QwenLM/refactor/send-message-type
fix(core): strip orphaned user entries before retry to prevent API errors
2026-03-16 09:43:59 +08:00
Дмитрий Волобуев
f816ffbd04 fix(pipeline): handle duplicate finish_reason chunks from OpenRouter
Some OpenRouter model providers (e.g. google/gemini-3.1-flash-lite-preview)
send two consecutive SSE chunks with finish_reason='tool_calls'. The second
chunk arrives after streamingToolCallParser.reset() has been called, so it
carries empty parts — no functionCall entries.

The original handleChunkMerging treated every finish chunk as authoritative
and overwrote pendingFinishResponse, discarding the functionCall parts that
were correctly assembled from the first finish chunk.

Fix: when a second finish chunk arrives and a pendingFinishResponse already
exists, only merge usageMetadata (if present) and keep the candidates from
the first finish chunk.
2026-03-16 00:26:19 +03:00
DragonnZhang
ee33a3c35e feat: add system prompt customization options in SDK and CLI 2026-03-16 02:57:31 +08:00
tanzhenxin
110fcd7b7b
Merge pull request #2280 from xuewenjie123/fix/hooks-json-schema-type
Some checks are pending
Qwen Code CI / Lint (push) Waiting to run
Qwen Code CI / Test (push) Blocked by required conditions
Qwen Code CI / Test-1 (push) Blocked by required conditions
Qwen Code CI / Test-2 (push) Blocked by required conditions
Qwen Code CI / Test-3 (push) Blocked by required conditions
Qwen Code CI / Test-4 (push) Blocked by required conditions
Qwen Code CI / Test-5 (push) Blocked by required conditions
Qwen Code CI / Test-6 (push) Blocked by required conditions
Qwen Code CI / Test-7 (push) Blocked by required conditions
Qwen Code CI / Test-8 (push) Blocked by required conditions
Qwen Code CI / Post Coverage Comment (push) Blocked by required conditions
Qwen Code CI / CodeQL (push) Waiting to run
E2E Tests / E2E Test (Linux) - sandbox:docker (push) Waiting to run
E2E Tests / E2E Test (Linux) - sandbox:none (push) Waiting to run
E2E Tests / E2E Test - macOS (push) Waiting to run
fix: correct hooks JSON schema type definition
2026-03-15 22:44:01 +08:00
tanzhenxin
06d8a01532
Merge pull request #2391 from kkhomej33-netizen/fix/macos-pty-sandbox-rules
fix(cli): allow /dev/ptmx and /dev/ttys* in macOS permissive sandbox
2026-03-15 22:33:40 +08:00
tanzhenxin
fb44b76abd
Merge pull request #2157 from QwenLM/zth/keep-rejected-plan-content-visible
Some checks are pending
Qwen Code CI / CodeQL (push) Waiting to run
Qwen Code CI / Lint (push) Waiting to run
Qwen Code CI / Test (push) Blocked by required conditions
Qwen Code CI / Test-1 (push) Blocked by required conditions
Qwen Code CI / Test-2 (push) Blocked by required conditions
Qwen Code CI / Test-3 (push) Blocked by required conditions
Qwen Code CI / Test-4 (push) Blocked by required conditions
Qwen Code CI / Test-5 (push) Blocked by required conditions
Qwen Code CI / Test-6 (push) Blocked by required conditions
Qwen Code CI / Test-7 (push) Blocked by required conditions
Qwen Code CI / Test-8 (push) Blocked by required conditions
Qwen Code CI / Post Coverage Comment (push) Blocked by required conditions
E2E Tests / E2E Test (Linux) - sandbox:docker (push) Waiting to run
E2E Tests / E2E Test (Linux) - sandbox:none (push) Waiting to run
E2E Tests / E2E Test - macOS (push) Waiting to run
Keep rejected plan content visible in plan mode
2026-03-15 22:11:57 +08:00
tanzhenxin
2719540fab
Merge pull request #2024 from drewd789/fix/pdf-session-corruption
fix(core): reject PDF files to prevent session corruption (fixes #2020)
2026-03-15 22:06:41 +08:00
tanzhenxin
33c6d9cbf3
Merge pull request #2286 from LaZzyMan/fix/extension-install-symlink-windows
fix(extension): disable symlinks on Windows during git clone to fix install failure
2026-03-15 21:55:44 +08:00
tanzhenxin
7ee65e1738 fix(fileUtils): remove error field from skipped file result
When a file is skipped because the model doesn't support a modality,
it should not be treated as an error. The error field was incorrectly
being set alongside the informational message.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-15 21:44:28 +08:00
tanzhenxin
fdad1980d7 fix(test): add missing getContentGeneratorConfig mock to tests
Adds the required getContentGeneratorConfig mock to read-file.test.ts
and pathReader.test.ts to fix failing tests that depend on content
generator configuration.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-15 21:41:20 +08:00
tanzhenxin
5c31341205 Merge remote main into fix/pdf-session-corruption
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-15 21:24:57 +08:00
tanzhenxin
6997636ba4 fix(fileUtils): use config modalities instead of model-based defaults
This fixes session corruption issues where the modality check was based on
the model name rather than the actual resolved config, causing inconsistent
behavior when the config's modalities differed from the defaults.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-15 21:22:57 +08:00
tanzhenxin
59c1765ec5
Merge pull request #2001 from hs-ye/docs/subagent-limits
Docs/subagent system prompt limits
2026-03-15 21:15:53 +08:00
tanzhenxin
1852a73a3f fix(subagents): change limits from hard errors to soft warnings
- Increase description warning threshold from 500 to 1,000 characters
- Change system prompt 10,000 char limit from error to warning
- Remove intermediate 5,000 char warning threshold for system prompts
- Update documentation to reflect soft warning behavior

This provides more flexibility for users while still guiding them
toward better practices.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-15 20:56:25 +08:00
tanzhenxin
e2affcebdd
Merge pull request #2364 from netbrah/fix/empty-choices-crash
fix(core): guard against empty choices in convertOpenAIResponseToGemini
2026-03-15 20:52:47 +08:00
tanzhenxin
2898e9e60e refactor(core): move candidates assignment inside choice check
Restructures the convertOpenAIResponseToGemini method to set
response.candidates within the choice conditional block, making
the empty choices handling more explicit and the control flow clearer.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-15 20:37:59 +08:00
tanzhenxin
8161ac4523 fix(hooks): correct JSON schema type for hooks configuration
- Add 'array' type support to SettingItemDefinition
- Change hooks field from object to array type
- Add additionalProperties constraint for env fields
- Fix additionalProperties generation to only apply for object types

This ensures the hooks configuration schema correctly represents hooks as an array
and properly validates environment variable objects.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-15 20:32:56 +08:00
tanzhenxin
b83e9ea393
Merge pull request #2333 from chen893/fix/slash-command-i18n
fix(i18n): localize slash command descriptions
2026-03-15 20:12:15 +08:00
tanzhenxin
a165599b32 chore(release): bump version to 0.12.4
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-15 18:45:14 +08:00
tanzhenxin
00baa5085e fix(core): use terminal replay for accurate raw output capture
Replay raw PTY output through a terminal buffer to properly collapse
carriage-return progress updates (e.g., git clone progress) instead of
showing all intermediate states.

This ensures the final output reflects what a user would actually see
in their terminal, with progress bars and spinners collapsed to their
final state.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-15 18:09:07 +08:00
zach
487a8390b0 fix(cli): allow macOS PTY device paths in permissive sandbox 2026-03-15 08:09:35 +00:00
pomelo-nwu
4de9688543 feat(cli): add detail mode to /context and track loaded skill bodies
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-15 14:39:33 +08:00
tanzhenxin
7be66749bf fix(core): fix mock type mismatch in shellExecutionService test
The Terminal.prototype.write mock's data parameter needed to accept
string | Uint8Array to match the actual method signature.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-15 14:35:25 +08:00
tanzhenxin
5a26de927c fix(test): add missing config methods to makeFakeConfig in qwen-logger tests
StartSessionEvent requires getTruncateToolOutputThreshold,
getTruncateToolOutputLines, getIdeMode, getShouldUseNodePtyShell,
and getHookSystem from the config object.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-15 14:28:33 +08:00
tanzhenxin
1140c10cbe fix(core): correctly capture rapid pty outputs in interactive shell mode
When PTY outputs data rapidly, the headless terminal rendering is
slower than appending buffers, and the render queue can be overrun
before finalize() races on exit. Additionally, node-pty can fire
onExit before all onData events have been delivered.

This fix:
- Captures raw output immediately before processing
- Uses setImmediate drain mechanism to flush late onData events
- Builds output from raw chunks instead of xterm buffer to avoid
  scrollback limit data loss

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-15 14:24:58 +08:00
tanzhenxin
9fe783ad56 fix(truncation): use character budget instead of line wrapping
Replace average-line-length estimation with explicit head/tail budgets.
Remove line wrapping; save original content to file. Handle very long
lines by truncating with ellipsis. Add tests for edge cases with
variable line lengths.

This ensures truncated output stays predictably near the character
threshold, avoiding cases where long lines in the tail would blow past
the budget.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-15 14:05:03 +08:00
tanzhenxin
e484dfbbad refactor: remove summarizeToolOutput feature
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>

Remove the summarizeToolOutput setting and related functionality.

This feature allowed LLM-based summarization of shell tool output but is no longer needed.

This simplifies the codebase by removing unused summarization logic and configuration options.
2026-03-15 13:51:32 +08:00
tanzhenxin
04b94d5720 refactor(core): move truncation logic from scheduler to shell tool
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>

- Extract truncateAndSaveToFile to utils/truncation.ts with tests

- Move truncation handling from CoreToolScheduler to ShellTool

- Remove outputFile field from ToolCallResponseInfo and display types

- Add line limit constraint alongside character threshold for truncation

This improves separation of concerns by handling output truncation at the tool level where the output is generated, rather than centrally in the scheduler.
2026-03-15 13:37:12 +08:00
tanzhenxin
6e0cf6541d refactor(telemetry): update session event fields to match current config
- Remove deprecated fields: embedding_model, api_key_enabled, vertex_ai_enabled, log_prompts_enabled
- Add new fields: truncate_tool_output_threshold, truncate_tool_output_lines, hooks, ide_enabled, interactive_shell_enabled

This aligns telemetry data with the current CLI configuration options.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-15 12:06:01 +08:00
tanzhenxin
fed08cb1dd fix(config): remove enableToolOutputTruncation setting
Remove the enableToolOutputTruncation boolean setting. Users can now
disable truncation by setting truncateToolOutputThreshold to 0 or a
negative value instead of using a separate toggle.

This simplifies the configuration and prevents users from accidentally
disabling truncation which could cause memory issues with large tool
outputs.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-15 11:30:02 +08:00
tanzhenxin
b2c9e641ef
Merge pull request #2362 from netbrah/fix/deepseek-r1-output-limit
fix(core): add deepseek-r1 to output token limit patterns
2026-03-14 21:46:35 +08:00
tanzhenxin
545f466442 feat(telemetry): add user retry event tracking
This enables tracking of user retry actions for analytics purposes.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-14 21:14:42 +08:00
tanzhenxin
ba1680564e fix(session): handle cancellation during prompt queue wait
- Install AbortController before awaiting previous prompt so session/cancel
  during the wait targets the correct prompt
- Check if cancelled after waiting for previous prompt to complete
- Drop untagged streamEnd events when a tagged stream is active

This prevents race conditions where a new prompt could be incorrectly
cancelled or have its state cleared by stale events from a previous prompt.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-14 17:47:12 +08:00
Shaojin Wen
cf7204118f fix(core): avoid corrupting JSON strings in SSE whitespace normalization
Replace broad \s+} and \s+] regexes with a narrower pattern that only
strips whitespace before closing braces/brackets when preceded by a
JSON value terminator (", digit, ] or }). Prevents mangling string
values like "hello   }" which contain whitespace before braces.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-14 17:46:54 +08:00
Shaojin Wen
1b651d5c4f refactor(cli): make /btw non-blocking with fire-and-forget API call
Run the /btw API call as fire-and-forget in interactive mode so the
main conversation is not blocked while waiting for the answer. The
action now returns immediately after setting the pending item, and
the background promise updates the UI when the answer arrives.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-14 17:41:28 +08:00
Shaojin Wen
b1b5f72507 fix(cli): revert tools:[] to empty config for provider compatibility
Revert tools:[] to empty config {} to avoid provider compatibility
issues. Empty tools array is truthy and gets passed through to API
requests, which can cause errors on some providers. Omitting the
tools field entirely achieves the same effect (no tool access).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-14 17:24:57 +08:00
tanzhenxin
2d4310ee9b fix(vscode): scope streamEnd to specific request invocation
Add `forRequestId` parameter to `sendStreamEnd()` to detect and ignore
stale calls when a newer request has taken over shared state.

This prevents stale handleSendMessage invocations from emitting
streamEnd events tagged with the wrong request ID.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-14 17:13:20 +08:00
高铁
a9c2866ca8 fix(core): define Anthropic stream types locally to fix verbatimModuleSyntax incompatibility
The @anthropic-ai/sdk package's type exports are not compatible with
TypeScript's verbatimModuleSyntax option when using NodeNext module
resolution. Define the stream event types locally to avoid the import error.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-14 17:09:57 +08:00