@apteva/apteva-kit 0.1.130 → 0.1.132
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +36 -1
- package/dist/index.d.ts +36 -1
- package/dist/index.js +333 -80
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +553 -300
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -2805,17 +2805,36 @@ function ToolCall({ name, status, isReceiving = false, inputLength = 0, streamOu
|
|
|
2805
2805
|
// src/components/Chat/ToolCallGroup.tsx
|
|
2806
2806
|
import { useState as useState5 } from "react";
|
|
2807
2807
|
import { jsx as jsx18, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
2808
|
+
function formatResultPreview(result) {
|
|
2809
|
+
if (result == null) return "";
|
|
2810
|
+
const str = typeof result === "string" ? result : JSON.stringify(result);
|
|
2811
|
+
const oneLine = str.replace(/\s+/g, " ").trim();
|
|
2812
|
+
return oneLine.length > 120 ? oneLine.slice(0, 117) + "..." : oneLine;
|
|
2813
|
+
}
|
|
2808
2814
|
function ToolCallGroup({ tools }) {
|
|
2809
2815
|
const completed = tools.filter((t) => t.status === "completed").length;
|
|
2810
2816
|
const errored = tools.filter((t) => t.status === "error").length;
|
|
2811
|
-
const running = tools.filter((t) => t.status === "running").length;
|
|
2812
|
-
const preparing = tools.filter((t) => t.status === "preparing").length;
|
|
2813
2817
|
const total = tools.length;
|
|
2814
2818
|
const allDone = completed + errored === total;
|
|
2815
2819
|
const [expanded, setExpanded] = useState5(false);
|
|
2816
|
-
const isExpanded =
|
|
2817
|
-
const
|
|
2818
|
-
|
|
2820
|
+
const isExpanded = expanded;
|
|
2821
|
+
const activeTool = tools.find((t) => t.status === "running") || tools.find((t) => t.status === "preparing");
|
|
2822
|
+
let statusText;
|
|
2823
|
+
if (allDone) {
|
|
2824
|
+
if (errored > 0) {
|
|
2825
|
+
statusText = `Used ${total} tools \xB7 ${errored} failed`;
|
|
2826
|
+
} else {
|
|
2827
|
+
statusText = `Used ${total} tools`;
|
|
2828
|
+
}
|
|
2829
|
+
} else {
|
|
2830
|
+
const parts = [`Using ${total} tools`];
|
|
2831
|
+
if (completed > 0) parts.push(`${completed} done`);
|
|
2832
|
+
if (activeTool) {
|
|
2833
|
+
const activeLabel = activeTool.streamOutput || (activeTool.status === "preparing" ? "preparing" : "running");
|
|
2834
|
+
parts.push(`${activeTool.name} ${activeLabel === "preparing" || activeLabel === "running" ? activeLabel + "..." : "\xB7 " + activeLabel}`);
|
|
2835
|
+
}
|
|
2836
|
+
statusText = parts.join(" \xB7 ");
|
|
2837
|
+
}
|
|
2819
2838
|
const cardClass = allDone ? errored > 0 ? "apteva-tool-group apteva-tool-group-error" : "apteva-tool-group apteva-tool-group-completed" : "apteva-tool-group apteva-tool-group-running";
|
|
2820
2839
|
return /* @__PURE__ */ jsxs13("div", { className: cardClass, children: [
|
|
2821
2840
|
/* @__PURE__ */ jsxs13(
|
|
@@ -2846,18 +2865,20 @@ function ToolCallGroup({ tools }) {
|
|
|
2846
2865
|
]
|
|
2847
2866
|
}
|
|
2848
2867
|
),
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
|
|
2856
|
-
|
|
2857
|
-
|
|
2858
|
-
|
|
2859
|
-
|
|
2860
|
-
|
|
2868
|
+
isExpanded && /* @__PURE__ */ jsx18("div", { className: "apteva-tool-group-list", children: tools.map((tool) => {
|
|
2869
|
+
const resultPreview = tool.status === "completed" && tool.result ? formatResultPreview(tool.result) : "";
|
|
2870
|
+
const hasDetail = tool.status === "running" && tool.streamOutput || resultPreview;
|
|
2871
|
+
return /* @__PURE__ */ jsxs13("div", { className: `apteva-tool-group-item ${hasDetail ? "apteva-tool-group-item-has-detail" : ""}`, children: [
|
|
2872
|
+
/* @__PURE__ */ jsxs13("div", { className: "apteva-tool-group-item-row", children: [
|
|
2873
|
+
tool.status === "completed" ? /* @__PURE__ */ jsx18("svg", { className: "apteva-tool-group-item-icon apteva-tool-group-item-done", width: "12", height: "12", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx18("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 3, d: "M5 13l4 4L19 7" }) }) : tool.status === "error" ? /* @__PURE__ */ jsx18("svg", { className: "apteva-tool-group-item-icon apteva-tool-group-item-error", width: "12", height: "12", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx18("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 3, d: "M6 18L18 6M6 6l12 12" }) }) : /* @__PURE__ */ jsx18("div", { className: "apteva-tool-group-item-icon apteva-tool-group-item-spinner" }),
|
|
2874
|
+
/* @__PURE__ */ jsx18("span", { className: "apteva-tool-group-item-name", children: tool.name }),
|
|
2875
|
+
tool.status === "running" && !tool.streamOutput && /* @__PURE__ */ jsx18("span", { className: "apteva-tool-group-item-running-label", children: "running..." }),
|
|
2876
|
+
tool.status === "preparing" && /* @__PURE__ */ jsx18("span", { className: "apteva-tool-group-item-running-label", children: "preparing..." })
|
|
2877
|
+
] }),
|
|
2878
|
+
tool.status === "running" && tool.streamOutput && /* @__PURE__ */ jsx18("div", { className: "apteva-tool-group-item-detail", children: tool.streamOutput }),
|
|
2879
|
+
resultPreview && /* @__PURE__ */ jsx18("div", { className: "apteva-tool-group-item-detail apteva-tool-group-item-result-text", children: resultPreview })
|
|
2880
|
+
] }, tool.id);
|
|
2881
|
+
}) })
|
|
2861
2882
|
] });
|
|
2862
2883
|
}
|
|
2863
2884
|
|
|
@@ -3108,7 +3129,8 @@ function Message({ message, onAction, enableWidgets, onWidgetRender, persistentW
|
|
|
3108
3129
|
name: tool.name,
|
|
3109
3130
|
status: tool.status || (tool.result !== void 0 ? "completed" : "running"),
|
|
3110
3131
|
isReceiving: tool.isReceiving,
|
|
3111
|
-
streamOutput: tool.streamOutput
|
|
3132
|
+
streamOutput: tool.streamOutput,
|
|
3133
|
+
result: tool.result
|
|
3112
3134
|
};
|
|
3113
3135
|
});
|
|
3114
3136
|
elements.push(
|
|
@@ -4457,6 +4479,7 @@ function useVoiceSession(config) {
|
|
|
4457
4479
|
const [state, setState] = useState9("idle");
|
|
4458
4480
|
const [partialTranscript, setPartialTranscript] = useState9("");
|
|
4459
4481
|
const [duration, setDuration] = useState9(0);
|
|
4482
|
+
const [muted, setMuted] = useState9(false);
|
|
4460
4483
|
const wsRef = useRef9(null);
|
|
4461
4484
|
const captureCtxRef = useRef9(null);
|
|
4462
4485
|
const playbackCtxRef = useRef9(null);
|
|
@@ -4465,6 +4488,7 @@ function useVoiceSession(config) {
|
|
|
4465
4488
|
const nextPlayTimeRef = useRef9(0);
|
|
4466
4489
|
const durationIntervalRef = useRef9(null);
|
|
4467
4490
|
const startTimeRef = useRef9(0);
|
|
4491
|
+
const mutedRef = useRef9(false);
|
|
4468
4492
|
const configRef = useRef9(config);
|
|
4469
4493
|
configRef.current = config;
|
|
4470
4494
|
const cleanup = useCallback4(() => {
|
|
@@ -4502,6 +4526,8 @@ function useVoiceSession(config) {
|
|
|
4502
4526
|
wsRef.current = null;
|
|
4503
4527
|
}
|
|
4504
4528
|
nextPlayTimeRef.current = 0;
|
|
4529
|
+
mutedRef.current = false;
|
|
4530
|
+
setMuted(false);
|
|
4505
4531
|
setPartialTranscript("");
|
|
4506
4532
|
setDuration(0);
|
|
4507
4533
|
}, []);
|
|
@@ -4529,6 +4555,8 @@ function useVoiceSession(config) {
|
|
|
4529
4555
|
source.start(startTime);
|
|
4530
4556
|
nextPlayTimeRef.current = startTime + audioBuffer.duration;
|
|
4531
4557
|
}, []);
|
|
4558
|
+
const startCaptureRef = useRef9(() => {
|
|
4559
|
+
});
|
|
4532
4560
|
const handleMessage = useCallback4((msg) => {
|
|
4533
4561
|
const cfg = configRef.current;
|
|
4534
4562
|
switch (msg.type) {
|
|
@@ -4538,6 +4566,7 @@ function useVoiceSession(config) {
|
|
|
4538
4566
|
durationIntervalRef.current = setInterval(() => {
|
|
4539
4567
|
setDuration(Math.floor((Date.now() - startTimeRef.current) / 1e3));
|
|
4540
4568
|
}, 1e3);
|
|
4569
|
+
startCaptureRef.current();
|
|
4541
4570
|
break;
|
|
4542
4571
|
case "audio_delta":
|
|
4543
4572
|
if (msg.data?.chunk) {
|
|
@@ -4594,6 +4623,7 @@ function useVoiceSession(config) {
|
|
|
4594
4623
|
processorRef.current = captureCtxRef.current.createScriptProcessor(2048, 1, 1);
|
|
4595
4624
|
processorRef.current.onaudioprocess = (e) => {
|
|
4596
4625
|
if (!ws || ws.readyState !== WebSocket.OPEN) return;
|
|
4626
|
+
if (mutedRef.current) return;
|
|
4597
4627
|
const inputData = e.inputBuffer.getChannelData(0);
|
|
4598
4628
|
const resampledData = resampleAudio(inputData, nativeSampleRate, 16e3);
|
|
4599
4629
|
const int16Data = float32ToInt16(resampledData);
|
|
@@ -4606,16 +4636,24 @@ function useVoiceSession(config) {
|
|
|
4606
4636
|
source.connect(processorRef.current);
|
|
4607
4637
|
processorRef.current.connect(captureCtxRef.current.destination);
|
|
4608
4638
|
} catch (e) {
|
|
4639
|
+
console.warn("Microphone access denied:", e);
|
|
4609
4640
|
configRef.current.onError?.(new Error("Microphone access denied"));
|
|
4610
|
-
cleanup();
|
|
4611
|
-
setState("idle");
|
|
4612
4641
|
}
|
|
4613
4642
|
}, [cleanup]);
|
|
4643
|
+
startCaptureRef.current = startCapture;
|
|
4614
4644
|
const start = useCallback4(() => {
|
|
4615
4645
|
if (state !== "idle") return;
|
|
4616
4646
|
setState("connecting");
|
|
4617
|
-
|
|
4618
|
-
|
|
4647
|
+
let wsUrl;
|
|
4648
|
+
if (/^https?:\/\//.test(config.apiUrl)) {
|
|
4649
|
+
wsUrl = config.apiUrl.replace(/^http/, "ws") + "/voice";
|
|
4650
|
+
} else {
|
|
4651
|
+
const protocol = window.location.protocol === "https:" ? "wss:" : "ws:";
|
|
4652
|
+
wsUrl = `${protocol}//${window.location.host}${config.apiUrl}/voice`;
|
|
4653
|
+
}
|
|
4654
|
+
if (config.apiKey) {
|
|
4655
|
+
wsUrl += `${wsUrl.includes("?") ? "&" : "?"}token=${encodeURIComponent(config.apiKey)}`;
|
|
4656
|
+
}
|
|
4619
4657
|
const ws = new WebSocket(wsUrl);
|
|
4620
4658
|
wsRef.current = ws;
|
|
4621
4659
|
ws.onopen = () => {
|
|
@@ -4625,7 +4663,6 @@ function useVoiceSession(config) {
|
|
|
4625
4663
|
type: "start",
|
|
4626
4664
|
data: { provider, voice }
|
|
4627
4665
|
}));
|
|
4628
|
-
startCapture();
|
|
4629
4666
|
};
|
|
4630
4667
|
ws.onmessage = (event) => {
|
|
4631
4668
|
try {
|
|
@@ -4642,11 +4679,20 @@ function useVoiceSession(config) {
|
|
|
4642
4679
|
cleanup();
|
|
4643
4680
|
setState("idle");
|
|
4644
4681
|
};
|
|
4645
|
-
}, [state, config.apiUrl,
|
|
4682
|
+
}, [state, config.apiUrl, handleMessage, cleanup]);
|
|
4646
4683
|
const stop = useCallback4(() => {
|
|
4647
4684
|
cleanup();
|
|
4648
4685
|
setState("idle");
|
|
4649
4686
|
}, [cleanup]);
|
|
4687
|
+
const toggleMute = useCallback4(() => {
|
|
4688
|
+
const next = !mutedRef.current;
|
|
4689
|
+
mutedRef.current = next;
|
|
4690
|
+
setMuted(next);
|
|
4691
|
+
if (mediaStreamRef.current) {
|
|
4692
|
+
const track = mediaStreamRef.current.getAudioTracks()[0];
|
|
4693
|
+
if (track) track.enabled = !next;
|
|
4694
|
+
}
|
|
4695
|
+
}, []);
|
|
4650
4696
|
const sendText = useCallback4((text) => {
|
|
4651
4697
|
const ws = wsRef.current;
|
|
4652
4698
|
if (!ws || ws.readyState !== WebSocket.OPEN) return;
|
|
@@ -4655,7 +4701,7 @@ function useVoiceSession(config) {
|
|
|
4655
4701
|
data: { content: text }
|
|
4656
4702
|
}));
|
|
4657
4703
|
}, []);
|
|
4658
|
-
return { state, partialTranscript, duration, start, stop, sendText };
|
|
4704
|
+
return { state, partialTranscript, duration, muted, start, stop, sendText, toggleMute };
|
|
4659
4705
|
}
|
|
4660
4706
|
|
|
4661
4707
|
// src/components/Chat/Chat.tsx
|
|
@@ -4746,6 +4792,7 @@ var Chat = forwardRef(function Chat2({
|
|
|
4746
4792
|
}, []);
|
|
4747
4793
|
const voice = useVoiceSession({
|
|
4748
4794
|
apiUrl: apiUrl || "",
|
|
4795
|
+
apiKey,
|
|
4749
4796
|
provider: voiceProvider,
|
|
4750
4797
|
voice: voiceId,
|
|
4751
4798
|
onTranscript: handleVoiceTranscript,
|
|
@@ -5439,9 +5486,214 @@ ${planToExecute}`;
|
|
|
5439
5486
|
import { useState as useState11 } from "react";
|
|
5440
5487
|
import { jsx as jsx27, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
5441
5488
|
|
|
5489
|
+
// src/components/Call/Call.tsx
|
|
5490
|
+
import { useState as useState12, useCallback as useCallback6, useEffect as useEffect12, useRef as useRef12 } from "react";
|
|
5491
|
+
|
|
5492
|
+
// src/components/Call/CallStatus.tsx
|
|
5493
|
+
import { jsx as jsx28, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
5494
|
+
function formatDuration(seconds) {
|
|
5495
|
+
const m = Math.floor(seconds / 60);
|
|
5496
|
+
const s = seconds % 60;
|
|
5497
|
+
return `${m.toString().padStart(2, "0")}:${s.toString().padStart(2, "0")}`;
|
|
5498
|
+
}
|
|
5499
|
+
function CallStatus({ agentName = "Agent", agentAvatarUrl, state, duration }) {
|
|
5500
|
+
const initial = agentName.charAt(0).toUpperCase();
|
|
5501
|
+
return /* @__PURE__ */ jsxs22("div", { className: "apteva-call-agent", children: [
|
|
5502
|
+
/* @__PURE__ */ jsxs22("div", { className: "apteva-call-avatar-wrap", children: [
|
|
5503
|
+
agentAvatarUrl ? /* @__PURE__ */ jsx28("img", { src: agentAvatarUrl, alt: agentName, className: "apteva-call-avatar" }) : /* @__PURE__ */ jsx28("div", { className: "apteva-call-avatar-placeholder", children: initial }),
|
|
5504
|
+
state === "active" && /* @__PURE__ */ jsx28("div", { className: "apteva-call-pulse-ring" })
|
|
5505
|
+
] }),
|
|
5506
|
+
/* @__PURE__ */ jsx28("div", { className: "apteva-call-agent-name", children: agentName }),
|
|
5507
|
+
/* @__PURE__ */ jsxs22("div", { className: `apteva-call-status ${state === "active" ? "apteva-call-status-active" : state === "connecting" ? "apteva-call-status-connecting" : state === "error" ? "apteva-call-status-error" : ""}`, children: [
|
|
5508
|
+
state === "idle" && "Ready",
|
|
5509
|
+
state === "connecting" && "Connecting...",
|
|
5510
|
+
state === "active" && "Connected",
|
|
5511
|
+
state === "error" && "Error"
|
|
5512
|
+
] }),
|
|
5513
|
+
(state === "active" || state === "connecting") && /* @__PURE__ */ jsx28("div", { className: "apteva-call-duration", children: formatDuration(duration) })
|
|
5514
|
+
] });
|
|
5515
|
+
}
|
|
5516
|
+
|
|
5517
|
+
// src/components/Call/CallTranscript.tsx
|
|
5518
|
+
import { useEffect as useEffect11, useRef as useRef11 } from "react";
|
|
5519
|
+
import { jsx as jsx29, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
5520
|
+
function CallTranscript({ entries, partialTranscript }) {
|
|
5521
|
+
const scrollRef = useRef11(null);
|
|
5522
|
+
useEffect11(() => {
|
|
5523
|
+
if (scrollRef.current) {
|
|
5524
|
+
scrollRef.current.scrollTop = scrollRef.current.scrollHeight;
|
|
5525
|
+
}
|
|
5526
|
+
}, [entries.length, partialTranscript]);
|
|
5527
|
+
if (entries.length === 0 && !partialTranscript) return null;
|
|
5528
|
+
return /* @__PURE__ */ jsxs23("div", { className: "apteva-call-transcript", ref: scrollRef, children: [
|
|
5529
|
+
entries.map((entry) => /* @__PURE__ */ jsxs23("div", { className: "apteva-call-transcript-entry", children: [
|
|
5530
|
+
/* @__PURE__ */ jsx29("span", { className: `apteva-call-transcript-role apteva-call-transcript-role-${entry.role}`, children: entry.role === "user" ? "You" : entry.role === "assistant" ? "Agent" : "System" }),
|
|
5531
|
+
/* @__PURE__ */ jsx29("span", { className: "apteva-call-transcript-content", children: entry.content })
|
|
5532
|
+
] }, entry.id)),
|
|
5533
|
+
partialTranscript && /* @__PURE__ */ jsxs23("div", { className: "apteva-call-transcript-entry", children: [
|
|
5534
|
+
/* @__PURE__ */ jsx29("span", { className: "apteva-call-transcript-role apteva-call-transcript-role-user", children: "You" }),
|
|
5535
|
+
/* @__PURE__ */ jsx29("span", { className: "apteva-call-transcript-partial", children: partialTranscript })
|
|
5536
|
+
] })
|
|
5537
|
+
] });
|
|
5538
|
+
}
|
|
5539
|
+
|
|
5540
|
+
// src/components/Call/CallControls.tsx
|
|
5541
|
+
import { Fragment as Fragment7, jsx as jsx30, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
5542
|
+
function CallControls({ state, muted, mediaMode, onStart, onEnd, onToggleMute }) {
|
|
5543
|
+
const isLive = state === "active" || state === "connecting";
|
|
5544
|
+
return /* @__PURE__ */ jsx30("div", { className: "apteva-call-controls", children: isLive ? /* @__PURE__ */ jsxs24(Fragment7, { children: [
|
|
5545
|
+
/* @__PURE__ */ jsx30(
|
|
5546
|
+
"button",
|
|
5547
|
+
{
|
|
5548
|
+
onClick: onToggleMute,
|
|
5549
|
+
className: `apteva-call-btn apteva-call-btn-mute ${muted ? "apteva-call-btn-mute-active" : ""}`,
|
|
5550
|
+
title: muted ? "Unmute" : "Mute",
|
|
5551
|
+
children: muted ? /* @__PURE__ */ jsxs24("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
5552
|
+
/* @__PURE__ */ jsx30("line", { x1: "1", y1: "1", x2: "23", y2: "23" }),
|
|
5553
|
+
/* @__PURE__ */ jsx30("path", { d: "M9 9v3a3 3 0 0 0 5.12 2.12M15 9.34V4a3 3 0 0 0-5.94-.6" }),
|
|
5554
|
+
/* @__PURE__ */ jsx30("path", { d: "M17 16.95A7 7 0 0 1 5 12v-2m14 0v2c0 .76-.13 1.49-.35 2.17" }),
|
|
5555
|
+
/* @__PURE__ */ jsx30("line", { x1: "12", y1: "19", x2: "12", y2: "23" }),
|
|
5556
|
+
/* @__PURE__ */ jsx30("line", { x1: "8", y1: "23", x2: "16", y2: "23" })
|
|
5557
|
+
] }) : /* @__PURE__ */ jsxs24("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
5558
|
+
/* @__PURE__ */ jsx30("path", { d: "M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z" }),
|
|
5559
|
+
/* @__PURE__ */ jsx30("path", { d: "M19 10v2a7 7 0 0 1-14 0v-2" }),
|
|
5560
|
+
/* @__PURE__ */ jsx30("line", { x1: "12", y1: "19", x2: "12", y2: "23" }),
|
|
5561
|
+
/* @__PURE__ */ jsx30("line", { x1: "8", y1: "23", x2: "16", y2: "23" })
|
|
5562
|
+
] })
|
|
5563
|
+
}
|
|
5564
|
+
),
|
|
5565
|
+
/* @__PURE__ */ jsx30(
|
|
5566
|
+
"button",
|
|
5567
|
+
{
|
|
5568
|
+
onClick: onEnd,
|
|
5569
|
+
className: "apteva-call-btn apteva-call-btn-end",
|
|
5570
|
+
title: "End call",
|
|
5571
|
+
children: /* @__PURE__ */ jsxs24("svg", { width: "22", height: "22", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
5572
|
+
/* @__PURE__ */ jsx30("path", { d: "M10.68 13.31a16 16 0 0 0 3.41 2.6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7 2 2 0 0 1 1.72 2v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91" }),
|
|
5573
|
+
/* @__PURE__ */ jsx30("line", { x1: "23", y1: "1", x2: "1", y2: "23" })
|
|
5574
|
+
] })
|
|
5575
|
+
}
|
|
5576
|
+
)
|
|
5577
|
+
] }) : (
|
|
5578
|
+
/* Start call button */
|
|
5579
|
+
/* @__PURE__ */ jsx30(
|
|
5580
|
+
"button",
|
|
5581
|
+
{
|
|
5582
|
+
onClick: onStart,
|
|
5583
|
+
className: "apteva-call-btn apteva-call-btn-start",
|
|
5584
|
+
title: "Start call",
|
|
5585
|
+
disabled: state === "error",
|
|
5586
|
+
children: /* @__PURE__ */ jsx30("svg", { width: "22", height: "22", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsx30("path", { d: "M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z" }) })
|
|
5587
|
+
}
|
|
5588
|
+
)
|
|
5589
|
+
) });
|
|
5590
|
+
}
|
|
5591
|
+
|
|
5592
|
+
// src/components/Call/Call.tsx
|
|
5593
|
+
import { jsx as jsx31, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
5594
|
+
function Call({
|
|
5595
|
+
agentName = "Agent",
|
|
5596
|
+
agentAvatarUrl,
|
|
5597
|
+
apiUrl,
|
|
5598
|
+
apiKey,
|
|
5599
|
+
voiceProvider,
|
|
5600
|
+
voiceId,
|
|
5601
|
+
mediaMode = "voice",
|
|
5602
|
+
autoStart = false,
|
|
5603
|
+
showTranscript = true,
|
|
5604
|
+
maxTranscriptEntries = 50,
|
|
5605
|
+
onCallStart,
|
|
5606
|
+
onCallEnd,
|
|
5607
|
+
onTranscript,
|
|
5608
|
+
onError,
|
|
5609
|
+
onMuteChange,
|
|
5610
|
+
variant = "default",
|
|
5611
|
+
theme,
|
|
5612
|
+
className
|
|
5613
|
+
}) {
|
|
5614
|
+
const [transcripts, setTranscripts] = useState12([]);
|
|
5615
|
+
const prevStateRef = useRef12("idle");
|
|
5616
|
+
const durationRef = useRef12(0);
|
|
5617
|
+
const autoStartedRef = useRef12(false);
|
|
5618
|
+
const handleTranscript = useCallback6((entry) => {
|
|
5619
|
+
setTranscripts((prev) => {
|
|
5620
|
+
const next = [...prev, entry];
|
|
5621
|
+
return next.length > maxTranscriptEntries ? next.slice(next.length - maxTranscriptEntries) : next;
|
|
5622
|
+
});
|
|
5623
|
+
onTranscript?.(entry);
|
|
5624
|
+
}, [maxTranscriptEntries, onTranscript]);
|
|
5625
|
+
const voice = useVoiceSession({
|
|
5626
|
+
apiUrl,
|
|
5627
|
+
apiKey,
|
|
5628
|
+
provider: voiceProvider,
|
|
5629
|
+
voice: voiceId,
|
|
5630
|
+
onTranscript: handleTranscript,
|
|
5631
|
+
onError
|
|
5632
|
+
});
|
|
5633
|
+
useEffect12(() => {
|
|
5634
|
+
durationRef.current = voice.duration;
|
|
5635
|
+
}, [voice.duration]);
|
|
5636
|
+
useEffect12(() => {
|
|
5637
|
+
const prev = prevStateRef.current;
|
|
5638
|
+
if (prev !== "active" && voice.state === "active") {
|
|
5639
|
+
onCallStart?.();
|
|
5640
|
+
}
|
|
5641
|
+
if (prev === "active" && voice.state === "idle") {
|
|
5642
|
+
onCallEnd?.({ duration: durationRef.current, transcripts });
|
|
5643
|
+
}
|
|
5644
|
+
prevStateRef.current = voice.state;
|
|
5645
|
+
}, [voice.state, onCallStart, onCallEnd, transcripts]);
|
|
5646
|
+
useEffect12(() => {
|
|
5647
|
+
if (autoStart && !autoStartedRef.current && voice.state === "idle") {
|
|
5648
|
+
autoStartedRef.current = true;
|
|
5649
|
+
voice.start();
|
|
5650
|
+
}
|
|
5651
|
+
}, [autoStart, voice.state, voice.start]);
|
|
5652
|
+
useEffect12(() => {
|
|
5653
|
+
onMuteChange?.(voice.muted);
|
|
5654
|
+
}, [voice.muted, onMuteChange]);
|
|
5655
|
+
const cn2 = [
|
|
5656
|
+
"apteva-call",
|
|
5657
|
+
variant !== "default" && `apteva-call-${variant}`,
|
|
5658
|
+
theme === "dark" && "apteva-force-dark",
|
|
5659
|
+
theme === "light" && "apteva-force-light",
|
|
5660
|
+
className
|
|
5661
|
+
].filter(Boolean).join(" ");
|
|
5662
|
+
return /* @__PURE__ */ jsxs25("div", { className: cn2, children: [
|
|
5663
|
+
/* @__PURE__ */ jsx31(
|
|
5664
|
+
CallStatus,
|
|
5665
|
+
{
|
|
5666
|
+
agentName,
|
|
5667
|
+
agentAvatarUrl,
|
|
5668
|
+
state: voice.state,
|
|
5669
|
+
duration: voice.duration
|
|
5670
|
+
}
|
|
5671
|
+
),
|
|
5672
|
+
mediaMode === "video" && /* @__PURE__ */ jsx31("div", { className: "apteva-call-video-area", children: /* @__PURE__ */ jsx31("svg", { width: "32", height: "32", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", opacity: "0.4", children: /* @__PURE__ */ jsx31("path", { d: "M16.24 7.76a6 6 0 0 1 0 8.49m-8.48-.01a6 6 0 0 1 0-8.49m11.31-2.82a10 10 0 0 1 0 14.14m-14.14 0a10 10 0 0 1 0-14.14" }) }) }),
|
|
5673
|
+
showTranscript && /* @__PURE__ */ jsx31(
|
|
5674
|
+
CallTranscript,
|
|
5675
|
+
{
|
|
5676
|
+
entries: transcripts,
|
|
5677
|
+
partialTranscript: voice.partialTranscript
|
|
5678
|
+
}
|
|
5679
|
+
),
|
|
5680
|
+
/* @__PURE__ */ jsx31(
|
|
5681
|
+
CallControls,
|
|
5682
|
+
{
|
|
5683
|
+
state: voice.state,
|
|
5684
|
+
muted: voice.muted,
|
|
5685
|
+
mediaMode,
|
|
5686
|
+
onStart: voice.start,
|
|
5687
|
+
onEnd: voice.stop,
|
|
5688
|
+
onToggleMute: voice.toggleMute
|
|
5689
|
+
}
|
|
5690
|
+
)
|
|
5691
|
+
] });
|
|
5692
|
+
}
|
|
5693
|
+
|
|
5442
5694
|
// src/components/Command/Command.tsx
|
|
5443
|
-
import
|
|
5444
|
-
import { Fragment as
|
|
5695
|
+
import React3, { useState as useState13, useEffect as useEffect13 } from "react";
|
|
5696
|
+
import { Fragment as Fragment8, jsx as jsx32, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
5445
5697
|
function Command({
|
|
5446
5698
|
agentId,
|
|
5447
5699
|
command: initialCommand,
|
|
@@ -5468,28 +5720,28 @@ function Command({
|
|
|
5468
5720
|
resultRenderer,
|
|
5469
5721
|
className
|
|
5470
5722
|
}) {
|
|
5471
|
-
const [state, setState] =
|
|
5472
|
-
const [result, setResult] =
|
|
5473
|
-
const [error, setError] =
|
|
5474
|
-
const [progress, setProgress] =
|
|
5475
|
-
const [command, setCommand] =
|
|
5476
|
-
const [streamedContent, setStreamedContent] =
|
|
5477
|
-
const [plan, setPlan] =
|
|
5478
|
-
const [pendingCommand, setPendingCommand] =
|
|
5479
|
-
const [showPlanDetails, setShowPlanDetails] =
|
|
5480
|
-
const [uploadedFiles, setUploadedFiles] =
|
|
5481
|
-
const [showSettingsMenu, setShowSettingsMenu] =
|
|
5482
|
-
const [internalPlanMode, setInternalPlanMode] =
|
|
5483
|
-
const fileInputRef =
|
|
5484
|
-
|
|
5723
|
+
const [state, setState] = useState13("idle");
|
|
5724
|
+
const [result, setResult] = useState13(null);
|
|
5725
|
+
const [error, setError] = useState13(null);
|
|
5726
|
+
const [progress, setProgress] = useState13(0);
|
|
5727
|
+
const [command, setCommand] = useState13(initialCommand || "");
|
|
5728
|
+
const [streamedContent, setStreamedContent] = useState13("");
|
|
5729
|
+
const [plan, setPlan] = useState13("");
|
|
5730
|
+
const [pendingCommand, setPendingCommand] = useState13("");
|
|
5731
|
+
const [showPlanDetails, setShowPlanDetails] = useState13(false);
|
|
5732
|
+
const [uploadedFiles, setUploadedFiles] = useState13([]);
|
|
5733
|
+
const [showSettingsMenu, setShowSettingsMenu] = useState13(false);
|
|
5734
|
+
const [internalPlanMode, setInternalPlanMode] = useState13(planMode);
|
|
5735
|
+
const fileInputRef = React3.useRef(null);
|
|
5736
|
+
useEffect13(() => {
|
|
5485
5737
|
if (autoExecute && state === "idle" && command) {
|
|
5486
5738
|
executeCommand();
|
|
5487
5739
|
}
|
|
5488
5740
|
}, [autoExecute]);
|
|
5489
|
-
|
|
5741
|
+
useEffect13(() => {
|
|
5490
5742
|
setInternalPlanMode(planMode);
|
|
5491
5743
|
}, [planMode]);
|
|
5492
|
-
|
|
5744
|
+
useEffect13(() => {
|
|
5493
5745
|
const handleClickOutside = (event) => {
|
|
5494
5746
|
const target = event.target;
|
|
5495
5747
|
if (showSettingsMenu && !target.closest(".settings-menu-container")) {
|
|
@@ -5891,7 +6143,7 @@ ${planToExecute}`;
|
|
|
5891
6143
|
setUploadedFiles((prev) => prev.filter((_, i) => i !== index));
|
|
5892
6144
|
};
|
|
5893
6145
|
const isCompact = variant === "compact";
|
|
5894
|
-
return /* @__PURE__ */
|
|
6146
|
+
return /* @__PURE__ */ jsxs26(
|
|
5895
6147
|
"div",
|
|
5896
6148
|
{
|
|
5897
6149
|
className: cn(
|
|
@@ -5906,9 +6158,9 @@ ${planToExecute}`;
|
|
|
5906
6158
|
),
|
|
5907
6159
|
style: { minHeight: isCompact ? "auto" : "180px" },
|
|
5908
6160
|
children: [
|
|
5909
|
-
/* @__PURE__ */
|
|
5910
|
-
state === "idle" && allowInput && !isCompact && /* @__PURE__ */
|
|
5911
|
-
/* @__PURE__ */
|
|
6161
|
+
/* @__PURE__ */ jsxs26("div", { className: cn("flex-1 flex", isCompact ? "flex-row items-center p-3 gap-3" : "flex-col p-4"), children: [
|
|
6162
|
+
state === "idle" && allowInput && !isCompact && /* @__PURE__ */ jsxs26(Fragment8, { children: [
|
|
6163
|
+
/* @__PURE__ */ jsx32(
|
|
5912
6164
|
"textarea",
|
|
5913
6165
|
{
|
|
5914
6166
|
value: command,
|
|
@@ -5924,42 +6176,42 @@ ${planToExecute}`;
|
|
|
5924
6176
|
rows: 6
|
|
5925
6177
|
}
|
|
5926
6178
|
),
|
|
5927
|
-
uploadedFiles.length > 0 && /* @__PURE__ */
|
|
5928
|
-
file.type === "image" ? /* @__PURE__ */
|
|
6179
|
+
uploadedFiles.length > 0 && /* @__PURE__ */ jsx32("div", { className: "flex flex-wrap gap-2 mt-2", children: uploadedFiles.map((file, index) => /* @__PURE__ */ jsxs26("div", { className: "relative group", children: [
|
|
6180
|
+
file.type === "image" ? /* @__PURE__ */ jsx32(
|
|
5929
6181
|
"img",
|
|
5930
6182
|
{
|
|
5931
6183
|
src: file.preview,
|
|
5932
6184
|
alt: file.name,
|
|
5933
6185
|
className: "w-20 h-20 object-cover rounded-lg border-2 border-neutral-300 dark:border-neutral-600"
|
|
5934
6186
|
}
|
|
5935
|
-
) : /* @__PURE__ */
|
|
5936
|
-
/* @__PURE__ */
|
|
5937
|
-
/* @__PURE__ */
|
|
6187
|
+
) : /* @__PURE__ */ jsxs26("div", { className: "w-20 h-20 flex flex-col items-center justify-center rounded-lg border-2 border-neutral-300 dark:border-neutral-600 bg-neutral-50 dark:bg-neutral-800", children: [
|
|
6188
|
+
/* @__PURE__ */ jsx32("svg", { className: "w-8 h-8 text-neutral-500 dark:text-neutral-400", fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ jsx32("path", { fillRule: "evenodd", d: "M4 4a2 2 0 012-2h4.586A2 2 0 0112 2.586L15.414 6A2 2 0 0116 7.414V16a2 2 0 01-2 2H6a2 2 0 01-2-2V4zm2 6a1 1 0 011-1h6a1 1 0 110 2H7a1 1 0 01-1-1zm1 3a1 1 0 100 2h6a1 1 0 100-2H7z", clipRule: "evenodd" }) }),
|
|
6189
|
+
/* @__PURE__ */ jsx32("span", { className: "text-[8px] text-neutral-500 dark:text-neutral-400 mt-1 px-1 truncate max-w-full", children: file.name.length > 12 ? file.name.slice(0, 12) + "..." : file.name })
|
|
5938
6190
|
] }),
|
|
5939
|
-
/* @__PURE__ */
|
|
6191
|
+
/* @__PURE__ */ jsx32(
|
|
5940
6192
|
"button",
|
|
5941
6193
|
{
|
|
5942
6194
|
onClick: () => removeFile(index),
|
|
5943
6195
|
className: "absolute -top-2 -right-2 w-6 h-6 bg-red-500 hover:bg-red-600 text-white rounded-full flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity",
|
|
5944
6196
|
title: `Remove ${file.type}`,
|
|
5945
|
-
children: /* @__PURE__ */
|
|
6197
|
+
children: /* @__PURE__ */ jsx32("svg", { className: "w-4 h-4", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsx32("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) })
|
|
5946
6198
|
}
|
|
5947
6199
|
)
|
|
5948
6200
|
] }, index)) })
|
|
5949
6201
|
] }),
|
|
5950
|
-
state === "idle" && allowInput && isCompact && /* @__PURE__ */
|
|
5951
|
-
/* @__PURE__ */
|
|
5952
|
-
enableFileUpload && /* @__PURE__ */
|
|
6202
|
+
state === "idle" && allowInput && isCompact && /* @__PURE__ */ jsxs26(Fragment8, { children: [
|
|
6203
|
+
/* @__PURE__ */ jsxs26("div", { className: "flex items-center gap-0.5 flex-shrink-0", children: [
|
|
6204
|
+
enableFileUpload && /* @__PURE__ */ jsx32(
|
|
5953
6205
|
"button",
|
|
5954
6206
|
{
|
|
5955
6207
|
onClick: () => fileInputRef.current?.click(),
|
|
5956
6208
|
className: "w-8 h-8 rounded-lg flex items-center justify-center transition-all flex-shrink-0 !text-neutral-500 dark:!text-neutral-500 hover:bg-neutral-100 dark:hover:bg-neutral-800",
|
|
5957
6209
|
title: "Attach file",
|
|
5958
|
-
children: /* @__PURE__ */
|
|
6210
|
+
children: /* @__PURE__ */ jsx32("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx32("path", { d: "M8.4 2.8L4.4 6.8C3.736 7.464 3.736 8.536 4.4 9.2C5.064 9.864 6.136 9.864 6.8 9.2L11.6 4.4C12.704 3.296 12.704 1.504 11.6 0.4C10.496 -0.704 8.704 -0.704 7.6 0.4L2.8 5.2C1.256 6.744 1.256 9.256 2.8 10.8C4.344 12.344 6.856 12.344 8.4 10.8L12.4 6.8", stroke: "currentColor", strokeWidth: "1.2", strokeLinecap: "round", strokeLinejoin: "round", transform: "translate(1.6, 2.4)" }) })
|
|
5959
6211
|
}
|
|
5960
6212
|
),
|
|
5961
|
-
planMode && /* @__PURE__ */
|
|
5962
|
-
/* @__PURE__ */
|
|
6213
|
+
planMode && /* @__PURE__ */ jsxs26("div", { className: "relative settings-menu-container", children: [
|
|
6214
|
+
/* @__PURE__ */ jsx32(
|
|
5963
6215
|
"button",
|
|
5964
6216
|
{
|
|
5965
6217
|
onClick: () => setShowSettingsMenu(!showSettingsMenu),
|
|
@@ -5968,28 +6220,28 @@ ${planToExecute}`;
|
|
|
5968
6220
|
internalPlanMode ? "!text-blue-600 dark:!text-blue-400" : "!text-neutral-500 dark:!text-neutral-500"
|
|
5969
6221
|
),
|
|
5970
6222
|
title: "Settings",
|
|
5971
|
-
children: /* @__PURE__ */
|
|
5972
|
-
/* @__PURE__ */
|
|
5973
|
-
/* @__PURE__ */
|
|
5974
|
-
/* @__PURE__ */
|
|
5975
|
-
/* @__PURE__ */
|
|
5976
|
-
/* @__PURE__ */
|
|
5977
|
-
/* @__PURE__ */
|
|
5978
|
-
/* @__PURE__ */
|
|
5979
|
-
/* @__PURE__ */
|
|
5980
|
-
/* @__PURE__ */
|
|
6223
|
+
children: /* @__PURE__ */ jsxs26("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
6224
|
+
/* @__PURE__ */ jsx32("line", { x1: "4", y1: "21", x2: "4", y2: "14" }),
|
|
6225
|
+
/* @__PURE__ */ jsx32("line", { x1: "4", y1: "10", x2: "4", y2: "3" }),
|
|
6226
|
+
/* @__PURE__ */ jsx32("line", { x1: "12", y1: "21", x2: "12", y2: "12" }),
|
|
6227
|
+
/* @__PURE__ */ jsx32("line", { x1: "12", y1: "8", x2: "12", y2: "3" }),
|
|
6228
|
+
/* @__PURE__ */ jsx32("line", { x1: "20", y1: "21", x2: "20", y2: "16" }),
|
|
6229
|
+
/* @__PURE__ */ jsx32("line", { x1: "20", y1: "12", x2: "20", y2: "3" }),
|
|
6230
|
+
/* @__PURE__ */ jsx32("line", { x1: "1", y1: "14", x2: "7", y2: "14" }),
|
|
6231
|
+
/* @__PURE__ */ jsx32("line", { x1: "9", y1: "8", x2: "15", y2: "8" }),
|
|
6232
|
+
/* @__PURE__ */ jsx32("line", { x1: "17", y1: "16", x2: "23", y2: "16" })
|
|
5981
6233
|
] })
|
|
5982
6234
|
}
|
|
5983
6235
|
),
|
|
5984
|
-
showSettingsMenu && /* @__PURE__ */
|
|
5985
|
-
/* @__PURE__ */
|
|
5986
|
-
/* @__PURE__ */
|
|
5987
|
-
/* @__PURE__ */
|
|
5988
|
-
/* @__PURE__ */
|
|
5989
|
-
/* @__PURE__ */
|
|
6236
|
+
showSettingsMenu && /* @__PURE__ */ jsx32("div", { className: "absolute top-10 left-0 z-50 w-56 bg-white dark:bg-neutral-800 border border-neutral-200 dark:border-neutral-700 rounded-lg shadow-lg p-2.5 settings-menu-container", children: /* @__PURE__ */ jsxs26("label", { className: "flex items-center justify-between cursor-pointer group", children: [
|
|
6237
|
+
/* @__PURE__ */ jsxs26("div", { className: "flex items-center gap-2", children: [
|
|
6238
|
+
/* @__PURE__ */ jsx32("svg", { className: "w-3.5 h-3.5 text-neutral-500 dark:text-neutral-400", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsx32("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-3 7h3m-3 4h3m-6-4h.01M9 16h.01" }) }),
|
|
6239
|
+
/* @__PURE__ */ jsxs26("div", { children: [
|
|
6240
|
+
/* @__PURE__ */ jsx32("div", { className: "text-xs font-medium text-neutral-700 dark:text-neutral-300", children: "Plan Mode" }),
|
|
6241
|
+
/* @__PURE__ */ jsx32("div", { className: "text-[10px] text-neutral-500 dark:text-neutral-400", children: "Review first" })
|
|
5990
6242
|
] })
|
|
5991
6243
|
] }),
|
|
5992
|
-
/* @__PURE__ */
|
|
6244
|
+
/* @__PURE__ */ jsx32(
|
|
5993
6245
|
"button",
|
|
5994
6246
|
{
|
|
5995
6247
|
onClick: (e) => {
|
|
@@ -6001,7 +6253,7 @@ ${planToExecute}`;
|
|
|
6001
6253
|
internalPlanMode ? "bg-blue-600" : "bg-neutral-300 dark:bg-neutral-600"
|
|
6002
6254
|
),
|
|
6003
6255
|
type: "button",
|
|
6004
|
-
children: /* @__PURE__ */
|
|
6256
|
+
children: /* @__PURE__ */ jsx32(
|
|
6005
6257
|
"span",
|
|
6006
6258
|
{
|
|
6007
6259
|
className: cn(
|
|
@@ -6015,26 +6267,26 @@ ${planToExecute}`;
|
|
|
6015
6267
|
] }) })
|
|
6016
6268
|
] })
|
|
6017
6269
|
] }),
|
|
6018
|
-
uploadedFiles.length > 0 && /* @__PURE__ */
|
|
6019
|
-
file.type === "image" ? /* @__PURE__ */
|
|
6270
|
+
uploadedFiles.length > 0 && /* @__PURE__ */ jsx32("div", { className: "flex gap-1 flex-shrink-0", children: uploadedFiles.map((file, index) => /* @__PURE__ */ jsxs26("div", { className: "relative group", children: [
|
|
6271
|
+
file.type === "image" ? /* @__PURE__ */ jsx32(
|
|
6020
6272
|
"img",
|
|
6021
6273
|
{
|
|
6022
6274
|
src: file.preview,
|
|
6023
6275
|
alt: file.name,
|
|
6024
6276
|
className: "w-8 h-8 object-cover rounded border border-neutral-300 dark:border-neutral-600"
|
|
6025
6277
|
}
|
|
6026
|
-
) : /* @__PURE__ */
|
|
6027
|
-
/* @__PURE__ */
|
|
6278
|
+
) : /* @__PURE__ */ jsx32("div", { className: "w-8 h-8 flex items-center justify-center rounded border border-neutral-300 dark:border-neutral-600 bg-neutral-50 dark:bg-neutral-800", title: file.name, children: /* @__PURE__ */ jsx32("svg", { className: "w-4 h-4 text-neutral-500 dark:text-neutral-400", fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ jsx32("path", { fillRule: "evenodd", d: "M4 4a2 2 0 012-2h4.586A2 2 0 0112 2.586L15.414 6A2 2 0 0116 7.414V16a2 2 0 01-2 2H6a2 2 0 01-2-2V4zm2 6a1 1 0 011-1h6a1 1 0 110 2H7a1 1 0 01-1-1zm1 3a1 1 0 100 2h6a1 1 0 100-2H7z", clipRule: "evenodd" }) }) }),
|
|
6279
|
+
/* @__PURE__ */ jsx32(
|
|
6028
6280
|
"button",
|
|
6029
6281
|
{
|
|
6030
6282
|
onClick: () => removeFile(index),
|
|
6031
6283
|
className: "absolute -top-1 -right-1 w-4 h-4 bg-red-500 hover:bg-red-600 text-white rounded-full flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity",
|
|
6032
6284
|
title: "Remove",
|
|
6033
|
-
children: /* @__PURE__ */
|
|
6285
|
+
children: /* @__PURE__ */ jsx32("svg", { className: "w-2.5 h-2.5", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: 3, children: /* @__PURE__ */ jsx32("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 18L18 6M6 6l12 12" }) })
|
|
6034
6286
|
}
|
|
6035
6287
|
)
|
|
6036
6288
|
] }, index)) }),
|
|
6037
|
-
/* @__PURE__ */
|
|
6289
|
+
/* @__PURE__ */ jsx32(
|
|
6038
6290
|
"input",
|
|
6039
6291
|
{
|
|
6040
6292
|
type: "text",
|
|
@@ -6050,7 +6302,7 @@ ${planToExecute}`;
|
|
|
6050
6302
|
className: "flex-1 bg-transparent border-none focus:outline-none !text-neutral-900 dark:!text-neutral-100 placeholder-neutral-400 dark:placeholder-neutral-500 py-1"
|
|
6051
6303
|
}
|
|
6052
6304
|
),
|
|
6053
|
-
/* @__PURE__ */
|
|
6305
|
+
/* @__PURE__ */ jsx32(
|
|
6054
6306
|
"button",
|
|
6055
6307
|
{
|
|
6056
6308
|
onClick: () => executeCommand(),
|
|
@@ -6066,33 +6318,33 @@ ${planToExecute}`;
|
|
|
6066
6318
|
!command.trim() && "border-neutral-200 dark:border-neutral-700 !text-neutral-400 dark:!text-neutral-600"
|
|
6067
6319
|
),
|
|
6068
6320
|
title: "Execute",
|
|
6069
|
-
children: /* @__PURE__ */
|
|
6321
|
+
children: /* @__PURE__ */ jsx32("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx32("path", { d: "M8 3L8 13M8 3L4 7M8 3L12 7", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })
|
|
6070
6322
|
}
|
|
6071
6323
|
)
|
|
6072
6324
|
] }),
|
|
6073
|
-
state === "loading" && !isCompact && /* @__PURE__ */
|
|
6074
|
-
/* @__PURE__ */
|
|
6075
|
-
/* @__PURE__ */
|
|
6076
|
-
showProgress && /* @__PURE__ */
|
|
6077
|
-
/* @__PURE__ */
|
|
6325
|
+
state === "loading" && !isCompact && /* @__PURE__ */ jsxs26("div", { className: "flex-1 flex flex-col items-center justify-center space-y-4 py-8", children: [
|
|
6326
|
+
/* @__PURE__ */ jsx32("div", { className: "w-6 h-6 border-2 border-neutral-300 border-t-blue-500 rounded-full animate-spin" }),
|
|
6327
|
+
/* @__PURE__ */ jsx32("div", { className: "text-neutral-600 dark:text-neutral-400 text-sm text-center max-w-md", children: enableStreaming && streamedContent ? streamedContent : loadingText }),
|
|
6328
|
+
showProgress && /* @__PURE__ */ jsxs26("div", { className: "w-full max-w-sm", children: [
|
|
6329
|
+
/* @__PURE__ */ jsx32("div", { className: "w-full bg-neutral-200 dark:bg-neutral-700 rounded-full h-1.5", children: /* @__PURE__ */ jsx32(
|
|
6078
6330
|
"div",
|
|
6079
6331
|
{
|
|
6080
6332
|
className: "bg-blue-500 h-1.5 rounded-full transition-all duration-300",
|
|
6081
6333
|
style: { width: `${progress}%` }
|
|
6082
6334
|
}
|
|
6083
6335
|
) }),
|
|
6084
|
-
/* @__PURE__ */
|
|
6336
|
+
/* @__PURE__ */ jsxs26("p", { className: "text-xs text-neutral-500 mt-2 text-center", children: [
|
|
6085
6337
|
progress,
|
|
6086
6338
|
"%"
|
|
6087
6339
|
] })
|
|
6088
6340
|
] })
|
|
6089
6341
|
] }),
|
|
6090
|
-
state === "loading" && isCompact && /* @__PURE__ */
|
|
6091
|
-
/* @__PURE__ */
|
|
6092
|
-
/* @__PURE__ */
|
|
6093
|
-
/* @__PURE__ */
|
|
6342
|
+
state === "loading" && isCompact && /* @__PURE__ */ jsxs26(Fragment8, { children: [
|
|
6343
|
+
/* @__PURE__ */ jsxs26("div", { className: "flex-1 flex items-center gap-3 py-1", children: [
|
|
6344
|
+
/* @__PURE__ */ jsx32("div", { className: "w-4 h-4 border-2 border-neutral-300 border-t-blue-500 rounded-full animate-spin" }),
|
|
6345
|
+
/* @__PURE__ */ jsx32("div", { className: "text-neutral-600 dark:text-neutral-400 text-sm truncate", children: enableStreaming && streamedContent ? streamedContent : loadingText })
|
|
6094
6346
|
] }),
|
|
6095
|
-
/* @__PURE__ */
|
|
6347
|
+
/* @__PURE__ */ jsx32(
|
|
6096
6348
|
"button",
|
|
6097
6349
|
{
|
|
6098
6350
|
disabled: true,
|
|
@@ -6104,20 +6356,20 @@ ${planToExecute}`;
|
|
|
6104
6356
|
"!text-lg",
|
|
6105
6357
|
"opacity-30 cursor-not-allowed"
|
|
6106
6358
|
),
|
|
6107
|
-
children: /* @__PURE__ */
|
|
6359
|
+
children: /* @__PURE__ */ jsx32("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx32("path", { d: "M8 3L8 13M8 3L4 7M8 3L12 7", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })
|
|
6108
6360
|
}
|
|
6109
6361
|
)
|
|
6110
6362
|
] }),
|
|
6111
|
-
state === "plan-pending" && !isCompact && /* @__PURE__ */
|
|
6112
|
-
/* @__PURE__ */
|
|
6113
|
-
/* @__PURE__ */
|
|
6114
|
-
/* @__PURE__ */
|
|
6115
|
-
/* @__PURE__ */
|
|
6116
|
-
/* @__PURE__ */
|
|
6363
|
+
state === "plan-pending" && !isCompact && /* @__PURE__ */ jsx32("div", { className: "flex-1 flex flex-col", children: /* @__PURE__ */ jsxs26("div", { className: "mb-4 p-4 bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-lg", children: [
|
|
6364
|
+
/* @__PURE__ */ jsxs26("div", { className: "flex items-start gap-2 mb-3", children: [
|
|
6365
|
+
/* @__PURE__ */ jsx32("svg", { className: "w-5 h-5 text-blue-600 dark:text-blue-400 mt-0.5 flex-shrink-0", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsx32("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-3 7h3m-3 4h3m-6-4h.01M9 16h.01" }) }),
|
|
6366
|
+
/* @__PURE__ */ jsxs26("div", { className: "flex-1", children: [
|
|
6367
|
+
/* @__PURE__ */ jsx32("h3", { className: "text-sm font-semibold text-blue-800 dark:text-blue-300 mb-1", children: "Proposed Plan" }),
|
|
6368
|
+
/* @__PURE__ */ jsx32("div", { className: "text-blue-700 dark:text-blue-300 text-sm whitespace-pre-line leading-relaxed", children: plan })
|
|
6117
6369
|
] })
|
|
6118
6370
|
] }),
|
|
6119
|
-
/* @__PURE__ */
|
|
6120
|
-
/* @__PURE__ */
|
|
6371
|
+
/* @__PURE__ */ jsxs26("div", { className: "flex gap-2 mt-4", children: [
|
|
6372
|
+
/* @__PURE__ */ jsx32(
|
|
6121
6373
|
"button",
|
|
6122
6374
|
{
|
|
6123
6375
|
onClick: approvePlan,
|
|
@@ -6125,7 +6377,7 @@ ${planToExecute}`;
|
|
|
6125
6377
|
children: "Approve & Execute"
|
|
6126
6378
|
}
|
|
6127
6379
|
),
|
|
6128
|
-
/* @__PURE__ */
|
|
6380
|
+
/* @__PURE__ */ jsx32(
|
|
6129
6381
|
"button",
|
|
6130
6382
|
{
|
|
6131
6383
|
onClick: rejectPlan,
|
|
@@ -6135,20 +6387,20 @@ ${planToExecute}`;
|
|
|
6135
6387
|
)
|
|
6136
6388
|
] })
|
|
6137
6389
|
] }) }),
|
|
6138
|
-
state === "plan-pending" && isCompact && /* @__PURE__ */
|
|
6139
|
-
/* @__PURE__ */
|
|
6390
|
+
state === "plan-pending" && isCompact && /* @__PURE__ */ jsxs26(Fragment8, { children: [
|
|
6391
|
+
/* @__PURE__ */ jsxs26(
|
|
6140
6392
|
"button",
|
|
6141
6393
|
{
|
|
6142
6394
|
onClick: () => setShowPlanDetails(true),
|
|
6143
6395
|
className: "flex-1 flex items-center gap-2 px-3 py-2 bg-blue-50 dark:bg-blue-900/30 hover:bg-blue-100 dark:hover:bg-blue-900/40 border border-blue-200 dark:border-blue-800 rounded-lg transition-colors",
|
|
6144
6396
|
children: [
|
|
6145
|
-
/* @__PURE__ */
|
|
6146
|
-
/* @__PURE__ */
|
|
6397
|
+
/* @__PURE__ */ jsx32("svg", { className: "w-4 h-4 text-blue-600 dark:text-blue-400 flex-shrink-0", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsx32("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-3 7h3m-3 4h3m-6-4h.01M9 16h.01" }) }),
|
|
6398
|
+
/* @__PURE__ */ jsx32("span", { className: "text-sm font-medium text-blue-700 dark:text-blue-300 truncate flex-1", children: "View Execution Plan" })
|
|
6147
6399
|
]
|
|
6148
6400
|
}
|
|
6149
6401
|
),
|
|
6150
|
-
/* @__PURE__ */
|
|
6151
|
-
/* @__PURE__ */
|
|
6402
|
+
/* @__PURE__ */ jsxs26("div", { className: "flex gap-2 flex-shrink-0", children: [
|
|
6403
|
+
/* @__PURE__ */ jsx32(
|
|
6152
6404
|
"button",
|
|
6153
6405
|
{
|
|
6154
6406
|
onClick: approvePlan,
|
|
@@ -6156,7 +6408,7 @@ ${planToExecute}`;
|
|
|
6156
6408
|
children: "Approve"
|
|
6157
6409
|
}
|
|
6158
6410
|
),
|
|
6159
|
-
/* @__PURE__ */
|
|
6411
|
+
/* @__PURE__ */ jsx32(
|
|
6160
6412
|
"button",
|
|
6161
6413
|
{
|
|
6162
6414
|
onClick: rejectPlan,
|
|
@@ -6166,15 +6418,15 @@ ${planToExecute}`;
|
|
|
6166
6418
|
)
|
|
6167
6419
|
] })
|
|
6168
6420
|
] }),
|
|
6169
|
-
state === "error" && /* @__PURE__ */
|
|
6170
|
-
/* @__PURE__ */
|
|
6171
|
-
/* @__PURE__ */
|
|
6172
|
-
/* @__PURE__ */
|
|
6173
|
-
/* @__PURE__ */
|
|
6174
|
-
/* @__PURE__ */
|
|
6421
|
+
state === "error" && /* @__PURE__ */ jsxs26("div", { className: "flex-1 flex flex-col", children: [
|
|
6422
|
+
/* @__PURE__ */ jsx32("div", { className: "mb-4 p-3 bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg", children: /* @__PURE__ */ jsxs26("div", { className: "flex items-start gap-2", children: [
|
|
6423
|
+
/* @__PURE__ */ jsx32("svg", { className: "w-5 h-5 text-red-600 mt-0.5 flex-shrink-0", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsx32("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" }) }),
|
|
6424
|
+
/* @__PURE__ */ jsxs26("div", { children: [
|
|
6425
|
+
/* @__PURE__ */ jsx32("h3", { className: "text-sm font-semibold text-red-800 dark:text-red-400", children: "Error" }),
|
|
6426
|
+
/* @__PURE__ */ jsx32("p", { className: "text-red-700 dark:text-red-300 text-sm mt-1", children: error?.message })
|
|
6175
6427
|
] })
|
|
6176
6428
|
] }) }),
|
|
6177
|
-
allowInput && /* @__PURE__ */
|
|
6429
|
+
allowInput && /* @__PURE__ */ jsx32(
|
|
6178
6430
|
"textarea",
|
|
6179
6431
|
{
|
|
6180
6432
|
value: command,
|
|
@@ -6191,16 +6443,16 @@ ${planToExecute}`;
|
|
|
6191
6443
|
}
|
|
6192
6444
|
)
|
|
6193
6445
|
] }),
|
|
6194
|
-
state === "success" && result && !isCompact && /* @__PURE__ */
|
|
6195
|
-
/* @__PURE__ */
|
|
6196
|
-
/* @__PURE__ */
|
|
6197
|
-
/* @__PURE__ */
|
|
6198
|
-
/* @__PURE__ */
|
|
6199
|
-
/* @__PURE__ */
|
|
6446
|
+
state === "success" && result && !isCompact && /* @__PURE__ */ jsx32("div", { className: "flex-1 overflow-auto", children: resultRenderer ? resultRenderer(result.data) : /* @__PURE__ */ jsxs26("div", { className: "space-y-4", children: [
|
|
6447
|
+
/* @__PURE__ */ jsxs26("div", { className: "flex items-start gap-3 p-3 bg-green-50 dark:bg-green-900/20 border border-green-200 dark:border-green-800 rounded-lg", children: [
|
|
6448
|
+
/* @__PURE__ */ jsx32("svg", { className: "w-5 h-5 text-green-600 mt-0.5 flex-shrink-0", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsx32("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z" }) }),
|
|
6449
|
+
/* @__PURE__ */ jsxs26("div", { className: "flex-1", children: [
|
|
6450
|
+
/* @__PURE__ */ jsx32("h3", { className: "text-sm font-semibold text-green-800 dark:text-green-400 mb-1", children: "Success" }),
|
|
6451
|
+
/* @__PURE__ */ jsx32("p", { className: "text-green-700 dark:text-green-300 text-sm", children: "Command executed successfully" })
|
|
6200
6452
|
] })
|
|
6201
6453
|
] }),
|
|
6202
|
-
result.data?.summary && /* @__PURE__ */
|
|
6203
|
-
result.widgets && result.widgets.length > 0 && /* @__PURE__ */
|
|
6454
|
+
result.data?.summary && /* @__PURE__ */ jsx32("div", { className: "text-neutral-700 dark:text-neutral-300 text-sm leading-relaxed whitespace-pre-line", children: result.data.summary }),
|
|
6455
|
+
result.widgets && result.widgets.length > 0 && /* @__PURE__ */ jsx32("div", { className: "space-y-3", children: result.widgets.map((widget) => /* @__PURE__ */ jsx32(
|
|
6204
6456
|
WidgetRenderer,
|
|
6205
6457
|
{
|
|
6206
6458
|
widget,
|
|
@@ -6209,8 +6461,8 @@ ${planToExecute}`;
|
|
|
6209
6461
|
widget.id
|
|
6210
6462
|
)) })
|
|
6211
6463
|
] }) }),
|
|
6212
|
-
state === "success" && result && isCompact && /* @__PURE__ */
|
|
6213
|
-
/* @__PURE__ */
|
|
6464
|
+
state === "success" && result && isCompact && /* @__PURE__ */ jsxs26(Fragment8, { children: [
|
|
6465
|
+
/* @__PURE__ */ jsxs26(
|
|
6214
6466
|
"div",
|
|
6215
6467
|
{
|
|
6216
6468
|
className: "flex-1 flex items-center gap-2 py-1 cursor-text min-w-0",
|
|
@@ -6219,12 +6471,12 @@ ${planToExecute}`;
|
|
|
6219
6471
|
setResult(null);
|
|
6220
6472
|
},
|
|
6221
6473
|
children: [
|
|
6222
|
-
/* @__PURE__ */
|
|
6223
|
-
/* @__PURE__ */
|
|
6474
|
+
/* @__PURE__ */ jsx32("svg", { className: "w-4 h-4 text-green-600 flex-shrink-0", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsx32("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z" }) }),
|
|
6475
|
+
/* @__PURE__ */ jsx32("div", { className: "text-green-700 dark:text-green-300 text-sm truncate flex-1 min-w-0", children: resultRenderer ? resultRenderer(result.data) : result.message || "Command executed successfully" })
|
|
6224
6476
|
]
|
|
6225
6477
|
}
|
|
6226
6478
|
),
|
|
6227
|
-
/* @__PURE__ */
|
|
6479
|
+
/* @__PURE__ */ jsx32(
|
|
6228
6480
|
"button",
|
|
6229
6481
|
{
|
|
6230
6482
|
onClick: () => {
|
|
@@ -6240,24 +6492,24 @@ ${planToExecute}`;
|
|
|
6240
6492
|
"!text-lg"
|
|
6241
6493
|
),
|
|
6242
6494
|
title: "New command",
|
|
6243
|
-
children: /* @__PURE__ */
|
|
6495
|
+
children: /* @__PURE__ */ jsx32("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx32("path", { d: "M8 3L8 13M8 3L4 7M8 3L12 7", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })
|
|
6244
6496
|
}
|
|
6245
6497
|
)
|
|
6246
6498
|
] })
|
|
6247
6499
|
] }),
|
|
6248
|
-
!isCompact && /* @__PURE__ */
|
|
6249
|
-
/* @__PURE__ */
|
|
6250
|
-
enableFileUpload && /* @__PURE__ */
|
|
6500
|
+
!isCompact && /* @__PURE__ */ jsxs26("div", { className: "p-3 flex items-center justify-between gap-2", children: [
|
|
6501
|
+
/* @__PURE__ */ jsx32("div", { className: "flex items-center gap-1", children: state === "idle" && allowInput && /* @__PURE__ */ jsxs26(Fragment8, { children: [
|
|
6502
|
+
enableFileUpload && /* @__PURE__ */ jsx32(
|
|
6251
6503
|
"button",
|
|
6252
6504
|
{
|
|
6253
6505
|
onClick: () => fileInputRef.current?.click(),
|
|
6254
6506
|
className: "w-8 h-8 rounded-lg flex items-center justify-center transition-all flex-shrink-0 !text-neutral-500 dark:!text-neutral-500 hover:bg-neutral-100 dark:hover:bg-neutral-800",
|
|
6255
6507
|
title: "Attach file",
|
|
6256
|
-
children: /* @__PURE__ */
|
|
6508
|
+
children: /* @__PURE__ */ jsx32("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx32("path", { d: "M8.4 2.8L4.4 6.8C3.736 7.464 3.736 8.536 4.4 9.2C5.064 9.864 6.136 9.864 6.8 9.2L11.6 4.4C12.704 3.296 12.704 1.504 11.6 0.4C10.496 -0.704 8.704 -0.704 7.6 0.4L2.8 5.2C1.256 6.744 1.256 9.256 2.8 10.8C4.344 12.344 6.856 12.344 8.4 10.8L12.4 6.8", stroke: "currentColor", strokeWidth: "1.2", strokeLinecap: "round", strokeLinejoin: "round", transform: "translate(1.6, 2.4)" }) })
|
|
6257
6509
|
}
|
|
6258
6510
|
),
|
|
6259
|
-
planMode && /* @__PURE__ */
|
|
6260
|
-
/* @__PURE__ */
|
|
6511
|
+
planMode && /* @__PURE__ */ jsxs26("div", { className: "relative settings-menu-container", children: [
|
|
6512
|
+
/* @__PURE__ */ jsx32(
|
|
6261
6513
|
"button",
|
|
6262
6514
|
{
|
|
6263
6515
|
onClick: () => setShowSettingsMenu(!showSettingsMenu),
|
|
@@ -6266,28 +6518,28 @@ ${planToExecute}`;
|
|
|
6266
6518
|
internalPlanMode ? "!text-blue-600 dark:!text-blue-400" : "!text-neutral-500 dark:!text-neutral-500"
|
|
6267
6519
|
),
|
|
6268
6520
|
title: "Settings",
|
|
6269
|
-
children: /* @__PURE__ */
|
|
6270
|
-
/* @__PURE__ */
|
|
6271
|
-
/* @__PURE__ */
|
|
6272
|
-
/* @__PURE__ */
|
|
6273
|
-
/* @__PURE__ */
|
|
6274
|
-
/* @__PURE__ */
|
|
6275
|
-
/* @__PURE__ */
|
|
6276
|
-
/* @__PURE__ */
|
|
6277
|
-
/* @__PURE__ */
|
|
6278
|
-
/* @__PURE__ */
|
|
6521
|
+
children: /* @__PURE__ */ jsxs26("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
6522
|
+
/* @__PURE__ */ jsx32("line", { x1: "4", y1: "21", x2: "4", y2: "14" }),
|
|
6523
|
+
/* @__PURE__ */ jsx32("line", { x1: "4", y1: "10", x2: "4", y2: "3" }),
|
|
6524
|
+
/* @__PURE__ */ jsx32("line", { x1: "12", y1: "21", x2: "12", y2: "12" }),
|
|
6525
|
+
/* @__PURE__ */ jsx32("line", { x1: "12", y1: "8", x2: "12", y2: "3" }),
|
|
6526
|
+
/* @__PURE__ */ jsx32("line", { x1: "20", y1: "21", x2: "20", y2: "16" }),
|
|
6527
|
+
/* @__PURE__ */ jsx32("line", { x1: "20", y1: "12", x2: "20", y2: "3" }),
|
|
6528
|
+
/* @__PURE__ */ jsx32("line", { x1: "1", y1: "14", x2: "7", y2: "14" }),
|
|
6529
|
+
/* @__PURE__ */ jsx32("line", { x1: "9", y1: "8", x2: "15", y2: "8" }),
|
|
6530
|
+
/* @__PURE__ */ jsx32("line", { x1: "17", y1: "16", x2: "23", y2: "16" })
|
|
6279
6531
|
] })
|
|
6280
6532
|
}
|
|
6281
6533
|
),
|
|
6282
|
-
showSettingsMenu && /* @__PURE__ */
|
|
6283
|
-
/* @__PURE__ */
|
|
6284
|
-
/* @__PURE__ */
|
|
6285
|
-
/* @__PURE__ */
|
|
6286
|
-
/* @__PURE__ */
|
|
6287
|
-
/* @__PURE__ */
|
|
6534
|
+
showSettingsMenu && /* @__PURE__ */ jsx32("div", { className: "absolute top-10 left-0 z-50 w-64 bg-white dark:bg-neutral-800 border border-neutral-200 dark:border-neutral-700 rounded-lg shadow-lg p-3 settings-menu-container", children: /* @__PURE__ */ jsxs26("label", { className: "flex items-center justify-between cursor-pointer group", children: [
|
|
6535
|
+
/* @__PURE__ */ jsxs26("div", { className: "flex items-center gap-2", children: [
|
|
6536
|
+
/* @__PURE__ */ jsx32("svg", { className: "w-4 h-4 text-neutral-500 dark:text-neutral-400", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsx32("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-3 7h3m-3 4h3m-6-4h.01M9 16h.01" }) }),
|
|
6537
|
+
/* @__PURE__ */ jsxs26("div", { children: [
|
|
6538
|
+
/* @__PURE__ */ jsx32("div", { className: "text-sm font-medium text-neutral-700 dark:text-neutral-300", children: "Plan Mode" }),
|
|
6539
|
+
/* @__PURE__ */ jsx32("div", { className: "text-xs text-neutral-500 dark:text-neutral-400", children: "Review before executing" })
|
|
6288
6540
|
] })
|
|
6289
6541
|
] }),
|
|
6290
|
-
/* @__PURE__ */
|
|
6542
|
+
/* @__PURE__ */ jsx32(
|
|
6291
6543
|
"button",
|
|
6292
6544
|
{
|
|
6293
6545
|
onClick: (e) => {
|
|
@@ -6299,7 +6551,7 @@ ${planToExecute}`;
|
|
|
6299
6551
|
internalPlanMode ? "bg-blue-600" : "bg-neutral-300 dark:bg-neutral-600"
|
|
6300
6552
|
),
|
|
6301
6553
|
type: "button",
|
|
6302
|
-
children: /* @__PURE__ */
|
|
6554
|
+
children: /* @__PURE__ */ jsx32(
|
|
6303
6555
|
"span",
|
|
6304
6556
|
{
|
|
6305
6557
|
className: cn(
|
|
@@ -6313,9 +6565,9 @@ ${planToExecute}`;
|
|
|
6313
6565
|
] }) })
|
|
6314
6566
|
] })
|
|
6315
6567
|
] }) }),
|
|
6316
|
-
!(state === "idle" && allowInput) && /* @__PURE__ */
|
|
6317
|
-
/* @__PURE__ */
|
|
6318
|
-
(state === "success" || state === "error") && allowInput && /* @__PURE__ */
|
|
6568
|
+
!(state === "idle" && allowInput) && /* @__PURE__ */ jsx32("div", {}),
|
|
6569
|
+
/* @__PURE__ */ jsxs26("div", { className: "flex items-center gap-2", children: [
|
|
6570
|
+
(state === "success" || state === "error") && allowInput && /* @__PURE__ */ jsx32(
|
|
6319
6571
|
"button",
|
|
6320
6572
|
{
|
|
6321
6573
|
onClick: resetCommand,
|
|
@@ -6323,7 +6575,7 @@ ${planToExecute}`;
|
|
|
6323
6575
|
children: "Reset"
|
|
6324
6576
|
}
|
|
6325
6577
|
),
|
|
6326
|
-
(state === "idle" || state === "error") && /* @__PURE__ */
|
|
6578
|
+
(state === "idle" || state === "error") && /* @__PURE__ */ jsx32(
|
|
6327
6579
|
"button",
|
|
6328
6580
|
{
|
|
6329
6581
|
onClick: () => executeCommand(),
|
|
@@ -6339,29 +6591,29 @@ ${planToExecute}`;
|
|
|
6339
6591
|
!command.trim() && "border-neutral-200 dark:border-neutral-700 !text-neutral-400 dark:!text-neutral-600"
|
|
6340
6592
|
),
|
|
6341
6593
|
title: state === "error" ? "Retry" : "Execute",
|
|
6342
|
-
children: state === "error" ? /* @__PURE__ */
|
|
6594
|
+
children: state === "error" ? /* @__PURE__ */ jsx32("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx32("path", { d: "M13 8C13 10.7614 10.7614 13 8 13C5.23858 13 3 10.7614 3 8C3 5.23858 5.23858 3 8 3C9.65685 3 11.1257 3.82818 12 5.09091M12 3V5.09091M12 5.09091H9.81818", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }) : /* @__PURE__ */ jsx32("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx32("path", { d: "M8 3L8 13M8 3L4 7M8 3L12 7", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })
|
|
6343
6595
|
}
|
|
6344
6596
|
)
|
|
6345
6597
|
] })
|
|
6346
6598
|
] }),
|
|
6347
|
-
showPlanDetails && isCompact && state === "plan-pending" && /* @__PURE__ */
|
|
6348
|
-
/* @__PURE__ */
|
|
6349
|
-
/* @__PURE__ */
|
|
6350
|
-
/* @__PURE__ */
|
|
6351
|
-
/* @__PURE__ */
|
|
6599
|
+
showPlanDetails && isCompact && state === "plan-pending" && /* @__PURE__ */ jsx32("div", { className: "fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4", onClick: () => setShowPlanDetails(false), children: /* @__PURE__ */ jsxs26("div", { className: "bg-white dark:bg-neutral-900 rounded-2xl shadow-2xl max-w-2xl w-full max-h-[80vh] overflow-hidden", onClick: (e) => e.stopPropagation(), children: [
|
|
6600
|
+
/* @__PURE__ */ jsxs26("div", { className: "flex items-center justify-between p-6 border-b border-neutral-200 dark:border-neutral-700", children: [
|
|
6601
|
+
/* @__PURE__ */ jsxs26("div", { className: "flex items-center gap-3", children: [
|
|
6602
|
+
/* @__PURE__ */ jsx32("svg", { className: "w-6 h-6 text-blue-600 dark:text-blue-400", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsx32("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-3 7h3m-3 4h3m-6-4h.01M9 16h.01" }) }),
|
|
6603
|
+
/* @__PURE__ */ jsx32("h2", { className: "text-xl font-semibold text-neutral-900 dark:text-white", children: "Proposed Execution Plan" })
|
|
6352
6604
|
] }),
|
|
6353
|
-
/* @__PURE__ */
|
|
6605
|
+
/* @__PURE__ */ jsx32(
|
|
6354
6606
|
"button",
|
|
6355
6607
|
{
|
|
6356
6608
|
onClick: () => setShowPlanDetails(false),
|
|
6357
6609
|
className: "text-neutral-400 hover:text-neutral-600 dark:hover:text-neutral-300 transition-colors",
|
|
6358
|
-
children: /* @__PURE__ */
|
|
6610
|
+
children: /* @__PURE__ */ jsx32("svg", { className: "w-6 h-6", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsx32("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) })
|
|
6359
6611
|
}
|
|
6360
6612
|
)
|
|
6361
6613
|
] }),
|
|
6362
|
-
/* @__PURE__ */
|
|
6363
|
-
/* @__PURE__ */
|
|
6364
|
-
/* @__PURE__ */
|
|
6614
|
+
/* @__PURE__ */ jsx32("div", { className: "p-6 overflow-y-auto max-h-[calc(80vh-180px)]", children: /* @__PURE__ */ jsx32("div", { className: "prose prose-sm dark:prose-invert max-w-none", children: /* @__PURE__ */ jsx32("div", { className: "text-neutral-700 dark:text-neutral-300 whitespace-pre-line leading-relaxed", children: plan }) }) }),
|
|
6615
|
+
/* @__PURE__ */ jsxs26("div", { className: "flex items-center justify-end gap-3 p-6 border-t border-neutral-200 dark:border-neutral-700 bg-neutral-50 dark:bg-neutral-800/50", children: [
|
|
6616
|
+
/* @__PURE__ */ jsx32(
|
|
6365
6617
|
"button",
|
|
6366
6618
|
{
|
|
6367
6619
|
onClick: rejectPlan,
|
|
@@ -6369,7 +6621,7 @@ ${planToExecute}`;
|
|
|
6369
6621
|
children: "Modify Command"
|
|
6370
6622
|
}
|
|
6371
6623
|
),
|
|
6372
|
-
/* @__PURE__ */
|
|
6624
|
+
/* @__PURE__ */ jsx32(
|
|
6373
6625
|
"button",
|
|
6374
6626
|
{
|
|
6375
6627
|
onClick: approvePlan,
|
|
@@ -6379,7 +6631,7 @@ ${planToExecute}`;
|
|
|
6379
6631
|
)
|
|
6380
6632
|
] })
|
|
6381
6633
|
] }) }),
|
|
6382
|
-
/* @__PURE__ */
|
|
6634
|
+
/* @__PURE__ */ jsx32(
|
|
6383
6635
|
"input",
|
|
6384
6636
|
{
|
|
6385
6637
|
ref: fileInputRef,
|
|
@@ -6390,7 +6642,7 @@ ${planToExecute}`;
|
|
|
6390
6642
|
accept: "image/*,application/pdf,.doc,.docx,.txt"
|
|
6391
6643
|
}
|
|
6392
6644
|
),
|
|
6393
|
-
/* @__PURE__ */
|
|
6645
|
+
/* @__PURE__ */ jsx32("style", { dangerouslySetInnerHTML: {
|
|
6394
6646
|
__html: `
|
|
6395
6647
|
@keyframes pulse-border {
|
|
6396
6648
|
0%, 100% {
|
|
@@ -6411,8 +6663,8 @@ ${planToExecute}`;
|
|
|
6411
6663
|
}
|
|
6412
6664
|
|
|
6413
6665
|
// src/components/Prompt/Prompt.tsx
|
|
6414
|
-
import { useState as
|
|
6415
|
-
import { jsx as
|
|
6666
|
+
import { useState as useState14 } from "react";
|
|
6667
|
+
import { jsx as jsx33, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
6416
6668
|
function Prompt({
|
|
6417
6669
|
agentId,
|
|
6418
6670
|
placeholder = "Enter your prompt...",
|
|
@@ -6429,9 +6681,9 @@ function Prompt({
|
|
|
6429
6681
|
showSuggestions = false,
|
|
6430
6682
|
className
|
|
6431
6683
|
}) {
|
|
6432
|
-
const [value, setValue] =
|
|
6433
|
-
const [isLoading, setIsLoading] =
|
|
6434
|
-
const [suggestions] =
|
|
6684
|
+
const [value, setValue] = useState14(initialValue);
|
|
6685
|
+
const [isLoading, setIsLoading] = useState14(false);
|
|
6686
|
+
const [suggestions] = useState14(["Plan a trip", "Write a description", "Analyze data"]);
|
|
6435
6687
|
const handleChange = (e) => {
|
|
6436
6688
|
const newValue = e.target.value;
|
|
6437
6689
|
if (!maxLength || newValue.length <= maxLength) {
|
|
@@ -6474,9 +6726,9 @@ function Prompt({
|
|
|
6474
6726
|
handleSubmit();
|
|
6475
6727
|
}
|
|
6476
6728
|
};
|
|
6477
|
-
return /* @__PURE__ */
|
|
6478
|
-
/* @__PURE__ */
|
|
6479
|
-
/* @__PURE__ */
|
|
6729
|
+
return /* @__PURE__ */ jsxs27("div", { className: cn("space-y-2", className), children: [
|
|
6730
|
+
/* @__PURE__ */ jsxs27("div", { className: "flex gap-2", children: [
|
|
6731
|
+
/* @__PURE__ */ jsx33(
|
|
6480
6732
|
"input",
|
|
6481
6733
|
{
|
|
6482
6734
|
type: "text",
|
|
@@ -6489,7 +6741,7 @@ function Prompt({
|
|
|
6489
6741
|
className: "flex-1 px-4 py-2 border border-neutral-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-apteva-500 dark:bg-neutral-800 dark:border-neutral-600 dark:text-white"
|
|
6490
6742
|
}
|
|
6491
6743
|
),
|
|
6492
|
-
submitOn === "button" && /* @__PURE__ */
|
|
6744
|
+
submitOn === "button" && /* @__PURE__ */ jsx33(
|
|
6493
6745
|
"button",
|
|
6494
6746
|
{
|
|
6495
6747
|
onClick: handleSubmit,
|
|
@@ -6499,13 +6751,13 @@ function Prompt({
|
|
|
6499
6751
|
}
|
|
6500
6752
|
)
|
|
6501
6753
|
] }),
|
|
6502
|
-
maxLength && /* @__PURE__ */
|
|
6754
|
+
maxLength && /* @__PURE__ */ jsxs27("p", { className: "text-xs text-neutral-500", children: [
|
|
6503
6755
|
value.length,
|
|
6504
6756
|
" / ",
|
|
6505
6757
|
maxLength,
|
|
6506
6758
|
" characters"
|
|
6507
6759
|
] }),
|
|
6508
|
-
showSuggestions && !value && /* @__PURE__ */
|
|
6760
|
+
showSuggestions && !value && /* @__PURE__ */ jsx33("div", { className: "flex flex-wrap gap-2", children: suggestions.map((suggestion, idx) => /* @__PURE__ */ jsx33(
|
|
6509
6761
|
"button",
|
|
6510
6762
|
{
|
|
6511
6763
|
onClick: () => setValue(suggestion),
|
|
@@ -6514,16 +6766,16 @@ function Prompt({
|
|
|
6514
6766
|
},
|
|
6515
6767
|
idx
|
|
6516
6768
|
)) }),
|
|
6517
|
-
isLoading && /* @__PURE__ */
|
|
6518
|
-
/* @__PURE__ */
|
|
6519
|
-
/* @__PURE__ */
|
|
6769
|
+
isLoading && /* @__PURE__ */ jsxs27("div", { className: "flex items-center gap-2 text-sm text-neutral-500", children: [
|
|
6770
|
+
/* @__PURE__ */ jsx33("div", { className: "w-4 h-4 border-2 border-apteva-500 border-t-transparent rounded-full animate-spin" }),
|
|
6771
|
+
/* @__PURE__ */ jsx33("span", { children: "AI is processing your request..." })
|
|
6520
6772
|
] })
|
|
6521
6773
|
] });
|
|
6522
6774
|
}
|
|
6523
6775
|
|
|
6524
6776
|
// src/components/Stream/Stream.tsx
|
|
6525
|
-
import { useState as
|
|
6526
|
-
import { jsx as
|
|
6777
|
+
import { useState as useState15, useEffect as useEffect14 } from "react";
|
|
6778
|
+
import { jsx as jsx34, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
6527
6779
|
function Stream({
|
|
6528
6780
|
agentId,
|
|
6529
6781
|
prompt,
|
|
@@ -6539,10 +6791,10 @@ function Stream({
|
|
|
6539
6791
|
typingSpeed = 30,
|
|
6540
6792
|
className
|
|
6541
6793
|
}) {
|
|
6542
|
-
const [text, setText] =
|
|
6543
|
-
const [isStreaming, setIsStreaming] =
|
|
6544
|
-
const [isComplete, setIsComplete] =
|
|
6545
|
-
|
|
6794
|
+
const [text, setText] = useState15("");
|
|
6795
|
+
const [isStreaming, setIsStreaming] = useState15(false);
|
|
6796
|
+
const [isComplete, setIsComplete] = useState15(false);
|
|
6797
|
+
useEffect14(() => {
|
|
6546
6798
|
if (autoStart && !isStreaming && !isComplete) {
|
|
6547
6799
|
startStreaming();
|
|
6548
6800
|
}
|
|
@@ -6603,7 +6855,7 @@ function Stream({
|
|
|
6603
6855
|
plain: "text-neutral-900 dark:text-neutral-100"
|
|
6604
6856
|
};
|
|
6605
6857
|
if (!isStreaming && !isComplete) {
|
|
6606
|
-
return /* @__PURE__ */
|
|
6858
|
+
return /* @__PURE__ */ jsx34("div", { className: cn("p-4", className), children: /* @__PURE__ */ jsx34(
|
|
6607
6859
|
"button",
|
|
6608
6860
|
{
|
|
6609
6861
|
onClick: startStreaming,
|
|
@@ -6612,19 +6864,19 @@ function Stream({
|
|
|
6612
6864
|
}
|
|
6613
6865
|
) });
|
|
6614
6866
|
}
|
|
6615
|
-
return /* @__PURE__ */
|
|
6867
|
+
return /* @__PURE__ */ jsxs28("div", { className: cn(variantClasses[variant], className), children: [
|
|
6616
6868
|
text,
|
|
6617
|
-
isStreaming && showCursor && /* @__PURE__ */
|
|
6869
|
+
isStreaming && showCursor && /* @__PURE__ */ jsx34("span", { className: "apteva-stream-cursor" })
|
|
6618
6870
|
] });
|
|
6619
6871
|
}
|
|
6620
6872
|
|
|
6621
6873
|
// src/components/Threads/ThreadList.tsx
|
|
6622
|
-
import { useState as
|
|
6874
|
+
import { useState as useState16 } from "react";
|
|
6623
6875
|
|
|
6624
6876
|
// src/components/Threads/ThreadItem.tsx
|
|
6625
|
-
import { jsx as
|
|
6877
|
+
import { jsx as jsx35, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
6626
6878
|
function ThreadItem({ thread, isActive = false, onSelect, onDelete }) {
|
|
6627
|
-
return /* @__PURE__ */
|
|
6879
|
+
return /* @__PURE__ */ jsxs29(
|
|
6628
6880
|
"div",
|
|
6629
6881
|
{
|
|
6630
6882
|
className: cn("apteva-thread-item", {
|
|
@@ -6632,19 +6884,19 @@ function ThreadItem({ thread, isActive = false, onSelect, onDelete }) {
|
|
|
6632
6884
|
}),
|
|
6633
6885
|
onClick: onSelect,
|
|
6634
6886
|
children: [
|
|
6635
|
-
/* @__PURE__ */
|
|
6636
|
-
/* @__PURE__ */
|
|
6637
|
-
thread.preview && /* @__PURE__ */
|
|
6638
|
-
/* @__PURE__ */
|
|
6639
|
-
/* @__PURE__ */
|
|
6887
|
+
/* @__PURE__ */ jsxs29("div", { className: "flex-1 min-w-0", children: [
|
|
6888
|
+
/* @__PURE__ */ jsx35("h4", { className: "font-semibold text-neutral-900 dark:text-white truncate", children: thread.title }),
|
|
6889
|
+
thread.preview && /* @__PURE__ */ jsx35("p", { className: "text-sm text-neutral-600 dark:text-neutral-400 truncate", children: thread.preview }),
|
|
6890
|
+
/* @__PURE__ */ jsxs29("div", { className: "flex items-center gap-2 mt-1 text-xs text-neutral-500", children: [
|
|
6891
|
+
/* @__PURE__ */ jsxs29("span", { children: [
|
|
6640
6892
|
thread.messageCount,
|
|
6641
6893
|
" messages"
|
|
6642
6894
|
] }),
|
|
6643
|
-
/* @__PURE__ */
|
|
6644
|
-
/* @__PURE__ */
|
|
6895
|
+
/* @__PURE__ */ jsx35("span", { children: "\u2022" }),
|
|
6896
|
+
/* @__PURE__ */ jsx35("span", { children: formatRelativeTime(thread.updatedAt) })
|
|
6645
6897
|
] })
|
|
6646
6898
|
] }),
|
|
6647
|
-
onDelete && /* @__PURE__ */
|
|
6899
|
+
onDelete && /* @__PURE__ */ jsx35(
|
|
6648
6900
|
"button",
|
|
6649
6901
|
{
|
|
6650
6902
|
onClick: (e) => {
|
|
@@ -6674,7 +6926,7 @@ function formatRelativeTime(date) {
|
|
|
6674
6926
|
}
|
|
6675
6927
|
|
|
6676
6928
|
// src/components/Threads/ThreadList.tsx
|
|
6677
|
-
import { jsx as
|
|
6929
|
+
import { jsx as jsx36, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
6678
6930
|
function ThreadList({
|
|
6679
6931
|
threads,
|
|
6680
6932
|
currentThreadId,
|
|
@@ -6683,13 +6935,13 @@ function ThreadList({
|
|
|
6683
6935
|
showSearch = false,
|
|
6684
6936
|
groupBy = "none"
|
|
6685
6937
|
}) {
|
|
6686
|
-
const [searchQuery, setSearchQuery] =
|
|
6938
|
+
const [searchQuery, setSearchQuery] = useState16("");
|
|
6687
6939
|
const filteredThreads = threads.filter(
|
|
6688
6940
|
(thread) => thread.title.toLowerCase().includes(searchQuery.toLowerCase()) || thread.preview?.toLowerCase().includes(searchQuery.toLowerCase())
|
|
6689
6941
|
);
|
|
6690
6942
|
const groupedThreads = groupBy === "date" ? groupThreadsByDate(filteredThreads) : { All: filteredThreads };
|
|
6691
|
-
return /* @__PURE__ */
|
|
6692
|
-
showSearch && /* @__PURE__ */
|
|
6943
|
+
return /* @__PURE__ */ jsxs30("div", { className: "flex flex-col h-full", children: [
|
|
6944
|
+
showSearch && /* @__PURE__ */ jsx36("div", { className: "p-3 border-b border-neutral-200 dark:border-neutral-700", children: /* @__PURE__ */ jsx36(
|
|
6693
6945
|
"input",
|
|
6694
6946
|
{
|
|
6695
6947
|
type: "text",
|
|
@@ -6699,10 +6951,10 @@ function ThreadList({
|
|
|
6699
6951
|
className: "w-full px-3 py-2 text-sm border border-neutral-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-apteva-500 dark:bg-neutral-800 dark:border-neutral-600 dark:text-white"
|
|
6700
6952
|
}
|
|
6701
6953
|
) }),
|
|
6702
|
-
/* @__PURE__ */
|
|
6703
|
-
Object.entries(groupedThreads).map(([group, groupThreads]) => /* @__PURE__ */
|
|
6704
|
-
groupBy !== "none" && /* @__PURE__ */
|
|
6705
|
-
groupThreads.map((thread) => /* @__PURE__ */
|
|
6954
|
+
/* @__PURE__ */ jsxs30("div", { className: "flex-1 overflow-y-auto", children: [
|
|
6955
|
+
Object.entries(groupedThreads).map(([group, groupThreads]) => /* @__PURE__ */ jsxs30("div", { children: [
|
|
6956
|
+
groupBy !== "none" && /* @__PURE__ */ jsx36("div", { className: "px-3 py-2 text-xs font-semibold text-neutral-500 uppercase", children: group }),
|
|
6957
|
+
groupThreads.map((thread) => /* @__PURE__ */ jsx36(
|
|
6706
6958
|
ThreadItem,
|
|
6707
6959
|
{
|
|
6708
6960
|
thread,
|
|
@@ -6713,9 +6965,9 @@ function ThreadList({
|
|
|
6713
6965
|
thread.id
|
|
6714
6966
|
))
|
|
6715
6967
|
] }, group)),
|
|
6716
|
-
filteredThreads.length === 0 && /* @__PURE__ */
|
|
6717
|
-
/* @__PURE__ */
|
|
6718
|
-
/* @__PURE__ */
|
|
6968
|
+
filteredThreads.length === 0 && /* @__PURE__ */ jsxs30("div", { className: "p-8 text-center text-neutral-500", children: [
|
|
6969
|
+
/* @__PURE__ */ jsx36("svg", { className: "w-10 h-10 mx-auto mb-2 opacity-50", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx36("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.5, d: "M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z" }) }),
|
|
6970
|
+
/* @__PURE__ */ jsx36("p", { children: "No conversations found" })
|
|
6719
6971
|
] })
|
|
6720
6972
|
] })
|
|
6721
6973
|
] });
|
|
@@ -6747,7 +6999,7 @@ function groupThreadsByDate(threads) {
|
|
|
6747
6999
|
}
|
|
6748
7000
|
|
|
6749
7001
|
// src/components/Threads/Threads.tsx
|
|
6750
|
-
import { jsx as
|
|
7002
|
+
import { jsx as jsx37, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
6751
7003
|
function Threads({
|
|
6752
7004
|
threads,
|
|
6753
7005
|
currentThreadId,
|
|
@@ -6766,8 +7018,8 @@ function Threads({
|
|
|
6766
7018
|
tabs: "flex gap-2 border-b border-neutral-200 dark:border-neutral-700 overflow-x-auto"
|
|
6767
7019
|
};
|
|
6768
7020
|
if (variant === "tabs") {
|
|
6769
|
-
return /* @__PURE__ */
|
|
6770
|
-
threads.slice(0, 5).map((thread) => /* @__PURE__ */
|
|
7021
|
+
return /* @__PURE__ */ jsxs31("div", { className: cn(variantClasses[variant], className), children: [
|
|
7022
|
+
threads.slice(0, 5).map((thread) => /* @__PURE__ */ jsx37(
|
|
6771
7023
|
"button",
|
|
6772
7024
|
{
|
|
6773
7025
|
onClick: () => onThreadSelect?.(thread.id),
|
|
@@ -6779,7 +7031,7 @@ function Threads({
|
|
|
6779
7031
|
},
|
|
6780
7032
|
thread.id
|
|
6781
7033
|
)),
|
|
6782
|
-
showNewButton && onNewThread && /* @__PURE__ */
|
|
7034
|
+
showNewButton && onNewThread && /* @__PURE__ */ jsx37(
|
|
6783
7035
|
"button",
|
|
6784
7036
|
{
|
|
6785
7037
|
onClick: onNewThread,
|
|
@@ -6789,8 +7041,8 @@ function Threads({
|
|
|
6789
7041
|
)
|
|
6790
7042
|
] });
|
|
6791
7043
|
}
|
|
6792
|
-
return /* @__PURE__ */
|
|
6793
|
-
showNewButton && onNewThread && /* @__PURE__ */
|
|
7044
|
+
return /* @__PURE__ */ jsxs31("div", { className: cn(variantClasses[variant], "flex flex-col", className), children: [
|
|
7045
|
+
showNewButton && onNewThread && /* @__PURE__ */ jsx37("div", { className: "p-3 border-b border-neutral-200 dark:border-neutral-700", children: /* @__PURE__ */ jsx37(
|
|
6794
7046
|
"button",
|
|
6795
7047
|
{
|
|
6796
7048
|
onClick: onNewThread,
|
|
@@ -6798,7 +7050,7 @@ function Threads({
|
|
|
6798
7050
|
children: "+ New Conversation"
|
|
6799
7051
|
}
|
|
6800
7052
|
) }),
|
|
6801
|
-
/* @__PURE__ */
|
|
7053
|
+
/* @__PURE__ */ jsx37(
|
|
6802
7054
|
ThreadList,
|
|
6803
7055
|
{
|
|
6804
7056
|
threads,
|
|
@@ -6813,11 +7065,11 @@ function Threads({
|
|
|
6813
7065
|
}
|
|
6814
7066
|
|
|
6815
7067
|
// src/components/AutoInterface/AutoInterface.tsx
|
|
6816
|
-
import { useState as
|
|
7068
|
+
import { useState as useState18, useRef as useRef13, useCallback as useCallback7, useEffect as useEffect15 } from "react";
|
|
6817
7069
|
|
|
6818
7070
|
// src/components/AutoInterface/LayoutRenderer.tsx
|
|
6819
|
-
import { useState as
|
|
6820
|
-
import { Fragment as
|
|
7071
|
+
import { useState as useState17 } from "react";
|
|
7072
|
+
import { Fragment as Fragment9, jsx as jsx38, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
6821
7073
|
var gapClasses = {
|
|
6822
7074
|
none: "gap-0",
|
|
6823
7075
|
sm: "gap-2",
|
|
@@ -6841,27 +7093,27 @@ function LayoutRenderer({ node, onAction, renderNode }) {
|
|
|
6841
7093
|
const children = node.children || [];
|
|
6842
7094
|
switch (node.layout) {
|
|
6843
7095
|
case "page":
|
|
6844
|
-
return /* @__PURE__ */
|
|
7096
|
+
return /* @__PURE__ */ jsx38(PageLayout, { node, renderNode });
|
|
6845
7097
|
case "row":
|
|
6846
|
-
return /* @__PURE__ */
|
|
7098
|
+
return /* @__PURE__ */ jsx38(RowLayout, { node, renderNode });
|
|
6847
7099
|
case "columns":
|
|
6848
|
-
return /* @__PURE__ */
|
|
7100
|
+
return /* @__PURE__ */ jsx38(ColumnsLayout, { node, renderNode });
|
|
6849
7101
|
case "stack":
|
|
6850
|
-
return /* @__PURE__ */
|
|
7102
|
+
return /* @__PURE__ */ jsx38(StackLayout, { node, renderNode });
|
|
6851
7103
|
case "sidebar":
|
|
6852
|
-
return /* @__PURE__ */
|
|
7104
|
+
return /* @__PURE__ */ jsx38(SidebarLayout, { node, renderNode });
|
|
6853
7105
|
case "tabs":
|
|
6854
|
-
return /* @__PURE__ */
|
|
7106
|
+
return /* @__PURE__ */ jsx38(TabsLayout, { node, renderNode });
|
|
6855
7107
|
default:
|
|
6856
|
-
return /* @__PURE__ */
|
|
7108
|
+
return /* @__PURE__ */ jsx38("div", { className: "space-y-4", children: children.map((child) => /* @__PURE__ */ jsx38("div", { children: renderNode(child) }, child.id)) });
|
|
6857
7109
|
}
|
|
6858
7110
|
}
|
|
6859
7111
|
function PageLayout({ node, renderNode }) {
|
|
6860
7112
|
const { title, padding = "md", maxWidth = "xl" } = node.props || {};
|
|
6861
7113
|
const children = node.children || [];
|
|
6862
|
-
return /* @__PURE__ */
|
|
6863
|
-
title && /* @__PURE__ */
|
|
6864
|
-
/* @__PURE__ */
|
|
7114
|
+
return /* @__PURE__ */ jsxs32("div", { className: cn("w-full mx-auto", paddingClasses[padding], maxWidthClasses[maxWidth]), children: [
|
|
7115
|
+
title && /* @__PURE__ */ jsx38("h1", { className: "!text-2xl font-bold !text-neutral-900 dark:!text-white mb-6", children: title }),
|
|
7116
|
+
/* @__PURE__ */ jsx38("div", { className: "space-y-6", children: children.map((child) => /* @__PURE__ */ jsx38("div", { children: renderNode(child) }, child.id)) })
|
|
6865
7117
|
] });
|
|
6866
7118
|
}
|
|
6867
7119
|
function RowLayout({ node, renderNode }) {
|
|
@@ -6874,12 +7126,12 @@ function RowLayout({ node, renderNode }) {
|
|
|
6874
7126
|
end: "items-end",
|
|
6875
7127
|
stretch: "items-stretch"
|
|
6876
7128
|
};
|
|
6877
|
-
return /* @__PURE__ */
|
|
7129
|
+
return /* @__PURE__ */ jsx38(
|
|
6878
7130
|
"div",
|
|
6879
7131
|
{
|
|
6880
7132
|
className: cn("grid", gapClasses[gap], alignClasses[align]),
|
|
6881
7133
|
style: { gridTemplateColumns: templateColumns },
|
|
6882
|
-
children: children.map((child) => /* @__PURE__ */
|
|
7134
|
+
children: children.map((child) => /* @__PURE__ */ jsx38("div", { children: renderNode(child) }, child.id))
|
|
6883
7135
|
}
|
|
6884
7136
|
);
|
|
6885
7137
|
}
|
|
@@ -6887,12 +7139,12 @@ function ColumnsLayout({ node, renderNode }) {
|
|
|
6887
7139
|
const { count, gap = "md" } = node.props || {};
|
|
6888
7140
|
const children = node.children || [];
|
|
6889
7141
|
const colCount = count || children.length;
|
|
6890
|
-
return /* @__PURE__ */
|
|
7142
|
+
return /* @__PURE__ */ jsx38(
|
|
6891
7143
|
"div",
|
|
6892
7144
|
{
|
|
6893
7145
|
className: cn("grid", gapClasses[gap]),
|
|
6894
7146
|
style: { gridTemplateColumns: `repeat(${colCount}, 1fr)` },
|
|
6895
|
-
children: children.map((child) => /* @__PURE__ */
|
|
7147
|
+
children: children.map((child) => /* @__PURE__ */ jsx38("div", { children: renderNode(child) }, child.id))
|
|
6896
7148
|
}
|
|
6897
7149
|
);
|
|
6898
7150
|
}
|
|
@@ -6905,14 +7157,14 @@ function StackLayout({ node, renderNode }) {
|
|
|
6905
7157
|
right: "items-end",
|
|
6906
7158
|
stretch: "items-stretch"
|
|
6907
7159
|
};
|
|
6908
|
-
return /* @__PURE__ */
|
|
7160
|
+
return /* @__PURE__ */ jsx38("div", { className: cn("flex flex-col", gapClasses[gap], alignClasses[align]), children: children.map((child) => /* @__PURE__ */ jsx38("div", { children: renderNode(child) }, child.id)) });
|
|
6909
7161
|
}
|
|
6910
7162
|
function SidebarLayout({ node, renderNode }) {
|
|
6911
7163
|
const { side = "left", width = "280px" } = node.props || {};
|
|
6912
7164
|
const children = node.children || [];
|
|
6913
7165
|
const [sidebarChild, ...mainChildren] = side === "left" ? children : [...children].reverse();
|
|
6914
7166
|
if (!sidebarChild) return null;
|
|
6915
|
-
const sidebar = /* @__PURE__ */
|
|
7167
|
+
const sidebar = /* @__PURE__ */ jsx38(
|
|
6916
7168
|
"div",
|
|
6917
7169
|
{
|
|
6918
7170
|
className: "flex-shrink-0 overflow-y-auto border-neutral-200 dark:border-neutral-700",
|
|
@@ -6920,11 +7172,11 @@ function SidebarLayout({ node, renderNode }) {
|
|
|
6920
7172
|
children: renderNode(sidebarChild)
|
|
6921
7173
|
}
|
|
6922
7174
|
);
|
|
6923
|
-
const main = /* @__PURE__ */
|
|
6924
|
-
return /* @__PURE__ */
|
|
7175
|
+
const main = /* @__PURE__ */ jsx38("div", { className: "flex-1 overflow-y-auto min-w-0", children: mainChildren.map((child) => /* @__PURE__ */ jsx38("div", { children: renderNode(child) }, child.id)) });
|
|
7176
|
+
return /* @__PURE__ */ jsx38("div", { className: "flex h-full gap-4", children: side === "left" ? /* @__PURE__ */ jsxs32(Fragment9, { children: [
|
|
6925
7177
|
sidebar,
|
|
6926
7178
|
main
|
|
6927
|
-
] }) : /* @__PURE__ */
|
|
7179
|
+
] }) : /* @__PURE__ */ jsxs32(Fragment9, { children: [
|
|
6928
7180
|
main,
|
|
6929
7181
|
sidebar
|
|
6930
7182
|
] }) });
|
|
@@ -6932,9 +7184,9 @@ function SidebarLayout({ node, renderNode }) {
|
|
|
6932
7184
|
function TabsLayout({ node, renderNode }) {
|
|
6933
7185
|
const { labels = [], defaultTab = 0 } = node.props || {};
|
|
6934
7186
|
const children = node.children || [];
|
|
6935
|
-
const [activeTab, setActiveTab] =
|
|
6936
|
-
return /* @__PURE__ */
|
|
6937
|
-
/* @__PURE__ */
|
|
7187
|
+
const [activeTab, setActiveTab] = useState17(defaultTab);
|
|
7188
|
+
return /* @__PURE__ */ jsxs32("div", { children: [
|
|
7189
|
+
/* @__PURE__ */ jsx38("div", { className: "flex border-b border-neutral-200 dark:border-neutral-700 mb-4", children: labels.map((label, idx) => /* @__PURE__ */ jsx38(
|
|
6938
7190
|
"button",
|
|
6939
7191
|
{
|
|
6940
7192
|
onClick: () => setActiveTab(idx),
|
|
@@ -6951,7 +7203,7 @@ function TabsLayout({ node, renderNode }) {
|
|
|
6951
7203
|
}
|
|
6952
7204
|
|
|
6953
7205
|
// src/components/AutoInterface/InterfaceRenderer.tsx
|
|
6954
|
-
import { Fragment as
|
|
7206
|
+
import { Fragment as Fragment10, jsx as jsx39 } from "react/jsx-runtime";
|
|
6955
7207
|
var STRUCTURAL_KEYS = /* @__PURE__ */ new Set(["type", "id", "layout", "props", "children", "actions", "metadata", "isStreaming"]);
|
|
6956
7208
|
function normalizeNode(n) {
|
|
6957
7209
|
let node = { ...n };
|
|
@@ -6981,7 +7233,7 @@ function InterfaceRenderer({ node, onAction }) {
|
|
|
6981
7233
|
const renderNode = (rawNode) => {
|
|
6982
7234
|
const n = normalizeNode(rawNode);
|
|
6983
7235
|
if (n.type === "layout" && n.layout) {
|
|
6984
|
-
return /* @__PURE__ */
|
|
7236
|
+
return /* @__PURE__ */ jsx39(
|
|
6985
7237
|
LayoutRenderer,
|
|
6986
7238
|
{
|
|
6987
7239
|
node: n,
|
|
@@ -6991,7 +7243,7 @@ function InterfaceRenderer({ node, onAction }) {
|
|
|
6991
7243
|
n.id
|
|
6992
7244
|
);
|
|
6993
7245
|
}
|
|
6994
|
-
return /* @__PURE__ */
|
|
7246
|
+
return /* @__PURE__ */ jsx39(
|
|
6995
7247
|
WidgetRenderer,
|
|
6996
7248
|
{
|
|
6997
7249
|
widget: {
|
|
@@ -7007,33 +7259,33 @@ function InterfaceRenderer({ node, onAction }) {
|
|
|
7007
7259
|
n.id
|
|
7008
7260
|
);
|
|
7009
7261
|
};
|
|
7010
|
-
return /* @__PURE__ */
|
|
7262
|
+
return /* @__PURE__ */ jsx39(Fragment10, { children: renderNode(node) });
|
|
7011
7263
|
}
|
|
7012
7264
|
|
|
7013
7265
|
// src/components/AutoInterface/InterfaceSkeleton.tsx
|
|
7014
|
-
import { jsx as
|
|
7266
|
+
import { jsx as jsx40, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
7015
7267
|
function InterfaceSkeleton({ className }) {
|
|
7016
|
-
return /* @__PURE__ */
|
|
7017
|
-
/* @__PURE__ */
|
|
7018
|
-
/* @__PURE__ */
|
|
7019
|
-
/* @__PURE__ */
|
|
7020
|
-
/* @__PURE__ */
|
|
7268
|
+
return /* @__PURE__ */ jsxs33("div", { className: cn("animate-pulse space-y-6 p-6", className), children: [
|
|
7269
|
+
/* @__PURE__ */ jsx40("div", { className: "h-7 bg-neutral-200 dark:bg-neutral-700 rounded w-1/3" }),
|
|
7270
|
+
/* @__PURE__ */ jsx40("div", { className: "grid grid-cols-4 gap-4", children: [1, 2, 3, 4].map((i) => /* @__PURE__ */ jsxs33("div", { className: "border border-neutral-200 dark:border-neutral-700 rounded-xl p-5 space-y-2", children: [
|
|
7271
|
+
/* @__PURE__ */ jsx40("div", { className: "h-4 bg-neutral-200 dark:bg-neutral-700 rounded w-2/3" }),
|
|
7272
|
+
/* @__PURE__ */ jsx40("div", { className: "h-8 bg-neutral-200 dark:bg-neutral-700 rounded w-1/2" })
|
|
7021
7273
|
] }, i)) }),
|
|
7022
|
-
/* @__PURE__ */
|
|
7023
|
-
/* @__PURE__ */
|
|
7024
|
-
/* @__PURE__ */
|
|
7025
|
-
/* @__PURE__ */
|
|
7274
|
+
/* @__PURE__ */ jsxs33("div", { className: "grid grid-cols-3 gap-4", children: [
|
|
7275
|
+
/* @__PURE__ */ jsxs33("div", { className: "col-span-2 border border-neutral-200 dark:border-neutral-700 rounded-xl p-5 space-y-3", children: [
|
|
7276
|
+
/* @__PURE__ */ jsx40("div", { className: "h-4 bg-neutral-200 dark:bg-neutral-700 rounded w-1/4" }),
|
|
7277
|
+
/* @__PURE__ */ jsx40("div", { className: "h-40 bg-neutral-200 dark:bg-neutral-700 rounded" })
|
|
7026
7278
|
] }),
|
|
7027
|
-
/* @__PURE__ */
|
|
7028
|
-
/* @__PURE__ */
|
|
7029
|
-
[1, 2, 3].map((i) => /* @__PURE__ */
|
|
7279
|
+
/* @__PURE__ */ jsxs33("div", { className: "border border-neutral-200 dark:border-neutral-700 rounded-xl p-5 space-y-3", children: [
|
|
7280
|
+
/* @__PURE__ */ jsx40("div", { className: "h-4 bg-neutral-200 dark:bg-neutral-700 rounded w-1/2" }),
|
|
7281
|
+
[1, 2, 3].map((i) => /* @__PURE__ */ jsx40("div", { className: "h-10 bg-neutral-200 dark:bg-neutral-700 rounded" }, i))
|
|
7030
7282
|
] })
|
|
7031
7283
|
] })
|
|
7032
7284
|
] });
|
|
7033
7285
|
}
|
|
7034
7286
|
|
|
7035
7287
|
// src/components/AutoInterface/AutoInterface.tsx
|
|
7036
|
-
import { jsx as
|
|
7288
|
+
import { jsx as jsx41, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
7037
7289
|
async function generateInitialInterface(apiUrl, apiKey, agentId, prompt) {
|
|
7038
7290
|
const systemContext = generateCompactInterfaceContext();
|
|
7039
7291
|
const message = `${systemContext}
|
|
@@ -7083,19 +7335,19 @@ function AutoInterface({
|
|
|
7083
7335
|
theme,
|
|
7084
7336
|
className
|
|
7085
7337
|
}) {
|
|
7086
|
-
const [interfaceSpec, setInterfaceSpec] =
|
|
7087
|
-
const [isGenerating, setIsGenerating] =
|
|
7088
|
-
const [chatCollapsed, setChatCollapsed] =
|
|
7089
|
-
const chatRef =
|
|
7338
|
+
const [interfaceSpec, setInterfaceSpec] = useState18(initialInterface || null);
|
|
7339
|
+
const [isGenerating, setIsGenerating] = useState18(false);
|
|
7340
|
+
const [chatCollapsed, setChatCollapsed] = useState18(false);
|
|
7341
|
+
const chatRef = useRef13(null);
|
|
7090
7342
|
const systemContext = [
|
|
7091
7343
|
generateInterfaceContext(),
|
|
7092
7344
|
context || ""
|
|
7093
7345
|
].filter(Boolean).join("\n\n");
|
|
7094
|
-
const updateInterface =
|
|
7346
|
+
const updateInterface = useCallback7((newSpec) => {
|
|
7095
7347
|
setInterfaceSpec(newSpec);
|
|
7096
7348
|
onInterfaceChange?.(newSpec);
|
|
7097
7349
|
}, [onInterfaceChange]);
|
|
7098
|
-
const handleAction =
|
|
7350
|
+
const handleAction = useCallback7((action) => {
|
|
7099
7351
|
onAction?.(action);
|
|
7100
7352
|
if (chatRef.current) {
|
|
7101
7353
|
chatRef.current.sendMessage(
|
|
@@ -7103,7 +7355,7 @@ function AutoInterface({
|
|
|
7103
7355
|
);
|
|
7104
7356
|
}
|
|
7105
7357
|
}, [onAction]);
|
|
7106
|
-
const handleMessageComplete =
|
|
7358
|
+
const handleMessageComplete = useCallback7((result) => {
|
|
7107
7359
|
if (!result?.data) return;
|
|
7108
7360
|
const text = typeof result.data === "string" ? result.data : result.data.message || "";
|
|
7109
7361
|
console.log("[AutoInterface] Chat message complete, text (" + text.length + " chars):", text.substring(0, 300));
|
|
@@ -7124,7 +7376,7 @@ function AutoInterface({
|
|
|
7124
7376
|
}
|
|
7125
7377
|
setIsGenerating(false);
|
|
7126
7378
|
}, [interfaceSpec, updateInterface]);
|
|
7127
|
-
|
|
7379
|
+
useEffect15(() => {
|
|
7128
7380
|
if (!initialPrompt || initialInterface || useMock) return;
|
|
7129
7381
|
if (!apiUrl) return;
|
|
7130
7382
|
let cancelled = false;
|
|
@@ -7153,17 +7405,17 @@ function AutoInterface({
|
|
|
7153
7405
|
}, [initialPrompt]);
|
|
7154
7406
|
const hasInterface = interfaceSpec !== null;
|
|
7155
7407
|
const showSkeleton = isGenerating && !hasInterface;
|
|
7156
|
-
return /* @__PURE__ */
|
|
7408
|
+
return /* @__PURE__ */ jsxs34("div", { className: cn(
|
|
7157
7409
|
"flex h-full bg-neutral-50 dark:bg-black",
|
|
7158
7410
|
chatPosition === "bottom" ? "flex-col" : "flex-row",
|
|
7159
7411
|
className
|
|
7160
7412
|
), children: [
|
|
7161
|
-
/* @__PURE__ */
|
|
7413
|
+
/* @__PURE__ */ jsxs34("div", { className: cn(
|
|
7162
7414
|
"flex-1 overflow-y-auto min-w-0",
|
|
7163
7415
|
hasInterface || showSkeleton ? "" : "hidden"
|
|
7164
7416
|
), children: [
|
|
7165
|
-
showSkeleton && /* @__PURE__ */
|
|
7166
|
-
hasInterface && interfaceSpec && /* @__PURE__ */
|
|
7417
|
+
showSkeleton && /* @__PURE__ */ jsx41(InterfaceSkeleton, {}),
|
|
7418
|
+
hasInterface && interfaceSpec && /* @__PURE__ */ jsx41("div", { className: "p-4", children: /* @__PURE__ */ jsx41(
|
|
7167
7419
|
InterfaceRenderer,
|
|
7168
7420
|
{
|
|
7169
7421
|
node: interfaceSpec.root,
|
|
@@ -7171,16 +7423,16 @@ function AutoInterface({
|
|
|
7171
7423
|
}
|
|
7172
7424
|
) })
|
|
7173
7425
|
] }),
|
|
7174
|
-
chatCollapsible && hasInterface && chatPosition === "right" && /* @__PURE__ */
|
|
7426
|
+
chatCollapsible && hasInterface && chatPosition === "right" && /* @__PURE__ */ jsx41(
|
|
7175
7427
|
"button",
|
|
7176
7428
|
{
|
|
7177
7429
|
onClick: () => setChatCollapsed(!chatCollapsed),
|
|
7178
7430
|
className: "flex-shrink-0 w-6 flex items-center justify-center border-l border-neutral-200 dark:border-neutral-700 bg-neutral-100 dark:bg-neutral-800 hover:bg-neutral-200 dark:hover:bg-neutral-700 transition-colors",
|
|
7179
7431
|
title: chatCollapsed ? "Show chat" : "Hide chat",
|
|
7180
|
-
children: /* @__PURE__ */
|
|
7432
|
+
children: /* @__PURE__ */ jsx41("span", { className: "!text-xs !text-neutral-500 dark:!text-neutral-400", children: chatCollapsed ? "\u25C0" : "\u25B6" })
|
|
7181
7433
|
}
|
|
7182
7434
|
),
|
|
7183
|
-
/* @__PURE__ */
|
|
7435
|
+
/* @__PURE__ */ jsx41(
|
|
7184
7436
|
"div",
|
|
7185
7437
|
{
|
|
7186
7438
|
className: cn(
|
|
@@ -7191,7 +7443,7 @@ function AutoInterface({
|
|
|
7191
7443
|
!hasInterface && !showSkeleton && "flex-1"
|
|
7192
7444
|
),
|
|
7193
7445
|
style: hasInterface || showSkeleton ? chatPosition === "right" ? { width: chatWidth } : { height: "300px" } : void 0,
|
|
7194
|
-
children: /* @__PURE__ */
|
|
7446
|
+
children: /* @__PURE__ */ jsx41(
|
|
7195
7447
|
Chat,
|
|
7196
7448
|
{
|
|
7197
7449
|
ref: chatRef,
|
|
@@ -7249,29 +7501,29 @@ function getThemeScript() {
|
|
|
7249
7501
|
}
|
|
7250
7502
|
|
|
7251
7503
|
// src/hooks/useInterfaceState.ts
|
|
7252
|
-
import { useState as
|
|
7504
|
+
import { useState as useState19, useCallback as useCallback8 } from "react";
|
|
7253
7505
|
function useInterfaceState(initialSpec) {
|
|
7254
|
-
const [spec, setSpec] =
|
|
7255
|
-
const [isStreaming, setIsStreaming] =
|
|
7256
|
-
const setInterface =
|
|
7506
|
+
const [spec, setSpec] = useState19(initialSpec || null);
|
|
7507
|
+
const [isStreaming, setIsStreaming] = useState19(false);
|
|
7508
|
+
const setInterface = useCallback8((newSpec) => {
|
|
7257
7509
|
setSpec(newSpec);
|
|
7258
7510
|
}, []);
|
|
7259
|
-
const clearInterface =
|
|
7511
|
+
const clearInterface = useCallback8(() => {
|
|
7260
7512
|
setSpec(null);
|
|
7261
7513
|
}, []);
|
|
7262
|
-
const applyInterfaceUpdate =
|
|
7514
|
+
const applyInterfaceUpdate = useCallback8((update) => {
|
|
7263
7515
|
setSpec((prev) => {
|
|
7264
7516
|
if (!prev) return prev;
|
|
7265
7517
|
return applyUpdate(prev, update);
|
|
7266
7518
|
});
|
|
7267
7519
|
}, []);
|
|
7268
|
-
const applyInterfaceUpdates =
|
|
7520
|
+
const applyInterfaceUpdates = useCallback8((updates) => {
|
|
7269
7521
|
setSpec((prev) => {
|
|
7270
7522
|
if (!prev) return prev;
|
|
7271
7523
|
return applyUpdates(prev, updates);
|
|
7272
7524
|
});
|
|
7273
7525
|
}, []);
|
|
7274
|
-
const getNode =
|
|
7526
|
+
const getNode = useCallback8((id) => {
|
|
7275
7527
|
if (!spec) return null;
|
|
7276
7528
|
return findNode(spec.root, id);
|
|
7277
7529
|
}, [spec]);
|
|
@@ -7288,7 +7540,7 @@ function useInterfaceState(initialSpec) {
|
|
|
7288
7540
|
}
|
|
7289
7541
|
|
|
7290
7542
|
// src/hooks/useInterfaceAI.ts
|
|
7291
|
-
import { useCallback as
|
|
7543
|
+
import { useCallback as useCallback9, useRef as useRef14 } from "react";
|
|
7292
7544
|
function useInterfaceAI({
|
|
7293
7545
|
agentId,
|
|
7294
7546
|
apiUrl,
|
|
@@ -7300,15 +7552,15 @@ function useInterfaceAI({
|
|
|
7300
7552
|
onStreamStart,
|
|
7301
7553
|
onStreamEnd
|
|
7302
7554
|
}) {
|
|
7303
|
-
const threadIdRef =
|
|
7304
|
-
const accumulatedTextRef =
|
|
7555
|
+
const threadIdRef = useRef14(null);
|
|
7556
|
+
const accumulatedTextRef = useRef14("");
|
|
7305
7557
|
if (apiUrl || apiKey) {
|
|
7306
7558
|
aptevaClient.configure({
|
|
7307
7559
|
...apiUrl && { apiUrl },
|
|
7308
7560
|
...apiKey && { apiKey }
|
|
7309
7561
|
});
|
|
7310
7562
|
}
|
|
7311
|
-
const sendMessage =
|
|
7563
|
+
const sendMessage = useCallback9(async (message) => {
|
|
7312
7564
|
accumulatedTextRef.current = "";
|
|
7313
7565
|
onStreamStart?.();
|
|
7314
7566
|
const systemPrompt = [
|
|
@@ -7365,6 +7617,7 @@ export {
|
|
|
7365
7617
|
AptevaClient,
|
|
7366
7618
|
AutoInterface,
|
|
7367
7619
|
Button,
|
|
7620
|
+
Call,
|
|
7368
7621
|
Card,
|
|
7369
7622
|
Chat,
|
|
7370
7623
|
Command,
|