@apteva/apteva-kit 0.1.131 → 0.1.133
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 +293 -62
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +513 -282
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -4479,6 +4479,7 @@ function useVoiceSession(config) {
|
|
|
4479
4479
|
const [state, setState] = useState9("idle");
|
|
4480
4480
|
const [partialTranscript, setPartialTranscript] = useState9("");
|
|
4481
4481
|
const [duration, setDuration] = useState9(0);
|
|
4482
|
+
const [muted, setMuted] = useState9(false);
|
|
4482
4483
|
const wsRef = useRef9(null);
|
|
4483
4484
|
const captureCtxRef = useRef9(null);
|
|
4484
4485
|
const playbackCtxRef = useRef9(null);
|
|
@@ -4487,6 +4488,7 @@ function useVoiceSession(config) {
|
|
|
4487
4488
|
const nextPlayTimeRef = useRef9(0);
|
|
4488
4489
|
const durationIntervalRef = useRef9(null);
|
|
4489
4490
|
const startTimeRef = useRef9(0);
|
|
4491
|
+
const mutedRef = useRef9(false);
|
|
4490
4492
|
const configRef = useRef9(config);
|
|
4491
4493
|
configRef.current = config;
|
|
4492
4494
|
const cleanup = useCallback4(() => {
|
|
@@ -4524,6 +4526,8 @@ function useVoiceSession(config) {
|
|
|
4524
4526
|
wsRef.current = null;
|
|
4525
4527
|
}
|
|
4526
4528
|
nextPlayTimeRef.current = 0;
|
|
4529
|
+
mutedRef.current = false;
|
|
4530
|
+
setMuted(false);
|
|
4527
4531
|
setPartialTranscript("");
|
|
4528
4532
|
setDuration(0);
|
|
4529
4533
|
}, []);
|
|
@@ -4551,6 +4555,8 @@ function useVoiceSession(config) {
|
|
|
4551
4555
|
source.start(startTime);
|
|
4552
4556
|
nextPlayTimeRef.current = startTime + audioBuffer.duration;
|
|
4553
4557
|
}, []);
|
|
4558
|
+
const startCaptureRef = useRef9(() => {
|
|
4559
|
+
});
|
|
4554
4560
|
const handleMessage = useCallback4((msg) => {
|
|
4555
4561
|
const cfg = configRef.current;
|
|
4556
4562
|
switch (msg.type) {
|
|
@@ -4560,6 +4566,7 @@ function useVoiceSession(config) {
|
|
|
4560
4566
|
durationIntervalRef.current = setInterval(() => {
|
|
4561
4567
|
setDuration(Math.floor((Date.now() - startTimeRef.current) / 1e3));
|
|
4562
4568
|
}, 1e3);
|
|
4569
|
+
startCaptureRef.current();
|
|
4563
4570
|
break;
|
|
4564
4571
|
case "audio_delta":
|
|
4565
4572
|
if (msg.data?.chunk) {
|
|
@@ -4616,6 +4623,7 @@ function useVoiceSession(config) {
|
|
|
4616
4623
|
processorRef.current = captureCtxRef.current.createScriptProcessor(2048, 1, 1);
|
|
4617
4624
|
processorRef.current.onaudioprocess = (e) => {
|
|
4618
4625
|
if (!ws || ws.readyState !== WebSocket.OPEN) return;
|
|
4626
|
+
if (mutedRef.current) return;
|
|
4619
4627
|
const inputData = e.inputBuffer.getChannelData(0);
|
|
4620
4628
|
const resampledData = resampleAudio(inputData, nativeSampleRate, 16e3);
|
|
4621
4629
|
const int16Data = float32ToInt16(resampledData);
|
|
@@ -4628,16 +4636,24 @@ function useVoiceSession(config) {
|
|
|
4628
4636
|
source.connect(processorRef.current);
|
|
4629
4637
|
processorRef.current.connect(captureCtxRef.current.destination);
|
|
4630
4638
|
} catch (e) {
|
|
4639
|
+
console.warn("Microphone access denied:", e);
|
|
4631
4640
|
configRef.current.onError?.(new Error("Microphone access denied"));
|
|
4632
|
-
cleanup();
|
|
4633
|
-
setState("idle");
|
|
4634
4641
|
}
|
|
4635
4642
|
}, [cleanup]);
|
|
4643
|
+
startCaptureRef.current = startCapture;
|
|
4636
4644
|
const start = useCallback4(() => {
|
|
4637
4645
|
if (state !== "idle") return;
|
|
4638
4646
|
setState("connecting");
|
|
4639
|
-
|
|
4640
|
-
|
|
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
|
+
}
|
|
4641
4657
|
const ws = new WebSocket(wsUrl);
|
|
4642
4658
|
wsRef.current = ws;
|
|
4643
4659
|
ws.onopen = () => {
|
|
@@ -4647,7 +4663,6 @@ function useVoiceSession(config) {
|
|
|
4647
4663
|
type: "start",
|
|
4648
4664
|
data: { provider, voice }
|
|
4649
4665
|
}));
|
|
4650
|
-
startCapture();
|
|
4651
4666
|
};
|
|
4652
4667
|
ws.onmessage = (event) => {
|
|
4653
4668
|
try {
|
|
@@ -4664,11 +4679,20 @@ function useVoiceSession(config) {
|
|
|
4664
4679
|
cleanup();
|
|
4665
4680
|
setState("idle");
|
|
4666
4681
|
};
|
|
4667
|
-
}, [state, config.apiUrl,
|
|
4682
|
+
}, [state, config.apiUrl, handleMessage, cleanup]);
|
|
4668
4683
|
const stop = useCallback4(() => {
|
|
4669
4684
|
cleanup();
|
|
4670
4685
|
setState("idle");
|
|
4671
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
|
+
}, []);
|
|
4672
4696
|
const sendText = useCallback4((text) => {
|
|
4673
4697
|
const ws = wsRef.current;
|
|
4674
4698
|
if (!ws || ws.readyState !== WebSocket.OPEN) return;
|
|
@@ -4677,7 +4701,7 @@ function useVoiceSession(config) {
|
|
|
4677
4701
|
data: { content: text }
|
|
4678
4702
|
}));
|
|
4679
4703
|
}, []);
|
|
4680
|
-
return { state, partialTranscript, duration, start, stop, sendText };
|
|
4704
|
+
return { state, partialTranscript, duration, muted, start, stop, sendText, toggleMute };
|
|
4681
4705
|
}
|
|
4682
4706
|
|
|
4683
4707
|
// src/components/Chat/Chat.tsx
|
|
@@ -4768,6 +4792,7 @@ var Chat = forwardRef(function Chat2({
|
|
|
4768
4792
|
}, []);
|
|
4769
4793
|
const voice = useVoiceSession({
|
|
4770
4794
|
apiUrl: apiUrl || "",
|
|
4795
|
+
apiKey,
|
|
4771
4796
|
provider: voiceProvider,
|
|
4772
4797
|
voice: voiceId,
|
|
4773
4798
|
onTranscript: handleVoiceTranscript,
|
|
@@ -5461,9 +5486,214 @@ ${planToExecute}`;
|
|
|
5461
5486
|
import { useState as useState11 } from "react";
|
|
5462
5487
|
import { jsx as jsx27, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
5463
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
|
+
|
|
5464
5694
|
// src/components/Command/Command.tsx
|
|
5465
|
-
import
|
|
5466
|
-
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";
|
|
5467
5697
|
function Command({
|
|
5468
5698
|
agentId,
|
|
5469
5699
|
command: initialCommand,
|
|
@@ -5490,28 +5720,28 @@ function Command({
|
|
|
5490
5720
|
resultRenderer,
|
|
5491
5721
|
className
|
|
5492
5722
|
}) {
|
|
5493
|
-
const [state, setState] =
|
|
5494
|
-
const [result, setResult] =
|
|
5495
|
-
const [error, setError] =
|
|
5496
|
-
const [progress, setProgress] =
|
|
5497
|
-
const [command, setCommand] =
|
|
5498
|
-
const [streamedContent, setStreamedContent] =
|
|
5499
|
-
const [plan, setPlan] =
|
|
5500
|
-
const [pendingCommand, setPendingCommand] =
|
|
5501
|
-
const [showPlanDetails, setShowPlanDetails] =
|
|
5502
|
-
const [uploadedFiles, setUploadedFiles] =
|
|
5503
|
-
const [showSettingsMenu, setShowSettingsMenu] =
|
|
5504
|
-
const [internalPlanMode, setInternalPlanMode] =
|
|
5505
|
-
const fileInputRef =
|
|
5506
|
-
|
|
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(() => {
|
|
5507
5737
|
if (autoExecute && state === "idle" && command) {
|
|
5508
5738
|
executeCommand();
|
|
5509
5739
|
}
|
|
5510
5740
|
}, [autoExecute]);
|
|
5511
|
-
|
|
5741
|
+
useEffect13(() => {
|
|
5512
5742
|
setInternalPlanMode(planMode);
|
|
5513
5743
|
}, [planMode]);
|
|
5514
|
-
|
|
5744
|
+
useEffect13(() => {
|
|
5515
5745
|
const handleClickOutside = (event) => {
|
|
5516
5746
|
const target = event.target;
|
|
5517
5747
|
if (showSettingsMenu && !target.closest(".settings-menu-container")) {
|
|
@@ -5913,7 +6143,7 @@ ${planToExecute}`;
|
|
|
5913
6143
|
setUploadedFiles((prev) => prev.filter((_, i) => i !== index));
|
|
5914
6144
|
};
|
|
5915
6145
|
const isCompact = variant === "compact";
|
|
5916
|
-
return /* @__PURE__ */
|
|
6146
|
+
return /* @__PURE__ */ jsxs26(
|
|
5917
6147
|
"div",
|
|
5918
6148
|
{
|
|
5919
6149
|
className: cn(
|
|
@@ -5928,9 +6158,9 @@ ${planToExecute}`;
|
|
|
5928
6158
|
),
|
|
5929
6159
|
style: { minHeight: isCompact ? "auto" : "180px" },
|
|
5930
6160
|
children: [
|
|
5931
|
-
/* @__PURE__ */
|
|
5932
|
-
state === "idle" && allowInput && !isCompact && /* @__PURE__ */
|
|
5933
|
-
/* @__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(
|
|
5934
6164
|
"textarea",
|
|
5935
6165
|
{
|
|
5936
6166
|
value: command,
|
|
@@ -5946,42 +6176,42 @@ ${planToExecute}`;
|
|
|
5946
6176
|
rows: 6
|
|
5947
6177
|
}
|
|
5948
6178
|
),
|
|
5949
|
-
uploadedFiles.length > 0 && /* @__PURE__ */
|
|
5950
|
-
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(
|
|
5951
6181
|
"img",
|
|
5952
6182
|
{
|
|
5953
6183
|
src: file.preview,
|
|
5954
6184
|
alt: file.name,
|
|
5955
6185
|
className: "w-20 h-20 object-cover rounded-lg border-2 border-neutral-300 dark:border-neutral-600"
|
|
5956
6186
|
}
|
|
5957
|
-
) : /* @__PURE__ */
|
|
5958
|
-
/* @__PURE__ */
|
|
5959
|
-
/* @__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 })
|
|
5960
6190
|
] }),
|
|
5961
|
-
/* @__PURE__ */
|
|
6191
|
+
/* @__PURE__ */ jsx32(
|
|
5962
6192
|
"button",
|
|
5963
6193
|
{
|
|
5964
6194
|
onClick: () => removeFile(index),
|
|
5965
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",
|
|
5966
6196
|
title: `Remove ${file.type}`,
|
|
5967
|
-
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" }) })
|
|
5968
6198
|
}
|
|
5969
6199
|
)
|
|
5970
6200
|
] }, index)) })
|
|
5971
6201
|
] }),
|
|
5972
|
-
state === "idle" && allowInput && isCompact && /* @__PURE__ */
|
|
5973
|
-
/* @__PURE__ */
|
|
5974
|
-
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(
|
|
5975
6205
|
"button",
|
|
5976
6206
|
{
|
|
5977
6207
|
onClick: () => fileInputRef.current?.click(),
|
|
5978
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",
|
|
5979
6209
|
title: "Attach file",
|
|
5980
|
-
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)" }) })
|
|
5981
6211
|
}
|
|
5982
6212
|
),
|
|
5983
|
-
planMode && /* @__PURE__ */
|
|
5984
|
-
/* @__PURE__ */
|
|
6213
|
+
planMode && /* @__PURE__ */ jsxs26("div", { className: "relative settings-menu-container", children: [
|
|
6214
|
+
/* @__PURE__ */ jsx32(
|
|
5985
6215
|
"button",
|
|
5986
6216
|
{
|
|
5987
6217
|
onClick: () => setShowSettingsMenu(!showSettingsMenu),
|
|
@@ -5990,28 +6220,28 @@ ${planToExecute}`;
|
|
|
5990
6220
|
internalPlanMode ? "!text-blue-600 dark:!text-blue-400" : "!text-neutral-500 dark:!text-neutral-500"
|
|
5991
6221
|
),
|
|
5992
6222
|
title: "Settings",
|
|
5993
|
-
children: /* @__PURE__ */
|
|
5994
|
-
/* @__PURE__ */
|
|
5995
|
-
/* @__PURE__ */
|
|
5996
|
-
/* @__PURE__ */
|
|
5997
|
-
/* @__PURE__ */
|
|
5998
|
-
/* @__PURE__ */
|
|
5999
|
-
/* @__PURE__ */
|
|
6000
|
-
/* @__PURE__ */
|
|
6001
|
-
/* @__PURE__ */
|
|
6002
|
-
/* @__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" })
|
|
6003
6233
|
] })
|
|
6004
6234
|
}
|
|
6005
6235
|
),
|
|
6006
|
-
showSettingsMenu && /* @__PURE__ */
|
|
6007
|
-
/* @__PURE__ */
|
|
6008
|
-
/* @__PURE__ */
|
|
6009
|
-
/* @__PURE__ */
|
|
6010
|
-
/* @__PURE__ */
|
|
6011
|
-
/* @__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" })
|
|
6012
6242
|
] })
|
|
6013
6243
|
] }),
|
|
6014
|
-
/* @__PURE__ */
|
|
6244
|
+
/* @__PURE__ */ jsx32(
|
|
6015
6245
|
"button",
|
|
6016
6246
|
{
|
|
6017
6247
|
onClick: (e) => {
|
|
@@ -6023,7 +6253,7 @@ ${planToExecute}`;
|
|
|
6023
6253
|
internalPlanMode ? "bg-blue-600" : "bg-neutral-300 dark:bg-neutral-600"
|
|
6024
6254
|
),
|
|
6025
6255
|
type: "button",
|
|
6026
|
-
children: /* @__PURE__ */
|
|
6256
|
+
children: /* @__PURE__ */ jsx32(
|
|
6027
6257
|
"span",
|
|
6028
6258
|
{
|
|
6029
6259
|
className: cn(
|
|
@@ -6037,26 +6267,26 @@ ${planToExecute}`;
|
|
|
6037
6267
|
] }) })
|
|
6038
6268
|
] })
|
|
6039
6269
|
] }),
|
|
6040
|
-
uploadedFiles.length > 0 && /* @__PURE__ */
|
|
6041
|
-
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(
|
|
6042
6272
|
"img",
|
|
6043
6273
|
{
|
|
6044
6274
|
src: file.preview,
|
|
6045
6275
|
alt: file.name,
|
|
6046
6276
|
className: "w-8 h-8 object-cover rounded border border-neutral-300 dark:border-neutral-600"
|
|
6047
6277
|
}
|
|
6048
|
-
) : /* @__PURE__ */
|
|
6049
|
-
/* @__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(
|
|
6050
6280
|
"button",
|
|
6051
6281
|
{
|
|
6052
6282
|
onClick: () => removeFile(index),
|
|
6053
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",
|
|
6054
6284
|
title: "Remove",
|
|
6055
|
-
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" }) })
|
|
6056
6286
|
}
|
|
6057
6287
|
)
|
|
6058
6288
|
] }, index)) }),
|
|
6059
|
-
/* @__PURE__ */
|
|
6289
|
+
/* @__PURE__ */ jsx32(
|
|
6060
6290
|
"input",
|
|
6061
6291
|
{
|
|
6062
6292
|
type: "text",
|
|
@@ -6072,7 +6302,7 @@ ${planToExecute}`;
|
|
|
6072
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"
|
|
6073
6303
|
}
|
|
6074
6304
|
),
|
|
6075
|
-
/* @__PURE__ */
|
|
6305
|
+
/* @__PURE__ */ jsx32(
|
|
6076
6306
|
"button",
|
|
6077
6307
|
{
|
|
6078
6308
|
onClick: () => executeCommand(),
|
|
@@ -6088,33 +6318,33 @@ ${planToExecute}`;
|
|
|
6088
6318
|
!command.trim() && "border-neutral-200 dark:border-neutral-700 !text-neutral-400 dark:!text-neutral-600"
|
|
6089
6319
|
),
|
|
6090
6320
|
title: "Execute",
|
|
6091
|
-
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" }) })
|
|
6092
6322
|
}
|
|
6093
6323
|
)
|
|
6094
6324
|
] }),
|
|
6095
|
-
state === "loading" && !isCompact && /* @__PURE__ */
|
|
6096
|
-
/* @__PURE__ */
|
|
6097
|
-
/* @__PURE__ */
|
|
6098
|
-
showProgress && /* @__PURE__ */
|
|
6099
|
-
/* @__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(
|
|
6100
6330
|
"div",
|
|
6101
6331
|
{
|
|
6102
6332
|
className: "bg-blue-500 h-1.5 rounded-full transition-all duration-300",
|
|
6103
6333
|
style: { width: `${progress}%` }
|
|
6104
6334
|
}
|
|
6105
6335
|
) }),
|
|
6106
|
-
/* @__PURE__ */
|
|
6336
|
+
/* @__PURE__ */ jsxs26("p", { className: "text-xs text-neutral-500 mt-2 text-center", children: [
|
|
6107
6337
|
progress,
|
|
6108
6338
|
"%"
|
|
6109
6339
|
] })
|
|
6110
6340
|
] })
|
|
6111
6341
|
] }),
|
|
6112
|
-
state === "loading" && isCompact && /* @__PURE__ */
|
|
6113
|
-
/* @__PURE__ */
|
|
6114
|
-
/* @__PURE__ */
|
|
6115
|
-
/* @__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 })
|
|
6116
6346
|
] }),
|
|
6117
|
-
/* @__PURE__ */
|
|
6347
|
+
/* @__PURE__ */ jsx32(
|
|
6118
6348
|
"button",
|
|
6119
6349
|
{
|
|
6120
6350
|
disabled: true,
|
|
@@ -6126,20 +6356,20 @@ ${planToExecute}`;
|
|
|
6126
6356
|
"!text-lg",
|
|
6127
6357
|
"opacity-30 cursor-not-allowed"
|
|
6128
6358
|
),
|
|
6129
|
-
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" }) })
|
|
6130
6360
|
}
|
|
6131
6361
|
)
|
|
6132
6362
|
] }),
|
|
6133
|
-
state === "plan-pending" && !isCompact && /* @__PURE__ */
|
|
6134
|
-
/* @__PURE__ */
|
|
6135
|
-
/* @__PURE__ */
|
|
6136
|
-
/* @__PURE__ */
|
|
6137
|
-
/* @__PURE__ */
|
|
6138
|
-
/* @__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 })
|
|
6139
6369
|
] })
|
|
6140
6370
|
] }),
|
|
6141
|
-
/* @__PURE__ */
|
|
6142
|
-
/* @__PURE__ */
|
|
6371
|
+
/* @__PURE__ */ jsxs26("div", { className: "flex gap-2 mt-4", children: [
|
|
6372
|
+
/* @__PURE__ */ jsx32(
|
|
6143
6373
|
"button",
|
|
6144
6374
|
{
|
|
6145
6375
|
onClick: approvePlan,
|
|
@@ -6147,7 +6377,7 @@ ${planToExecute}`;
|
|
|
6147
6377
|
children: "Approve & Execute"
|
|
6148
6378
|
}
|
|
6149
6379
|
),
|
|
6150
|
-
/* @__PURE__ */
|
|
6380
|
+
/* @__PURE__ */ jsx32(
|
|
6151
6381
|
"button",
|
|
6152
6382
|
{
|
|
6153
6383
|
onClick: rejectPlan,
|
|
@@ -6157,20 +6387,20 @@ ${planToExecute}`;
|
|
|
6157
6387
|
)
|
|
6158
6388
|
] })
|
|
6159
6389
|
] }) }),
|
|
6160
|
-
state === "plan-pending" && isCompact && /* @__PURE__ */
|
|
6161
|
-
/* @__PURE__ */
|
|
6390
|
+
state === "plan-pending" && isCompact && /* @__PURE__ */ jsxs26(Fragment8, { children: [
|
|
6391
|
+
/* @__PURE__ */ jsxs26(
|
|
6162
6392
|
"button",
|
|
6163
6393
|
{
|
|
6164
6394
|
onClick: () => setShowPlanDetails(true),
|
|
6165
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",
|
|
6166
6396
|
children: [
|
|
6167
|
-
/* @__PURE__ */
|
|
6168
|
-
/* @__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" })
|
|
6169
6399
|
]
|
|
6170
6400
|
}
|
|
6171
6401
|
),
|
|
6172
|
-
/* @__PURE__ */
|
|
6173
|
-
/* @__PURE__ */
|
|
6402
|
+
/* @__PURE__ */ jsxs26("div", { className: "flex gap-2 flex-shrink-0", children: [
|
|
6403
|
+
/* @__PURE__ */ jsx32(
|
|
6174
6404
|
"button",
|
|
6175
6405
|
{
|
|
6176
6406
|
onClick: approvePlan,
|
|
@@ -6178,7 +6408,7 @@ ${planToExecute}`;
|
|
|
6178
6408
|
children: "Approve"
|
|
6179
6409
|
}
|
|
6180
6410
|
),
|
|
6181
|
-
/* @__PURE__ */
|
|
6411
|
+
/* @__PURE__ */ jsx32(
|
|
6182
6412
|
"button",
|
|
6183
6413
|
{
|
|
6184
6414
|
onClick: rejectPlan,
|
|
@@ -6188,15 +6418,15 @@ ${planToExecute}`;
|
|
|
6188
6418
|
)
|
|
6189
6419
|
] })
|
|
6190
6420
|
] }),
|
|
6191
|
-
state === "error" && /* @__PURE__ */
|
|
6192
|
-
/* @__PURE__ */
|
|
6193
|
-
/* @__PURE__ */
|
|
6194
|
-
/* @__PURE__ */
|
|
6195
|
-
/* @__PURE__ */
|
|
6196
|
-
/* @__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 })
|
|
6197
6427
|
] })
|
|
6198
6428
|
] }) }),
|
|
6199
|
-
allowInput && /* @__PURE__ */
|
|
6429
|
+
allowInput && /* @__PURE__ */ jsx32(
|
|
6200
6430
|
"textarea",
|
|
6201
6431
|
{
|
|
6202
6432
|
value: command,
|
|
@@ -6213,16 +6443,16 @@ ${planToExecute}`;
|
|
|
6213
6443
|
}
|
|
6214
6444
|
)
|
|
6215
6445
|
] }),
|
|
6216
|
-
state === "success" && result && !isCompact && /* @__PURE__ */
|
|
6217
|
-
/* @__PURE__ */
|
|
6218
|
-
/* @__PURE__ */
|
|
6219
|
-
/* @__PURE__ */
|
|
6220
|
-
/* @__PURE__ */
|
|
6221
|
-
/* @__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" })
|
|
6222
6452
|
] })
|
|
6223
6453
|
] }),
|
|
6224
|
-
result.data?.summary && /* @__PURE__ */
|
|
6225
|
-
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(
|
|
6226
6456
|
WidgetRenderer,
|
|
6227
6457
|
{
|
|
6228
6458
|
widget,
|
|
@@ -6231,8 +6461,8 @@ ${planToExecute}`;
|
|
|
6231
6461
|
widget.id
|
|
6232
6462
|
)) })
|
|
6233
6463
|
] }) }),
|
|
6234
|
-
state === "success" && result && isCompact && /* @__PURE__ */
|
|
6235
|
-
/* @__PURE__ */
|
|
6464
|
+
state === "success" && result && isCompact && /* @__PURE__ */ jsxs26(Fragment8, { children: [
|
|
6465
|
+
/* @__PURE__ */ jsxs26(
|
|
6236
6466
|
"div",
|
|
6237
6467
|
{
|
|
6238
6468
|
className: "flex-1 flex items-center gap-2 py-1 cursor-text min-w-0",
|
|
@@ -6241,12 +6471,12 @@ ${planToExecute}`;
|
|
|
6241
6471
|
setResult(null);
|
|
6242
6472
|
},
|
|
6243
6473
|
children: [
|
|
6244
|
-
/* @__PURE__ */
|
|
6245
|
-
/* @__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" })
|
|
6246
6476
|
]
|
|
6247
6477
|
}
|
|
6248
6478
|
),
|
|
6249
|
-
/* @__PURE__ */
|
|
6479
|
+
/* @__PURE__ */ jsx32(
|
|
6250
6480
|
"button",
|
|
6251
6481
|
{
|
|
6252
6482
|
onClick: () => {
|
|
@@ -6262,24 +6492,24 @@ ${planToExecute}`;
|
|
|
6262
6492
|
"!text-lg"
|
|
6263
6493
|
),
|
|
6264
6494
|
title: "New command",
|
|
6265
|
-
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" }) })
|
|
6266
6496
|
}
|
|
6267
6497
|
)
|
|
6268
6498
|
] })
|
|
6269
6499
|
] }),
|
|
6270
|
-
!isCompact && /* @__PURE__ */
|
|
6271
|
-
/* @__PURE__ */
|
|
6272
|
-
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(
|
|
6273
6503
|
"button",
|
|
6274
6504
|
{
|
|
6275
6505
|
onClick: () => fileInputRef.current?.click(),
|
|
6276
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",
|
|
6277
6507
|
title: "Attach file",
|
|
6278
|
-
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)" }) })
|
|
6279
6509
|
}
|
|
6280
6510
|
),
|
|
6281
|
-
planMode && /* @__PURE__ */
|
|
6282
|
-
/* @__PURE__ */
|
|
6511
|
+
planMode && /* @__PURE__ */ jsxs26("div", { className: "relative settings-menu-container", children: [
|
|
6512
|
+
/* @__PURE__ */ jsx32(
|
|
6283
6513
|
"button",
|
|
6284
6514
|
{
|
|
6285
6515
|
onClick: () => setShowSettingsMenu(!showSettingsMenu),
|
|
@@ -6288,28 +6518,28 @@ ${planToExecute}`;
|
|
|
6288
6518
|
internalPlanMode ? "!text-blue-600 dark:!text-blue-400" : "!text-neutral-500 dark:!text-neutral-500"
|
|
6289
6519
|
),
|
|
6290
6520
|
title: "Settings",
|
|
6291
|
-
children: /* @__PURE__ */
|
|
6292
|
-
/* @__PURE__ */
|
|
6293
|
-
/* @__PURE__ */
|
|
6294
|
-
/* @__PURE__ */
|
|
6295
|
-
/* @__PURE__ */
|
|
6296
|
-
/* @__PURE__ */
|
|
6297
|
-
/* @__PURE__ */
|
|
6298
|
-
/* @__PURE__ */
|
|
6299
|
-
/* @__PURE__ */
|
|
6300
|
-
/* @__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" })
|
|
6301
6531
|
] })
|
|
6302
6532
|
}
|
|
6303
6533
|
),
|
|
6304
|
-
showSettingsMenu && /* @__PURE__ */
|
|
6305
|
-
/* @__PURE__ */
|
|
6306
|
-
/* @__PURE__ */
|
|
6307
|
-
/* @__PURE__ */
|
|
6308
|
-
/* @__PURE__ */
|
|
6309
|
-
/* @__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" })
|
|
6310
6540
|
] })
|
|
6311
6541
|
] }),
|
|
6312
|
-
/* @__PURE__ */
|
|
6542
|
+
/* @__PURE__ */ jsx32(
|
|
6313
6543
|
"button",
|
|
6314
6544
|
{
|
|
6315
6545
|
onClick: (e) => {
|
|
@@ -6321,7 +6551,7 @@ ${planToExecute}`;
|
|
|
6321
6551
|
internalPlanMode ? "bg-blue-600" : "bg-neutral-300 dark:bg-neutral-600"
|
|
6322
6552
|
),
|
|
6323
6553
|
type: "button",
|
|
6324
|
-
children: /* @__PURE__ */
|
|
6554
|
+
children: /* @__PURE__ */ jsx32(
|
|
6325
6555
|
"span",
|
|
6326
6556
|
{
|
|
6327
6557
|
className: cn(
|
|
@@ -6335,9 +6565,9 @@ ${planToExecute}`;
|
|
|
6335
6565
|
] }) })
|
|
6336
6566
|
] })
|
|
6337
6567
|
] }) }),
|
|
6338
|
-
!(state === "idle" && allowInput) && /* @__PURE__ */
|
|
6339
|
-
/* @__PURE__ */
|
|
6340
|
-
(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(
|
|
6341
6571
|
"button",
|
|
6342
6572
|
{
|
|
6343
6573
|
onClick: resetCommand,
|
|
@@ -6345,7 +6575,7 @@ ${planToExecute}`;
|
|
|
6345
6575
|
children: "Reset"
|
|
6346
6576
|
}
|
|
6347
6577
|
),
|
|
6348
|
-
(state === "idle" || state === "error") && /* @__PURE__ */
|
|
6578
|
+
(state === "idle" || state === "error") && /* @__PURE__ */ jsx32(
|
|
6349
6579
|
"button",
|
|
6350
6580
|
{
|
|
6351
6581
|
onClick: () => executeCommand(),
|
|
@@ -6361,29 +6591,29 @@ ${planToExecute}`;
|
|
|
6361
6591
|
!command.trim() && "border-neutral-200 dark:border-neutral-700 !text-neutral-400 dark:!text-neutral-600"
|
|
6362
6592
|
),
|
|
6363
6593
|
title: state === "error" ? "Retry" : "Execute",
|
|
6364
|
-
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" }) })
|
|
6365
6595
|
}
|
|
6366
6596
|
)
|
|
6367
6597
|
] })
|
|
6368
6598
|
] }),
|
|
6369
|
-
showPlanDetails && isCompact && state === "plan-pending" && /* @__PURE__ */
|
|
6370
|
-
/* @__PURE__ */
|
|
6371
|
-
/* @__PURE__ */
|
|
6372
|
-
/* @__PURE__ */
|
|
6373
|
-
/* @__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" })
|
|
6374
6604
|
] }),
|
|
6375
|
-
/* @__PURE__ */
|
|
6605
|
+
/* @__PURE__ */ jsx32(
|
|
6376
6606
|
"button",
|
|
6377
6607
|
{
|
|
6378
6608
|
onClick: () => setShowPlanDetails(false),
|
|
6379
6609
|
className: "text-neutral-400 hover:text-neutral-600 dark:hover:text-neutral-300 transition-colors",
|
|
6380
|
-
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" }) })
|
|
6381
6611
|
}
|
|
6382
6612
|
)
|
|
6383
6613
|
] }),
|
|
6384
|
-
/* @__PURE__ */
|
|
6385
|
-
/* @__PURE__ */
|
|
6386
|
-
/* @__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(
|
|
6387
6617
|
"button",
|
|
6388
6618
|
{
|
|
6389
6619
|
onClick: rejectPlan,
|
|
@@ -6391,7 +6621,7 @@ ${planToExecute}`;
|
|
|
6391
6621
|
children: "Modify Command"
|
|
6392
6622
|
}
|
|
6393
6623
|
),
|
|
6394
|
-
/* @__PURE__ */
|
|
6624
|
+
/* @__PURE__ */ jsx32(
|
|
6395
6625
|
"button",
|
|
6396
6626
|
{
|
|
6397
6627
|
onClick: approvePlan,
|
|
@@ -6401,7 +6631,7 @@ ${planToExecute}`;
|
|
|
6401
6631
|
)
|
|
6402
6632
|
] })
|
|
6403
6633
|
] }) }),
|
|
6404
|
-
/* @__PURE__ */
|
|
6634
|
+
/* @__PURE__ */ jsx32(
|
|
6405
6635
|
"input",
|
|
6406
6636
|
{
|
|
6407
6637
|
ref: fileInputRef,
|
|
@@ -6412,7 +6642,7 @@ ${planToExecute}`;
|
|
|
6412
6642
|
accept: "image/*,application/pdf,.doc,.docx,.txt"
|
|
6413
6643
|
}
|
|
6414
6644
|
),
|
|
6415
|
-
/* @__PURE__ */
|
|
6645
|
+
/* @__PURE__ */ jsx32("style", { dangerouslySetInnerHTML: {
|
|
6416
6646
|
__html: `
|
|
6417
6647
|
@keyframes pulse-border {
|
|
6418
6648
|
0%, 100% {
|
|
@@ -6433,8 +6663,8 @@ ${planToExecute}`;
|
|
|
6433
6663
|
}
|
|
6434
6664
|
|
|
6435
6665
|
// src/components/Prompt/Prompt.tsx
|
|
6436
|
-
import { useState as
|
|
6437
|
-
import { jsx as
|
|
6666
|
+
import { useState as useState14 } from "react";
|
|
6667
|
+
import { jsx as jsx33, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
6438
6668
|
function Prompt({
|
|
6439
6669
|
agentId,
|
|
6440
6670
|
placeholder = "Enter your prompt...",
|
|
@@ -6451,9 +6681,9 @@ function Prompt({
|
|
|
6451
6681
|
showSuggestions = false,
|
|
6452
6682
|
className
|
|
6453
6683
|
}) {
|
|
6454
|
-
const [value, setValue] =
|
|
6455
|
-
const [isLoading, setIsLoading] =
|
|
6456
|
-
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"]);
|
|
6457
6687
|
const handleChange = (e) => {
|
|
6458
6688
|
const newValue = e.target.value;
|
|
6459
6689
|
if (!maxLength || newValue.length <= maxLength) {
|
|
@@ -6496,9 +6726,9 @@ function Prompt({
|
|
|
6496
6726
|
handleSubmit();
|
|
6497
6727
|
}
|
|
6498
6728
|
};
|
|
6499
|
-
return /* @__PURE__ */
|
|
6500
|
-
/* @__PURE__ */
|
|
6501
|
-
/* @__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(
|
|
6502
6732
|
"input",
|
|
6503
6733
|
{
|
|
6504
6734
|
type: "text",
|
|
@@ -6511,7 +6741,7 @@ function Prompt({
|
|
|
6511
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"
|
|
6512
6742
|
}
|
|
6513
6743
|
),
|
|
6514
|
-
submitOn === "button" && /* @__PURE__ */
|
|
6744
|
+
submitOn === "button" && /* @__PURE__ */ jsx33(
|
|
6515
6745
|
"button",
|
|
6516
6746
|
{
|
|
6517
6747
|
onClick: handleSubmit,
|
|
@@ -6521,13 +6751,13 @@ function Prompt({
|
|
|
6521
6751
|
}
|
|
6522
6752
|
)
|
|
6523
6753
|
] }),
|
|
6524
|
-
maxLength && /* @__PURE__ */
|
|
6754
|
+
maxLength && /* @__PURE__ */ jsxs27("p", { className: "text-xs text-neutral-500", children: [
|
|
6525
6755
|
value.length,
|
|
6526
6756
|
" / ",
|
|
6527
6757
|
maxLength,
|
|
6528
6758
|
" characters"
|
|
6529
6759
|
] }),
|
|
6530
|
-
showSuggestions && !value && /* @__PURE__ */
|
|
6760
|
+
showSuggestions && !value && /* @__PURE__ */ jsx33("div", { className: "flex flex-wrap gap-2", children: suggestions.map((suggestion, idx) => /* @__PURE__ */ jsx33(
|
|
6531
6761
|
"button",
|
|
6532
6762
|
{
|
|
6533
6763
|
onClick: () => setValue(suggestion),
|
|
@@ -6536,16 +6766,16 @@ function Prompt({
|
|
|
6536
6766
|
},
|
|
6537
6767
|
idx
|
|
6538
6768
|
)) }),
|
|
6539
|
-
isLoading && /* @__PURE__ */
|
|
6540
|
-
/* @__PURE__ */
|
|
6541
|
-
/* @__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..." })
|
|
6542
6772
|
] })
|
|
6543
6773
|
] });
|
|
6544
6774
|
}
|
|
6545
6775
|
|
|
6546
6776
|
// src/components/Stream/Stream.tsx
|
|
6547
|
-
import { useState as
|
|
6548
|
-
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";
|
|
6549
6779
|
function Stream({
|
|
6550
6780
|
agentId,
|
|
6551
6781
|
prompt,
|
|
@@ -6561,10 +6791,10 @@ function Stream({
|
|
|
6561
6791
|
typingSpeed = 30,
|
|
6562
6792
|
className
|
|
6563
6793
|
}) {
|
|
6564
|
-
const [text, setText] =
|
|
6565
|
-
const [isStreaming, setIsStreaming] =
|
|
6566
|
-
const [isComplete, setIsComplete] =
|
|
6567
|
-
|
|
6794
|
+
const [text, setText] = useState15("");
|
|
6795
|
+
const [isStreaming, setIsStreaming] = useState15(false);
|
|
6796
|
+
const [isComplete, setIsComplete] = useState15(false);
|
|
6797
|
+
useEffect14(() => {
|
|
6568
6798
|
if (autoStart && !isStreaming && !isComplete) {
|
|
6569
6799
|
startStreaming();
|
|
6570
6800
|
}
|
|
@@ -6625,7 +6855,7 @@ function Stream({
|
|
|
6625
6855
|
plain: "text-neutral-900 dark:text-neutral-100"
|
|
6626
6856
|
};
|
|
6627
6857
|
if (!isStreaming && !isComplete) {
|
|
6628
|
-
return /* @__PURE__ */
|
|
6858
|
+
return /* @__PURE__ */ jsx34("div", { className: cn("p-4", className), children: /* @__PURE__ */ jsx34(
|
|
6629
6859
|
"button",
|
|
6630
6860
|
{
|
|
6631
6861
|
onClick: startStreaming,
|
|
@@ -6634,19 +6864,19 @@ function Stream({
|
|
|
6634
6864
|
}
|
|
6635
6865
|
) });
|
|
6636
6866
|
}
|
|
6637
|
-
return /* @__PURE__ */
|
|
6867
|
+
return /* @__PURE__ */ jsxs28("div", { className: cn(variantClasses[variant], className), children: [
|
|
6638
6868
|
text,
|
|
6639
|
-
isStreaming && showCursor && /* @__PURE__ */
|
|
6869
|
+
isStreaming && showCursor && /* @__PURE__ */ jsx34("span", { className: "apteva-stream-cursor" })
|
|
6640
6870
|
] });
|
|
6641
6871
|
}
|
|
6642
6872
|
|
|
6643
6873
|
// src/components/Threads/ThreadList.tsx
|
|
6644
|
-
import { useState as
|
|
6874
|
+
import { useState as useState16 } from "react";
|
|
6645
6875
|
|
|
6646
6876
|
// src/components/Threads/ThreadItem.tsx
|
|
6647
|
-
import { jsx as
|
|
6877
|
+
import { jsx as jsx35, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
6648
6878
|
function ThreadItem({ thread, isActive = false, onSelect, onDelete }) {
|
|
6649
|
-
return /* @__PURE__ */
|
|
6879
|
+
return /* @__PURE__ */ jsxs29(
|
|
6650
6880
|
"div",
|
|
6651
6881
|
{
|
|
6652
6882
|
className: cn("apteva-thread-item", {
|
|
@@ -6654,19 +6884,19 @@ function ThreadItem({ thread, isActive = false, onSelect, onDelete }) {
|
|
|
6654
6884
|
}),
|
|
6655
6885
|
onClick: onSelect,
|
|
6656
6886
|
children: [
|
|
6657
|
-
/* @__PURE__ */
|
|
6658
|
-
/* @__PURE__ */
|
|
6659
|
-
thread.preview && /* @__PURE__ */
|
|
6660
|
-
/* @__PURE__ */
|
|
6661
|
-
/* @__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: [
|
|
6662
6892
|
thread.messageCount,
|
|
6663
6893
|
" messages"
|
|
6664
6894
|
] }),
|
|
6665
|
-
/* @__PURE__ */
|
|
6666
|
-
/* @__PURE__ */
|
|
6895
|
+
/* @__PURE__ */ jsx35("span", { children: "\u2022" }),
|
|
6896
|
+
/* @__PURE__ */ jsx35("span", { children: formatRelativeTime(thread.updatedAt) })
|
|
6667
6897
|
] })
|
|
6668
6898
|
] }),
|
|
6669
|
-
onDelete && /* @__PURE__ */
|
|
6899
|
+
onDelete && /* @__PURE__ */ jsx35(
|
|
6670
6900
|
"button",
|
|
6671
6901
|
{
|
|
6672
6902
|
onClick: (e) => {
|
|
@@ -6696,7 +6926,7 @@ function formatRelativeTime(date) {
|
|
|
6696
6926
|
}
|
|
6697
6927
|
|
|
6698
6928
|
// src/components/Threads/ThreadList.tsx
|
|
6699
|
-
import { jsx as
|
|
6929
|
+
import { jsx as jsx36, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
6700
6930
|
function ThreadList({
|
|
6701
6931
|
threads,
|
|
6702
6932
|
currentThreadId,
|
|
@@ -6705,13 +6935,13 @@ function ThreadList({
|
|
|
6705
6935
|
showSearch = false,
|
|
6706
6936
|
groupBy = "none"
|
|
6707
6937
|
}) {
|
|
6708
|
-
const [searchQuery, setSearchQuery] =
|
|
6938
|
+
const [searchQuery, setSearchQuery] = useState16("");
|
|
6709
6939
|
const filteredThreads = threads.filter(
|
|
6710
6940
|
(thread) => thread.title.toLowerCase().includes(searchQuery.toLowerCase()) || thread.preview?.toLowerCase().includes(searchQuery.toLowerCase())
|
|
6711
6941
|
);
|
|
6712
6942
|
const groupedThreads = groupBy === "date" ? groupThreadsByDate(filteredThreads) : { All: filteredThreads };
|
|
6713
|
-
return /* @__PURE__ */
|
|
6714
|
-
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(
|
|
6715
6945
|
"input",
|
|
6716
6946
|
{
|
|
6717
6947
|
type: "text",
|
|
@@ -6721,10 +6951,10 @@ function ThreadList({
|
|
|
6721
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"
|
|
6722
6952
|
}
|
|
6723
6953
|
) }),
|
|
6724
|
-
/* @__PURE__ */
|
|
6725
|
-
Object.entries(groupedThreads).map(([group, groupThreads]) => /* @__PURE__ */
|
|
6726
|
-
groupBy !== "none" && /* @__PURE__ */
|
|
6727
|
-
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(
|
|
6728
6958
|
ThreadItem,
|
|
6729
6959
|
{
|
|
6730
6960
|
thread,
|
|
@@ -6735,9 +6965,9 @@ function ThreadList({
|
|
|
6735
6965
|
thread.id
|
|
6736
6966
|
))
|
|
6737
6967
|
] }, group)),
|
|
6738
|
-
filteredThreads.length === 0 && /* @__PURE__ */
|
|
6739
|
-
/* @__PURE__ */
|
|
6740
|
-
/* @__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" })
|
|
6741
6971
|
] })
|
|
6742
6972
|
] })
|
|
6743
6973
|
] });
|
|
@@ -6769,7 +6999,7 @@ function groupThreadsByDate(threads) {
|
|
|
6769
6999
|
}
|
|
6770
7000
|
|
|
6771
7001
|
// src/components/Threads/Threads.tsx
|
|
6772
|
-
import { jsx as
|
|
7002
|
+
import { jsx as jsx37, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
6773
7003
|
function Threads({
|
|
6774
7004
|
threads,
|
|
6775
7005
|
currentThreadId,
|
|
@@ -6788,8 +7018,8 @@ function Threads({
|
|
|
6788
7018
|
tabs: "flex gap-2 border-b border-neutral-200 dark:border-neutral-700 overflow-x-auto"
|
|
6789
7019
|
};
|
|
6790
7020
|
if (variant === "tabs") {
|
|
6791
|
-
return /* @__PURE__ */
|
|
6792
|
-
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(
|
|
6793
7023
|
"button",
|
|
6794
7024
|
{
|
|
6795
7025
|
onClick: () => onThreadSelect?.(thread.id),
|
|
@@ -6801,7 +7031,7 @@ function Threads({
|
|
|
6801
7031
|
},
|
|
6802
7032
|
thread.id
|
|
6803
7033
|
)),
|
|
6804
|
-
showNewButton && onNewThread && /* @__PURE__ */
|
|
7034
|
+
showNewButton && onNewThread && /* @__PURE__ */ jsx37(
|
|
6805
7035
|
"button",
|
|
6806
7036
|
{
|
|
6807
7037
|
onClick: onNewThread,
|
|
@@ -6811,8 +7041,8 @@ function Threads({
|
|
|
6811
7041
|
)
|
|
6812
7042
|
] });
|
|
6813
7043
|
}
|
|
6814
|
-
return /* @__PURE__ */
|
|
6815
|
-
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(
|
|
6816
7046
|
"button",
|
|
6817
7047
|
{
|
|
6818
7048
|
onClick: onNewThread,
|
|
@@ -6820,7 +7050,7 @@ function Threads({
|
|
|
6820
7050
|
children: "+ New Conversation"
|
|
6821
7051
|
}
|
|
6822
7052
|
) }),
|
|
6823
|
-
/* @__PURE__ */
|
|
7053
|
+
/* @__PURE__ */ jsx37(
|
|
6824
7054
|
ThreadList,
|
|
6825
7055
|
{
|
|
6826
7056
|
threads,
|
|
@@ -6835,11 +7065,11 @@ function Threads({
|
|
|
6835
7065
|
}
|
|
6836
7066
|
|
|
6837
7067
|
// src/components/AutoInterface/AutoInterface.tsx
|
|
6838
|
-
import { useState as
|
|
7068
|
+
import { useState as useState18, useRef as useRef13, useCallback as useCallback7, useEffect as useEffect15 } from "react";
|
|
6839
7069
|
|
|
6840
7070
|
// src/components/AutoInterface/LayoutRenderer.tsx
|
|
6841
|
-
import { useState as
|
|
6842
|
-
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";
|
|
6843
7073
|
var gapClasses = {
|
|
6844
7074
|
none: "gap-0",
|
|
6845
7075
|
sm: "gap-2",
|
|
@@ -6863,27 +7093,27 @@ function LayoutRenderer({ node, onAction, renderNode }) {
|
|
|
6863
7093
|
const children = node.children || [];
|
|
6864
7094
|
switch (node.layout) {
|
|
6865
7095
|
case "page":
|
|
6866
|
-
return /* @__PURE__ */
|
|
7096
|
+
return /* @__PURE__ */ jsx38(PageLayout, { node, renderNode });
|
|
6867
7097
|
case "row":
|
|
6868
|
-
return /* @__PURE__ */
|
|
7098
|
+
return /* @__PURE__ */ jsx38(RowLayout, { node, renderNode });
|
|
6869
7099
|
case "columns":
|
|
6870
|
-
return /* @__PURE__ */
|
|
7100
|
+
return /* @__PURE__ */ jsx38(ColumnsLayout, { node, renderNode });
|
|
6871
7101
|
case "stack":
|
|
6872
|
-
return /* @__PURE__ */
|
|
7102
|
+
return /* @__PURE__ */ jsx38(StackLayout, { node, renderNode });
|
|
6873
7103
|
case "sidebar":
|
|
6874
|
-
return /* @__PURE__ */
|
|
7104
|
+
return /* @__PURE__ */ jsx38(SidebarLayout, { node, renderNode });
|
|
6875
7105
|
case "tabs":
|
|
6876
|
-
return /* @__PURE__ */
|
|
7106
|
+
return /* @__PURE__ */ jsx38(TabsLayout, { node, renderNode });
|
|
6877
7107
|
default:
|
|
6878
|
-
return /* @__PURE__ */
|
|
7108
|
+
return /* @__PURE__ */ jsx38("div", { className: "space-y-4", children: children.map((child) => /* @__PURE__ */ jsx38("div", { children: renderNode(child) }, child.id)) });
|
|
6879
7109
|
}
|
|
6880
7110
|
}
|
|
6881
7111
|
function PageLayout({ node, renderNode }) {
|
|
6882
7112
|
const { title, padding = "md", maxWidth = "xl" } = node.props || {};
|
|
6883
7113
|
const children = node.children || [];
|
|
6884
|
-
return /* @__PURE__ */
|
|
6885
|
-
title && /* @__PURE__ */
|
|
6886
|
-
/* @__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)) })
|
|
6887
7117
|
] });
|
|
6888
7118
|
}
|
|
6889
7119
|
function RowLayout({ node, renderNode }) {
|
|
@@ -6896,12 +7126,12 @@ function RowLayout({ node, renderNode }) {
|
|
|
6896
7126
|
end: "items-end",
|
|
6897
7127
|
stretch: "items-stretch"
|
|
6898
7128
|
};
|
|
6899
|
-
return /* @__PURE__ */
|
|
7129
|
+
return /* @__PURE__ */ jsx38(
|
|
6900
7130
|
"div",
|
|
6901
7131
|
{
|
|
6902
7132
|
className: cn("grid", gapClasses[gap], alignClasses[align]),
|
|
6903
7133
|
style: { gridTemplateColumns: templateColumns },
|
|
6904
|
-
children: children.map((child) => /* @__PURE__ */
|
|
7134
|
+
children: children.map((child) => /* @__PURE__ */ jsx38("div", { children: renderNode(child) }, child.id))
|
|
6905
7135
|
}
|
|
6906
7136
|
);
|
|
6907
7137
|
}
|
|
@@ -6909,12 +7139,12 @@ function ColumnsLayout({ node, renderNode }) {
|
|
|
6909
7139
|
const { count, gap = "md" } = node.props || {};
|
|
6910
7140
|
const children = node.children || [];
|
|
6911
7141
|
const colCount = count || children.length;
|
|
6912
|
-
return /* @__PURE__ */
|
|
7142
|
+
return /* @__PURE__ */ jsx38(
|
|
6913
7143
|
"div",
|
|
6914
7144
|
{
|
|
6915
7145
|
className: cn("grid", gapClasses[gap]),
|
|
6916
7146
|
style: { gridTemplateColumns: `repeat(${colCount}, 1fr)` },
|
|
6917
|
-
children: children.map((child) => /* @__PURE__ */
|
|
7147
|
+
children: children.map((child) => /* @__PURE__ */ jsx38("div", { children: renderNode(child) }, child.id))
|
|
6918
7148
|
}
|
|
6919
7149
|
);
|
|
6920
7150
|
}
|
|
@@ -6927,14 +7157,14 @@ function StackLayout({ node, renderNode }) {
|
|
|
6927
7157
|
right: "items-end",
|
|
6928
7158
|
stretch: "items-stretch"
|
|
6929
7159
|
};
|
|
6930
|
-
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)) });
|
|
6931
7161
|
}
|
|
6932
7162
|
function SidebarLayout({ node, renderNode }) {
|
|
6933
7163
|
const { side = "left", width = "280px" } = node.props || {};
|
|
6934
7164
|
const children = node.children || [];
|
|
6935
7165
|
const [sidebarChild, ...mainChildren] = side === "left" ? children : [...children].reverse();
|
|
6936
7166
|
if (!sidebarChild) return null;
|
|
6937
|
-
const sidebar = /* @__PURE__ */
|
|
7167
|
+
const sidebar = /* @__PURE__ */ jsx38(
|
|
6938
7168
|
"div",
|
|
6939
7169
|
{
|
|
6940
7170
|
className: "flex-shrink-0 overflow-y-auto border-neutral-200 dark:border-neutral-700",
|
|
@@ -6942,11 +7172,11 @@ function SidebarLayout({ node, renderNode }) {
|
|
|
6942
7172
|
children: renderNode(sidebarChild)
|
|
6943
7173
|
}
|
|
6944
7174
|
);
|
|
6945
|
-
const main = /* @__PURE__ */
|
|
6946
|
-
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: [
|
|
6947
7177
|
sidebar,
|
|
6948
7178
|
main
|
|
6949
|
-
] }) : /* @__PURE__ */
|
|
7179
|
+
] }) : /* @__PURE__ */ jsxs32(Fragment9, { children: [
|
|
6950
7180
|
main,
|
|
6951
7181
|
sidebar
|
|
6952
7182
|
] }) });
|
|
@@ -6954,9 +7184,9 @@ function SidebarLayout({ node, renderNode }) {
|
|
|
6954
7184
|
function TabsLayout({ node, renderNode }) {
|
|
6955
7185
|
const { labels = [], defaultTab = 0 } = node.props || {};
|
|
6956
7186
|
const children = node.children || [];
|
|
6957
|
-
const [activeTab, setActiveTab] =
|
|
6958
|
-
return /* @__PURE__ */
|
|
6959
|
-
/* @__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(
|
|
6960
7190
|
"button",
|
|
6961
7191
|
{
|
|
6962
7192
|
onClick: () => setActiveTab(idx),
|
|
@@ -6973,7 +7203,7 @@ function TabsLayout({ node, renderNode }) {
|
|
|
6973
7203
|
}
|
|
6974
7204
|
|
|
6975
7205
|
// src/components/AutoInterface/InterfaceRenderer.tsx
|
|
6976
|
-
import { Fragment as
|
|
7206
|
+
import { Fragment as Fragment10, jsx as jsx39 } from "react/jsx-runtime";
|
|
6977
7207
|
var STRUCTURAL_KEYS = /* @__PURE__ */ new Set(["type", "id", "layout", "props", "children", "actions", "metadata", "isStreaming"]);
|
|
6978
7208
|
function normalizeNode(n) {
|
|
6979
7209
|
let node = { ...n };
|
|
@@ -7003,7 +7233,7 @@ function InterfaceRenderer({ node, onAction }) {
|
|
|
7003
7233
|
const renderNode = (rawNode) => {
|
|
7004
7234
|
const n = normalizeNode(rawNode);
|
|
7005
7235
|
if (n.type === "layout" && n.layout) {
|
|
7006
|
-
return /* @__PURE__ */
|
|
7236
|
+
return /* @__PURE__ */ jsx39(
|
|
7007
7237
|
LayoutRenderer,
|
|
7008
7238
|
{
|
|
7009
7239
|
node: n,
|
|
@@ -7013,7 +7243,7 @@ function InterfaceRenderer({ node, onAction }) {
|
|
|
7013
7243
|
n.id
|
|
7014
7244
|
);
|
|
7015
7245
|
}
|
|
7016
|
-
return /* @__PURE__ */
|
|
7246
|
+
return /* @__PURE__ */ jsx39(
|
|
7017
7247
|
WidgetRenderer,
|
|
7018
7248
|
{
|
|
7019
7249
|
widget: {
|
|
@@ -7029,33 +7259,33 @@ function InterfaceRenderer({ node, onAction }) {
|
|
|
7029
7259
|
n.id
|
|
7030
7260
|
);
|
|
7031
7261
|
};
|
|
7032
|
-
return /* @__PURE__ */
|
|
7262
|
+
return /* @__PURE__ */ jsx39(Fragment10, { children: renderNode(node) });
|
|
7033
7263
|
}
|
|
7034
7264
|
|
|
7035
7265
|
// src/components/AutoInterface/InterfaceSkeleton.tsx
|
|
7036
|
-
import { jsx as
|
|
7266
|
+
import { jsx as jsx40, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
7037
7267
|
function InterfaceSkeleton({ className }) {
|
|
7038
|
-
return /* @__PURE__ */
|
|
7039
|
-
/* @__PURE__ */
|
|
7040
|
-
/* @__PURE__ */
|
|
7041
|
-
/* @__PURE__ */
|
|
7042
|
-
/* @__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" })
|
|
7043
7273
|
] }, i)) }),
|
|
7044
|
-
/* @__PURE__ */
|
|
7045
|
-
/* @__PURE__ */
|
|
7046
|
-
/* @__PURE__ */
|
|
7047
|
-
/* @__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" })
|
|
7048
7278
|
] }),
|
|
7049
|
-
/* @__PURE__ */
|
|
7050
|
-
/* @__PURE__ */
|
|
7051
|
-
[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))
|
|
7052
7282
|
] })
|
|
7053
7283
|
] })
|
|
7054
7284
|
] });
|
|
7055
7285
|
}
|
|
7056
7286
|
|
|
7057
7287
|
// src/components/AutoInterface/AutoInterface.tsx
|
|
7058
|
-
import { jsx as
|
|
7288
|
+
import { jsx as jsx41, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
7059
7289
|
async function generateInitialInterface(apiUrl, apiKey, agentId, prompt) {
|
|
7060
7290
|
const systemContext = generateCompactInterfaceContext();
|
|
7061
7291
|
const message = `${systemContext}
|
|
@@ -7105,19 +7335,19 @@ function AutoInterface({
|
|
|
7105
7335
|
theme,
|
|
7106
7336
|
className
|
|
7107
7337
|
}) {
|
|
7108
|
-
const [interfaceSpec, setInterfaceSpec] =
|
|
7109
|
-
const [isGenerating, setIsGenerating] =
|
|
7110
|
-
const [chatCollapsed, setChatCollapsed] =
|
|
7111
|
-
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);
|
|
7112
7342
|
const systemContext = [
|
|
7113
7343
|
generateInterfaceContext(),
|
|
7114
7344
|
context || ""
|
|
7115
7345
|
].filter(Boolean).join("\n\n");
|
|
7116
|
-
const updateInterface =
|
|
7346
|
+
const updateInterface = useCallback7((newSpec) => {
|
|
7117
7347
|
setInterfaceSpec(newSpec);
|
|
7118
7348
|
onInterfaceChange?.(newSpec);
|
|
7119
7349
|
}, [onInterfaceChange]);
|
|
7120
|
-
const handleAction =
|
|
7350
|
+
const handleAction = useCallback7((action) => {
|
|
7121
7351
|
onAction?.(action);
|
|
7122
7352
|
if (chatRef.current) {
|
|
7123
7353
|
chatRef.current.sendMessage(
|
|
@@ -7125,7 +7355,7 @@ function AutoInterface({
|
|
|
7125
7355
|
);
|
|
7126
7356
|
}
|
|
7127
7357
|
}, [onAction]);
|
|
7128
|
-
const handleMessageComplete =
|
|
7358
|
+
const handleMessageComplete = useCallback7((result) => {
|
|
7129
7359
|
if (!result?.data) return;
|
|
7130
7360
|
const text = typeof result.data === "string" ? result.data : result.data.message || "";
|
|
7131
7361
|
console.log("[AutoInterface] Chat message complete, text (" + text.length + " chars):", text.substring(0, 300));
|
|
@@ -7146,7 +7376,7 @@ function AutoInterface({
|
|
|
7146
7376
|
}
|
|
7147
7377
|
setIsGenerating(false);
|
|
7148
7378
|
}, [interfaceSpec, updateInterface]);
|
|
7149
|
-
|
|
7379
|
+
useEffect15(() => {
|
|
7150
7380
|
if (!initialPrompt || initialInterface || useMock) return;
|
|
7151
7381
|
if (!apiUrl) return;
|
|
7152
7382
|
let cancelled = false;
|
|
@@ -7175,17 +7405,17 @@ function AutoInterface({
|
|
|
7175
7405
|
}, [initialPrompt]);
|
|
7176
7406
|
const hasInterface = interfaceSpec !== null;
|
|
7177
7407
|
const showSkeleton = isGenerating && !hasInterface;
|
|
7178
|
-
return /* @__PURE__ */
|
|
7408
|
+
return /* @__PURE__ */ jsxs34("div", { className: cn(
|
|
7179
7409
|
"flex h-full bg-neutral-50 dark:bg-black",
|
|
7180
7410
|
chatPosition === "bottom" ? "flex-col" : "flex-row",
|
|
7181
7411
|
className
|
|
7182
7412
|
), children: [
|
|
7183
|
-
/* @__PURE__ */
|
|
7413
|
+
/* @__PURE__ */ jsxs34("div", { className: cn(
|
|
7184
7414
|
"flex-1 overflow-y-auto min-w-0",
|
|
7185
7415
|
hasInterface || showSkeleton ? "" : "hidden"
|
|
7186
7416
|
), children: [
|
|
7187
|
-
showSkeleton && /* @__PURE__ */
|
|
7188
|
-
hasInterface && interfaceSpec && /* @__PURE__ */
|
|
7417
|
+
showSkeleton && /* @__PURE__ */ jsx41(InterfaceSkeleton, {}),
|
|
7418
|
+
hasInterface && interfaceSpec && /* @__PURE__ */ jsx41("div", { className: "p-4", children: /* @__PURE__ */ jsx41(
|
|
7189
7419
|
InterfaceRenderer,
|
|
7190
7420
|
{
|
|
7191
7421
|
node: interfaceSpec.root,
|
|
@@ -7193,16 +7423,16 @@ function AutoInterface({
|
|
|
7193
7423
|
}
|
|
7194
7424
|
) })
|
|
7195
7425
|
] }),
|
|
7196
|
-
chatCollapsible && hasInterface && chatPosition === "right" && /* @__PURE__ */
|
|
7426
|
+
chatCollapsible && hasInterface && chatPosition === "right" && /* @__PURE__ */ jsx41(
|
|
7197
7427
|
"button",
|
|
7198
7428
|
{
|
|
7199
7429
|
onClick: () => setChatCollapsed(!chatCollapsed),
|
|
7200
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",
|
|
7201
7431
|
title: chatCollapsed ? "Show chat" : "Hide chat",
|
|
7202
|
-
children: /* @__PURE__ */
|
|
7432
|
+
children: /* @__PURE__ */ jsx41("span", { className: "!text-xs !text-neutral-500 dark:!text-neutral-400", children: chatCollapsed ? "\u25C0" : "\u25B6" })
|
|
7203
7433
|
}
|
|
7204
7434
|
),
|
|
7205
|
-
/* @__PURE__ */
|
|
7435
|
+
/* @__PURE__ */ jsx41(
|
|
7206
7436
|
"div",
|
|
7207
7437
|
{
|
|
7208
7438
|
className: cn(
|
|
@@ -7213,7 +7443,7 @@ function AutoInterface({
|
|
|
7213
7443
|
!hasInterface && !showSkeleton && "flex-1"
|
|
7214
7444
|
),
|
|
7215
7445
|
style: hasInterface || showSkeleton ? chatPosition === "right" ? { width: chatWidth } : { height: "300px" } : void 0,
|
|
7216
|
-
children: /* @__PURE__ */
|
|
7446
|
+
children: /* @__PURE__ */ jsx41(
|
|
7217
7447
|
Chat,
|
|
7218
7448
|
{
|
|
7219
7449
|
ref: chatRef,
|
|
@@ -7271,29 +7501,29 @@ function getThemeScript() {
|
|
|
7271
7501
|
}
|
|
7272
7502
|
|
|
7273
7503
|
// src/hooks/useInterfaceState.ts
|
|
7274
|
-
import { useState as
|
|
7504
|
+
import { useState as useState19, useCallback as useCallback8 } from "react";
|
|
7275
7505
|
function useInterfaceState(initialSpec) {
|
|
7276
|
-
const [spec, setSpec] =
|
|
7277
|
-
const [isStreaming, setIsStreaming] =
|
|
7278
|
-
const setInterface =
|
|
7506
|
+
const [spec, setSpec] = useState19(initialSpec || null);
|
|
7507
|
+
const [isStreaming, setIsStreaming] = useState19(false);
|
|
7508
|
+
const setInterface = useCallback8((newSpec) => {
|
|
7279
7509
|
setSpec(newSpec);
|
|
7280
7510
|
}, []);
|
|
7281
|
-
const clearInterface =
|
|
7511
|
+
const clearInterface = useCallback8(() => {
|
|
7282
7512
|
setSpec(null);
|
|
7283
7513
|
}, []);
|
|
7284
|
-
const applyInterfaceUpdate =
|
|
7514
|
+
const applyInterfaceUpdate = useCallback8((update) => {
|
|
7285
7515
|
setSpec((prev) => {
|
|
7286
7516
|
if (!prev) return prev;
|
|
7287
7517
|
return applyUpdate(prev, update);
|
|
7288
7518
|
});
|
|
7289
7519
|
}, []);
|
|
7290
|
-
const applyInterfaceUpdates =
|
|
7520
|
+
const applyInterfaceUpdates = useCallback8((updates) => {
|
|
7291
7521
|
setSpec((prev) => {
|
|
7292
7522
|
if (!prev) return prev;
|
|
7293
7523
|
return applyUpdates(prev, updates);
|
|
7294
7524
|
});
|
|
7295
7525
|
}, []);
|
|
7296
|
-
const getNode =
|
|
7526
|
+
const getNode = useCallback8((id) => {
|
|
7297
7527
|
if (!spec) return null;
|
|
7298
7528
|
return findNode(spec.root, id);
|
|
7299
7529
|
}, [spec]);
|
|
@@ -7310,7 +7540,7 @@ function useInterfaceState(initialSpec) {
|
|
|
7310
7540
|
}
|
|
7311
7541
|
|
|
7312
7542
|
// src/hooks/useInterfaceAI.ts
|
|
7313
|
-
import { useCallback as
|
|
7543
|
+
import { useCallback as useCallback9, useRef as useRef14 } from "react";
|
|
7314
7544
|
function useInterfaceAI({
|
|
7315
7545
|
agentId,
|
|
7316
7546
|
apiUrl,
|
|
@@ -7322,15 +7552,15 @@ function useInterfaceAI({
|
|
|
7322
7552
|
onStreamStart,
|
|
7323
7553
|
onStreamEnd
|
|
7324
7554
|
}) {
|
|
7325
|
-
const threadIdRef =
|
|
7326
|
-
const accumulatedTextRef =
|
|
7555
|
+
const threadIdRef = useRef14(null);
|
|
7556
|
+
const accumulatedTextRef = useRef14("");
|
|
7327
7557
|
if (apiUrl || apiKey) {
|
|
7328
7558
|
aptevaClient.configure({
|
|
7329
7559
|
...apiUrl && { apiUrl },
|
|
7330
7560
|
...apiKey && { apiKey }
|
|
7331
7561
|
});
|
|
7332
7562
|
}
|
|
7333
|
-
const sendMessage =
|
|
7563
|
+
const sendMessage = useCallback9(async (message) => {
|
|
7334
7564
|
accumulatedTextRef.current = "";
|
|
7335
7565
|
onStreamStart?.();
|
|
7336
7566
|
const systemPrompt = [
|
|
@@ -7387,6 +7617,7 @@ export {
|
|
|
7387
7617
|
AptevaClient,
|
|
7388
7618
|
AutoInterface,
|
|
7389
7619
|
Button,
|
|
7620
|
+
Call,
|
|
7390
7621
|
Card,
|
|
7391
7622
|
Chat,
|
|
7392
7623
|
Command,
|