diff --git a/CHANGELOG.md b/CHANGELOG.md index 9eedf13db..a325ec6d5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,8 @@ Only write entries that are worth mentioning to users. ## Unreleased +- Shell: Simplify input prompt by removing username prefix for a cleaner appearance +- Shell: Add horizontal separator line and expanded keyboard shortcut hints to the toolbar - Shell: Add number key shortcuts (1–5) for quick option selection in question and approval panels, with redesigned bordered panel UI and keyboard hints - Shell: Add tab-style navigation for multi-question panels — use Left/Right arrows or Tab to switch between questions, with visual indicators for answered, current, and pending states, and automatic state restoration when revisiting a question - Shell: Allow Space key to submit single-select questions in the question panel diff --git a/docs/en/release-notes/changelog.md b/docs/en/release-notes/changelog.md index 3f4c08c55..bbbb0ae63 100644 --- a/docs/en/release-notes/changelog.md +++ b/docs/en/release-notes/changelog.md @@ -4,6 +4,8 @@ This page documents the changes in each Kimi Code CLI release. ## Unreleased +- Shell: Simplify input prompt by removing username prefix for a cleaner appearance +- Shell: Add horizontal separator line and expanded keyboard shortcut hints to the toolbar - Shell: Add number key shortcuts (1–5) for quick option selection in question and approval panels, with redesigned bordered panel UI and keyboard hints - Shell: Add tab-style navigation for multi-question panels — use Left/Right arrows or Tab to switch between questions, with visual indicators for answered, current, and pending states, and automatic state restoration when revisiting a question - Shell: Allow Space key to submit single-select questions in the question panel diff --git a/docs/zh/release-notes/changelog.md b/docs/zh/release-notes/changelog.md index fcc495075..d5b20a184 100644 --- a/docs/zh/release-notes/changelog.md +++ b/docs/zh/release-notes/changelog.md @@ -4,6 +4,8 @@ ## 未发布 +- Shell:精简输入提示符,移除用户名前缀以获得更简洁的外观 +- Shell:在工具栏中添加水平分隔线和更完整的键盘快捷键提示 - Shell:为问题面板和审批面板添加数字键(1–5)快速选择选项,并以带边框的面板和键盘提示重新设计交互界面 - Shell:为多问题面板添加标签式导航——使用左右方向键或 Tab 键在问题间切换,并以可视化指示器区分已答、当前和待答状态,重新访问已答问题时自动恢复选择状态 - Shell:在问题面板中支持使用空格键提交单选问题 diff --git a/src/kimi_cli/ui/shell/__init__.py b/src/kimi_cli/ui/shell/__init__.py index 30fc4322f..c042ab208 100644 --- a/src/kimi_cli/ui/shell/__init__.py +++ b/src/kimi_cli/ui/shell/__init__.py @@ -110,6 +110,7 @@ async def run(self, command: str | None = None) -> bool: continue await self.run_soul_command(user_input.content) + console.print() finally: ensure_tty_sane() diff --git a/src/kimi_cli/ui/shell/prompt.py b/src/kimi_cli/ui/shell/prompt.py index 83c6c8aca..a27af8c3d 100644 --- a/src/kimi_cli/ui/shell/prompt.py +++ b/src/kimi_cli/ui/shell/prompt.py @@ -2,7 +2,6 @@ import asyncio import base64 -import getpass import json import mimetypes import os @@ -742,10 +741,10 @@ def _(buffer: Buffer) -> None: self._status_refresh_task: asyncio.Task[None] | None = None def _render_message(self) -> FormattedText: - symbol = PROMPT_SYMBOL if self._mode == PromptMode.AGENT else PROMPT_SYMBOL_SHELL - if self._mode == PromptMode.AGENT and self._thinking: - symbol = PROMPT_SYMBOL_THINKING - return FormattedText([("bold", f"{getpass.getuser()}@{KaosPath.cwd().name}{symbol} ")]) + if self._mode == PromptMode.SHELL: + return FormattedText([("bold", f"{PROMPT_SYMBOL_SHELL} ")]) + symbol = PROMPT_SYMBOL_THINKING if self._thinking else PROMPT_SYMBOL + return FormattedText([("", f"{symbol} ")]) def _apply_mode(self, event: KeyPressEvent | None = None) -> None: # Apply mode to the active buffer (not the PromptSession itself) @@ -883,6 +882,9 @@ def _render_bottom_toolbar(self) -> FormattedText: fragments: list[tuple[str, str]] = [] + fragments.append(("fg:#4d4d4d", "─" * columns)) + fragments.append(("", "\n")) + now_text = datetime.now().strftime("%H:%M") fragments.extend([("", now_text), ("", " " * 2)]) columns -= len(now_text) + 2 @@ -912,10 +914,15 @@ def _render_bottom_toolbar(self) -> FormattedText: if current_toast_left.duration <= 0.0: _toast_queues["left"].popleft() else: - shortcuts = "ctrl-x: toggle mode" - if columns - len(right_text) > len(shortcuts) + 2: - fragments.extend([("", shortcuts), ("", " " * 2)]) - columns -= len(shortcuts) + 2 + shortcut_candidates = [ + "ctrl-x: toggle mode | ctrl-j / alt-enter: newline", + "ctrl-j / alt-enter: newline", + ] + for shortcuts in shortcut_candidates: + if columns - len(right_text) > len(shortcuts) + 2: + fragments.extend([("", shortcuts), ("", " " * 2)]) + columns -= len(shortcuts) + 2 + break padding = max(1, columns - len(right_text)) fragments.append(("", " " * padding)) diff --git a/src/kimi_cli/ui/shell/replay.py b/src/kimi_cli/ui/shell/replay.py index 5376b020b..e582e9b0e 100644 --- a/src/kimi_cli/ui/shell/replay.py +++ b/src/kimi_cli/ui/shell/replay.py @@ -2,7 +2,6 @@ import asyncio import contextlib -import getpass from collections import deque from collections.abc import Sequence from dataclasses import dataclass @@ -63,7 +62,7 @@ async def replay_recent_history( for turn in turns: wire = Wire() - console.print(f"{getpass.getuser()}{PROMPT_SYMBOL} {message_stringify(turn.user_message)}") + console.print(f"{PROMPT_SYMBOL} {message_stringify(turn.user_message)}") ui_task = asyncio.create_task( visualize(wire.ui_side(merge=False), initial_status=StatusUpdate()) ) diff --git a/src/kimi_cli/ui/shell/visualize.py b/src/kimi_cli/ui/shell/visualize.py index baa742e12..9ef162240 100644 --- a/src/kimi_cli/ui/shell/visualize.py +++ b/src/kimi_cli/ui/shell/visualize.py @@ -8,7 +8,6 @@ from typing import Any, NamedTuple, cast import streamingjson # type: ignore[reportMissingTypeStubs] -from kosong.message import Message from kosong.tooling import ToolError, ToolOk from rich.console import Group, RenderableType from rich.live import Live @@ -25,7 +24,6 @@ from kimi_cli.utils.aioqueue import QueueShutDown from kimi_cli.utils.diff import format_unified_diff from kimi_cli.utils.logging import logger -from kimi_cli.utils.message import message_stringify from kimi_cli.utils.rich.columns import BulletColumns from kimi_cli.utils.rich.markdown import Markdown from kimi_cli.utils.rich.syntax import KimiSyntax @@ -867,6 +865,7 @@ def compose(self) -> RenderableType: blocks.append(self._current_approval_request_panel.render()) if self._current_question_panel: blocks.append(self._current_question_panel.render()) + blocks.append(self._status_block.render()) return Group(*blocks) @@ -888,12 +887,6 @@ def dispatch_wire_message(self, msg: WireMessage) -> None: match msg: case TurnBegin(): self.flush_content() - console.print( - Panel( - Text(message_stringify(Message(role="user", content=msg.user_input))), - padding=(0, 1), - ) - ) case TurnEnd(): pass case CompactionBegin():