@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.cjs
CHANGED
|
@@ -2,11 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
var react = require('react');
|
|
4
4
|
var jsxRuntime = require('react/jsx-runtime');
|
|
5
|
-
var ReactMarkdown = require('react-markdown');
|
|
6
|
-
|
|
7
|
-
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
8
|
-
|
|
9
|
-
var ReactMarkdown__default = /*#__PURE__*/_interopDefault(ReactMarkdown);
|
|
10
5
|
|
|
11
6
|
// src/components/ToolCallCard.tsx
|
|
12
7
|
|
|
@@ -115,6 +110,16 @@ function mapToolToActionType(toolName, input) {
|
|
|
115
110
|
stats
|
|
116
111
|
};
|
|
117
112
|
}
|
|
113
|
+
case "Task": {
|
|
114
|
+
return {
|
|
115
|
+
action: "agent_tool",
|
|
116
|
+
agentType: inputObj.subagent_type || "general-purpose",
|
|
117
|
+
description: inputObj.description || "",
|
|
118
|
+
prompt: inputObj.prompt,
|
|
119
|
+
startedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
120
|
+
toolCallCount: 0
|
|
121
|
+
};
|
|
122
|
+
}
|
|
118
123
|
default: {
|
|
119
124
|
const mcpParts = parseMcpToolName(toolName);
|
|
120
125
|
if (mcpParts) {
|
|
@@ -164,6 +169,8 @@ function generateToolSummary(_toolName, _input, actionType) {
|
|
|
164
169
|
}
|
|
165
170
|
return `${actionType.todos.length} tasks`;
|
|
166
171
|
}
|
|
172
|
+
case "agent_tool":
|
|
173
|
+
return actionType.description;
|
|
167
174
|
default:
|
|
168
175
|
return "Unknown tool";
|
|
169
176
|
}
|
|
@@ -231,6 +238,7 @@ function createToolCall(toolUse) {
|
|
|
231
238
|
actionType,
|
|
232
239
|
status: "pending",
|
|
233
240
|
summary,
|
|
241
|
+
input: toolUse.input,
|
|
234
242
|
startedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
235
243
|
};
|
|
236
244
|
}
|
|
@@ -240,6 +248,7 @@ function updateToolCallWithResult(toolCall, content, isError) {
|
|
|
240
248
|
updatedToolCall.status = isError ? "failed" : "success";
|
|
241
249
|
updatedToolCall.completedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
242
250
|
updatedToolCall.isError = isError;
|
|
251
|
+
updatedToolCall.output = content;
|
|
243
252
|
if (actionType.action === "command_run") {
|
|
244
253
|
const result = parseCommandResult(content);
|
|
245
254
|
actionType.result = result;
|
|
@@ -277,6 +286,8 @@ function getActionIcon(actionType) {
|
|
|
277
286
|
return "tool";
|
|
278
287
|
case "todo_write":
|
|
279
288
|
return "list-checks";
|
|
289
|
+
case "agent_tool":
|
|
290
|
+
return "bot";
|
|
280
291
|
default:
|
|
281
292
|
return "tool";
|
|
282
293
|
}
|
|
@@ -305,6 +316,8 @@ function getActionLabel(actionType) {
|
|
|
305
316
|
return "Tool";
|
|
306
317
|
case "todo_write":
|
|
307
318
|
return "Tasks";
|
|
319
|
+
case "agent_tool":
|
|
320
|
+
return actionType.agentType;
|
|
308
321
|
default:
|
|
309
322
|
return "Tool";
|
|
310
323
|
}
|
|
@@ -327,6 +340,21 @@ function formatTimestamp(timestamp) {
|
|
|
327
340
|
return timestamp;
|
|
328
341
|
}
|
|
329
342
|
}
|
|
343
|
+
function formatElapsedTime(startTime, endTime) {
|
|
344
|
+
const start = typeof startTime === "string" ? new Date(startTime) : startTime;
|
|
345
|
+
const end = endTime ? typeof endTime === "string" ? new Date(endTime) : endTime : /* @__PURE__ */ new Date();
|
|
346
|
+
const elapsedMs = end.getTime() - start.getTime();
|
|
347
|
+
const elapsedSeconds = Math.floor(elapsedMs / 1e3);
|
|
348
|
+
if (elapsedSeconds < 60) {
|
|
349
|
+
return `${elapsedSeconds}s`;
|
|
350
|
+
}
|
|
351
|
+
const minutes = Math.floor(elapsedSeconds / 60);
|
|
352
|
+
const seconds = elapsedSeconds % 60;
|
|
353
|
+
if (seconds === 0) {
|
|
354
|
+
return `${minutes}m`;
|
|
355
|
+
}
|
|
356
|
+
return `${minutes}m ${seconds}s`;
|
|
357
|
+
}
|
|
330
358
|
function truncate(str, maxLength) {
|
|
331
359
|
if (str.length <= maxLength) return str;
|
|
332
360
|
return str.substring(0, maxLength - 3) + "...";
|
|
@@ -650,6 +678,12 @@ function ClipboardListIcon({ className }) {
|
|
|
650
678
|
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M8 16h.01" })
|
|
651
679
|
] });
|
|
652
680
|
}
|
|
681
|
+
function ClockIcon({ className }) {
|
|
682
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("svg", { className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
|
|
683
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "12", r: "10" }),
|
|
684
|
+
/* @__PURE__ */ jsxRuntime.jsx("polyline", { points: "12 6 12 12 16 14" })
|
|
685
|
+
] });
|
|
686
|
+
}
|
|
653
687
|
function SpinnerIcon({ className }) {
|
|
654
688
|
return /* @__PURE__ */ jsxRuntime.jsx("svg", { className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M21 12a9 9 0 1 1-6.219-8.56" }) });
|
|
655
689
|
}
|
|
@@ -705,6 +739,8 @@ function ActionIcon({ actionType, className = "w-4 h-4" }) {
|
|
|
705
739
|
return /* @__PURE__ */ jsxRuntime.jsx(PlugIcon, { className });
|
|
706
740
|
case "todo_write":
|
|
707
741
|
return /* @__PURE__ */ jsxRuntime.jsx(ListChecksIcon, { className });
|
|
742
|
+
case "agent_tool":
|
|
743
|
+
return /* @__PURE__ */ jsxRuntime.jsx(BotIcon, { className });
|
|
708
744
|
case "generic_tool":
|
|
709
745
|
default:
|
|
710
746
|
return /* @__PURE__ */ jsxRuntime.jsx(ToolIcon, { className });
|
|
@@ -758,6 +794,153 @@ function JsonDisplay({ value, maxHeight, className }) {
|
|
|
758
794
|
const formatted = JSON.stringify(value, null, 2);
|
|
759
795
|
return /* @__PURE__ */ jsxRuntime.jsx(CodeBlock, { maxHeight, className, children: formatted });
|
|
760
796
|
}
|
|
797
|
+
function AgentToolCard({
|
|
798
|
+
toolCall,
|
|
799
|
+
defaultExpanded = false,
|
|
800
|
+
className,
|
|
801
|
+
depth = 0
|
|
802
|
+
}) {
|
|
803
|
+
const [expanded, setExpanded] = react.useState(defaultExpanded);
|
|
804
|
+
const [elapsedTime, setElapsedTime] = react.useState("");
|
|
805
|
+
const intervalRef = react.useRef(null);
|
|
806
|
+
const { actionType, status, summary, nestedToolCalls, nestedToolCallCount, startedAt } = toolCall;
|
|
807
|
+
const agentData = react.useMemo(() => {
|
|
808
|
+
if (actionType.action !== "agent_tool") {
|
|
809
|
+
return null;
|
|
810
|
+
}
|
|
811
|
+
const agentAction = actionType;
|
|
812
|
+
return {
|
|
813
|
+
agentType: agentAction.agentType,
|
|
814
|
+
description: agentAction.description,
|
|
815
|
+
prompt: agentAction.prompt
|
|
816
|
+
};
|
|
817
|
+
}, [actionType]);
|
|
818
|
+
const toolCount = nestedToolCallCount ?? nestedToolCalls?.length ?? 0;
|
|
819
|
+
const isRunning = status === "pending";
|
|
820
|
+
react.useEffect(() => {
|
|
821
|
+
if (isRunning && startedAt) {
|
|
822
|
+
setElapsedTime(formatElapsedTime(startedAt));
|
|
823
|
+
intervalRef.current = setInterval(() => {
|
|
824
|
+
setElapsedTime(formatElapsedTime(startedAt));
|
|
825
|
+
}, 1e3);
|
|
826
|
+
return () => {
|
|
827
|
+
if (intervalRef.current) {
|
|
828
|
+
clearInterval(intervalRef.current);
|
|
829
|
+
intervalRef.current = null;
|
|
830
|
+
}
|
|
831
|
+
};
|
|
832
|
+
} else if (!isRunning) {
|
|
833
|
+
if (intervalRef.current) {
|
|
834
|
+
clearInterval(intervalRef.current);
|
|
835
|
+
intervalRef.current = null;
|
|
836
|
+
}
|
|
837
|
+
setElapsedTime("");
|
|
838
|
+
}
|
|
839
|
+
return void 0;
|
|
840
|
+
}, [isRunning, startedAt]);
|
|
841
|
+
if (!agentData) {
|
|
842
|
+
return null;
|
|
843
|
+
}
|
|
844
|
+
const { agentType, description, prompt } = agentData;
|
|
845
|
+
const indentClass = depth > 0 ? "ml-4" : "";
|
|
846
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
847
|
+
"div",
|
|
848
|
+
{
|
|
849
|
+
className: cn(
|
|
850
|
+
"rounded-xl border bg-[var(--ash-surface-dark,#0a0a0a)] overflow-hidden",
|
|
851
|
+
isRunning ? "border-yellow-500/30" : status === "failed" ? "border-red-500/30" : "border-white/10",
|
|
852
|
+
indentClass,
|
|
853
|
+
className
|
|
854
|
+
),
|
|
855
|
+
children: [
|
|
856
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
857
|
+
"button",
|
|
858
|
+
{
|
|
859
|
+
onClick: () => setExpanded(!expanded),
|
|
860
|
+
className: "w-full px-4 py-3 flex items-center gap-3 hover:bg-white/5 cursor-pointer transition-colors",
|
|
861
|
+
children: [
|
|
862
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
863
|
+
ChevronRightIcon,
|
|
864
|
+
{
|
|
865
|
+
className: cn(
|
|
866
|
+
"w-4 h-4 text-white/40 transition-transform duration-200 shrink-0",
|
|
867
|
+
expanded && "rotate-90"
|
|
868
|
+
)
|
|
869
|
+
}
|
|
870
|
+
),
|
|
871
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
872
|
+
"div",
|
|
873
|
+
{
|
|
874
|
+
className: cn(
|
|
875
|
+
"w-6 h-6 rounded-lg flex items-center justify-center shrink-0",
|
|
876
|
+
isRunning ? "bg-yellow-500/20" : status === "failed" ? "bg-red-500/20" : "bg-[var(--ash-accent)]/20"
|
|
877
|
+
),
|
|
878
|
+
children: isRunning ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
879
|
+
SpinnerIcon,
|
|
880
|
+
{
|
|
881
|
+
className: "w-3.5 h-3.5 text-yellow-400 animate-spin"
|
|
882
|
+
}
|
|
883
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
884
|
+
BotIcon,
|
|
885
|
+
{
|
|
886
|
+
className: cn(
|
|
887
|
+
"w-3.5 h-3.5",
|
|
888
|
+
status === "failed" ? "text-red-400" : "text-[var(--ash-accent)]"
|
|
889
|
+
)
|
|
890
|
+
}
|
|
891
|
+
)
|
|
892
|
+
}
|
|
893
|
+
),
|
|
894
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
895
|
+
"span",
|
|
896
|
+
{
|
|
897
|
+
className: cn(
|
|
898
|
+
"px-2 py-0.5 rounded text-xs font-medium shrink-0",
|
|
899
|
+
isRunning ? "bg-yellow-500/20 text-yellow-400" : status === "failed" ? "bg-red-500/20 text-red-400" : "bg-white/10 text-white/70"
|
|
900
|
+
),
|
|
901
|
+
children: agentType
|
|
902
|
+
}
|
|
903
|
+
),
|
|
904
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-white/80 truncate flex-1 text-left", children: description || summary }),
|
|
905
|
+
toolCount > 0 && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-xs text-white/50 shrink-0", children: [
|
|
906
|
+
toolCount,
|
|
907
|
+
" tool call",
|
|
908
|
+
toolCount !== 1 ? "s" : ""
|
|
909
|
+
] }),
|
|
910
|
+
isRunning && elapsedTime && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1 text-xs text-white/40 shrink-0", children: [
|
|
911
|
+
/* @__PURE__ */ jsxRuntime.jsx(ClockIcon, { className: "w-3 h-3" }),
|
|
912
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: elapsedTime })
|
|
913
|
+
] }),
|
|
914
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-white/30 shrink-0", children: "..." })
|
|
915
|
+
]
|
|
916
|
+
}
|
|
917
|
+
),
|
|
918
|
+
expanded && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "border-t border-white/5 bg-black/20", children: [
|
|
919
|
+
prompt && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-4 py-3 border-b border-white/5", children: /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-white/70 whitespace-pre-wrap", children: prompt.length > 500 ? prompt.substring(0, 500) + "..." : prompt }) }),
|
|
920
|
+
nestedToolCalls && nestedToolCalls.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-3 space-y-2", children: nestedToolCalls.map((nestedCall) => /* @__PURE__ */ jsxRuntime.jsx("div", { children: nestedCall.actionType.action === "agent_tool" ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
921
|
+
AgentToolCard,
|
|
922
|
+
{
|
|
923
|
+
toolCall: nestedCall,
|
|
924
|
+
defaultExpanded: false,
|
|
925
|
+
depth: depth + 1
|
|
926
|
+
}
|
|
927
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
928
|
+
ToolCallCard,
|
|
929
|
+
{
|
|
930
|
+
toolCall: nestedCall,
|
|
931
|
+
defaultExpanded: false
|
|
932
|
+
}
|
|
933
|
+
) }, nestedCall.id)) }),
|
|
934
|
+
(!nestedToolCalls || nestedToolCalls.length === 0) && isRunning && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-4 py-6 flex items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 text-sm text-white/40", children: [
|
|
935
|
+
/* @__PURE__ */ jsxRuntime.jsx(SpinnerIcon, { className: "w-4 h-4 animate-spin" }),
|
|
936
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "Agent is working..." })
|
|
937
|
+
] }) }),
|
|
938
|
+
(!nestedToolCalls || nestedToolCalls.length === 0) && !isRunning && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-4 py-4 text-sm text-white/40 text-center", children: "No tool calls recorded" })
|
|
939
|
+
] })
|
|
940
|
+
]
|
|
941
|
+
}
|
|
942
|
+
);
|
|
943
|
+
}
|
|
761
944
|
function SectionHeader({ children }) {
|
|
762
945
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "ash-tool-section-header", children });
|
|
763
946
|
}
|
|
@@ -1033,6 +1216,9 @@ function hasDetails(actionType) {
|
|
|
1033
1216
|
return Boolean(actionType.arguments || actionType.result);
|
|
1034
1217
|
case "todo_write":
|
|
1035
1218
|
return actionType.todos.length > 0;
|
|
1219
|
+
case "agent_tool":
|
|
1220
|
+
return true;
|
|
1221
|
+
// Always expandable (handled by AgentToolCard)
|
|
1036
1222
|
default:
|
|
1037
1223
|
return false;
|
|
1038
1224
|
}
|
|
@@ -1040,6 +1226,16 @@ function hasDetails(actionType) {
|
|
|
1040
1226
|
function ToolCallCard({ toolCall, defaultExpanded = false, className }) {
|
|
1041
1227
|
const [expanded, setExpanded] = react.useState(defaultExpanded);
|
|
1042
1228
|
const { actionType, status, summary } = toolCall;
|
|
1229
|
+
if (actionType.action === "agent_tool") {
|
|
1230
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1231
|
+
AgentToolCard,
|
|
1232
|
+
{
|
|
1233
|
+
toolCall,
|
|
1234
|
+
defaultExpanded,
|
|
1235
|
+
className
|
|
1236
|
+
}
|
|
1237
|
+
);
|
|
1238
|
+
}
|
|
1043
1239
|
const canExpand = hasDetails(actionType);
|
|
1044
1240
|
const statusClasses = {
|
|
1045
1241
|
pending: "border-yellow-500/30 ash-tool-status-pending",
|
|
@@ -1108,6 +1304,17 @@ function ToolCallCard({ toolCall, defaultExpanded = false, className }) {
|
|
|
1108
1304
|
}
|
|
1109
1305
|
);
|
|
1110
1306
|
}
|
|
1307
|
+
var ReactMarkdown = react.lazy(() => import('react-markdown'));
|
|
1308
|
+
function LazyMarkdown({ children, fallback, className }) {
|
|
1309
|
+
const [mounted, setMounted] = react.useState(false);
|
|
1310
|
+
react.useEffect(() => {
|
|
1311
|
+
setMounted(true);
|
|
1312
|
+
}, []);
|
|
1313
|
+
if (!mounted) {
|
|
1314
|
+
return /* @__PURE__ */ jsxRuntime.jsx("span", { className, children: fallback ?? children });
|
|
1315
|
+
}
|
|
1316
|
+
return /* @__PURE__ */ jsxRuntime.jsx(react.Suspense, { fallback: /* @__PURE__ */ jsxRuntime.jsx("span", { className, children: fallback ?? children }), children: /* @__PURE__ */ jsxRuntime.jsx(ReactMarkdown, { children }) });
|
|
1317
|
+
}
|
|
1111
1318
|
function OptionCards({ options, onSelect, className }) {
|
|
1112
1319
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("grid gap-2 mt-3", className), style: {
|
|
1113
1320
|
gridTemplateColumns: "repeat(auto-fit, minmax(200px, 1fr))"
|
|
@@ -1203,7 +1410,7 @@ function AssistantMessage({ entry, onOptionSelect, className }) {
|
|
|
1203
1410
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-7 h-7 rounded-full bg-[var(--ash-accent)]/20 flex items-center justify-center shrink-0", children: /* @__PURE__ */ jsxRuntime.jsx(BotIcon, { className: "w-4 h-4 text-[var(--ash-accent)]" }) }),
|
|
1204
1411
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1 max-w-[85%]", children: [
|
|
1205
1412
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "ash-card-glass rounded-2xl p-4", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "ash-message-content prose prose-sm prose-invert max-w-none text-sm leading-relaxed", children: parsedOptions ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1206
|
-
parsedOptions.preamble && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1413
|
+
parsedOptions.preamble && /* @__PURE__ */ jsxRuntime.jsx(LazyMarkdown, { children: parsedOptions.preamble }),
|
|
1207
1414
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1208
1415
|
OptionCards,
|
|
1209
1416
|
{
|
|
@@ -1211,7 +1418,7 @@ function AssistantMessage({ entry, onOptionSelect, className }) {
|
|
|
1211
1418
|
onSelect: handleOptionSelect
|
|
1212
1419
|
}
|
|
1213
1420
|
)
|
|
1214
|
-
] }) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
1421
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsx(LazyMarkdown, { children: entry.content }) }) }),
|
|
1215
1422
|
entry.timestamp && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-xs text-white/40 mt-2", children: formatTimestamp(entry.timestamp) })
|
|
1216
1423
|
] })
|
|
1217
1424
|
] });
|
|
@@ -1246,7 +1453,7 @@ function ErrorMessage({ entry, className }) {
|
|
|
1246
1453
|
] }) })
|
|
1247
1454
|
] });
|
|
1248
1455
|
}
|
|
1249
|
-
function MessageEntry({ entry, onOptionSelect, className }) {
|
|
1456
|
+
function MessageEntry({ entry, onOptionSelect, defaultExpanded, className }) {
|
|
1250
1457
|
switch (entry.entryType.type) {
|
|
1251
1458
|
case "user_message":
|
|
1252
1459
|
return /* @__PURE__ */ jsxRuntime.jsx(UserMessage, { entry, className });
|
|
@@ -1255,7 +1462,7 @@ function MessageEntry({ entry, onOptionSelect, className }) {
|
|
|
1255
1462
|
case "thinking":
|
|
1256
1463
|
return /* @__PURE__ */ jsxRuntime.jsx(ThinkingMessage, { entry, className });
|
|
1257
1464
|
case "tool_call":
|
|
1258
|
-
return /* @__PURE__ */ jsxRuntime.jsx(ToolCallMessage, { entry, className });
|
|
1465
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ToolCallMessage, { entry, defaultExpanded, className });
|
|
1259
1466
|
case "error":
|
|
1260
1467
|
return /* @__PURE__ */ jsxRuntime.jsx(ErrorMessage, { entry, className });
|
|
1261
1468
|
default:
|
|
@@ -1317,7 +1524,7 @@ function StreamingText({
|
|
|
1317
1524
|
className
|
|
1318
1525
|
}) {
|
|
1319
1526
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("relative", className), children: renderMarkdown ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ash-message-content prose prose-sm prose-invert max-w-none text-sm leading-relaxed", children: [
|
|
1320
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1527
|
+
/* @__PURE__ */ jsxRuntime.jsx(LazyMarkdown, { children: content }),
|
|
1321
1528
|
isStreaming && /* @__PURE__ */ jsxRuntime.jsx(LoadingIndicator, { variant: "cursor", size: "sm", className: "inline-block ml-0.5" })
|
|
1322
1529
|
] }) : /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "whitespace-pre-wrap text-sm leading-relaxed", children: [
|
|
1323
1530
|
content,
|
|
@@ -1858,6 +2065,9 @@ function isGenericToolAction(action) {
|
|
|
1858
2065
|
function isTodoWriteAction(action) {
|
|
1859
2066
|
return action.action === "todo_write";
|
|
1860
2067
|
}
|
|
2068
|
+
function isAgentToolAction(action) {
|
|
2069
|
+
return action.action === "agent_tool";
|
|
2070
|
+
}
|
|
1861
2071
|
function isToolCallEntry(entry) {
|
|
1862
2072
|
return entry.type === "tool_call";
|
|
1863
2073
|
}
|
|
@@ -1975,7 +2185,7 @@ function MessageList({
|
|
|
1975
2185
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "ash-animate-fade-in", children: widgetContent }, entry.id);
|
|
1976
2186
|
}
|
|
1977
2187
|
}
|
|
1978
|
-
return /* @__PURE__ */ jsxRuntime.jsx(MessageEntry, { entry, onOptionSelect }, entry.id);
|
|
2188
|
+
return /* @__PURE__ */ jsxRuntime.jsx(MessageEntry, { entry, onOptionSelect, defaultExpanded: config.defaultExpanded }, entry.id);
|
|
1979
2189
|
}
|
|
1980
2190
|
const toolCalls = extractToolCallsFromGroup(groupedEntry.entries);
|
|
1981
2191
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-3 ash-animate-fade-in", children: [
|
|
@@ -3298,6 +3508,24 @@ function useAgentChat(options) {
|
|
|
3298
3508
|
}
|
|
3299
3509
|
}
|
|
3300
3510
|
break;
|
|
3511
|
+
case "text":
|
|
3512
|
+
if (event.text && !currentTextRef.current) {
|
|
3513
|
+
currentTextIdRef.current = `text-${Date.now()}-${Math.random().toString(36).slice(2)}`;
|
|
3514
|
+
currentTextRef.current = event.text;
|
|
3515
|
+
newEntries.push(createTextEntry(currentTextIdRef.current, currentTextRef.current));
|
|
3516
|
+
}
|
|
3517
|
+
break;
|
|
3518
|
+
case "message":
|
|
3519
|
+
if (event.content && !currentTextRef.current) {
|
|
3520
|
+
const messageContent = event.content;
|
|
3521
|
+
const textBlock = messageContent?.find((c) => c.type === "text");
|
|
3522
|
+
if (textBlock?.text) {
|
|
3523
|
+
currentTextIdRef.current = `text-${Date.now()}-${Math.random().toString(36).slice(2)}`;
|
|
3524
|
+
currentTextRef.current = textBlock.text;
|
|
3525
|
+
newEntries.push(createTextEntry(currentTextIdRef.current, currentTextRef.current));
|
|
3526
|
+
}
|
|
3527
|
+
}
|
|
3528
|
+
break;
|
|
3301
3529
|
case "sandbox_log":
|
|
3302
3530
|
if (event.entry) {
|
|
3303
3531
|
onSandboxLog?.(event.entry);
|
|
@@ -3343,7 +3571,7 @@ function useAgentChat(options) {
|
|
|
3343
3571
|
abortControllerRef.current = controller;
|
|
3344
3572
|
let localStreamingEntries = [];
|
|
3345
3573
|
try {
|
|
3346
|
-
const stream = createStream(prompt, sessionId || void 0);
|
|
3574
|
+
const stream = createStream(prompt, sessionId || void 0, controller.signal);
|
|
3347
3575
|
for await (const event of stream) {
|
|
3348
3576
|
if (controller.signal.aborted) break;
|
|
3349
3577
|
localStreamingEntries = processEvent(event, localStreamingEntries);
|
|
@@ -3472,6 +3700,7 @@ function useLongTextConversion({
|
|
|
3472
3700
|
}
|
|
3473
3701
|
|
|
3474
3702
|
exports.ActionIcon = ActionIcon;
|
|
3703
|
+
exports.AgentToolCard = AgentToolCard;
|
|
3475
3704
|
exports.AlertCircleIcon = AlertCircleIcon;
|
|
3476
3705
|
exports.AlertTriangleIcon = AlertTriangleIcon;
|
|
3477
3706
|
exports.AssistantMessage = AssistantMessage;
|
|
@@ -3486,6 +3715,7 @@ exports.ChevronRightIcon = ChevronRightIcon;
|
|
|
3486
3715
|
exports.ChevronUpIcon = ChevronUpIcon;
|
|
3487
3716
|
exports.CircleIcon = CircleIcon;
|
|
3488
3717
|
exports.ClipboardListIcon = ClipboardListIcon;
|
|
3718
|
+
exports.ClockIcon = ClockIcon;
|
|
3489
3719
|
exports.CodeBlock = CodeBlock;
|
|
3490
3720
|
exports.CodeIcon = CodeIcon;
|
|
3491
3721
|
exports.CompactToolRow = CompactToolRow;
|
|
@@ -3505,6 +3735,7 @@ exports.FolderSearchIcon = FolderSearchIcon;
|
|
|
3505
3735
|
exports.GlobeIcon = GlobeIcon;
|
|
3506
3736
|
exports.InfoIcon = InfoIcon;
|
|
3507
3737
|
exports.JsonDisplay = JsonDisplay;
|
|
3738
|
+
exports.LazyMarkdown = LazyMarkdown;
|
|
3508
3739
|
exports.ListChecksIcon = ListChecksIcon;
|
|
3509
3740
|
exports.LoaderIcon = LoaderIcon;
|
|
3510
3741
|
exports.LoadingIndicator = LoadingIndicator;
|
|
@@ -3545,6 +3776,7 @@ exports.colors = colors;
|
|
|
3545
3776
|
exports.createToolCall = createToolCall;
|
|
3546
3777
|
exports.extractTextContent = extractTextContent;
|
|
3547
3778
|
exports.extractToolCallsFromGroup = extractToolCallsFromGroup;
|
|
3779
|
+
exports.formatElapsedTime = formatElapsedTime;
|
|
3548
3780
|
exports.formatFileSize = formatFileSize;
|
|
3549
3781
|
exports.formatTimestamp = formatTimestamp;
|
|
3550
3782
|
exports.formatToolName = formatToolName;
|
|
@@ -3553,6 +3785,7 @@ exports.getActionIcon = getActionIcon;
|
|
|
3553
3785
|
exports.getActionLabel = getActionLabel;
|
|
3554
3786
|
exports.groupEntriesForCompactMode = groupEntriesForCompactMode;
|
|
3555
3787
|
exports.inlineStyles = inlineStyles;
|
|
3788
|
+
exports.isAgentToolAction = isAgentToolAction;
|
|
3556
3789
|
exports.isCommandRunAction = isCommandRunAction;
|
|
3557
3790
|
exports.isErrorEntry = isErrorEntry;
|
|
3558
3791
|
exports.isFileEditAction = isFileEditAction;
|