mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-07 02:51:50 +00:00
35 lines
896 B
TypeScript
35 lines
896 B
TypeScript
import { Box, Text } from '@hermes/ink'
|
|
import { useState } from 'react'
|
|
|
|
import type { Theme } from '../theme.js'
|
|
import { isMac } from '../lib/platform.js'
|
|
|
|
import { TextInput } from './textInput.js'
|
|
|
|
export function MaskedPrompt({ cols = 80, icon, label, onSubmit, sub, t }: MaskedPromptProps) {
|
|
const [value, setValue] = useState('')
|
|
|
|
return (
|
|
<Box flexDirection="column">
|
|
<Text bold color={t.color.warn}>
|
|
{icon} {label}
|
|
</Text>
|
|
|
|
{sub && <Text color={t.color.dim}> {sub}</Text>}
|
|
|
|
<Box>
|
|
<Text color={t.color.label}>{'> '}</Text>
|
|
<TextInput columns={Math.max(20, cols - 6)} allowClipboardHotkeys={isMac} mask="*" onChange={setValue} onSubmit={onSubmit} value={value} />
|
|
</Box>
|
|
</Box>
|
|
)
|
|
}
|
|
|
|
interface MaskedPromptProps {
|
|
cols?: number
|
|
icon: string
|
|
label: string
|
|
onSubmit: (v: string) => void
|
|
sub?: string
|
|
t: Theme
|
|
}
|