Commit graph

2307 commits

Author SHA1 Message Date
wenshao
2a28132fed fix(footer): suppress hint when status line active, hide on exit prompts
- Hide "? for shortcuts" when a custom status line is configured
  (status line already occupies the top row, hint is redundant)
- Hide status line during Ctrl+C/D exit prompts to keep footer
  at one row during exit flow
- Matches upstream Claude Code suppressHint + exitMessage behavior
2026-04-08 21:03:21 +08:00
wenshao
63a14ae909 fix(footer): remove Box wrapper from indicators for proper truncation
AutoAcceptIndicator and ShellModeIndicator returned Box>Text, which
prevented the parent Text wrap="truncate" from working (ink cannot
nest Box inside Text). Change both to return plain Text elements
so the footer's truncation applies correctly on narrow terminals.
2026-04-08 20:59:19 +08:00
wenshao
50bf5cc72d fix(footer): truncate hints/mode row to prevent extra lines
Wrap leftBottomContent in Text with wrap="truncate" so the
hints/mode row stays on a single line, matching upstream behavior.
This guarantees the footer is at most 2 rows (status line + hints).
2026-04-08 20:57:03 +08:00
wenshao
cf879f0b58 refactor(footer): match upstream layout — status line + hints coexist
Restructure footer to match Claude Code's layout:
- Left column: status line (top, truncated) + hints/mode (bottom)
- Both rows coexist instead of being mutually exclusive
- Status line uses wrap="truncate" to guarantee single line
- Approval mode returns to the hints row (inline, not separate row)
- Left column uses flexShrink for narrow terminals
2026-04-08 20:54:07 +08:00
wenshao
f9b88c8f8e fix(footer): use wrap instead of truncate for status line text
Allow status line text to wrap to the next line when the terminal
is too narrow, preserving complete information instead of truncating.
2026-04-08 20:48:45 +08:00
wenshao
eaaa55389b fix(footer): prevent status line from pushing right items off screen
Add flexGrow/flexShrink to left section so it takes available space
but yields to right items. Add flexShrink={0} to right section so
context usage, verbose, sandbox indicators are never compressed.
Add overflow="hidden" to left section for clean truncation.
2026-04-08 20:44:47 +08:00
wenshao
a1c33cdb5e refactor(status-line): remove padding config
The status line is now inlined in the footer's left section,
so horizontal padding is no longer applicable. Remove padding
from StatusLineConfig, settings schema, JSON schema, and docs.
2026-04-08 20:24:33 +08:00
wenshao
7804946970 refactor(footer): inline status line in footer left section
Move status line from a dedicated row below the footer into the
footer's left section, replacing "? for shortcuts" when active.
High-priority messages (Ctrl+C/D, Esc, vim INSERT, shell mode)
still override the status line.

Move approval mode indicator to a separate row below the footer,
shown only when mode is non-default. This eliminates the empty
gap in default mode and matches upstream layout.
2026-04-08 20:18:06 +08:00
wenshao
841eb3c70c fix: address reviewer feedback — stdin error logging, JSON schema, i18n
- Log non-EPIPE stdin errors at debug level instead of silently
  swallowing them
- Add proper JSON schema properties for statusLine (type, command,
  padding) with enum, required, and additionalProperties constraints
- Add missing i18n entry for /statusline command description
2026-04-08 20:08:36 +08:00
wenshao
55b1ab174d fix(status-line): derive remaining_percentage from used and reject empty commands
- Compute remaining_percentage as round(100 - used) to guarantee
  used + remaining always sums to exactly 100.0
- Reject empty or whitespace-only command strings in config validation
2026-04-08 18:58:06 +08:00
wenshao
0be4d32cb0 Merge remote-tracking branch 'origin/main' into feature/status-line-customization 2026-04-08 18:50:10 +08:00
wenshao
520ed4e040 fix: address audit findings across status-line and verbose-mode features
- useStatusLine: clamp used/remaining percentage to [0,100], track
  totalLinesRemoved as trigger, clean up debounceRef on unmount
- AppContainer: use drainQueue from useMessageQueue instead of manual
  messageQueueRef to avoid stale-ref reads between renders
- builtin-agents: add WRITE_FILE tool to statusline-setup agent, improve
  PS1 parsing instructions (unquoted assignments, \[/\]/\e escapes),
  strip ANSI colors, remove unreachable symlink instruction
- CompactToolGroupDisplay: fix misleading hint "show full tool output"
  to "toggle verbose mode" across all 6 locales
- AppContainer.test: add missing drainQueue mock
2026-04-08 18:45:44 +08:00
wenshao
c36953816c fix(test): add missing metrics and model fields to Footer test mock
useStatusLine hook accesses sessionStats.metrics.tools.totalCalls,
sessionStats.metrics.files.totalLinesAdded, and currentModel which
were missing from the mock UIState, causing a TypeError crash during
render and making 4 Footer tests fail in CI.
2026-04-08 18:28:40 +08:00
tanzhenxin
d9a1275913
Merge pull request #2954 from QwenLM/fix/disable-followup-suggestions-default
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(cli): disable follow-up suggestions by default
2026-04-08 18:02:00 +08:00
克竟
24a28d5fb0 refactor(status-line): redesign JSON input schema and add context fields
Restructure the status line stdin JSON for clarity and accuracy:
- Rename model.id → model.display_name, cwd → workspace.current_dir
- Replace raw context_window size/count with used_percentage,
  remaining_percentage, current_usage, context_window_size, and
  total_input_tokens/total_output_tokens
- Add version field from cfg.getCliVersion()
- Add git.branch, metrics.models, metrics.files
- Remove upstream-only fields: tokens.tool (never populated),
  session (start_time/elapsed_time not live-updating),
  streaming_state, approval_mode, terminal, metrics.tools
- Rename tokens.candidates → tokens.completion (Qwen API convention)
- Fix template string escaping in builtin-agents to avoid
  templateString() placeholder collision

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-08 17:52:07 +08:00
tanzhenxin
3c23952ef7
Merge pull request #2897 from QwenLM/feat/thinking-cross-turn-retention-idle-cleanup
feat(core): thinking block cross-turn retention with idle cleanup
2026-04-08 15:26:53 +08:00
wenshao
6a55a9aeea feat(config): make thinking idle threshold configurable and lower default to 5min
Align with observed provider prompt-cache TTL (~5 min). Add
`context.gapThresholdMinutes` setting so users can tune the threshold
for providers with different cache TTLs.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-08 14:21:06 +08:00
wenshao
1d4c17b1ce fix: rename /plan execute to /plan exit
Rename the subcommand to accurately reflect its behavior (exits plan
mode and restores previous approval mode, does not trigger execution).
Update source, tests, i18n keys (6 locales), and docs.
2026-04-08 10:21:00 +08:00
wenshao
b50f23f91c fix: correct copyright year from 2026 to 2025 in planCommand.ts 2026-04-08 06:53:44 +08:00
wenshao
51964fa4b9 Merge remote-tracking branch 'origin/main' into feature/status-line-customization
# Conflicts:
#	packages/cli/src/ui/components/Footer.tsx
2026-04-08 05:05:04 +08:00
wenshao
6bb5e0a276 Merge remote-tracking branch 'origin/main' into feat/plan-mode
# Conflicts:
#	packages/cli/src/i18n/locales/de.js
#	packages/cli/src/i18n/locales/en.js
#	packages/cli/src/i18n/locales/ja.js
#	packages/cli/src/i18n/locales/pt.js
#	packages/cli/src/i18n/locales/ru.js
#	packages/cli/src/i18n/locales/zh.js
2026-04-07 21:04:25 +08:00
tanzhenxin
03fdaf2faa fix(cli): disable follow-up suggestions by default
Most Qwen OAuth users don't have a fast model configured for this
feature, so it fires a wasted API request on every turn with no
visible benefit. Default to off; users can opt in via settings.
2026-04-07 12:50:27 +00:00
tanzhenxin
5b550ae7cd
Merge pull request #2858 from QwenLM/fix/anyof-schema-validation-coercion
fix(core): coerce stringified JSON values for anyOf/oneOf MCP tool schemas
2026-04-07 15:52:01 +08:00
tanzhenxin
b632541629
Merge pull request #2770 from chiga0/feat/add-verbose-mode-switcher
feat: to #2767, support verbose and compact mode swither with ctrl-o
2026-04-07 15:48:41 +08:00
tanzhenxin
d7f60fb416 test(cli): remove flaky 'should delete entire placeholder on backspace' test
Same class of Windows CI timing flake — the backspace keypress
doesn't propagate through the paste/keypress pipeline fast enough
on slow runners, so replaceRangeByOffset is never called (0 calls).
2026-04-07 07:25:27 +00:00
tanzhenxin
2245f77b6d test(cli): remove flaky 'navigates with number keys' test
The test has a stale closure race condition: the 50ms wait between
pressing '2' and Enter may not be enough for React/Ink to re-render
and re-subscribe the useKeypress callback with the updated
selectedIndex, causing it to read the default value (0) instead of
the expected value (1) on slow CI runners (Windows + Node 20).
2026-04-07 06:41:54 +00:00
Shaojin Wen
b6373ac71e
feat(core): implement mid-turn queue drain for agent execution (#2854)
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
* feat(core): implement mid-turn queue drain for agent execution

Inject queued user messages between tool execution steps within a single
turn, so the model sees them immediately instead of waiting for the
entire round to complete.

- Add `dequeueAll()` to AsyncMessageQueue
- Add `midTurnDrain` callback to ReasoningLoopOptions
- Drain queue after processFunctionCalls, inject as text parts
- AgentComposer always enqueues directly (no local buffering)
- Add QUEUE_MESSAGES_CONSUMED event for UI sync

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* feat(cli): add mid-turn queue drain to main session

Extend mid-turn queue drain to the main session's tool execution path
(useGeminiStream). Previously only agent tabs had this feature.

- Add midTurnDrainRef parameter to useGeminiStream
- Inject queued messages in handleCompletedTools before submitQuery
- Bridge useMessageQueue to drain ref in AppContainer via ref pattern

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: address Copilot review feedback on mid-turn drain

- Guard midTurnDrain with abort check to prevent message loss on cancel
- Synchronously clear messageQueueRef to prevent duplicate drains
- Only clear pending display on IDLE status, not all status changes

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* refactor: scope mid-turn drain to main session only

Revert subagent-path changes (AgentCore, AgentInteractive,
AgentComposer, AsyncMessageQueue, agent-events) to keep the PR
focused on the main session, which is easier to test and validate.

Subagent mid-turn drain can be added in a follow-up PR.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: address Copilot review on main session mid-turn drain

- Move synchronous queue ref into useMessageQueue itself, expose
  drainQueue() for atomic drain (fixes race between addMessage and drain)
- Record drained messages as USER history items so the transcript
  stays complete
- Simplify AppContainer bridge to just midTurnDrainRef.current = drainQueue

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: guard mid-turn drain against cancelled turns

- Skip drain when turnCancelledRef or abortController signal is set,
  so queued messages stay for the next turn instead of being lost
- Restore ref-based queue bridge (drainQueue removed from useMessageQueue)
- Keep synchronous ref clear to prevent duplicate drains

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-07 09:14:44 +08:00
chiga0
1d639c97fa fix: revert default to verbose mode (true) and force-show on Error status
Per maintainer review (tanzhenxin): default verboseMode reverted to true
to preserve existing behavior — compact mode is opt-in via Ctrl+O.

Also addresses wenshao's security concern: in compact mode, tool groups
now force-expand on Error status (in addition to existing Confirming
handling), and ToolMessage force-shows result for both Confirming and
Error statuses so users always see diffs before approval and error
details for debugging.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-06 22:04:31 +08:00
wenshao
0e9c3610c5 fix: use explicit Agent tool wording in /statusline prompt
"Use the Agent tool with subagent_type" is more direct than
"Create an Agent", reducing ambiguity for the model.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-06 19:31:08 +08:00
wenshao
f67c9c5d78 fix: clarify footer comment and add Windows shell note to docs
- Footer comment now accurately states only the "? for shortcuts"
  hint is suppressed, not all left-section items
- Docs now note that Windows uses cmd.exe by default and suggest
  wrapping commands with bash -c or using a bash script

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-06 19:10:52 +08:00
wenshao
c597847bc3 feat(core): add prePlanMode tracking to restore previous approval mode
When entering plan mode, Config now saves the previous approval mode
(e.g. AUTO_EDIT, YOLO) so it can be restored when exiting. Previously,
/plan execute and ExitPlanModeTool both hardcoded a return to DEFAULT,
losing the user's prior mode.

Changes:
- Config: add prePlanMode field, getPrePlanMode(), auto-track in
  setApprovalMode()
- planCommand: /plan execute restores prePlanMode instead of DEFAULT
- ExitPlanModeTool: ProceedOnce restores prePlanMode instead of DEFAULT
- Tests: 4 new Config tests, 1 new planCommand test, 1 new
  ExitPlanModeTool test

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-06 17:39:13 +08:00
chiga0
8d1866ca55 fix: address PR #2770 review feedback for verbose/compact mode toggle
- Fix default value: compact mode (verboseMode=false) is now the default,
  matching PR description and intended UX
- Extract shared ToolStatusIndicator component to eliminate duplicate
  status icon rendering between ToolMessage and CompactToolGroupDisplay
- Memoize VerboseModeProvider context value to prevent unnecessary
  re-renders of all consumer components
- Clear frozenSnapshot on WaitingForConfirmation state to ensure tool
  confirmation UI remains interactive during mid-stream toggle
- Replace magic string 'Shell' with SHELL_NAME constant in ToolMessage
- Remove unused i18n translation keys (verbose/compact mode messages)
- Update snapshots for Footer and ToolGroupMessage tests

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-06 15:07:59 +08:00
wenshao
9bba05bad3 fix: add ASK_USER_QUESTION to statusline-setup agent, clear debounce on command change
- Agent can now ask for clarification when PS1 is not found
- Clear pending debounce timer before immediate doUpdate on command
  change to prevent redundant second execution

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-06 14:46:02 +08:00
wenshao
4c4e63888a fix: kill child process when statusLine config is removed
When statusLineCommand becomes undefined (user removes the setting),
kill any in-flight child process, bump generation counter, and clear
the debounce timer so stale callbacks cannot resurrect the output.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-06 14:21:28 +08:00
wenshao
1a985bb02e fix: exec cwd, output trimming, and status line alignment
- Set cwd to config.getTargetDir() so commands like pwd/git run in the
  correct workspace directory
- Strip only trailing newline instead of trim() to preserve intentional
  leading/trailing whitespace in command output
- Match footer's marginLeft/marginRight on the status line row so it
  aligns with the rest of the footer content

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-06 11:45:49 +08:00
wenshao
24251db4ef fix: track vimEnabled changes in status line triggers
When vim mode is toggled off, vimMode stays the same but the status
line should stop including vim data. Use effectiveVim (undefined when
disabled) as the tracked value instead of raw vimMode.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-06 11:39:25 +08:00
wenshao
c219f7c4ac fix: address review feedback from Copilot
- Validate padding is finite number >= 0 instead of blind cast
- Initialize prevStateRef with current values to prevent double exec on mount
- Kill previous child process before starting new one; kill on unmount
- Fix agent prompt: settings path is ui.statusLine, not root-level
- Fix agent prompt: remove multi-cat examples, stdin can only be read once
- Update Footer left-section comment to reflect new behavior

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-06 11:34:47 +08:00
wenshao
be13adb6e7 fix: add SettingsContext to Footer tests
useStatusLine hook requires SettingsContext, which was missing from
the test render wrapper, causing all Footer tests to crash.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-06 11:32:21 +08:00
wenshao
8d85492913 feat(ui): rewrite customizable status line
Rewrite the status line feature (originally by Gemini 3.1 Pro) to align
with the upstream design:

- Settings: change from plain string to object `{ type, command, padding? }`
- Hook: event-driven with 300ms debounce instead of 5s polling; pass
  structured JSON context (session, model, tokens, vim) via stdin;
  generation counter to ignore stale exec callbacks; EPIPE guard on stdin
- Footer: render status line as dedicated row with dimColor + truncate;
  suppress "? for shortcuts" hint when status line is active
- Add `/statusline` slash command that delegates to a statusline-setup agent
- Add `statusline-setup` built-in agent with PS1 conversion instructions
- Remove unrelated changes (whitespace, formatting, package-lock, test file)
- Fix copyright headers (Google LLC → Qwen)
- Fix config path references (~/.qwen-code → ~/.qwen)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-06 08:04:20 +08:00
wenshao
6784f0c02c feat(ui): add customizable status line
Allow users to configure a custom shell command to display in the UI footer status line.
2026-04-06 07:10:50 +08:00
wenshao
007fff67ba fix(cli): fix /plan command bugs and clean up hallucinated i18n keys
- Fix /plan execute running without checking if currently in plan mode
- Remove hallucinated i18n keys (e.g. "Coding Plan API keys") added by
  prior AI-generated code
- Remove /plan from non-interactive command allowlist (plan mode is
  interactive)
- Revert unrelated package-lock.json and unused-keys-only-in-locales.json
  changes
- Add test case for /plan execute when not in plan mode

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-06 06:56:41 +08:00
wenshao
135699dd5a feat(cli): implement /plan command for plan mode
- Add /plan command to switch to plan mode or execute the current plan
- Update BuiltinCommandLoader to include planCommand
- Allow planCommand in non-interactive environments
- Add corresponding unit tests
- Update i18n locales to include new translations
- Document /plan command in features/commands.md
2026-04-06 06:31:04 +08:00
tanzhenxin
6785a8d908
Merge pull request #2463 from mj4444ru/patch-1
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 / 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
Qwen Code CI / Post Coverage Comment (push) Has been cancelled
Fix Markdown table cell separator escaping in MarkdownDisplay.tsx
2026-04-05 15:23:23 +08:00
tanzhenxin
0776627e0f
Merge pull request #2420 from huww98/fix/ctrl-y-retry-rate-limit
feat: allow Ctrl+Y to skip rate-limit retry delay immediately
2026-04-05 14:47:59 +08:00
tanzhenxin
4c594e222a
Merge pull request #2455 from Sakuranda/fix/2454-model-settings-preservation
fix(cli): preserve runtime-added models when saving settings
2026-04-05 14:47:12 +08:00
tanzhenxin
6d9ee19dc6
Merge pull request #2834 from kulikrch/fix/theme-esc-cancel-2833-main
fix(cli): restore previous theme on /theme cancel (refs #2833)
2026-04-05 14:43:34 +08:00
tanzhenxin
cf5c1ab5d8
Merge pull request #2837 from euxaristia/fix/quote-input-lag
fix(cli): remove quote-based drag detection to prevent input lag
2026-04-05 14:40:22 +08:00
tanzhenxin
fe4f2567c6
Merge pull request #2822 from qqqys/fix/cli_command
fix(cli): prevent ideCommand failure from breaking all slash commands…
2026-04-05 14:27:01 +08:00
tanzhenxin
90c51339c1
Merge pull request #2884 from YingchaoX/fix(vim)-shortcut-2779
fix(cli): restore ? shortcuts in vim normal mode
2026-04-05 14:13:41 +08:00
tanzhenxin
90fbddf826
Merge pull request #2842 from QwenLM/fix/output-language-persistence
fix: prevent output-language.md from being overwritten on startup
2026-04-05 14:13:09 +08:00