Refactor CLI input prompt and layout in HermesCLI
- Updated the input area prompt to dynamically reflect agent status, enhancing user feedback during operation. - Removed the status line from the layout to streamline the interface, focusing solely on the input area. - Adjusted styling for prompt states to improve visual clarity and user experience.
This commit is contained in:
parent
a7f52911e1
commit
dfa3c6265c
1 changed files with 12 additions and 15 deletions
27
cli.py
27
cli.py
|
|
@ -1562,32 +1562,28 @@ class HermesCLI:
|
||||||
self._should_exit = True
|
self._should_exit = True
|
||||||
event.app.exit()
|
event.app.exit()
|
||||||
|
|
||||||
|
# Dynamic prompt: changes to show agent status
|
||||||
|
cli_ref = self # capture for closure
|
||||||
|
|
||||||
|
def get_prompt():
|
||||||
|
if cli_ref._agent_running:
|
||||||
|
return [('class:prompt-working', '⚕ ❯ ')]
|
||||||
|
return [('class:prompt', '❯ ')]
|
||||||
|
|
||||||
# Create the input area widget with persistent history across sessions
|
# Create the input area widget with persistent history across sessions
|
||||||
input_area = TextArea(
|
input_area = TextArea(
|
||||||
height=1,
|
height=1,
|
||||||
prompt='❯ ',
|
prompt=get_prompt,
|
||||||
style='class:input-area',
|
style='class:input-area',
|
||||||
multiline=False,
|
multiline=False,
|
||||||
wrap_lines=False,
|
wrap_lines=False,
|
||||||
history=FileHistory(str(self._history_file)),
|
history=FileHistory(str(self._history_file)),
|
||||||
)
|
)
|
||||||
|
|
||||||
# Create a status line that shows when agent is working
|
# Layout: just the input area, no extra status line
|
||||||
def get_status_text():
|
|
||||||
if self._agent_running:
|
|
||||||
return [('class:status', ' 🔄 Agent working... (type to interrupt) ')]
|
|
||||||
return [('class:status', '')]
|
|
||||||
|
|
||||||
status_window = Window(
|
|
||||||
content=FormattedTextControl(get_status_text),
|
|
||||||
height=1,
|
|
||||||
)
|
|
||||||
|
|
||||||
# Layout with status and input at bottom
|
|
||||||
layout = Layout(
|
layout = Layout(
|
||||||
HSplit([
|
HSplit([
|
||||||
Window(height=0), # Spacer that expands
|
Window(height=0), # Spacer that expands
|
||||||
status_window,
|
|
||||||
input_area,
|
input_area,
|
||||||
])
|
])
|
||||||
)
|
)
|
||||||
|
|
@ -1595,7 +1591,8 @@ class HermesCLI:
|
||||||
# Style for the application
|
# Style for the application
|
||||||
style = PTStyle.from_dict({
|
style = PTStyle.from_dict({
|
||||||
'input-area': '#FFF8DC',
|
'input-area': '#FFF8DC',
|
||||||
'status': 'bg:#333333 #FFD700',
|
'prompt': '#FFF8DC',
|
||||||
|
'prompt-working': '#888888 italic',
|
||||||
})
|
})
|
||||||
|
|
||||||
# Create the application
|
# Create the application
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue