"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.AgentInteractionPanel = void 0;
const jsx_runtime_1 = require("react/jsx-runtime");
const react_1 = require("react");
const AgentInteractionPanel = ({ agentId, onSendPrompt }) => {
    const [prompt, setPrompt] = (0, react_1.useState)('');
    const [response, setResponse] = (0, react_1.useState)(null);
    const [loading, setLoading] = (0, react_1.useState)(false);
    const [error, setError] = (0, react_1.useState)(null);
    const handleSend = async () => {
        setLoading(true);
        setError(null);
        setResponse(null);
        try {
            const result = await onSendPrompt(prompt);
            setResponse(result);
        }
        catch (err) {
            setError(err.message || 'Unknown error');
        }
        finally {
            setLoading(false);
        }
    };
    return ((0, jsx_runtime_1.jsxs)("div", { className: "agent-interaction-panel", style: { maxWidth: '600px', margin: 'auto', padding: '1rem' }, children: [(0, jsx_runtime_1.jsx)("h2", { children: "Agent Interaction" }), (0, jsx_runtime_1.jsxs)("div", { style: { fontSize: '0.9rem', color: '#666', marginBottom: '0.5rem' }, children: ["Agent ID: ", agentId] }), (0, jsx_runtime_1.jsx)("textarea", { value: prompt, onChange: (e) => setPrompt(e.target.value), placeholder: "Enter prompt here...", rows: 5, style: { width: '100%', fontFamily: 'monospace', fontSize: '1rem', marginBottom: '0.5rem' } }), (0, jsx_runtime_1.jsx)("button", { onClick: handleSend, disabled: loading || prompt.trim() === '', style: { marginBottom: '1rem' }, children: loading ? 'Sending...' : 'Send Prompt' }), error && (0, jsx_runtime_1.jsxs)("div", { style: { color: 'red', marginBottom: '1rem' }, children: ["Error: ", error] }), response && ((0, jsx_runtime_1.jsxs)("div", { style: { whiteSpace: 'pre-wrap', backgroundColor: '#f4f4f4', padding: '1rem', borderRadius: '4px' }, children: [(0, jsx_runtime_1.jsx)("strong", { children: "Response:" }), (0, jsx_runtime_1.jsx)("p", { children: response })] }))] }));
};
exports.AgentInteractionPanel = AgentInteractionPanel;
//# sourceMappingURL=AgentInteractionPanel.js.map