automagik-cli
Version:
Automagik CLI - A powerful command-line interface for interacting with Automagik Hive multi-agent AI systems
18 lines (17 loc) • 1.06 kB
JavaScript
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { useState, useCallback } from 'react';
import { Box, Text } from 'ink';
import TextInput from 'ink-text-input';
export const SimpleInputPrompt = ({ onSubmit, disabled = false, placeholder = 'Type your message...', }) => {
const [input, setInput] = useState('');
const handleSubmit = useCallback((value) => {
if (value.trim() && !disabled) {
onSubmit(value.trim());
setInput('');
}
}, [onSubmit, disabled]);
const handleChange = useCallback((value) => {
setInput(value);
}, []);
return (_jsxs(Box, { flexDirection: "column", marginY: 1, children: [_jsxs(Box, { children: [_jsx(Text, { color: "cyan", children: '> ' }), _jsx(TextInput, { value: input, placeholder: placeholder, onChange: handleChange, onSubmit: handleSubmit, focus: !disabled, showCursor: !disabled })] }), !disabled && (_jsx(Box, { marginTop: 1, children: _jsx(Text, { color: "gray", children: "Press Enter to send \u2022 Ctrl+C to exit" }) }))] }));
};