mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-16 04:22:36 +00:00
refactor(tui): share remote shell detection
Reuse the platform helper for SSH-aware copy hints so hotkey display and input handling cannot drift.
This commit is contained in:
parent
bcc5362432
commit
a68793b6c4
2 changed files with 3 additions and 4 deletions
|
|
@ -1,6 +1,5 @@
|
||||||
import { isMac } from '../lib/platform.js'
|
import { isMac, isRemoteShell } from '../lib/platform.js'
|
||||||
|
|
||||||
const isRemoteShell = Boolean(process.env.SSH_CONNECTION || process.env.SSH_CLIENT || process.env.SSH_TTY)
|
|
||||||
const action = isMac ? 'Cmd' : 'Ctrl'
|
const action = isMac ? 'Cmd' : 'Ctrl'
|
||||||
const paste = isMac ? 'Cmd' : 'Alt'
|
const paste = isMac ? 'Cmd' : 'Alt'
|
||||||
|
|
||||||
|
|
@ -10,7 +9,7 @@ const copyHotkeys: [string, string][] = isMac
|
||||||
['Ctrl+C', 'interrupt / clear draft / exit']
|
['Ctrl+C', 'interrupt / clear draft / exit']
|
||||||
]
|
]
|
||||||
: [
|
: [
|
||||||
...(isRemoteShell ? ([['Cmd+C', 'copy selection when forwarded by the terminal']] as [string, string][]) : []),
|
...(isRemoteShell() ? ([['Cmd+C', 'copy selection when forwarded by the terminal']] as [string, string][]) : []),
|
||||||
['Ctrl+C', 'copy selection / interrupt / clear draft / exit']
|
['Ctrl+C', 'copy selection / interrupt / clear draft / exit']
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ export const isMacActionFallback = (
|
||||||
export const isAction = (key: { ctrl: boolean; meta: boolean; super?: boolean }, ch: string, target: string): boolean =>
|
export const isAction = (key: { ctrl: boolean; meta: boolean; super?: boolean }, ch: string, target: string): boolean =>
|
||||||
isActionMod(key) && ch.toLowerCase() === target
|
isActionMod(key) && ch.toLowerCase() === target
|
||||||
|
|
||||||
const isRemoteShell = (env: NodeJS.ProcessEnv = process.env): boolean =>
|
export const isRemoteShell = (env: NodeJS.ProcessEnv = process.env): boolean =>
|
||||||
Boolean(env.SSH_CONNECTION || env.SSH_CLIENT || env.SSH_TTY)
|
Boolean(env.SSH_CONNECTION || env.SSH_CLIENT || env.SSH_TTY)
|
||||||
|
|
||||||
export const isCopyShortcut = (
|
export const isCopyShortcut = (
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue