@getcatalystiq/agent-plane-ui 0.1.30 → 0.1.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +711 -261
- package/dist/index.d.cts +83 -2
- package/dist/index.d.ts +83 -2
- package/dist/index.js +464 -27
- package/package.json +2 -1
package/dist/index.cjs
CHANGED
|
@@ -2,13 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
var chunkVZ43ATC5_cjs = require('./chunk-VZ43ATC5.cjs');
|
|
4
4
|
var chunkXXF4U7WL_cjs = require('./chunk-XXF4U7WL.cjs');
|
|
5
|
+
var React4 = require('react');
|
|
5
6
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
-
var React = require('react');
|
|
7
7
|
var swr = require('swr');
|
|
8
8
|
var ReactMarkdown = require('react-markdown');
|
|
9
9
|
var cmdk = require('cmdk');
|
|
10
10
|
var Popover = require('@radix-ui/react-popover');
|
|
11
11
|
var remarkGfm = require('remark-gfm');
|
|
12
|
+
var ToastPrimitives = require('@radix-ui/react-toast');
|
|
13
|
+
var classVarianceAuthority = require('class-variance-authority');
|
|
12
14
|
|
|
13
15
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
16
|
|
|
@@ -30,11 +32,70 @@ function _interopNamespace(e) {
|
|
|
30
32
|
return Object.freeze(n);
|
|
31
33
|
}
|
|
32
34
|
|
|
33
|
-
var
|
|
35
|
+
var React4__namespace = /*#__PURE__*/_interopNamespace(React4);
|
|
34
36
|
var ReactMarkdown__default = /*#__PURE__*/_interopDefault(ReactMarkdown);
|
|
35
37
|
var Popover__namespace = /*#__PURE__*/_interopNamespace(Popover);
|
|
36
38
|
var remarkGfm__default = /*#__PURE__*/_interopDefault(remarkGfm);
|
|
39
|
+
var ToastPrimitives__namespace = /*#__PURE__*/_interopNamespace(ToastPrimitives);
|
|
37
40
|
|
|
41
|
+
var ACTIVE_STATUSES = /* @__PURE__ */ new Set(["running", "pending"]);
|
|
42
|
+
function useRunStream(runId, status) {
|
|
43
|
+
const client = chunkXXF4U7WL_cjs.useAgentPlaneClient();
|
|
44
|
+
const [events, setEvents] = React4.useState([]);
|
|
45
|
+
const [isStreaming, setIsStreaming] = React4.useState(false);
|
|
46
|
+
const [terminalEvent, setTerminalEvent] = React4.useState(null);
|
|
47
|
+
const [streamingText, setStreamingText] = React4.useState("");
|
|
48
|
+
const [error, setError] = React4.useState(null);
|
|
49
|
+
const abortRef = React4.useRef(null);
|
|
50
|
+
const startStream = React4.useCallback(async (id, signal) => {
|
|
51
|
+
setIsStreaming(true);
|
|
52
|
+
setError(null);
|
|
53
|
+
try {
|
|
54
|
+
const stream = await client.runs.stream(id, { signal });
|
|
55
|
+
for await (const event of stream) {
|
|
56
|
+
if (signal.aborted) break;
|
|
57
|
+
if (event.type === "text_delta") {
|
|
58
|
+
const text = event.text ?? "";
|
|
59
|
+
setStreamingText((prev) => prev + text);
|
|
60
|
+
continue;
|
|
61
|
+
}
|
|
62
|
+
if (event.type === "assistant") {
|
|
63
|
+
setStreamingText("");
|
|
64
|
+
}
|
|
65
|
+
if (event.type === "stream_detached") {
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
setEvents((prev) => [...prev, event]);
|
|
69
|
+
if (event.type === "result" || event.type === "error") {
|
|
70
|
+
setTerminalEvent(event);
|
|
71
|
+
setIsStreaming(false);
|
|
72
|
+
setStreamingText("");
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
setIsStreaming(false);
|
|
77
|
+
} catch (err) {
|
|
78
|
+
if (signal.aborted) return;
|
|
79
|
+
setError(err instanceof Error ? err : new Error(String(err)));
|
|
80
|
+
setIsStreaming(false);
|
|
81
|
+
}
|
|
82
|
+
}, [client]);
|
|
83
|
+
React4.useEffect(() => {
|
|
84
|
+
if (!runId || !ACTIVE_STATUSES.has(status)) {
|
|
85
|
+
setIsStreaming(false);
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
if (terminalEvent) return;
|
|
89
|
+
const controller = new AbortController();
|
|
90
|
+
abortRef.current = controller;
|
|
91
|
+
startStream(runId, controller.signal);
|
|
92
|
+
return () => {
|
|
93
|
+
controller.abort();
|
|
94
|
+
abortRef.current = null;
|
|
95
|
+
};
|
|
96
|
+
}, [runId, status, startStream, terminalEvent]);
|
|
97
|
+
return { events, isStreaming, terminalEvent, streamingText, error };
|
|
98
|
+
}
|
|
38
99
|
function Select({ className = "", ...props }) {
|
|
39
100
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative w-full", children: [
|
|
40
101
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -51,7 +112,7 @@ function Select({ className = "", ...props }) {
|
|
|
51
112
|
] }) })
|
|
52
113
|
] });
|
|
53
114
|
}
|
|
54
|
-
var Textarea =
|
|
115
|
+
var Textarea = React4__namespace.forwardRef(
|
|
55
116
|
({ className, ...props }, ref) => {
|
|
56
117
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
57
118
|
"textarea",
|
|
@@ -157,7 +218,7 @@ function PaginationBar({
|
|
|
157
218
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between px-3 py-2 border-t border-border bg-muted/20 text-sm", children: [
|
|
158
219
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 text-muted-foreground", children: [
|
|
159
220
|
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "Rows per page:" }),
|
|
160
|
-
PAGE_SIZE_OPTIONS.map((ps) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
221
|
+
PAGE_SIZE_OPTIONS.map((ps) => /* @__PURE__ */ jsxRuntime.jsx(React4__namespace.default.Fragment, { children: renderLink(
|
|
161
222
|
buildHref(1, ps),
|
|
162
223
|
ps,
|
|
163
224
|
`px-2 py-0.5 rounded text-xs ${pageSize === ps ? "bg-primary text-primary-foreground font-medium" : "hover:bg-muted"}`
|
|
@@ -188,7 +249,7 @@ function parsePaginationParams(pageParam, pageSizeParam, defaultPageSize = 20) {
|
|
|
188
249
|
return { page, pageSize, offset };
|
|
189
250
|
}
|
|
190
251
|
function Tabs({ tabs, defaultTab = 0 }) {
|
|
191
|
-
const [active, setActive] =
|
|
252
|
+
const [active, setActive] = React4.useState(defaultTab);
|
|
192
253
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
193
254
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex gap-4", children: tabs.map((tab, i) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
194
255
|
"button",
|
|
@@ -230,7 +291,7 @@ function ConfirmDialog({
|
|
|
230
291
|
] }) });
|
|
231
292
|
}
|
|
232
293
|
function CopyButton({ text, className = "" }) {
|
|
233
|
-
const [copied, setCopied] =
|
|
294
|
+
const [copied, setCopied] = React4.useState(false);
|
|
234
295
|
async function handleCopy() {
|
|
235
296
|
await navigator.clipboard.writeText(text);
|
|
236
297
|
setCopied(true);
|
|
@@ -323,6 +384,102 @@ function DashboardPage({ initialData, chartComponent: ChartComponent }) {
|
|
|
323
384
|
ChartComponent && /* @__PURE__ */ jsxRuntime.jsx(ChartComponent, { stats: daily_stats })
|
|
324
385
|
] });
|
|
325
386
|
}
|
|
387
|
+
var TOAST_LIMIT = 5;
|
|
388
|
+
var TOAST_REMOVE_DELAY = 1e6;
|
|
389
|
+
var count = 0;
|
|
390
|
+
function genId() {
|
|
391
|
+
count = (count + 1) % Number.MAX_SAFE_INTEGER;
|
|
392
|
+
return count.toString();
|
|
393
|
+
}
|
|
394
|
+
var toastTimeouts = /* @__PURE__ */ new Map();
|
|
395
|
+
function addToRemoveQueue(toastId) {
|
|
396
|
+
if (toastTimeouts.has(toastId)) return;
|
|
397
|
+
const timeout = setTimeout(() => {
|
|
398
|
+
toastTimeouts.delete(toastId);
|
|
399
|
+
dispatch({ type: "REMOVE_TOAST", toastId });
|
|
400
|
+
}, TOAST_REMOVE_DELAY);
|
|
401
|
+
toastTimeouts.set(toastId, timeout);
|
|
402
|
+
}
|
|
403
|
+
function reducer(state, action) {
|
|
404
|
+
switch (action.type) {
|
|
405
|
+
case "ADD_TOAST":
|
|
406
|
+
return {
|
|
407
|
+
...state,
|
|
408
|
+
toasts: [action.toast, ...state.toasts].slice(0, TOAST_LIMIT)
|
|
409
|
+
};
|
|
410
|
+
case "UPDATE_TOAST":
|
|
411
|
+
return {
|
|
412
|
+
...state,
|
|
413
|
+
toasts: state.toasts.map(
|
|
414
|
+
(t) => t.id === action.toast.id ? { ...t, ...action.toast } : t
|
|
415
|
+
)
|
|
416
|
+
};
|
|
417
|
+
case "DISMISS_TOAST": {
|
|
418
|
+
const { toastId } = action;
|
|
419
|
+
if (toastId) {
|
|
420
|
+
addToRemoveQueue(toastId);
|
|
421
|
+
} else {
|
|
422
|
+
state.toasts.forEach((t) => addToRemoveQueue(t.id));
|
|
423
|
+
}
|
|
424
|
+
return {
|
|
425
|
+
...state,
|
|
426
|
+
toasts: state.toasts.map(
|
|
427
|
+
(t) => t.id === toastId || toastId === void 0 ? { ...t, open: false } : t
|
|
428
|
+
)
|
|
429
|
+
};
|
|
430
|
+
}
|
|
431
|
+
case "REMOVE_TOAST":
|
|
432
|
+
if (action.toastId === void 0) {
|
|
433
|
+
return { ...state, toasts: [] };
|
|
434
|
+
}
|
|
435
|
+
return {
|
|
436
|
+
...state,
|
|
437
|
+
toasts: state.toasts.filter((t) => t.id !== action.toastId)
|
|
438
|
+
};
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
var listeners = [];
|
|
442
|
+
var memoryState = { toasts: [] };
|
|
443
|
+
function dispatch(action) {
|
|
444
|
+
memoryState = reducer(memoryState, action);
|
|
445
|
+
listeners.forEach((listener) => listener(memoryState));
|
|
446
|
+
}
|
|
447
|
+
function toast(props) {
|
|
448
|
+
const id = genId();
|
|
449
|
+
const update = (updateProps) => dispatch({ type: "UPDATE_TOAST", toast: { ...updateProps, id } });
|
|
450
|
+
const dismiss2 = () => dispatch({ type: "DISMISS_TOAST", toastId: id });
|
|
451
|
+
dispatch({
|
|
452
|
+
type: "ADD_TOAST",
|
|
453
|
+
toast: {
|
|
454
|
+
...props,
|
|
455
|
+
id,
|
|
456
|
+
open: true,
|
|
457
|
+
onOpenChange: (open) => {
|
|
458
|
+
if (!open) dismiss2();
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
});
|
|
462
|
+
return { id, dismiss: dismiss2, update };
|
|
463
|
+
}
|
|
464
|
+
function dismiss(toastId) {
|
|
465
|
+
const action = toastId !== void 0 ? { type: "DISMISS_TOAST", toastId } : { type: "DISMISS_TOAST" };
|
|
466
|
+
dispatch(action);
|
|
467
|
+
}
|
|
468
|
+
function useToast() {
|
|
469
|
+
const [state, setState] = React4__namespace.useState(memoryState);
|
|
470
|
+
React4__namespace.useEffect(() => {
|
|
471
|
+
listeners.push(setState);
|
|
472
|
+
return () => {
|
|
473
|
+
const index = listeners.indexOf(setState);
|
|
474
|
+
if (index > -1) listeners.splice(index, 1);
|
|
475
|
+
};
|
|
476
|
+
}, [state]);
|
|
477
|
+
return {
|
|
478
|
+
...state,
|
|
479
|
+
toast,
|
|
480
|
+
dismiss
|
|
481
|
+
};
|
|
482
|
+
}
|
|
326
483
|
var SOURCES = [
|
|
327
484
|
{ value: "", label: "All Sources" },
|
|
328
485
|
{ value: "api", label: "API" },
|
|
@@ -332,11 +489,18 @@ var SOURCES = [
|
|
|
332
489
|
{ value: "a2a", label: "A2A" }
|
|
333
490
|
];
|
|
334
491
|
var VALID_SOURCES = SOURCES.filter((s) => s.value).map((s) => s.value);
|
|
492
|
+
var ACTIVE_STATUSES2 = /* @__PURE__ */ new Set(["running", "pending"]);
|
|
493
|
+
var TERMINAL_STATUSES = /* @__PURE__ */ new Set(["completed", "failed", "cancelled", "timed_out"]);
|
|
335
494
|
function RunListPage({ initialData }) {
|
|
336
495
|
const { LinkComponent, basePath } = chunkXXF4U7WL_cjs.useNavigation();
|
|
337
|
-
const
|
|
338
|
-
const [
|
|
339
|
-
const [
|
|
496
|
+
const { toast: toast2 } = useToast();
|
|
497
|
+
const [page, setPage] = React4.useState(1);
|
|
498
|
+
const [pageSize, setPageSize] = React4.useState(20);
|
|
499
|
+
const [sourceFilter, setSourceFilter] = React4.useState(null);
|
|
500
|
+
const prevStatusesRef = React4.useRef(/* @__PURE__ */ new Map());
|
|
501
|
+
const [activeRunsExist, setActiveRunsExist] = React4.useState(
|
|
502
|
+
() => initialData?.data?.some((r) => ACTIVE_STATUSES2.has(r.status)) ?? false
|
|
503
|
+
);
|
|
340
504
|
const cacheKey = `runs-${page}-${pageSize}-${sourceFilter || "all"}`;
|
|
341
505
|
const { data, error, isLoading } = chunkVZ43ATC5_cjs.useApi(
|
|
342
506
|
cacheKey,
|
|
@@ -347,14 +511,35 @@ function RunListPage({ initialData }) {
|
|
|
347
511
|
...sourceFilter ? { triggered_by: sourceFilter } : {}
|
|
348
512
|
});
|
|
349
513
|
},
|
|
350
|
-
|
|
514
|
+
{
|
|
515
|
+
...initialData ? { fallbackData: initialData } : {},
|
|
516
|
+
refreshInterval: activeRunsExist ? 5e3 : 0
|
|
517
|
+
}
|
|
351
518
|
);
|
|
352
|
-
|
|
519
|
+
React4.useEffect(() => {
|
|
520
|
+
if (!data?.data) return;
|
|
521
|
+
const prev = prevStatusesRef.current;
|
|
522
|
+
const next = /* @__PURE__ */ new Map();
|
|
523
|
+
for (const run of data.data) {
|
|
524
|
+
next.set(run.id, run.status);
|
|
525
|
+
const oldStatus = prev.get(run.id);
|
|
526
|
+
if (oldStatus && ACTIVE_STATUSES2.has(oldStatus) && TERMINAL_STATUSES.has(run.status)) {
|
|
527
|
+
toast2({
|
|
528
|
+
title: `Run ${run.status}`,
|
|
529
|
+
description: run.agent_name,
|
|
530
|
+
variant: run.status === "completed" ? "success" : "destructive"
|
|
531
|
+
});
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
prevStatusesRef.current = next;
|
|
535
|
+
setActiveRunsExist(data.data.some((r) => ACTIVE_STATUSES2.has(r.status)));
|
|
536
|
+
}, [data, toast2]);
|
|
537
|
+
const handleSourceChange = React4.useCallback((e) => {
|
|
353
538
|
const value = e.target.value;
|
|
354
539
|
setSourceFilter(VALID_SOURCES.includes(value) ? value : null);
|
|
355
540
|
setPage(1);
|
|
356
541
|
}, []);
|
|
357
|
-
const handlePaginationNavigate =
|
|
542
|
+
const handlePaginationNavigate = React4.useCallback((href) => {
|
|
358
543
|
const url = new URL(href, "http://localhost");
|
|
359
544
|
const p = parseInt(url.searchParams.get("page") || "1", 10);
|
|
360
545
|
const ps = parseInt(url.searchParams.get("pageSize") || "20", 10);
|
|
@@ -396,7 +581,8 @@ function RunListPage({ initialData }) {
|
|
|
396
581
|
/* @__PURE__ */ jsxRuntime.jsx(Th, { align: "right", children: "Cost" }),
|
|
397
582
|
/* @__PURE__ */ jsxRuntime.jsx(Th, { align: "right", children: "Turns" }),
|
|
398
583
|
/* @__PURE__ */ jsxRuntime.jsx(Th, { align: "right", children: "Duration" }),
|
|
399
|
-
/* @__PURE__ */ jsxRuntime.jsx(Th, { children: "Created" })
|
|
584
|
+
/* @__PURE__ */ jsxRuntime.jsx(Th, { children: "Created" }),
|
|
585
|
+
/* @__PURE__ */ jsxRuntime.jsx(Th, {})
|
|
400
586
|
] }),
|
|
401
587
|
/* @__PURE__ */ jsxRuntime.jsxs("tbody", { children: [
|
|
402
588
|
runs.map((r) => /* @__PURE__ */ jsxRuntime.jsxs(AdminTableRow, { children: [
|
|
@@ -417,13 +603,47 @@ function RunListPage({ initialData }) {
|
|
|
417
603
|
] }),
|
|
418
604
|
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "p-3 text-right", children: r.num_turns }),
|
|
419
605
|
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "p-3 text-right text-muted-foreground text-xs", children: r.duration_ms > 0 ? `${(r.duration_ms / 1e3).toFixed(1)}s` : "\u2014" }),
|
|
420
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "p-3 text-muted-foreground text-xs", children: /* @__PURE__ */ jsxRuntime.jsx(LocalDate, { value: r.created_at }) })
|
|
606
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "p-3 text-muted-foreground text-xs", children: /* @__PURE__ */ jsxRuntime.jsx(LocalDate, { value: r.created_at }) }),
|
|
607
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "p-3", children: (r.status === "failed" || r.status === "cancelled" || r.status === "timed_out") && /* @__PURE__ */ jsxRuntime.jsx(RerunRowButton, { agentId: r.agent_id, prompt: r.prompt }) })
|
|
421
608
|
] }, r.id)),
|
|
422
|
-
runs.length === 0 && /* @__PURE__ */ jsxRuntime.jsx(EmptyRow, { colSpan:
|
|
609
|
+
runs.length === 0 && /* @__PURE__ */ jsxRuntime.jsx(EmptyRow, { colSpan: 10, children: "No runs found" })
|
|
423
610
|
] })
|
|
424
611
|
] })
|
|
425
612
|
] });
|
|
426
613
|
}
|
|
614
|
+
function RerunRowButton({ agentId, prompt }) {
|
|
615
|
+
const [rerunning, setRerunning] = React4.useState(false);
|
|
616
|
+
const client = chunkXXF4U7WL_cjs.useAgentPlaneClient();
|
|
617
|
+
const { onNavigate, basePath } = chunkXXF4U7WL_cjs.useNavigation();
|
|
618
|
+
const { toast: toast2 } = useToast();
|
|
619
|
+
async function handleRerun(e) {
|
|
620
|
+
e.preventDefault();
|
|
621
|
+
e.stopPropagation();
|
|
622
|
+
setRerunning(true);
|
|
623
|
+
try {
|
|
624
|
+
const stream = await client.runs.create({ agent_id: agentId, prompt });
|
|
625
|
+
let newRunId = null;
|
|
626
|
+
for await (const event of stream) {
|
|
627
|
+
if (event.type === "run_started") {
|
|
628
|
+
newRunId = event.run_id;
|
|
629
|
+
break;
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
if (newRunId) {
|
|
633
|
+
onNavigate(`${basePath}/runs/${newRunId}`);
|
|
634
|
+
}
|
|
635
|
+
} catch (err) {
|
|
636
|
+
toast2({
|
|
637
|
+
title: "Failed to rerun",
|
|
638
|
+
description: err instanceof Error ? err.message : "Unknown error",
|
|
639
|
+
variant: "destructive"
|
|
640
|
+
});
|
|
641
|
+
} finally {
|
|
642
|
+
setRerunning(false);
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
return /* @__PURE__ */ jsxRuntime.jsx(chunkXXF4U7WL_cjs.Button, { variant: "ghost", size: "sm", onClick: handleRerun, disabled: rerunning, children: rerunning ? "\u2026" : "Rerun" });
|
|
646
|
+
}
|
|
427
647
|
function buildConversation(events) {
|
|
428
648
|
const items = [];
|
|
429
649
|
const toolCallMap = /* @__PURE__ */ new Map();
|
|
@@ -529,17 +749,51 @@ function buildConversation(events) {
|
|
|
529
749
|
}
|
|
530
750
|
return items;
|
|
531
751
|
}
|
|
532
|
-
function TranscriptViewer({ transcript, prompt }) {
|
|
533
|
-
const conversation =
|
|
752
|
+
function TranscriptViewer({ transcript, prompt, isStreaming = false }) {
|
|
753
|
+
const conversation = React4.useMemo(() => buildConversation(transcript), [transcript]);
|
|
754
|
+
const scrollContainerRef = React4.useRef(null);
|
|
755
|
+
const sentinelRef = React4.useRef(null);
|
|
756
|
+
const userHasScrolledUpRef = React4.useRef(false);
|
|
757
|
+
const [userHasScrolledUp, setUserHasScrolledUp] = React4.useState(false);
|
|
758
|
+
const handleScroll = React4.useCallback(() => {
|
|
759
|
+
const el = scrollContainerRef.current;
|
|
760
|
+
if (!el) return;
|
|
761
|
+
const atBottom = el.scrollHeight - el.scrollTop - el.clientHeight < 50;
|
|
762
|
+
if (atBottom) {
|
|
763
|
+
userHasScrolledUpRef.current = false;
|
|
764
|
+
setUserHasScrolledUp(false);
|
|
765
|
+
} else {
|
|
766
|
+
userHasScrolledUpRef.current = true;
|
|
767
|
+
setUserHasScrolledUp(true);
|
|
768
|
+
}
|
|
769
|
+
}, []);
|
|
770
|
+
React4.useEffect(() => {
|
|
771
|
+
if (isStreaming && !userHasScrolledUpRef.current) {
|
|
772
|
+
sentinelRef.current?.scrollIntoView({ behavior: "smooth" });
|
|
773
|
+
}
|
|
774
|
+
}, [transcript.length, isStreaming]);
|
|
534
775
|
return /* @__PURE__ */ jsxRuntime.jsxs(chunkVZ43ATC5_cjs.Card, { children: [
|
|
535
776
|
/* @__PURE__ */ jsxRuntime.jsx(chunkVZ43ATC5_cjs.CardHeader, { children: /* @__PURE__ */ jsxRuntime.jsx(chunkVZ43ATC5_cjs.CardTitle, { className: "text-base", children: "Transcript" }) }),
|
|
536
|
-
/* @__PURE__ */ jsxRuntime.
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
777
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkVZ43ATC5_cjs.CardContent, { className: "p-0", children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
778
|
+
"div",
|
|
779
|
+
{
|
|
780
|
+
ref: scrollContainerRef,
|
|
781
|
+
onScroll: isStreaming ? handleScroll : void 0,
|
|
782
|
+
className: "space-y-3 overflow-y-auto px-6 pb-6",
|
|
783
|
+
children: [
|
|
784
|
+
prompt && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-md border border-border bg-muted/20 px-4 py-3", children: [
|
|
785
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-xs font-medium text-muted-foreground mb-1", children: "Prompt" }),
|
|
786
|
+
/* @__PURE__ */ jsxRuntime.jsx("pre", { className: "text-xs font-mono whitespace-pre-wrap", children: prompt })
|
|
787
|
+
] }),
|
|
788
|
+
transcript.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground", children: "No transcript available" }) : /* @__PURE__ */ jsxRuntime.jsx(ConversationView, { items: conversation }),
|
|
789
|
+
isStreaming && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 px-4 py-2 text-xs text-muted-foreground", children: [
|
|
790
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "h-2 w-2 rounded-full bg-blue-400 animate-pulse" }),
|
|
791
|
+
"Streaming..."
|
|
792
|
+
] }),
|
|
793
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { ref: sentinelRef })
|
|
794
|
+
]
|
|
795
|
+
}
|
|
796
|
+
) })
|
|
543
797
|
] });
|
|
544
798
|
}
|
|
545
799
|
function ConversationView({ items }) {
|
|
@@ -563,7 +817,7 @@ function ConversationView({ items }) {
|
|
|
563
817
|
}) });
|
|
564
818
|
}
|
|
565
819
|
function A2AIncomingItem({ item }) {
|
|
566
|
-
const [expanded, setExpanded] =
|
|
820
|
+
const [expanded, setExpanded] = React4.useState(false);
|
|
567
821
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-md border border-border bg-muted/30 overflow-hidden", children: [
|
|
568
822
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
569
823
|
"button",
|
|
@@ -589,7 +843,7 @@ function A2AIncomingItem({ item }) {
|
|
|
589
843
|
] });
|
|
590
844
|
}
|
|
591
845
|
function SystemItem({ item }) {
|
|
592
|
-
const [expanded, setExpanded] =
|
|
846
|
+
const [expanded, setExpanded] = React4.useState(false);
|
|
593
847
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-md border border-border bg-muted/30 overflow-hidden", children: [
|
|
594
848
|
/* @__PURE__ */ jsxRuntime.jsxs("button", { onClick: () => setExpanded(!expanded), className: "w-full flex items-center gap-2 px-4 py-2 text-left hover:bg-muted/50 transition-colors", children: [
|
|
595
849
|
/* @__PURE__ */ jsxRuntime.jsx(chunkXXF4U7WL_cjs.Badge, { variant: "outline", className: "text-[10px]", children: "system" }),
|
|
@@ -618,7 +872,7 @@ function SystemItem({ item }) {
|
|
|
618
872
|
] });
|
|
619
873
|
}
|
|
620
874
|
function AssistantItem({ item }) {
|
|
621
|
-
const [expanded, setExpanded] =
|
|
875
|
+
const [expanded, setExpanded] = React4.useState(false);
|
|
622
876
|
const preview = item.text?.split("\n")[0]?.slice(0, 120) ?? "";
|
|
623
877
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-md border border-border overflow-hidden", children: [
|
|
624
878
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -637,7 +891,7 @@ function AssistantItem({ item }) {
|
|
|
637
891
|
] });
|
|
638
892
|
}
|
|
639
893
|
function ToolItem({ item }) {
|
|
640
|
-
const [expanded, setExpanded] =
|
|
894
|
+
const [expanded, setExpanded] = React4.useState(false);
|
|
641
895
|
const hasOutput = item.toolOutput && item.toolOutput.length > 0;
|
|
642
896
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-md border border-border overflow-hidden", children: [
|
|
643
897
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -693,6 +947,7 @@ function ErrorItem({ item }) {
|
|
|
693
947
|
}
|
|
694
948
|
function RunDetailPage({ runId, initialData, initialTranscript }) {
|
|
695
949
|
const { mutate } = swr.useSWRConfig();
|
|
950
|
+
const { toast: toast2 } = useToast();
|
|
696
951
|
const { data: run, error, isLoading } = chunkVZ43ATC5_cjs.useApi(
|
|
697
952
|
`run-${runId}`,
|
|
698
953
|
(client) => client.runs.get(runId),
|
|
@@ -703,6 +958,20 @@ function RunDetailPage({ runId, initialData, initialTranscript }) {
|
|
|
703
958
|
(client) => client.runs.transcriptArray(runId),
|
|
704
959
|
initialTranscript ? { fallbackData: initialTranscript } : void 0
|
|
705
960
|
);
|
|
961
|
+
const isActive = run?.status === "running" || run?.status === "pending";
|
|
962
|
+
const { events, isStreaming, terminalEvent, streamingText } = useRunStream(
|
|
963
|
+
runId,
|
|
964
|
+
run?.status ?? ""
|
|
965
|
+
);
|
|
966
|
+
React4.useEffect(() => {
|
|
967
|
+
if (!terminalEvent) return;
|
|
968
|
+
toast2({
|
|
969
|
+
title: terminalEvent.type === "result" ? "Run completed" : "Run failed",
|
|
970
|
+
variant: terminalEvent.type === "result" ? "success" : "destructive"
|
|
971
|
+
});
|
|
972
|
+
mutate(`run-${runId}`);
|
|
973
|
+
mutate(`transcript-${runId}`);
|
|
974
|
+
}, [terminalEvent, toast2, mutate, runId]);
|
|
706
975
|
if (error) {
|
|
707
976
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-center min-h-[40vh]", children: /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-destructive", children: [
|
|
708
977
|
"Failed to load run: ",
|
|
@@ -717,6 +986,7 @@ function RunDetailPage({ runId, initialData, initialTranscript }) {
|
|
|
717
986
|
}
|
|
718
987
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-6", children: [
|
|
719
988
|
(run.status === "running" || run.status === "pending") && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-end", children: /* @__PURE__ */ jsxRuntime.jsx(CancelRunButton, { runId: run.id, onCancelled: () => mutate(`run-${runId}`) }) }),
|
|
989
|
+
(run.status === "failed" || run.status === "cancelled" || run.status === "timed_out") && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-end", children: /* @__PURE__ */ jsxRuntime.jsx(RerunButton, { agentId: run.agent_id, prompt: run.prompt }) }),
|
|
720
990
|
run.triggered_by === "a2a" && run.requested_by_key_name && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 text-sm text-muted-foreground", children: [
|
|
721
991
|
/* @__PURE__ */ jsxRuntime.jsx(chunkXXF4U7WL_cjs.Badge, { variant: "outline", className: "text-[10px]", children: "A2A" }),
|
|
722
992
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
|
|
@@ -735,16 +1005,26 @@ function RunDetailPage({ runId, initialData, initialTranscript }) {
|
|
|
735
1005
|
] }),
|
|
736
1006
|
/* @__PURE__ */ jsxRuntime.jsx(MetricCard, { label: "Cost", children: /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "font-mono", children: [
|
|
737
1007
|
"$",
|
|
738
|
-
|
|
1008
|
+
(() => {
|
|
1009
|
+
const cost = terminalEvent?.cost_usd ?? run.cost_usd;
|
|
1010
|
+
return cost != null ? Number(cost).toFixed(4) : "\u2014";
|
|
1011
|
+
})()
|
|
739
1012
|
] }) }),
|
|
740
|
-
/* @__PURE__ */ jsxRuntime.jsx(MetricCard, { label: "Turns", children: run.num_turns }),
|
|
741
|
-
/* @__PURE__ */ jsxRuntime.jsx(MetricCard, { label: "Duration", children:
|
|
1013
|
+
/* @__PURE__ */ jsxRuntime.jsx(MetricCard, { label: "Turns", children: terminalEvent?.num_turns ?? run.num_turns }),
|
|
1014
|
+
/* @__PURE__ */ jsxRuntime.jsx(MetricCard, { label: "Duration", children: (() => {
|
|
1015
|
+
const ms = terminalEvent?.duration_ms ?? run.duration_ms;
|
|
1016
|
+
return ms > 0 ? `${(ms / 1e3).toFixed(1)}s` : "\u2014";
|
|
1017
|
+
})() }),
|
|
742
1018
|
/* @__PURE__ */ jsxRuntime.jsxs(MetricCard, { label: "Tokens", children: [
|
|
743
|
-
(
|
|
1019
|
+
(() => {
|
|
1020
|
+
const inTok = terminalEvent?.total_input_tokens ?? run.total_input_tokens;
|
|
1021
|
+
const outTok = terminalEvent?.total_output_tokens ?? run.total_output_tokens;
|
|
1022
|
+
return (inTok + outTok).toLocaleString();
|
|
1023
|
+
})(),
|
|
744
1024
|
/* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-xs text-muted-foreground mt-0.5 font-normal", children: [
|
|
745
|
-
run.total_input_tokens.toLocaleString(),
|
|
1025
|
+
(terminalEvent?.total_input_tokens ?? run.total_input_tokens).toLocaleString(),
|
|
746
1026
|
" in / ",
|
|
747
|
-
run.total_output_tokens.toLocaleString(),
|
|
1027
|
+
(terminalEvent?.total_output_tokens ?? run.total_output_tokens).toLocaleString(),
|
|
748
1028
|
" out"
|
|
749
1029
|
] })
|
|
750
1030
|
] })
|
|
@@ -756,7 +1036,18 @@ function RunDetailPage({ runId, initialData, initialTranscript }) {
|
|
|
756
1036
|
run.error_messages.map((msg, i) => /* @__PURE__ */ jsxRuntime.jsx("pre", { className: "whitespace-pre-wrap text-sm text-destructive font-mono bg-destructive/10 rounded-md p-3", children: msg }, i))
|
|
757
1037
|
] })
|
|
758
1038
|
] }),
|
|
759
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1039
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1040
|
+
TranscriptViewer,
|
|
1041
|
+
{
|
|
1042
|
+
transcript: isActive && isStreaming ? events : transcript || [],
|
|
1043
|
+
prompt: run.prompt,
|
|
1044
|
+
isStreaming: isActive && isStreaming
|
|
1045
|
+
}
|
|
1046
|
+
),
|
|
1047
|
+
isActive && streamingText && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-lg border bg-muted/30 p-4", children: /* @__PURE__ */ jsxRuntime.jsxs("pre", { className: "whitespace-pre-wrap text-sm font-mono", children: [
|
|
1048
|
+
streamingText,
|
|
1049
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "inline-block w-2 h-4 ml-0.5 bg-foreground/70 animate-pulse align-text-bottom" })
|
|
1050
|
+
] }) }),
|
|
760
1051
|
/* @__PURE__ */ jsxRuntime.jsx(chunkVZ43ATC5_cjs.Card, { children: /* @__PURE__ */ jsxRuntime.jsxs("details", { children: [
|
|
761
1052
|
/* @__PURE__ */ jsxRuntime.jsxs("summary", { className: "flex items-center justify-between px-6 py-4 cursor-pointer list-none hover:bg-muted/30 transition-colors rounded-xl", children: [
|
|
762
1053
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-base font-semibold", children: "Metadata" }),
|
|
@@ -781,9 +1072,40 @@ function RunDetailPage({ runId, initialData, initialTranscript }) {
|
|
|
781
1072
|
] }) })
|
|
782
1073
|
] });
|
|
783
1074
|
}
|
|
1075
|
+
function RerunButton({ agentId, prompt }) {
|
|
1076
|
+
const [rerunning, setRerunning] = React4.useState(false);
|
|
1077
|
+
const client = chunkXXF4U7WL_cjs.useAgentPlaneClient();
|
|
1078
|
+
const { onNavigate, basePath } = chunkXXF4U7WL_cjs.useNavigation();
|
|
1079
|
+
const { toast: toast2 } = useToast();
|
|
1080
|
+
async function handleRerun() {
|
|
1081
|
+
setRerunning(true);
|
|
1082
|
+
try {
|
|
1083
|
+
const stream = await client.runs.create({ agent_id: agentId, prompt });
|
|
1084
|
+
let newRunId = null;
|
|
1085
|
+
for await (const event of stream) {
|
|
1086
|
+
if (event.type === "run_started") {
|
|
1087
|
+
newRunId = event.run_id;
|
|
1088
|
+
break;
|
|
1089
|
+
}
|
|
1090
|
+
}
|
|
1091
|
+
if (newRunId) {
|
|
1092
|
+
onNavigate(`${basePath}/runs/${newRunId}`);
|
|
1093
|
+
}
|
|
1094
|
+
} catch (err) {
|
|
1095
|
+
toast2({
|
|
1096
|
+
title: "Failed to rerun",
|
|
1097
|
+
description: err instanceof Error ? err.message : "Unknown error",
|
|
1098
|
+
variant: "destructive"
|
|
1099
|
+
});
|
|
1100
|
+
} finally {
|
|
1101
|
+
setRerunning(false);
|
|
1102
|
+
}
|
|
1103
|
+
}
|
|
1104
|
+
return /* @__PURE__ */ jsxRuntime.jsx(chunkXXF4U7WL_cjs.Button, { variant: "outline", size: "sm", onClick: handleRerun, disabled: rerunning, children: rerunning ? "Rerunning\u2026" : "\u21BB Rerun" });
|
|
1105
|
+
}
|
|
784
1106
|
function CancelRunButton({ runId, onCancelled }) {
|
|
785
|
-
const [open, setOpen] =
|
|
786
|
-
const [cancelling, setCancelling] =
|
|
1107
|
+
const [open, setOpen] = React4.useState(false);
|
|
1108
|
+
const [cancelling, setCancelling] = React4.useState(false);
|
|
787
1109
|
const client = chunkXXF4U7WL_cjs.useAgentPlaneClient();
|
|
788
1110
|
async function handleConfirm() {
|
|
789
1111
|
setCancelling(true);
|
|
@@ -836,17 +1158,17 @@ function McpServerListPage({ initialData }) {
|
|
|
836
1158
|
(c) => c.customConnectors.listServers(),
|
|
837
1159
|
initialData ? { fallbackData: initialData } : void 0
|
|
838
1160
|
);
|
|
839
|
-
const [showCreate, setShowCreate] =
|
|
840
|
-
const [creating, setCreating] =
|
|
841
|
-
const [createForm, setCreateForm] =
|
|
842
|
-
const [createError, setCreateError] =
|
|
843
|
-
const [editTarget, setEditTarget] =
|
|
844
|
-
const [editing, setEditing] =
|
|
845
|
-
const [editForm, setEditForm] =
|
|
846
|
-
const [editError, setEditError] =
|
|
847
|
-
const [deleteTarget, setDeleteTarget] =
|
|
848
|
-
const [deleting, setDeleting] =
|
|
849
|
-
const [deleteError, setDeleteError] =
|
|
1161
|
+
const [showCreate, setShowCreate] = React4.useState(false);
|
|
1162
|
+
const [creating, setCreating] = React4.useState(false);
|
|
1163
|
+
const [createForm, setCreateForm] = React4.useState(emptyForm);
|
|
1164
|
+
const [createError, setCreateError] = React4.useState("");
|
|
1165
|
+
const [editTarget, setEditTarget] = React4.useState(null);
|
|
1166
|
+
const [editing, setEditing] = React4.useState(false);
|
|
1167
|
+
const [editForm, setEditForm] = React4.useState({ name: "", description: "" });
|
|
1168
|
+
const [editError, setEditError] = React4.useState("");
|
|
1169
|
+
const [deleteTarget, setDeleteTarget] = React4.useState(null);
|
|
1170
|
+
const [deleting, setDeleting] = React4.useState(false);
|
|
1171
|
+
const [deleteError, setDeleteError] = React4.useState("");
|
|
850
1172
|
async function handleCreate() {
|
|
851
1173
|
setCreating(true);
|
|
852
1174
|
setCreateError("");
|
|
@@ -1029,13 +1351,13 @@ function PluginMarketplaceListPage({ initialData }) {
|
|
|
1029
1351
|
(c) => c.pluginMarketplaces.list(),
|
|
1030
1352
|
initialData ? { fallbackData: initialData } : void 0
|
|
1031
1353
|
);
|
|
1032
|
-
const [showAdd, setShowAdd] =
|
|
1033
|
-
const [adding, setAdding] =
|
|
1034
|
-
const [addError, setAddError] =
|
|
1035
|
-
const [newMarketplace, setNewMarketplace] =
|
|
1036
|
-
const [deleteTarget, setDeleteTarget] =
|
|
1037
|
-
const [deleting, setDeleting] =
|
|
1038
|
-
const [deleteError, setDeleteError] =
|
|
1354
|
+
const [showAdd, setShowAdd] = React4.useState(false);
|
|
1355
|
+
const [adding, setAdding] = React4.useState(false);
|
|
1356
|
+
const [addError, setAddError] = React4.useState("");
|
|
1357
|
+
const [newMarketplace, setNewMarketplace] = React4.useState({ name: "", github_repo: "" });
|
|
1358
|
+
const [deleteTarget, setDeleteTarget] = React4.useState(null);
|
|
1359
|
+
const [deleting, setDeleting] = React4.useState(false);
|
|
1360
|
+
const [deleteError, setDeleteError] = React4.useState("");
|
|
1039
1361
|
function resetAddForm() {
|
|
1040
1362
|
setNewMarketplace({ name: "", github_repo: "" });
|
|
1041
1363
|
setAddError("");
|
|
@@ -1197,8 +1519,8 @@ function PluginMarketplaceDetailPage({ marketplaceId, initialData, initialPlugin
|
|
|
1197
1519
|
(c) => c.pluginMarketplaces.listPlugins(marketplaceId),
|
|
1198
1520
|
initialPlugins ? { fallbackData: initialPlugins } : void 0
|
|
1199
1521
|
);
|
|
1200
|
-
const [tokenInput, setTokenInput] =
|
|
1201
|
-
const [savingToken, setSavingToken] =
|
|
1522
|
+
const [tokenInput, setTokenInput] = React4.useState("");
|
|
1523
|
+
const [savingToken, setSavingToken] = React4.useState(false);
|
|
1202
1524
|
async function handleSaveToken() {
|
|
1203
1525
|
setSavingToken(true);
|
|
1204
1526
|
try {
|
|
@@ -1395,15 +1717,15 @@ function PluginDetailPage({ marketplaceId, pluginName }) {
|
|
|
1395
1717
|
`marketplace-${marketplaceId}-plugin-${pluginName}`,
|
|
1396
1718
|
(c) => c.pluginMarketplaces.getPlugin(marketplaceId, pluginName)
|
|
1397
1719
|
);
|
|
1398
|
-
const [editorState, setEditorState] =
|
|
1399
|
-
const [pluginFiles, setPluginFiles] =
|
|
1400
|
-
const [filesLoading, setFilesLoading] =
|
|
1401
|
-
const [filesError, setFilesError] =
|
|
1402
|
-
const [editedContent, setEditedContent] =
|
|
1403
|
-
const [saving, setSaving] =
|
|
1404
|
-
const [saveError, setSaveError] =
|
|
1405
|
-
const [saveSuccess, setSaveSuccess] =
|
|
1406
|
-
const fetchFiles =
|
|
1720
|
+
const [editorState, setEditorState] = React4.useState(null);
|
|
1721
|
+
const [pluginFiles, setPluginFiles] = React4.useState(null);
|
|
1722
|
+
const [filesLoading, setFilesLoading] = React4.useState(false);
|
|
1723
|
+
const [filesError, setFilesError] = React4.useState("");
|
|
1724
|
+
const [editedContent, setEditedContent] = React4.useState(/* @__PURE__ */ new Map());
|
|
1725
|
+
const [saving, setSaving] = React4.useState(false);
|
|
1726
|
+
const [saveError, setSaveError] = React4.useState("");
|
|
1727
|
+
const [saveSuccess, setSaveSuccess] = React4.useState("");
|
|
1728
|
+
const fetchFiles = React4.useCallback(async () => {
|
|
1407
1729
|
if (pluginFiles) return pluginFiles;
|
|
1408
1730
|
setFilesLoading(true);
|
|
1409
1731
|
setFilesError("");
|
|
@@ -1418,7 +1740,7 @@ function PluginDetailPage({ marketplaceId, pluginName }) {
|
|
|
1418
1740
|
setFilesLoading(false);
|
|
1419
1741
|
}
|
|
1420
1742
|
}, [client, marketplaceId, pluginName, pluginFiles]);
|
|
1421
|
-
const handleSelectAgent =
|
|
1743
|
+
const handleSelectAgent = React4.useCallback(async (filename) => {
|
|
1422
1744
|
if (editorState?.type === "agent" && editorState.identifier === filename) {
|
|
1423
1745
|
setEditorState(null);
|
|
1424
1746
|
return;
|
|
@@ -1430,7 +1752,7 @@ function PluginDetailPage({ marketplaceId, pluginName }) {
|
|
|
1430
1752
|
setEditorState({ type: "agent", identifier: filename });
|
|
1431
1753
|
}
|
|
1432
1754
|
}, [editorState, fetchFiles]);
|
|
1433
|
-
const handleSelectSkill =
|
|
1755
|
+
const handleSelectSkill = React4.useCallback(async (skill) => {
|
|
1434
1756
|
if (editorState?.type === "skill" && editorState.identifier === skill) {
|
|
1435
1757
|
setEditorState(null);
|
|
1436
1758
|
return;
|
|
@@ -1442,7 +1764,7 @@ function PluginDetailPage({ marketplaceId, pluginName }) {
|
|
|
1442
1764
|
setEditorState({ type: "skill", identifier: skill });
|
|
1443
1765
|
}
|
|
1444
1766
|
}, [editorState, fetchFiles]);
|
|
1445
|
-
const handleSelectConnector =
|
|
1767
|
+
const handleSelectConnector = React4.useCallback(async () => {
|
|
1446
1768
|
if (editorState?.type === "connector") {
|
|
1447
1769
|
setEditorState(null);
|
|
1448
1770
|
return;
|
|
@@ -1683,12 +2005,12 @@ function SettingsPage({ initialData, hideDangerZone }) {
|
|
|
1683
2005
|
}
|
|
1684
2006
|
function CompanyForm({ tenant, onSaved }) {
|
|
1685
2007
|
const client = chunkXXF4U7WL_cjs.useAgentPlaneClient();
|
|
1686
|
-
const fileInputRef =
|
|
1687
|
-
const [name, setName] =
|
|
1688
|
-
const [budget, setBudget] =
|
|
1689
|
-
const [timezone, setTimezone] =
|
|
1690
|
-
const [logoUrl, setLogoUrl] =
|
|
1691
|
-
const [saving, setSaving] =
|
|
2008
|
+
const fileInputRef = React4.useRef(null);
|
|
2009
|
+
const [name, setName] = React4.useState(tenant.name);
|
|
2010
|
+
const [budget, setBudget] = React4.useState(tenant.monthly_budget_usd.toString());
|
|
2011
|
+
const [timezone, setTimezone] = React4.useState(tenant.timezone);
|
|
2012
|
+
const [logoUrl, setLogoUrl] = React4.useState(tenant.logo_url ?? "");
|
|
2013
|
+
const [saving, setSaving] = React4.useState(false);
|
|
1692
2014
|
const isDirty = name !== tenant.name || budget !== tenant.monthly_budget_usd.toString() || timezone !== tenant.timezone || (logoUrl || "") !== (tenant.logo_url ?? "");
|
|
1693
2015
|
async function handleSave() {
|
|
1694
2016
|
setSaving(true);
|
|
@@ -1762,13 +2084,13 @@ function CompanyForm({ tenant, onSaved }) {
|
|
|
1762
2084
|
}
|
|
1763
2085
|
function ApiKeysSection({ initialKeys, onChanged }) {
|
|
1764
2086
|
const client = chunkXXF4U7WL_cjs.useAgentPlaneClient();
|
|
1765
|
-
const [creating, setCreating] =
|
|
1766
|
-
const [newKeyName, setNewKeyName] =
|
|
1767
|
-
const [showCreate, setShowCreate] =
|
|
1768
|
-
const [rawKey, setRawKey] =
|
|
1769
|
-
const [revokeTarget, setRevokeTarget] =
|
|
1770
|
-
const [revoking, setRevoking] =
|
|
1771
|
-
const [revokeError, setRevokeError] =
|
|
2087
|
+
const [creating, setCreating] = React4.useState(false);
|
|
2088
|
+
const [newKeyName, setNewKeyName] = React4.useState("default");
|
|
2089
|
+
const [showCreate, setShowCreate] = React4.useState(false);
|
|
2090
|
+
const [rawKey, setRawKey] = React4.useState(null);
|
|
2091
|
+
const [revokeTarget, setRevokeTarget] = React4.useState(null);
|
|
2092
|
+
const [revoking, setRevoking] = React4.useState(false);
|
|
2093
|
+
const [revokeError, setRevokeError] = React4.useState("");
|
|
1772
2094
|
async function handleCreate() {
|
|
1773
2095
|
setCreating(true);
|
|
1774
2096
|
try {
|
|
@@ -1889,9 +2211,9 @@ function ApiKeysSection({ initialKeys, onChanged }) {
|
|
|
1889
2211
|
function DangerZone({ tenantId, tenantName }) {
|
|
1890
2212
|
const client = chunkXXF4U7WL_cjs.useAgentPlaneClient();
|
|
1891
2213
|
const { onNavigate, basePath } = chunkXXF4U7WL_cjs.useNavigation();
|
|
1892
|
-
const [open, setOpen] =
|
|
1893
|
-
const [deleting, setDeleting] =
|
|
1894
|
-
const [error, setError] =
|
|
2214
|
+
const [open, setOpen] = React4.useState(false);
|
|
2215
|
+
const [deleting, setDeleting] = React4.useState(false);
|
|
2216
|
+
const [error, setError] = React4.useState("");
|
|
1895
2217
|
async function handleDelete() {
|
|
1896
2218
|
setDeleting(true);
|
|
1897
2219
|
setError("");
|
|
@@ -1972,14 +2294,14 @@ var TAG_TITLES = {
|
|
|
1972
2294
|
};
|
|
1973
2295
|
function ModelSelector({ value, onChange, disabled }) {
|
|
1974
2296
|
const client = chunkXXF4U7WL_cjs.useAgentPlaneClient();
|
|
1975
|
-
const [open, setOpen] =
|
|
1976
|
-
const [models, setModels] =
|
|
1977
|
-
const [loading, setLoading] =
|
|
1978
|
-
const [error, setError] =
|
|
1979
|
-
const [search, setSearch] =
|
|
1980
|
-
const [providerFilter, setProviderFilter] =
|
|
1981
|
-
const hasFetchedRef =
|
|
1982
|
-
|
|
2297
|
+
const [open, setOpen] = React4.useState(false);
|
|
2298
|
+
const [models, setModels] = React4.useState(null);
|
|
2299
|
+
const [loading, setLoading] = React4.useState(false);
|
|
2300
|
+
const [error, setError] = React4.useState(false);
|
|
2301
|
+
const [search, setSearch] = React4.useState("");
|
|
2302
|
+
const [providerFilter, setProviderFilter] = React4.useState("all");
|
|
2303
|
+
const hasFetchedRef = React4.useRef(false);
|
|
2304
|
+
React4.useEffect(() => {
|
|
1983
2305
|
if (!open || hasFetchedRef.current) return;
|
|
1984
2306
|
hasFetchedRef.current = true;
|
|
1985
2307
|
let cancelled = false;
|
|
@@ -2000,12 +2322,12 @@ function ModelSelector({ value, onChange, disabled }) {
|
|
|
2000
2322
|
cancelled = true;
|
|
2001
2323
|
};
|
|
2002
2324
|
}, [open, client]);
|
|
2003
|
-
const providers =
|
|
2325
|
+
const providers = React4.useMemo(() => {
|
|
2004
2326
|
if (!models) return [];
|
|
2005
2327
|
const set = new Set(models.map((m) => m.provider));
|
|
2006
2328
|
return Array.from(set).sort();
|
|
2007
2329
|
}, [models]);
|
|
2008
|
-
const grouped =
|
|
2330
|
+
const grouped = React4.useMemo(() => {
|
|
2009
2331
|
if (!models) return {};
|
|
2010
2332
|
let filtered = models;
|
|
2011
2333
|
if (providerFilter !== "all") {
|
|
@@ -2021,7 +2343,7 @@ function ModelSelector({ value, onChange, disabled }) {
|
|
|
2021
2343
|
}, [models, providerFilter]);
|
|
2022
2344
|
const selectedModel = models?.find((m) => m.id === value);
|
|
2023
2345
|
const displayName = selectedModel?.name || value || "Select model...";
|
|
2024
|
-
const searchMatchesAny =
|
|
2346
|
+
const searchMatchesAny = React4.useMemo(() => {
|
|
2025
2347
|
if (!search || !models) return true;
|
|
2026
2348
|
const lower = search.toLowerCase();
|
|
2027
2349
|
return models.some(
|
|
@@ -2176,10 +2498,10 @@ function ModelSelector({ value, onChange, disabled }) {
|
|
|
2176
2498
|
}
|
|
2177
2499
|
function AddAgentDialog({ onCreated }) {
|
|
2178
2500
|
const client = chunkXXF4U7WL_cjs.useAgentPlaneClient();
|
|
2179
|
-
const [open, setOpen] =
|
|
2180
|
-
const [saving, setSaving] =
|
|
2181
|
-
const [error, setError] =
|
|
2182
|
-
const [form, setForm] =
|
|
2501
|
+
const [open, setOpen] = React4.useState(false);
|
|
2502
|
+
const [saving, setSaving] = React4.useState(false);
|
|
2503
|
+
const [error, setError] = React4.useState("");
|
|
2504
|
+
const [form, setForm] = React4.useState({
|
|
2183
2505
|
name: "",
|
|
2184
2506
|
description: "",
|
|
2185
2507
|
model: "claude-sonnet-4-6",
|
|
@@ -2348,9 +2670,9 @@ function AddAgentDialog({ onCreated }) {
|
|
|
2348
2670
|
}
|
|
2349
2671
|
function DeleteAgentButton({ agentId, agentName, onDeleted }) {
|
|
2350
2672
|
const client = chunkXXF4U7WL_cjs.useAgentPlaneClient();
|
|
2351
|
-
const [open, setOpen] =
|
|
2352
|
-
const [deleting, setDeleting] =
|
|
2353
|
-
const [error, setError] =
|
|
2673
|
+
const [open, setOpen] = React4.useState(false);
|
|
2674
|
+
const [deleting, setDeleting] = React4.useState(false);
|
|
2675
|
+
const [error, setError] = React4.useState("");
|
|
2354
2676
|
async function handleDelete() {
|
|
2355
2677
|
setDeleting(true);
|
|
2356
2678
|
setError("");
|
|
@@ -2403,7 +2725,7 @@ function AgentListPage() {
|
|
|
2403
2725
|
(client) => client.agents.list()
|
|
2404
2726
|
);
|
|
2405
2727
|
const agents = data?.data ?? [];
|
|
2406
|
-
const invalidate =
|
|
2728
|
+
const invalidate = React4.useCallback(() => {
|
|
2407
2729
|
mutate("agents");
|
|
2408
2730
|
}, [mutate]);
|
|
2409
2731
|
if (isLoading) {
|
|
@@ -2450,17 +2772,17 @@ function AgentListPage() {
|
|
|
2450
2772
|
}
|
|
2451
2773
|
function AgentEditForm({ agent, onSaved }) {
|
|
2452
2774
|
const client = chunkXXF4U7WL_cjs.useAgentPlaneClient();
|
|
2453
|
-
const [name, setName] =
|
|
2454
|
-
const [description, setDescription] =
|
|
2455
|
-
const [model, setModel] =
|
|
2456
|
-
const [runner, setRunner] =
|
|
2457
|
-
const [permissionMode, setPermissionMode] =
|
|
2458
|
-
const [maxTurns, setMaxTurns] =
|
|
2459
|
-
const [maxBudget, setMaxBudget] =
|
|
2460
|
-
const [maxRuntime, setMaxRuntime] =
|
|
2461
|
-
const [saving, setSaving] =
|
|
2775
|
+
const [name, setName] = React4.useState(agent.name);
|
|
2776
|
+
const [description, setDescription] = React4.useState(agent.description ?? "");
|
|
2777
|
+
const [model, setModel] = React4.useState(agent.model);
|
|
2778
|
+
const [runner, setRunner] = React4.useState(agent.runner ?? "");
|
|
2779
|
+
const [permissionMode, setPermissionMode] = React4.useState(agent.permission_mode);
|
|
2780
|
+
const [maxTurns, setMaxTurns] = React4.useState(agent.max_turns.toString());
|
|
2781
|
+
const [maxBudget, setMaxBudget] = React4.useState(agent.max_budget_usd.toString());
|
|
2782
|
+
const [maxRuntime, setMaxRuntime] = React4.useState(Math.floor(agent.max_runtime_seconds / 60).toString());
|
|
2783
|
+
const [saving, setSaving] = React4.useState(false);
|
|
2462
2784
|
const isDirty = name !== agent.name || description !== (agent.description ?? "") || model !== agent.model || runner !== (agent.runner ?? "") || permissionMode !== agent.permission_mode || maxTurns !== agent.max_turns.toString() || maxBudget !== agent.max_budget_usd.toString() || maxRuntime !== Math.floor(agent.max_runtime_seconds / 60).toString();
|
|
2463
|
-
const [error, setError] =
|
|
2785
|
+
const [error, setError] = React4.useState("");
|
|
2464
2786
|
async function handleSave() {
|
|
2465
2787
|
setSaving(true);
|
|
2466
2788
|
setError("");
|
|
@@ -2540,17 +2862,17 @@ function AgentEditForm({ agent, onSaved }) {
|
|
|
2540
2862
|
}
|
|
2541
2863
|
function ToolkitMultiselect({ value, onChange }) {
|
|
2542
2864
|
const client = chunkXXF4U7WL_cjs.useAgentPlaneClient();
|
|
2543
|
-
const [open, setOpen] =
|
|
2544
|
-
const [search, setSearch] =
|
|
2545
|
-
const [toolkits, setToolkits] =
|
|
2546
|
-
const [loading, setLoading] =
|
|
2547
|
-
const containerRef =
|
|
2548
|
-
const searchRef =
|
|
2549
|
-
|
|
2865
|
+
const [open, setOpen] = React4.useState(false);
|
|
2866
|
+
const [search, setSearch] = React4.useState("");
|
|
2867
|
+
const [toolkits, setToolkits] = React4.useState([]);
|
|
2868
|
+
const [loading, setLoading] = React4.useState(true);
|
|
2869
|
+
const containerRef = React4.useRef(null);
|
|
2870
|
+
const searchRef = React4.useRef(null);
|
|
2871
|
+
React4.useEffect(() => {
|
|
2550
2872
|
client.composio.toolkits().then((data) => setToolkits(data)).catch(() => {
|
|
2551
2873
|
}).finally(() => setLoading(false));
|
|
2552
2874
|
}, [client]);
|
|
2553
|
-
|
|
2875
|
+
React4.useEffect(() => {
|
|
2554
2876
|
function handleClick(e) {
|
|
2555
2877
|
if (containerRef.current && !containerRef.current.contains(e.target)) {
|
|
2556
2878
|
setOpen(false);
|
|
@@ -2560,7 +2882,7 @@ function ToolkitMultiselect({ value, onChange }) {
|
|
|
2560
2882
|
document.addEventListener("mousedown", handleClick);
|
|
2561
2883
|
return () => document.removeEventListener("mousedown", handleClick);
|
|
2562
2884
|
}, []);
|
|
2563
|
-
|
|
2885
|
+
React4.useEffect(() => {
|
|
2564
2886
|
searchRef.current?.focus();
|
|
2565
2887
|
}, []);
|
|
2566
2888
|
const filtered = toolkits.filter((t) => {
|
|
@@ -2666,12 +2988,12 @@ function ToolsModal({
|
|
|
2666
2988
|
onSave
|
|
2667
2989
|
}) {
|
|
2668
2990
|
const client = chunkXXF4U7WL_cjs.useAgentPlaneClient();
|
|
2669
|
-
const [tools, setTools] =
|
|
2670
|
-
const [loading, setLoading] =
|
|
2671
|
-
const [search, setSearch] =
|
|
2672
|
-
const [selected, setSelected] =
|
|
2673
|
-
const [saving, setSaving] =
|
|
2674
|
-
const fetchTools =
|
|
2991
|
+
const [tools, setTools] = React4.useState([]);
|
|
2992
|
+
const [loading, setLoading] = React4.useState(false);
|
|
2993
|
+
const [search, setSearch] = React4.useState("");
|
|
2994
|
+
const [selected, setSelected] = React4.useState(/* @__PURE__ */ new Set());
|
|
2995
|
+
const [saving, setSaving] = React4.useState(false);
|
|
2996
|
+
const fetchTools = React4.useCallback(async () => {
|
|
2675
2997
|
setLoading(true);
|
|
2676
2998
|
try {
|
|
2677
2999
|
const data = await client.composio.tools(toolkit);
|
|
@@ -2680,7 +3002,7 @@ function ToolsModal({
|
|
|
2680
3002
|
setLoading(false);
|
|
2681
3003
|
}
|
|
2682
3004
|
}, [toolkit, client]);
|
|
2683
|
-
|
|
3005
|
+
React4.useEffect(() => {
|
|
2684
3006
|
if (open) {
|
|
2685
3007
|
fetchTools();
|
|
2686
3008
|
setSearch("");
|
|
@@ -2771,13 +3093,13 @@ function McpToolsModal({
|
|
|
2771
3093
|
onSave
|
|
2772
3094
|
}) {
|
|
2773
3095
|
const client = chunkXXF4U7WL_cjs.useAgentPlaneClient();
|
|
2774
|
-
const [tools, setTools] =
|
|
2775
|
-
const [loading, setLoading] =
|
|
2776
|
-
const [search, setSearch] =
|
|
2777
|
-
const [selected, setSelected] =
|
|
2778
|
-
const [saving, setSaving] =
|
|
2779
|
-
const [error, setError] =
|
|
2780
|
-
const fetchTools =
|
|
3096
|
+
const [tools, setTools] = React4.useState([]);
|
|
3097
|
+
const [loading, setLoading] = React4.useState(false);
|
|
3098
|
+
const [search, setSearch] = React4.useState("");
|
|
3099
|
+
const [selected, setSelected] = React4.useState(/* @__PURE__ */ new Set());
|
|
3100
|
+
const [saving, setSaving] = React4.useState(false);
|
|
3101
|
+
const [error, setError] = React4.useState("");
|
|
3102
|
+
const fetchTools = React4.useCallback(async () => {
|
|
2781
3103
|
setLoading(true);
|
|
2782
3104
|
setError("");
|
|
2783
3105
|
try {
|
|
@@ -2789,7 +3111,7 @@ function McpToolsModal({
|
|
|
2789
3111
|
setLoading(false);
|
|
2790
3112
|
}
|
|
2791
3113
|
}, [agentId, mcpServerId, client]);
|
|
2792
|
-
|
|
3114
|
+
React4.useEffect(() => {
|
|
2793
3115
|
if (open) {
|
|
2794
3116
|
fetchTools();
|
|
2795
3117
|
setSearch("");
|
|
@@ -2869,30 +3191,30 @@ function McpToolsModal({
|
|
|
2869
3191
|
}
|
|
2870
3192
|
function AgentConnectorsManager({ agentId, toolkits: initialToolkits, composioAllowedTools: initialAllowedTools, onChanged }) {
|
|
2871
3193
|
const client = chunkXXF4U7WL_cjs.useAgentPlaneClient();
|
|
2872
|
-
const [localToolkits, setLocalToolkits] =
|
|
2873
|
-
const [connectors, setConnectors] =
|
|
2874
|
-
const [loading, setLoading] =
|
|
2875
|
-
const [showAdd, setShowAdd] =
|
|
2876
|
-
const [pendingToolkits, setPendingToolkits] =
|
|
2877
|
-
const [applyingToolkits, setApplyingToolkits] =
|
|
2878
|
-
const [confirmDelete, setConfirmDelete] =
|
|
2879
|
-
const [deleting, setDeleting] =
|
|
2880
|
-
const [apiKeys, setApiKeys] =
|
|
2881
|
-
const [saving, setSaving] =
|
|
2882
|
-
const [errors, setErrors] =
|
|
2883
|
-
const [allowedTools, setAllowedTools] =
|
|
2884
|
-
const [toolCounts, setToolCounts] =
|
|
2885
|
-
const [toolsModalToolkit, setToolsModalToolkit] =
|
|
2886
|
-
const mcpOauthHandlerRef =
|
|
2887
|
-
const composioOauthHandlerRef =
|
|
2888
|
-
const [mcpConnections, setMcpConnections] =
|
|
2889
|
-
const [mcpServers, setMcpServers] =
|
|
2890
|
-
const [mcpLoading, setMcpLoading] =
|
|
2891
|
-
const [mcpConnecting, setMcpConnecting] =
|
|
2892
|
-
const [confirmMcpDisconnect, setConfirmMcpDisconnect] =
|
|
2893
|
-
const [mcpDisconnecting, setMcpDisconnecting] =
|
|
2894
|
-
const [mcpToolsModal, setMcpToolsModal] =
|
|
2895
|
-
const loadComposio =
|
|
3194
|
+
const [localToolkits, setLocalToolkits] = React4.useState(initialToolkits);
|
|
3195
|
+
const [connectors, setConnectors] = React4.useState([]);
|
|
3196
|
+
const [loading, setLoading] = React4.useState(true);
|
|
3197
|
+
const [showAdd, setShowAdd] = React4.useState(false);
|
|
3198
|
+
const [pendingToolkits, setPendingToolkits] = React4.useState(initialToolkits);
|
|
3199
|
+
const [applyingToolkits, setApplyingToolkits] = React4.useState(false);
|
|
3200
|
+
const [confirmDelete, setConfirmDelete] = React4.useState(null);
|
|
3201
|
+
const [deleting, setDeleting] = React4.useState(false);
|
|
3202
|
+
const [apiKeys, setApiKeys] = React4.useState({});
|
|
3203
|
+
const [saving, setSaving] = React4.useState({});
|
|
3204
|
+
const [errors, setErrors] = React4.useState({});
|
|
3205
|
+
const [allowedTools, setAllowedTools] = React4.useState(initialAllowedTools);
|
|
3206
|
+
const [toolCounts, setToolCounts] = React4.useState({});
|
|
3207
|
+
const [toolsModalToolkit, setToolsModalToolkit] = React4.useState(null);
|
|
3208
|
+
const mcpOauthHandlerRef = React4.useRef(null);
|
|
3209
|
+
const composioOauthHandlerRef = React4.useRef(null);
|
|
3210
|
+
const [mcpConnections, setMcpConnections] = React4.useState([]);
|
|
3211
|
+
const [mcpServers, setMcpServers] = React4.useState([]);
|
|
3212
|
+
const [mcpLoading, setMcpLoading] = React4.useState(true);
|
|
3213
|
+
const [mcpConnecting, setMcpConnecting] = React4.useState(null);
|
|
3214
|
+
const [confirmMcpDisconnect, setConfirmMcpDisconnect] = React4.useState(null);
|
|
3215
|
+
const [mcpDisconnecting, setMcpDisconnecting] = React4.useState(false);
|
|
3216
|
+
const [mcpToolsModal, setMcpToolsModal] = React4.useState(null);
|
|
3217
|
+
const loadComposio = React4.useCallback(async () => {
|
|
2896
3218
|
setLoading(true);
|
|
2897
3219
|
try {
|
|
2898
3220
|
const data = await client.connectors.list(agentId);
|
|
@@ -2901,7 +3223,7 @@ function AgentConnectorsManager({ agentId, toolkits: initialToolkits, composioAl
|
|
|
2901
3223
|
setLoading(false);
|
|
2902
3224
|
}
|
|
2903
3225
|
}, [agentId, client]);
|
|
2904
|
-
const loadMcp =
|
|
3226
|
+
const loadMcp = React4.useCallback(async () => {
|
|
2905
3227
|
setMcpLoading(true);
|
|
2906
3228
|
try {
|
|
2907
3229
|
const data = await client.customConnectors.list(agentId);
|
|
@@ -2911,13 +3233,13 @@ function AgentConnectorsManager({ agentId, toolkits: initialToolkits, composioAl
|
|
|
2911
3233
|
}
|
|
2912
3234
|
}, [agentId, client]);
|
|
2913
3235
|
const toolkitsKey = localToolkits.join(",");
|
|
2914
|
-
|
|
3236
|
+
React4.useEffect(() => {
|
|
2915
3237
|
loadComposio();
|
|
2916
3238
|
}, [loadComposio, toolkitsKey]);
|
|
2917
|
-
|
|
3239
|
+
React4.useEffect(() => {
|
|
2918
3240
|
loadMcp();
|
|
2919
3241
|
}, [loadMcp]);
|
|
2920
|
-
|
|
3242
|
+
React4.useEffect(() => {
|
|
2921
3243
|
return () => {
|
|
2922
3244
|
if (mcpOauthHandlerRef.current) {
|
|
2923
3245
|
window.removeEventListener("message", mcpOauthHandlerRef.current);
|
|
@@ -2929,7 +3251,7 @@ function AgentConnectorsManager({ agentId, toolkits: initialToolkits, composioAl
|
|
|
2929
3251
|
}
|
|
2930
3252
|
};
|
|
2931
3253
|
}, []);
|
|
2932
|
-
|
|
3254
|
+
React4.useEffect(() => {
|
|
2933
3255
|
if (localToolkits.length === 0) return;
|
|
2934
3256
|
let cancelled = false;
|
|
2935
3257
|
for (const slug of localToolkits) {
|
|
@@ -3292,7 +3614,7 @@ function AgentConnectorsManager({ agentId, toolkits: initialToolkits, composioAl
|
|
|
3292
3614
|
)
|
|
3293
3615
|
] });
|
|
3294
3616
|
}
|
|
3295
|
-
var CodeEditor =
|
|
3617
|
+
var CodeEditor = React4.lazy(() => import('./code-editor-ZYP54YUT.cjs'));
|
|
3296
3618
|
function buildTree(files) {
|
|
3297
3619
|
const rootFiles = [];
|
|
3298
3620
|
const dirMap = /* @__PURE__ */ new Map();
|
|
@@ -3365,49 +3687,49 @@ function FileTreeEditor2({
|
|
|
3365
3687
|
fixedStructure = false,
|
|
3366
3688
|
headerActions
|
|
3367
3689
|
}) {
|
|
3368
|
-
const [files, setFiles] =
|
|
3369
|
-
const [selectedPath, setSelectedPath] =
|
|
3690
|
+
const [files, setFiles] = React4.useState(initialFiles);
|
|
3691
|
+
const [selectedPath, setSelectedPath] = React4.useState(
|
|
3370
3692
|
initialFiles.length > 0 ? initialFiles[0].path : null
|
|
3371
3693
|
);
|
|
3372
|
-
const [saving, setSaving] =
|
|
3373
|
-
const [expanded, setExpanded] =
|
|
3694
|
+
const [saving, setSaving] = React4.useState(false);
|
|
3695
|
+
const [expanded, setExpanded] = React4.useState(() => {
|
|
3374
3696
|
const { rootDirs } = buildTree(initialFiles);
|
|
3375
3697
|
return collectAllDirPaths(rootDirs);
|
|
3376
3698
|
});
|
|
3377
|
-
const [showAddFolder, setShowAddFolder] =
|
|
3378
|
-
const [newFolderName, setNewFolderName] =
|
|
3379
|
-
const [addingFileInDir, setAddingFileInDir] =
|
|
3380
|
-
const [newFileName, setNewFileName] =
|
|
3381
|
-
const [savedSnapshot, setSavedSnapshot] =
|
|
3382
|
-
|
|
3699
|
+
const [showAddFolder, setShowAddFolder] = React4.useState(false);
|
|
3700
|
+
const [newFolderName, setNewFolderName] = React4.useState("");
|
|
3701
|
+
const [addingFileInDir, setAddingFileInDir] = React4.useState(null);
|
|
3702
|
+
const [newFileName, setNewFileName] = React4.useState("");
|
|
3703
|
+
const [savedSnapshot, setSavedSnapshot] = React4.useState(() => JSON.stringify(initialFiles));
|
|
3704
|
+
React4.useEffect(() => {
|
|
3383
3705
|
const snap = JSON.stringify(initialFiles);
|
|
3384
3706
|
setSavedSnapshot(snap);
|
|
3385
3707
|
setFiles(initialFiles);
|
|
3386
3708
|
const { rootDirs } = buildTree(initialFiles);
|
|
3387
3709
|
setExpanded(collectAllDirPaths(rootDirs));
|
|
3388
3710
|
}, [initialFiles]);
|
|
3389
|
-
|
|
3711
|
+
React4.useEffect(() => {
|
|
3390
3712
|
if (savedVersion !== void 0 && savedVersion > 0) {
|
|
3391
3713
|
setSavedSnapshot(JSON.stringify(files));
|
|
3392
3714
|
}
|
|
3393
3715
|
}, [savedVersion]);
|
|
3394
|
-
const onChangeRef =
|
|
3716
|
+
const onChangeRef = React4.useRef(onChange);
|
|
3395
3717
|
onChangeRef.current = onChange;
|
|
3396
|
-
|
|
3718
|
+
React4.useEffect(() => {
|
|
3397
3719
|
if (onChangeRef.current && JSON.stringify(files) !== savedSnapshot) {
|
|
3398
3720
|
onChangeRef.current(files);
|
|
3399
3721
|
}
|
|
3400
3722
|
}, [files, savedSnapshot]);
|
|
3401
|
-
const isDirty =
|
|
3723
|
+
const isDirty = React4.useMemo(
|
|
3402
3724
|
() => JSON.stringify(files) !== savedSnapshot,
|
|
3403
3725
|
[files, savedSnapshot]
|
|
3404
3726
|
);
|
|
3405
|
-
const tree =
|
|
3406
|
-
const activeFile =
|
|
3727
|
+
const tree = React4.useMemo(() => buildTree(files), [files]);
|
|
3728
|
+
const activeFile = React4.useMemo(
|
|
3407
3729
|
() => selectedPath ? files.find((f) => f.path === selectedPath) ?? null : null,
|
|
3408
3730
|
[files, selectedPath]
|
|
3409
3731
|
);
|
|
3410
|
-
const handleEditorChange =
|
|
3732
|
+
const handleEditorChange = React4.useCallback((value) => {
|
|
3411
3733
|
if (readOnly || !selectedPath) return;
|
|
3412
3734
|
setFiles((prev) => prev.map((f) => f.path === selectedPath ? { ...f, content: value } : f));
|
|
3413
3735
|
}, [readOnly, selectedPath]);
|
|
@@ -3619,7 +3941,7 @@ function FileTreeEditor2({
|
|
|
3619
3941
|
] }),
|
|
3620
3942
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 border border-border rounded-md overflow-hidden", children: activeFile ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "h-full flex flex-col", children: [
|
|
3621
3943
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-3 py-1.5 bg-muted/50 border-b border-border text-xs text-muted-foreground", children: activeFile.path }),
|
|
3622
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3944
|
+
/* @__PURE__ */ jsxRuntime.jsx(React4.Suspense, { fallback: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 animate-pulse bg-muted/50" }), children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3623
3945
|
CodeEditor,
|
|
3624
3946
|
{
|
|
3625
3947
|
value: activeFile.content,
|
|
@@ -3649,19 +3971,19 @@ function TabButton({ label, active, onClick }) {
|
|
|
3649
3971
|
}
|
|
3650
3972
|
function ImportSkillDialog({ open, onOpenChange, onImported, existingFolders }) {
|
|
3651
3973
|
const client = chunkXXF4U7WL_cjs.useAgentPlaneClient();
|
|
3652
|
-
const [tab, setTab] =
|
|
3653
|
-
const [entries, setEntries] =
|
|
3654
|
-
const [loading, setLoading] =
|
|
3655
|
-
const [error, setError] =
|
|
3656
|
-
const [search, setSearch] =
|
|
3657
|
-
const [selected, setSelected] =
|
|
3658
|
-
const [preview, setPreview] =
|
|
3659
|
-
const [previewLoading, setPreviewLoading] =
|
|
3660
|
-
const [importing, setImporting] =
|
|
3661
|
-
const [importError, setImportError] =
|
|
3662
|
-
const [url, setUrl] =
|
|
3663
|
-
const [urlImporting, setUrlImporting] =
|
|
3664
|
-
|
|
3974
|
+
const [tab, setTab] = React4.useState("all");
|
|
3975
|
+
const [entries, setEntries] = React4.useState([]);
|
|
3976
|
+
const [loading, setLoading] = React4.useState(false);
|
|
3977
|
+
const [error, setError] = React4.useState("");
|
|
3978
|
+
const [search, setSearch] = React4.useState("");
|
|
3979
|
+
const [selected, setSelected] = React4.useState(null);
|
|
3980
|
+
const [preview, setPreview] = React4.useState("");
|
|
3981
|
+
const [previewLoading, setPreviewLoading] = React4.useState(false);
|
|
3982
|
+
const [importing, setImporting] = React4.useState(false);
|
|
3983
|
+
const [importError, setImportError] = React4.useState("");
|
|
3984
|
+
const [url, setUrl] = React4.useState("");
|
|
3985
|
+
const [urlImporting, setUrlImporting] = React4.useState(false);
|
|
3986
|
+
React4.useEffect(() => {
|
|
3665
3987
|
if (!open) return;
|
|
3666
3988
|
setLoading(true);
|
|
3667
3989
|
setError("");
|
|
@@ -3669,7 +3991,7 @@ function ImportSkillDialog({ open, onOpenChange, onImported, existingFolders })
|
|
|
3669
3991
|
setPreview("");
|
|
3670
3992
|
client.skillsDirectory.list(tab).then((data) => setEntries(data)).catch((err) => setError(err instanceof Error ? err.message : "Failed to load skills")).finally(() => setLoading(false));
|
|
3671
3993
|
}, [tab, open, client]);
|
|
3672
|
-
const filtered =
|
|
3994
|
+
const filtered = React4.useMemo(() => {
|
|
3673
3995
|
if (!search.trim()) return entries;
|
|
3674
3996
|
const q = search.toLowerCase();
|
|
3675
3997
|
return entries.filter(
|
|
@@ -3805,10 +4127,10 @@ function ImportSkillDialog({ open, onOpenChange, onImported, existingFolders })
|
|
|
3805
4127
|
}
|
|
3806
4128
|
function AgentSkillManager({ agentId, initialSkills, onSaved }) {
|
|
3807
4129
|
const client = chunkXXF4U7WL_cjs.useAgentPlaneClient();
|
|
3808
|
-
const [importOpen, setImportOpen] =
|
|
3809
|
-
const [extraSkills, setExtraSkills] =
|
|
3810
|
-
const allSkills =
|
|
3811
|
-
const initialFiles =
|
|
4130
|
+
const [importOpen, setImportOpen] = React4.useState(false);
|
|
4131
|
+
const [extraSkills, setExtraSkills] = React4.useState([]);
|
|
4132
|
+
const allSkills = React4.useMemo(() => [...initialSkills, ...extraSkills], [initialSkills, extraSkills]);
|
|
4133
|
+
const initialFiles = React4.useMemo(
|
|
3812
4134
|
() => allSkills.flatMap(
|
|
3813
4135
|
(s) => s.files.map((f) => ({
|
|
3814
4136
|
path: s.folder === "(root)" ? f.path : `${s.folder}/${f.path}`,
|
|
@@ -3817,11 +4139,11 @@ function AgentSkillManager({ agentId, initialSkills, onSaved }) {
|
|
|
3817
4139
|
),
|
|
3818
4140
|
[allSkills]
|
|
3819
4141
|
);
|
|
3820
|
-
const existingFolders =
|
|
3821
|
-
const handleImported =
|
|
4142
|
+
const existingFolders = React4.useMemo(() => allSkills.map((s) => s.folder), [allSkills]);
|
|
4143
|
+
const handleImported = React4.useCallback((skill) => {
|
|
3822
4144
|
setExtraSkills((prev) => [...prev, skill]);
|
|
3823
4145
|
}, []);
|
|
3824
|
-
const handleSave =
|
|
4146
|
+
const handleSave = React4.useCallback(async (files) => {
|
|
3825
4147
|
const folderMap = /* @__PURE__ */ new Map();
|
|
3826
4148
|
for (const file of files) {
|
|
3827
4149
|
const slashIdx = file.path.lastIndexOf("/");
|
|
@@ -3871,24 +4193,24 @@ function AgentSkillManager({ agentId, initialSkills, onSaved }) {
|
|
|
3871
4193
|
}
|
|
3872
4194
|
function AgentPluginManager({ agentId, initialPlugins, onSaved }) {
|
|
3873
4195
|
const client = chunkXXF4U7WL_cjs.useAgentPlaneClient();
|
|
3874
|
-
const [plugins, setPlugins] =
|
|
3875
|
-
const [saving, setSaving] =
|
|
3876
|
-
const [dialogOpen, setDialogOpen] =
|
|
3877
|
-
const [marketplaces, setMarketplaces] =
|
|
3878
|
-
const [selectedMarketplace, setSelectedMarketplace] =
|
|
3879
|
-
const [availablePlugins, setAvailablePlugins] =
|
|
3880
|
-
const [loadingPlugins, setLoadingPlugins] =
|
|
3881
|
-
const [marketplaceNames, setMarketplaceNames] =
|
|
3882
|
-
const savedSnapshot =
|
|
3883
|
-
|
|
4196
|
+
const [plugins, setPlugins] = React4.useState(initialPlugins);
|
|
4197
|
+
const [saving, setSaving] = React4.useState(false);
|
|
4198
|
+
const [dialogOpen, setDialogOpen] = React4.useState(false);
|
|
4199
|
+
const [marketplaces, setMarketplaces] = React4.useState([]);
|
|
4200
|
+
const [selectedMarketplace, setSelectedMarketplace] = React4.useState(null);
|
|
4201
|
+
const [availablePlugins, setAvailablePlugins] = React4.useState([]);
|
|
4202
|
+
const [loadingPlugins, setLoadingPlugins] = React4.useState(false);
|
|
4203
|
+
const [marketplaceNames, setMarketplaceNames] = React4.useState({});
|
|
4204
|
+
const savedSnapshot = React4.useRef(JSON.stringify(initialPlugins));
|
|
4205
|
+
React4.useEffect(() => {
|
|
3884
4206
|
savedSnapshot.current = JSON.stringify(initialPlugins);
|
|
3885
4207
|
setPlugins(initialPlugins);
|
|
3886
4208
|
}, [initialPlugins]);
|
|
3887
|
-
const isDirty =
|
|
4209
|
+
const isDirty = React4.useMemo(
|
|
3888
4210
|
() => JSON.stringify(plugins) !== savedSnapshot.current,
|
|
3889
4211
|
[plugins]
|
|
3890
4212
|
);
|
|
3891
|
-
|
|
4213
|
+
React4.useEffect(() => {
|
|
3892
4214
|
client.pluginMarketplaces.list().then((data) => {
|
|
3893
4215
|
setMarketplaces(data);
|
|
3894
4216
|
const names = {};
|
|
@@ -3897,7 +4219,7 @@ function AgentPluginManager({ agentId, initialPlugins, onSaved }) {
|
|
|
3897
4219
|
}).catch(() => {
|
|
3898
4220
|
});
|
|
3899
4221
|
}, [client]);
|
|
3900
|
-
const loadPluginsForMarketplace =
|
|
4222
|
+
const loadPluginsForMarketplace = React4.useCallback(async (marketplaceId) => {
|
|
3901
4223
|
setSelectedMarketplace(marketplaceId);
|
|
3902
4224
|
setLoadingPlugins(true);
|
|
3903
4225
|
setAvailablePlugins([]);
|
|
@@ -4085,15 +4407,15 @@ function AgentA2aInfo({
|
|
|
4085
4407
|
onChanged
|
|
4086
4408
|
}) {
|
|
4087
4409
|
const client = chunkXXF4U7WL_cjs.useAgentPlaneClient();
|
|
4088
|
-
const [enabled, setEnabled] =
|
|
4089
|
-
const [toggling, setToggling] =
|
|
4090
|
-
const [detailsOpen, setDetailsOpen] =
|
|
4091
|
-
const [cardPreview, setCardPreview] =
|
|
4092
|
-
const [loading, setLoading] =
|
|
4093
|
-
const [tags, setTags] =
|
|
4094
|
-
const [tagInput, setTagInput] =
|
|
4095
|
-
const [savingTags, setSavingTags] =
|
|
4096
|
-
const inputRef =
|
|
4410
|
+
const [enabled, setEnabled] = React4.useState(initialEnabled);
|
|
4411
|
+
const [toggling, setToggling] = React4.useState(false);
|
|
4412
|
+
const [detailsOpen, setDetailsOpen] = React4.useState(false);
|
|
4413
|
+
const [cardPreview, setCardPreview] = React4.useState(null);
|
|
4414
|
+
const [loading, setLoading] = React4.useState(false);
|
|
4415
|
+
const [tags, setTags] = React4.useState(initialTags);
|
|
4416
|
+
const [tagInput, setTagInput] = React4.useState("");
|
|
4417
|
+
const [savingTags, setSavingTags] = React4.useState(false);
|
|
4418
|
+
const inputRef = React4.useRef(null);
|
|
4097
4419
|
const endpointUrl = `${baseUrl}/api/a2a/${tenantSlug}/${agentSlug}`;
|
|
4098
4420
|
const jsonRpcUrl = `${baseUrl}/api/a2a/${tenantSlug}/${agentSlug}/jsonrpc`;
|
|
4099
4421
|
const agentCardUrl = `${baseUrl}/api/a2a/${tenantSlug}/${agentSlug}/.well-known/agent-card.json`;
|
|
@@ -4263,7 +4585,7 @@ function AgentA2aInfo({
|
|
|
4263
4585
|
] })
|
|
4264
4586
|
] });
|
|
4265
4587
|
}
|
|
4266
|
-
var AgentIdentityTab =
|
|
4588
|
+
var AgentIdentityTab = React4.lazy(() => import('./agent-identity-tab-YGMVWOWT.cjs').then((m) => ({ default: m.AgentIdentityTab })));
|
|
4267
4589
|
function AgentDetailPage({ agentId, a2aBaseUrl, tenantSlug, adminApiBaseUrl, adminApiKey }) {
|
|
4268
4590
|
const { LinkComponent, basePath } = chunkXXF4U7WL_cjs.useNavigation();
|
|
4269
4591
|
const { mutate } = swr.useSWRConfig();
|
|
@@ -4272,10 +4594,10 @@ function AgentDetailPage({ agentId, a2aBaseUrl, tenantSlug, adminApiBaseUrl, adm
|
|
|
4272
4594
|
cacheKey,
|
|
4273
4595
|
(client) => client.agents.get(agentId)
|
|
4274
4596
|
);
|
|
4275
|
-
const invalidate =
|
|
4597
|
+
const invalidate = React4.useCallback(() => {
|
|
4276
4598
|
mutate(cacheKey);
|
|
4277
4599
|
}, [mutate, cacheKey]);
|
|
4278
|
-
const adminFetch =
|
|
4600
|
+
const adminFetch = React4.useCallback(async (path, options) => {
|
|
4279
4601
|
if (!adminApiBaseUrl) throw new Error("Admin API not configured");
|
|
4280
4602
|
const res = await fetch(`${adminApiBaseUrl}${path}`, {
|
|
4281
4603
|
...options,
|
|
@@ -4291,7 +4613,7 @@ function AgentDetailPage({ agentId, a2aBaseUrl, tenantSlug, adminApiBaseUrl, adm
|
|
|
4291
4613
|
}
|
|
4292
4614
|
return res.json();
|
|
4293
4615
|
}, [adminApiBaseUrl, adminApiKey]);
|
|
4294
|
-
const soulCallbacks =
|
|
4616
|
+
const soulCallbacks = React4.useMemo(() => {
|
|
4295
4617
|
if (!adminApiBaseUrl) return {};
|
|
4296
4618
|
return {
|
|
4297
4619
|
onGenerateSoul: async () => {
|
|
@@ -4378,7 +4700,7 @@ function AgentDetailPage({ agentId, a2aBaseUrl, tenantSlug, adminApiBaseUrl, adm
|
|
|
4378
4700
|
},
|
|
4379
4701
|
{
|
|
4380
4702
|
label: "Identity",
|
|
4381
|
-
content: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4703
|
+
content: /* @__PURE__ */ jsxRuntime.jsx(React4.Suspense, { fallback: /* @__PURE__ */ jsxRuntime.jsx(chunkVZ43ATC5_cjs.Skeleton, { className: "h-64 w-full" }), children: /* @__PURE__ */ jsxRuntime.jsx(AgentIdentityTab, { agent, FileTreeEditor: chunkVZ43ATC5_cjs.FileTreeEditor, onSaved: invalidate, ...soulCallbacks }) })
|
|
4382
4704
|
},
|
|
4383
4705
|
{
|
|
4384
4706
|
label: "Connectors",
|
|
@@ -4463,12 +4785,12 @@ function ScheduleCard({
|
|
|
4463
4785
|
schedule,
|
|
4464
4786
|
timezone
|
|
4465
4787
|
}) {
|
|
4466
|
-
const [frequency, setFrequency] =
|
|
4467
|
-
const [time, setTime] =
|
|
4468
|
-
const [dayOfWeek, setDayOfWeek] =
|
|
4469
|
-
const [prompt, setPrompt] =
|
|
4470
|
-
const [enabled, setEnabled] =
|
|
4471
|
-
const [name, setName] =
|
|
4788
|
+
const [frequency, setFrequency] = React4.useState(schedule.frequency);
|
|
4789
|
+
const [time, setTime] = React4.useState(formatTimeForInput(schedule.time));
|
|
4790
|
+
const [dayOfWeek, setDayOfWeek] = React4.useState(schedule.day_of_week ?? 1);
|
|
4791
|
+
const [prompt, setPrompt] = React4.useState(schedule.prompt ?? "");
|
|
4792
|
+
const [enabled, setEnabled] = React4.useState(schedule.enabled);
|
|
4793
|
+
const [name, setName] = React4.useState(schedule.name ?? "");
|
|
4472
4794
|
const showTimePicker = ["daily", "weekdays", "weekly"].includes(frequency);
|
|
4473
4795
|
const showDayPicker = frequency === "weekly";
|
|
4474
4796
|
const canEnable = frequency !== "manual";
|
|
@@ -4571,7 +4893,7 @@ function MarkdownContent({ children }) {
|
|
|
4571
4893
|
) });
|
|
4572
4894
|
}
|
|
4573
4895
|
function CollapsibleJson({ data, maxHeight = "12rem" }) {
|
|
4574
|
-
const [expanded, setExpanded] =
|
|
4896
|
+
const [expanded, setExpanded] = React4.useState(false);
|
|
4575
4897
|
const json = typeof data === "string" ? data : JSON.stringify(data, null, 2);
|
|
4576
4898
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", children: [
|
|
4577
4899
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -4717,7 +5039,7 @@ function renderEvent(event, idx) {
|
|
|
4717
5039
|
/* @__PURE__ */ jsxRuntime.jsx(CollapsibleJson, { data: event, maxHeight: "8rem" })
|
|
4718
5040
|
] }, idx);
|
|
4719
5041
|
}
|
|
4720
|
-
var
|
|
5042
|
+
var TERMINAL_STATUSES2 = /* @__PURE__ */ new Set(["completed", "failed", "cancelled", "timed_out"]);
|
|
4721
5043
|
function PlaygroundPage({ agentId }) {
|
|
4722
5044
|
const client = chunkXXF4U7WL_cjs.useAgentPlaneClient();
|
|
4723
5045
|
const { LinkComponent, basePath } = chunkXXF4U7WL_cjs.useNavigation();
|
|
@@ -4725,30 +5047,30 @@ function PlaygroundPage({ agentId }) {
|
|
|
4725
5047
|
`agent-${agentId}`,
|
|
4726
5048
|
(c) => c.agents.get(agentId)
|
|
4727
5049
|
);
|
|
4728
|
-
const [prompt, setPrompt] =
|
|
4729
|
-
const [events, setEvents] =
|
|
4730
|
-
const [streamingText, setStreamingText] =
|
|
4731
|
-
const [running, setRunning] =
|
|
4732
|
-
const [polling, setPolling] =
|
|
4733
|
-
const [error, setError] =
|
|
4734
|
-
const [sessionId, setSessionId] =
|
|
4735
|
-
const sessionIdRef =
|
|
4736
|
-
const abortRef =
|
|
4737
|
-
const runIdRef =
|
|
4738
|
-
const streamRef =
|
|
4739
|
-
const scrollRef =
|
|
4740
|
-
const textareaRef =
|
|
4741
|
-
|
|
5050
|
+
const [prompt, setPrompt] = React4.useState("");
|
|
5051
|
+
const [events, setEvents] = React4.useState([]);
|
|
5052
|
+
const [streamingText, setStreamingText] = React4.useState("");
|
|
5053
|
+
const [running, setRunning] = React4.useState(false);
|
|
5054
|
+
const [polling, setPolling] = React4.useState(false);
|
|
5055
|
+
const [error, setError] = React4.useState(null);
|
|
5056
|
+
const [sessionId, setSessionId] = React4.useState(null);
|
|
5057
|
+
const sessionIdRef = React4.useRef(null);
|
|
5058
|
+
const abortRef = React4.useRef(null);
|
|
5059
|
+
const runIdRef = React4.useRef(null);
|
|
5060
|
+
const streamRef = React4.useRef(null);
|
|
5061
|
+
const scrollRef = React4.useRef(null);
|
|
5062
|
+
const textareaRef = React4.useRef(null);
|
|
5063
|
+
React4.useEffect(() => {
|
|
4742
5064
|
const el = scrollRef.current;
|
|
4743
5065
|
if (el) el.scrollTop = el.scrollHeight;
|
|
4744
5066
|
}, [events, streamingText]);
|
|
4745
|
-
|
|
5067
|
+
React4.useEffect(() => {
|
|
4746
5068
|
return () => {
|
|
4747
5069
|
abortRef.current?.abort();
|
|
4748
5070
|
streamRef.current?.abort();
|
|
4749
5071
|
};
|
|
4750
5072
|
}, []);
|
|
4751
|
-
const pollForFinalResult =
|
|
5073
|
+
const pollForFinalResult = React4.useCallback(async (runId) => {
|
|
4752
5074
|
setPolling(true);
|
|
4753
5075
|
let delay = 3e3;
|
|
4754
5076
|
const maxDelay = 1e4;
|
|
@@ -4759,7 +5081,7 @@ function PlaygroundPage({ agentId }) {
|
|
|
4759
5081
|
if (abortRef.current?.signal.aborted) break;
|
|
4760
5082
|
try {
|
|
4761
5083
|
const run = await client.runs.get(runId);
|
|
4762
|
-
if (
|
|
5084
|
+
if (TERMINAL_STATUSES2.has(run.status)) {
|
|
4763
5085
|
try {
|
|
4764
5086
|
const transcriptEvents = await client.runs.transcriptArray(runId);
|
|
4765
5087
|
if (transcriptEvents.length > 0) {
|
|
@@ -4804,7 +5126,7 @@ function PlaygroundPage({ agentId }) {
|
|
|
4804
5126
|
streamRef.current = null;
|
|
4805
5127
|
}
|
|
4806
5128
|
}, [client]);
|
|
4807
|
-
const consumeStream =
|
|
5129
|
+
const consumeStream = React4.useCallback(async (stream) => {
|
|
4808
5130
|
streamRef.current = stream;
|
|
4809
5131
|
let handedOffToPoll = false;
|
|
4810
5132
|
try {
|
|
@@ -4842,7 +5164,7 @@ function PlaygroundPage({ agentId }) {
|
|
|
4842
5164
|
}
|
|
4843
5165
|
}
|
|
4844
5166
|
}, [pollForFinalResult]);
|
|
4845
|
-
const handleSend =
|
|
5167
|
+
const handleSend = React4.useCallback(async () => {
|
|
4846
5168
|
if (!prompt.trim() || running) return;
|
|
4847
5169
|
const messageText = prompt.trim();
|
|
4848
5170
|
setPrompt("");
|
|
@@ -4995,6 +5317,122 @@ function PlaygroundPage({ agentId }) {
|
|
|
4995
5317
|
] })
|
|
4996
5318
|
] });
|
|
4997
5319
|
}
|
|
5320
|
+
var ToastProvider = ToastPrimitives__namespace.Provider;
|
|
5321
|
+
var ToastViewport = React4__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
5322
|
+
ToastPrimitives__namespace.Viewport,
|
|
5323
|
+
{
|
|
5324
|
+
ref,
|
|
5325
|
+
className: chunkXXF4U7WL_cjs.cn(
|
|
5326
|
+
"fixed top-0 right-0 z-[100] flex max-h-screen w-full flex-col-reverse gap-2 p-4 sm:flex-col sm:max-w-[420px]",
|
|
5327
|
+
className
|
|
5328
|
+
),
|
|
5329
|
+
...props
|
|
5330
|
+
}
|
|
5331
|
+
));
|
|
5332
|
+
ToastViewport.displayName = ToastPrimitives__namespace.Viewport.displayName;
|
|
5333
|
+
var toastVariants = classVarianceAuthority.cva(
|
|
5334
|
+
"group pointer-events-auto relative flex w-full items-center justify-between gap-4 overflow-hidden rounded-lg border p-4 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-right-full",
|
|
5335
|
+
{
|
|
5336
|
+
variants: {
|
|
5337
|
+
variant: {
|
|
5338
|
+
default: "bg-zinc-800 border-zinc-700 text-zinc-100",
|
|
5339
|
+
success: "bg-green-950 border-green-900 text-green-400",
|
|
5340
|
+
destructive: "bg-red-950 border-red-900 text-red-400"
|
|
5341
|
+
}
|
|
5342
|
+
},
|
|
5343
|
+
defaultVariants: {
|
|
5344
|
+
variant: "default"
|
|
5345
|
+
}
|
|
5346
|
+
}
|
|
5347
|
+
);
|
|
5348
|
+
var Toast = React4__namespace.forwardRef(({ className, variant, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
5349
|
+
ToastPrimitives__namespace.Root,
|
|
5350
|
+
{
|
|
5351
|
+
ref,
|
|
5352
|
+
className: chunkXXF4U7WL_cjs.cn(toastVariants({ variant }), className),
|
|
5353
|
+
...props
|
|
5354
|
+
}
|
|
5355
|
+
));
|
|
5356
|
+
Toast.displayName = ToastPrimitives__namespace.Root.displayName;
|
|
5357
|
+
var ToastAction = React4__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
5358
|
+
ToastPrimitives__namespace.Action,
|
|
5359
|
+
{
|
|
5360
|
+
ref,
|
|
5361
|
+
className: chunkXXF4U7WL_cjs.cn(
|
|
5362
|
+
"inline-flex h-8 shrink-0 items-center justify-center rounded-md border border-zinc-600 bg-transparent px-3 text-sm font-medium transition-colors hover:bg-zinc-700 focus:outline-none focus:ring-1 focus:ring-zinc-500 disabled:pointer-events-none disabled:opacity-50",
|
|
5363
|
+
"group-[.destructive]:border-red-800 group-[.destructive]:hover:border-red-700 group-[.destructive]:hover:bg-red-900 group-[.destructive]:focus:ring-red-800",
|
|
5364
|
+
"group-[.success]:border-green-800 group-[.success]:hover:border-green-700 group-[.success]:hover:bg-green-900 group-[.success]:focus:ring-green-800",
|
|
5365
|
+
className
|
|
5366
|
+
),
|
|
5367
|
+
...props
|
|
5368
|
+
}
|
|
5369
|
+
));
|
|
5370
|
+
ToastAction.displayName = ToastPrimitives__namespace.Action.displayName;
|
|
5371
|
+
var ToastClose = React4__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
5372
|
+
ToastPrimitives__namespace.Close,
|
|
5373
|
+
{
|
|
5374
|
+
ref,
|
|
5375
|
+
className: chunkXXF4U7WL_cjs.cn(
|
|
5376
|
+
"absolute right-1 top-1 rounded-md p-1 text-zinc-400 opacity-0 transition-opacity hover:text-zinc-100 focus:opacity-100 focus:outline-none group-hover:opacity-100",
|
|
5377
|
+
"group-[.destructive]:text-red-400 group-[.destructive]:hover:text-red-300",
|
|
5378
|
+
"group-[.success]:text-green-400 group-[.success]:hover:text-green-300",
|
|
5379
|
+
className
|
|
5380
|
+
),
|
|
5381
|
+
"toast-close": "",
|
|
5382
|
+
...props,
|
|
5383
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
5384
|
+
"svg",
|
|
5385
|
+
{
|
|
5386
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
5387
|
+
width: "16",
|
|
5388
|
+
height: "16",
|
|
5389
|
+
viewBox: "0 0 24 24",
|
|
5390
|
+
fill: "none",
|
|
5391
|
+
stroke: "currentColor",
|
|
5392
|
+
strokeWidth: "2",
|
|
5393
|
+
strokeLinecap: "round",
|
|
5394
|
+
strokeLinejoin: "round",
|
|
5395
|
+
children: [
|
|
5396
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M18 6 6 18" }),
|
|
5397
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "m6 6 12 12" })
|
|
5398
|
+
]
|
|
5399
|
+
}
|
|
5400
|
+
)
|
|
5401
|
+
}
|
|
5402
|
+
));
|
|
5403
|
+
ToastClose.displayName = ToastPrimitives__namespace.Close.displayName;
|
|
5404
|
+
var ToastTitle = React4__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
5405
|
+
ToastPrimitives__namespace.Title,
|
|
5406
|
+
{
|
|
5407
|
+
ref,
|
|
5408
|
+
className: chunkXXF4U7WL_cjs.cn("text-sm font-semibold [&+div]:text-xs", className),
|
|
5409
|
+
...props
|
|
5410
|
+
}
|
|
5411
|
+
));
|
|
5412
|
+
ToastTitle.displayName = ToastPrimitives__namespace.Title.displayName;
|
|
5413
|
+
var ToastDescription = React4__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
5414
|
+
ToastPrimitives__namespace.Description,
|
|
5415
|
+
{
|
|
5416
|
+
ref,
|
|
5417
|
+
className: chunkXXF4U7WL_cjs.cn("text-sm opacity-90", className),
|
|
5418
|
+
...props
|
|
5419
|
+
}
|
|
5420
|
+
));
|
|
5421
|
+
ToastDescription.displayName = ToastPrimitives__namespace.Description.displayName;
|
|
5422
|
+
function Toaster() {
|
|
5423
|
+
const { toasts } = useToast();
|
|
5424
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(ToastProvider, { children: [
|
|
5425
|
+
toasts.map(({ id, title, description, action, ...props }) => /* @__PURE__ */ jsxRuntime.jsxs(Toast, { ...props, children: [
|
|
5426
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid gap-1", children: [
|
|
5427
|
+
title && /* @__PURE__ */ jsxRuntime.jsx(ToastTitle, { children: title }),
|
|
5428
|
+
description && /* @__PURE__ */ jsxRuntime.jsx(ToastDescription, { children: description })
|
|
5429
|
+
] }),
|
|
5430
|
+
action,
|
|
5431
|
+
/* @__PURE__ */ jsxRuntime.jsx(ToastClose, {})
|
|
5432
|
+
] }, id)),
|
|
5433
|
+
/* @__PURE__ */ jsxRuntime.jsx(ToastViewport, {})
|
|
5434
|
+
] });
|
|
5435
|
+
}
|
|
4998
5436
|
|
|
4999
5437
|
Object.defineProperty(exports, "Card", {
|
|
5000
5438
|
enumerable: true,
|
|
@@ -5133,6 +5571,18 @@ exports.SettingsPage = SettingsPage;
|
|
|
5133
5571
|
exports.Tabs = Tabs;
|
|
5134
5572
|
exports.Textarea = Textarea;
|
|
5135
5573
|
exports.Th = Th;
|
|
5574
|
+
exports.Toast = Toast;
|
|
5575
|
+
exports.ToastAction = ToastAction;
|
|
5576
|
+
exports.ToastClose = ToastClose;
|
|
5577
|
+
exports.ToastDescription = ToastDescription;
|
|
5578
|
+
exports.ToastProvider = ToastProvider;
|
|
5579
|
+
exports.ToastTitle = ToastTitle;
|
|
5580
|
+
exports.ToastViewport = ToastViewport;
|
|
5581
|
+
exports.Toaster = Toaster;
|
|
5136
5582
|
exports.ToolkitMultiselect = ToolkitMultiselect;
|
|
5137
5583
|
exports.TranscriptViewer = TranscriptViewer;
|
|
5138
5584
|
exports.parsePaginationParams = parsePaginationParams;
|
|
5585
|
+
exports.toast = toast;
|
|
5586
|
+
exports.toastVariants = toastVariants;
|
|
5587
|
+
exports.useRunStream = useRunStream;
|
|
5588
|
+
exports.useToast = useToast;
|