qwen-code/packages/cli/src/ui/components
Shaojin Wen f208801b0e
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:none (push) Waiting to run
E2E Tests / E2E Test (Linux) - sandbox:docker (push) Waiting to run
E2E Tests / E2E Test - macOS (push) Waiting to run
fix(followup): prevent tool call UI leak and Enter accept buffer race (#2872)
* fix(core): prevent followup suggestion input/output from appearing in tool call UI

The follow-up suggestion generation was leaking into the conversation UI
through three channels:

1. The forked query included tools in its generation config, allowing the
   model to produce function calls during suggestion generation. Fixed by
   setting `tools: []` in runForkedQuery's per-request config (kept in
   createForkedChat for speculation which needs tools).

2. logApiResponse and logApiError recorded suggestion API events to the
   chatRecordingService, causing them to appear in session JSONL files
   and the WebUI. Fixed by adding isInternalPromptId() guard that skips
   chatRecordingService for 'prompt_suggestion' and 'forked_query' IDs.
   uiTelemetryService.addEvent() is preserved so /stats still tracks
   suggestion token usage.

3. LoggingContentGenerator logged suggestion requests/responses to the
   OpenAI logger and telemetry pipeline. Fixed by skipping logApiRequest,
   buildOpenAIRequestForLogging, and logOpenAIInteraction for internal
   prompt IDs. _logApiResponse is preserved (for /stats) but its
   chatRecordingService path is filtered by fix #2.

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

* refactor: deduplicate isInternalPromptId into shared export from loggers.ts

Address review feedback: extract isInternalPromptId() to a single
exported function in telemetry/loggers.ts and import it in
LoggingContentGenerator, eliminating the duplicate private method.

Also update loggingContentGenerator.test.ts mock to use importOriginal
so the real isInternalPromptId is available during tests.

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

* refactor: extract isInternalPromptId to shared utils, add tests

Address maintainer review feedback:

1. Move isInternalPromptId() to packages/core/src/utils/internalPromptIds.ts
   using a ReadonlySet for the ID registry. Adding new internal prompt IDs
   only requires changing one file. loggers.ts re-exports for compatibility,
   loggingContentGenerator.ts imports directly from utils.

2. Extract `tools: []` magic value to a frozen NO_TOOLS constant in
   forkedQuery.ts.

3. Add unit tests for isInternalPromptId: prompt_suggestion → true,
   forked_query → true, user_query → false, empty string → false.

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

* fix: address Copilot review — docs, stream optimization, tests

1. Update forkedQuery.ts module docs to reflect that runForkedQuery
   overrides tools: [] at the per-request level while createForkedChat
   retains the full generationConfig for speculation callers.

2. Propagate isInternal into loggingStreamWrapper to skip response
   collection and consolidation for internal prompts, avoiding
   unnecessary CPU/memory overhead.

3. Add logApiResponse chatRecordingService filter tests: verify
   prompt_suggestion/forked_query skip recording while normal IDs
   still record.

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

* fix: deep-freeze NO_TOOLS, add internal prompt guard tests

Address Copilot review round 3:

1. Deep-freeze NO_TOOLS.tools array to prevent shared mutable state
   across forked query calls.

2. Add LoggingContentGenerator tests verifying that internal prompt IDs
   (prompt_suggestion, forked_query) skip logApiRequest and OpenAI
   interaction logging while preserving logApiResponse.

3. Add logApiError chatRecordingService filter tests matching the
   existing logApiResponse coverage.

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

* docs: reconcile createForkedChat JSDoc with module header

Clarify that createForkedChat retains the full generationConfig
(including tools) for speculation callers, while runForkedQuery
strips tools at the per-request level via NO_TOOLS.

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

* fix: build errors and Copilot round 4 feedback

1. Fix NO_TOOLS type: Object.freeze produces readonly array incompatible
   with ToolUnion[]. Use Readonly<Pick<>> instead; spread in requestConfig
   already creates a fresh mutable copy per call.

2. Fix test missing required 'model' field in ContentGeneratorConfig.

3. Track firstResponseId/firstModelVersion in loggingStreamWrapper so
   _logApiResponse/_logApiError have accurate values even when full
   response collection is skipped for internal prompts.

4. Strengthen OpenAI logger test assertion: assert OpenAILogger was
   constructed (not guarded by if), then assert logInteraction was
   not called.

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

* fix: remove dead Object.keys check, add streaming internal prompt test

1. Simplify runForkedQuery: requestConfig always has tools:[] from
   NO_TOOLS spread, so the Object.keys().length > 0 ternary is dead
   code. Pass requestConfig directly.

2. Add generateContentStream test for internal prompt IDs to match
   the existing generateContent coverage, ensuring the streaming
   wrapper also skips logApiRequest and OpenAI interaction logging.

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

* fix: prevent Enter accept from re-inserting suggestion into buffer

When accepting a followup suggestion via Enter, accept() queued
buffer.insert(suggestion) in a microtask that executed after
handleSubmitAndClear had already cleared the buffer, leaving the
suggestion text stuck in the input.

Add skipOnAccept option to accept() so the Enter path bypasses the
onAccept callback. Also add runForkedQuery unit tests verifying
tools: [] is passed in per-request config.

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

* fix(core): add speculation to internal IDs, fix logToolCall filtering, improve suggestion prompt

- Add 'speculation' to INTERNAL_PROMPT_IDS so speculation API traffic
  and tool calls are hidden from chat recordings and tool call UI
- Add isInternalPromptId check to logToolCall() for consistency with
  logApiError/logApiResponse
- Improve SUGGESTION_PROMPT: prioritize assistant's last few lines and
  extract actionable text from explicit tips (e.g. "Tip: type X")
- Fix garbled unicode in prompt text
- Update design docs and user docs to reflect changes
- Add test coverage for all new behavior

* fix(core): deep-freeze NO_TOOLS, add speculation to loggingContentGenerator tests

- Object.freeze NO_TOOLS and its tools array to prevent runtime mutation
- Add 'speculation' to loggingContentGenerator internal prompt ID tests
  for consistency with loggers.test.ts and internalPromptIds.ts

* fix(core): fix NO_TOOLS Object.freeze type error

Use `as const` with type assertion to satisfy TypeScript while keeping
runtime immutability via Object.freeze.

* refactor(core): remove unused isInternalPromptId re-export from loggers.ts

All consumers import directly from utils/internalPromptIds.js.
The re-export was dead code with no importers.

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-09 00:07:03 +08:00
..
__snapshots__ fix: revert default to verbose mode (true) and force-show on Error status 2026-04-06 22:04:31 +08:00
agent-view refactor(agents): remove outputFile from tool result events 2026-03-17 14:29:02 +08:00
arena feat(arena): improve cancellation handling and simplify to in-process mode 2026-03-12 16:57:44 +08:00
extensions fix test 2026-03-11 19:13:14 +08:00
hooks remove test case 2026-04-01 13:39:51 +08:00
mcp feat(mcp): show 'Re-authenticate' for servers with existing OAuth tokens 2026-03-12 22:08:17 +08:00
messages Merge pull request #2858 from QwenLM/fix/anyof-schema-validation-coercion 2026-04-07 15:52:01 +08:00
shared fix: address PR #2770 review feedback for verbose/compact mode toggle 2026-04-06 15:07:59 +08:00
subagents feat: simplify subagent model configuration with model selector 2026-03-27 11:49:45 +08:00
views feat(cli): add detail mode to /context and track loaded skill bodies 2026-03-15 14:39:33 +08:00
AboutBox.tsx feat(cli): refactor about dialog and add proxy field 2026-01-19 10:54:45 +08:00
AnsiOutput.test.tsx Sync upstream Gemini-CLI v0.8.2 (#838) 2025-10-23 09:27:04 +08:00
AnsiOutput.tsx Sync upstream Gemini-CLI v0.8.2 (#838) 2025-10-23 09:27:04 +08:00
ApiKeyInput.tsx fix(auth): validate Coding Plan API key prefix for China region 2026-03-02 21:19:41 +08:00
AppHeader.test.tsx fix test 2026-02-06 03:01:53 -08:00
AppHeader.tsx refactor(cli): simplify auth type display in Header 2026-02-28 14:59:56 +08:00
ApprovalModeDialog.tsx Redesign settings dialog with curated list and view-switching UI 2026-01-18 21:56:33 +08:00
AsciiArt.ts feat: Redesign CLI welcome screen and improve visual consistency 2026-01-16 11:48:31 +08:00
AutoAcceptIndicator.tsx feat use tab on windows instead of shift+tab 2026-02-02 19:48:07 +08:00
BaseTextInput.tsx feat(cli): add agent composer UI and refactor text input handling 2026-03-10 16:53:10 +08:00
Composer.test.tsx feat(ui): implement per-task token tracking in LoadingIndicator 2026-03-18 17:35:37 +08:00
Composer.tsx feat(cli, webui): add follow-up suggestions feature (#2525) 2026-04-03 20:07:23 +08:00
ConfigInitDisplay.tsx feat(i18n): Add Internationalization Support for UI and LLM Output (#1058) 2025-11-21 15:44:37 +08:00
ConsentPrompt.test.tsx feat: Redesign CLI welcome screen and improve visual consistency 2026-01-16 11:48:31 +08:00
ConsentPrompt.tsx feat: Redesign CLI welcome screen and improve visual consistency 2026-01-16 11:48:31 +08:00
ContextSummaryDisplay.test.tsx Merge tag 'v0.3.0' into chore/sync-gemini-cli-v0.3.0 2025-09-11 16:26:56 +08:00
ContextSummaryDisplay.tsx feat(i18n): Add Internationalization Support for UI and LLM Output (#1058) 2025-11-21 15:44:37 +08:00
ContextUsageDisplay.tsx fix(contextWindowSize): fix context window size update on model switch and ACP agent config priority 2026-01-29 20:51:03 +08:00
DebugModeNotification.tsx feat(core,cli): add debug logging infrastructure (M0-M2) 2026-01-25 09:23:18 +08:00
DebugProfiler.tsx Sync upstream Gemini-CLI v0.8.2 (#838) 2025-10-23 09:27:04 +08:00
DialogManager.tsx feat(cli, webui): add follow-up suggestions feature (#2525) 2026-04-03 20:07:23 +08:00
EditorSettingsDialog.tsx feat(cli): migrate console calls to debugLogger and stdioHelpers (M3 Phase 7-9) 2026-01-26 15:02:37 +08:00
ExitWarning.tsx Sync upstream Gemini-CLI v0.8.2 (#838) 2025-10-23 09:27:04 +08:00
FolderTrustDialog.test.tsx Sync upstream Gemini-CLI v0.8.2 (#838) 2025-10-23 09:27:04 +08:00
FolderTrustDialog.tsx Sync upstream Gemini-CLI v0.8.2 (#838) 2025-10-23 09:27:04 +08:00
Footer.test.tsx test: fix Footer and tokenLimits test failures 2026-01-29 21:13:12 +08:00
Footer.tsx feat: to #2767, support verbose and compact mode swither with ctrl-o 2026-03-31 19:00:13 +08:00
GeminiRespondingSpinner.tsx Sync upstream Gemini-CLI v0.8.2 (#838) 2025-10-23 09:27:04 +08:00
Header.test.tsx test: update OAuth progress and header tests for UI changes 2026-03-12 16:42:43 +08:00
Header.tsx refactor: simplify OAuth progress UI and use semantic colors 2026-03-12 16:23:05 +08:00
Help.test.tsx feat use tab on windows instead of shift+tab 2026-02-02 19:48:07 +08:00
Help.tsx feat use tab on windows instead of shift+tab 2026-02-02 19:48:07 +08:00
HistoryItemDisplay.test.tsx feat(cli): refactor about dialog and add proxy field 2026-01-19 10:54:45 +08:00
HistoryItemDisplay.tsx Merge pull request #2770 from chiga0/feat/add-verbose-mode-switcher 2026-04-07 15:48:41 +08:00
IdeTrustChangeDialog.test.tsx refactor(debug): replace ConsolePatcher with debugLogger and update error reporting 2026-02-02 17:37:54 +08:00
IdeTrustChangeDialog.tsx feat(cli): migrate console calls to debugLogger and stdioHelpers (M3 Phase 7-9) 2026-01-26 15:02:37 +08:00
InputPrompt.test.tsx fix(followup): prevent tool call UI leak and Enter accept buffer race (#2872) 2026-04-09 00:07:03 +08:00
InputPrompt.tsx fix(followup): prevent tool call UI leak and Enter accept buffer race (#2872) 2026-04-09 00:07:03 +08:00
KeyboardShortcuts.tsx feat(cli): add Ctrl+Y shortcut to retry failed requests (#2011) 2026-03-02 17:59:18 +08:00
LoadingIndicator.test.tsx test(cli): remove promptTokens prop from LoadingIndicator tests 2026-03-18 00:22:35 +08:00
LoadingIndicator.tsx Merge branch 'main' into feat/token_display 2026-03-18 21:40:16 +08:00
LoopDetectionConfirmation.test.tsx Sync upstream Gemini-CLI v0.8.2 (#838) 2025-10-23 09:27:04 +08:00
LoopDetectionConfirmation.tsx Sync upstream Gemini-CLI v0.8.2 (#838) 2025-10-23 09:27:04 +08:00
MainContent.tsx feat: to #2767, support verbose and compact mode swither with ctrl-o 2026-03-31 19:00:13 +08:00
MemoryUsageDisplay.tsx Sync upstream Gemini-CLI v0.8.2 (#838) 2025-10-23 09:27:04 +08:00
ModelDialog.test.tsx test(cli): fix ModelDialog test by removing rigid help text assertion 2026-02-28 19:36:53 +08:00
ModelDialog.tsx feat(cli, webui): add follow-up suggestions feature (#2525) 2026-04-03 20:07:23 +08:00
ModelStatsDisplay.test.tsx Explict imports & exports with type modifier (#3774) 2025-08-25 22:04:53 +00:00
ModelStatsDisplay.tsx feat: Redesign CLI welcome screen and improve visual consistency 2026-01-16 11:48:31 +08:00
Notifications.tsx refactor: streamline debug logging and remove Notifications component 2026-02-04 22:41:31 +08:00
PermissionsDialog.tsx feat(permissions): add workspace directory management tab 2026-03-11 10:54:59 +08:00
PlanSummaryDisplay.tsx Keep rejected plan content visible in plan mode 2026-03-06 19:00:49 +08:00
PluginChoicePrompt.test.tsx feat: add select ui for claude marketplace 2026-01-23 16:23:30 +08:00
PluginChoicePrompt.tsx feat: add select ui for claude marketplace 2026-01-23 16:23:30 +08:00
PrepareLabel.test.tsx Sync upstream Gemini-CLI v0.8.2 (#838) 2025-10-23 09:27:04 +08:00
PrepareLabel.tsx Sync upstream Gemini-CLI v0.8.2 (#838) 2025-10-23 09:27:04 +08:00
QueuedMessageDisplay.test.tsx Sync upstream Gemini-CLI v0.8.2 (#838) 2025-10-23 09:27:04 +08:00
QueuedMessageDisplay.tsx Sync upstream Gemini-CLI v0.8.2 (#838) 2025-10-23 09:27:04 +08:00
QuittingDisplay.tsx feat: Redesign CLI welcome screen and improve visual consistency 2026-01-16 11:48:31 +08:00
QwenOAuthProgress.test.tsx refactor(ui): remove spinner from OAuth progress component 2026-03-12 17:34:08 +08:00
QwenOAuthProgress.tsx refactor(ui): remove spinner from OAuth progress component 2026-03-12 17:34:08 +08:00
SessionPicker.tsx feat: Redesign CLI welcome screen and improve visual consistency 2026-01-16 11:48:31 +08:00
SessionSummaryDisplay.test.tsx Add chat recording toggle (CLI + settings) and disable recording in tests 2025-12-15 13:48:38 +08:00
SessionSummaryDisplay.tsx feat: Redesign CLI welcome screen and improve visual consistency 2026-01-16 11:48:31 +08:00
SettingInputPrompt.test.tsx fix settings in interactive mode 2026-01-21 11:29:48 +08:00
SettingInputPrompt.tsx fix settings in interactive mode 2026-01-21 11:29:48 +08:00
SettingsDialog.test.tsx fix: correct schema field name for context.loadFromIncludeDirectories 2026-01-26 15:09:36 +08:00
SettingsDialog.tsx feat(cli): migrate console calls to debugLogger and stdioHelpers (M3 Phase 7-9) 2026-01-26 15:02:37 +08:00
ShellConfirmationDialog.test.tsx feat test tool permissions 2026-03-10 16:30:22 +08:00
ShellConfirmationDialog.tsx feat test tool permissions 2026-03-10 16:30:22 +08:00
ShellInputPrompt.tsx fix(cli): prevent Ctrl+F from leaking to PTY as ^F artifact 2026-03-13 16:34:55 +08:00
ShellModeIndicator.tsx Sync upstream Gemini-CLI v0.8.2 (#838) 2025-10-23 09:27:04 +08:00
ShowMoreLines.tsx Sync upstream Gemini-CLI v0.8.2 (#838) 2025-10-23 09:27:04 +08:00
StandaloneSessionPicker.test.tsx rework /resume slash command 2025-12-16 19:54:55 +08:00
StandaloneSessionPicker.tsx feat(cli): migrate console calls to debugLogger and stdioHelpers (M3 Phase 7-9) 2026-01-26 15:02:37 +08:00
StatsDisplay.test.tsx # 🚀 Sync Gemini CLI v0.2.1 - Major Feature Update (#483) 2025-09-01 14:48:55 +08:00
StatsDisplay.tsx feat: Redesign CLI welcome screen and improve visual consistency 2026-01-16 11:48:31 +08:00
SuggestionsDisplay.tsx feat: Redesign CLI welcome screen and improve visual consistency 2026-01-16 11:48:31 +08:00
ThemeDialog.test.tsx Sync upstream Gemini-CLI v0.8.2 (#838) 2025-10-23 09:27:04 +08:00
ThemeDialog.tsx feat: 优化useSettingsHooks以及全面review DiffRender的settings的入参是否有缺失 2026-01-23 15:30:08 +08:00
Tips.test.ts feat(cli): Increase /insight feature exposure via weighted tips 2026-02-28 18:08:37 +08:00
Tips.tsx feat(cli): Increase /insight feature exposure via weighted tips 2026-02-28 18:08:37 +08:00
TodoDisplay.test.tsx Merge tag 'v0.3.0' into chore/sync-gemini-cli-v0.3.0 2025-09-11 16:26:56 +08:00
TodoDisplay.tsx Merge tag 'v0.3.0' into chore/sync-gemini-cli-v0.3.0 2025-09-11 16:26:56 +08:00
ToolStatsDisplay.test.tsx Explict imports & exports with type modifier (#3774) 2025-08-25 22:04:53 +00:00
ToolStatsDisplay.tsx feat: Redesign CLI welcome screen and improve visual consistency 2026-01-16 11:48:31 +08:00
TrustDialog.test.tsx feat(permissions): add permission system and rename folder trust command 2026-03-04 19:24:43 +08:00
TrustDialog.tsx feat(permissions): add permission system and rename folder trust command 2026-03-04 19:24:43 +08:00
UpdateNotification.tsx Sync upstream Gemini-CLI v0.8.2 (#838) 2025-10-23 09:27:04 +08:00
WelcomeBackDialog.tsx feat(i18n): Add Internationalization Support for UI and LLM Output (#1058) 2025-11-21 15:44:37 +08:00