feat(initial): scaffold @push.rocks/smartchat with core, CLI, and web layers
Three-layer architecture built on @push.rocks/smartagent: - ts/ — ChatSession wrapping runAgent() with conversation state management - ts_cli/ — ink-based terminal chat TUI (React.createElement, no JSX) - ts_web/ — Lit web components (smartchat-window, smartchat-message, smartchat-input)
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
import { React, h, Box, Text, TextInput } from './plugins.js';
|
||||
|
||||
interface IInputAreaProps {
|
||||
disabled: boolean;
|
||||
onSubmit: (text: string) => void;
|
||||
}
|
||||
|
||||
export function InputArea({ disabled, onSubmit }: IInputAreaProps): React.ReactElement {
|
||||
const [value, setValue] = React.useState('');
|
||||
|
||||
const handleSubmit = (text: string) => {
|
||||
if (!text.trim()) return;
|
||||
onSubmit(text.trim());
|
||||
setValue('');
|
||||
};
|
||||
|
||||
return h(
|
||||
Box,
|
||||
{ borderStyle: 'single' as const, borderTop: true, borderBottom: false, borderLeft: false, borderRight: false, paddingX: 1 },
|
||||
h(Text, { bold: true, color: disabled ? 'gray' : 'cyan' }, '> '),
|
||||
h(TextInput, {
|
||||
value,
|
||||
onChange: setValue,
|
||||
onSubmit: handleSubmit,
|
||||
placeholder: disabled ? 'Waiting for response...' : 'Type a message...',
|
||||
focus: !disabled,
|
||||
}),
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user