@ash-cloud/ash-ui 0.0.7 → 0.0.8
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/icons.cjs +7 -0
- package/dist/icons.cjs.map +1 -1
- package/dist/icons.d.cts +2 -1
- package/dist/icons.d.ts +2 -1
- package/dist/icons.js +7 -1
- package/dist/icons.js.map +1 -1
- package/dist/index.cjs +245 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +65 -9
- package/dist/index.d.ts +65 -9
- package/dist/index.js +242 -10
- package/dist/index.js.map +1 -1
- package/dist/styles-full.css +1 -1
- package/dist/styles.css +1 -1
- package/dist/types.cjs +4 -0
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +33 -2
- package/dist/types.d.ts +33 -2
- package/dist/types.js +4 -1
- package/dist/types.js.map +1 -1
- package/dist/utils.cjs +34 -0
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.d.cts +8 -1
- package/dist/utils.d.ts +8 -1
- package/dist/utils.js +34 -1
- package/dist/utils.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { createContext, useState, useMemo,
|
|
1
|
+
import { lazy, createContext, useState, useRef, useMemo, useEffect, Suspense, useCallback, useContext } from 'react';
|
|
2
2
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
3
|
-
import ReactMarkdown from 'react-markdown';
|
|
4
3
|
|
|
5
4
|
// src/components/ToolCallCard.tsx
|
|
6
5
|
|
|
@@ -109,6 +108,16 @@ function mapToolToActionType(toolName, input) {
|
|
|
109
108
|
stats
|
|
110
109
|
};
|
|
111
110
|
}
|
|
111
|
+
case "Task": {
|
|
112
|
+
return {
|
|
113
|
+
action: "agent_tool",
|
|
114
|
+
agentType: inputObj.subagent_type || "general-purpose",
|
|
115
|
+
description: inputObj.description || "",
|
|
116
|
+
prompt: inputObj.prompt,
|
|
117
|
+
startedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
118
|
+
toolCallCount: 0
|
|
119
|
+
};
|
|
120
|
+
}
|
|
112
121
|
default: {
|
|
113
122
|
const mcpParts = parseMcpToolName(toolName);
|
|
114
123
|
if (mcpParts) {
|
|
@@ -158,6 +167,8 @@ function generateToolSummary(_toolName, _input, actionType) {
|
|
|
158
167
|
}
|
|
159
168
|
return `${actionType.todos.length} tasks`;
|
|
160
169
|
}
|
|
170
|
+
case "agent_tool":
|
|
171
|
+
return actionType.description;
|
|
161
172
|
default:
|
|
162
173
|
return "Unknown tool";
|
|
163
174
|
}
|
|
@@ -225,6 +236,7 @@ function createToolCall(toolUse) {
|
|
|
225
236
|
actionType,
|
|
226
237
|
status: "pending",
|
|
227
238
|
summary,
|
|
239
|
+
input: toolUse.input,
|
|
228
240
|
startedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
229
241
|
};
|
|
230
242
|
}
|
|
@@ -234,6 +246,7 @@ function updateToolCallWithResult(toolCall, content, isError) {
|
|
|
234
246
|
updatedToolCall.status = isError ? "failed" : "success";
|
|
235
247
|
updatedToolCall.completedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
236
248
|
updatedToolCall.isError = isError;
|
|
249
|
+
updatedToolCall.output = content;
|
|
237
250
|
if (actionType.action === "command_run") {
|
|
238
251
|
const result = parseCommandResult(content);
|
|
239
252
|
actionType.result = result;
|
|
@@ -271,6 +284,8 @@ function getActionIcon(actionType) {
|
|
|
271
284
|
return "tool";
|
|
272
285
|
case "todo_write":
|
|
273
286
|
return "list-checks";
|
|
287
|
+
case "agent_tool":
|
|
288
|
+
return "bot";
|
|
274
289
|
default:
|
|
275
290
|
return "tool";
|
|
276
291
|
}
|
|
@@ -299,6 +314,8 @@ function getActionLabel(actionType) {
|
|
|
299
314
|
return "Tool";
|
|
300
315
|
case "todo_write":
|
|
301
316
|
return "Tasks";
|
|
317
|
+
case "agent_tool":
|
|
318
|
+
return actionType.agentType;
|
|
302
319
|
default:
|
|
303
320
|
return "Tool";
|
|
304
321
|
}
|
|
@@ -321,6 +338,21 @@ function formatTimestamp(timestamp) {
|
|
|
321
338
|
return timestamp;
|
|
322
339
|
}
|
|
323
340
|
}
|
|
341
|
+
function formatElapsedTime(startTime, endTime) {
|
|
342
|
+
const start = typeof startTime === "string" ? new Date(startTime) : startTime;
|
|
343
|
+
const end = endTime ? typeof endTime === "string" ? new Date(endTime) : endTime : /* @__PURE__ */ new Date();
|
|
344
|
+
const elapsedMs = end.getTime() - start.getTime();
|
|
345
|
+
const elapsedSeconds = Math.floor(elapsedMs / 1e3);
|
|
346
|
+
if (elapsedSeconds < 60) {
|
|
347
|
+
return `${elapsedSeconds}s`;
|
|
348
|
+
}
|
|
349
|
+
const minutes = Math.floor(elapsedSeconds / 60);
|
|
350
|
+
const seconds = elapsedSeconds % 60;
|
|
351
|
+
if (seconds === 0) {
|
|
352
|
+
return `${minutes}m`;
|
|
353
|
+
}
|
|
354
|
+
return `${minutes}m ${seconds}s`;
|
|
355
|
+
}
|
|
324
356
|
function truncate(str, maxLength) {
|
|
325
357
|
if (str.length <= maxLength) return str;
|
|
326
358
|
return str.substring(0, maxLength - 3) + "...";
|
|
@@ -644,6 +676,12 @@ function ClipboardListIcon({ className }) {
|
|
|
644
676
|
/* @__PURE__ */ jsx("path", { d: "M8 16h.01" })
|
|
645
677
|
] });
|
|
646
678
|
}
|
|
679
|
+
function ClockIcon({ className }) {
|
|
680
|
+
return /* @__PURE__ */ jsxs("svg", { className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
|
|
681
|
+
/* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "10" }),
|
|
682
|
+
/* @__PURE__ */ jsx("polyline", { points: "12 6 12 12 16 14" })
|
|
683
|
+
] });
|
|
684
|
+
}
|
|
647
685
|
function SpinnerIcon({ className }) {
|
|
648
686
|
return /* @__PURE__ */ jsx("svg", { className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx("path", { d: "M21 12a9 9 0 1 1-6.219-8.56" }) });
|
|
649
687
|
}
|
|
@@ -699,6 +737,8 @@ function ActionIcon({ actionType, className = "w-4 h-4" }) {
|
|
|
699
737
|
return /* @__PURE__ */ jsx(PlugIcon, { className });
|
|
700
738
|
case "todo_write":
|
|
701
739
|
return /* @__PURE__ */ jsx(ListChecksIcon, { className });
|
|
740
|
+
case "agent_tool":
|
|
741
|
+
return /* @__PURE__ */ jsx(BotIcon, { className });
|
|
702
742
|
case "generic_tool":
|
|
703
743
|
default:
|
|
704
744
|
return /* @__PURE__ */ jsx(ToolIcon, { className });
|
|
@@ -752,6 +792,153 @@ function JsonDisplay({ value, maxHeight, className }) {
|
|
|
752
792
|
const formatted = JSON.stringify(value, null, 2);
|
|
753
793
|
return /* @__PURE__ */ jsx(CodeBlock, { maxHeight, className, children: formatted });
|
|
754
794
|
}
|
|
795
|
+
function AgentToolCard({
|
|
796
|
+
toolCall,
|
|
797
|
+
defaultExpanded = false,
|
|
798
|
+
className,
|
|
799
|
+
depth = 0
|
|
800
|
+
}) {
|
|
801
|
+
const [expanded, setExpanded] = useState(defaultExpanded);
|
|
802
|
+
const [elapsedTime, setElapsedTime] = useState("");
|
|
803
|
+
const intervalRef = useRef(null);
|
|
804
|
+
const { actionType, status, summary, nestedToolCalls, nestedToolCallCount, startedAt } = toolCall;
|
|
805
|
+
const agentData = useMemo(() => {
|
|
806
|
+
if (actionType.action !== "agent_tool") {
|
|
807
|
+
return null;
|
|
808
|
+
}
|
|
809
|
+
const agentAction = actionType;
|
|
810
|
+
return {
|
|
811
|
+
agentType: agentAction.agentType,
|
|
812
|
+
description: agentAction.description,
|
|
813
|
+
prompt: agentAction.prompt
|
|
814
|
+
};
|
|
815
|
+
}, [actionType]);
|
|
816
|
+
const toolCount = nestedToolCallCount ?? nestedToolCalls?.length ?? 0;
|
|
817
|
+
const isRunning = status === "pending";
|
|
818
|
+
useEffect(() => {
|
|
819
|
+
if (isRunning && startedAt) {
|
|
820
|
+
setElapsedTime(formatElapsedTime(startedAt));
|
|
821
|
+
intervalRef.current = setInterval(() => {
|
|
822
|
+
setElapsedTime(formatElapsedTime(startedAt));
|
|
823
|
+
}, 1e3);
|
|
824
|
+
return () => {
|
|
825
|
+
if (intervalRef.current) {
|
|
826
|
+
clearInterval(intervalRef.current);
|
|
827
|
+
intervalRef.current = null;
|
|
828
|
+
}
|
|
829
|
+
};
|
|
830
|
+
} else if (!isRunning) {
|
|
831
|
+
if (intervalRef.current) {
|
|
832
|
+
clearInterval(intervalRef.current);
|
|
833
|
+
intervalRef.current = null;
|
|
834
|
+
}
|
|
835
|
+
setElapsedTime("");
|
|
836
|
+
}
|
|
837
|
+
return void 0;
|
|
838
|
+
}, [isRunning, startedAt]);
|
|
839
|
+
if (!agentData) {
|
|
840
|
+
return null;
|
|
841
|
+
}
|
|
842
|
+
const { agentType, description, prompt } = agentData;
|
|
843
|
+
const indentClass = depth > 0 ? "ml-4" : "";
|
|
844
|
+
return /* @__PURE__ */ jsxs(
|
|
845
|
+
"div",
|
|
846
|
+
{
|
|
847
|
+
className: cn(
|
|
848
|
+
"rounded-xl border bg-[var(--ash-surface-dark,#0a0a0a)] overflow-hidden",
|
|
849
|
+
isRunning ? "border-yellow-500/30" : status === "failed" ? "border-red-500/30" : "border-white/10",
|
|
850
|
+
indentClass,
|
|
851
|
+
className
|
|
852
|
+
),
|
|
853
|
+
children: [
|
|
854
|
+
/* @__PURE__ */ jsxs(
|
|
855
|
+
"button",
|
|
856
|
+
{
|
|
857
|
+
onClick: () => setExpanded(!expanded),
|
|
858
|
+
className: "w-full px-4 py-3 flex items-center gap-3 hover:bg-white/5 cursor-pointer transition-colors",
|
|
859
|
+
children: [
|
|
860
|
+
/* @__PURE__ */ jsx(
|
|
861
|
+
ChevronRightIcon,
|
|
862
|
+
{
|
|
863
|
+
className: cn(
|
|
864
|
+
"w-4 h-4 text-white/40 transition-transform duration-200 shrink-0",
|
|
865
|
+
expanded && "rotate-90"
|
|
866
|
+
)
|
|
867
|
+
}
|
|
868
|
+
),
|
|
869
|
+
/* @__PURE__ */ jsx(
|
|
870
|
+
"div",
|
|
871
|
+
{
|
|
872
|
+
className: cn(
|
|
873
|
+
"w-6 h-6 rounded-lg flex items-center justify-center shrink-0",
|
|
874
|
+
isRunning ? "bg-yellow-500/20" : status === "failed" ? "bg-red-500/20" : "bg-[var(--ash-accent)]/20"
|
|
875
|
+
),
|
|
876
|
+
children: isRunning ? /* @__PURE__ */ jsx(
|
|
877
|
+
SpinnerIcon,
|
|
878
|
+
{
|
|
879
|
+
className: "w-3.5 h-3.5 text-yellow-400 animate-spin"
|
|
880
|
+
}
|
|
881
|
+
) : /* @__PURE__ */ jsx(
|
|
882
|
+
BotIcon,
|
|
883
|
+
{
|
|
884
|
+
className: cn(
|
|
885
|
+
"w-3.5 h-3.5",
|
|
886
|
+
status === "failed" ? "text-red-400" : "text-[var(--ash-accent)]"
|
|
887
|
+
)
|
|
888
|
+
}
|
|
889
|
+
)
|
|
890
|
+
}
|
|
891
|
+
),
|
|
892
|
+
/* @__PURE__ */ jsx(
|
|
893
|
+
"span",
|
|
894
|
+
{
|
|
895
|
+
className: cn(
|
|
896
|
+
"px-2 py-0.5 rounded text-xs font-medium shrink-0",
|
|
897
|
+
isRunning ? "bg-yellow-500/20 text-yellow-400" : status === "failed" ? "bg-red-500/20 text-red-400" : "bg-white/10 text-white/70"
|
|
898
|
+
),
|
|
899
|
+
children: agentType
|
|
900
|
+
}
|
|
901
|
+
),
|
|
902
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm text-white/80 truncate flex-1 text-left", children: description || summary }),
|
|
903
|
+
toolCount > 0 && /* @__PURE__ */ jsxs("span", { className: "text-xs text-white/50 shrink-0", children: [
|
|
904
|
+
toolCount,
|
|
905
|
+
" tool call",
|
|
906
|
+
toolCount !== 1 ? "s" : ""
|
|
907
|
+
] }),
|
|
908
|
+
isRunning && elapsedTime && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1 text-xs text-white/40 shrink-0", children: [
|
|
909
|
+
/* @__PURE__ */ jsx(ClockIcon, { className: "w-3 h-3" }),
|
|
910
|
+
/* @__PURE__ */ jsx("span", { children: elapsedTime })
|
|
911
|
+
] }),
|
|
912
|
+
/* @__PURE__ */ jsx("span", { className: "text-white/30 shrink-0", children: "..." })
|
|
913
|
+
]
|
|
914
|
+
}
|
|
915
|
+
),
|
|
916
|
+
expanded && /* @__PURE__ */ jsxs("div", { className: "border-t border-white/5 bg-black/20", children: [
|
|
917
|
+
prompt && /* @__PURE__ */ jsx("div", { className: "px-4 py-3 border-b border-white/5", children: /* @__PURE__ */ jsx("p", { className: "text-sm text-white/70 whitespace-pre-wrap", children: prompt.length > 500 ? prompt.substring(0, 500) + "..." : prompt }) }),
|
|
918
|
+
nestedToolCalls && nestedToolCalls.length > 0 && /* @__PURE__ */ jsx("div", { className: "p-3 space-y-2", children: nestedToolCalls.map((nestedCall) => /* @__PURE__ */ jsx("div", { children: nestedCall.actionType.action === "agent_tool" ? /* @__PURE__ */ jsx(
|
|
919
|
+
AgentToolCard,
|
|
920
|
+
{
|
|
921
|
+
toolCall: nestedCall,
|
|
922
|
+
defaultExpanded: false,
|
|
923
|
+
depth: depth + 1
|
|
924
|
+
}
|
|
925
|
+
) : /* @__PURE__ */ jsx(
|
|
926
|
+
ToolCallCard,
|
|
927
|
+
{
|
|
928
|
+
toolCall: nestedCall,
|
|
929
|
+
defaultExpanded: false
|
|
930
|
+
}
|
|
931
|
+
) }, nestedCall.id)) }),
|
|
932
|
+
(!nestedToolCalls || nestedToolCalls.length === 0) && isRunning && /* @__PURE__ */ jsx("div", { className: "px-4 py-6 flex items-center justify-center", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-sm text-white/40", children: [
|
|
933
|
+
/* @__PURE__ */ jsx(SpinnerIcon, { className: "w-4 h-4 animate-spin" }),
|
|
934
|
+
/* @__PURE__ */ jsx("span", { children: "Agent is working..." })
|
|
935
|
+
] }) }),
|
|
936
|
+
(!nestedToolCalls || nestedToolCalls.length === 0) && !isRunning && /* @__PURE__ */ jsx("div", { className: "px-4 py-4 text-sm text-white/40 text-center", children: "No tool calls recorded" })
|
|
937
|
+
] })
|
|
938
|
+
]
|
|
939
|
+
}
|
|
940
|
+
);
|
|
941
|
+
}
|
|
755
942
|
function SectionHeader({ children }) {
|
|
756
943
|
return /* @__PURE__ */ jsx("div", { className: "ash-tool-section-header", children });
|
|
757
944
|
}
|
|
@@ -1027,6 +1214,9 @@ function hasDetails(actionType) {
|
|
|
1027
1214
|
return Boolean(actionType.arguments || actionType.result);
|
|
1028
1215
|
case "todo_write":
|
|
1029
1216
|
return actionType.todos.length > 0;
|
|
1217
|
+
case "agent_tool":
|
|
1218
|
+
return true;
|
|
1219
|
+
// Always expandable (handled by AgentToolCard)
|
|
1030
1220
|
default:
|
|
1031
1221
|
return false;
|
|
1032
1222
|
}
|
|
@@ -1034,6 +1224,16 @@ function hasDetails(actionType) {
|
|
|
1034
1224
|
function ToolCallCard({ toolCall, defaultExpanded = false, className }) {
|
|
1035
1225
|
const [expanded, setExpanded] = useState(defaultExpanded);
|
|
1036
1226
|
const { actionType, status, summary } = toolCall;
|
|
1227
|
+
if (actionType.action === "agent_tool") {
|
|
1228
|
+
return /* @__PURE__ */ jsx(
|
|
1229
|
+
AgentToolCard,
|
|
1230
|
+
{
|
|
1231
|
+
toolCall,
|
|
1232
|
+
defaultExpanded,
|
|
1233
|
+
className
|
|
1234
|
+
}
|
|
1235
|
+
);
|
|
1236
|
+
}
|
|
1037
1237
|
const canExpand = hasDetails(actionType);
|
|
1038
1238
|
const statusClasses = {
|
|
1039
1239
|
pending: "border-yellow-500/30 ash-tool-status-pending",
|
|
@@ -1102,6 +1302,17 @@ function ToolCallCard({ toolCall, defaultExpanded = false, className }) {
|
|
|
1102
1302
|
}
|
|
1103
1303
|
);
|
|
1104
1304
|
}
|
|
1305
|
+
var ReactMarkdown = lazy(() => import('react-markdown'));
|
|
1306
|
+
function LazyMarkdown({ children, fallback, className }) {
|
|
1307
|
+
const [mounted, setMounted] = useState(false);
|
|
1308
|
+
useEffect(() => {
|
|
1309
|
+
setMounted(true);
|
|
1310
|
+
}, []);
|
|
1311
|
+
if (!mounted) {
|
|
1312
|
+
return /* @__PURE__ */ jsx("span", { className, children: fallback ?? children });
|
|
1313
|
+
}
|
|
1314
|
+
return /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("span", { className, children: fallback ?? children }), children: /* @__PURE__ */ jsx(ReactMarkdown, { children }) });
|
|
1315
|
+
}
|
|
1105
1316
|
function OptionCards({ options, onSelect, className }) {
|
|
1106
1317
|
return /* @__PURE__ */ jsx("div", { className: cn("grid gap-2 mt-3", className), style: {
|
|
1107
1318
|
gridTemplateColumns: "repeat(auto-fit, minmax(200px, 1fr))"
|
|
@@ -1197,7 +1408,7 @@ function AssistantMessage({ entry, onOptionSelect, className }) {
|
|
|
1197
1408
|
/* @__PURE__ */ jsx("div", { className: "w-7 h-7 rounded-full bg-[var(--ash-accent)]/20 flex items-center justify-center shrink-0", children: /* @__PURE__ */ jsx(BotIcon, { className: "w-4 h-4 text-[var(--ash-accent)]" }) }),
|
|
1198
1409
|
/* @__PURE__ */ jsxs("div", { className: "flex-1 max-w-[85%]", children: [
|
|
1199
1410
|
/* @__PURE__ */ jsx("div", { className: "ash-card-glass rounded-2xl p-4", children: /* @__PURE__ */ jsx("div", { className: "ash-message-content prose prose-sm prose-invert max-w-none text-sm leading-relaxed", children: parsedOptions ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1200
|
-
parsedOptions.preamble && /* @__PURE__ */ jsx(
|
|
1411
|
+
parsedOptions.preamble && /* @__PURE__ */ jsx(LazyMarkdown, { children: parsedOptions.preamble }),
|
|
1201
1412
|
/* @__PURE__ */ jsx(
|
|
1202
1413
|
OptionCards,
|
|
1203
1414
|
{
|
|
@@ -1205,7 +1416,7 @@ function AssistantMessage({ entry, onOptionSelect, className }) {
|
|
|
1205
1416
|
onSelect: handleOptionSelect
|
|
1206
1417
|
}
|
|
1207
1418
|
)
|
|
1208
|
-
] }) : /* @__PURE__ */ jsx(
|
|
1419
|
+
] }) : /* @__PURE__ */ jsx(LazyMarkdown, { children: entry.content }) }) }),
|
|
1209
1420
|
entry.timestamp && /* @__PURE__ */ jsx("div", { className: "text-xs text-white/40 mt-2", children: formatTimestamp(entry.timestamp) })
|
|
1210
1421
|
] })
|
|
1211
1422
|
] });
|
|
@@ -1240,7 +1451,7 @@ function ErrorMessage({ entry, className }) {
|
|
|
1240
1451
|
] }) })
|
|
1241
1452
|
] });
|
|
1242
1453
|
}
|
|
1243
|
-
function MessageEntry({ entry, onOptionSelect, className }) {
|
|
1454
|
+
function MessageEntry({ entry, onOptionSelect, defaultExpanded, className }) {
|
|
1244
1455
|
switch (entry.entryType.type) {
|
|
1245
1456
|
case "user_message":
|
|
1246
1457
|
return /* @__PURE__ */ jsx(UserMessage, { entry, className });
|
|
@@ -1249,7 +1460,7 @@ function MessageEntry({ entry, onOptionSelect, className }) {
|
|
|
1249
1460
|
case "thinking":
|
|
1250
1461
|
return /* @__PURE__ */ jsx(ThinkingMessage, { entry, className });
|
|
1251
1462
|
case "tool_call":
|
|
1252
|
-
return /* @__PURE__ */ jsx(ToolCallMessage, { entry, className });
|
|
1463
|
+
return /* @__PURE__ */ jsx(ToolCallMessage, { entry, defaultExpanded, className });
|
|
1253
1464
|
case "error":
|
|
1254
1465
|
return /* @__PURE__ */ jsx(ErrorMessage, { entry, className });
|
|
1255
1466
|
default:
|
|
@@ -1311,7 +1522,7 @@ function StreamingText({
|
|
|
1311
1522
|
className
|
|
1312
1523
|
}) {
|
|
1313
1524
|
return /* @__PURE__ */ jsx("div", { className: cn("relative", className), children: renderMarkdown ? /* @__PURE__ */ jsxs("div", { className: "ash-message-content prose prose-sm prose-invert max-w-none text-sm leading-relaxed", children: [
|
|
1314
|
-
/* @__PURE__ */ jsx(
|
|
1525
|
+
/* @__PURE__ */ jsx(LazyMarkdown, { children: content }),
|
|
1315
1526
|
isStreaming && /* @__PURE__ */ jsx(LoadingIndicator, { variant: "cursor", size: "sm", className: "inline-block ml-0.5" })
|
|
1316
1527
|
] }) : /* @__PURE__ */ jsxs("p", { className: "whitespace-pre-wrap text-sm leading-relaxed", children: [
|
|
1317
1528
|
content,
|
|
@@ -1852,6 +2063,9 @@ function isGenericToolAction(action) {
|
|
|
1852
2063
|
function isTodoWriteAction(action) {
|
|
1853
2064
|
return action.action === "todo_write";
|
|
1854
2065
|
}
|
|
2066
|
+
function isAgentToolAction(action) {
|
|
2067
|
+
return action.action === "agent_tool";
|
|
2068
|
+
}
|
|
1855
2069
|
function isToolCallEntry(entry) {
|
|
1856
2070
|
return entry.type === "tool_call";
|
|
1857
2071
|
}
|
|
@@ -1969,7 +2183,7 @@ function MessageList({
|
|
|
1969
2183
|
return /* @__PURE__ */ jsx("div", { className: "ash-animate-fade-in", children: widgetContent }, entry.id);
|
|
1970
2184
|
}
|
|
1971
2185
|
}
|
|
1972
|
-
return /* @__PURE__ */ jsx(MessageEntry, { entry, onOptionSelect }, entry.id);
|
|
2186
|
+
return /* @__PURE__ */ jsx(MessageEntry, { entry, onOptionSelect, defaultExpanded: config.defaultExpanded }, entry.id);
|
|
1973
2187
|
}
|
|
1974
2188
|
const toolCalls = extractToolCallsFromGroup(groupedEntry.entries);
|
|
1975
2189
|
return /* @__PURE__ */ jsxs("div", { className: "flex gap-3 ash-animate-fade-in", children: [
|
|
@@ -3292,6 +3506,24 @@ function useAgentChat(options) {
|
|
|
3292
3506
|
}
|
|
3293
3507
|
}
|
|
3294
3508
|
break;
|
|
3509
|
+
case "text":
|
|
3510
|
+
if (event.text && !currentTextRef.current) {
|
|
3511
|
+
currentTextIdRef.current = `text-${Date.now()}-${Math.random().toString(36).slice(2)}`;
|
|
3512
|
+
currentTextRef.current = event.text;
|
|
3513
|
+
newEntries.push(createTextEntry(currentTextIdRef.current, currentTextRef.current));
|
|
3514
|
+
}
|
|
3515
|
+
break;
|
|
3516
|
+
case "message":
|
|
3517
|
+
if (event.content && !currentTextRef.current) {
|
|
3518
|
+
const messageContent = event.content;
|
|
3519
|
+
const textBlock = messageContent?.find((c) => c.type === "text");
|
|
3520
|
+
if (textBlock?.text) {
|
|
3521
|
+
currentTextIdRef.current = `text-${Date.now()}-${Math.random().toString(36).slice(2)}`;
|
|
3522
|
+
currentTextRef.current = textBlock.text;
|
|
3523
|
+
newEntries.push(createTextEntry(currentTextIdRef.current, currentTextRef.current));
|
|
3524
|
+
}
|
|
3525
|
+
}
|
|
3526
|
+
break;
|
|
3295
3527
|
case "sandbox_log":
|
|
3296
3528
|
if (event.entry) {
|
|
3297
3529
|
onSandboxLog?.(event.entry);
|
|
@@ -3337,7 +3569,7 @@ function useAgentChat(options) {
|
|
|
3337
3569
|
abortControllerRef.current = controller;
|
|
3338
3570
|
let localStreamingEntries = [];
|
|
3339
3571
|
try {
|
|
3340
|
-
const stream = createStream(prompt, sessionId || void 0);
|
|
3572
|
+
const stream = createStream(prompt, sessionId || void 0, controller.signal);
|
|
3341
3573
|
for await (const event of stream) {
|
|
3342
3574
|
if (controller.signal.aborted) break;
|
|
3343
3575
|
localStreamingEntries = processEvent(event, localStreamingEntries);
|
|
@@ -3465,6 +3697,6 @@ function useLongTextConversion({
|
|
|
3465
3697
|
};
|
|
3466
3698
|
}
|
|
3467
3699
|
|
|
3468
|
-
export { ActionIcon, AlertCircleIcon, AlertTriangleIcon, AssistantMessage, BotIcon, BrainIcon, BugIcon, CheckCircleIcon, CheckIcon, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, ChevronUpIcon, CircleIcon, ClipboardListIcon, CodeBlock, CodeIcon, CompactToolRow, CompactToolStatusLine, CopyIcon, DEFAULT_DISPLAY_CONFIG, DisplayModeProvider, DisplayModeToggle, EditIcon, EnvVarsPanel, ErrorIcon, ErrorMessage, FileBadge, FileIcon, FilePlusIcon, FolderSearchIcon, GlobeIcon, InfoIcon, JsonDisplay, ListChecksIcon, LoaderIcon, LoadingIndicator, LogsPanel, MessageEntry, MessageList, MessageSquareIcon, MoonIcon, OptionCards, PaperclipIcon, PlugIcon, SearchIcon, SendIcon, SparklesIcon, SpinnerIcon, StatusIndicator, StepAccordion, StopCircleIcon, StreamingText, SunIcon, TerminalIcon, ThemeProvider, ThinkingMessage, TodoPanel, ToolCallCard, ToolCallMessage, ToolExecutionGroup, ToolIcon, TypewriterText, UserIcon, UserMessage, XCircleIcon, XIcon, allKeyframesCss, borderRadius, cn, colors, createToolCall, extractTextContent, extractToolCallsFromGroup, formatFileSize, formatTimestamp, formatToolName, generateToolSummary, getActionIcon, getActionLabel, groupEntriesForCompactMode, inlineStyles, isCommandRunAction, isErrorEntry, isFileEditAction, isFileReadAction, isFileWriteAction, isGenericToolAction, isGlobAction, isMcpToolAction, isSearchAction, isTodoWriteAction, isToolCallEntry, isWebFetchAction, isWebSearchAction, isWidgetEntry, keyframes, keyframesCss, mapToolToActionType, normalizeToolResult, parseCommandResult, parseMcpToolName, parseOptionsFromContent, shadows, spacing, tokensToCssVariables, transitions, truncate, typography, updateToolCallWithResult, useAgentChat, useDisplayConfig, useDisplayMode, useFileUpload, useLongTextConversion, useMessageQueue, useStopExecution, useTheme, widget, zIndex };
|
|
3700
|
+
export { ActionIcon, AgentToolCard, AlertCircleIcon, AlertTriangleIcon, AssistantMessage, BotIcon, BrainIcon, BugIcon, CheckCircleIcon, CheckIcon, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, ChevronUpIcon, CircleIcon, ClipboardListIcon, ClockIcon, CodeBlock, CodeIcon, CompactToolRow, CompactToolStatusLine, CopyIcon, DEFAULT_DISPLAY_CONFIG, DisplayModeProvider, DisplayModeToggle, EditIcon, EnvVarsPanel, ErrorIcon, ErrorMessage, FileBadge, FileIcon, FilePlusIcon, FolderSearchIcon, GlobeIcon, InfoIcon, JsonDisplay, LazyMarkdown, ListChecksIcon, LoaderIcon, LoadingIndicator, LogsPanel, MessageEntry, MessageList, MessageSquareIcon, MoonIcon, OptionCards, PaperclipIcon, PlugIcon, SearchIcon, SendIcon, SparklesIcon, SpinnerIcon, StatusIndicator, StepAccordion, StopCircleIcon, StreamingText, SunIcon, TerminalIcon, ThemeProvider, ThinkingMessage, TodoPanel, ToolCallCard, ToolCallMessage, ToolExecutionGroup, ToolIcon, TypewriterText, UserIcon, UserMessage, XCircleIcon, XIcon, allKeyframesCss, borderRadius, cn, colors, createToolCall, extractTextContent, extractToolCallsFromGroup, formatElapsedTime, formatFileSize, formatTimestamp, formatToolName, generateToolSummary, getActionIcon, getActionLabel, groupEntriesForCompactMode, inlineStyles, isAgentToolAction, isCommandRunAction, isErrorEntry, isFileEditAction, isFileReadAction, isFileWriteAction, isGenericToolAction, isGlobAction, isMcpToolAction, isSearchAction, isTodoWriteAction, isToolCallEntry, isWebFetchAction, isWebSearchAction, isWidgetEntry, keyframes, keyframesCss, mapToolToActionType, normalizeToolResult, parseCommandResult, parseMcpToolName, parseOptionsFromContent, shadows, spacing, tokensToCssVariables, transitions, truncate, typography, updateToolCallWithResult, useAgentChat, useDisplayConfig, useDisplayMode, useFileUpload, useLongTextConversion, useMessageQueue, useStopExecution, useTheme, widget, zIndex };
|
|
3469
3701
|
//# sourceMappingURL=index.js.map
|
|
3470
3702
|
//# sourceMappingURL=index.js.map
|