Commit graph

1394 commits

Author SHA1 Message Date
pomelo-nwu
3bfe34a1dc telemetry: track cached content tokens for accurate context calculation
- Add cachedContentTokenCount tracking in uiTelemetry service
- Collect cached_content_token_count from streaming usage metadata
- Use cached tokens instead of estimated overhead when available
- Fix messages token calculation to avoid 'messages = 0' issue

This improves context window display accuracy when using providers
that support prefix caching (e.g., DashScope).

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-18 17:51:50 +08:00
pomelo
d4379d6ee6
Merge branch 'main' into feat/context-usage 2026-03-18 16:45:12 +08:00
tanzhenxin
d1b761adf2
Merge pull request #2425 from kkhomej33-netizen/fix/ctrl-r-command-search-order
Some checks failed
Qwen Code CI / Test-3 (push) Has been skipped
Qwen Code CI / Test-4 (push) Has been skipped
Qwen Code CI / Lint (push) Failing after 24s
Qwen Code CI / CodeQL (push) Failing after 24s
Qwen Code CI / Test (push) Has been skipped
Qwen Code CI / Test-1 (push) Has been skipped
Qwen Code CI / Test-2 (push) Has been skipped
Qwen Code CI / Test-5 (push) Has been skipped
Qwen Code CI / Test-6 (push) Has been skipped
Qwen Code CI / Test-7 (push) Has been skipped
Qwen Code CI / Test-8 (push) Has been skipped
E2E Tests / E2E Test (Linux) - sandbox:docker (push) Failing after 5s
E2E Tests / E2E Test (Linux) - sandbox:none (push) Failing after 6s
Qwen Code CI / Post Coverage Comment (push) Has been skipped
E2E Tests / E2E Test - macOS (push) Has been cancelled
fix(cli): show newest-first history for Ctrl+R command search
2026-03-18 13:51:28 +08:00
tanzhenxin
080271031d
Merge pull request #2400 from QwenLM/feat/system-prompt-sdk
feat: add system prompt customization options in SDK and CLI
2026-03-18 11:29:21 +08:00
DragonnZhang
7886ec6c8d fix(keypress): handle unsupported Kitty CSI-u keys and recover plain text
- Add helper functions for better code organization (createPrintableKey,
  getCompleteCsiSequenceLength, parsePlainTextPrefix)
- Drop unsupported Kitty CSI-u keys without blocking subsequent input
- Recover plain text that arrives in same chunk after unsupported CSI-u keys
- Add comprehensive tests for edge cases (CAPS_LOCK, event metadata variants)

Improves robustness of Kitty keyboard protocol parsing by gracefully
handling unsupported key codes and ensuring plain text input is not lost.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-17 14:02:41 +08:00
zach
46b9c75f83 fix(cli): show newest-first history for Ctrl+R command search 2026-03-16 14:16:03 +00: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
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
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
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
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
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
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
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
Shaojin Wen
1359563f45
feat(skills): add bundled /review skill for out-of-the-box code review (#2348)
feat(skills): add bundled /review skill for out-of-the-box code review
2026-03-14 15:15:08 +08:00
tanzhenxin
88685e55f6 fix(core): strip orphaned user entries before retry to prevent API errors
Replace isContinuation boolean with SendMessageType enum for clearer
message type semantics. Add stripOrphanedUserEntriesFromHistory() to
clean up orphaned user entries in chat history before retry operations,
preventing 'messages with role tool must be a response to preceding
message with tool_calls' API errors.

Fixes #2360

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-14 12:51:34 +08:00
tanzhenxin
cb1f8d7691
Merge pull request #2350 from QwenLM/fix/ctrl-f-pty-artifact
fix(cli): prevent Ctrl+F from leaking to PTY as ^F artifact
2026-03-13 17:32:18 +08:00
tanzhenxin
f831586d96 fix(cli): prevent Ctrl+F from leaking to PTY as ^F artifact
When toggling shell focus mode with Ctrl+F, the raw control character
was being forwarded to the PTY, causing a ^F artifact to appear in the
shell. This fix intercepts the Ctrl+F keypress before it reaches the
PTY when it's used for focus mode toggling.

Fixes #2236

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-13 16:34:55 +08:00
tanzhenxin
4e5fccf82e test(cli): remove flaky keyboard interaction tests on Windows
Remove tests that rely on arrow key and keyboard input timing which are
unreliable on Windows CI due to terminal emulation differences.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-13 16:13:31 +08:00
顾盼
46d57afb22
Merge pull request #2327 from QwenLM/fix-mcp-auth
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
feat(mcp): improve OAuth auth UX - post-auth feedback, i18n, clear auth, and bug fixes
2026-03-13 00:32:58 +08:00
chen893
cc120712c1 fix(i18n): localize slash command descriptions 2026-03-13 00:16:31 +08:00
LaZzyMan
31914a451e feat(mcp): show 'Re-authenticate' for servers with existing OAuth tokens
Servers that already have stored OAuth tokens now display 'Re-authenticate'
instead of 'Authenticate' in the server detail actions, making it clearer
that credentials already exist. Added i18n for all 6 languages.
2026-03-12 22:08:17 +08:00
LaZzyMan
dcf986838c feat(mcp): improve OAuth auth UX - post-auth feedback, i18n, clear auth, and bug fixes
- Show tool count and completion message after successful authentication
- Auto-navigate back to server details after auth success (2s delay)
- Add structured i18n messages for OAuth display (core emits key/params, CLI translates)
- Add 'Clear Authentication' option for servers with stored OAuth tokens
- Fix: clearing auth now disconnects server (not just deleting tokens)
- Fix: auth popup infinite loop caused by onSuccess triggering reload/remount cycle
- Add ToolRegistry.disconnectServer() (disconnect without adding to exclusion list)
- Add i18n translations for all 6 languages (en/zh/de/ja/pt/ru)
2026-03-12 20:46:59 +08:00
yiliang114
d951e30cfa fix: clear retry error messages promptly after auto-retry succeeds
Previously, when an auto-retry countdown elapsed and the server sent a
Retry event (without retryInfo) to signal the actual retry attempt, the
error message was not cleared because `pendingRetryCountdownItemRef` was
still set. This caused stale error messages to persist in the UI until
the user manually initiated a new request.

Additionally, when the user pressed Ctrl+Y to retry, the error was
committed to history (without hint) instead of being discarded. This was
inconsistent with the auto-retry behavior where errors are silently
cleared on success.

Changes:
- Always call clearRetryCountdown() when a Retry event without retryInfo
  is received, removing the flawed guard condition
- Remove error-to-history commit in retryLastPrompt for consistent UX
- Add test covering the countdown-elapsed retry scenario

Closes #2310

Made-with: Cursor
2026-03-12 20:43:29 +08:00
tanzhenxin
e181cfc097
Merge pull request #2315 from xuewenjie123/fix/remove-qrcode-from-oauth-progress-v2
fix: remove QR code from OAuth authentication UI to prevent screen flickering
2026-03-12 18:53:25 +08:00
tanzhenxin
1da0c2bf30 refactor(ui): remove spinner from OAuth progress component
This simplifies the OAuth progress UI by removing the animated spinner,
resulting in a cleaner, more maintainable component.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-12 17:34:08 +08:00
xwj02155382
67089ed532 test: update OAuth progress and header tests for UI changes
- Update Header.test.tsx to expect single border (┌┐) instead of round (╭╯)
- Update QwenOAuthProgress.test.tsx:
  - Change cancel text expectation from '(Press ESC or CTRL+C to cancel)' to 'Esc to cancel'
  - Update loading state test to expect 'Qwen OAuth Authentication' title
  - Simplify animated dots test to avoid timing sensitivity
  - Rename 'gray border' test to 'single border' test

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-12 16:42:43 +08:00
xwj02155382
928701d688 refactor: simplify OAuth progress UI and use semantic colors
- Replace round border with single border style for consistency
- Use semantic-colors theme instead of Colors enum
- Add i18n translations for error messages and status text
- Simplify dots animation with fixed-width cycling patterns
- Consolidate into single bordered box layout
- Add Esc to cancel hint for better UX

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-12 16:23:05 +08:00
tanzhenxin
61fac4b15b test(cli): remove flaky tab navigation test
Remove the 'navigates between tabs with left/right arrows' test from
AskUserQuestionDialog.test.tsx due to timing-related flakiness.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-12 14:09:54 +08:00
xwj02155382
da7a0e8dbd fix: remove qrcode-terminal dependency and update tests
- Remove qrcode-terminal from packages/cli/package.json dependencies
- Remove @types/qrcode-terminal from root package.json devDependencies
- Update QwenOAuthProgress.test.tsx to remove QR code related tests
- Remove qrcode-terminal mock from qwenOAuth2.test.ts

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-12 13:42:59 +08:00
xuewenjie
74315a1aa4 fix: remove QR code from OAuth authentication UI to prevent screen flickering
Remove the terminal QR code display from the OAuth authentication progress
component. The QR code caused severe screen flickering on Windows PowerShell
due to Ink's full re-render cycle combined with the large character volume
of the QR code and high-frequency state updates (spinner + countdown timer).

The authorization URL link is preserved for users to complete authentication.

Changes:
- Remove qrcode-terminal import and QrCodeDisplay component
- Replace with simplified AuthUrlDisplay component (URL only)
- Remove qrCodeData state and QR code generation useEffect
- Remove unused createDebugLogger import and debugLogger instance
2026-03-12 13:42:58 +08:00
pomelo
2a8366390d
Merge pull request #2268 from QwenLM/fix/export-current-session
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: export command should use current session ID instead of loadLastSession
2026-03-11 22:38:45 +08:00
pomelo-nwu
f13a2fdf17 fix: export command should use current session ID instead of loadLastSession
The /export commands (html, md, json, jsonl) were incorrectly using
loadLastSession() which loads the last modified session from disk,
rather than the currently active session.

This fix uses config.getSessionId() to get the current session ID
and loads the correct session with loadSession(sessionId).

Fixes #2267

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-11 11:16:29 +08:00
tanzhenxin
bf99f95602
Merge pull request #2045 from xieyonn/feat/tmp-editor-filename
Some checks failed
Qwen Code CI / Lint (push) Has been cancelled
Qwen Code CI / CodeQL (push) Has been cancelled
E2E Tests / E2E Test (Linux) - sandbox:docker (push) Has been cancelled
E2E Tests / E2E Test (Linux) - sandbox:none (push) Has been cancelled
E2E Tests / E2E Test - macOS (push) Has been cancelled
Qwen Code CI / Post Coverage Comment (push) Has been cancelled
Qwen Code CI / Test (push) Has been cancelled
Qwen Code CI / Test-1 (push) Has been cancelled
Qwen Code CI / Test-2 (push) Has been cancelled
Qwen Code CI / Test-3 (push) Has been cancelled
Qwen Code CI / Test-4 (push) Has been cancelled
Qwen Code CI / Test-5 (push) Has been cancelled
Qwen Code CI / Test-6 (push) Has been cancelled
Qwen Code CI / Test-7 (push) Has been cancelled
Qwen Code CI / Test-8 (push) Has been cancelled
feat(cli): change temporary filename prefix to qwen-edit-
2026-03-10 16:51:42 +08:00
tanzhenxin
9154048be2
Merge pull request #2219 from LaZzyMan/fix-mcp-extension-ui
fix: clean up MCP server display and add CONCAT merge strategy for mcp allowed/excluded lists
2026-03-10 13:55:59 +08:00
tanzhenxin
29e82822e2 fix(test): simplify AskUserQuestionDialog tests to remove flaky timing-dependent tests
Keep only essential stable tests:
- Rendering tests (6)
- Basic single-select interaction (4)
- Basic multi-select interaction (2)
- Multiple questions navigation (4)
- Focus behavior (1)

Remove timing-sensitive tests involving:
- Auto-advance after selection (setTimeout 150ms)
- Custom input state preservation across navigation
- Complex multi-select toggle state assertions

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-10 11:11:23 +08:00
tanzhenxin
a4136f484d
Merge pull request #2110 from QwenLM/fix/clear-message-after-change-modle
fix(cli): clear static error message when starting new query
2026-03-10 10:36:32 +08:00
pomelo
d80199d893
Merge pull request #2212 from xuewenjie123/fix/mcp-oauth-scope-from-protected-resource
fix(mcp): use scopes from protected resource metadata (RFC 9728)
2026-03-10 10:23:12 +08:00
LaZzyMan
d32dcab5db fix: remove redundant scope field from MCP server display and add CONCAT merge strategy for mcp allowed/excluded lists 2026-03-09 21:38:42 +08:00
LaZzyMan
817f24e0ea fix bugs 2026-03-09 19:11:40 +08:00
LaZzyMan
a02ed08d26 fix ui 2026-03-09 18:26:01 +08:00
xwj02155382
c074960dd7 fix: increase wait times in AskUserQuestionDialog tests for CI stability
The tests used fixed wait times (200ms) that were too close to the
auto-advance timeout (150ms). In CI environments (especially Windows
with Node 20), timing can be less predictable due to event loop
scheduling differences, causing race conditions.

Changes:
- Increased wait(200) to wait(300) for auto-advance tests
- Increased wait() to wait(100) for navigation tests in custom input state test

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-09 18:25:02 +08:00
LaZzyMan
0c21071bf6 fix ci test 2026-03-09 16:08:11 +08:00
LaZzyMan
a19f1b1ab3 add i18n 2026-03-09 16:01:16 +08:00
LaZzyMan
597ce85335 fix extension ui 2026-03-09 15:49:02 +08:00
LaZzyMan
15b5bc3bfc fix mcp ui 2026-03-09 15:20:30 +08:00
LaZzyMan
9e34b5db4a fix: 重写 AuthenticateStep 使用正确的 OAuth 流程
- 按照 mcpCommand.ts 中的 auth 实现重写 AuthenticateStep
- 使用 MCPOAuthProvider + MCPOAuthTokenStorage 进行实际 OAuth 认证
- 通过 appEvents/AppEvent.OauthDisplayMessage 展示认证过程消息
- 认证成功后自动触发 tool re-discovery 和 client tools 更新
- 只在 server.config.oauth?.enabled 为 true 时显示 Authenticate 选项
- 认证成功后 reload servers 刷新列表
2026-03-09 12:05:27 +08:00
LaZzyMan
8c693ba738 test: 修复 extensionsCommand 测试
- 更新 mock ExtensionManager 以通过 instanceof 检查
- 确保测试与新的错误处理逻辑兼容
2026-03-09 11:12:46 +08:00
LaZzyMan
2d5088e58f fix: 修复 Extension Management 命令报错 (问题 6)
- 在 listAction 中添加 ExtensionManager 可用性检查
- 当 ExtensionManager 不可用时显示友好的错误提示
- 改进:避免用户遇到静默失败,提供明确的环境不支持信息
2026-03-09 11:11:18 +08:00