mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-08 03:01:47 +00:00
fix(tui): align Ctrl+L and /model with classic CLI semantics
Make Ctrl+L non-destructive by redrawing the current screen state instead of starting a new session, and stop auto-appending --global for typed /model commands so session scope remains the default unless explicitly requested.
This commit is contained in:
parent
d5a89283b7
commit
4909b94f99
5 changed files with 11 additions and 19 deletions
|
|
@ -16,17 +16,9 @@ import { patchOverlayState } from '../../overlayStore.js'
|
|||
import { patchUiState } from '../../uiStore.js'
|
||||
import type { SlashCommand } from '../types.js'
|
||||
|
||||
const GLOBAL_MODEL_FLAG_RE = /(?:^|\s)--global(?:\s|$)/
|
||||
|
||||
const TUI_SESSION_MODEL_RE = new RegExp(`(?:^|\\s)${TUI_SESSION_MODEL_FLAG}(?:\\s|$)`)
|
||||
const TUI_SESSION_STRIP_RE = new RegExp(`\\s*${TUI_SESSION_MODEL_FLAG}\\b\\s*`, 'g')
|
||||
|
||||
const persistedModelArg = (arg: string) => {
|
||||
const trimmed = arg.trim()
|
||||
|
||||
return !trimmed || GLOBAL_MODEL_FLAG_RE.test(trimmed) ? trimmed : `${trimmed} --global`
|
||||
}
|
||||
|
||||
const stripTuiSessionFlag = (trimmed: string) =>
|
||||
trimmed.replace(TUI_SESSION_STRIP_RE, ' ').replace(/\s+/g, ' ').trim()
|
||||
|
||||
|
|
@ -41,7 +33,7 @@ const modelValueForConfigSet = (arg: string) => {
|
|||
return stripTuiSessionFlag(trimmed)
|
||||
}
|
||||
|
||||
return persistedModelArg(trimmed)
|
||||
return trimmed
|
||||
}
|
||||
|
||||
export const sessionCommands: SlashCommand[] = [
|
||||
|
|
|
|||
|
|
@ -379,13 +379,8 @@ export function useInputHandlers(ctx: InputHandlerContext): InputHandlerResult {
|
|||
}
|
||||
|
||||
if (isAction(key, ch, 'l')) {
|
||||
if (actions.guardBusySessionSwitch()) {
|
||||
return
|
||||
}
|
||||
|
||||
patchUiState({ status: 'forging session…' })
|
||||
|
||||
return actions.newSession()
|
||||
clearSelection()
|
||||
return patchUiState(state => ({ ...state }))
|
||||
}
|
||||
|
||||
if (isVoiceToggleKey(key, ch)) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue