- 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>
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>
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>
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>
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
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.
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>
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>
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>
- 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>
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>
- 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>
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>
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>
StartSessionEvent requires getTruncateToolOutputThreshold,
getTruncateToolOutputLines, getIdeMode, getShouldUseNodePtyShell,
and getHookSystem from the config object.
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
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>
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>
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.
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.
- 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>
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>
- 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>
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>
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>
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>
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>
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>