@ash-cloud/ash-ai 0.1.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/ash-widget.js +2 -0
- package/dist/ash-widget.js.map +1 -0
- package/dist/embed.cjs +19 -0
- package/dist/embed.cjs.map +1 -0
- package/dist/embed.d.cts +278 -0
- package/dist/embed.d.ts +278 -0
- package/dist/embed.js +16 -0
- package/dist/embed.js.map +1 -0
- package/dist/icons.cjs +156 -0
- package/dist/icons.cjs.map +1 -0
- package/dist/icons.d.cts +1 -0
- package/dist/icons.d.ts +1 -0
- package/dist/icons.js +3 -0
- package/dist/icons.js.map +1 -0
- package/dist/index-DJwpy-R5.js +6797 -0
- package/dist/index.cjs +17502 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +9590 -0
- package/dist/index.d.ts +9590 -0
- package/dist/index.js +17328 -0
- package/dist/index.js.map +1 -0
- package/dist/playground/App.d.ts +2 -0
- package/dist/playground/App.d.ts.map +1 -0
- package/dist/playground/Playground.d.ts +62 -0
- package/dist/playground/Playground.d.ts.map +1 -0
- package/dist/playground/components/ChatInput.d.ts +60 -0
- package/dist/playground/components/ChatInput.d.ts.map +1 -0
- package/dist/playground/components/MessageList.d.ts +28 -0
- package/dist/playground/components/MessageList.d.ts.map +1 -0
- package/dist/playground/components/NormalizedMessageList.d.ts +26 -0
- package/dist/playground/components/NormalizedMessageList.d.ts.map +1 -0
- package/dist/playground/components/SandboxLogsPanel.d.ts +16 -0
- package/dist/playground/components/SandboxLogsPanel.d.ts.map +1 -0
- package/dist/playground/components/Sidebar.d.ts +7 -0
- package/dist/playground/components/Sidebar.d.ts.map +1 -0
- package/dist/playground/components/ToolCallCard.d.ts +9 -0
- package/dist/playground/components/ToolCallCard.d.ts.map +1 -0
- package/dist/playground/components/icons.d.ts +9 -0
- package/dist/playground/components/icons.d.ts.map +1 -0
- package/dist/playground/contexts/ThemeContext.d.ts +9 -0
- package/dist/playground/contexts/ThemeContext.d.ts.map +1 -0
- package/dist/playground/index.d.ts +30 -0
- package/dist/playground/index.d.ts.map +1 -0
- package/dist/playground/main.d.ts +1 -0
- package/dist/playground/main.d.ts.map +1 -0
- package/dist/playground/pages/AgentsPage.d.ts +2 -0
- package/dist/playground/pages/AgentsPage.d.ts.map +1 -0
- package/dist/playground/pages/ChatPage.d.ts +2 -0
- package/dist/playground/pages/ChatPage.d.ts.map +1 -0
- package/dist/playground/pages/SessionsPage.d.ts +2 -0
- package/dist/playground/pages/SessionsPage.d.ts.map +1 -0
- package/dist/playground.css +1 -0
- package/dist/playground.d.ts +18 -0
- package/dist/playground.d.ts.map +1 -0
- package/dist/playground.js +3753 -0
- package/dist/schema-B_CVsJm5.d.cts +1585 -0
- package/dist/schema-B_CVsJm5.d.ts +1585 -0
- package/dist/schema.cjs +254 -0
- package/dist/schema.cjs.map +1 -0
- package/dist/schema.d.cts +3 -0
- package/dist/schema.d.ts +3 -0
- package/dist/schema.js +235 -0
- package/dist/schema.js.map +1 -0
- package/package.json +108 -0
|
@@ -0,0 +1,3753 @@
|
|
|
1
|
+
var it = Object.defineProperty;
|
|
2
|
+
var at = (e, n, r) => n in e ? it(e, n, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[n] = r;
|
|
3
|
+
var ee = (e, n, r) => at(e, typeof n != "symbol" ? n + "" : n, r);
|
|
4
|
+
import { lazy as lt, createContext as Ge, useState as N, useRef as O, useEffect as j, useCallback as B, useMemo as re, useContext as Je, Suspense as ot, Fragment as Le } from "react";
|
|
5
|
+
import { jsxs as i, jsx as t, Fragment as _ } from "react/jsx-runtime";
|
|
6
|
+
function ct(e) {
|
|
7
|
+
if (e.startsWith("mcp__")) {
|
|
8
|
+
const n = e.split("__");
|
|
9
|
+
if (n.length >= 3)
|
|
10
|
+
return `mcp:${n[1]}:${n.slice(2).join(":")}`;
|
|
11
|
+
}
|
|
12
|
+
return e;
|
|
13
|
+
}
|
|
14
|
+
function dt(e) {
|
|
15
|
+
if (e.startsWith("mcp__")) {
|
|
16
|
+
const n = e.split("__");
|
|
17
|
+
if (n.length >= 3 && n[1] !== void 0)
|
|
18
|
+
return {
|
|
19
|
+
serverName: n[1],
|
|
20
|
+
toolName: n.slice(2).join("__")
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
function ut(e, n) {
|
|
26
|
+
const r = n || {};
|
|
27
|
+
switch (e) {
|
|
28
|
+
case "Bash":
|
|
29
|
+
return {
|
|
30
|
+
action: "command_run",
|
|
31
|
+
command: r.command || "",
|
|
32
|
+
description: r.description
|
|
33
|
+
};
|
|
34
|
+
case "Read": {
|
|
35
|
+
const s = r.limit;
|
|
36
|
+
return {
|
|
37
|
+
action: "file_read",
|
|
38
|
+
path: r.file_path || "",
|
|
39
|
+
offset: r.offset,
|
|
40
|
+
limit: s,
|
|
41
|
+
linesRead: s
|
|
42
|
+
// Use limit as approximate lines read if specified
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
case "Edit": {
|
|
46
|
+
const s = r.old_string, a = r.new_string, l = s ? s.split(`
|
|
47
|
+
`).length : 0, c = a ? a.split(`
|
|
48
|
+
`).length : 0;
|
|
49
|
+
return {
|
|
50
|
+
action: "file_edit",
|
|
51
|
+
path: r.file_path || "",
|
|
52
|
+
oldString: s,
|
|
53
|
+
newString: a,
|
|
54
|
+
replaceAll: r.replace_all,
|
|
55
|
+
linesAdded: c,
|
|
56
|
+
linesRemoved: l
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
case "Write": {
|
|
60
|
+
const s = r.content;
|
|
61
|
+
return {
|
|
62
|
+
action: "file_write",
|
|
63
|
+
path: r.file_path || "",
|
|
64
|
+
content: s,
|
|
65
|
+
linesWritten: s ? s.split(`
|
|
66
|
+
`).length : void 0
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
case "Grep":
|
|
70
|
+
return {
|
|
71
|
+
action: "search",
|
|
72
|
+
pattern: r.pattern || "",
|
|
73
|
+
path: r.path,
|
|
74
|
+
glob: r.glob,
|
|
75
|
+
type: r.type
|
|
76
|
+
};
|
|
77
|
+
case "Glob":
|
|
78
|
+
return {
|
|
79
|
+
action: "glob",
|
|
80
|
+
pattern: r.pattern || "",
|
|
81
|
+
path: r.path
|
|
82
|
+
};
|
|
83
|
+
case "WebFetch":
|
|
84
|
+
return {
|
|
85
|
+
action: "web_fetch",
|
|
86
|
+
url: r.url || "",
|
|
87
|
+
prompt: r.prompt
|
|
88
|
+
};
|
|
89
|
+
case "WebSearch":
|
|
90
|
+
return {
|
|
91
|
+
action: "web_search",
|
|
92
|
+
query: r.query || ""
|
|
93
|
+
};
|
|
94
|
+
case "TodoWrite": {
|
|
95
|
+
const s = r.todos || [], a = {
|
|
96
|
+
total: s.length,
|
|
97
|
+
completed: s.filter((l) => l.status === "completed").length,
|
|
98
|
+
inProgress: s.filter((l) => l.status === "in_progress").length,
|
|
99
|
+
pending: s.filter((l) => l.status === "pending").length
|
|
100
|
+
};
|
|
101
|
+
return {
|
|
102
|
+
action: "todo_write",
|
|
103
|
+
todos: s,
|
|
104
|
+
stats: a
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
case "Task":
|
|
108
|
+
return {
|
|
109
|
+
action: "agent_tool",
|
|
110
|
+
agentType: r.subagent_type || "general-purpose",
|
|
111
|
+
description: r.description || "",
|
|
112
|
+
prompt: r.prompt,
|
|
113
|
+
startedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
114
|
+
toolCallCount: 0
|
|
115
|
+
};
|
|
116
|
+
default: {
|
|
117
|
+
const s = dt(e);
|
|
118
|
+
return s ? {
|
|
119
|
+
action: "mcp_tool",
|
|
120
|
+
serverName: s.serverName,
|
|
121
|
+
toolName: s.toolName,
|
|
122
|
+
arguments: n
|
|
123
|
+
} : {
|
|
124
|
+
action: "generic_tool",
|
|
125
|
+
toolName: ct(e),
|
|
126
|
+
arguments: n
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
function ht(e, n, r) {
|
|
132
|
+
switch (r.action) {
|
|
133
|
+
case "command_run": {
|
|
134
|
+
const s = r.command;
|
|
135
|
+
return s.length > 60 ? s.substring(0, 57) + "..." : s;
|
|
136
|
+
}
|
|
137
|
+
case "file_read":
|
|
138
|
+
return r.path;
|
|
139
|
+
case "file_edit":
|
|
140
|
+
return r.path;
|
|
141
|
+
case "file_write":
|
|
142
|
+
return r.path;
|
|
143
|
+
case "search":
|
|
144
|
+
return `${r.pattern}${r.path ? ` in ${r.path}` : ""}`;
|
|
145
|
+
case "glob":
|
|
146
|
+
return r.pattern;
|
|
147
|
+
case "web_fetch":
|
|
148
|
+
return r.url;
|
|
149
|
+
case "web_search":
|
|
150
|
+
return r.query;
|
|
151
|
+
case "mcp_tool":
|
|
152
|
+
return `${r.serverName}:${r.toolName}`;
|
|
153
|
+
case "generic_tool":
|
|
154
|
+
return r.toolName;
|
|
155
|
+
case "todo_write": {
|
|
156
|
+
const { stats: s } = r;
|
|
157
|
+
return s ? `${s.completed}/${s.total} completed` : `${r.todos.length} tasks`;
|
|
158
|
+
}
|
|
159
|
+
case "agent_tool":
|
|
160
|
+
return r.description;
|
|
161
|
+
default:
|
|
162
|
+
return "Unknown tool";
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
function mt(e) {
|
|
166
|
+
return typeof e == "string" ? e : Array.isArray(e) ? e.filter((n) => typeof (n == null ? void 0 : n.text) == "string").map((n) => n.text).join(`
|
|
167
|
+
`) : e && typeof e == "object" && "text" in e ? String(e.text) : JSON.stringify(e, null, 2);
|
|
168
|
+
}
|
|
169
|
+
function pt(e) {
|
|
170
|
+
if (typeof e == "string")
|
|
171
|
+
try {
|
|
172
|
+
return { type: "json", value: JSON.parse(e) };
|
|
173
|
+
} catch {
|
|
174
|
+
return { type: "markdown", value: e };
|
|
175
|
+
}
|
|
176
|
+
if (Array.isArray(e)) {
|
|
177
|
+
const n = e.filter(
|
|
178
|
+
(r) => (r == null ? void 0 : r.type) === "text" && typeof r.text == "string"
|
|
179
|
+
).map((r) => r.text);
|
|
180
|
+
if (n.length > 0) {
|
|
181
|
+
const r = n.join(`
|
|
182
|
+
|
|
183
|
+
`);
|
|
184
|
+
try {
|
|
185
|
+
return { type: "json", value: JSON.parse(r) };
|
|
186
|
+
} catch {
|
|
187
|
+
return { type: "markdown", value: r };
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
return { type: "json", value: e };
|
|
192
|
+
}
|
|
193
|
+
function ft(e) {
|
|
194
|
+
const n = mt(e);
|
|
195
|
+
if (typeof e == "string")
|
|
196
|
+
try {
|
|
197
|
+
const r = JSON.parse(e);
|
|
198
|
+
if (typeof r.exitCode == "number")
|
|
199
|
+
return {
|
|
200
|
+
exitCode: r.exitCode,
|
|
201
|
+
output: r.output || n,
|
|
202
|
+
success: r.exitCode === 0
|
|
203
|
+
};
|
|
204
|
+
} catch {
|
|
205
|
+
}
|
|
206
|
+
return {
|
|
207
|
+
output: n,
|
|
208
|
+
success: !0
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
function tr(e) {
|
|
212
|
+
const n = ut(e.name, e.input), r = ht(e.name, e.input, n);
|
|
213
|
+
return {
|
|
214
|
+
id: e.id,
|
|
215
|
+
toolName: e.name,
|
|
216
|
+
actionType: n,
|
|
217
|
+
status: "pending",
|
|
218
|
+
summary: r,
|
|
219
|
+
input: e.input,
|
|
220
|
+
startedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
function nr(e, n, r) {
|
|
224
|
+
const s = { ...e }, a = { ...e.actionType };
|
|
225
|
+
if (s.status = r ? "failed" : "success", s.completedAt = (/* @__PURE__ */ new Date()).toISOString(), s.isError = r, s.output = n, a.action === "command_run") {
|
|
226
|
+
const l = ft(n);
|
|
227
|
+
a.result = l, l.exitCode !== void 0 && l.exitCode !== 0 && (s.status = "failed", s.isError = !0);
|
|
228
|
+
} else (a.action === "mcp_tool" || a.action === "generic_tool") && (a.result = pt(n));
|
|
229
|
+
return s.actionType = a, s;
|
|
230
|
+
}
|
|
231
|
+
function rr(e) {
|
|
232
|
+
switch (e.action) {
|
|
233
|
+
case "command_run":
|
|
234
|
+
return "terminal";
|
|
235
|
+
case "file_read":
|
|
236
|
+
return "file-text";
|
|
237
|
+
case "file_edit":
|
|
238
|
+
return "edit";
|
|
239
|
+
case "file_write":
|
|
240
|
+
return "file-plus";
|
|
241
|
+
case "search":
|
|
242
|
+
return "search";
|
|
243
|
+
case "glob":
|
|
244
|
+
return "folder-search";
|
|
245
|
+
case "web_fetch":
|
|
246
|
+
return "globe";
|
|
247
|
+
case "web_search":
|
|
248
|
+
return "search";
|
|
249
|
+
case "mcp_tool":
|
|
250
|
+
return "plug";
|
|
251
|
+
case "generic_tool":
|
|
252
|
+
return "tool";
|
|
253
|
+
case "todo_write":
|
|
254
|
+
return "list-checks";
|
|
255
|
+
case "agent_tool":
|
|
256
|
+
return "bot";
|
|
257
|
+
default:
|
|
258
|
+
return "tool";
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
function Ue(e) {
|
|
262
|
+
switch (e.action) {
|
|
263
|
+
case "command_run":
|
|
264
|
+
return "Command";
|
|
265
|
+
case "file_read":
|
|
266
|
+
return "Read";
|
|
267
|
+
case "file_edit":
|
|
268
|
+
return "Edit";
|
|
269
|
+
case "file_write":
|
|
270
|
+
return "Write";
|
|
271
|
+
case "search":
|
|
272
|
+
return "Search";
|
|
273
|
+
case "glob":
|
|
274
|
+
return "Glob";
|
|
275
|
+
case "web_fetch":
|
|
276
|
+
return "Fetch";
|
|
277
|
+
case "web_search":
|
|
278
|
+
return "Search";
|
|
279
|
+
case "mcp_tool":
|
|
280
|
+
return "MCP";
|
|
281
|
+
case "generic_tool":
|
|
282
|
+
return "Tool";
|
|
283
|
+
case "todo_write":
|
|
284
|
+
return "Tasks";
|
|
285
|
+
case "agent_tool":
|
|
286
|
+
return e.agentType;
|
|
287
|
+
default:
|
|
288
|
+
return "Tool";
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
function sr(e) {
|
|
292
|
+
return e < 1024 ? `${e} B` : e < 1024 * 1024 ? `${(e / 1024).toFixed(1)} KB` : `${(e / (1024 * 1024)).toFixed(1)} MB`;
|
|
293
|
+
}
|
|
294
|
+
function De(e) {
|
|
295
|
+
try {
|
|
296
|
+
return new Date(e).toLocaleTimeString("en-US", {
|
|
297
|
+
hour: "2-digit",
|
|
298
|
+
minute: "2-digit",
|
|
299
|
+
second: "2-digit",
|
|
300
|
+
hour12: !1
|
|
301
|
+
});
|
|
302
|
+
} catch {
|
|
303
|
+
return e;
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
function He(e, n) {
|
|
307
|
+
const r = typeof e == "string" ? new Date(e) : e, a = (/* @__PURE__ */ new Date()).getTime() - r.getTime(), l = Math.floor(a / 1e3);
|
|
308
|
+
if (l < 60)
|
|
309
|
+
return `${l}s`;
|
|
310
|
+
const c = Math.floor(l / 60), h = l % 60;
|
|
311
|
+
return h === 0 ? `${c}m` : `${c}m ${h}s`;
|
|
312
|
+
}
|
|
313
|
+
function ir(e, n) {
|
|
314
|
+
return e.length <= n ? e : e.substring(0, n - 3) + "...";
|
|
315
|
+
}
|
|
316
|
+
function p(...e) {
|
|
317
|
+
return e.filter(Boolean).join(" ");
|
|
318
|
+
}
|
|
319
|
+
function xt(e, n) {
|
|
320
|
+
const r = [];
|
|
321
|
+
let s = [], a = 0;
|
|
322
|
+
const l = () => {
|
|
323
|
+
s.length > 0 && (r.push({
|
|
324
|
+
type: "tool_group",
|
|
325
|
+
entries: [...s],
|
|
326
|
+
id: `tool-group-${a++}`
|
|
327
|
+
}), s = []);
|
|
328
|
+
};
|
|
329
|
+
for (const c of e)
|
|
330
|
+
c.entryType.type === "tool_call" ? (s.push(c), n.breakEveryNToolCalls && n.breakEveryNToolCalls > 0 && s.length >= n.breakEveryNToolCalls && l()) : (l(), r.push({ type: "single", entry: c }));
|
|
331
|
+
return l(), r;
|
|
332
|
+
}
|
|
333
|
+
function gt(e) {
|
|
334
|
+
return e.filter(
|
|
335
|
+
(n) => n.entryType.type === "tool_call"
|
|
336
|
+
).map((n) => n.entryType.toolCall);
|
|
337
|
+
}
|
|
338
|
+
function wt(e) {
|
|
339
|
+
const n = /(?:\*\*)?Option\s+(\d+)(?:\*\*)?[:\-]\s*([^\n]+)(?:\n((?:(?!\n(?:\*\*)?Option\s+\d).)*?))?/gi, r = [];
|
|
340
|
+
let s = -1, a;
|
|
341
|
+
for (n.lastIndex = 0; (a = n.exec(e)) !== null; ) {
|
|
342
|
+
s === -1 && (s = a.index);
|
|
343
|
+
const h = a[1] ?? "", o = a[2], w = o ? o.trim() : "", d = a[3];
|
|
344
|
+
let m;
|
|
345
|
+
if (d) {
|
|
346
|
+
const g = d.split(`
|
|
347
|
+
`).map((v) => v.trim()).filter((v) => v.length > 0).join(" ");
|
|
348
|
+
g && (m = g);
|
|
349
|
+
}
|
|
350
|
+
r.push({ id: h, label: w, description: m });
|
|
351
|
+
}
|
|
352
|
+
if (r.length >= 2)
|
|
353
|
+
return { preamble: s > 0 ? e.substring(0, s).trim() : "", options: r };
|
|
354
|
+
const l = /^(.*?(?:what would you like to do\??|choose an option|select.*?:|here are your options.*?:))\s*\n+((?:\d+\.\s+.+\n?)+)/ims, c = e.match(l);
|
|
355
|
+
if (c && c[1] && c[2]) {
|
|
356
|
+
const h = c[1].trim(), o = c[2], w = /(\d+)\.\s+([^\n]+)/g;
|
|
357
|
+
let d;
|
|
358
|
+
for (; (d = w.exec(o)) !== null; ) {
|
|
359
|
+
const m = d[1] ?? "", g = d[2], v = g ? g.trim() : "";
|
|
360
|
+
r.push({
|
|
361
|
+
id: m,
|
|
362
|
+
label: v
|
|
363
|
+
});
|
|
364
|
+
}
|
|
365
|
+
if (r.length >= 2)
|
|
366
|
+
return { preamble: h, options: r };
|
|
367
|
+
}
|
|
368
|
+
return null;
|
|
369
|
+
}
|
|
370
|
+
function ar({ className: e }) {
|
|
371
|
+
return /* @__PURE__ */ i("svg", { className: e, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
|
|
372
|
+
/* @__PURE__ */ t("circle", { cx: "12", cy: "12", r: "5" }),
|
|
373
|
+
/* @__PURE__ */ t("line", { x1: "12", y1: "1", x2: "12", y2: "3" }),
|
|
374
|
+
/* @__PURE__ */ t("line", { x1: "12", y1: "21", x2: "12", y2: "23" }),
|
|
375
|
+
/* @__PURE__ */ t("line", { x1: "4.22", y1: "4.22", x2: "5.64", y2: "5.64" }),
|
|
376
|
+
/* @__PURE__ */ t("line", { x1: "18.36", y1: "18.36", x2: "19.78", y2: "19.78" }),
|
|
377
|
+
/* @__PURE__ */ t("line", { x1: "1", y1: "12", x2: "3", y2: "12" }),
|
|
378
|
+
/* @__PURE__ */ t("line", { x1: "21", y1: "12", x2: "23", y2: "12" }),
|
|
379
|
+
/* @__PURE__ */ t("line", { x1: "4.22", y1: "19.78", x2: "5.64", y2: "18.36" }),
|
|
380
|
+
/* @__PURE__ */ t("line", { x1: "18.36", y1: "5.64", x2: "19.78", y2: "4.22" })
|
|
381
|
+
] });
|
|
382
|
+
}
|
|
383
|
+
function lr({ className: e }) {
|
|
384
|
+
return /* @__PURE__ */ t("svg", { className: e, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ t("path", { d: "M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z" }) });
|
|
385
|
+
}
|
|
386
|
+
function je({ className: e }) {
|
|
387
|
+
return /* @__PURE__ */ t("svg", { className: e, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ t("polyline", { points: "6 9 12 15 18 9" }) });
|
|
388
|
+
}
|
|
389
|
+
function ve({ className: e }) {
|
|
390
|
+
return /* @__PURE__ */ t("svg", { className: e, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ t("polyline", { points: "9 18 15 12 9 6" }) });
|
|
391
|
+
}
|
|
392
|
+
function or({ className: e }) {
|
|
393
|
+
return /* @__PURE__ */ t("svg", { className: e, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ t("polyline", { points: "15 18 9 12 15 6" }) });
|
|
394
|
+
}
|
|
395
|
+
function cr({ className: e }) {
|
|
396
|
+
return /* @__PURE__ */ t("svg", { className: e, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ t("polyline", { points: "18 15 12 9 6 15" }) });
|
|
397
|
+
}
|
|
398
|
+
function Me({ className: e }) {
|
|
399
|
+
return /* @__PURE__ */ i("svg", { className: e, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
|
|
400
|
+
/* @__PURE__ */ t("polyline", { points: "4 17 10 11 4 5" }),
|
|
401
|
+
/* @__PURE__ */ t("line", { x1: "12", y1: "19", x2: "20", y2: "19" })
|
|
402
|
+
] });
|
|
403
|
+
}
|
|
404
|
+
function We({ className: e }) {
|
|
405
|
+
return /* @__PURE__ */ i("svg", { className: e, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
|
|
406
|
+
/* @__PURE__ */ t("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" }),
|
|
407
|
+
/* @__PURE__ */ t("polyline", { points: "14 2 14 8 20 8" }),
|
|
408
|
+
/* @__PURE__ */ t("line", { x1: "16", y1: "13", x2: "8", y2: "13" }),
|
|
409
|
+
/* @__PURE__ */ t("line", { x1: "16", y1: "17", x2: "8", y2: "17" })
|
|
410
|
+
] });
|
|
411
|
+
}
|
|
412
|
+
function Be({ className: e }) {
|
|
413
|
+
return /* @__PURE__ */ i("svg", { className: e, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
|
|
414
|
+
/* @__PURE__ */ t("path", { d: "M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7" }),
|
|
415
|
+
/* @__PURE__ */ t("path", { d: "M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z" })
|
|
416
|
+
] });
|
|
417
|
+
}
|
|
418
|
+
function vt({ className: e }) {
|
|
419
|
+
return /* @__PURE__ */ i("svg", { className: e, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
|
|
420
|
+
/* @__PURE__ */ t("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" }),
|
|
421
|
+
/* @__PURE__ */ t("polyline", { points: "14 2 14 8 20 8" }),
|
|
422
|
+
/* @__PURE__ */ t("line", { x1: "12", y1: "18", x2: "12", y2: "12" }),
|
|
423
|
+
/* @__PURE__ */ t("line", { x1: "9", y1: "15", x2: "15", y2: "15" })
|
|
424
|
+
] });
|
|
425
|
+
}
|
|
426
|
+
function _e({ className: e }) {
|
|
427
|
+
return /* @__PURE__ */ i("svg", { className: e, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
|
|
428
|
+
/* @__PURE__ */ t("circle", { cx: "11", cy: "11", r: "8" }),
|
|
429
|
+
/* @__PURE__ */ t("line", { x1: "21", y1: "21", x2: "16.65", y2: "16.65" })
|
|
430
|
+
] });
|
|
431
|
+
}
|
|
432
|
+
function yt({ className: e }) {
|
|
433
|
+
return /* @__PURE__ */ i("svg", { className: e, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
|
|
434
|
+
/* @__PURE__ */ t("circle", { cx: "12", cy: "12", r: "10" }),
|
|
435
|
+
/* @__PURE__ */ t("line", { x1: "2", y1: "12", x2: "22", y2: "12" }),
|
|
436
|
+
/* @__PURE__ */ t("path", { d: "M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z" })
|
|
437
|
+
] });
|
|
438
|
+
}
|
|
439
|
+
function bt({ className: e }) {
|
|
440
|
+
return /* @__PURE__ */ i("svg", { className: e, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
|
|
441
|
+
/* @__PURE__ */ t("path", { d: "M12 2v6" }),
|
|
442
|
+
/* @__PURE__ */ t("path", { d: "M6 6v4a6 6 0 0 0 12 0V6" }),
|
|
443
|
+
/* @__PURE__ */ t("path", { d: "M12 16v6" })
|
|
444
|
+
] });
|
|
445
|
+
}
|
|
446
|
+
function Nt({ className: e }) {
|
|
447
|
+
return /* @__PURE__ */ t("svg", { className: e, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ t("path", { d: "M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z" }) });
|
|
448
|
+
}
|
|
449
|
+
function kt({ className: e }) {
|
|
450
|
+
return /* @__PURE__ */ i("svg", { className: e, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
|
|
451
|
+
/* @__PURE__ */ t("path", { d: "M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z" }),
|
|
452
|
+
/* @__PURE__ */ t("circle", { cx: "11", cy: "13", r: "3" }),
|
|
453
|
+
/* @__PURE__ */ t("line", { x1: "15", y1: "16", x2: "17", y2: "18" })
|
|
454
|
+
] });
|
|
455
|
+
}
|
|
456
|
+
function dr({ className: e }) {
|
|
457
|
+
return /* @__PURE__ */ i("svg", { className: e, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
|
|
458
|
+
/* @__PURE__ */ t("polyline", { points: "16 18 22 12 16 6" }),
|
|
459
|
+
/* @__PURE__ */ t("polyline", { points: "8 6 2 12 8 18" })
|
|
460
|
+
] });
|
|
461
|
+
}
|
|
462
|
+
function ur({ className: e }) {
|
|
463
|
+
return /* @__PURE__ */ i("svg", { className: e, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
|
|
464
|
+
/* @__PURE__ */ t("rect", { x: "9", y: "9", width: "13", height: "13", rx: "2", ry: "2" }),
|
|
465
|
+
/* @__PURE__ */ t("path", { d: "M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" })
|
|
466
|
+
] });
|
|
467
|
+
}
|
|
468
|
+
function Ct({ className: e }) {
|
|
469
|
+
return /* @__PURE__ */ t("svg", { className: e, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ t("polyline", { points: "20 6 9 17 4 12" }) });
|
|
470
|
+
}
|
|
471
|
+
function hr({ className: e }) {
|
|
472
|
+
return /* @__PURE__ */ i("svg", { className: e, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
|
|
473
|
+
/* @__PURE__ */ t("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
|
|
474
|
+
/* @__PURE__ */ t("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
|
|
475
|
+
] });
|
|
476
|
+
}
|
|
477
|
+
function _t({ className: e }) {
|
|
478
|
+
return /* @__PURE__ */ i("svg", { className: e, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
|
|
479
|
+
/* @__PURE__ */ t("line", { x1: "12", y1: "2", x2: "12", y2: "6" }),
|
|
480
|
+
/* @__PURE__ */ t("line", { x1: "12", y1: "18", x2: "12", y2: "22" }),
|
|
481
|
+
/* @__PURE__ */ t("line", { x1: "4.93", y1: "4.93", x2: "7.76", y2: "7.76" }),
|
|
482
|
+
/* @__PURE__ */ t("line", { x1: "16.24", y1: "16.24", x2: "19.07", y2: "19.07" }),
|
|
483
|
+
/* @__PURE__ */ t("line", { x1: "2", y1: "12", x2: "6", y2: "12" }),
|
|
484
|
+
/* @__PURE__ */ t("line", { x1: "18", y1: "12", x2: "22", y2: "12" }),
|
|
485
|
+
/* @__PURE__ */ t("line", { x1: "4.93", y1: "19.07", x2: "7.76", y2: "16.24" }),
|
|
486
|
+
/* @__PURE__ */ t("line", { x1: "16.24", y1: "7.76", x2: "19.07", y2: "4.93" })
|
|
487
|
+
] });
|
|
488
|
+
}
|
|
489
|
+
function Tt({ className: e }) {
|
|
490
|
+
return /* @__PURE__ */ i("svg", { className: e, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
|
|
491
|
+
/* @__PURE__ */ t("circle", { cx: "12", cy: "12", r: "10" }),
|
|
492
|
+
/* @__PURE__ */ t("line", { x1: "12", y1: "16", x2: "12", y2: "12" }),
|
|
493
|
+
/* @__PURE__ */ t("line", { x1: "12", y1: "8", x2: "12.01", y2: "8" })
|
|
494
|
+
] });
|
|
495
|
+
}
|
|
496
|
+
function Ke({ className: e }) {
|
|
497
|
+
return /* @__PURE__ */ i("svg", { className: e, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
|
|
498
|
+
/* @__PURE__ */ t("path", { d: "M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z" }),
|
|
499
|
+
/* @__PURE__ */ t("line", { x1: "12", y1: "9", x2: "12", y2: "13" }),
|
|
500
|
+
/* @__PURE__ */ t("line", { x1: "12", y1: "17", x2: "12.01", y2: "17" })
|
|
501
|
+
] });
|
|
502
|
+
}
|
|
503
|
+
function St({ className: e }) {
|
|
504
|
+
return /* @__PURE__ */ i("svg", { className: e, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
|
|
505
|
+
/* @__PURE__ */ t("circle", { cx: "12", cy: "12", r: "10" }),
|
|
506
|
+
/* @__PURE__ */ t("line", { x1: "12", y1: "8", x2: "12", y2: "12" }),
|
|
507
|
+
/* @__PURE__ */ t("line", { x1: "12", y1: "16", x2: "12.01", y2: "16" })
|
|
508
|
+
] });
|
|
509
|
+
}
|
|
510
|
+
function Mt({ className: e }) {
|
|
511
|
+
return /* @__PURE__ */ i("svg", { className: e, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
|
|
512
|
+
/* @__PURE__ */ t("rect", { x: "8", y: "6", width: "8", height: "14", rx: "4" }),
|
|
513
|
+
/* @__PURE__ */ t("path", { d: "M3 10h2" }),
|
|
514
|
+
/* @__PURE__ */ t("path", { d: "M19 10h2" }),
|
|
515
|
+
/* @__PURE__ */ t("path", { d: "M3 14h2" }),
|
|
516
|
+
/* @__PURE__ */ t("path", { d: "M19 14h2" }),
|
|
517
|
+
/* @__PURE__ */ t("path", { d: "M9 2h6" }),
|
|
518
|
+
/* @__PURE__ */ t("path", { d: "M12 2v4" })
|
|
519
|
+
] });
|
|
520
|
+
}
|
|
521
|
+
function It({ className: e }) {
|
|
522
|
+
return /* @__PURE__ */ i("svg", { className: e, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
|
|
523
|
+
/* @__PURE__ */ t("circle", { cx: "12", cy: "12", r: "10" }),
|
|
524
|
+
/* @__PURE__ */ t("path", { d: "M9 12l2 2 4-4" })
|
|
525
|
+
] });
|
|
526
|
+
}
|
|
527
|
+
function mr({ className: e }) {
|
|
528
|
+
return /* @__PURE__ */ i("svg", { className: e, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
|
|
529
|
+
/* @__PURE__ */ t("circle", { cx: "12", cy: "12", r: "10" }),
|
|
530
|
+
/* @__PURE__ */ t("line", { x1: "15", y1: "9", x2: "9", y2: "15" }),
|
|
531
|
+
/* @__PURE__ */ t("line", { x1: "9", y1: "9", x2: "15", y2: "15" })
|
|
532
|
+
] });
|
|
533
|
+
}
|
|
534
|
+
function pr({ className: e }) {
|
|
535
|
+
return /* @__PURE__ */ i("svg", { className: e, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
|
|
536
|
+
/* @__PURE__ */ t("line", { x1: "22", y1: "2", x2: "11", y2: "13" }),
|
|
537
|
+
/* @__PURE__ */ t("polygon", { points: "22 2 15 22 11 13 2 9 22 2" })
|
|
538
|
+
] });
|
|
539
|
+
}
|
|
540
|
+
function Et({ className: e }) {
|
|
541
|
+
return /* @__PURE__ */ t("svg", { className: e, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ t("path", { d: "M21.44 11.05l-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48" }) });
|
|
542
|
+
}
|
|
543
|
+
function fr({ className: e }) {
|
|
544
|
+
return /* @__PURE__ */ i("svg", { className: e, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
|
|
545
|
+
/* @__PURE__ */ t("circle", { cx: "12", cy: "12", r: "10" }),
|
|
546
|
+
/* @__PURE__ */ t("rect", { x: "9", y: "9", width: "6", height: "6" })
|
|
547
|
+
] });
|
|
548
|
+
}
|
|
549
|
+
function xr({ className: e }) {
|
|
550
|
+
return /* @__PURE__ */ t("svg", { className: e, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ t("path", { d: "M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z" }) });
|
|
551
|
+
}
|
|
552
|
+
function Lt({ className: e }) {
|
|
553
|
+
return /* @__PURE__ */ i("svg", { className: e, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
|
|
554
|
+
/* @__PURE__ */ t("path", { d: "M12 3l1.5 4.5L18 9l-4.5 1.5L12 15l-1.5-4.5L6 9l4.5-1.5L12 3z" }),
|
|
555
|
+
/* @__PURE__ */ t("path", { d: "M5 19l.5 1.5L7 21l-1.5.5L5 23l-.5-1.5L3 21l1.5-.5L5 19z" }),
|
|
556
|
+
/* @__PURE__ */ t("path", { d: "M19 11l.5 1.5L21 13l-1.5.5L19 15l-.5-1.5L17 13l1.5-.5L19 11z" })
|
|
557
|
+
] });
|
|
558
|
+
}
|
|
559
|
+
function gr({ className: e }) {
|
|
560
|
+
return /* @__PURE__ */ i("svg", { className: e, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
|
|
561
|
+
/* @__PURE__ */ t("path", { d: "M9.5 2A2.5 2.5 0 0 1 12 4.5v15a2.5 2.5 0 0 1-4.96.44 2.5 2.5 0 0 1-2.96-3.08 3 3 0 0 1-.34-5.58 2.5 2.5 0 0 1 1.32-4.24 2.5 2.5 0 0 1 4.44-1.54" }),
|
|
562
|
+
/* @__PURE__ */ t("path", { d: "M14.5 2A2.5 2.5 0 0 0 12 4.5v15a2.5 2.5 0 0 0 4.96.44 2.5 2.5 0 0 0 2.96-3.08 3 3 0 0 0 .34-5.58 2.5 2.5 0 0 0-1.32-4.24 2.5 2.5 0 0 0-4.44-1.54" })
|
|
563
|
+
] });
|
|
564
|
+
}
|
|
565
|
+
function de({ className: e }) {
|
|
566
|
+
return /* @__PURE__ */ i("svg", { className: e, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
|
|
567
|
+
/* @__PURE__ */ t("path", { d: "M12 8V4H8" }),
|
|
568
|
+
/* @__PURE__ */ t("rect", { x: "5", y: "8", width: "14", height: "12", rx: "2" }),
|
|
569
|
+
/* @__PURE__ */ t("path", { d: "M2 14h2" }),
|
|
570
|
+
/* @__PURE__ */ t("path", { d: "M20 14h2" }),
|
|
571
|
+
/* @__PURE__ */ t("path", { d: "M9 13v2" }),
|
|
572
|
+
/* @__PURE__ */ t("path", { d: "M15 13v2" })
|
|
573
|
+
] });
|
|
574
|
+
}
|
|
575
|
+
function $t({ className: e }) {
|
|
576
|
+
return /* @__PURE__ */ i("svg", { className: e, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
|
|
577
|
+
/* @__PURE__ */ t("path", { d: "M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2" }),
|
|
578
|
+
/* @__PURE__ */ t("circle", { cx: "12", cy: "7", r: "4" })
|
|
579
|
+
] });
|
|
580
|
+
}
|
|
581
|
+
function At({ className: e }) {
|
|
582
|
+
return /* @__PURE__ */ t("svg", { className: e, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ t("circle", { cx: "12", cy: "12", r: "10" }) });
|
|
583
|
+
}
|
|
584
|
+
function Rt({ className: e }) {
|
|
585
|
+
return /* @__PURE__ */ i("svg", { className: e, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
|
|
586
|
+
/* @__PURE__ */ t("path", { d: "M10 6h11" }),
|
|
587
|
+
/* @__PURE__ */ t("path", { d: "M10 12h11" }),
|
|
588
|
+
/* @__PURE__ */ t("path", { d: "M10 18h11" }),
|
|
589
|
+
/* @__PURE__ */ t("path", { d: "M3 6l2 2 4-4" }),
|
|
590
|
+
/* @__PURE__ */ t("path", { d: "M3 12l2 2 4-4" }),
|
|
591
|
+
/* @__PURE__ */ t("path", { d: "M3 18l2 2 4-4" })
|
|
592
|
+
] });
|
|
593
|
+
}
|
|
594
|
+
function Dt({ className: e }) {
|
|
595
|
+
return /* @__PURE__ */ i("svg", { className: e, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
|
|
596
|
+
/* @__PURE__ */ t("circle", { cx: "12", cy: "12", r: "10" }),
|
|
597
|
+
/* @__PURE__ */ t("polyline", { points: "12 6 12 12 16 14" })
|
|
598
|
+
] });
|
|
599
|
+
}
|
|
600
|
+
function qe({ className: e }) {
|
|
601
|
+
return /* @__PURE__ */ t("svg", { className: e, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ t("path", { d: "M21 12a9 9 0 1 1-6.219-8.56" }) });
|
|
602
|
+
}
|
|
603
|
+
function jt({ status: e, size: n = "sm", className: r }) {
|
|
604
|
+
const s = {
|
|
605
|
+
sm: "w-2 h-2",
|
|
606
|
+
md: "w-3 h-3",
|
|
607
|
+
lg: "w-4 h-4"
|
|
608
|
+
}, a = {
|
|
609
|
+
pending: "ash-status-pending",
|
|
610
|
+
success: "ash-status-success",
|
|
611
|
+
failed: "ash-status-failed"
|
|
612
|
+
};
|
|
613
|
+
return /* @__PURE__ */ t(
|
|
614
|
+
"div",
|
|
615
|
+
{
|
|
616
|
+
className: p(
|
|
617
|
+
"rounded-full flex-shrink-0",
|
|
618
|
+
s[n],
|
|
619
|
+
a[e],
|
|
620
|
+
r
|
|
621
|
+
)
|
|
622
|
+
}
|
|
623
|
+
);
|
|
624
|
+
}
|
|
625
|
+
function Ye({ actionType: e, className: n = "w-4 h-4" }) {
|
|
626
|
+
switch (e.action) {
|
|
627
|
+
case "command_run":
|
|
628
|
+
return /* @__PURE__ */ t(Me, { className: n });
|
|
629
|
+
case "file_read":
|
|
630
|
+
return /* @__PURE__ */ t(We, { className: n });
|
|
631
|
+
case "file_edit":
|
|
632
|
+
return /* @__PURE__ */ t(Be, { className: n });
|
|
633
|
+
case "file_write":
|
|
634
|
+
return /* @__PURE__ */ t(vt, { className: n });
|
|
635
|
+
case "search":
|
|
636
|
+
return /* @__PURE__ */ t(_e, { className: n });
|
|
637
|
+
case "glob":
|
|
638
|
+
return /* @__PURE__ */ t(kt, { className: n });
|
|
639
|
+
case "web_fetch":
|
|
640
|
+
return /* @__PURE__ */ t(yt, { className: n });
|
|
641
|
+
case "web_search":
|
|
642
|
+
return /* @__PURE__ */ t(_e, { className: n });
|
|
643
|
+
case "mcp_tool":
|
|
644
|
+
return /* @__PURE__ */ t(bt, { className: n });
|
|
645
|
+
case "todo_write":
|
|
646
|
+
return /* @__PURE__ */ t(Rt, { className: n });
|
|
647
|
+
case "agent_tool":
|
|
648
|
+
return /* @__PURE__ */ t(de, { className: n });
|
|
649
|
+
case "generic_tool":
|
|
650
|
+
default:
|
|
651
|
+
return /* @__PURE__ */ t(Nt, { className: n });
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
function se({
|
|
655
|
+
children: e,
|
|
656
|
+
maxHeight: n = 200,
|
|
657
|
+
language: r,
|
|
658
|
+
showLineNumbers: s = !1,
|
|
659
|
+
className: a
|
|
660
|
+
}) {
|
|
661
|
+
const [l, c] = N(!1), h = e.split(`
|
|
662
|
+
`), o = h.length > 10 || e.length > 500;
|
|
663
|
+
return /* @__PURE__ */ i("div", { className: p("relative", a), children: [
|
|
664
|
+
/* @__PURE__ */ t(
|
|
665
|
+
"pre",
|
|
666
|
+
{
|
|
667
|
+
className: p(
|
|
668
|
+
"ash-tool-code-block text-xs font-mono text-white/90 p-3 rounded-xl overflow-x-auto whitespace-pre-wrap break-words",
|
|
669
|
+
!l && o && "overflow-y-hidden"
|
|
670
|
+
),
|
|
671
|
+
style: !l && o ? { maxHeight: n } : void 0,
|
|
672
|
+
"data-language": r,
|
|
673
|
+
children: s ? /* @__PURE__ */ t("code", { children: h.map((w, d) => /* @__PURE__ */ i("span", { className: "block", children: [
|
|
674
|
+
/* @__PURE__ */ t("span", { className: "inline-block w-8 text-white/30 select-none text-right pr-2", children: d + 1 }),
|
|
675
|
+
/* @__PURE__ */ t("span", { className: "text-white/80", children: w })
|
|
676
|
+
] }, d)) }) : /* @__PURE__ */ t("code", { className: "text-white/80", children: e })
|
|
677
|
+
}
|
|
678
|
+
),
|
|
679
|
+
o && !l && /* @__PURE__ */ t("div", { className: "absolute bottom-0 left-0 right-0 h-12 ash-truncate-fade flex items-end justify-center pb-2", children: /* @__PURE__ */ t(
|
|
680
|
+
"button",
|
|
681
|
+
{
|
|
682
|
+
onClick: () => c(!0),
|
|
683
|
+
className: "text-xs text-[var(--ash-accent)] hover:text-[var(--ash-accent-300)] font-medium transition-colors",
|
|
684
|
+
children: "Show more"
|
|
685
|
+
}
|
|
686
|
+
) }),
|
|
687
|
+
o && l && /* @__PURE__ */ t(
|
|
688
|
+
"button",
|
|
689
|
+
{
|
|
690
|
+
onClick: () => c(!1),
|
|
691
|
+
className: "text-xs text-[var(--ash-accent)] hover:text-[var(--ash-accent-300)] font-medium mt-2 transition-colors",
|
|
692
|
+
children: "Show less"
|
|
693
|
+
}
|
|
694
|
+
)
|
|
695
|
+
] });
|
|
696
|
+
}
|
|
697
|
+
function Te({ value: e, maxHeight: n, className: r }) {
|
|
698
|
+
const s = JSON.stringify(e, null, 2);
|
|
699
|
+
return /* @__PURE__ */ t(se, { maxHeight: n, className: r, children: s });
|
|
700
|
+
}
|
|
701
|
+
function Ze({
|
|
702
|
+
toolCall: e,
|
|
703
|
+
defaultExpanded: n = !1,
|
|
704
|
+
className: r,
|
|
705
|
+
depth: s = 0
|
|
706
|
+
}) {
|
|
707
|
+
const [a, l] = N(n), [c, h] = N(""), o = O(null), { actionType: w, status: d, summary: m, nestedToolCalls: g, nestedToolCallCount: v, startedAt: S } = e, z = re(() => {
|
|
708
|
+
if (w.action !== "agent_tool")
|
|
709
|
+
return null;
|
|
710
|
+
const P = w;
|
|
711
|
+
return {
|
|
712
|
+
agentType: P.agentType,
|
|
713
|
+
description: P.description,
|
|
714
|
+
prompt: P.prompt
|
|
715
|
+
};
|
|
716
|
+
}, [w]), M = v ?? (g == null ? void 0 : g.length) ?? 0, k = d === "pending";
|
|
717
|
+
if (j(() => {
|
|
718
|
+
if (k && S)
|
|
719
|
+
return h(He(S)), o.current = setInterval(() => {
|
|
720
|
+
h(He(S));
|
|
721
|
+
}, 1e3), () => {
|
|
722
|
+
o.current && (clearInterval(o.current), o.current = null);
|
|
723
|
+
};
|
|
724
|
+
k || (o.current && (clearInterval(o.current), o.current = null), h(""));
|
|
725
|
+
}, [k, S]), !z)
|
|
726
|
+
return null;
|
|
727
|
+
const { agentType: A, description: E, prompt: W } = z, F = s > 0 ? "ml-4" : "";
|
|
728
|
+
return /* @__PURE__ */ i(
|
|
729
|
+
"div",
|
|
730
|
+
{
|
|
731
|
+
className: p(
|
|
732
|
+
"rounded-xl border bg-[var(--ash-surface-dark,#0a0a0a)] overflow-hidden",
|
|
733
|
+
k ? "border-yellow-500/30" : d === "failed" ? "border-red-500/30" : "border-white/10",
|
|
734
|
+
F,
|
|
735
|
+
r
|
|
736
|
+
),
|
|
737
|
+
children: [
|
|
738
|
+
/* @__PURE__ */ i(
|
|
739
|
+
"button",
|
|
740
|
+
{
|
|
741
|
+
onClick: () => l(!a),
|
|
742
|
+
className: "w-full px-4 py-3 flex items-center gap-3 hover:bg-white/5 cursor-pointer transition-colors",
|
|
743
|
+
children: [
|
|
744
|
+
/* @__PURE__ */ t(
|
|
745
|
+
ve,
|
|
746
|
+
{
|
|
747
|
+
className: p(
|
|
748
|
+
"w-4 h-4 text-white/40 transition-transform duration-200 shrink-0",
|
|
749
|
+
a && "rotate-90"
|
|
750
|
+
)
|
|
751
|
+
}
|
|
752
|
+
),
|
|
753
|
+
/* @__PURE__ */ t(
|
|
754
|
+
"div",
|
|
755
|
+
{
|
|
756
|
+
className: p(
|
|
757
|
+
"w-6 h-6 rounded-lg flex items-center justify-center shrink-0",
|
|
758
|
+
k ? "bg-yellow-500/20" : d === "failed" ? "bg-red-500/20" : "bg-[var(--ash-accent)]/20"
|
|
759
|
+
),
|
|
760
|
+
children: k ? /* @__PURE__ */ t(
|
|
761
|
+
qe,
|
|
762
|
+
{
|
|
763
|
+
className: "w-3.5 h-3.5 text-yellow-400 animate-spin"
|
|
764
|
+
}
|
|
765
|
+
) : /* @__PURE__ */ t(
|
|
766
|
+
de,
|
|
767
|
+
{
|
|
768
|
+
className: p(
|
|
769
|
+
"w-3.5 h-3.5",
|
|
770
|
+
d === "failed" ? "text-red-400" : "text-[var(--ash-accent)]"
|
|
771
|
+
)
|
|
772
|
+
}
|
|
773
|
+
)
|
|
774
|
+
}
|
|
775
|
+
),
|
|
776
|
+
/* @__PURE__ */ t(
|
|
777
|
+
"span",
|
|
778
|
+
{
|
|
779
|
+
className: p(
|
|
780
|
+
"px-2 py-0.5 rounded text-xs font-medium shrink-0",
|
|
781
|
+
k ? "bg-yellow-500/20 text-yellow-400" : d === "failed" ? "bg-red-500/20 text-red-400" : "bg-white/10 text-white/70"
|
|
782
|
+
),
|
|
783
|
+
children: A
|
|
784
|
+
}
|
|
785
|
+
),
|
|
786
|
+
/* @__PURE__ */ t("span", { className: "text-sm text-white/80 truncate flex-1 text-left", children: E || m }),
|
|
787
|
+
M > 0 && /* @__PURE__ */ i("span", { className: "text-xs text-white/50 shrink-0", children: [
|
|
788
|
+
M,
|
|
789
|
+
" tool call",
|
|
790
|
+
M !== 1 ? "s" : ""
|
|
791
|
+
] }),
|
|
792
|
+
k && c && /* @__PURE__ */ i("div", { className: "flex items-center gap-1 text-xs text-white/40 shrink-0", children: [
|
|
793
|
+
/* @__PURE__ */ t(Dt, { className: "w-3 h-3" }),
|
|
794
|
+
/* @__PURE__ */ t("span", { children: c })
|
|
795
|
+
] }),
|
|
796
|
+
/* @__PURE__ */ t("span", { className: "text-white/30 shrink-0", children: "..." })
|
|
797
|
+
]
|
|
798
|
+
}
|
|
799
|
+
),
|
|
800
|
+
a && /* @__PURE__ */ i("div", { className: "border-t border-white/5 bg-black/20", children: [
|
|
801
|
+
W && /* @__PURE__ */ t("div", { className: "px-4 py-3 border-b border-white/5", children: /* @__PURE__ */ t("p", { className: "text-sm text-white/70 whitespace-pre-wrap", children: W.length > 500 ? W.substring(0, 500) + "..." : W }) }),
|
|
802
|
+
g && g.length > 0 && /* @__PURE__ */ t("div", { className: "p-3 space-y-2", children: g.map((P) => /* @__PURE__ */ t("div", { children: P.actionType.action === "agent_tool" ? /* @__PURE__ */ t(
|
|
803
|
+
Ze,
|
|
804
|
+
{
|
|
805
|
+
toolCall: P,
|
|
806
|
+
defaultExpanded: !1,
|
|
807
|
+
depth: s + 1
|
|
808
|
+
}
|
|
809
|
+
) : /* @__PURE__ */ t(
|
|
810
|
+
Oe,
|
|
811
|
+
{
|
|
812
|
+
toolCall: P,
|
|
813
|
+
defaultExpanded: !1
|
|
814
|
+
}
|
|
815
|
+
) }, P.id)) }),
|
|
816
|
+
(!g || g.length === 0) && k && /* @__PURE__ */ t("div", { className: "px-4 py-6 flex items-center justify-center", children: /* @__PURE__ */ i("div", { className: "flex items-center gap-2 text-sm text-white/40", children: [
|
|
817
|
+
/* @__PURE__ */ t(qe, { className: "w-4 h-4 animate-spin" }),
|
|
818
|
+
/* @__PURE__ */ t("span", { children: "Agent is working..." })
|
|
819
|
+
] }) }),
|
|
820
|
+
(!g || g.length === 0) && !k && /* @__PURE__ */ t("div", { className: "px-4 py-4 text-sm text-white/40 text-center", children: "No tool calls recorded" })
|
|
821
|
+
] })
|
|
822
|
+
]
|
|
823
|
+
}
|
|
824
|
+
);
|
|
825
|
+
}
|
|
826
|
+
function L({ children: e }) {
|
|
827
|
+
return /* @__PURE__ */ t("div", { className: "ash-tool-section-header", children: e });
|
|
828
|
+
}
|
|
829
|
+
function $({ children: e }) {
|
|
830
|
+
return /* @__PURE__ */ t("div", { className: "px-3 py-2", children: e });
|
|
831
|
+
}
|
|
832
|
+
function Wt({ action: e }) {
|
|
833
|
+
var n;
|
|
834
|
+
return /* @__PURE__ */ i(_, { children: [
|
|
835
|
+
e.command && /* @__PURE__ */ i(_, { children: [
|
|
836
|
+
/* @__PURE__ */ t(L, { children: "COMMAND" }),
|
|
837
|
+
/* @__PURE__ */ t($, { children: /* @__PURE__ */ t(se, { children: e.command }) })
|
|
838
|
+
] }),
|
|
839
|
+
((n = e.result) == null ? void 0 : n.output) && /* @__PURE__ */ i(_, { children: [
|
|
840
|
+
/* @__PURE__ */ t(L, { children: "OUTPUT" }),
|
|
841
|
+
/* @__PURE__ */ i($, { children: [
|
|
842
|
+
/* @__PURE__ */ t(se, { maxHeight: 300, children: e.result.output }),
|
|
843
|
+
e.result.exitCode !== void 0 && e.result.exitCode !== 0 && /* @__PURE__ */ i("div", { className: "mt-2 text-xs text-red-400", children: [
|
|
844
|
+
"Exit code: ",
|
|
845
|
+
e.result.exitCode
|
|
846
|
+
] })
|
|
847
|
+
] })
|
|
848
|
+
] })
|
|
849
|
+
] });
|
|
850
|
+
}
|
|
851
|
+
function Bt({ action: e }) {
|
|
852
|
+
return /* @__PURE__ */ i(_, { children: [
|
|
853
|
+
/* @__PURE__ */ t(L, { children: "PATH" }),
|
|
854
|
+
/* @__PURE__ */ i($, { children: [
|
|
855
|
+
/* @__PURE__ */ t("code", { className: "text-xs font-mono bg-white/10 text-white/90 px-1 py-0.5 rounded", children: e.path }),
|
|
856
|
+
(e.offset !== void 0 || e.limit !== void 0) && /* @__PURE__ */ i("div", { className: "mt-1 text-xs text-white/50", children: [
|
|
857
|
+
e.offset !== void 0 && /* @__PURE__ */ i("span", { children: [
|
|
858
|
+
"Offset: ",
|
|
859
|
+
e.offset
|
|
860
|
+
] }),
|
|
861
|
+
e.offset !== void 0 && e.limit !== void 0 && /* @__PURE__ */ t("span", { children: " · " }),
|
|
862
|
+
e.limit !== void 0 && /* @__PURE__ */ i("span", { children: [
|
|
863
|
+
"Limit: ",
|
|
864
|
+
e.limit
|
|
865
|
+
] })
|
|
866
|
+
] })
|
|
867
|
+
] })
|
|
868
|
+
] });
|
|
869
|
+
}
|
|
870
|
+
function Ot({ action: e }) {
|
|
871
|
+
return /* @__PURE__ */ i(_, { children: [
|
|
872
|
+
/* @__PURE__ */ t(L, { children: "PATH" }),
|
|
873
|
+
/* @__PURE__ */ t($, { children: /* @__PURE__ */ t("code", { className: "text-xs font-mono bg-white/10 text-white/90 px-1 py-0.5 rounded", children: e.path }) }),
|
|
874
|
+
e.oldString && /* @__PURE__ */ i(_, { children: [
|
|
875
|
+
/* @__PURE__ */ t(L, { children: "OLD" }),
|
|
876
|
+
/* @__PURE__ */ t($, { children: /* @__PURE__ */ t(se, { children: e.oldString }) })
|
|
877
|
+
] }),
|
|
878
|
+
e.newString && /* @__PURE__ */ i(_, { children: [
|
|
879
|
+
/* @__PURE__ */ t(L, { children: "NEW" }),
|
|
880
|
+
/* @__PURE__ */ t($, { children: /* @__PURE__ */ t(se, { children: e.newString }) })
|
|
881
|
+
] })
|
|
882
|
+
] });
|
|
883
|
+
}
|
|
884
|
+
function zt({ action: e }) {
|
|
885
|
+
return /* @__PURE__ */ i(_, { children: [
|
|
886
|
+
/* @__PURE__ */ t(L, { children: "PATH" }),
|
|
887
|
+
/* @__PURE__ */ t($, { children: /* @__PURE__ */ t("code", { className: "text-xs font-mono bg-white/10 text-white/90 px-1 py-0.5 rounded", children: e.path }) }),
|
|
888
|
+
e.content && /* @__PURE__ */ i(_, { children: [
|
|
889
|
+
/* @__PURE__ */ t(L, { children: "CONTENT" }),
|
|
890
|
+
/* @__PURE__ */ t($, { children: /* @__PURE__ */ t(se, { maxHeight: 300, children: e.content }) })
|
|
891
|
+
] })
|
|
892
|
+
] });
|
|
893
|
+
}
|
|
894
|
+
function Ft({ action: e }) {
|
|
895
|
+
return /* @__PURE__ */ i(_, { children: [
|
|
896
|
+
/* @__PURE__ */ t(L, { children: "PATTERN" }),
|
|
897
|
+
/* @__PURE__ */ i($, { children: [
|
|
898
|
+
/* @__PURE__ */ t("code", { className: "text-xs font-mono bg-white/10 text-white/90 px-1 py-0.5 rounded", children: e.pattern }),
|
|
899
|
+
(e.path || e.glob || e.type) && /* @__PURE__ */ i("div", { className: "mt-1 text-xs text-white/50", children: [
|
|
900
|
+
e.path && /* @__PURE__ */ i("span", { children: [
|
|
901
|
+
"Path: ",
|
|
902
|
+
e.path
|
|
903
|
+
] }),
|
|
904
|
+
e.glob && /* @__PURE__ */ i("span", { children: [
|
|
905
|
+
"Glob: ",
|
|
906
|
+
e.glob
|
|
907
|
+
] }),
|
|
908
|
+
e.type && /* @__PURE__ */ i("span", { children: [
|
|
909
|
+
"Type: ",
|
|
910
|
+
e.type
|
|
911
|
+
] })
|
|
912
|
+
] })
|
|
913
|
+
] })
|
|
914
|
+
] });
|
|
915
|
+
}
|
|
916
|
+
function Pt({ action: e }) {
|
|
917
|
+
return /* @__PURE__ */ i(_, { children: [
|
|
918
|
+
/* @__PURE__ */ t(L, { children: "PATTERN" }),
|
|
919
|
+
/* @__PURE__ */ i($, { children: [
|
|
920
|
+
/* @__PURE__ */ t("code", { className: "text-xs font-mono bg-white/10 text-white/90 px-1 py-0.5 rounded", children: e.pattern }),
|
|
921
|
+
e.path && /* @__PURE__ */ i("div", { className: "mt-1 text-xs text-white/50", children: [
|
|
922
|
+
"Path: ",
|
|
923
|
+
e.path
|
|
924
|
+
] })
|
|
925
|
+
] })
|
|
926
|
+
] });
|
|
927
|
+
}
|
|
928
|
+
function Ht({ action: e }) {
|
|
929
|
+
return /* @__PURE__ */ i(_, { children: [
|
|
930
|
+
/* @__PURE__ */ t(L, { children: "URL" }),
|
|
931
|
+
/* @__PURE__ */ i($, { children: [
|
|
932
|
+
/* @__PURE__ */ t(
|
|
933
|
+
"a",
|
|
934
|
+
{
|
|
935
|
+
href: e.url,
|
|
936
|
+
target: "_blank",
|
|
937
|
+
rel: "noopener noreferrer",
|
|
938
|
+
className: "text-xs text-blue-400 hover:text-blue-300 underline break-all",
|
|
939
|
+
children: e.url
|
|
940
|
+
}
|
|
941
|
+
),
|
|
942
|
+
e.prompt && /* @__PURE__ */ t("div", { className: "mt-2 text-xs text-white/50", children: e.prompt })
|
|
943
|
+
] })
|
|
944
|
+
] });
|
|
945
|
+
}
|
|
946
|
+
function qt({ action: e }) {
|
|
947
|
+
return /* @__PURE__ */ i(_, { children: [
|
|
948
|
+
/* @__PURE__ */ t(L, { children: "QUERY" }),
|
|
949
|
+
/* @__PURE__ */ t($, { children: /* @__PURE__ */ t("span", { className: "text-sm text-white/90", children: e.query }) })
|
|
950
|
+
] });
|
|
951
|
+
}
|
|
952
|
+
function Vt({ action: e }) {
|
|
953
|
+
return /* @__PURE__ */ i(_, { children: [
|
|
954
|
+
/* @__PURE__ */ t(L, { children: "TOOL" }),
|
|
955
|
+
/* @__PURE__ */ t($, { children: /* @__PURE__ */ i("code", { className: "text-xs font-mono bg-white/10 text-white/90 px-1 py-0.5 rounded", children: [
|
|
956
|
+
e.serverName,
|
|
957
|
+
":",
|
|
958
|
+
e.toolName
|
|
959
|
+
] }) }),
|
|
960
|
+
e.arguments && /* @__PURE__ */ i(_, { children: [
|
|
961
|
+
/* @__PURE__ */ t(L, { children: "ARGS" }),
|
|
962
|
+
/* @__PURE__ */ t($, { children: /* @__PURE__ */ t(Te, { value: e.arguments }) })
|
|
963
|
+
] }),
|
|
964
|
+
e.result && /* @__PURE__ */ i(_, { children: [
|
|
965
|
+
/* @__PURE__ */ t(L, { children: "RESULT" }),
|
|
966
|
+
/* @__PURE__ */ t($, { children: e.result.type === "markdown" ? /* @__PURE__ */ t(se, { children: String(e.result.value) }) : /* @__PURE__ */ t(Te, { value: e.result.value }) })
|
|
967
|
+
] })
|
|
968
|
+
] });
|
|
969
|
+
}
|
|
970
|
+
function Gt({ action: e }) {
|
|
971
|
+
return /* @__PURE__ */ i(_, { children: [
|
|
972
|
+
e.arguments && /* @__PURE__ */ i(_, { children: [
|
|
973
|
+
/* @__PURE__ */ t(L, { children: "ARGS" }),
|
|
974
|
+
/* @__PURE__ */ t($, { children: /* @__PURE__ */ t(Te, { value: e.arguments }) })
|
|
975
|
+
] }),
|
|
976
|
+
e.result && /* @__PURE__ */ i(_, { children: [
|
|
977
|
+
/* @__PURE__ */ t(L, { children: "RESULT" }),
|
|
978
|
+
/* @__PURE__ */ t($, { children: e.result.type === "markdown" ? /* @__PURE__ */ t(se, { children: String(e.result.value) }) : /* @__PURE__ */ t(Te, { value: e.result.value }) })
|
|
979
|
+
] })
|
|
980
|
+
] });
|
|
981
|
+
}
|
|
982
|
+
function Jt({ action: e }) {
|
|
983
|
+
const { todos: n, stats: r } = e;
|
|
984
|
+
return /* @__PURE__ */ i(_, { children: [
|
|
985
|
+
r && /* @__PURE__ */ i(_, { children: [
|
|
986
|
+
/* @__PURE__ */ t(L, { children: "PROGRESS" }),
|
|
987
|
+
/* @__PURE__ */ i($, { children: [
|
|
988
|
+
/* @__PURE__ */ i("div", { className: "flex items-center gap-3", children: [
|
|
989
|
+
/* @__PURE__ */ t("div", { className: "flex-1 h-2 bg-white/10 rounded-full overflow-hidden", children: /* @__PURE__ */ t(
|
|
990
|
+
"div",
|
|
991
|
+
{
|
|
992
|
+
className: "h-full bg-emerald-400 rounded-full transition-all duration-500 ease-out",
|
|
993
|
+
style: { width: `${r.total > 0 ? r.completed / r.total * 100 : 0}%` }
|
|
994
|
+
}
|
|
995
|
+
) }),
|
|
996
|
+
/* @__PURE__ */ i("span", { className: "text-xs text-white/60 tabular-nums", children: [
|
|
997
|
+
r.completed,
|
|
998
|
+
"/",
|
|
999
|
+
r.total
|
|
1000
|
+
] })
|
|
1001
|
+
] }),
|
|
1002
|
+
/* @__PURE__ */ i("div", { className: "flex gap-3 mt-2 text-xs", children: [
|
|
1003
|
+
r.inProgress > 0 && /* @__PURE__ */ i("span", { className: "text-yellow-400", children: [
|
|
1004
|
+
r.inProgress,
|
|
1005
|
+
" in progress"
|
|
1006
|
+
] }),
|
|
1007
|
+
r.pending > 0 && /* @__PURE__ */ i("span", { className: "text-white/40", children: [
|
|
1008
|
+
r.pending,
|
|
1009
|
+
" pending"
|
|
1010
|
+
] })
|
|
1011
|
+
] })
|
|
1012
|
+
] })
|
|
1013
|
+
] }),
|
|
1014
|
+
/* @__PURE__ */ t(L, { children: "TASKS" }),
|
|
1015
|
+
/* @__PURE__ */ t($, { children: /* @__PURE__ */ t("div", { className: "space-y-1.5", children: n.map((s, a) => {
|
|
1016
|
+
const l = s.status === "in_progress" ? s.activeForm : s.content;
|
|
1017
|
+
return /* @__PURE__ */ i(
|
|
1018
|
+
"div",
|
|
1019
|
+
{
|
|
1020
|
+
className: p(
|
|
1021
|
+
"flex items-start gap-2 py-1 transition-all duration-200",
|
|
1022
|
+
s.status === "completed" && "opacity-50",
|
|
1023
|
+
s.status === "in_progress" && "bg-yellow-500/10 -mx-2 px-2 rounded"
|
|
1024
|
+
),
|
|
1025
|
+
children: [
|
|
1026
|
+
s.status === "completed" ? /* @__PURE__ */ t(It, { className: "w-4 h-4 text-emerald-400 shrink-0 mt-0.5" }) : s.status === "in_progress" ? /* @__PURE__ */ t(_t, { className: "w-4 h-4 text-yellow-400 animate-spin shrink-0 mt-0.5" }) : /* @__PURE__ */ t(At, { className: "w-4 h-4 text-white/30 shrink-0 mt-0.5" }),
|
|
1027
|
+
/* @__PURE__ */ i(
|
|
1028
|
+
"span",
|
|
1029
|
+
{
|
|
1030
|
+
className: p(
|
|
1031
|
+
"text-sm leading-relaxed",
|
|
1032
|
+
s.status === "completed" ? "text-white/50 line-through" : "text-white/80"
|
|
1033
|
+
),
|
|
1034
|
+
children: [
|
|
1035
|
+
/* @__PURE__ */ i("span", { className: "text-white/40 mr-1.5", children: [
|
|
1036
|
+
a + 1,
|
|
1037
|
+
"."
|
|
1038
|
+
] }),
|
|
1039
|
+
l
|
|
1040
|
+
]
|
|
1041
|
+
}
|
|
1042
|
+
)
|
|
1043
|
+
]
|
|
1044
|
+
},
|
|
1045
|
+
`${s.content}-${a}`
|
|
1046
|
+
);
|
|
1047
|
+
}) }) })
|
|
1048
|
+
] });
|
|
1049
|
+
}
|
|
1050
|
+
function Ut({ actionType: e }) {
|
|
1051
|
+
switch (e.action) {
|
|
1052
|
+
case "command_run":
|
|
1053
|
+
return /* @__PURE__ */ t(Wt, { action: e });
|
|
1054
|
+
case "file_read":
|
|
1055
|
+
return /* @__PURE__ */ t(Bt, { action: e });
|
|
1056
|
+
case "file_edit":
|
|
1057
|
+
return /* @__PURE__ */ t(Ot, { action: e });
|
|
1058
|
+
case "file_write":
|
|
1059
|
+
return /* @__PURE__ */ t(zt, { action: e });
|
|
1060
|
+
case "search":
|
|
1061
|
+
return /* @__PURE__ */ t(Ft, { action: e });
|
|
1062
|
+
case "glob":
|
|
1063
|
+
return /* @__PURE__ */ t(Pt, { action: e });
|
|
1064
|
+
case "web_fetch":
|
|
1065
|
+
return /* @__PURE__ */ t(Ht, { action: e });
|
|
1066
|
+
case "web_search":
|
|
1067
|
+
return /* @__PURE__ */ t(qt, { action: e });
|
|
1068
|
+
case "mcp_tool":
|
|
1069
|
+
return /* @__PURE__ */ t(Vt, { action: e });
|
|
1070
|
+
case "generic_tool":
|
|
1071
|
+
return /* @__PURE__ */ t(Gt, { action: e });
|
|
1072
|
+
case "todo_write":
|
|
1073
|
+
return /* @__PURE__ */ t(Jt, { action: e });
|
|
1074
|
+
default:
|
|
1075
|
+
return null;
|
|
1076
|
+
}
|
|
1077
|
+
}
|
|
1078
|
+
function Kt(e) {
|
|
1079
|
+
var n;
|
|
1080
|
+
switch (e.action) {
|
|
1081
|
+
case "command_run":
|
|
1082
|
+
return !!(e.command || (n = e.result) != null && n.output);
|
|
1083
|
+
case "file_read":
|
|
1084
|
+
return !0;
|
|
1085
|
+
case "file_edit":
|
|
1086
|
+
return !!(e.oldString || e.newString);
|
|
1087
|
+
case "file_write":
|
|
1088
|
+
return !!e.content;
|
|
1089
|
+
case "search":
|
|
1090
|
+
return !0;
|
|
1091
|
+
case "glob":
|
|
1092
|
+
return !0;
|
|
1093
|
+
case "web_fetch":
|
|
1094
|
+
return !0;
|
|
1095
|
+
case "web_search":
|
|
1096
|
+
return !0;
|
|
1097
|
+
case "mcp_tool":
|
|
1098
|
+
return !!(e.arguments || e.result);
|
|
1099
|
+
case "generic_tool":
|
|
1100
|
+
return !!(e.arguments || e.result);
|
|
1101
|
+
case "todo_write":
|
|
1102
|
+
return e.todos.length > 0;
|
|
1103
|
+
case "agent_tool":
|
|
1104
|
+
return !0;
|
|
1105
|
+
// Always expandable (handled by AgentToolCard)
|
|
1106
|
+
default:
|
|
1107
|
+
return !1;
|
|
1108
|
+
}
|
|
1109
|
+
}
|
|
1110
|
+
function Oe({ toolCall: e, defaultExpanded: n = !1, className: r }) {
|
|
1111
|
+
const [s, a] = N(n), { actionType: l, status: c, summary: h } = e;
|
|
1112
|
+
if (l.action === "agent_tool")
|
|
1113
|
+
return /* @__PURE__ */ t(
|
|
1114
|
+
Ze,
|
|
1115
|
+
{
|
|
1116
|
+
toolCall: e,
|
|
1117
|
+
defaultExpanded: n,
|
|
1118
|
+
className: r
|
|
1119
|
+
}
|
|
1120
|
+
);
|
|
1121
|
+
const o = Kt(l);
|
|
1122
|
+
return /* @__PURE__ */ i(
|
|
1123
|
+
"div",
|
|
1124
|
+
{
|
|
1125
|
+
className: p(
|
|
1126
|
+
"rounded-xl border bg-[var(--ash-surface-dark,#0a0a0a)] overflow-hidden",
|
|
1127
|
+
{
|
|
1128
|
+
pending: "border-yellow-500/30 ash-tool-status-pending",
|
|
1129
|
+
success: "border-white/10",
|
|
1130
|
+
failed: "border-red-500/30"
|
|
1131
|
+
}[c],
|
|
1132
|
+
r
|
|
1133
|
+
),
|
|
1134
|
+
children: [
|
|
1135
|
+
/* @__PURE__ */ i(
|
|
1136
|
+
"button",
|
|
1137
|
+
{
|
|
1138
|
+
onClick: () => o && a(!s),
|
|
1139
|
+
className: p(
|
|
1140
|
+
"w-full px-4 py-3 flex items-center justify-between transition-colors",
|
|
1141
|
+
o ? "hover:bg-white/5 cursor-pointer" : "cursor-default"
|
|
1142
|
+
),
|
|
1143
|
+
disabled: !o,
|
|
1144
|
+
children: [
|
|
1145
|
+
/* @__PURE__ */ i("div", { className: "flex items-center gap-3 min-w-0 flex-1", children: [
|
|
1146
|
+
/* @__PURE__ */ t("div", { className: p(
|
|
1147
|
+
"w-6 h-6 rounded-lg flex items-center justify-center shrink-0",
|
|
1148
|
+
c === "pending" ? "bg-yellow-500/20" : c === "failed" ? "bg-red-500/20" : "bg-[var(--ash-accent)]/20"
|
|
1149
|
+
), children: /* @__PURE__ */ t(
|
|
1150
|
+
Ye,
|
|
1151
|
+
{
|
|
1152
|
+
actionType: l,
|
|
1153
|
+
className: p(
|
|
1154
|
+
"w-3.5 h-3.5",
|
|
1155
|
+
c === "pending" ? "text-yellow-400" : c === "failed" ? "text-red-400" : "text-[var(--ash-accent)]"
|
|
1156
|
+
)
|
|
1157
|
+
}
|
|
1158
|
+
) }),
|
|
1159
|
+
/* @__PURE__ */ t("span", { className: "text-sm font-medium text-white shrink-0", children: Ue(l) }),
|
|
1160
|
+
/* @__PURE__ */ t("span", { className: "font-mono text-sm truncate text-white/60 min-w-0", children: h })
|
|
1161
|
+
] }),
|
|
1162
|
+
/* @__PURE__ */ i("div", { className: "flex items-center gap-2 shrink-0", children: [
|
|
1163
|
+
/* @__PURE__ */ t(jt, { status: c, size: "sm" }),
|
|
1164
|
+
o && /* @__PURE__ */ t(
|
|
1165
|
+
je,
|
|
1166
|
+
{
|
|
1167
|
+
className: p(
|
|
1168
|
+
"w-4 h-4 text-white/40 transition-transform duration-200",
|
|
1169
|
+
s && "rotate-180"
|
|
1170
|
+
)
|
|
1171
|
+
}
|
|
1172
|
+
)
|
|
1173
|
+
] })
|
|
1174
|
+
]
|
|
1175
|
+
}
|
|
1176
|
+
),
|
|
1177
|
+
s && o && /* @__PURE__ */ i("div", { className: "border-t border-white/5 max-h-[400px] overflow-y-auto ash-scrollbar bg-black/20", children: [
|
|
1178
|
+
/* @__PURE__ */ t(Ut, { actionType: l }),
|
|
1179
|
+
c === "success" && /* @__PURE__ */ t("div", { className: "px-4 py-3 border-t border-white/5 bg-[var(--ash-accent)]/5", children: /* @__PURE__ */ i("div", { className: "flex items-center gap-2", children: [
|
|
1180
|
+
/* @__PURE__ */ t(Ct, { className: "w-4 h-4 text-[var(--ash-accent)]" }),
|
|
1181
|
+
/* @__PURE__ */ t("span", { className: "text-sm text-[var(--ash-accent)] font-medium", children: "Completed successfully" })
|
|
1182
|
+
] }) })
|
|
1183
|
+
] })
|
|
1184
|
+
]
|
|
1185
|
+
}
|
|
1186
|
+
);
|
|
1187
|
+
}
|
|
1188
|
+
var Yt = lt(() => import("./index-DJwpy-R5.js"));
|
|
1189
|
+
function ze({ children: e, fallback: n, className: r }) {
|
|
1190
|
+
const [s, a] = N(!1);
|
|
1191
|
+
return j(() => {
|
|
1192
|
+
a(!0);
|
|
1193
|
+
}, []), s ? /* @__PURE__ */ t(ot, { fallback: /* @__PURE__ */ t("span", { className: r, children: n ?? e }), children: /* @__PURE__ */ t(Yt, { children: e }) }) : /* @__PURE__ */ t("span", { className: r, children: n ?? e });
|
|
1194
|
+
}
|
|
1195
|
+
function Zt({ segment: e }) {
|
|
1196
|
+
const n = e.color ? `${e.color}20` : "rgba(34, 197, 94, 0.2)", r = e.color || "#22c55e", s = e.color ? `${e.color}40` : "rgba(34, 197, 94, 0.4)";
|
|
1197
|
+
return /* @__PURE__ */ i(
|
|
1198
|
+
"span",
|
|
1199
|
+
{
|
|
1200
|
+
className: "inline-flex items-center px-2 py-0.5 rounded-md text-xs font-medium mx-0.5",
|
|
1201
|
+
style: {
|
|
1202
|
+
backgroundColor: n,
|
|
1203
|
+
color: r,
|
|
1204
|
+
border: `1px solid ${s}`
|
|
1205
|
+
},
|
|
1206
|
+
title: e.id ? `ID: ${e.id}` : void 0,
|
|
1207
|
+
children: [
|
|
1208
|
+
"@",
|
|
1209
|
+
e.name
|
|
1210
|
+
]
|
|
1211
|
+
}
|
|
1212
|
+
);
|
|
1213
|
+
}
|
|
1214
|
+
function Qt({
|
|
1215
|
+
content: e,
|
|
1216
|
+
renderers: n,
|
|
1217
|
+
className: r
|
|
1218
|
+
}) {
|
|
1219
|
+
return /* @__PURE__ */ t("div", { className: p("rich-content", r), children: e.map((s, a) => {
|
|
1220
|
+
const l = `segment-${a}`;
|
|
1221
|
+
switch (s.type) {
|
|
1222
|
+
case "text":
|
|
1223
|
+
return /* @__PURE__ */ t(Le, { children: /* @__PURE__ */ t(ze, { children: s.content }) }, l);
|
|
1224
|
+
case "mention":
|
|
1225
|
+
return n != null && n.renderMention ? /* @__PURE__ */ t(Le, { children: n.renderMention({ segment: s }) }, l) : /* @__PURE__ */ t(Zt, { segment: s }, l);
|
|
1226
|
+
case "component":
|
|
1227
|
+
return n != null && n.renderComponent ? /* @__PURE__ */ t(Le, { children: n.renderComponent({ segment: s }) }, l) : /* @__PURE__ */ i("code", { className: "text-xs text-orange-400", children: [
|
|
1228
|
+
"[component: ",
|
|
1229
|
+
s.componentType,
|
|
1230
|
+
"]"
|
|
1231
|
+
] }, l);
|
|
1232
|
+
default:
|
|
1233
|
+
return null;
|
|
1234
|
+
}
|
|
1235
|
+
}) });
|
|
1236
|
+
}
|
|
1237
|
+
function Xt({ options: e, onSelect: n, className: r }) {
|
|
1238
|
+
return /* @__PURE__ */ t("div", { className: p("grid gap-2 mt-3", r), style: {
|
|
1239
|
+
gridTemplateColumns: "repeat(auto-fit, minmax(200px, 1fr))"
|
|
1240
|
+
}, children: e.map((s) => /* @__PURE__ */ i(
|
|
1241
|
+
"button",
|
|
1242
|
+
{
|
|
1243
|
+
onClick: () => n(s),
|
|
1244
|
+
className: p(
|
|
1245
|
+
"flex items-start gap-3 p-3 rounded-xl text-left",
|
|
1246
|
+
"bg-white/5 border border-white/10",
|
|
1247
|
+
"hover:bg-[var(--ash-accent)]/10 hover:border-[var(--ash-accent)]/30",
|
|
1248
|
+
"focus:outline-none focus:ring-2 focus:ring-[var(--ash-accent)]/50",
|
|
1249
|
+
"transition-all duration-200 cursor-pointer",
|
|
1250
|
+
"group"
|
|
1251
|
+
),
|
|
1252
|
+
children: [
|
|
1253
|
+
/* @__PURE__ */ t("span", { className: p(
|
|
1254
|
+
"flex-shrink-0 w-6 h-6 rounded-lg",
|
|
1255
|
+
"bg-[var(--ash-accent)]/20 text-[var(--ash-accent)]",
|
|
1256
|
+
"flex items-center justify-center",
|
|
1257
|
+
"text-xs font-semibold",
|
|
1258
|
+
"group-hover:bg-[var(--ash-accent)]/30",
|
|
1259
|
+
"transition-colors duration-200"
|
|
1260
|
+
), children: s.id }),
|
|
1261
|
+
/* @__PURE__ */ i("div", { className: "flex-1 min-w-0", children: [
|
|
1262
|
+
/* @__PURE__ */ t("div", { className: "text-sm font-medium text-white/90 group-hover:text-white transition-colors", children: s.label }),
|
|
1263
|
+
s.description && /* @__PURE__ */ t("div", { className: "text-xs text-white/50 mt-0.5 line-clamp-2 group-hover:text-white/60 transition-colors", children: s.description })
|
|
1264
|
+
] }),
|
|
1265
|
+
/* @__PURE__ */ t(
|
|
1266
|
+
"svg",
|
|
1267
|
+
{
|
|
1268
|
+
className: p(
|
|
1269
|
+
"w-4 h-4 text-white/30 flex-shrink-0 mt-0.5",
|
|
1270
|
+
"group-hover:text-[var(--ash-accent)] group-hover:translate-x-0.5",
|
|
1271
|
+
"transition-all duration-200"
|
|
1272
|
+
),
|
|
1273
|
+
fill: "none",
|
|
1274
|
+
viewBox: "0 0 24 24",
|
|
1275
|
+
stroke: "currentColor",
|
|
1276
|
+
strokeWidth: 2,
|
|
1277
|
+
children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M9 5l7 7-7 7" })
|
|
1278
|
+
}
|
|
1279
|
+
)
|
|
1280
|
+
]
|
|
1281
|
+
},
|
|
1282
|
+
s.id
|
|
1283
|
+
)) });
|
|
1284
|
+
}
|
|
1285
|
+
function en(e) {
|
|
1286
|
+
const n = "[Uploaded files available at /uploads/]", r = e.indexOf(n);
|
|
1287
|
+
if (r === -1)
|
|
1288
|
+
return { text: e, files: [] };
|
|
1289
|
+
const s = e.substring(0, r).trim(), l = e.substring(r + n.length).trim().split(`
|
|
1290
|
+
`).filter((c) => c.startsWith("- ")).map((c) => c.substring(2).trim());
|
|
1291
|
+
return { text: s, files: l };
|
|
1292
|
+
}
|
|
1293
|
+
function tn({ entry: e, className: n }) {
|
|
1294
|
+
const { text: r, files: s } = en(e.content);
|
|
1295
|
+
return /* @__PURE__ */ i("div", { className: p("flex gap-3 justify-end ash-animate-fade-in", n), children: [
|
|
1296
|
+
/* @__PURE__ */ i("div", { className: "max-w-[85%]", children: [
|
|
1297
|
+
/* @__PURE__ */ t("div", { className: "rounded-2xl p-4 bg-[var(--ash-accent)] text-[var(--ash-accent-foreground)]", children: /* @__PURE__ */ t("p", { className: "text-sm leading-relaxed whitespace-pre-wrap", children: r || "(files attached)" }) }),
|
|
1298
|
+
s.length > 0 && /* @__PURE__ */ i("div", { className: "mt-2 pt-2 border-t border-[var(--ash-accent-foreground)]/20", children: [
|
|
1299
|
+
/* @__PURE__ */ i("div", { className: "text-xs text-[var(--ash-accent-foreground)]/60 mb-1 flex items-center gap-1", children: [
|
|
1300
|
+
/* @__PURE__ */ t(Et, { className: "w-3 h-3" }),
|
|
1301
|
+
"Attached Files"
|
|
1302
|
+
] }),
|
|
1303
|
+
/* @__PURE__ */ t("div", { className: "flex flex-wrap gap-1", children: s.map((a, l) => /* @__PURE__ */ t(
|
|
1304
|
+
"span",
|
|
1305
|
+
{
|
|
1306
|
+
className: "inline-flex items-center px-2 py-0.5 rounded-lg bg-[var(--ash-accent-foreground)]/10 text-xs",
|
|
1307
|
+
title: a,
|
|
1308
|
+
children: a.split(" (")[0]
|
|
1309
|
+
},
|
|
1310
|
+
l
|
|
1311
|
+
)) })
|
|
1312
|
+
] }),
|
|
1313
|
+
e.timestamp && /* @__PURE__ */ t("div", { className: "text-xs text-white/40 mt-2", children: De(e.timestamp) })
|
|
1314
|
+
] }),
|
|
1315
|
+
/* @__PURE__ */ t("div", { className: "w-7 h-7 rounded-full bg-white/10 flex items-center justify-center shrink-0", children: /* @__PURE__ */ t($t, { className: "w-4 h-4 text-white/50" }) })
|
|
1316
|
+
] });
|
|
1317
|
+
}
|
|
1318
|
+
function nn({
|
|
1319
|
+
entry: e,
|
|
1320
|
+
onOptionSelect: n,
|
|
1321
|
+
richContentRenderers: r,
|
|
1322
|
+
className: s
|
|
1323
|
+
}) {
|
|
1324
|
+
const a = e.richContent ? null : wt(e.content), l = (h) => {
|
|
1325
|
+
n && n(`Option ${h.id}: ${h.label}`);
|
|
1326
|
+
}, c = (h) => e.richContent && e.richContent.length > 0 ? /* @__PURE__ */ t(
|
|
1327
|
+
Qt,
|
|
1328
|
+
{
|
|
1329
|
+
content: e.richContent,
|
|
1330
|
+
renderers: r
|
|
1331
|
+
}
|
|
1332
|
+
) : /* @__PURE__ */ t(ze, { children: h || e.content });
|
|
1333
|
+
return /* @__PURE__ */ i("div", { className: p("flex gap-3 ash-animate-fade-in", s), children: [
|
|
1334
|
+
/* @__PURE__ */ t("div", { className: "w-7 h-7 rounded-full bg-[var(--ash-accent)]/20 flex items-center justify-center shrink-0", children: /* @__PURE__ */ t(de, { className: "w-4 h-4 text-[var(--ash-accent)]" }) }),
|
|
1335
|
+
/* @__PURE__ */ i("div", { className: "flex-1 max-w-[85%]", children: [
|
|
1336
|
+
/* @__PURE__ */ t("div", { className: "ash-card-glass rounded-2xl p-4", children: /* @__PURE__ */ t("div", { className: "ash-message-content prose prose-sm prose-invert max-w-none text-sm leading-relaxed", children: a ? /* @__PURE__ */ i(_, { children: [
|
|
1337
|
+
a.preamble && c(a.preamble),
|
|
1338
|
+
/* @__PURE__ */ t(
|
|
1339
|
+
Xt,
|
|
1340
|
+
{
|
|
1341
|
+
options: a.options,
|
|
1342
|
+
onSelect: l
|
|
1343
|
+
}
|
|
1344
|
+
)
|
|
1345
|
+
] }) : c() }) }),
|
|
1346
|
+
e.timestamp && /* @__PURE__ */ t("div", { className: "text-xs text-white/40 mt-2", children: De(e.timestamp) })
|
|
1347
|
+
] })
|
|
1348
|
+
] });
|
|
1349
|
+
}
|
|
1350
|
+
function rn({ entry: e, className: n }) {
|
|
1351
|
+
return /* @__PURE__ */ i("div", { className: p("flex gap-3 ash-animate-fade-in", n), children: [
|
|
1352
|
+
/* @__PURE__ */ t("div", { className: "w-7 h-7 rounded-full bg-purple-500/20 flex items-center justify-center shrink-0", children: /* @__PURE__ */ t(Lt, { className: "w-4 h-4 text-purple-400" }) }),
|
|
1353
|
+
/* @__PURE__ */ t("div", { className: "flex-1 max-w-[85%]", children: /* @__PURE__ */ i("div", { className: "rounded-2xl p-4 bg-purple-500/10 border border-purple-500/30", children: [
|
|
1354
|
+
/* @__PURE__ */ t("div", { className: "text-xs text-purple-400 mb-2 font-medium", children: "Thinking" }),
|
|
1355
|
+
/* @__PURE__ */ t("div", { className: "text-sm text-purple-300 italic opacity-80 whitespace-pre-wrap leading-relaxed", children: e.content })
|
|
1356
|
+
] }) })
|
|
1357
|
+
] });
|
|
1358
|
+
}
|
|
1359
|
+
function sn({ entry: e, defaultExpanded: n = !1, className: r }) {
|
|
1360
|
+
return e.entryType.type !== "tool_call" ? null : /* @__PURE__ */ i("div", { className: p("flex gap-3 ash-animate-fade-in", r), children: [
|
|
1361
|
+
/* @__PURE__ */ t("div", { className: "w-7 h-7 rounded-full bg-[var(--ash-accent)]/20 flex items-center justify-center shrink-0", children: /* @__PURE__ */ t(de, { className: "w-4 h-4 text-[var(--ash-accent)]" }) }),
|
|
1362
|
+
/* @__PURE__ */ t("div", { className: "flex-1", children: /* @__PURE__ */ t(Oe, { toolCall: e.entryType.toolCall, defaultExpanded: n }) })
|
|
1363
|
+
] });
|
|
1364
|
+
}
|
|
1365
|
+
function an({ entry: e, className: n }) {
|
|
1366
|
+
return e.entryType.type !== "error" ? null : /* @__PURE__ */ i("div", { className: p("flex gap-3 ash-animate-fade-in", n), children: [
|
|
1367
|
+
/* @__PURE__ */ t("div", { className: "w-7 h-7 rounded-full bg-red-500/20 flex items-center justify-center shrink-0", children: /* @__PURE__ */ t(Ke, { className: "w-4 h-4 text-red-400" }) }),
|
|
1368
|
+
/* @__PURE__ */ t("div", { className: "flex-1 max-w-[85%]", children: /* @__PURE__ */ i("div", { className: "rounded-2xl p-4 bg-red-500/10 border border-red-500/30", children: [
|
|
1369
|
+
/* @__PURE__ */ t("div", { className: "text-xs text-red-400 mb-2 font-medium", children: "Error" }),
|
|
1370
|
+
/* @__PURE__ */ t("p", { className: "text-sm text-red-300", children: e.entryType.message }),
|
|
1371
|
+
e.entryType.code && /* @__PURE__ */ i("p", { className: "text-xs text-red-400/70 mt-2 font-mono", children: [
|
|
1372
|
+
"Code: ",
|
|
1373
|
+
e.entryType.code
|
|
1374
|
+
] })
|
|
1375
|
+
] }) })
|
|
1376
|
+
] });
|
|
1377
|
+
}
|
|
1378
|
+
function ln({
|
|
1379
|
+
entry: e,
|
|
1380
|
+
onOptionSelect: n,
|
|
1381
|
+
defaultExpanded: r,
|
|
1382
|
+
richContentRenderers: s,
|
|
1383
|
+
className: a
|
|
1384
|
+
}) {
|
|
1385
|
+
switch (e.entryType.type) {
|
|
1386
|
+
case "user_message":
|
|
1387
|
+
return /* @__PURE__ */ t(tn, { entry: e, className: a });
|
|
1388
|
+
case "assistant_message":
|
|
1389
|
+
return /* @__PURE__ */ t(
|
|
1390
|
+
nn,
|
|
1391
|
+
{
|
|
1392
|
+
entry: e,
|
|
1393
|
+
onOptionSelect: n,
|
|
1394
|
+
richContentRenderers: s,
|
|
1395
|
+
className: a
|
|
1396
|
+
}
|
|
1397
|
+
);
|
|
1398
|
+
case "thinking":
|
|
1399
|
+
return /* @__PURE__ */ t(rn, { entry: e, className: a });
|
|
1400
|
+
case "tool_call":
|
|
1401
|
+
return /* @__PURE__ */ t(sn, { entry: e, defaultExpanded: r, className: a });
|
|
1402
|
+
case "error":
|
|
1403
|
+
return /* @__PURE__ */ t(an, { entry: e, className: a });
|
|
1404
|
+
default:
|
|
1405
|
+
return null;
|
|
1406
|
+
}
|
|
1407
|
+
}
|
|
1408
|
+
function $e({ variant: e = "dots", size: n = "md", className: r }) {
|
|
1409
|
+
if (e === "dots") {
|
|
1410
|
+
const a = {
|
|
1411
|
+
sm: "w-1 h-1",
|
|
1412
|
+
md: "w-1.5 h-1.5",
|
|
1413
|
+
lg: "w-2 h-2"
|
|
1414
|
+
};
|
|
1415
|
+
return /* @__PURE__ */ i("div", { className: p("flex items-center gap-1", r), children: [
|
|
1416
|
+
/* @__PURE__ */ t("span", { className: p("rounded-full bg-[var(--ash-accent)] animate-pulse", a[n]) }),
|
|
1417
|
+
/* @__PURE__ */ t("span", { className: p("rounded-full bg-[var(--ash-accent)] animate-pulse", a[n]), style: { animationDelay: "150ms" } }),
|
|
1418
|
+
/* @__PURE__ */ t("span", { className: p("rounded-full bg-[var(--ash-accent)] animate-pulse", a[n]), style: { animationDelay: "300ms" } })
|
|
1419
|
+
] });
|
|
1420
|
+
}
|
|
1421
|
+
if (e === "pulse") {
|
|
1422
|
+
const a = {
|
|
1423
|
+
sm: "w-1.5 h-1.5",
|
|
1424
|
+
md: "w-2 h-2",
|
|
1425
|
+
lg: "w-3 h-3"
|
|
1426
|
+
};
|
|
1427
|
+
return /* @__PURE__ */ t("div", { className: p("flex items-center gap-1", r), children: /* @__PURE__ */ t("span", { className: p("bg-[var(--ash-accent)] rounded-full animate-pulse", a[n]) }) });
|
|
1428
|
+
}
|
|
1429
|
+
return e === "cursor" ? /* @__PURE__ */ t(
|
|
1430
|
+
"span",
|
|
1431
|
+
{
|
|
1432
|
+
className: p(
|
|
1433
|
+
"inline-block bg-[var(--ash-accent)]/50 ash-tool-status-pending",
|
|
1434
|
+
{
|
|
1435
|
+
sm: "w-1 h-3",
|
|
1436
|
+
md: "w-1.5 h-4",
|
|
1437
|
+
lg: "w-2 h-5"
|
|
1438
|
+
}[n],
|
|
1439
|
+
r
|
|
1440
|
+
)
|
|
1441
|
+
}
|
|
1442
|
+
) : /* @__PURE__ */ t("div", { className: p("animate-spin text-[var(--ash-accent)]", {
|
|
1443
|
+
sm: "w-4 h-4",
|
|
1444
|
+
md: "w-6 h-6",
|
|
1445
|
+
lg: "w-8 h-8"
|
|
1446
|
+
}[n], r), children: /* @__PURE__ */ i("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
|
|
1447
|
+
/* @__PURE__ */ t("circle", { cx: "12", cy: "12", r: "10", className: "opacity-25" }),
|
|
1448
|
+
/* @__PURE__ */ t("path", { d: "M12 2a10 10 0 0 1 10 10", strokeLinecap: "round" })
|
|
1449
|
+
] }) });
|
|
1450
|
+
}
|
|
1451
|
+
function on({
|
|
1452
|
+
content: e,
|
|
1453
|
+
isStreaming: n = !1,
|
|
1454
|
+
renderMarkdown: r = !0,
|
|
1455
|
+
className: s
|
|
1456
|
+
}) {
|
|
1457
|
+
return /* @__PURE__ */ t("div", { className: p("relative", s), children: r ? /* @__PURE__ */ i("div", { className: "ash-message-content prose prose-sm prose-invert max-w-none text-sm leading-relaxed", children: [
|
|
1458
|
+
/* @__PURE__ */ t(ze, { children: e }),
|
|
1459
|
+
n && /* @__PURE__ */ t($e, { variant: "cursor", size: "sm", className: "inline-block ml-0.5" })
|
|
1460
|
+
] }) : /* @__PURE__ */ i("p", { className: "whitespace-pre-wrap text-sm leading-relaxed", children: [
|
|
1461
|
+
e,
|
|
1462
|
+
n && /* @__PURE__ */ t($e, { variant: "cursor", size: "sm", className: "inline-block ml-0.5" })
|
|
1463
|
+
] }) });
|
|
1464
|
+
}
|
|
1465
|
+
function cn(e) {
|
|
1466
|
+
switch (e.action) {
|
|
1467
|
+
case "file_read":
|
|
1468
|
+
case "file_edit":
|
|
1469
|
+
case "file_write":
|
|
1470
|
+
return e.path;
|
|
1471
|
+
default:
|
|
1472
|
+
return null;
|
|
1473
|
+
}
|
|
1474
|
+
}
|
|
1475
|
+
function Qe(e) {
|
|
1476
|
+
const n = e.split("/");
|
|
1477
|
+
return n[n.length - 1] || e;
|
|
1478
|
+
}
|
|
1479
|
+
function dn(e) {
|
|
1480
|
+
const n = Qe(e), r = n.lastIndexOf(".");
|
|
1481
|
+
return r === -1 ? null : n.slice(r + 1).toLowerCase();
|
|
1482
|
+
}
|
|
1483
|
+
function un(e) {
|
|
1484
|
+
switch (e.action) {
|
|
1485
|
+
case "file_edit": {
|
|
1486
|
+
const n = e;
|
|
1487
|
+
return n.linesAdded !== void 0 || n.linesRemoved !== void 0 ? { added: n.linesAdded, removed: n.linesRemoved } : null;
|
|
1488
|
+
}
|
|
1489
|
+
case "file_read": {
|
|
1490
|
+
const n = e;
|
|
1491
|
+
return n.linesRead !== void 0 ? { read: n.linesRead } : null;
|
|
1492
|
+
}
|
|
1493
|
+
case "file_write": {
|
|
1494
|
+
const n = e;
|
|
1495
|
+
return n.linesWritten !== void 0 ? { written: n.linesWritten } : null;
|
|
1496
|
+
}
|
|
1497
|
+
default:
|
|
1498
|
+
return null;
|
|
1499
|
+
}
|
|
1500
|
+
}
|
|
1501
|
+
function hn(e) {
|
|
1502
|
+
switch (e) {
|
|
1503
|
+
case "ts":
|
|
1504
|
+
case "tsx":
|
|
1505
|
+
return "text-blue-400";
|
|
1506
|
+
case "js":
|
|
1507
|
+
case "jsx":
|
|
1508
|
+
return "text-yellow-400";
|
|
1509
|
+
case "md":
|
|
1510
|
+
return "text-white/60";
|
|
1511
|
+
case "json":
|
|
1512
|
+
return "text-orange-400";
|
|
1513
|
+
case "sh":
|
|
1514
|
+
return "text-green-400";
|
|
1515
|
+
case "css":
|
|
1516
|
+
case "scss":
|
|
1517
|
+
return "text-pink-400";
|
|
1518
|
+
case "py":
|
|
1519
|
+
return "text-blue-300";
|
|
1520
|
+
default:
|
|
1521
|
+
return "text-white/70";
|
|
1522
|
+
}
|
|
1523
|
+
}
|
|
1524
|
+
function Xe({ toolCall: e, showFullPath: n = !1, className: r }) {
|
|
1525
|
+
const { actionType: s, status: a, summary: l } = e, c = Ue(s), h = cn(s), o = un(s), w = h ? n ? h : Qe(h) : null, d = h ? dn(h) : null, m = hn(d), g = !h && l;
|
|
1526
|
+
return /* @__PURE__ */ i(
|
|
1527
|
+
"div",
|
|
1528
|
+
{
|
|
1529
|
+
className: p(
|
|
1530
|
+
"flex items-center gap-2 py-1.5 text-sm min-w-0",
|
|
1531
|
+
r
|
|
1532
|
+
),
|
|
1533
|
+
children: [
|
|
1534
|
+
/* @__PURE__ */ i("div", { className: "flex items-center gap-1.5 shrink-0", children: [
|
|
1535
|
+
/* @__PURE__ */ t(
|
|
1536
|
+
Ye,
|
|
1537
|
+
{
|
|
1538
|
+
actionType: s,
|
|
1539
|
+
className: p(
|
|
1540
|
+
"w-3.5 h-3.5",
|
|
1541
|
+
a === "pending" ? "text-yellow-400" : a === "failed" ? "text-red-400" : "text-white/50"
|
|
1542
|
+
)
|
|
1543
|
+
}
|
|
1544
|
+
),
|
|
1545
|
+
/* @__PURE__ */ t("span", { className: p(
|
|
1546
|
+
"font-medium",
|
|
1547
|
+
a === "pending" ? "text-white/90" : a === "failed" ? "text-red-400" : "text-white/60"
|
|
1548
|
+
), children: c })
|
|
1549
|
+
] }),
|
|
1550
|
+
w && /* @__PURE__ */ t("code", { className: p(
|
|
1551
|
+
"px-1.5 py-0.5 rounded bg-white/5 font-mono text-xs truncate max-w-[200px]",
|
|
1552
|
+
m
|
|
1553
|
+
), children: w }),
|
|
1554
|
+
o && /* @__PURE__ */ i("span", { className: "flex items-center gap-1 text-xs shrink-0 font-mono", children: [
|
|
1555
|
+
o.added !== void 0 && o.added > 0 && /* @__PURE__ */ i("span", { className: "text-emerald-400", children: [
|
|
1556
|
+
"+",
|
|
1557
|
+
o.added
|
|
1558
|
+
] }),
|
|
1559
|
+
o.removed !== void 0 && o.removed > 0 && /* @__PURE__ */ i("span", { className: "text-red-400", children: [
|
|
1560
|
+
"-",
|
|
1561
|
+
o.removed
|
|
1562
|
+
] }),
|
|
1563
|
+
o.read !== void 0 && /* @__PURE__ */ i("span", { className: "text-white/40", children: [
|
|
1564
|
+
o.read,
|
|
1565
|
+
" lines"
|
|
1566
|
+
] }),
|
|
1567
|
+
o.written !== void 0 && /* @__PURE__ */ i("span", { className: "text-emerald-400", children: [
|
|
1568
|
+
"+",
|
|
1569
|
+
o.written
|
|
1570
|
+
] })
|
|
1571
|
+
] }),
|
|
1572
|
+
g && /* @__PURE__ */ t("span", { className: "text-white/40 truncate min-w-0 text-xs", children: l })
|
|
1573
|
+
]
|
|
1574
|
+
}
|
|
1575
|
+
);
|
|
1576
|
+
}
|
|
1577
|
+
function mn(e) {
|
|
1578
|
+
const n = e.split("/").pop() || e, r = n.lastIndexOf(".");
|
|
1579
|
+
return r === -1 ? null : n.slice(r + 1).toLowerCase();
|
|
1580
|
+
}
|
|
1581
|
+
function pn(e) {
|
|
1582
|
+
switch (e) {
|
|
1583
|
+
case "ts":
|
|
1584
|
+
case "tsx":
|
|
1585
|
+
return "TS";
|
|
1586
|
+
case "js":
|
|
1587
|
+
case "jsx":
|
|
1588
|
+
return "JS";
|
|
1589
|
+
case "md":
|
|
1590
|
+
return "MD";
|
|
1591
|
+
case "json":
|
|
1592
|
+
return "{}";
|
|
1593
|
+
case "sh":
|
|
1594
|
+
return "$";
|
|
1595
|
+
case "css":
|
|
1596
|
+
case "scss":
|
|
1597
|
+
return "#";
|
|
1598
|
+
case "py":
|
|
1599
|
+
return "PY";
|
|
1600
|
+
default:
|
|
1601
|
+
return "";
|
|
1602
|
+
}
|
|
1603
|
+
}
|
|
1604
|
+
function fn(e) {
|
|
1605
|
+
switch (e) {
|
|
1606
|
+
case "ts":
|
|
1607
|
+
case "tsx":
|
|
1608
|
+
return "bg-blue-500/20";
|
|
1609
|
+
case "js":
|
|
1610
|
+
case "jsx":
|
|
1611
|
+
return "bg-yellow-500/20";
|
|
1612
|
+
case "md":
|
|
1613
|
+
return "bg-white/10";
|
|
1614
|
+
case "json":
|
|
1615
|
+
return "bg-orange-500/20";
|
|
1616
|
+
case "sh":
|
|
1617
|
+
return "bg-green-500/20";
|
|
1618
|
+
case "css":
|
|
1619
|
+
case "scss":
|
|
1620
|
+
return "bg-pink-500/20";
|
|
1621
|
+
case "py":
|
|
1622
|
+
return "bg-blue-400/20";
|
|
1623
|
+
default:
|
|
1624
|
+
return "bg-white/10";
|
|
1625
|
+
}
|
|
1626
|
+
}
|
|
1627
|
+
function et({
|
|
1628
|
+
path: e,
|
|
1629
|
+
linesAdded: n,
|
|
1630
|
+
linesRemoved: r,
|
|
1631
|
+
showOnlyFilename: s = !0,
|
|
1632
|
+
className: a
|
|
1633
|
+
}) {
|
|
1634
|
+
const l = s && e.split("/").pop() || e, c = mn(e), h = pn(c), o = fn(c), w = n !== void 0 && n > 0 || r !== void 0 && r > 0;
|
|
1635
|
+
return /* @__PURE__ */ i(
|
|
1636
|
+
"span",
|
|
1637
|
+
{
|
|
1638
|
+
className: p(
|
|
1639
|
+
"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-md text-xs font-mono",
|
|
1640
|
+
o,
|
|
1641
|
+
a
|
|
1642
|
+
),
|
|
1643
|
+
children: [
|
|
1644
|
+
h && /* @__PURE__ */ t("span", { className: "text-[10px] opacity-60 font-semibold", children: h }),
|
|
1645
|
+
/* @__PURE__ */ t("span", { className: "text-white/80 truncate max-w-[120px]", children: l }),
|
|
1646
|
+
w && /* @__PURE__ */ i("span", { className: "flex items-center gap-0.5", children: [
|
|
1647
|
+
n !== void 0 && n > 0 && /* @__PURE__ */ i("span", { className: "text-emerald-400", children: [
|
|
1648
|
+
"+",
|
|
1649
|
+
n
|
|
1650
|
+
] }),
|
|
1651
|
+
r !== void 0 && r > 0 && /* @__PURE__ */ i("span", { className: "text-red-400", children: [
|
|
1652
|
+
"-",
|
|
1653
|
+
r
|
|
1654
|
+
] })
|
|
1655
|
+
] })
|
|
1656
|
+
]
|
|
1657
|
+
}
|
|
1658
|
+
);
|
|
1659
|
+
}
|
|
1660
|
+
function xn(e) {
|
|
1661
|
+
const n = /* @__PURE__ */ new Map();
|
|
1662
|
+
for (const r of e) {
|
|
1663
|
+
const { actionType: s } = r;
|
|
1664
|
+
if (s.action === "file_edit") {
|
|
1665
|
+
const a = s, l = n.get(a.path);
|
|
1666
|
+
l ? (l.linesAdded = (l.linesAdded || 0) + (a.linesAdded || 0), l.linesRemoved = (l.linesRemoved || 0) + (a.linesRemoved || 0)) : n.set(a.path, {
|
|
1667
|
+
path: a.path,
|
|
1668
|
+
linesAdded: a.linesAdded,
|
|
1669
|
+
linesRemoved: a.linesRemoved
|
|
1670
|
+
});
|
|
1671
|
+
} else if (s.action === "file_write") {
|
|
1672
|
+
const a = s;
|
|
1673
|
+
n.has(a.path) || n.set(a.path, {
|
|
1674
|
+
path: a.path,
|
|
1675
|
+
linesAdded: a.linesWritten
|
|
1676
|
+
});
|
|
1677
|
+
}
|
|
1678
|
+
}
|
|
1679
|
+
return Array.from(n.values());
|
|
1680
|
+
}
|
|
1681
|
+
function gn(e) {
|
|
1682
|
+
const n = {};
|
|
1683
|
+
for (const r of e) {
|
|
1684
|
+
const s = r.actionType.action;
|
|
1685
|
+
n[s] = (n[s] || 0) + 1;
|
|
1686
|
+
}
|
|
1687
|
+
return n;
|
|
1688
|
+
}
|
|
1689
|
+
function wn(e) {
|
|
1690
|
+
switch (e) {
|
|
1691
|
+
case "file_read":
|
|
1692
|
+
return We;
|
|
1693
|
+
case "file_edit":
|
|
1694
|
+
case "file_write":
|
|
1695
|
+
return Be;
|
|
1696
|
+
case "command_run":
|
|
1697
|
+
return Me;
|
|
1698
|
+
case "search":
|
|
1699
|
+
case "glob":
|
|
1700
|
+
return _e;
|
|
1701
|
+
default:
|
|
1702
|
+
return null;
|
|
1703
|
+
}
|
|
1704
|
+
}
|
|
1705
|
+
function vn({
|
|
1706
|
+
toolCalls: e,
|
|
1707
|
+
defaultExpanded: n = !1,
|
|
1708
|
+
className: r
|
|
1709
|
+
}) {
|
|
1710
|
+
const [s, a] = N(n), [l, c] = N(null), h = re(() => xn(e), [e]), o = re(() => gn(e), [e]), w = re(() => Object.entries(o).sort((m, g) => g[1] - m[1]).slice(0, 3).map(([m]) => m), [o]), d = e.length;
|
|
1711
|
+
return e.length === 0 ? null : /* @__PURE__ */ i("div", { className: p("ash-animate-fade-in", r), children: [
|
|
1712
|
+
/* @__PURE__ */ i(
|
|
1713
|
+
"button",
|
|
1714
|
+
{
|
|
1715
|
+
onClick: () => a(!s),
|
|
1716
|
+
className: "w-full flex items-center gap-2 py-1 text-left group",
|
|
1717
|
+
children: [
|
|
1718
|
+
/* @__PURE__ */ t(
|
|
1719
|
+
ve,
|
|
1720
|
+
{
|
|
1721
|
+
className: p(
|
|
1722
|
+
"w-3.5 h-3.5 text-white/40 transition-transform duration-200 shrink-0",
|
|
1723
|
+
s && "rotate-90"
|
|
1724
|
+
)
|
|
1725
|
+
}
|
|
1726
|
+
),
|
|
1727
|
+
/* @__PURE__ */ i("span", { className: "text-sm text-white/60", children: [
|
|
1728
|
+
d,
|
|
1729
|
+
" tool call",
|
|
1730
|
+
d !== 1 ? "s" : ""
|
|
1731
|
+
] }),
|
|
1732
|
+
/* @__PURE__ */ t("div", { className: "flex items-center gap-1", children: w.map((m) => {
|
|
1733
|
+
const g = wn(m);
|
|
1734
|
+
return g ? /* @__PURE__ */ t(
|
|
1735
|
+
g,
|
|
1736
|
+
{
|
|
1737
|
+
className: "w-3.5 h-3.5 text-white/30"
|
|
1738
|
+
},
|
|
1739
|
+
m
|
|
1740
|
+
) : null;
|
|
1741
|
+
}) }),
|
|
1742
|
+
/* @__PURE__ */ t("div", { className: "flex-1" }),
|
|
1743
|
+
!s && h.length > 0 && /* @__PURE__ */ i("div", { className: "flex items-center gap-1.5 flex-wrap justify-end", children: [
|
|
1744
|
+
h.slice(0, 4).map((m) => /* @__PURE__ */ t(
|
|
1745
|
+
et,
|
|
1746
|
+
{
|
|
1747
|
+
path: m.path,
|
|
1748
|
+
linesAdded: m.linesAdded,
|
|
1749
|
+
linesRemoved: m.linesRemoved
|
|
1750
|
+
},
|
|
1751
|
+
m.path
|
|
1752
|
+
)),
|
|
1753
|
+
h.length > 4 && /* @__PURE__ */ i("span", { className: "text-xs text-white/40", children: [
|
|
1754
|
+
"+",
|
|
1755
|
+
h.length - 4,
|
|
1756
|
+
" more"
|
|
1757
|
+
] })
|
|
1758
|
+
] })
|
|
1759
|
+
]
|
|
1760
|
+
}
|
|
1761
|
+
),
|
|
1762
|
+
s && /* @__PURE__ */ t("div", { className: "pl-5 border-l border-white/10 ml-1.5 mt-1 space-y-0.5", children: e.map((m) => /* @__PURE__ */ t("div", { children: l === m.id ? /* @__PURE__ */ i("div", { className: "py-1", children: [
|
|
1763
|
+
/* @__PURE__ */ t(
|
|
1764
|
+
Oe,
|
|
1765
|
+
{
|
|
1766
|
+
toolCall: m,
|
|
1767
|
+
defaultExpanded: !0
|
|
1768
|
+
}
|
|
1769
|
+
),
|
|
1770
|
+
/* @__PURE__ */ t(
|
|
1771
|
+
"button",
|
|
1772
|
+
{
|
|
1773
|
+
onClick: () => c(null),
|
|
1774
|
+
className: "text-xs text-white/40 hover:text-white/60 mt-1 pl-1",
|
|
1775
|
+
children: "Collapse"
|
|
1776
|
+
}
|
|
1777
|
+
)
|
|
1778
|
+
] }) : /* @__PURE__ */ t(
|
|
1779
|
+
"button",
|
|
1780
|
+
{
|
|
1781
|
+
onClick: () => c(m.id),
|
|
1782
|
+
className: "w-full text-left hover:bg-white/5 rounded px-1 -mx-1 transition-colors",
|
|
1783
|
+
children: /* @__PURE__ */ t(Xe, { toolCall: m })
|
|
1784
|
+
}
|
|
1785
|
+
) }, m.id)) })
|
|
1786
|
+
] });
|
|
1787
|
+
}
|
|
1788
|
+
function yn(e) {
|
|
1789
|
+
const n = /* @__PURE__ */ new Map();
|
|
1790
|
+
for (const r of e) {
|
|
1791
|
+
const { actionType: s } = r;
|
|
1792
|
+
if (s.action === "file_edit") {
|
|
1793
|
+
const a = s, l = n.get(a.path);
|
|
1794
|
+
l ? (l.linesAdded = (l.linesAdded || 0) + (a.linesAdded || 0), l.linesRemoved = (l.linesRemoved || 0) + (a.linesRemoved || 0)) : n.set(a.path, {
|
|
1795
|
+
path: a.path,
|
|
1796
|
+
linesAdded: a.linesAdded,
|
|
1797
|
+
linesRemoved: a.linesRemoved
|
|
1798
|
+
});
|
|
1799
|
+
} else s.action === "file_write" && (n.has(s.path) || n.set(s.path, {
|
|
1800
|
+
path: s.path,
|
|
1801
|
+
linesAdded: s.linesWritten
|
|
1802
|
+
}));
|
|
1803
|
+
}
|
|
1804
|
+
return Array.from(n.values());
|
|
1805
|
+
}
|
|
1806
|
+
function bn(e) {
|
|
1807
|
+
const n = {};
|
|
1808
|
+
for (const r of e) {
|
|
1809
|
+
const s = r.actionType.action;
|
|
1810
|
+
n[s] = (n[s] || 0) + 1;
|
|
1811
|
+
}
|
|
1812
|
+
return n;
|
|
1813
|
+
}
|
|
1814
|
+
function Nn(e) {
|
|
1815
|
+
switch (e) {
|
|
1816
|
+
case "file_read":
|
|
1817
|
+
return We;
|
|
1818
|
+
case "file_edit":
|
|
1819
|
+
case "file_write":
|
|
1820
|
+
return Be;
|
|
1821
|
+
case "command_run":
|
|
1822
|
+
return Me;
|
|
1823
|
+
case "search":
|
|
1824
|
+
case "glob":
|
|
1825
|
+
return _e;
|
|
1826
|
+
default:
|
|
1827
|
+
return null;
|
|
1828
|
+
}
|
|
1829
|
+
}
|
|
1830
|
+
function kn({
|
|
1831
|
+
toolCalls: e,
|
|
1832
|
+
defaultExpanded: n = !1,
|
|
1833
|
+
isExpanded: r,
|
|
1834
|
+
onToggle: s,
|
|
1835
|
+
className: a
|
|
1836
|
+
}) {
|
|
1837
|
+
const [l, c] = N(n), h = r !== void 0 ? r : l, o = B(() => {
|
|
1838
|
+
s ? s() : c((v) => !v);
|
|
1839
|
+
}, [s]), w = re(() => yn(e), [e]), d = re(() => bn(e), [e]), m = re(() => Object.entries(d).sort((v, S) => S[1] - v[1]).slice(0, 3).map(([v]) => v), [d]);
|
|
1840
|
+
if (e.length === 0)
|
|
1841
|
+
return null;
|
|
1842
|
+
const g = e.length;
|
|
1843
|
+
return /* @__PURE__ */ i("div", { className: p("ash-animate-fade-in", a), children: [
|
|
1844
|
+
/* @__PURE__ */ i(
|
|
1845
|
+
"button",
|
|
1846
|
+
{
|
|
1847
|
+
type: "button",
|
|
1848
|
+
onClick: o,
|
|
1849
|
+
className: "w-full flex items-center gap-2 py-1 text-left group",
|
|
1850
|
+
children: [
|
|
1851
|
+
/* @__PURE__ */ t(
|
|
1852
|
+
ve,
|
|
1853
|
+
{
|
|
1854
|
+
className: p(
|
|
1855
|
+
"w-3.5 h-3.5 text-white/40 transition-transform duration-200 shrink-0",
|
|
1856
|
+
h && "rotate-90"
|
|
1857
|
+
)
|
|
1858
|
+
}
|
|
1859
|
+
),
|
|
1860
|
+
/* @__PURE__ */ i("span", { className: "text-sm text-white/60", children: [
|
|
1861
|
+
g,
|
|
1862
|
+
" tool call",
|
|
1863
|
+
g !== 1 ? "s" : ""
|
|
1864
|
+
] }),
|
|
1865
|
+
/* @__PURE__ */ t("div", { className: "flex items-center gap-1", children: m.map((v) => {
|
|
1866
|
+
const S = Nn(v);
|
|
1867
|
+
return S ? /* @__PURE__ */ t(
|
|
1868
|
+
S,
|
|
1869
|
+
{
|
|
1870
|
+
className: "w-3.5 h-3.5 text-white/30"
|
|
1871
|
+
},
|
|
1872
|
+
v
|
|
1873
|
+
) : null;
|
|
1874
|
+
}) }),
|
|
1875
|
+
/* @__PURE__ */ t("div", { className: "flex-1" }),
|
|
1876
|
+
!h && w.length > 0 && /* @__PURE__ */ i("div", { className: "flex items-center gap-1.5 flex-wrap justify-end", children: [
|
|
1877
|
+
w.slice(0, 4).map((v) => /* @__PURE__ */ t(
|
|
1878
|
+
et,
|
|
1879
|
+
{
|
|
1880
|
+
path: v.path,
|
|
1881
|
+
linesAdded: v.linesAdded,
|
|
1882
|
+
linesRemoved: v.linesRemoved
|
|
1883
|
+
},
|
|
1884
|
+
v.path
|
|
1885
|
+
)),
|
|
1886
|
+
w.length > 4 && /* @__PURE__ */ i("span", { className: "text-xs text-white/40", children: [
|
|
1887
|
+
"+",
|
|
1888
|
+
w.length - 4,
|
|
1889
|
+
" more"
|
|
1890
|
+
] })
|
|
1891
|
+
] })
|
|
1892
|
+
]
|
|
1893
|
+
}
|
|
1894
|
+
),
|
|
1895
|
+
h && /* @__PURE__ */ t("div", { className: "pl-5 border-l border-white/10 ml-1.5 mt-1 space-y-0.5", children: e.map((v) => /* @__PURE__ */ t(Xe, { toolCall: v }, v.id)) })
|
|
1896
|
+
] });
|
|
1897
|
+
}
|
|
1898
|
+
function wr(e) {
|
|
1899
|
+
return e.action === "command_run";
|
|
1900
|
+
}
|
|
1901
|
+
function vr(e) {
|
|
1902
|
+
return e.action === "file_read";
|
|
1903
|
+
}
|
|
1904
|
+
function yr(e) {
|
|
1905
|
+
return e.action === "file_edit";
|
|
1906
|
+
}
|
|
1907
|
+
function br(e) {
|
|
1908
|
+
return e.action === "file_write";
|
|
1909
|
+
}
|
|
1910
|
+
function Nr(e) {
|
|
1911
|
+
return e.action === "search";
|
|
1912
|
+
}
|
|
1913
|
+
function kr(e) {
|
|
1914
|
+
return e.action === "glob";
|
|
1915
|
+
}
|
|
1916
|
+
function Cr(e) {
|
|
1917
|
+
return e.action === "web_fetch";
|
|
1918
|
+
}
|
|
1919
|
+
function _r(e) {
|
|
1920
|
+
return e.action === "web_search";
|
|
1921
|
+
}
|
|
1922
|
+
function Tr(e) {
|
|
1923
|
+
return e.action === "mcp_tool";
|
|
1924
|
+
}
|
|
1925
|
+
function Sr(e) {
|
|
1926
|
+
return e.action === "generic_tool";
|
|
1927
|
+
}
|
|
1928
|
+
function Mr(e) {
|
|
1929
|
+
return e.type === "tool_call";
|
|
1930
|
+
}
|
|
1931
|
+
function Ir(e) {
|
|
1932
|
+
return e.type === "error";
|
|
1933
|
+
}
|
|
1934
|
+
var Cn = {
|
|
1935
|
+
mode: "inline",
|
|
1936
|
+
breakEveryNToolCalls: 0,
|
|
1937
|
+
defaultExpanded: !1,
|
|
1938
|
+
animationDuration: 300
|
|
1939
|
+
}, _n = Ge(null);
|
|
1940
|
+
function Tn() {
|
|
1941
|
+
const e = Je(_n);
|
|
1942
|
+
return e || {
|
|
1943
|
+
config: Cn,
|
|
1944
|
+
setMode: () => {
|
|
1945
|
+
},
|
|
1946
|
+
setConfig: () => {
|
|
1947
|
+
},
|
|
1948
|
+
toggleMode: () => {
|
|
1949
|
+
}
|
|
1950
|
+
};
|
|
1951
|
+
}
|
|
1952
|
+
function Sn() {
|
|
1953
|
+
const { config: e } = Tn();
|
|
1954
|
+
return e;
|
|
1955
|
+
}
|
|
1956
|
+
function Mn({
|
|
1957
|
+
entries: e,
|
|
1958
|
+
loading: n,
|
|
1959
|
+
streamingContent: r,
|
|
1960
|
+
displayConfig: s,
|
|
1961
|
+
onOptionSelect: a,
|
|
1962
|
+
renderWidget: l,
|
|
1963
|
+
onWidgetAction: c,
|
|
1964
|
+
autoScroll: h = !0,
|
|
1965
|
+
richContentRenderers: o,
|
|
1966
|
+
className: w
|
|
1967
|
+
}) {
|
|
1968
|
+
const d = Sn(), m = s || d, g = O(null), v = O(null);
|
|
1969
|
+
j(() => {
|
|
1970
|
+
h && v.current && g.current && v.current.scrollIntoView({ behavior: "smooth", block: "end" });
|
|
1971
|
+
}, [e, r, n, h]);
|
|
1972
|
+
const S = B(
|
|
1973
|
+
(M, k) => {
|
|
1974
|
+
if (c)
|
|
1975
|
+
return (A) => {
|
|
1976
|
+
c({
|
|
1977
|
+
...A,
|
|
1978
|
+
entryId: M,
|
|
1979
|
+
widgetType: k
|
|
1980
|
+
});
|
|
1981
|
+
};
|
|
1982
|
+
},
|
|
1983
|
+
[c]
|
|
1984
|
+
), z = re(() => m.mode === "inline" ? e.map((M) => ({
|
|
1985
|
+
type: "single",
|
|
1986
|
+
entry: M,
|
|
1987
|
+
id: M.id
|
|
1988
|
+
})) : xt(e, m), [e, m]);
|
|
1989
|
+
return /* @__PURE__ */ i("div", { ref: g, className: p("flex-1 overflow-y-auto p-4 space-y-4 ash-scrollbar", w), children: [
|
|
1990
|
+
z.map((M) => {
|
|
1991
|
+
if (M.type === "single") {
|
|
1992
|
+
const A = M.entry;
|
|
1993
|
+
if (A.entryType.type === "widget" && l) {
|
|
1994
|
+
const E = A.entryType, W = l({
|
|
1995
|
+
entry: A,
|
|
1996
|
+
widgetType: E.widgetType,
|
|
1997
|
+
widgetData: E.widgetData,
|
|
1998
|
+
onAction: S(A.id, E.widgetType)
|
|
1999
|
+
});
|
|
2000
|
+
if (W !== null)
|
|
2001
|
+
return /* @__PURE__ */ t("div", { className: "ash-animate-fade-in", children: W }, A.id);
|
|
2002
|
+
}
|
|
2003
|
+
return /* @__PURE__ */ t(
|
|
2004
|
+
ln,
|
|
2005
|
+
{
|
|
2006
|
+
entry: A,
|
|
2007
|
+
onOptionSelect: a,
|
|
2008
|
+
defaultExpanded: m.defaultExpanded,
|
|
2009
|
+
richContentRenderers: o
|
|
2010
|
+
},
|
|
2011
|
+
A.id
|
|
2012
|
+
);
|
|
2013
|
+
}
|
|
2014
|
+
const k = gt(M.entries);
|
|
2015
|
+
return /* @__PURE__ */ i("div", { className: "flex gap-3 ash-animate-fade-in", children: [
|
|
2016
|
+
/* @__PURE__ */ t("div", { className: "w-7 h-7 rounded-full bg-[var(--ash-accent)]/20 flex items-center justify-center shrink-0", children: /* @__PURE__ */ t(de, { className: "w-4 h-4 text-[var(--ash-accent)]" }) }),
|
|
2017
|
+
/* @__PURE__ */ t("div", { className: "flex-1", children: m.mode === "accordion" ? /* @__PURE__ */ t(
|
|
2018
|
+
kn,
|
|
2019
|
+
{
|
|
2020
|
+
toolCalls: k,
|
|
2021
|
+
defaultExpanded: m.defaultExpanded
|
|
2022
|
+
}
|
|
2023
|
+
) : /* @__PURE__ */ t(
|
|
2024
|
+
vn,
|
|
2025
|
+
{
|
|
2026
|
+
toolCalls: k,
|
|
2027
|
+
defaultExpanded: m.defaultExpanded,
|
|
2028
|
+
animationDuration: m.animationDuration
|
|
2029
|
+
}
|
|
2030
|
+
) })
|
|
2031
|
+
] }, M.id);
|
|
2032
|
+
}),
|
|
2033
|
+
r && /* @__PURE__ */ i("div", { className: "flex gap-3 ash-animate-fade-in", children: [
|
|
2034
|
+
/* @__PURE__ */ t("div", { className: "w-7 h-7 rounded-full bg-[var(--ash-accent)]/20 flex items-center justify-center shrink-0", children: /* @__PURE__ */ t(de, { className: "w-4 h-4 text-[var(--ash-accent)]" }) }),
|
|
2035
|
+
/* @__PURE__ */ t("div", { className: "flex-1 max-w-[85%]", children: /* @__PURE__ */ t("div", { className: "rounded-xl p-3 bg-white/5 text-white/80", children: /* @__PURE__ */ t(on, { content: r, isStreaming: !0 }) }) })
|
|
2036
|
+
] }),
|
|
2037
|
+
n && !r && /* @__PURE__ */ i("div", { className: "flex gap-3 ash-animate-fade-in", children: [
|
|
2038
|
+
/* @__PURE__ */ t("div", { className: "w-7 h-7 rounded-full bg-[var(--ash-accent)]/20 flex items-center justify-center shrink-0", children: /* @__PURE__ */ t(de, { className: "w-4 h-4 text-[var(--ash-accent)]" }) }),
|
|
2039
|
+
/* @__PURE__ */ t("div", { className: "rounded-xl p-3 bg-white/5", children: /* @__PURE__ */ t($e, { variant: "dots" }) })
|
|
2040
|
+
] }),
|
|
2041
|
+
/* @__PURE__ */ t("div", { ref: v })
|
|
2042
|
+
] });
|
|
2043
|
+
}
|
|
2044
|
+
function In(e) {
|
|
2045
|
+
switch (e) {
|
|
2046
|
+
case "info":
|
|
2047
|
+
return /* @__PURE__ */ t(Tt, { className: "w-3.5 h-3.5" });
|
|
2048
|
+
case "warn":
|
|
2049
|
+
return /* @__PURE__ */ t(Ke, { className: "w-3.5 h-3.5" });
|
|
2050
|
+
case "error":
|
|
2051
|
+
return /* @__PURE__ */ t(St, { className: "w-3.5 h-3.5" });
|
|
2052
|
+
case "debug":
|
|
2053
|
+
return /* @__PURE__ */ t(Mt, { className: "w-3.5 h-3.5" });
|
|
2054
|
+
}
|
|
2055
|
+
}
|
|
2056
|
+
function En(e) {
|
|
2057
|
+
switch (e) {
|
|
2058
|
+
case "info":
|
|
2059
|
+
return "text-blue-400";
|
|
2060
|
+
case "warn":
|
|
2061
|
+
return "text-yellow-500";
|
|
2062
|
+
case "error":
|
|
2063
|
+
return "text-red-400";
|
|
2064
|
+
case "debug":
|
|
2065
|
+
return "text-white/50";
|
|
2066
|
+
}
|
|
2067
|
+
}
|
|
2068
|
+
function Ln(e) {
|
|
2069
|
+
switch (e) {
|
|
2070
|
+
case "info":
|
|
2071
|
+
return "bg-blue-900/20";
|
|
2072
|
+
case "warn":
|
|
2073
|
+
return "bg-yellow-900/20";
|
|
2074
|
+
case "error":
|
|
2075
|
+
return "bg-red-900/20";
|
|
2076
|
+
case "debug":
|
|
2077
|
+
return "bg-white/5";
|
|
2078
|
+
}
|
|
2079
|
+
}
|
|
2080
|
+
function $n(e) {
|
|
2081
|
+
switch (e) {
|
|
2082
|
+
case "setup":
|
|
2083
|
+
return "Setup";
|
|
2084
|
+
case "skills":
|
|
2085
|
+
return "Skills";
|
|
2086
|
+
case "execution":
|
|
2087
|
+
return "Execution";
|
|
2088
|
+
case "process":
|
|
2089
|
+
return "Process";
|
|
2090
|
+
case "startup":
|
|
2091
|
+
return "Startup";
|
|
2092
|
+
}
|
|
2093
|
+
}
|
|
2094
|
+
function An({ log: e }) {
|
|
2095
|
+
const [n, r] = N(!1), s = e.data && Object.keys(e.data).length > 0;
|
|
2096
|
+
return /* @__PURE__ */ i(
|
|
2097
|
+
"div",
|
|
2098
|
+
{
|
|
2099
|
+
className: p(
|
|
2100
|
+
"px-3 py-2 border-b border-white/10 last:border-b-0",
|
|
2101
|
+
Ln(e.level)
|
|
2102
|
+
),
|
|
2103
|
+
children: [
|
|
2104
|
+
/* @__PURE__ */ i(
|
|
2105
|
+
"div",
|
|
2106
|
+
{
|
|
2107
|
+
className: p("flex items-start gap-2", s && "cursor-pointer"),
|
|
2108
|
+
onClick: () => s && r(!n),
|
|
2109
|
+
children: [
|
|
2110
|
+
/* @__PURE__ */ t("div", { className: "w-4 flex-shrink-0 pt-0.5", children: s && (n ? /* @__PURE__ */ t(je, { className: "w-3 h-3 text-white/40" }) : /* @__PURE__ */ t(ve, { className: "w-3 h-3 text-white/40" })) }),
|
|
2111
|
+
/* @__PURE__ */ t("div", { className: p("flex-shrink-0 pt-0.5", En(e.level)), children: In(e.level) }),
|
|
2112
|
+
/* @__PURE__ */ t("span", { className: "text-xs text-white/40 font-mono flex-shrink-0 pt-0.5", children: De(e.timestamp) }),
|
|
2113
|
+
/* @__PURE__ */ t("span", { className: "text-xs px-1.5 py-0.5 rounded bg-white/10 text-white/70 font-medium flex-shrink-0", children: $n(e.category) }),
|
|
2114
|
+
/* @__PURE__ */ t("span", { className: "text-sm text-white/80 flex-1 break-words", children: e.message })
|
|
2115
|
+
]
|
|
2116
|
+
}
|
|
2117
|
+
),
|
|
2118
|
+
n && s && /* @__PURE__ */ t("div", { className: "mt-2 ml-6 pl-4 border-l-2 border-white/20", children: /* @__PURE__ */ t("pre", { className: "text-xs text-white/50 font-mono whitespace-pre-wrap overflow-x-auto", children: JSON.stringify(e.data, null, 2) }) })
|
|
2119
|
+
]
|
|
2120
|
+
}
|
|
2121
|
+
);
|
|
2122
|
+
}
|
|
2123
|
+
function Rn({
|
|
2124
|
+
logs: e,
|
|
2125
|
+
title: n = "Logs",
|
|
2126
|
+
isLoading: r,
|
|
2127
|
+
defaultCollapsed: s = !0,
|
|
2128
|
+
maxHeight: a = 256,
|
|
2129
|
+
className: l
|
|
2130
|
+
}) {
|
|
2131
|
+
const [c, h] = N(s), o = e.filter((d) => d.level === "error").length, w = e.filter((d) => d.level === "warn").length;
|
|
2132
|
+
return e.length === 0 && !r ? null : /* @__PURE__ */ i(
|
|
2133
|
+
"div",
|
|
2134
|
+
{
|
|
2135
|
+
className: p(
|
|
2136
|
+
"border-t border-white/10 bg-[var(--ash-surface-dark,#0a0a0a)]",
|
|
2137
|
+
l
|
|
2138
|
+
),
|
|
2139
|
+
children: [
|
|
2140
|
+
/* @__PURE__ */ i(
|
|
2141
|
+
"button",
|
|
2142
|
+
{
|
|
2143
|
+
onClick: () => h(!c),
|
|
2144
|
+
className: "w-full flex items-center justify-between px-4 py-2 hover:bg-white/5 transition-colors",
|
|
2145
|
+
children: [
|
|
2146
|
+
/* @__PURE__ */ i("div", { className: "flex items-center gap-2", children: [
|
|
2147
|
+
/* @__PURE__ */ t(Me, { className: "w-4 h-4 text-white/50" }),
|
|
2148
|
+
/* @__PURE__ */ t("span", { className: "text-sm font-medium text-white/80", children: n }),
|
|
2149
|
+
/* @__PURE__ */ i("span", { className: "text-xs text-white/40", children: [
|
|
2150
|
+
"(",
|
|
2151
|
+
e.length,
|
|
2152
|
+
")"
|
|
2153
|
+
] }),
|
|
2154
|
+
o > 0 && /* @__PURE__ */ i("span", { className: "text-xs px-1.5 py-0.5 rounded bg-red-900/50 text-red-400 font-medium", children: [
|
|
2155
|
+
o,
|
|
2156
|
+
" error",
|
|
2157
|
+
o > 1 ? "s" : ""
|
|
2158
|
+
] }),
|
|
2159
|
+
w > 0 && /* @__PURE__ */ i("span", { className: "text-xs px-1.5 py-0.5 rounded bg-yellow-900/50 text-yellow-400 font-medium", children: [
|
|
2160
|
+
w,
|
|
2161
|
+
" warning",
|
|
2162
|
+
w > 1 ? "s" : ""
|
|
2163
|
+
] }),
|
|
2164
|
+
r && /* @__PURE__ */ t("span", { className: "text-xs text-white/40 animate-pulse", children: "Loading..." })
|
|
2165
|
+
] }),
|
|
2166
|
+
c ? /* @__PURE__ */ t(ve, { className: "w-4 h-4 text-white/40" }) : /* @__PURE__ */ t(je, { className: "w-4 h-4 text-white/40" })
|
|
2167
|
+
]
|
|
2168
|
+
}
|
|
2169
|
+
),
|
|
2170
|
+
!c && /* @__PURE__ */ t(
|
|
2171
|
+
"div",
|
|
2172
|
+
{
|
|
2173
|
+
className: "overflow-y-auto border-t border-white/10",
|
|
2174
|
+
style: { maxHeight: a },
|
|
2175
|
+
children: e.length === 0 ? /* @__PURE__ */ t("div", { className: "px-4 py-6 text-center text-sm text-white/50", children: "No logs yet" }) : e.map((d, m) => /* @__PURE__ */ t(An, { log: d }, `${d.timestamp}-${m}`))
|
|
2176
|
+
}
|
|
2177
|
+
)
|
|
2178
|
+
]
|
|
2179
|
+
}
|
|
2180
|
+
);
|
|
2181
|
+
}
|
|
2182
|
+
var Ae = Ge(void 0), Dn = "ash-ui-theme";
|
|
2183
|
+
function Er({
|
|
2184
|
+
children: e,
|
|
2185
|
+
defaultTheme: n,
|
|
2186
|
+
storageKey: r = Dn,
|
|
2187
|
+
listenToSystemChanges: s = !0
|
|
2188
|
+
}) {
|
|
2189
|
+
const [a, l] = N(() => {
|
|
2190
|
+
if (typeof window < "u") {
|
|
2191
|
+
const d = localStorage.getItem(r);
|
|
2192
|
+
if (d === "dark" || d === "light")
|
|
2193
|
+
return d;
|
|
2194
|
+
if (!n && window.matchMedia("(prefers-color-scheme: dark)").matches)
|
|
2195
|
+
return "dark";
|
|
2196
|
+
}
|
|
2197
|
+
return n ?? "light";
|
|
2198
|
+
}), [c, h] = N(!1);
|
|
2199
|
+
j(() => {
|
|
2200
|
+
h(!0);
|
|
2201
|
+
}, []), j(() => {
|
|
2202
|
+
if (!c) return;
|
|
2203
|
+
const d = document.documentElement;
|
|
2204
|
+
a === "dark" ? d.classList.add("dark") : d.classList.remove("dark"), localStorage.setItem(r, a);
|
|
2205
|
+
}, [a, c, r]), j(() => {
|
|
2206
|
+
if (!s || typeof window > "u") return;
|
|
2207
|
+
const d = window.matchMedia("(prefers-color-scheme: dark)"), m = (g) => {
|
|
2208
|
+
localStorage.getItem(r) || l(g.matches ? "dark" : "light");
|
|
2209
|
+
};
|
|
2210
|
+
return d.addEventListener("change", m), () => d.removeEventListener("change", m);
|
|
2211
|
+
}, [r, s]);
|
|
2212
|
+
const o = B(() => {
|
|
2213
|
+
l((d) => d === "light" ? "dark" : "light");
|
|
2214
|
+
}, []), w = B((d) => {
|
|
2215
|
+
l(d);
|
|
2216
|
+
}, []);
|
|
2217
|
+
return c ? /* @__PURE__ */ t(Ae.Provider, { value: { theme: a, toggleTheme: o, setTheme: w }, children: e }) : /* @__PURE__ */ t(Ae.Provider, { value: { theme: n ?? "light", toggleTheme: o, setTheme: w }, children: e });
|
|
2218
|
+
}
|
|
2219
|
+
function Lr() {
|
|
2220
|
+
const e = Je(Ae);
|
|
2221
|
+
if (e === void 0)
|
|
2222
|
+
throw new Error("useTheme must be used within a ThemeProvider");
|
|
2223
|
+
return e;
|
|
2224
|
+
}
|
|
2225
|
+
var jn = {
|
|
2226
|
+
slideUp: `
|
|
2227
|
+
@keyframes ash-slide-up {
|
|
2228
|
+
from { opacity: 0; transform: translateY(20px); }
|
|
2229
|
+
to { opacity: 1; transform: translateY(0); }
|
|
2230
|
+
}
|
|
2231
|
+
`,
|
|
2232
|
+
fadeIn: `
|
|
2233
|
+
@keyframes ash-fade-in {
|
|
2234
|
+
from { opacity: 0; transform: translateY(10px); }
|
|
2235
|
+
to { opacity: 1; transform: translateY(0); }
|
|
2236
|
+
}
|
|
2237
|
+
`,
|
|
2238
|
+
blink: `
|
|
2239
|
+
@keyframes ash-blink {
|
|
2240
|
+
0%, 50% { opacity: 1; }
|
|
2241
|
+
51%, 100% { opacity: 0; }
|
|
2242
|
+
}
|
|
2243
|
+
`,
|
|
2244
|
+
bounce: `
|
|
2245
|
+
@keyframes ash-bounce {
|
|
2246
|
+
0%, 80%, 100% { transform: scale(0); }
|
|
2247
|
+
40% { transform: scale(1); }
|
|
2248
|
+
}
|
|
2249
|
+
`,
|
|
2250
|
+
pulse: `
|
|
2251
|
+
@keyframes ash-pulse {
|
|
2252
|
+
0%, 100% { opacity: 1; }
|
|
2253
|
+
50% { opacity: 0.5; }
|
|
2254
|
+
}
|
|
2255
|
+
`,
|
|
2256
|
+
glowPulse: `
|
|
2257
|
+
@keyframes ash-glow-pulse {
|
|
2258
|
+
0%, 100% { box-shadow: 0 0 20px rgba(204, 255, 0, 0.3); }
|
|
2259
|
+
50% { box-shadow: 0 0 40px rgba(204, 255, 0, 0.5); }
|
|
2260
|
+
}
|
|
2261
|
+
`
|
|
2262
|
+
};
|
|
2263
|
+
Object.values(jn).join(`
|
|
2264
|
+
`);
|
|
2265
|
+
function Wn({
|
|
2266
|
+
messages: e,
|
|
2267
|
+
loading: n,
|
|
2268
|
+
streamingContent: r
|
|
2269
|
+
}) {
|
|
2270
|
+
const s = O(null), a = O(null);
|
|
2271
|
+
return j(() => {
|
|
2272
|
+
a.current && a.current.scrollIntoView({ behavior: "smooth", block: "end" });
|
|
2273
|
+
}, [e, r, n]), /* @__PURE__ */ i("div", { ref: s, className: "flex-1 overflow-y-auto p-4 space-y-4", children: [
|
|
2274
|
+
e.map((l) => /* @__PURE__ */ t(Bn, { message: l }, l.id)),
|
|
2275
|
+
r && /* @__PURE__ */ t("div", { className: "flex justify-start animate-fade-in", children: /* @__PURE__ */ i("div", { className: "max-w-[80%] card-glass rounded-2xl p-4", children: [
|
|
2276
|
+
/* @__PURE__ */ t("div", { className: "text-xs text-[#ccff00] mb-2 font-medium", children: "Assistant" }),
|
|
2277
|
+
/* @__PURE__ */ t("div", { className: "message-content prose prose-sm prose-invert max-w-none whitespace-pre-wrap", children: r })
|
|
2278
|
+
] }) }),
|
|
2279
|
+
n && !r && /* @__PURE__ */ t("div", { className: "flex justify-start animate-fade-in", children: /* @__PURE__ */ t("div", { className: "card-glass rounded-2xl p-4", children: /* @__PURE__ */ i("div", { className: "flex items-center gap-2 text-[#ccff00]", children: [
|
|
2280
|
+
/* @__PURE__ */ t("span", { className: "w-2 h-2 rounded-full bg-[#ccff00] animate-pulse" }),
|
|
2281
|
+
/* @__PURE__ */ t("span", { className: "w-2 h-2 rounded-full bg-[#ccff00] animate-pulse delay-100" }),
|
|
2282
|
+
/* @__PURE__ */ t("span", { className: "w-2 h-2 rounded-full bg-[#ccff00] animate-pulse delay-200" })
|
|
2283
|
+
] }) }) }),
|
|
2284
|
+
/* @__PURE__ */ t("div", { ref: a })
|
|
2285
|
+
] });
|
|
2286
|
+
}
|
|
2287
|
+
function Bn({ message: e }) {
|
|
2288
|
+
const n = e.role === "user", r = e.role === "tool";
|
|
2289
|
+
return /* @__PURE__ */ t("div", { className: `flex ${n ? "justify-end" : "justify-start"} animate-fade-in`, children: /* @__PURE__ */ i(
|
|
2290
|
+
"div",
|
|
2291
|
+
{
|
|
2292
|
+
className: `max-w-[80%] rounded-2xl p-4 ${n ? "bg-[#ccff00] text-black shadow-[0_0_20px_rgba(204,255,0,0.2)]" : r ? "bg-yellow-500/10 border border-yellow-500/20" : "card-glass"}`,
|
|
2293
|
+
children: [
|
|
2294
|
+
/* @__PURE__ */ t(
|
|
2295
|
+
"div",
|
|
2296
|
+
{
|
|
2297
|
+
className: `text-xs mb-2 font-medium ${n ? "text-black/60" : r ? "text-yellow-400" : "text-[#ccff00]"}`,
|
|
2298
|
+
children: e.role.charAt(0).toUpperCase() + e.role.slice(1)
|
|
2299
|
+
}
|
|
2300
|
+
),
|
|
2301
|
+
/* @__PURE__ */ t("div", { className: `message-content ${n ? "" : "prose prose-sm prose-invert max-w-none"}`, children: e.content.map((a, l) => /* @__PURE__ */ t(On, { block: a, isUser: n }, l)) }),
|
|
2302
|
+
/* @__PURE__ */ t("div", { className: `text-xs mt-3 ${n ? "text-black/40" : "text-white/40"}`, children: new Date(e.createdAt).toLocaleTimeString() })
|
|
2303
|
+
]
|
|
2304
|
+
}
|
|
2305
|
+
) });
|
|
2306
|
+
}
|
|
2307
|
+
function On({
|
|
2308
|
+
block: e,
|
|
2309
|
+
isUser: n
|
|
2310
|
+
}) {
|
|
2311
|
+
return e.type === "text" && e.text ? /* @__PURE__ */ t("p", { className: "whitespace-pre-wrap", children: e.text }) : e.type === "tool_use" ? /* @__PURE__ */ i("div", { className: "bg-black/40 border border-white/10 rounded-xl p-3 my-2", children: [
|
|
2312
|
+
/* @__PURE__ */ i("div", { className: "text-xs text-[#ccff00] mb-2 font-medium flex items-center gap-2", children: [
|
|
2313
|
+
/* @__PURE__ */ t("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M11.42 15.17 17.25 21A2.652 2.652 0 0 0 21 17.25l-5.877-5.877M11.42 15.17l2.496-3.03c.317-.384.74-.626 1.208-.766M11.42 15.17l-4.655 5.653a2.548 2.548 0 1 1-3.586-3.586l6.837-5.63m5.108-.233c.55-.164 1.163-.188 1.743-.14a4.5 4.5 0 0 0 4.486-6.336l-3.276 3.277a3.004 3.004 0 0 1-2.25-2.25l3.276-3.276a4.5 4.5 0 0 0-6.336 4.486c.091 1.076-.071 2.264-.904 2.95l-.102.085m-1.745 1.437L5.909 7.5H4.5L2.25 3.75l1.5-1.5L7.5 4.5v1.409l4.26 4.26m-1.745 1.437 1.745-1.437m6.615 8.206L15.75 15.75M4.867 19.125h.008v.008h-.008v-.008Z" }) }),
|
|
2314
|
+
"Tool: ",
|
|
2315
|
+
e.name
|
|
2316
|
+
] }),
|
|
2317
|
+
/* @__PURE__ */ t("pre", { className: "text-sm overflow-x-auto text-white/80 font-mono", children: JSON.stringify(e.input, null, 2) })
|
|
2318
|
+
] }) : e.type === "tool_result" ? /* @__PURE__ */ i("div", { className: "bg-emerald-500/10 border border-emerald-500/20 rounded-xl p-3 my-2", children: [
|
|
2319
|
+
/* @__PURE__ */ i("div", { className: "text-xs text-emerald-400 mb-2 font-medium flex items-center gap-2", children: [
|
|
2320
|
+
/* @__PURE__ */ t("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M9 12.75 11.25 15 15 9.75M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z" }) }),
|
|
2321
|
+
"Tool Result"
|
|
2322
|
+
] }),
|
|
2323
|
+
/* @__PURE__ */ t("pre", { className: "text-sm overflow-x-auto text-emerald-300/80 font-mono", children: typeof e.content == "string" ? e.content : JSON.stringify(e.content, null, 2) })
|
|
2324
|
+
] }) : null;
|
|
2325
|
+
}
|
|
2326
|
+
const zn = 5e3;
|
|
2327
|
+
function Ve(e) {
|
|
2328
|
+
return e < 1024 ? `${e} B` : e < 1024 * 1024 ? `${(e / 1024).toFixed(1)} KB` : `${(e / (1024 * 1024)).toFixed(1)} MB`;
|
|
2329
|
+
}
|
|
2330
|
+
function Fn({
|
|
2331
|
+
onSend: e,
|
|
2332
|
+
disabled: n,
|
|
2333
|
+
loading: r,
|
|
2334
|
+
placeholder: s = "Type your message...",
|
|
2335
|
+
queue: a = [],
|
|
2336
|
+
onCancelQueued: l,
|
|
2337
|
+
sessionContext: c = "",
|
|
2338
|
+
onSessionContextChange: h,
|
|
2339
|
+
envVars: o = {},
|
|
2340
|
+
onEnvVarsChange: w,
|
|
2341
|
+
enableFileUpload: d = !0,
|
|
2342
|
+
maxFileSize: m = 100 * 1024 * 1024,
|
|
2343
|
+
// 100MB
|
|
2344
|
+
maxFiles: g = 10,
|
|
2345
|
+
onStop: v,
|
|
2346
|
+
canStop: S = !1,
|
|
2347
|
+
enableLongTextConversion: z = !0,
|
|
2348
|
+
longTextThreshold: M = zn
|
|
2349
|
+
}) {
|
|
2350
|
+
const [k, A] = N(""), [E, W] = N(!1), [F, P] = N(!1), [ue, ie] = N(""), [ye, ae] = N(""), [R, K] = N([]), [he, le] = N(!1), [Z, Y] = N(null), [me, pe] = N(/* @__PURE__ */ new Map()), ge = O(0), oe = O(null), be = O(null), fe = O(null), we = B((u) => {
|
|
2351
|
+
const I = new TextEncoder().encode(u);
|
|
2352
|
+
let f = "";
|
|
2353
|
+
for (let C = 0; C < I.length; C++)
|
|
2354
|
+
f += String.fromCharCode(I[C]);
|
|
2355
|
+
return btoa(f);
|
|
2356
|
+
}, []), q = B((u) => {
|
|
2357
|
+
if (!z || !d) return;
|
|
2358
|
+
const b = u.clipboardData.getData("text/plain");
|
|
2359
|
+
if (b.length > M) {
|
|
2360
|
+
if (u.preventDefault(), R.length >= g) {
|
|
2361
|
+
console.warn(`Cannot convert text to attachment: maximum ${g} files reached`);
|
|
2362
|
+
return;
|
|
2363
|
+
}
|
|
2364
|
+
const I = b.split(`
|
|
2365
|
+
`).length;
|
|
2366
|
+
ge.current += 1;
|
|
2367
|
+
const f = ge.current, C = `pasted-text-${f}-${Date.now()}.txt`, X = we(b), rt = new TextEncoder().encode(b).length, st = {
|
|
2368
|
+
filename: C,
|
|
2369
|
+
content: X,
|
|
2370
|
+
mimeType: "text/plain",
|
|
2371
|
+
size: rt
|
|
2372
|
+
};
|
|
2373
|
+
pe((Ee) => {
|
|
2374
|
+
const Pe = new Map(Ee);
|
|
2375
|
+
return Pe.set(C, { number: f, lineCount: I }), Pe;
|
|
2376
|
+
}), K((Ee) => [...Ee, st]), Y({
|
|
2377
|
+
originalLength: b.length,
|
|
2378
|
+
filename: C,
|
|
2379
|
+
preview: b.slice(0, 100) + (b.length > 100 ? "..." : ""),
|
|
2380
|
+
lineCount: I
|
|
2381
|
+
}), setTimeout(() => {
|
|
2382
|
+
Y(null);
|
|
2383
|
+
}, 5e3);
|
|
2384
|
+
}
|
|
2385
|
+
}, [z, d, M, R.length, g, we]), x = () => {
|
|
2386
|
+
const u = k.trim();
|
|
2387
|
+
(u || R.length > 0) && !n && (e(u || "(files attached)", R.length > 0 ? R : void 0), A(""), K([]), pe(/* @__PURE__ */ new Map()), oe.current && (oe.current.style.height = "auto"));
|
|
2388
|
+
}, y = (u) => {
|
|
2389
|
+
u.key === "Enter" && !u.shiftKey && (u.preventDefault(), x());
|
|
2390
|
+
}, T = () => {
|
|
2391
|
+
const u = oe.current;
|
|
2392
|
+
u && (u.style.height = "auto", u.style.height = `${Math.min(u.scrollHeight, 200)}px`);
|
|
2393
|
+
}, D = async (u) => {
|
|
2394
|
+
if (!u) return;
|
|
2395
|
+
const b = [], I = R.length;
|
|
2396
|
+
for (let f = 0; f < u.length && I + b.length < g; f++) {
|
|
2397
|
+
const C = u[f];
|
|
2398
|
+
if (C.size > m) {
|
|
2399
|
+
console.warn(`File ${C.name} exceeds maximum size of ${Ve(m)}`);
|
|
2400
|
+
continue;
|
|
2401
|
+
}
|
|
2402
|
+
try {
|
|
2403
|
+
const X = await Q(C);
|
|
2404
|
+
b.push({
|
|
2405
|
+
filename: C.name,
|
|
2406
|
+
content: X,
|
|
2407
|
+
mimeType: C.type || "application/octet-stream",
|
|
2408
|
+
size: C.size
|
|
2409
|
+
});
|
|
2410
|
+
} catch (X) {
|
|
2411
|
+
console.error(`Failed to read file ${C.name}:`, X);
|
|
2412
|
+
}
|
|
2413
|
+
}
|
|
2414
|
+
b.length > 0 && K((f) => [...f, ...b]);
|
|
2415
|
+
}, Q = (u) => new Promise((b, I) => {
|
|
2416
|
+
const f = new FileReader();
|
|
2417
|
+
f.onload = () => {
|
|
2418
|
+
const X = f.result.split(",")[1];
|
|
2419
|
+
b(X || "");
|
|
2420
|
+
}, f.onerror = () => I(f.error), f.readAsDataURL(u);
|
|
2421
|
+
}), te = (u) => {
|
|
2422
|
+
D(u.target.files), fe.current && (fe.current.value = "");
|
|
2423
|
+
}, ce = (u) => {
|
|
2424
|
+
u.preventDefault(), d && !n && le(!0);
|
|
2425
|
+
}, V = (u) => {
|
|
2426
|
+
u.preventDefault(), le(!1);
|
|
2427
|
+
}, H = (u) => {
|
|
2428
|
+
u.preventDefault(), le(!1), d && !n && D(u.dataTransfer.files);
|
|
2429
|
+
}, G = (u) => {
|
|
2430
|
+
const b = R[u];
|
|
2431
|
+
b && me.has(b.filename) && pe((I) => {
|
|
2432
|
+
const f = new Map(I);
|
|
2433
|
+
return f.delete(b.filename), f;
|
|
2434
|
+
}), K((I) => I.filter((f, C) => C !== u));
|
|
2435
|
+
}, J = a.length > 0, Ne = r ? "Sending..." : J ? `Queue (${a.length})` : "Send", ke = c.trim().length > 0, Ce = Object.keys(o).length > 0, Ie = !n && (k.trim() || R.length > 0), xe = () => {
|
|
2436
|
+
const u = ue.trim(), b = ye.trim();
|
|
2437
|
+
u && w && (w({ ...o, [u]: b }), ie(""), ae(""));
|
|
2438
|
+
}, U = (u) => {
|
|
2439
|
+
if (w) {
|
|
2440
|
+
const b = { ...o };
|
|
2441
|
+
delete b[u], w(b);
|
|
2442
|
+
}
|
|
2443
|
+
}, ne = (u) => {
|
|
2444
|
+
u.key === "Enter" && (u.preventDefault(), xe());
|
|
2445
|
+
};
|
|
2446
|
+
return /* @__PURE__ */ i(
|
|
2447
|
+
"div",
|
|
2448
|
+
{
|
|
2449
|
+
className: `border-t border-white/10 p-3 sm:p-4 glass-panel relative ${he ? "bg-[#ccff00]/5" : ""}`,
|
|
2450
|
+
onDragOver: ce,
|
|
2451
|
+
onDragLeave: V,
|
|
2452
|
+
onDrop: H,
|
|
2453
|
+
children: [
|
|
2454
|
+
he && d && /* @__PURE__ */ t("div", { className: "absolute inset-0 bg-[#ccff00]/10 border-2 border-dashed border-[#ccff00]/50 rounded-xl flex items-center justify-center z-10 pointer-events-none", children: /* @__PURE__ */ t("div", { className: "text-[#ccff00] font-medium", children: "Drop files here" }) }),
|
|
2455
|
+
h && /* @__PURE__ */ i("div", { className: "mb-3", children: [
|
|
2456
|
+
/* @__PURE__ */ i(
|
|
2457
|
+
"button",
|
|
2458
|
+
{
|
|
2459
|
+
type: "button",
|
|
2460
|
+
onClick: () => W(!E),
|
|
2461
|
+
className: "flex items-center gap-2 text-xs font-medium text-white/50 hover:text-white/80 transition-colors",
|
|
2462
|
+
children: [
|
|
2463
|
+
/* @__PURE__ */ t(
|
|
2464
|
+
"svg",
|
|
2465
|
+
{
|
|
2466
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2467
|
+
className: `h-3 w-3 transition-transform ${E ? "rotate-90" : ""}`,
|
|
2468
|
+
viewBox: "0 0 20 20",
|
|
2469
|
+
fill: "currentColor",
|
|
2470
|
+
children: /* @__PURE__ */ t(
|
|
2471
|
+
"path",
|
|
2472
|
+
{
|
|
2473
|
+
fillRule: "evenodd",
|
|
2474
|
+
d: "M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z",
|
|
2475
|
+
clipRule: "evenodd"
|
|
2476
|
+
}
|
|
2477
|
+
)
|
|
2478
|
+
}
|
|
2479
|
+
),
|
|
2480
|
+
/* @__PURE__ */ t("span", { className: "uppercase tracking-wide", children: "Session Context" }),
|
|
2481
|
+
ke && !E && /* @__PURE__ */ t("span", { className: "badge badge-accent", children: "Active" })
|
|
2482
|
+
]
|
|
2483
|
+
}
|
|
2484
|
+
),
|
|
2485
|
+
E && /* @__PURE__ */ i("div", { className: "mt-2", children: [
|
|
2486
|
+
/* @__PURE__ */ t(
|
|
2487
|
+
"textarea",
|
|
2488
|
+
{
|
|
2489
|
+
ref: be,
|
|
2490
|
+
value: c,
|
|
2491
|
+
onChange: (u) => h(u.target.value),
|
|
2492
|
+
onInput: () => {
|
|
2493
|
+
const u = be.current;
|
|
2494
|
+
u && (u.style.height = "auto", u.style.height = `${Math.min(u.scrollHeight, 150)}px`);
|
|
2495
|
+
},
|
|
2496
|
+
placeholder: "Add context that will be injected into every request (e.g., current page, user selection, etc.)",
|
|
2497
|
+
className: "input-glass resize-none text-sm font-mono",
|
|
2498
|
+
rows: 3
|
|
2499
|
+
}
|
|
2500
|
+
),
|
|
2501
|
+
/* @__PURE__ */ t("p", { className: "text-xs text-white/40 mt-1", children: "This context is appended to the system prompt for each message sent." })
|
|
2502
|
+
] })
|
|
2503
|
+
] }),
|
|
2504
|
+
w && /* @__PURE__ */ i("div", { className: "mb-3", children: [
|
|
2505
|
+
/* @__PURE__ */ i(
|
|
2506
|
+
"button",
|
|
2507
|
+
{
|
|
2508
|
+
type: "button",
|
|
2509
|
+
onClick: () => P(!F),
|
|
2510
|
+
className: "flex items-center gap-2 text-xs font-medium text-white/50 hover:text-white/80 transition-colors",
|
|
2511
|
+
children: [
|
|
2512
|
+
/* @__PURE__ */ t(
|
|
2513
|
+
"svg",
|
|
2514
|
+
{
|
|
2515
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2516
|
+
className: `h-3 w-3 transition-transform ${F ? "rotate-90" : ""}`,
|
|
2517
|
+
viewBox: "0 0 20 20",
|
|
2518
|
+
fill: "currentColor",
|
|
2519
|
+
children: /* @__PURE__ */ t(
|
|
2520
|
+
"path",
|
|
2521
|
+
{
|
|
2522
|
+
fillRule: "evenodd",
|
|
2523
|
+
d: "M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z",
|
|
2524
|
+
clipRule: "evenodd"
|
|
2525
|
+
}
|
|
2526
|
+
)
|
|
2527
|
+
}
|
|
2528
|
+
),
|
|
2529
|
+
/* @__PURE__ */ t("span", { className: "uppercase tracking-wide", children: "Environment Variables" }),
|
|
2530
|
+
Ce && !F && /* @__PURE__ */ t("span", { className: "badge badge-accent", children: Object.keys(o).length })
|
|
2531
|
+
]
|
|
2532
|
+
}
|
|
2533
|
+
),
|
|
2534
|
+
F && /* @__PURE__ */ i("div", { className: "mt-2 space-y-2", children: [
|
|
2535
|
+
Object.entries(o).map(([u, b]) => /* @__PURE__ */ i(
|
|
2536
|
+
"div",
|
|
2537
|
+
{
|
|
2538
|
+
className: "flex items-center gap-2 bg-white/5 border border-white/10 rounded-xl px-3 py-2 text-sm",
|
|
2539
|
+
children: [
|
|
2540
|
+
/* @__PURE__ */ t("span", { className: "text-[#ccff00] font-mono font-medium", children: u }),
|
|
2541
|
+
/* @__PURE__ */ t("span", { className: "text-white/40", children: "=" }),
|
|
2542
|
+
/* @__PURE__ */ t("span", { className: "text-white/70 font-mono flex-1 truncate", children: b || "(empty)" }),
|
|
2543
|
+
/* @__PURE__ */ t(
|
|
2544
|
+
"button",
|
|
2545
|
+
{
|
|
2546
|
+
onClick: () => U(u),
|
|
2547
|
+
className: "text-white/40 hover:text-red-400 transition-colors",
|
|
2548
|
+
title: "Remove variable",
|
|
2549
|
+
children: /* @__PURE__ */ t(
|
|
2550
|
+
"svg",
|
|
2551
|
+
{
|
|
2552
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2553
|
+
className: "h-4 w-4",
|
|
2554
|
+
viewBox: "0 0 20 20",
|
|
2555
|
+
fill: "currentColor",
|
|
2556
|
+
children: /* @__PURE__ */ t(
|
|
2557
|
+
"path",
|
|
2558
|
+
{
|
|
2559
|
+
fillRule: "evenodd",
|
|
2560
|
+
d: "M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",
|
|
2561
|
+
clipRule: "evenodd"
|
|
2562
|
+
}
|
|
2563
|
+
)
|
|
2564
|
+
}
|
|
2565
|
+
)
|
|
2566
|
+
}
|
|
2567
|
+
)
|
|
2568
|
+
]
|
|
2569
|
+
},
|
|
2570
|
+
u
|
|
2571
|
+
)),
|
|
2572
|
+
/* @__PURE__ */ i("div", { className: "flex items-center gap-2", children: [
|
|
2573
|
+
/* @__PURE__ */ t(
|
|
2574
|
+
"input",
|
|
2575
|
+
{
|
|
2576
|
+
type: "text",
|
|
2577
|
+
value: ue,
|
|
2578
|
+
onChange: (u) => ie(u.target.value.toUpperCase().replace(/[^A-Z0-9_]/g, "")),
|
|
2579
|
+
onKeyDown: ne,
|
|
2580
|
+
placeholder: "KEY",
|
|
2581
|
+
className: "input-glass text-sm font-mono flex-1 min-w-0 py-2"
|
|
2582
|
+
}
|
|
2583
|
+
),
|
|
2584
|
+
/* @__PURE__ */ t("span", { className: "text-white/40", children: "=" }),
|
|
2585
|
+
/* @__PURE__ */ t(
|
|
2586
|
+
"input",
|
|
2587
|
+
{
|
|
2588
|
+
type: "text",
|
|
2589
|
+
value: ye,
|
|
2590
|
+
onChange: (u) => ae(u.target.value),
|
|
2591
|
+
onKeyDown: ne,
|
|
2592
|
+
placeholder: "value",
|
|
2593
|
+
className: "input-glass text-sm font-mono flex-[2] min-w-0 py-2"
|
|
2594
|
+
}
|
|
2595
|
+
),
|
|
2596
|
+
/* @__PURE__ */ t(
|
|
2597
|
+
"button",
|
|
2598
|
+
{
|
|
2599
|
+
onClick: xe,
|
|
2600
|
+
disabled: !ue.trim(),
|
|
2601
|
+
className: "px-3 py-2 text-sm bg-[#ccff00]/20 hover:bg-[#ccff00]/30 text-[#ccff00] rounded-xl transition-all duration-300 disabled:opacity-30 disabled:cursor-not-allowed",
|
|
2602
|
+
children: "Add"
|
|
2603
|
+
}
|
|
2604
|
+
)
|
|
2605
|
+
] }),
|
|
2606
|
+
/* @__PURE__ */ t("p", { className: "text-xs text-white/40", children: "These environment variables will be available in the sandbox for new sessions." })
|
|
2607
|
+
] })
|
|
2608
|
+
] }),
|
|
2609
|
+
Z && /* @__PURE__ */ t("div", { className: "mb-3 p-3 bg-blue-500/10 border border-blue-500/30 rounded-xl", children: /* @__PURE__ */ i("div", { className: "flex items-start justify-between gap-3", children: [
|
|
2610
|
+
/* @__PURE__ */ i("div", { className: "flex items-start gap-2 min-w-0", children: [
|
|
2611
|
+
/* @__PURE__ */ t(
|
|
2612
|
+
"svg",
|
|
2613
|
+
{
|
|
2614
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2615
|
+
className: "h-5 w-5 text-blue-400 shrink-0 mt-0.5",
|
|
2616
|
+
fill: "none",
|
|
2617
|
+
viewBox: "0 0 24 24",
|
|
2618
|
+
stroke: "currentColor",
|
|
2619
|
+
children: /* @__PURE__ */ t(
|
|
2620
|
+
"path",
|
|
2621
|
+
{
|
|
2622
|
+
strokeLinecap: "round",
|
|
2623
|
+
strokeLinejoin: "round",
|
|
2624
|
+
strokeWidth: 2,
|
|
2625
|
+
d: "M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"
|
|
2626
|
+
}
|
|
2627
|
+
)
|
|
2628
|
+
}
|
|
2629
|
+
),
|
|
2630
|
+
/* @__PURE__ */ i("div", { className: "min-w-0", children: [
|
|
2631
|
+
/* @__PURE__ */ t("p", { className: "text-sm text-blue-200 font-medium", children: "Long text converted to attachment" }),
|
|
2632
|
+
/* @__PURE__ */ i("p", { className: "text-xs text-blue-300/70 mt-1", children: [
|
|
2633
|
+
Z.originalLength.toLocaleString(),
|
|
2634
|
+
" characters (",
|
|
2635
|
+
Z.lineCount,
|
|
2636
|
+
" lines) saved as text attachment"
|
|
2637
|
+
] }),
|
|
2638
|
+
/* @__PURE__ */ t("p", { className: "text-xs text-white/50 mt-1 truncate font-mono", children: Z.preview })
|
|
2639
|
+
] })
|
|
2640
|
+
] }),
|
|
2641
|
+
/* @__PURE__ */ t(
|
|
2642
|
+
"button",
|
|
2643
|
+
{
|
|
2644
|
+
onClick: () => Y(null),
|
|
2645
|
+
className: "text-blue-400/70 hover:text-blue-300 transition-colors shrink-0",
|
|
2646
|
+
title: "Dismiss",
|
|
2647
|
+
children: /* @__PURE__ */ t(
|
|
2648
|
+
"svg",
|
|
2649
|
+
{
|
|
2650
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2651
|
+
className: "h-4 w-4",
|
|
2652
|
+
viewBox: "0 0 20 20",
|
|
2653
|
+
fill: "currentColor",
|
|
2654
|
+
children: /* @__PURE__ */ t(
|
|
2655
|
+
"path",
|
|
2656
|
+
{
|
|
2657
|
+
fillRule: "evenodd",
|
|
2658
|
+
d: "M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",
|
|
2659
|
+
clipRule: "evenodd"
|
|
2660
|
+
}
|
|
2661
|
+
)
|
|
2662
|
+
}
|
|
2663
|
+
)
|
|
2664
|
+
}
|
|
2665
|
+
)
|
|
2666
|
+
] }) }),
|
|
2667
|
+
R.length > 0 && /* @__PURE__ */ i("div", { className: "mb-3 space-y-2", children: [
|
|
2668
|
+
/* @__PURE__ */ i("div", { className: "text-xs font-medium text-white/50 uppercase tracking-wide", children: [
|
|
2669
|
+
"Attached Files (",
|
|
2670
|
+
R.length,
|
|
2671
|
+
")"
|
|
2672
|
+
] }),
|
|
2673
|
+
/* @__PURE__ */ t("div", { className: "flex flex-wrap gap-2", children: R.map((u, b) => {
|
|
2674
|
+
const I = me.get(u.filename), f = !!I;
|
|
2675
|
+
return /* @__PURE__ */ i(
|
|
2676
|
+
"div",
|
|
2677
|
+
{
|
|
2678
|
+
className: `flex items-center gap-2 rounded-xl px-3 py-1.5 text-sm ${f ? "bg-purple-500/10 border border-purple-500/30" : "bg-white/5 border border-white/10"}`,
|
|
2679
|
+
children: [
|
|
2680
|
+
f ? (
|
|
2681
|
+
// Pasted text icon (document with lines)
|
|
2682
|
+
/* @__PURE__ */ t(
|
|
2683
|
+
"svg",
|
|
2684
|
+
{
|
|
2685
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2686
|
+
className: "h-4 w-4 text-purple-400",
|
|
2687
|
+
fill: "none",
|
|
2688
|
+
viewBox: "0 0 24 24",
|
|
2689
|
+
stroke: "currentColor",
|
|
2690
|
+
children: /* @__PURE__ */ t(
|
|
2691
|
+
"path",
|
|
2692
|
+
{
|
|
2693
|
+
strokeLinecap: "round",
|
|
2694
|
+
strokeLinejoin: "round",
|
|
2695
|
+
strokeWidth: 2,
|
|
2696
|
+
d: "M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"
|
|
2697
|
+
}
|
|
2698
|
+
)
|
|
2699
|
+
}
|
|
2700
|
+
)
|
|
2701
|
+
) : (
|
|
2702
|
+
// Regular file attachment icon
|
|
2703
|
+
/* @__PURE__ */ t(
|
|
2704
|
+
"svg",
|
|
2705
|
+
{
|
|
2706
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2707
|
+
className: "h-4 w-4 text-[#ccff00]",
|
|
2708
|
+
fill: "none",
|
|
2709
|
+
viewBox: "0 0 24 24",
|
|
2710
|
+
stroke: "currentColor",
|
|
2711
|
+
children: /* @__PURE__ */ t(
|
|
2712
|
+
"path",
|
|
2713
|
+
{
|
|
2714
|
+
strokeLinecap: "round",
|
|
2715
|
+
strokeLinejoin: "round",
|
|
2716
|
+
strokeWidth: 2,
|
|
2717
|
+
d: "M15.172 7l-6.586 6.586a2 2 0 102.828 2.828l6.414-6.586a4 4 0 00-5.656-5.656l-6.415 6.585a6 6 0 108.486 8.486L20.5 13"
|
|
2718
|
+
}
|
|
2719
|
+
)
|
|
2720
|
+
}
|
|
2721
|
+
)
|
|
2722
|
+
),
|
|
2723
|
+
f ? /* @__PURE__ */ i("span", { className: "text-purple-200 font-mono", title: u.filename, children: [
|
|
2724
|
+
"[Pasted text #",
|
|
2725
|
+
I.number,
|
|
2726
|
+
" +",
|
|
2727
|
+
I.lineCount,
|
|
2728
|
+
" lines]"
|
|
2729
|
+
] }) : /* @__PURE__ */ i(_, { children: [
|
|
2730
|
+
/* @__PURE__ */ t("span", { className: "text-white/80 truncate max-w-[150px]", title: u.filename, children: u.filename }),
|
|
2731
|
+
/* @__PURE__ */ t("span", { className: "text-white/40 text-xs", children: Ve(u.size) })
|
|
2732
|
+
] }),
|
|
2733
|
+
/* @__PURE__ */ t(
|
|
2734
|
+
"button",
|
|
2735
|
+
{
|
|
2736
|
+
onClick: () => G(b),
|
|
2737
|
+
className: `hover:text-red-400 transition-colors ${f ? "text-purple-400/70" : "text-white/40"}`,
|
|
2738
|
+
title: "Remove file",
|
|
2739
|
+
children: /* @__PURE__ */ t(
|
|
2740
|
+
"svg",
|
|
2741
|
+
{
|
|
2742
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2743
|
+
className: "h-4 w-4",
|
|
2744
|
+
viewBox: "0 0 20 20",
|
|
2745
|
+
fill: "currentColor",
|
|
2746
|
+
children: /* @__PURE__ */ t(
|
|
2747
|
+
"path",
|
|
2748
|
+
{
|
|
2749
|
+
fillRule: "evenodd",
|
|
2750
|
+
d: "M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",
|
|
2751
|
+
clipRule: "evenodd"
|
|
2752
|
+
}
|
|
2753
|
+
)
|
|
2754
|
+
}
|
|
2755
|
+
)
|
|
2756
|
+
}
|
|
2757
|
+
)
|
|
2758
|
+
]
|
|
2759
|
+
},
|
|
2760
|
+
`${u.filename}-${b}`
|
|
2761
|
+
);
|
|
2762
|
+
}) })
|
|
2763
|
+
] }),
|
|
2764
|
+
J && /* @__PURE__ */ i("div", { className: "mb-3 space-y-2", children: [
|
|
2765
|
+
/* @__PURE__ */ i("div", { className: "text-xs font-medium text-white/50 uppercase tracking-wide", children: [
|
|
2766
|
+
"Queued Messages (",
|
|
2767
|
+
a.length,
|
|
2768
|
+
")"
|
|
2769
|
+
] }),
|
|
2770
|
+
/* @__PURE__ */ t("div", { className: "max-h-32 overflow-y-auto space-y-1", children: a.map((u, b) => /* @__PURE__ */ i(
|
|
2771
|
+
"div",
|
|
2772
|
+
{
|
|
2773
|
+
className: "flex items-center justify-between bg-yellow-500/10 border border-yellow-500/20 rounded-xl px-3 py-2 text-sm",
|
|
2774
|
+
children: [
|
|
2775
|
+
/* @__PURE__ */ i("div", { className: "flex items-center gap-2 flex-1 min-w-0", children: [
|
|
2776
|
+
/* @__PURE__ */ i("span", { className: "text-yellow-400 font-medium shrink-0", children: [
|
|
2777
|
+
"#",
|
|
2778
|
+
b + 1
|
|
2779
|
+
] }),
|
|
2780
|
+
/* @__PURE__ */ t("span", { className: "text-white/80 truncate", children: u.text })
|
|
2781
|
+
] }),
|
|
2782
|
+
l && /* @__PURE__ */ t(
|
|
2783
|
+
"button",
|
|
2784
|
+
{
|
|
2785
|
+
onClick: () => l(u.id),
|
|
2786
|
+
className: "ml-2 text-yellow-400/70 hover:text-red-400 transition-colors shrink-0",
|
|
2787
|
+
title: "Cancel queued message",
|
|
2788
|
+
children: /* @__PURE__ */ t(
|
|
2789
|
+
"svg",
|
|
2790
|
+
{
|
|
2791
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2792
|
+
className: "h-4 w-4",
|
|
2793
|
+
viewBox: "0 0 20 20",
|
|
2794
|
+
fill: "currentColor",
|
|
2795
|
+
children: /* @__PURE__ */ t(
|
|
2796
|
+
"path",
|
|
2797
|
+
{
|
|
2798
|
+
fillRule: "evenodd",
|
|
2799
|
+
d: "M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",
|
|
2800
|
+
clipRule: "evenodd"
|
|
2801
|
+
}
|
|
2802
|
+
)
|
|
2803
|
+
}
|
|
2804
|
+
)
|
|
2805
|
+
}
|
|
2806
|
+
)
|
|
2807
|
+
]
|
|
2808
|
+
},
|
|
2809
|
+
u.id
|
|
2810
|
+
)) })
|
|
2811
|
+
] }),
|
|
2812
|
+
/* @__PURE__ */ i("div", { className: "flex gap-2 items-end", children: [
|
|
2813
|
+
d && /* @__PURE__ */ i(_, { children: [
|
|
2814
|
+
/* @__PURE__ */ t(
|
|
2815
|
+
"input",
|
|
2816
|
+
{
|
|
2817
|
+
ref: fe,
|
|
2818
|
+
type: "file",
|
|
2819
|
+
multiple: !0,
|
|
2820
|
+
onChange: te,
|
|
2821
|
+
className: "hidden",
|
|
2822
|
+
disabled: n || R.length >= g
|
|
2823
|
+
}
|
|
2824
|
+
),
|
|
2825
|
+
/* @__PURE__ */ t(
|
|
2826
|
+
"button",
|
|
2827
|
+
{
|
|
2828
|
+
type: "button",
|
|
2829
|
+
onClick: () => {
|
|
2830
|
+
var u;
|
|
2831
|
+
return (u = fe.current) == null ? void 0 : u.click();
|
|
2832
|
+
},
|
|
2833
|
+
disabled: n || R.length >= g,
|
|
2834
|
+
className: "shrink-0 p-2 sm:px-3 sm:py-2 text-white/50 hover:text-[#ccff00] hover:bg-white/5 rounded-xl transition-all duration-300 disabled:opacity-50 disabled:cursor-not-allowed",
|
|
2835
|
+
title: R.length >= g ? `Maximum ${g} files` : "Attach files",
|
|
2836
|
+
children: /* @__PURE__ */ t(
|
|
2837
|
+
"svg",
|
|
2838
|
+
{
|
|
2839
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2840
|
+
className: "h-5 w-5",
|
|
2841
|
+
fill: "none",
|
|
2842
|
+
viewBox: "0 0 24 24",
|
|
2843
|
+
stroke: "currentColor",
|
|
2844
|
+
children: /* @__PURE__ */ t(
|
|
2845
|
+
"path",
|
|
2846
|
+
{
|
|
2847
|
+
strokeLinecap: "round",
|
|
2848
|
+
strokeLinejoin: "round",
|
|
2849
|
+
strokeWidth: 2,
|
|
2850
|
+
d: "M15.172 7l-6.586 6.586a2 2 0 102.828 2.828l6.414-6.586a4 4 0 00-5.656-5.656l-6.415 6.585a6 6 0 108.486 8.486L20.5 13"
|
|
2851
|
+
}
|
|
2852
|
+
)
|
|
2853
|
+
}
|
|
2854
|
+
)
|
|
2855
|
+
}
|
|
2856
|
+
)
|
|
2857
|
+
] }),
|
|
2858
|
+
/* @__PURE__ */ t(
|
|
2859
|
+
"textarea",
|
|
2860
|
+
{
|
|
2861
|
+
ref: oe,
|
|
2862
|
+
value: k,
|
|
2863
|
+
onChange: (u) => A(u.target.value),
|
|
2864
|
+
onKeyDown: y,
|
|
2865
|
+
onInput: T,
|
|
2866
|
+
onPaste: q,
|
|
2867
|
+
placeholder: s,
|
|
2868
|
+
disabled: n,
|
|
2869
|
+
className: "input-glass flex-1 min-w-0 resize-none py-2.5 disabled:opacity-50 disabled:cursor-not-allowed",
|
|
2870
|
+
rows: 1
|
|
2871
|
+
}
|
|
2872
|
+
),
|
|
2873
|
+
r && S && v ? /* @__PURE__ */ i(
|
|
2874
|
+
"button",
|
|
2875
|
+
{
|
|
2876
|
+
onClick: v,
|
|
2877
|
+
className: "shrink-0 px-3 sm:px-4 py-2.5 bg-red-500/80 hover:bg-red-500 text-white rounded-xl transition-all duration-300 flex items-center gap-1 sm:gap-2 border border-red-400/30",
|
|
2878
|
+
title: "Stop generation",
|
|
2879
|
+
children: [
|
|
2880
|
+
/* @__PURE__ */ t("svg", { xmlns: "http://www.w3.org/2000/svg", className: "h-4 w-4", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ t("path", { fillRule: "evenodd", d: "M10 18a8 8 0 100-16 8 8 0 000 16zM8 7a1 1 0 00-1 1v4a1 1 0 001 1h4a1 1 0 001-1V8a1 1 0 00-1-1H8z", clipRule: "evenodd" }) }),
|
|
2881
|
+
/* @__PURE__ */ t("span", { className: "hidden sm:inline", children: "Stop" })
|
|
2882
|
+
]
|
|
2883
|
+
}
|
|
2884
|
+
) : /* @__PURE__ */ i(
|
|
2885
|
+
"button",
|
|
2886
|
+
{
|
|
2887
|
+
onClick: x,
|
|
2888
|
+
disabled: !Ie,
|
|
2889
|
+
className: `shrink-0 px-3 sm:px-5 py-2.5 rounded-xl font-medium transition-all duration-300 disabled:opacity-30 disabled:cursor-not-allowed ${J ? "bg-yellow-500/80 hover:bg-yellow-500 text-black border border-yellow-400/30" : "bg-[#ccff00] hover:bg-[#b8e600] text-black shadow-[0_0_20px_rgba(204,255,0,0.3)] hover:shadow-[0_0_30px_rgba(204,255,0,0.5)]"}`,
|
|
2890
|
+
children: [
|
|
2891
|
+
/* @__PURE__ */ t("span", { className: "hidden sm:inline", children: Ne }),
|
|
2892
|
+
/* @__PURE__ */ t("span", { className: "sm:hidden", children: r ? "..." : J ? `+${a.length}` : "→" })
|
|
2893
|
+
]
|
|
2894
|
+
}
|
|
2895
|
+
)
|
|
2896
|
+
] }),
|
|
2897
|
+
/* @__PURE__ */ i("div", { className: "text-xs text-white/40 mt-2 hidden sm:block", children: [
|
|
2898
|
+
"Press Enter to ",
|
|
2899
|
+
r || J ? "queue" : "send",
|
|
2900
|
+
", Shift+Enter for new line",
|
|
2901
|
+
d && " • Drag & drop files or click the attach button",
|
|
2902
|
+
z && d && ` • Long text (>${M.toLocaleString()} chars) auto-converts to attachment`
|
|
2903
|
+
] })
|
|
2904
|
+
]
|
|
2905
|
+
}
|
|
2906
|
+
);
|
|
2907
|
+
}
|
|
2908
|
+
function $r({
|
|
2909
|
+
apiBasePath: e,
|
|
2910
|
+
initialAgent: n,
|
|
2911
|
+
initialSessionId: r,
|
|
2912
|
+
onSessionChange: s,
|
|
2913
|
+
className: a = "",
|
|
2914
|
+
useBackendQueue: l = !1
|
|
2915
|
+
}) {
|
|
2916
|
+
const [c, h] = N([]), [o, w] = N(n || null), [d, m] = N(r || null), [g, v] = N([]), [S, z] = N(!1), [M, k] = N(""), [A, E] = N(null), [W, F] = N([]), [P, ue] = N([]), [ie, ye] = N(""), [ae, R] = N({}), K = O(!1), he = O(ie), le = O(ae), Z = O(null);
|
|
2917
|
+
j(() => {
|
|
2918
|
+
he.current = ie;
|
|
2919
|
+
}, [ie]), j(() => {
|
|
2920
|
+
le.current = ae;
|
|
2921
|
+
}, [ae]), j(() => {
|
|
2922
|
+
fetch(`${e}/agents`).then((x) => x.json()).then((x) => {
|
|
2923
|
+
const y = x.agents || [];
|
|
2924
|
+
h(y), !o && y.length > 0 && w(y[0].slug || y[0].name);
|
|
2925
|
+
}).catch((x) => {
|
|
2926
|
+
console.error("Failed to fetch agents:", x), E("Failed to load agents");
|
|
2927
|
+
});
|
|
2928
|
+
}, [e]), j(() => {
|
|
2929
|
+
d && me(d);
|
|
2930
|
+
}, [d]);
|
|
2931
|
+
const Y = B(async () => {
|
|
2932
|
+
if (!(!l || !o))
|
|
2933
|
+
try {
|
|
2934
|
+
const x = await fetch(
|
|
2935
|
+
`${e}/queue/status/${o}?sessionId=${d || ""}`
|
|
2936
|
+
);
|
|
2937
|
+
if (!x.ok) return;
|
|
2938
|
+
const y = await x.json();
|
|
2939
|
+
z(y.isProcessing), ue(y.nextItems || []), !y.isProcessing && S && (d && await me(d), k(""));
|
|
2940
|
+
} catch (x) {
|
|
2941
|
+
console.error("Failed to fetch queue status:", x);
|
|
2942
|
+
}
|
|
2943
|
+
}, [l, o, d, e, S]);
|
|
2944
|
+
j(() => {
|
|
2945
|
+
if (l)
|
|
2946
|
+
return Z.current = setInterval(Y, 1e3), () => {
|
|
2947
|
+
Z.current && (clearInterval(Z.current), Z.current = null);
|
|
2948
|
+
};
|
|
2949
|
+
}, [l, Y]), j(() => {
|
|
2950
|
+
s == null || s(d);
|
|
2951
|
+
}, [d, s]);
|
|
2952
|
+
const me = async (x) => {
|
|
2953
|
+
try {
|
|
2954
|
+
const y = await fetch(`${e}/sessions/${x}/messages`);
|
|
2955
|
+
if (!y.ok) throw new Error("Failed to fetch messages");
|
|
2956
|
+
const T = await y.json();
|
|
2957
|
+
v(T.items || T.messages || []);
|
|
2958
|
+
} catch (y) {
|
|
2959
|
+
E(y instanceof Error ? y.message : "Failed to fetch messages");
|
|
2960
|
+
}
|
|
2961
|
+
}, pe = B(async (x, y, T) => {
|
|
2962
|
+
var te, ce;
|
|
2963
|
+
if (!o) return y;
|
|
2964
|
+
z(!0), E(null), k("");
|
|
2965
|
+
const D = {
|
|
2966
|
+
id: `temp-${Date.now()}`,
|
|
2967
|
+
role: "user",
|
|
2968
|
+
content: [{ type: "text", text: x }],
|
|
2969
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
2970
|
+
};
|
|
2971
|
+
v((V) => [...V, D]);
|
|
2972
|
+
let Q = y;
|
|
2973
|
+
try {
|
|
2974
|
+
const V = y ? `${e}/sessions/${y}/send` : `${e}/agents/${o}/run`, H = T == null ? void 0 : T.map((ne) => ({
|
|
2975
|
+
filename: ne.filename,
|
|
2976
|
+
content: ne.content,
|
|
2977
|
+
mimeType: ne.mimeType
|
|
2978
|
+
})), G = { prompt: x }, J = he.current.trim();
|
|
2979
|
+
J && (G.sessionContext = J);
|
|
2980
|
+
const Ne = le.current;
|
|
2981
|
+
!y && Object.keys(Ne).length > 0 && (G.envVars = Ne), H && H.length > 0 && (G.files = H);
|
|
2982
|
+
const ke = await fetch(V, {
|
|
2983
|
+
method: "POST",
|
|
2984
|
+
headers: { "Content-Type": "application/json" },
|
|
2985
|
+
body: JSON.stringify(G)
|
|
2986
|
+
});
|
|
2987
|
+
if (!ke.ok) throw new Error("Failed to send message");
|
|
2988
|
+
const Ce = (te = ke.body) == null ? void 0 : te.getReader(), Ie = new TextDecoder();
|
|
2989
|
+
let xe = "", U = "";
|
|
2990
|
+
for (; Ce; ) {
|
|
2991
|
+
const { done: ne, value: Fe } = await Ce.read();
|
|
2992
|
+
if (ne) break;
|
|
2993
|
+
xe += Ie.decode(Fe, { stream: !0 });
|
|
2994
|
+
const u = xe.split(`
|
|
2995
|
+
`);
|
|
2996
|
+
xe = u.pop() || "";
|
|
2997
|
+
for (const b of u)
|
|
2998
|
+
if (b.startsWith("data:")) {
|
|
2999
|
+
const I = b.slice(5).trim();
|
|
3000
|
+
if (!I) continue;
|
|
3001
|
+
try {
|
|
3002
|
+
const f = JSON.parse(I);
|
|
3003
|
+
if (f.type === "session_start" && f.sessionId)
|
|
3004
|
+
Q = f.sessionId, m(f.sessionId);
|
|
3005
|
+
else if (f.type === "text_delta" && f.delta)
|
|
3006
|
+
U += f.delta, k(U);
|
|
3007
|
+
else if (f.type === "thinking_delta" && f.delta)
|
|
3008
|
+
U += f.delta, k(U);
|
|
3009
|
+
else if (f.type === "message" && f.message) {
|
|
3010
|
+
const C = (ce = f.message.content) == null ? void 0 : ce.find(
|
|
3011
|
+
(X) => X.type === "text"
|
|
3012
|
+
);
|
|
3013
|
+
C != null && C.text && (U || (U = C.text, k(U)));
|
|
3014
|
+
} else if (f.type === "tool_use")
|
|
3015
|
+
U += `
|
|
3016
|
+
|
|
3017
|
+
🔧 Using tool: ${f.name}
|
|
3018
|
+
`, k(U);
|
|
3019
|
+
else if (f.type === "session_end") {
|
|
3020
|
+
const C = y || f.sessionId;
|
|
3021
|
+
C && await me(C), k("");
|
|
3022
|
+
} else f.type === "error" && E(f.error || "Unknown error");
|
|
3023
|
+
} catch {
|
|
3024
|
+
}
|
|
3025
|
+
}
|
|
3026
|
+
}
|
|
3027
|
+
} catch (V) {
|
|
3028
|
+
E(V instanceof Error ? V.message : "Unknown error"), v((H) => H.filter((G) => G.id !== D.id));
|
|
3029
|
+
} finally {
|
|
3030
|
+
z(!1);
|
|
3031
|
+
}
|
|
3032
|
+
return Q;
|
|
3033
|
+
}, [e, o]), ge = B(async () => {
|
|
3034
|
+
if (K.current) return;
|
|
3035
|
+
K.current = !0;
|
|
3036
|
+
let x = d;
|
|
3037
|
+
for (; ; ) {
|
|
3038
|
+
let y;
|
|
3039
|
+
if (F((T) => T.length === 0 ? T : (y = T[0], T.slice(1))), await new Promise((T) => setTimeout(T, 0)), !y) break;
|
|
3040
|
+
x = await pe(y.text, x, y.files);
|
|
3041
|
+
}
|
|
3042
|
+
K.current = !1;
|
|
3043
|
+
}, [d, pe]);
|
|
3044
|
+
j(() => {
|
|
3045
|
+
W.length > 0 && !K.current && ge();
|
|
3046
|
+
}, [W, ge]);
|
|
3047
|
+
const oe = B(async (x, y) => {
|
|
3048
|
+
if (!o) return;
|
|
3049
|
+
const T = {
|
|
3050
|
+
id: `temp-${Date.now()}`,
|
|
3051
|
+
role: "user",
|
|
3052
|
+
content: [{ type: "text", text: x }],
|
|
3053
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
3054
|
+
};
|
|
3055
|
+
v((D) => [...D, T]);
|
|
3056
|
+
try {
|
|
3057
|
+
const D = y == null ? void 0 : y.map((H) => ({
|
|
3058
|
+
filename: H.filename,
|
|
3059
|
+
content: H.content,
|
|
3060
|
+
mimeType: H.mimeType
|
|
3061
|
+
})), Q = le.current, te = !d && Object.keys(Q).length > 0 ? Q : void 0, ce = await fetch(`${e}/queue`, {
|
|
3062
|
+
method: "POST",
|
|
3063
|
+
headers: { "Content-Type": "application/json" },
|
|
3064
|
+
body: JSON.stringify({
|
|
3065
|
+
agentName: o,
|
|
3066
|
+
sessionId: d,
|
|
3067
|
+
prompt: x,
|
|
3068
|
+
files: D,
|
|
3069
|
+
sessionContext: he.current.trim() || void 0,
|
|
3070
|
+
envVars: te
|
|
3071
|
+
})
|
|
3072
|
+
});
|
|
3073
|
+
if (!ce.ok)
|
|
3074
|
+
throw new Error("Failed to queue message");
|
|
3075
|
+
const V = await ce.json();
|
|
3076
|
+
!d && V.id && setTimeout(async () => {
|
|
3077
|
+
const G = await fetch(`${e}/queue/${V.id}`);
|
|
3078
|
+
if (G.ok) {
|
|
3079
|
+
const J = await G.json();
|
|
3080
|
+
J.sessionId && m(J.sessionId);
|
|
3081
|
+
}
|
|
3082
|
+
}, 500), await Y();
|
|
3083
|
+
} catch (D) {
|
|
3084
|
+
E(D instanceof Error ? D.message : "Failed to queue message"), v((Q) => Q.filter((te) => te.id !== T.id));
|
|
3085
|
+
}
|
|
3086
|
+
}, [o, d, e, Y]), be = B((x, y) => {
|
|
3087
|
+
if (!o) return;
|
|
3088
|
+
if (l) {
|
|
3089
|
+
oe(x, y);
|
|
3090
|
+
return;
|
|
3091
|
+
}
|
|
3092
|
+
const T = {
|
|
3093
|
+
id: `queue-${Date.now()}-${Math.random().toString(36).slice(2)}`,
|
|
3094
|
+
text: x,
|
|
3095
|
+
files: y
|
|
3096
|
+
};
|
|
3097
|
+
S || K.current ? F((D) => [...D, T]) : F([T]);
|
|
3098
|
+
}, [o, S, l, oe]), fe = B(async (x) => {
|
|
3099
|
+
if (l) {
|
|
3100
|
+
try {
|
|
3101
|
+
await fetch(`${e}/queue/${x}/cancel`, {
|
|
3102
|
+
method: "POST"
|
|
3103
|
+
}), await Y();
|
|
3104
|
+
} catch (y) {
|
|
3105
|
+
console.error("Failed to cancel queue item:", y);
|
|
3106
|
+
}
|
|
3107
|
+
return;
|
|
3108
|
+
}
|
|
3109
|
+
F((y) => y.filter((T) => T.id !== x));
|
|
3110
|
+
}, [l, e, Y]), we = B(() => {
|
|
3111
|
+
m(null), v([]), k(""), E(null), ue([]), F([]);
|
|
3112
|
+
}, []), q = c.find(
|
|
3113
|
+
(x) => x.slug === o || x.name === o
|
|
3114
|
+
);
|
|
3115
|
+
return /* @__PURE__ */ i("div", { className: `harness-playground flex flex-col h-full bg-[#0a0a0a] relative overflow-hidden ${a}`, children: [
|
|
3116
|
+
/* @__PURE__ */ t("div", { className: "ambient-glow ambient-glow-accent w-[40vw] h-[40vw] -top-[20%] -right-[10%] animate-pulse-slow" }),
|
|
3117
|
+
/* @__PURE__ */ t("div", { className: "ambient-glow ambient-glow-green w-[30vw] h-[30vw] bottom-[10%] -left-[10%] animate-pulse-slow" }),
|
|
3118
|
+
/* @__PURE__ */ t("div", { className: "fixed inset-0 grid-pattern pointer-events-none z-0" }),
|
|
3119
|
+
/* @__PURE__ */ t("div", { className: "fixed inset-0 noise-overlay pointer-events-none z-0" }),
|
|
3120
|
+
/* @__PURE__ */ i("div", { className: "sticky top-0 flex items-center justify-between p-4 border-b border-white/10 glass-panel relative z-10", children: [
|
|
3121
|
+
/* @__PURE__ */ i("div", { children: [
|
|
3122
|
+
/* @__PURE__ */ t("h1", { className: "text-xl font-semibold text-white", children: "Playground" }),
|
|
3123
|
+
q && /* @__PURE__ */ t("p", { className: "text-sm text-white/50 mt-0.5", children: q.description || `Chat with ${q.name}` })
|
|
3124
|
+
] }),
|
|
3125
|
+
/* @__PURE__ */ i("div", { className: "flex items-center gap-3", children: [
|
|
3126
|
+
/* @__PURE__ */ i(
|
|
3127
|
+
"select",
|
|
3128
|
+
{
|
|
3129
|
+
value: o || "",
|
|
3130
|
+
onChange: (x) => {
|
|
3131
|
+
w(x.target.value), we();
|
|
3132
|
+
},
|
|
3133
|
+
className: "px-4 py-2.5 rounded-xl text-sm bg-white/5 border border-white/10 text-white focus:outline-none focus:border-[#ccff00]/50 transition-all duration-300",
|
|
3134
|
+
children: [
|
|
3135
|
+
c.length === 0 && /* @__PURE__ */ t("option", { value: "", children: "No agents" }),
|
|
3136
|
+
c.map((x) => /* @__PURE__ */ t("option", { value: x.slug || x.name, className: "bg-[#0a0a0a]", children: x.name }, x.slug || x.name))
|
|
3137
|
+
]
|
|
3138
|
+
}
|
|
3139
|
+
),
|
|
3140
|
+
/* @__PURE__ */ t(
|
|
3141
|
+
"button",
|
|
3142
|
+
{
|
|
3143
|
+
onClick: we,
|
|
3144
|
+
className: "px-4 py-2.5 text-sm text-white/70 hover:text-white border border-white/10 rounded-xl hover:bg-white/10 hover:border-white/20 transition-all duration-300",
|
|
3145
|
+
children: "New Chat"
|
|
3146
|
+
}
|
|
3147
|
+
)
|
|
3148
|
+
] })
|
|
3149
|
+
] }),
|
|
3150
|
+
A && /* @__PURE__ */ i("div", { className: "bg-red-500/10 border-b border-red-500/20 px-4 py-3 text-red-400 text-sm flex items-center justify-between relative z-10", children: [
|
|
3151
|
+
/* @__PURE__ */ t("span", { children: A }),
|
|
3152
|
+
/* @__PURE__ */ t(
|
|
3153
|
+
"button",
|
|
3154
|
+
{
|
|
3155
|
+
onClick: () => E(null),
|
|
3156
|
+
className: "text-red-400/70 hover:text-red-400 transition-colors",
|
|
3157
|
+
children: /* @__PURE__ */ t("svg", { className: "w-4 h-4", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 18L18 6M6 6l12 12" }) })
|
|
3158
|
+
}
|
|
3159
|
+
)
|
|
3160
|
+
] }),
|
|
3161
|
+
/* @__PURE__ */ t("div", { className: "flex-1 overflow-hidden relative z-10", children: g.length === 0 && !M ? /* @__PURE__ */ t("div", { className: "h-full flex items-center justify-center", children: /* @__PURE__ */ i("div", { className: "text-center animate-fade-in", children: [
|
|
3162
|
+
/* @__PURE__ */ t("div", { className: "w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#ccff00]/10 border border-[#ccff00]/20 flex items-center justify-center", children: /* @__PURE__ */ t("svg", { className: "w-8 h-8 text-[#ccff00]", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M8.625 12a.375.375 0 1 1-.75 0 .375.375 0 0 1 .75 0Zm0 0H8.25m4.125 0a.375.375 0 1 1-.75 0 .375.375 0 0 1 .75 0Zm0 0H12m4.125 0a.375.375 0 1 1-.75 0 .375.375 0 0 1 .75 0Zm0 0h-.375M21 12c0 4.556-4.03 8.25-9 8.25a9.764 9.764 0 0 1-2.555-.337A5.972 5.972 0 0 1 5.41 20.97a5.969 5.969 0 0 1-.474-.065 4.48 4.48 0 0 0 .978-2.025c.09-.457-.133-.901-.467-1.226C3.93 16.178 3 14.189 3 12c0-4.556 4.03-8.25 9-8.25s9 3.694 9 8.25Z" }) }) }),
|
|
3163
|
+
/* @__PURE__ */ t("p", { className: "text-lg text-white/80", children: "Start a conversation" }),
|
|
3164
|
+
/* @__PURE__ */ t("p", { className: "text-sm mt-1 text-white/40", children: o ? `Chat with ${(q == null ? void 0 : q.name) || o}` : "Select an agent to begin" })
|
|
3165
|
+
] }) }) : /* @__PURE__ */ t(
|
|
3166
|
+
Wn,
|
|
3167
|
+
{
|
|
3168
|
+
messages: g,
|
|
3169
|
+
loading: S,
|
|
3170
|
+
streamingContent: M
|
|
3171
|
+
}
|
|
3172
|
+
) }),
|
|
3173
|
+
/* @__PURE__ */ t("div", { className: "relative z-10", children: /* @__PURE__ */ t(
|
|
3174
|
+
Fn,
|
|
3175
|
+
{
|
|
3176
|
+
onSend: be,
|
|
3177
|
+
disabled: !o,
|
|
3178
|
+
loading: S,
|
|
3179
|
+
queue: l ? P.map((x) => ({ id: x.id, text: x.prompt })) : W,
|
|
3180
|
+
onCancelQueued: fe,
|
|
3181
|
+
sessionContext: ie,
|
|
3182
|
+
onSessionContextChange: ye,
|
|
3183
|
+
envVars: ae,
|
|
3184
|
+
onEnvVarsChange: R,
|
|
3185
|
+
placeholder: o ? `Message ${(q == null ? void 0 : q.name) || o}...` : "Select an agent to start chatting"
|
|
3186
|
+
}
|
|
3187
|
+
) }),
|
|
3188
|
+
d && /* @__PURE__ */ i("div", { className: "px-4 py-2 border-t border-white/10 text-xs text-white/40 glass-panel relative z-10 flex items-center gap-2", children: [
|
|
3189
|
+
/* @__PURE__ */ t("span", { className: "w-1.5 h-1.5 rounded-full bg-[#ccff00]" }),
|
|
3190
|
+
/* @__PURE__ */ i("span", { className: "font-mono", children: [
|
|
3191
|
+
"Session: ",
|
|
3192
|
+
d.slice(0, 8),
|
|
3193
|
+
"..."
|
|
3194
|
+
] })
|
|
3195
|
+
] })
|
|
3196
|
+
] });
|
|
3197
|
+
}
|
|
3198
|
+
function Ar({
|
|
3199
|
+
entries: e,
|
|
3200
|
+
loading: n,
|
|
3201
|
+
streamingContent: r,
|
|
3202
|
+
displayConfig: s,
|
|
3203
|
+
onOptionSelect: a
|
|
3204
|
+
}) {
|
|
3205
|
+
return /* @__PURE__ */ t(
|
|
3206
|
+
Mn,
|
|
3207
|
+
{
|
|
3208
|
+
entries: e,
|
|
3209
|
+
loading: n,
|
|
3210
|
+
streamingContent: r,
|
|
3211
|
+
displayConfig: s,
|
|
3212
|
+
onOptionSelect: a
|
|
3213
|
+
}
|
|
3214
|
+
);
|
|
3215
|
+
}
|
|
3216
|
+
function Rr({ logs: e, isLoading: n, className: r }) {
|
|
3217
|
+
return /* @__PURE__ */ t(
|
|
3218
|
+
Rn,
|
|
3219
|
+
{
|
|
3220
|
+
logs: e,
|
|
3221
|
+
title: "Sandbox Logs",
|
|
3222
|
+
isLoading: n,
|
|
3223
|
+
className: r
|
|
3224
|
+
}
|
|
3225
|
+
);
|
|
3226
|
+
}
|
|
3227
|
+
function Pn(e) {
|
|
3228
|
+
if (e.startsWith("mcp__")) {
|
|
3229
|
+
const n = e.split("__");
|
|
3230
|
+
if (n.length >= 3)
|
|
3231
|
+
return `mcp:${n[1]}:${n.slice(2).join(":")}`;
|
|
3232
|
+
}
|
|
3233
|
+
return e;
|
|
3234
|
+
}
|
|
3235
|
+
function Hn(e) {
|
|
3236
|
+
if (e.startsWith("mcp__")) {
|
|
3237
|
+
const n = e.split("__");
|
|
3238
|
+
if (n.length >= 3 && n[1] !== void 0)
|
|
3239
|
+
return {
|
|
3240
|
+
serverName: n[1],
|
|
3241
|
+
toolName: n.slice(2).join("__")
|
|
3242
|
+
};
|
|
3243
|
+
}
|
|
3244
|
+
return null;
|
|
3245
|
+
}
|
|
3246
|
+
function qn(e, n) {
|
|
3247
|
+
const r = n || {};
|
|
3248
|
+
switch (e) {
|
|
3249
|
+
case "Bash":
|
|
3250
|
+
return {
|
|
3251
|
+
action: "command_run",
|
|
3252
|
+
command: r.command || "",
|
|
3253
|
+
description: r.description
|
|
3254
|
+
};
|
|
3255
|
+
case "Read":
|
|
3256
|
+
return {
|
|
3257
|
+
action: "file_read",
|
|
3258
|
+
path: r.file_path || "",
|
|
3259
|
+
offset: r.offset,
|
|
3260
|
+
limit: r.limit
|
|
3261
|
+
};
|
|
3262
|
+
case "Edit":
|
|
3263
|
+
return {
|
|
3264
|
+
action: "file_edit",
|
|
3265
|
+
path: r.file_path || "",
|
|
3266
|
+
oldString: r.old_string,
|
|
3267
|
+
newString: r.new_string,
|
|
3268
|
+
replaceAll: r.replace_all
|
|
3269
|
+
};
|
|
3270
|
+
case "Write":
|
|
3271
|
+
return {
|
|
3272
|
+
action: "file_write",
|
|
3273
|
+
path: r.file_path || "",
|
|
3274
|
+
content: r.content
|
|
3275
|
+
};
|
|
3276
|
+
case "Grep":
|
|
3277
|
+
return {
|
|
3278
|
+
action: "search",
|
|
3279
|
+
pattern: r.pattern || "",
|
|
3280
|
+
path: r.path,
|
|
3281
|
+
glob: r.glob,
|
|
3282
|
+
type: r.type
|
|
3283
|
+
};
|
|
3284
|
+
case "Glob":
|
|
3285
|
+
return {
|
|
3286
|
+
action: "glob",
|
|
3287
|
+
pattern: r.pattern || "",
|
|
3288
|
+
path: r.path
|
|
3289
|
+
};
|
|
3290
|
+
case "WebFetch":
|
|
3291
|
+
return {
|
|
3292
|
+
action: "web_fetch",
|
|
3293
|
+
url: r.url || "",
|
|
3294
|
+
prompt: r.prompt
|
|
3295
|
+
};
|
|
3296
|
+
case "WebSearch":
|
|
3297
|
+
return {
|
|
3298
|
+
action: "web_search",
|
|
3299
|
+
query: r.query || ""
|
|
3300
|
+
};
|
|
3301
|
+
case "TodoWrite": {
|
|
3302
|
+
const s = r.todos || [], a = {
|
|
3303
|
+
total: s.length,
|
|
3304
|
+
completed: s.filter((l) => l.status === "completed").length,
|
|
3305
|
+
inProgress: s.filter((l) => l.status === "in_progress").length,
|
|
3306
|
+
pending: s.filter((l) => l.status === "pending").length
|
|
3307
|
+
};
|
|
3308
|
+
return {
|
|
3309
|
+
action: "todo_write",
|
|
3310
|
+
todos: s,
|
|
3311
|
+
stats: a
|
|
3312
|
+
};
|
|
3313
|
+
}
|
|
3314
|
+
default: {
|
|
3315
|
+
const s = Hn(e);
|
|
3316
|
+
return s ? {
|
|
3317
|
+
action: "mcp_tool",
|
|
3318
|
+
serverName: s.serverName,
|
|
3319
|
+
toolName: s.toolName,
|
|
3320
|
+
arguments: n
|
|
3321
|
+
} : {
|
|
3322
|
+
action: "generic_tool",
|
|
3323
|
+
toolName: Pn(e),
|
|
3324
|
+
arguments: n
|
|
3325
|
+
};
|
|
3326
|
+
}
|
|
3327
|
+
}
|
|
3328
|
+
}
|
|
3329
|
+
function Vn(e, n, r) {
|
|
3330
|
+
switch (r.action) {
|
|
3331
|
+
case "command_run":
|
|
3332
|
+
const s = r.command;
|
|
3333
|
+
return s.length > 60 ? s.substring(0, 57) + "..." : s;
|
|
3334
|
+
case "file_read":
|
|
3335
|
+
return r.path;
|
|
3336
|
+
case "file_edit":
|
|
3337
|
+
return r.path;
|
|
3338
|
+
case "file_write":
|
|
3339
|
+
return r.path;
|
|
3340
|
+
case "search":
|
|
3341
|
+
return `${r.pattern}${r.path ? ` in ${r.path}` : ""}`;
|
|
3342
|
+
case "glob":
|
|
3343
|
+
return r.pattern;
|
|
3344
|
+
case "web_fetch":
|
|
3345
|
+
return r.url;
|
|
3346
|
+
case "web_search":
|
|
3347
|
+
return r.query;
|
|
3348
|
+
case "mcp_tool":
|
|
3349
|
+
return `${r.serverName}:${r.toolName}`;
|
|
3350
|
+
case "generic_tool":
|
|
3351
|
+
return r.toolName;
|
|
3352
|
+
case "todo_write": {
|
|
3353
|
+
const { stats: a } = r;
|
|
3354
|
+
return a ? `${a.completed}/${a.total} completed` : `${r.todos.length} tasks`;
|
|
3355
|
+
}
|
|
3356
|
+
default:
|
|
3357
|
+
return "Unknown tool";
|
|
3358
|
+
}
|
|
3359
|
+
}
|
|
3360
|
+
function Gn(e) {
|
|
3361
|
+
return typeof e == "string" ? e : Array.isArray(e) ? e.filter((n) => typeof (n == null ? void 0 : n.text) == "string").map((n) => n.text).join(`
|
|
3362
|
+
`) : e && typeof e == "object" && "text" in e ? String(e.text) : JSON.stringify(e, null, 2);
|
|
3363
|
+
}
|
|
3364
|
+
function Jn(e) {
|
|
3365
|
+
if (typeof e == "string")
|
|
3366
|
+
try {
|
|
3367
|
+
return { type: "json", value: JSON.parse(e) };
|
|
3368
|
+
} catch {
|
|
3369
|
+
return { type: "markdown", value: e };
|
|
3370
|
+
}
|
|
3371
|
+
if (Array.isArray(e)) {
|
|
3372
|
+
const n = e.filter(
|
|
3373
|
+
(r) => (r == null ? void 0 : r.type) === "text" && typeof r.text == "string"
|
|
3374
|
+
).map((r) => r.text);
|
|
3375
|
+
if (n.length > 0) {
|
|
3376
|
+
const r = n.join(`
|
|
3377
|
+
|
|
3378
|
+
`);
|
|
3379
|
+
try {
|
|
3380
|
+
return { type: "json", value: JSON.parse(r) };
|
|
3381
|
+
} catch {
|
|
3382
|
+
return { type: "markdown", value: r };
|
|
3383
|
+
}
|
|
3384
|
+
}
|
|
3385
|
+
}
|
|
3386
|
+
return { type: "json", value: e };
|
|
3387
|
+
}
|
|
3388
|
+
function Un(e) {
|
|
3389
|
+
const n = Gn(e);
|
|
3390
|
+
if (typeof e == "string")
|
|
3391
|
+
try {
|
|
3392
|
+
const r = JSON.parse(e);
|
|
3393
|
+
if (typeof r.exitCode == "number")
|
|
3394
|
+
return {
|
|
3395
|
+
exitCode: r.exitCode,
|
|
3396
|
+
output: r.output || n,
|
|
3397
|
+
success: r.exitCode === 0
|
|
3398
|
+
};
|
|
3399
|
+
} catch {
|
|
3400
|
+
}
|
|
3401
|
+
return {
|
|
3402
|
+
output: n,
|
|
3403
|
+
success: !0
|
|
3404
|
+
// Assume success if no exit code
|
|
3405
|
+
};
|
|
3406
|
+
}
|
|
3407
|
+
function tt(e) {
|
|
3408
|
+
const n = qn(e.name, e.input), r = Vn(e.name, e.input, n);
|
|
3409
|
+
return {
|
|
3410
|
+
id: e.id,
|
|
3411
|
+
toolName: e.name,
|
|
3412
|
+
actionType: n,
|
|
3413
|
+
status: "pending",
|
|
3414
|
+
summary: r,
|
|
3415
|
+
startedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
3416
|
+
};
|
|
3417
|
+
}
|
|
3418
|
+
function nt(e, n, r) {
|
|
3419
|
+
const s = { ...e }, a = { ...e.actionType };
|
|
3420
|
+
if (s.status = r ? "failed" : "success", s.completedAt = (/* @__PURE__ */ new Date()).toISOString(), s.isError = r, a.action === "command_run") {
|
|
3421
|
+
const l = Un(n);
|
|
3422
|
+
a.result = l, l.exitCode !== void 0 && l.exitCode !== 0 && (s.status = "failed", s.isError = !0);
|
|
3423
|
+
} else (a.action === "mcp_tool" || a.action === "generic_tool") && (a.result = Jn(n));
|
|
3424
|
+
return s.actionType = a, s;
|
|
3425
|
+
}
|
|
3426
|
+
function Kn(e) {
|
|
3427
|
+
return e.type === "tool_use";
|
|
3428
|
+
}
|
|
3429
|
+
function Yn(e) {
|
|
3430
|
+
return e.type === "tool_result";
|
|
3431
|
+
}
|
|
3432
|
+
function Dr(e) {
|
|
3433
|
+
const n = [], r = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map();
|
|
3434
|
+
for (const a of e) {
|
|
3435
|
+
const l = a.createdAt instanceof Date ? a.createdAt.toISOString() : a.createdAt;
|
|
3436
|
+
for (const c of a.content)
|
|
3437
|
+
if (c.type === "text" && "text" in c)
|
|
3438
|
+
n.push({
|
|
3439
|
+
id: `${a.id}-text-${n.length}`,
|
|
3440
|
+
timestamp: l,
|
|
3441
|
+
entryType: {
|
|
3442
|
+
type: a.role === "user" ? "user_message" : "assistant_message"
|
|
3443
|
+
},
|
|
3444
|
+
content: c.text
|
|
3445
|
+
});
|
|
3446
|
+
else if (Kn(c)) {
|
|
3447
|
+
const h = tt(c);
|
|
3448
|
+
r.set(c.id, h);
|
|
3449
|
+
const o = {
|
|
3450
|
+
id: c.id,
|
|
3451
|
+
timestamp: l,
|
|
3452
|
+
entryType: {
|
|
3453
|
+
type: "tool_call",
|
|
3454
|
+
toolCall: h
|
|
3455
|
+
},
|
|
3456
|
+
content: h.summary
|
|
3457
|
+
};
|
|
3458
|
+
n.push(o), s.set(c.id, o);
|
|
3459
|
+
} else if (Yn(c)) {
|
|
3460
|
+
const h = c.toolUseId, o = r.get(h);
|
|
3461
|
+
if (o) {
|
|
3462
|
+
const w = nt(
|
|
3463
|
+
o,
|
|
3464
|
+
c.content,
|
|
3465
|
+
c.isError
|
|
3466
|
+
), d = s.get(h);
|
|
3467
|
+
d && d.entryType.type === "tool_call" && (d.entryType.toolCall = w), r.delete(h);
|
|
3468
|
+
}
|
|
3469
|
+
}
|
|
3470
|
+
}
|
|
3471
|
+
return n;
|
|
3472
|
+
}
|
|
3473
|
+
const Se = class Se {
|
|
3474
|
+
constructor() {
|
|
3475
|
+
ee(this, "entries", []);
|
|
3476
|
+
ee(this, "pendingToolCalls", /* @__PURE__ */ new Map());
|
|
3477
|
+
ee(this, "listeners", /* @__PURE__ */ new Set());
|
|
3478
|
+
ee(this, "currentTextContent", "");
|
|
3479
|
+
ee(this, "currentTextEntryId", null);
|
|
3480
|
+
ee(this, "hadToolCallSinceText", !1);
|
|
3481
|
+
/** Track the last few deltas to detect duplicates (prevents double-processing) */
|
|
3482
|
+
ee(this, "recentDeltas", []);
|
|
3483
|
+
}
|
|
3484
|
+
/**
|
|
3485
|
+
* Subscribe to entry updates.
|
|
3486
|
+
* Returns an unsubscribe function.
|
|
3487
|
+
*/
|
|
3488
|
+
subscribe(n) {
|
|
3489
|
+
return this.listeners.add(n), n([...this.entries]), () => this.listeners.delete(n);
|
|
3490
|
+
}
|
|
3491
|
+
/**
|
|
3492
|
+
* Get current entries (snapshot)
|
|
3493
|
+
*/
|
|
3494
|
+
getEntries() {
|
|
3495
|
+
return [...this.entries];
|
|
3496
|
+
}
|
|
3497
|
+
/**
|
|
3498
|
+
* Get pending tool calls (tools that started but haven't finished)
|
|
3499
|
+
*/
|
|
3500
|
+
getPendingToolCalls() {
|
|
3501
|
+
return Array.from(this.pendingToolCalls.values()).map((n) => n.toolCall);
|
|
3502
|
+
}
|
|
3503
|
+
/**
|
|
3504
|
+
* Check if there are any pending tool calls
|
|
3505
|
+
*/
|
|
3506
|
+
hasPendingToolCalls() {
|
|
3507
|
+
return this.pendingToolCalls.size > 0;
|
|
3508
|
+
}
|
|
3509
|
+
/**
|
|
3510
|
+
* Reset processor state for a new conversation
|
|
3511
|
+
*/
|
|
3512
|
+
reset() {
|
|
3513
|
+
this.entries = [], this.pendingToolCalls.clear(), this.currentTextContent = "", this.currentTextEntryId = null, this.hadToolCallSinceText = !1, this.recentDeltas = [], this.emit();
|
|
3514
|
+
}
|
|
3515
|
+
/**
|
|
3516
|
+
* Add initial entries (e.g., from message history)
|
|
3517
|
+
*/
|
|
3518
|
+
setInitialEntries(n) {
|
|
3519
|
+
this.entries = [...n], this.emit();
|
|
3520
|
+
}
|
|
3521
|
+
/**
|
|
3522
|
+
* Add a user message entry
|
|
3523
|
+
*/
|
|
3524
|
+
addUserMessage(n, r) {
|
|
3525
|
+
this.finalizeCurrentText(), this.entries.push({
|
|
3526
|
+
id: r || `user-${Date.now()}-${Math.random().toString(36).slice(2)}`,
|
|
3527
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
3528
|
+
entryType: { type: "user_message" },
|
|
3529
|
+
content: n
|
|
3530
|
+
}), this.emit();
|
|
3531
|
+
}
|
|
3532
|
+
/**
|
|
3533
|
+
* Process an incoming stream event
|
|
3534
|
+
*/
|
|
3535
|
+
processEvent(n) {
|
|
3536
|
+
switch (n.type) {
|
|
3537
|
+
case "text_delta":
|
|
3538
|
+
this.handleTextDelta(n.delta);
|
|
3539
|
+
break;
|
|
3540
|
+
case "thinking_delta":
|
|
3541
|
+
break;
|
|
3542
|
+
case "message":
|
|
3543
|
+
this.finalizeCurrentText();
|
|
3544
|
+
break;
|
|
3545
|
+
case "tool_use":
|
|
3546
|
+
this.handleToolUse(n);
|
|
3547
|
+
break;
|
|
3548
|
+
case "tool_result":
|
|
3549
|
+
this.handleToolResult(n);
|
|
3550
|
+
break;
|
|
3551
|
+
case "error":
|
|
3552
|
+
this.handleError(n.error, n.code);
|
|
3553
|
+
break;
|
|
3554
|
+
}
|
|
3555
|
+
}
|
|
3556
|
+
/**
|
|
3557
|
+
* Handle text_delta event - accumulate streaming text
|
|
3558
|
+
* Creates a new text entry if there have been tool calls since the last text
|
|
3559
|
+
*/
|
|
3560
|
+
handleTextDelta(n) {
|
|
3561
|
+
if (!n) return;
|
|
3562
|
+
const r = this.currentTextContent + n;
|
|
3563
|
+
if (this.currentTextContent.length > 0 && n.length > 10) {
|
|
3564
|
+
const s = n.substring(0, Math.min(50, n.length));
|
|
3565
|
+
if (this.recentDeltas.includes(s) && r.includes(this.currentTextContent + this.currentTextContent.substring(0, Math.min(20, this.currentTextContent.length)))) {
|
|
3566
|
+
console.warn("[ToolCallProcessor] Skipping potential duplicate delta");
|
|
3567
|
+
return;
|
|
3568
|
+
}
|
|
3569
|
+
this.recentDeltas.push(s), this.recentDeltas.length > Se.MAX_RECENT_DELTAS && this.recentDeltas.shift();
|
|
3570
|
+
}
|
|
3571
|
+
if (this.hadToolCallSinceText && this.currentTextEntryId && (this.currentTextContent = "", this.currentTextEntryId = null, this.hadToolCallSinceText = !1), this.currentTextContent += n, !this.currentTextEntryId)
|
|
3572
|
+
this.currentTextEntryId = `text-${Date.now()}-${Math.random().toString(36).slice(2)}`, this.entries.push({
|
|
3573
|
+
id: this.currentTextEntryId,
|
|
3574
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
3575
|
+
entryType: { type: "assistant_message" },
|
|
3576
|
+
content: this.currentTextContent
|
|
3577
|
+
});
|
|
3578
|
+
else {
|
|
3579
|
+
const s = this.entries.findIndex((a) => a.id === this.currentTextEntryId);
|
|
3580
|
+
if (s !== -1) {
|
|
3581
|
+
const a = this.entries[s];
|
|
3582
|
+
a && (this.entries[s] = {
|
|
3583
|
+
id: a.id,
|
|
3584
|
+
timestamp: a.timestamp,
|
|
3585
|
+
entryType: a.entryType,
|
|
3586
|
+
content: this.currentTextContent
|
|
3587
|
+
});
|
|
3588
|
+
}
|
|
3589
|
+
}
|
|
3590
|
+
this.emit();
|
|
3591
|
+
}
|
|
3592
|
+
/**
|
|
3593
|
+
* Finalize any accumulated text content
|
|
3594
|
+
*/
|
|
3595
|
+
finalizeCurrentText() {
|
|
3596
|
+
this.currentTextContent && this.currentTextEntryId && (this.currentTextContent = "", this.currentTextEntryId = null);
|
|
3597
|
+
}
|
|
3598
|
+
/**
|
|
3599
|
+
* Handle tool_use event - create pending tool call
|
|
3600
|
+
*/
|
|
3601
|
+
handleToolUse(n) {
|
|
3602
|
+
this.finalizeCurrentText(), this.hadToolCallSinceText = !0;
|
|
3603
|
+
const r = tt({
|
|
3604
|
+
id: n.id,
|
|
3605
|
+
name: n.name,
|
|
3606
|
+
input: n.input
|
|
3607
|
+
}), s = {
|
|
3608
|
+
id: n.id,
|
|
3609
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
3610
|
+
entryType: {
|
|
3611
|
+
type: "tool_call",
|
|
3612
|
+
toolCall: r
|
|
3613
|
+
},
|
|
3614
|
+
content: r.summary
|
|
3615
|
+
}, a = this.entries.length;
|
|
3616
|
+
this.entries.push(s), this.pendingToolCalls.set(n.id, { entryIndex: a, toolCall: r }), this.emit();
|
|
3617
|
+
}
|
|
3618
|
+
/**
|
|
3619
|
+
* Handle tool_result event - update pending tool call with result
|
|
3620
|
+
*/
|
|
3621
|
+
handleToolResult(n) {
|
|
3622
|
+
const r = this.pendingToolCalls.get(n.toolUseId);
|
|
3623
|
+
if (r) {
|
|
3624
|
+
const s = nt(
|
|
3625
|
+
r.toolCall,
|
|
3626
|
+
n.content,
|
|
3627
|
+
n.isError
|
|
3628
|
+
), a = this.entries[r.entryIndex];
|
|
3629
|
+
a && a.entryType.type === "tool_call" && (this.entries[r.entryIndex] = {
|
|
3630
|
+
id: a.id,
|
|
3631
|
+
timestamp: a.timestamp,
|
|
3632
|
+
entryType: {
|
|
3633
|
+
type: "tool_call",
|
|
3634
|
+
toolCall: s
|
|
3635
|
+
},
|
|
3636
|
+
content: a.content
|
|
3637
|
+
}), this.pendingToolCalls.delete(n.toolUseId), this.emit();
|
|
3638
|
+
}
|
|
3639
|
+
}
|
|
3640
|
+
/**
|
|
3641
|
+
* Handle error event
|
|
3642
|
+
*/
|
|
3643
|
+
handleError(n, r) {
|
|
3644
|
+
this.finalizeCurrentText(), this.entries.push({
|
|
3645
|
+
id: `error-${Date.now()}-${Math.random().toString(36).slice(2)}`,
|
|
3646
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
3647
|
+
entryType: {
|
|
3648
|
+
type: "error",
|
|
3649
|
+
message: n,
|
|
3650
|
+
code: r
|
|
3651
|
+
},
|
|
3652
|
+
content: n
|
|
3653
|
+
}), this.emit();
|
|
3654
|
+
}
|
|
3655
|
+
/**
|
|
3656
|
+
* Emit current entries to all listeners
|
|
3657
|
+
*/
|
|
3658
|
+
emit() {
|
|
3659
|
+
const n = [...this.entries];
|
|
3660
|
+
this.listeners.forEach((r) => r(n));
|
|
3661
|
+
}
|
|
3662
|
+
};
|
|
3663
|
+
ee(Se, "MAX_RECENT_DELTAS", 10);
|
|
3664
|
+
let Re = Se;
|
|
3665
|
+
function jr() {
|
|
3666
|
+
return new Re();
|
|
3667
|
+
}
|
|
3668
|
+
export {
|
|
3669
|
+
Ye as ActionIcon,
|
|
3670
|
+
St as AlertCircleIcon,
|
|
3671
|
+
Ke as AlertTriangleIcon,
|
|
3672
|
+
nn as AssistantMessage,
|
|
3673
|
+
gr as BrainIcon,
|
|
3674
|
+
Mt as BugIcon,
|
|
3675
|
+
Fn as ChatInput,
|
|
3676
|
+
It as CheckCircleIcon,
|
|
3677
|
+
Ct as CheckIcon,
|
|
3678
|
+
je as ChevronDownIcon,
|
|
3679
|
+
or as ChevronLeftIcon,
|
|
3680
|
+
ve as ChevronRightIcon,
|
|
3681
|
+
cr as ChevronUpIcon,
|
|
3682
|
+
se as CodeBlock,
|
|
3683
|
+
dr as CodeIcon,
|
|
3684
|
+
ur as CopyIcon,
|
|
3685
|
+
Be as EditIcon,
|
|
3686
|
+
an as ErrorMessage,
|
|
3687
|
+
We as FileIcon,
|
|
3688
|
+
vt as FilePlusIcon,
|
|
3689
|
+
kt as FolderSearchIcon,
|
|
3690
|
+
yt as GlobeIcon,
|
|
3691
|
+
Tt as InfoIcon,
|
|
3692
|
+
Te as JsonDisplay,
|
|
3693
|
+
Wn as LegacyMessageList,
|
|
3694
|
+
_t as LoaderIcon,
|
|
3695
|
+
$e as LoadingIndicator,
|
|
3696
|
+
Rn as LogsPanel,
|
|
3697
|
+
ln as MessageEntry,
|
|
3698
|
+
Mn as MessageList,
|
|
3699
|
+
xr as MessageSquareIcon,
|
|
3700
|
+
lr as MoonIcon,
|
|
3701
|
+
Ar as NormalizedMessageList,
|
|
3702
|
+
Et as PaperclipIcon,
|
|
3703
|
+
$r as Playground,
|
|
3704
|
+
bt as PlugIcon,
|
|
3705
|
+
Rr as SandboxLogsPanel,
|
|
3706
|
+
_e as SearchIcon,
|
|
3707
|
+
pr as SendIcon,
|
|
3708
|
+
Lt as SparklesIcon,
|
|
3709
|
+
jt as StatusIndicator,
|
|
3710
|
+
fr as StopCircleIcon,
|
|
3711
|
+
on as StreamingText,
|
|
3712
|
+
ar as SunIcon,
|
|
3713
|
+
Me as TerminalIcon,
|
|
3714
|
+
Er as ThemeProvider,
|
|
3715
|
+
rn as ThinkingMessage,
|
|
3716
|
+
Oe as ToolCallCard,
|
|
3717
|
+
sn as ToolCallMessage,
|
|
3718
|
+
Re as ToolCallProcessor,
|
|
3719
|
+
Nt as ToolIcon,
|
|
3720
|
+
tn as UserMessage,
|
|
3721
|
+
mr as XCircleIcon,
|
|
3722
|
+
hr as XIcon,
|
|
3723
|
+
p as cn,
|
|
3724
|
+
tr as createToolCall,
|
|
3725
|
+
jr as createToolCallProcessor,
|
|
3726
|
+
mt as extractTextContent,
|
|
3727
|
+
sr as formatFileSize,
|
|
3728
|
+
De as formatTimestamp,
|
|
3729
|
+
ct as formatToolName,
|
|
3730
|
+
ht as generateToolSummary,
|
|
3731
|
+
rr as getActionIcon,
|
|
3732
|
+
Ue as getActionLabel,
|
|
3733
|
+
wr as isCommandRunAction,
|
|
3734
|
+
Ir as isErrorEntry,
|
|
3735
|
+
yr as isFileEditAction,
|
|
3736
|
+
vr as isFileReadAction,
|
|
3737
|
+
br as isFileWriteAction,
|
|
3738
|
+
Sr as isGenericToolAction,
|
|
3739
|
+
kr as isGlobAction,
|
|
3740
|
+
Tr as isMcpToolAction,
|
|
3741
|
+
Nr as isSearchAction,
|
|
3742
|
+
Mr as isToolCallEntry,
|
|
3743
|
+
Cr as isWebFetchAction,
|
|
3744
|
+
_r as isWebSearchAction,
|
|
3745
|
+
ut as mapToolToActionType,
|
|
3746
|
+
Dr as normalizeMessages,
|
|
3747
|
+
pt as normalizeToolResult,
|
|
3748
|
+
ft as parseCommandResult,
|
|
3749
|
+
dt as parseMcpToolName,
|
|
3750
|
+
ir as truncate,
|
|
3751
|
+
nr as updateToolCallWithResult,
|
|
3752
|
+
Lr as useTheme
|
|
3753
|
+
};
|