Commit graph

12 commits

Author SHA1 Message Date
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
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
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
克竟
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
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
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