@shuffleio/shuffle-mcps 0.0.9 → 0.0.11
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 +371 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +37 -2
- package/dist/index.d.ts +37 -2
- package/dist/index.js +378 -14
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -7467,6 +7467,10 @@ var AgentUI = ({
|
|
|
7467
7467
|
appPickerSubtitle = "Pick the tools the agent is allowed to use for this run",
|
|
7468
7468
|
submitTooltip = "\u2318+Enter to send",
|
|
7469
7469
|
submitIcon,
|
|
7470
|
+
submitOverride,
|
|
7471
|
+
submitLabel,
|
|
7472
|
+
disableSchedule,
|
|
7473
|
+
disableScheduleTooltip,
|
|
7470
7474
|
continuationPlaceholder = "Add more details to continue this task\u2026",
|
|
7471
7475
|
readUrlParams = true,
|
|
7472
7476
|
executionId,
|
|
@@ -8183,7 +8187,6 @@ var AgentUI = ({
|
|
|
8183
8187
|
if (json.success === false) {
|
|
8184
8188
|
toast({ title: "Failed to submit", description: json.reason || "Try again later.", variant: "destructive" });
|
|
8185
8189
|
} else {
|
|
8186
|
-
toast({ title: "Submitted", description: "Agent will continue shortly." });
|
|
8187
8190
|
setQuestionAnswers({});
|
|
8188
8191
|
setContinuationText("");
|
|
8189
8192
|
setTimeout(() => {
|
|
@@ -8451,10 +8454,17 @@ var AgentUI = ({
|
|
|
8451
8454
|
else next.add(i);
|
|
8452
8455
|
return next;
|
|
8453
8456
|
});
|
|
8457
|
+
const handlePrimarySubmit = useCallback8(() => {
|
|
8458
|
+
if (submitOverride) {
|
|
8459
|
+
submitOverride({ input: actionInput, apps: chosenApps });
|
|
8460
|
+
} else {
|
|
8461
|
+
submitInput(actionInput);
|
|
8462
|
+
}
|
|
8463
|
+
}, [submitOverride, actionInput, chosenApps, submitInput]);
|
|
8454
8464
|
const onKeyDown = (e) => {
|
|
8455
8465
|
if ((e.metaKey || e.ctrlKey) && e.key === "Enter") {
|
|
8456
8466
|
e.preventDefault();
|
|
8457
|
-
|
|
8467
|
+
handlePrimarySubmit();
|
|
8458
8468
|
}
|
|
8459
8469
|
};
|
|
8460
8470
|
const activeTab = showStarter ? "start" : viewMode;
|
|
@@ -9038,6 +9048,7 @@ var AgentUI = ({
|
|
|
9038
9048
|
await onSchedule({
|
|
9039
9049
|
cron,
|
|
9040
9050
|
input: actionInput || "",
|
|
9051
|
+
apps: chosenApps.filter((a) => !!a?.name).map((a) => ({ name: a.name, id: a.id, icon: a.icon })),
|
|
9041
9052
|
onStep: (ev) => {
|
|
9042
9053
|
setScheduleSteps((prev) => prev.map((p) => p.id === ev.id ? { ...p, state: ev.state, detail: ev.detail } : p));
|
|
9043
9054
|
}
|
|
@@ -9086,14 +9097,14 @@ var AgentUI = ({
|
|
|
9086
9097
|
...Array.isArray(contentSx) ? contentSx : contentSx ? [contentSx] : []
|
|
9087
9098
|
],
|
|
9088
9099
|
children: [
|
|
9089
|
-
|
|
9100
|
+
showRunSwitcher && tabBar,
|
|
9090
9101
|
showStarter ? /* @__PURE__ */ jsxs13(
|
|
9091
9102
|
Box12,
|
|
9092
9103
|
{
|
|
9093
9104
|
component: "form",
|
|
9094
9105
|
onSubmit: (e) => {
|
|
9095
9106
|
e.preventDefault();
|
|
9096
|
-
|
|
9107
|
+
handlePrimarySubmit();
|
|
9097
9108
|
},
|
|
9098
9109
|
sx: { display: "flex", flexDirection: "column", alignItems: "center", gap: compact ? 2 : 3, py: compact ? 2 : 4 },
|
|
9099
9110
|
children: [
|
|
@@ -9206,9 +9217,10 @@ var AgentUI = ({
|
|
|
9206
9217
|
),
|
|
9207
9218
|
(() => {
|
|
9208
9219
|
const allowWithoutExecution = showStarter;
|
|
9209
|
-
const
|
|
9220
|
+
const promptTooShort = showStarter && (actionInput || "").trim().length < 6;
|
|
9221
|
+
const canSchedule = (hasExecution || allowWithoutExecution) && !scheduleDisabledReason && !promptTooShort && !disableSchedule;
|
|
9210
9222
|
const hintActive = Boolean(scheduleHint) && canSchedule;
|
|
9211
|
-
const tip = scheduleDisabledReason ? scheduleDisabledTooltip : hintActive ? `Detected schedule: ${scheduleHint.label}. Click to review and save.` : "Schedule this prompt to run repeatedly on a cron schedule";
|
|
9223
|
+
const tip = disableSchedule ? disableScheduleTooltip || "Scheduling is disabled while editing" : scheduleDisabledReason ? scheduleDisabledTooltip : promptTooShort ? "Type at least 6 characters of prompt before scheduling." : hintActive ? `Detected schedule: ${scheduleHint.label}. Click to review and save.` : "Schedule this prompt to run repeatedly on a cron schedule";
|
|
9212
9224
|
return /* @__PURE__ */ jsx15(Tooltip7, { title: tip, placement: "top", arrow: true, children: /* @__PURE__ */ jsx15(Box12, { sx: { display: "inline-flex", alignItems: "center", gap: 0.5 }, children: /* @__PURE__ */ jsxs13(
|
|
9213
9225
|
IconButton7,
|
|
9214
9226
|
{
|
|
@@ -9270,7 +9282,48 @@ var AgentUI = ({
|
|
|
9270
9282
|
children: /* @__PURE__ */ jsx15(AttachFileIcon, { sx: { fontSize: 18 } })
|
|
9271
9283
|
}
|
|
9272
9284
|
),
|
|
9273
|
-
/* @__PURE__ */ jsx15(Tooltip7, { title: submitTooltip, placement: "top", arrow: true, children: /* @__PURE__ */ jsx15("span", { children: /* @__PURE__ */
|
|
9285
|
+
/* @__PURE__ */ jsx15(Tooltip7, { title: submitTooltip, placement: "top", arrow: true, children: /* @__PURE__ */ jsx15("span", { children: submitLabel ? /* @__PURE__ */ jsxs13(Box12, { sx: { display: "inline-flex", alignItems: "center", gap: 1 }, children: [
|
|
9286
|
+
/* @__PURE__ */ jsx15(Tooltip7, { title: "Try this prompt without saving", placement: "top", arrow: true, children: /* @__PURE__ */ jsx15(
|
|
9287
|
+
IconButton7,
|
|
9288
|
+
{
|
|
9289
|
+
type: "button",
|
|
9290
|
+
onClick: () => submitInput(actionInput),
|
|
9291
|
+
disabled: actionInput.trim().length < 6 || agentRequestLoading,
|
|
9292
|
+
sx: {
|
|
9293
|
+
width: 36,
|
|
9294
|
+
height: 36,
|
|
9295
|
+
bgcolor: "transparent",
|
|
9296
|
+
border: "1px solid hsl(var(--border))",
|
|
9297
|
+
color: "hsl(var(--foreground))",
|
|
9298
|
+
"&:hover": { bgcolor: "hsl(var(--muted))" },
|
|
9299
|
+
"&.Mui-disabled": { color: "hsl(var(--muted-foreground))" }
|
|
9300
|
+
},
|
|
9301
|
+
children: /* @__PURE__ */ jsx15(PlayArrowRoundedIcon2, {})
|
|
9302
|
+
}
|
|
9303
|
+
) }),
|
|
9304
|
+
/* @__PURE__ */ jsx15(
|
|
9305
|
+
Button5,
|
|
9306
|
+
{
|
|
9307
|
+
type: "submit",
|
|
9308
|
+
variant: "contained",
|
|
9309
|
+
disabled: actionInput.trim().length < 6 || agentRequestLoading,
|
|
9310
|
+
startIcon: agentRequestLoading ? /* @__PURE__ */ jsx15(CircularProgress4, { size: 14, sx: { color: "inherit" } }) : null,
|
|
9311
|
+
sx: {
|
|
9312
|
+
height: 36,
|
|
9313
|
+
px: 2,
|
|
9314
|
+
textTransform: "none",
|
|
9315
|
+
fontSize: "0.85rem",
|
|
9316
|
+
fontWeight: 600,
|
|
9317
|
+
boxShadow: "none",
|
|
9318
|
+
bgcolor: "hsl(var(--primary))",
|
|
9319
|
+
color: "hsl(var(--primary-foreground))",
|
|
9320
|
+
"&:hover": { bgcolor: "hsl(var(--primary))", filter: "brightness(1.1)", boxShadow: "none" },
|
|
9321
|
+
"&.Mui-disabled": { bgcolor: "hsl(var(--muted))", color: "hsl(var(--muted-foreground))" }
|
|
9322
|
+
},
|
|
9323
|
+
children: submitLabel
|
|
9324
|
+
}
|
|
9325
|
+
)
|
|
9326
|
+
] }) : /* @__PURE__ */ jsx15(
|
|
9274
9327
|
IconButton7,
|
|
9275
9328
|
{
|
|
9276
9329
|
type: "submit",
|
|
@@ -10200,8 +10253,15 @@ import {
|
|
|
10200
10253
|
Button as Button6,
|
|
10201
10254
|
Chip as Chip8,
|
|
10202
10255
|
CircularProgress as CircularProgress5,
|
|
10256
|
+
Dialog as Dialog2,
|
|
10257
|
+
DialogActions,
|
|
10258
|
+
DialogContent as DialogContent2,
|
|
10259
|
+
DialogTitle as DialogTitle2,
|
|
10203
10260
|
InputAdornment,
|
|
10261
|
+
MenuItem as MenuItem3,
|
|
10262
|
+
Select as Select3,
|
|
10204
10263
|
TextField as TextField5,
|
|
10264
|
+
Tooltip as Tooltip9,
|
|
10205
10265
|
Typography as Typography14
|
|
10206
10266
|
} from "@mui/material";
|
|
10207
10267
|
import SearchIcon from "@mui/icons-material/Search";
|
|
@@ -10235,10 +10295,11 @@ var searchAgentActivity = async (params = {}) => {
|
|
|
10235
10295
|
suborgRuns = false,
|
|
10236
10296
|
apiKey,
|
|
10237
10297
|
apiBaseUrl,
|
|
10238
|
-
orgId
|
|
10298
|
+
orgId,
|
|
10299
|
+
workflowId = "AGENT"
|
|
10239
10300
|
} = params;
|
|
10240
10301
|
const payload = {
|
|
10241
|
-
workflow_id:
|
|
10302
|
+
workflow_id: workflowId,
|
|
10242
10303
|
cursor,
|
|
10243
10304
|
limit,
|
|
10244
10305
|
status,
|
|
@@ -10265,8 +10326,80 @@ var searchAgentActivity = async (params = {}) => {
|
|
|
10265
10326
|
cursor: data.cursor || ""
|
|
10266
10327
|
};
|
|
10267
10328
|
};
|
|
10329
|
+
var listAgentScheduleWorkflows = async (params = {}) => {
|
|
10330
|
+
const { apiKey, apiBaseUrl, orgId } = params;
|
|
10331
|
+
const response = await fetch(resolveUrl("/api/v1/workflows", apiBaseUrl), {
|
|
10332
|
+
method: "GET",
|
|
10333
|
+
credentials: "include",
|
|
10334
|
+
headers: { "Content-Type": "application/json", ...resolveHeaders(apiKey, orgId) }
|
|
10335
|
+
});
|
|
10336
|
+
if (!response.ok) {
|
|
10337
|
+
throw new Error(`Failed to fetch workflows: ${response.statusText}`);
|
|
10338
|
+
}
|
|
10339
|
+
const data = await response.json();
|
|
10340
|
+
const list = Array.isArray(data) ? data : data?.workflows || [];
|
|
10341
|
+
return list.filter((w) => w && w.workflow_type === "AGENT_SCHEDULE").map((w) => ({ id: w.id || w._id, name: w.name || "Untitled", description: w.description }));
|
|
10342
|
+
};
|
|
10343
|
+
var findAgentInputParam = (workflow) => {
|
|
10344
|
+
const actions = workflow?.actions || [];
|
|
10345
|
+
for (const a of actions) {
|
|
10346
|
+
if ((a?.app_name || "").toLowerCase().includes("ai agent") || a?.app_id === "shuffle_agent") {
|
|
10347
|
+
const params = a?.parameters || [];
|
|
10348
|
+
const p = params.find((x) => x?.name === "input");
|
|
10349
|
+
if (p) return { action: a, param: p };
|
|
10350
|
+
}
|
|
10351
|
+
}
|
|
10352
|
+
return null;
|
|
10353
|
+
};
|
|
10354
|
+
var getWorkflow = async (workflowId, params = {}) => {
|
|
10355
|
+
const { apiKey, apiBaseUrl, orgId } = params;
|
|
10356
|
+
const res = await fetch(resolveUrl(`/api/v1/workflows/${workflowId}`, apiBaseUrl), {
|
|
10357
|
+
method: "GET",
|
|
10358
|
+
credentials: "include",
|
|
10359
|
+
headers: { "Content-Type": "application/json", ...resolveHeaders(apiKey, orgId) }
|
|
10360
|
+
});
|
|
10361
|
+
if (!res.ok) throw new Error(`Failed to fetch workflow: ${res.statusText}`);
|
|
10362
|
+
return res.json();
|
|
10363
|
+
};
|
|
10364
|
+
var getAgentScheduleConfig = async (workflowId, params = {}) => {
|
|
10365
|
+
const workflow = await getWorkflow(workflowId, params);
|
|
10366
|
+
const found = findAgentInputParam(workflow);
|
|
10367
|
+
const prompt = String(found?.param?.value || "");
|
|
10368
|
+
const action = found?.action;
|
|
10369
|
+
const actionParams = action?.parameters || [];
|
|
10370
|
+
const appNameParam = actionParams.find((x) => x?.name === "app_name");
|
|
10371
|
+
const raw = String(appNameParam?.value || "");
|
|
10372
|
+
const apps = raw.split(",").map((s) => s.trim()).filter(Boolean).map((name) => ({ name }));
|
|
10373
|
+
return { workflow, prompt, apps };
|
|
10374
|
+
};
|
|
10375
|
+
var stopAgentSchedule = async (workflowId, params = {}) => {
|
|
10376
|
+
const { apiKey, apiBaseUrl, orgId } = params;
|
|
10377
|
+
const headers = { ...resolveHeaders(apiKey, orgId) };
|
|
10378
|
+
try {
|
|
10379
|
+
const workflow = await getWorkflow(workflowId, params);
|
|
10380
|
+
const triggers = workflow?.triggers || [];
|
|
10381
|
+
const scheduleIds = triggers.filter((t) => (t?.trigger_type || "").toUpperCase() === "SCHEDULE").map((t) => t?.id || t?.id_ || t?._id_).filter(Boolean);
|
|
10382
|
+
await Promise.all(
|
|
10383
|
+
scheduleIds.map(
|
|
10384
|
+
(sid) => fetch(resolveUrl(`/api/v1/workflows/${workflowId}/schedule/${sid}`, apiBaseUrl), {
|
|
10385
|
+
method: "DELETE",
|
|
10386
|
+
credentials: "include",
|
|
10387
|
+
headers
|
|
10388
|
+
}).catch(() => void 0)
|
|
10389
|
+
)
|
|
10390
|
+
);
|
|
10391
|
+
} catch {
|
|
10392
|
+
}
|
|
10393
|
+
const res = await fetch(resolveUrl(`/api/v1/workflows/${workflowId}`, apiBaseUrl), {
|
|
10394
|
+
method: "DELETE",
|
|
10395
|
+
credentials: "include",
|
|
10396
|
+
headers
|
|
10397
|
+
});
|
|
10398
|
+
if (!res.ok) throw new Error(`Failed to stop schedule: ${res.statusText}`);
|
|
10399
|
+
};
|
|
10268
10400
|
|
|
10269
10401
|
// AgentActivityList.tsx
|
|
10402
|
+
import { Pencil, StopCircle } from "lucide-react";
|
|
10270
10403
|
import { Fragment as Fragment8, jsx as jsx17, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
10271
10404
|
var STATUS_CONFIG = {
|
|
10272
10405
|
FINISHED: { icon: /* @__PURE__ */ jsx17(CheckCircle, { size: 16 }), color: "hsl(var(--severity-low, 142 71% 45%))", label: "Completed" },
|
|
@@ -10354,11 +10487,30 @@ var getRunSubtitle = (run) => {
|
|
|
10354
10487
|
}
|
|
10355
10488
|
return run.execution_source || "Agent execution";
|
|
10356
10489
|
};
|
|
10490
|
+
var getRunTools = (run) => {
|
|
10491
|
+
const out = /* @__PURE__ */ new Set();
|
|
10492
|
+
const add = (v) => {
|
|
10493
|
+
if (!v) return;
|
|
10494
|
+
const s = String(v).trim();
|
|
10495
|
+
if (!s) return;
|
|
10496
|
+
if (/^(ai\s*agent|shuffle\s*agent|shuffle_agent)$/i.test(s)) return;
|
|
10497
|
+
out.add(s);
|
|
10498
|
+
};
|
|
10499
|
+
(run.results || []).forEach((r) => {
|
|
10500
|
+
add(r?.action?.app_name);
|
|
10501
|
+
if (!r?.action?.app_name) add(r?.action?.label);
|
|
10502
|
+
});
|
|
10503
|
+
(run.decisions || []).forEach((d) => {
|
|
10504
|
+
add(typeof d?.tool === "string" ? d.tool : void 0);
|
|
10505
|
+
});
|
|
10506
|
+
return Array.from(out).slice(0, 6);
|
|
10507
|
+
};
|
|
10357
10508
|
var AgentRunRow = ({ run, onClick, sx }) => {
|
|
10358
10509
|
const statusKey = (run.status || "").toUpperCase();
|
|
10359
10510
|
const cfg = STATUS_CONFIG[statusKey] || STATUS_CONFIG.WAITING;
|
|
10360
10511
|
const iconColor = getRunIconColor(run);
|
|
10361
10512
|
const duration = formatDuration(run);
|
|
10513
|
+
const tools = getRunTools(run);
|
|
10362
10514
|
return /* @__PURE__ */ jsxs15(
|
|
10363
10515
|
Box14,
|
|
10364
10516
|
{
|
|
@@ -10438,7 +10590,42 @@ var AgentRunRow = ({ run, onClick, sx }) => {
|
|
|
10438
10590
|
/* @__PURE__ */ jsx17(Typography14, { sx: { fontSize: "0.72rem", color: "hsl(var(--muted-foreground))", opacity: 0.7 }, children: duration })
|
|
10439
10591
|
] })
|
|
10440
10592
|
] })
|
|
10441
|
-
] })
|
|
10593
|
+
] }),
|
|
10594
|
+
tools.length > 0 && /* @__PURE__ */ jsx17(
|
|
10595
|
+
Box14,
|
|
10596
|
+
{
|
|
10597
|
+
sx: {
|
|
10598
|
+
display: { xs: "none", sm: "flex" },
|
|
10599
|
+
alignItems: "center",
|
|
10600
|
+
gap: 0.5,
|
|
10601
|
+
flexWrap: "wrap",
|
|
10602
|
+
justifyContent: "flex-end",
|
|
10603
|
+
maxWidth: 220,
|
|
10604
|
+
flexShrink: 0
|
|
10605
|
+
},
|
|
10606
|
+
children: tools.map((t) => /* @__PURE__ */ jsx17(Tooltip9, { title: t, arrow: true, children: /* @__PURE__ */ jsx17(
|
|
10607
|
+
Chip8,
|
|
10608
|
+
{
|
|
10609
|
+
label: t,
|
|
10610
|
+
size: "small",
|
|
10611
|
+
sx: {
|
|
10612
|
+
height: 20,
|
|
10613
|
+
fontSize: "0.68rem",
|
|
10614
|
+
maxWidth: 120,
|
|
10615
|
+
bgcolor: "hsla(var(--muted) / 0.5)",
|
|
10616
|
+
color: "hsl(var(--muted-foreground))",
|
|
10617
|
+
border: "1px solid hsl(var(--border))",
|
|
10618
|
+
"& .MuiChip-label": {
|
|
10619
|
+
px: 0.75,
|
|
10620
|
+
overflow: "hidden",
|
|
10621
|
+
textOverflow: "ellipsis",
|
|
10622
|
+
whiteSpace: "nowrap"
|
|
10623
|
+
}
|
|
10624
|
+
}
|
|
10625
|
+
}
|
|
10626
|
+
) }, t))
|
|
10627
|
+
}
|
|
10628
|
+
)
|
|
10442
10629
|
]
|
|
10443
10630
|
}
|
|
10444
10631
|
);
|
|
@@ -10454,6 +10641,7 @@ var AgentActivityList = ({
|
|
|
10454
10641
|
apiBaseUrl,
|
|
10455
10642
|
orgId,
|
|
10456
10643
|
onRunClick,
|
|
10644
|
+
onEditWorkflow,
|
|
10457
10645
|
showSearchBar = true,
|
|
10458
10646
|
showStatusChips = true,
|
|
10459
10647
|
limit = 50,
|
|
@@ -10472,7 +10660,41 @@ var AgentActivityList = ({
|
|
|
10472
10660
|
const [statusFilter, setStatusFilter] = useState13("");
|
|
10473
10661
|
const [searchQuery, setSearchQuery] = useState13("");
|
|
10474
10662
|
const [debouncedQuery, setDebouncedQuery] = useState13("");
|
|
10663
|
+
const [agentWorkflows, setAgentWorkflows] = useState13([]);
|
|
10664
|
+
const [workflowFilter, setWorkflowFilter] = useState13("");
|
|
10665
|
+
const [stopOpen, setStopOpen] = useState13(false);
|
|
10666
|
+
const [stopLoading, setStopLoading] = useState13(false);
|
|
10475
10667
|
const debounceRef = useRef8();
|
|
10668
|
+
const selectedAgentWorkflow = agentWorkflows.find((w) => w.id === workflowFilter) || null;
|
|
10669
|
+
const openEditPrompt = useCallback9(async () => {
|
|
10670
|
+
if (!workflowFilter) return;
|
|
10671
|
+
try {
|
|
10672
|
+
const { prompt, apps } = await getAgentScheduleConfig(workflowFilter, { apiKey, apiBaseUrl, orgId });
|
|
10673
|
+
onEditWorkflow?.({
|
|
10674
|
+
workflowId: workflowFilter,
|
|
10675
|
+
name: selectedAgentWorkflow?.name || "Schedule",
|
|
10676
|
+
prompt,
|
|
10677
|
+
apps
|
|
10678
|
+
});
|
|
10679
|
+
} catch (e) {
|
|
10680
|
+
setError(e instanceof Error ? e.message : "Failed to load workflow");
|
|
10681
|
+
}
|
|
10682
|
+
}, [workflowFilter, selectedAgentWorkflow, apiKey, apiBaseUrl, orgId, onEditWorkflow]);
|
|
10683
|
+
const confirmStop = useCallback9(async () => {
|
|
10684
|
+
if (!workflowFilter) return;
|
|
10685
|
+
setStopLoading(true);
|
|
10686
|
+
try {
|
|
10687
|
+
await stopAgentSchedule(workflowFilter, { apiKey, apiBaseUrl, orgId });
|
|
10688
|
+
setStopOpen(false);
|
|
10689
|
+
const items = await listAgentScheduleWorkflows({ apiKey, apiBaseUrl, orgId });
|
|
10690
|
+
setAgentWorkflows(items);
|
|
10691
|
+
setWorkflowFilter("");
|
|
10692
|
+
} catch (e) {
|
|
10693
|
+
setError(e instanceof Error ? e.message : "Failed to stop schedule");
|
|
10694
|
+
} finally {
|
|
10695
|
+
setStopLoading(false);
|
|
10696
|
+
}
|
|
10697
|
+
}, [workflowFilter, apiKey, apiBaseUrl, orgId]);
|
|
10476
10698
|
const updateSearchQuery = useCallback9((q) => {
|
|
10477
10699
|
setSearchQuery(q);
|
|
10478
10700
|
if (debounceRef.current) clearTimeout(debounceRef.current);
|
|
@@ -10492,7 +10714,8 @@ var AgentActivityList = ({
|
|
|
10492
10714
|
cursor: cursorParam,
|
|
10493
10715
|
apiKey,
|
|
10494
10716
|
apiBaseUrl,
|
|
10495
|
-
orgId
|
|
10717
|
+
orgId,
|
|
10718
|
+
workflowId: workflowFilter || "AGENT"
|
|
10496
10719
|
});
|
|
10497
10720
|
if (result.success) {
|
|
10498
10721
|
setRuns((prev) => append ? [...prev, ...result.runs] : result.runs);
|
|
@@ -10507,11 +10730,21 @@ var AgentActivityList = ({
|
|
|
10507
10730
|
setIsLoading(false);
|
|
10508
10731
|
}
|
|
10509
10732
|
},
|
|
10510
|
-
[statusFilter, limit, apiKey, apiBaseUrl, orgId]
|
|
10733
|
+
[statusFilter, limit, apiKey, apiBaseUrl, orgId, workflowFilter]
|
|
10511
10734
|
);
|
|
10512
10735
|
useEffect11(() => {
|
|
10513
10736
|
fetchRuns(false, "");
|
|
10514
|
-
}, [statusFilter, apiKey, apiBaseUrl, orgId]);
|
|
10737
|
+
}, [statusFilter, apiKey, apiBaseUrl, orgId, workflowFilter]);
|
|
10738
|
+
useEffect11(() => {
|
|
10739
|
+
let cancelled = false;
|
|
10740
|
+
listAgentScheduleWorkflows({ apiKey, apiBaseUrl, orgId }).then((items) => {
|
|
10741
|
+
if (!cancelled) setAgentWorkflows(items);
|
|
10742
|
+
}).catch(() => {
|
|
10743
|
+
});
|
|
10744
|
+
return () => {
|
|
10745
|
+
cancelled = true;
|
|
10746
|
+
};
|
|
10747
|
+
}, [apiKey, apiBaseUrl, orgId]);
|
|
10515
10748
|
const loadMore = useCallback9(() => {
|
|
10516
10749
|
if (cursor && !isLoading) fetchRuns(true, cursor);
|
|
10517
10750
|
}, [cursor, isLoading, fetchRuns]);
|
|
@@ -10532,6 +10765,48 @@ var AgentActivityList = ({
|
|
|
10532
10765
|
sx: [{ display: "flex", flexDirection: "column", gap: 2 }, ...Array.isArray(sx) ? sx : sx ? [sx] : []],
|
|
10533
10766
|
children: [
|
|
10534
10767
|
(showSearchBar || showStatusChips) && /* @__PURE__ */ jsxs15(Box14, { sx: [{ display: "flex", alignItems: "center", justifyContent: "center", gap: 1.5, flexWrap: "wrap" }, ...Array.isArray(toolbarSx) ? toolbarSx : toolbarSx ? [toolbarSx] : []], children: [
|
|
10768
|
+
/* @__PURE__ */ jsxs15(
|
|
10769
|
+
Select3,
|
|
10770
|
+
{
|
|
10771
|
+
size: "small",
|
|
10772
|
+
value: workflowFilter,
|
|
10773
|
+
onChange: (e) => setWorkflowFilter(String(e.target.value)),
|
|
10774
|
+
displayEmpty: true,
|
|
10775
|
+
renderValue: (val) => {
|
|
10776
|
+
if (!val) return "All Agent runs";
|
|
10777
|
+
const wf = agentWorkflows.find((w) => w.id === val);
|
|
10778
|
+
return wf?.name || "Selected workflow";
|
|
10779
|
+
},
|
|
10780
|
+
sx: {
|
|
10781
|
+
height: 36,
|
|
10782
|
+
minWidth: 200,
|
|
10783
|
+
maxWidth: 260,
|
|
10784
|
+
fontSize: "0.85rem",
|
|
10785
|
+
bgcolor: "hsl(var(--card))",
|
|
10786
|
+
color: "hsl(var(--foreground))",
|
|
10787
|
+
borderRadius: 1.5,
|
|
10788
|
+
"& .MuiOutlinedInput-notchedOutline": { borderColor: "hsl(var(--border))" },
|
|
10789
|
+
"&:hover .MuiOutlinedInput-notchedOutline": { borderColor: "hsl(var(--muted-foreground) / 0.3)" },
|
|
10790
|
+
"&.Mui-focused .MuiOutlinedInput-notchedOutline": { borderColor: "hsl(var(--primary))" }
|
|
10791
|
+
},
|
|
10792
|
+
MenuProps: {
|
|
10793
|
+
slotProps: {
|
|
10794
|
+
paper: {
|
|
10795
|
+
sx: {
|
|
10796
|
+
bgcolor: "hsl(var(--card))",
|
|
10797
|
+
border: "1px solid hsl(var(--border))",
|
|
10798
|
+
color: "hsl(var(--foreground))",
|
|
10799
|
+
maxHeight: 320
|
|
10800
|
+
}
|
|
10801
|
+
}
|
|
10802
|
+
}
|
|
10803
|
+
},
|
|
10804
|
+
children: [
|
|
10805
|
+
/* @__PURE__ */ jsx17(MenuItem3, { value: "", sx: { fontSize: "0.85rem" }, children: "All Agent runs" }),
|
|
10806
|
+
agentWorkflows.map((w) => /* @__PURE__ */ jsx17(MenuItem3, { value: w.id, sx: { fontSize: "0.85rem" }, children: w.name }, w.id))
|
|
10807
|
+
]
|
|
10808
|
+
}
|
|
10809
|
+
),
|
|
10535
10810
|
showSearchBar && /* @__PURE__ */ jsx17(
|
|
10536
10811
|
TextField5,
|
|
10537
10812
|
{
|
|
@@ -10581,6 +10856,64 @@ var AgentActivityList = ({
|
|
|
10581
10856
|
)),
|
|
10582
10857
|
isLoading && runs.length > 0 && /* @__PURE__ */ jsx17(CircularProgress5, { size: 16, sx: { color: "hsl(var(--primary))", ml: 0.5 } })
|
|
10583
10858
|
] }),
|
|
10859
|
+
selectedAgentWorkflow && /* @__PURE__ */ jsxs15(
|
|
10860
|
+
Box14,
|
|
10861
|
+
{
|
|
10862
|
+
sx: {
|
|
10863
|
+
display: "flex",
|
|
10864
|
+
alignItems: "center",
|
|
10865
|
+
gap: 1.5,
|
|
10866
|
+
p: 1.5,
|
|
10867
|
+
borderRadius: 2,
|
|
10868
|
+
border: "1px solid hsl(var(--border))",
|
|
10869
|
+
bgcolor: "hsl(var(--card))"
|
|
10870
|
+
},
|
|
10871
|
+
children: [
|
|
10872
|
+
/* @__PURE__ */ jsxs15(Box14, { sx: { flex: 1, minWidth: 0 }, children: [
|
|
10873
|
+
/* @__PURE__ */ jsx17(Typography14, { sx: { fontSize: "0.85rem", fontWeight: 600, color: "hsl(var(--foreground))", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: selectedAgentWorkflow.name }),
|
|
10874
|
+
selectedAgentWorkflow.description && /* @__PURE__ */ jsx17(Typography14, { sx: { fontSize: "0.75rem", color: "hsl(var(--muted-foreground))", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: selectedAgentWorkflow.description })
|
|
10875
|
+
] }),
|
|
10876
|
+
/* @__PURE__ */ jsx17(
|
|
10877
|
+
Button6,
|
|
10878
|
+
{
|
|
10879
|
+
size: "small",
|
|
10880
|
+
startIcon: /* @__PURE__ */ jsx17(Pencil, { size: 14 }),
|
|
10881
|
+
onClick: openEditPrompt,
|
|
10882
|
+
sx: {
|
|
10883
|
+
height: 36,
|
|
10884
|
+
border: "1px solid hsl(var(--border))",
|
|
10885
|
+
borderRadius: 1.5,
|
|
10886
|
+
color: "hsl(var(--foreground))",
|
|
10887
|
+
textTransform: "none",
|
|
10888
|
+
fontSize: "0.8rem",
|
|
10889
|
+
px: 1.5,
|
|
10890
|
+
"&:hover": { bgcolor: "hsl(var(--muted))" }
|
|
10891
|
+
},
|
|
10892
|
+
children: "Edit"
|
|
10893
|
+
}
|
|
10894
|
+
),
|
|
10895
|
+
/* @__PURE__ */ jsx17(
|
|
10896
|
+
Button6,
|
|
10897
|
+
{
|
|
10898
|
+
size: "small",
|
|
10899
|
+
startIcon: /* @__PURE__ */ jsx17(StopCircle, { size: 14 }),
|
|
10900
|
+
onClick: () => setStopOpen(true),
|
|
10901
|
+
sx: {
|
|
10902
|
+
height: 36,
|
|
10903
|
+
border: "1px solid hsl(var(--severity-critical, 0 72% 55%) / 0.4)",
|
|
10904
|
+
borderRadius: 1.5,
|
|
10905
|
+
color: "hsl(var(--severity-critical, 0 72% 55%))",
|
|
10906
|
+
textTransform: "none",
|
|
10907
|
+
fontSize: "0.8rem",
|
|
10908
|
+
px: 1.5,
|
|
10909
|
+
"&:hover": { bgcolor: "hsla(var(--severity-critical, 0 72% 55%) / 0.08)" }
|
|
10910
|
+
},
|
|
10911
|
+
children: "Stop schedule"
|
|
10912
|
+
}
|
|
10913
|
+
)
|
|
10914
|
+
]
|
|
10915
|
+
}
|
|
10916
|
+
),
|
|
10584
10917
|
isLoading && runs.length === 0 ? /* @__PURE__ */ jsx17(Box14, { sx: { display: "flex", justifyContent: "center", py: 8 }, children: /* @__PURE__ */ jsx17(CircularProgress5, { size: 28, sx: { color: "hsl(var(--primary))" } }) }) : error ? /* @__PURE__ */ jsxs15(Box14, { sx: { display: "flex", flexDirection: "column", alignItems: "center", textAlign: "center", py: 6 }, children: [
|
|
10585
10918
|
/* @__PURE__ */ jsx17(AlertCircle, { size: 28, style: { color: "hsl(var(--severity-critical, 0 72% 55%))", marginBottom: 8 } }),
|
|
10586
10919
|
/* @__PURE__ */ jsx17(
|
|
@@ -10638,7 +10971,38 @@ var AgentActivityList = ({
|
|
|
10638
10971
|
]
|
|
10639
10972
|
}
|
|
10640
10973
|
) })
|
|
10641
|
-
] })
|
|
10974
|
+
] }),
|
|
10975
|
+
/* @__PURE__ */ jsxs15(
|
|
10976
|
+
Dialog2,
|
|
10977
|
+
{
|
|
10978
|
+
open: stopOpen,
|
|
10979
|
+
onClose: () => stopLoading ? null : setStopOpen(false),
|
|
10980
|
+
slotProps: { paper: { sx: { bgcolor: "hsl(var(--card))", color: "hsl(var(--foreground))", border: "1px solid hsl(var(--border))" } } },
|
|
10981
|
+
children: [
|
|
10982
|
+
/* @__PURE__ */ jsx17(DialogTitle2, { sx: { fontSize: "1rem", fontWeight: 600 }, children: "Stop schedule?" }),
|
|
10983
|
+
/* @__PURE__ */ jsx17(DialogContent2, { children: /* @__PURE__ */ jsxs15(Typography14, { sx: { fontSize: "0.85rem", color: "hsl(var(--muted-foreground))" }, children: [
|
|
10984
|
+
'This will stop "',
|
|
10985
|
+
selectedAgentWorkflow?.name,
|
|
10986
|
+
'" and delete the scheduled workflow. Past executions remain visible. This cannot be undone.'
|
|
10987
|
+
] }) }),
|
|
10988
|
+
/* @__PURE__ */ jsxs15(DialogActions, { sx: { px: 3, pb: 2 }, children: [
|
|
10989
|
+
/* @__PURE__ */ jsx17(Button6, { onClick: () => setStopOpen(false), disabled: stopLoading, sx: { textTransform: "none", color: "hsl(var(--muted-foreground))" }, children: "Cancel" }),
|
|
10990
|
+
/* @__PURE__ */ jsxs15(
|
|
10991
|
+
Button6,
|
|
10992
|
+
{
|
|
10993
|
+
onClick: confirmStop,
|
|
10994
|
+
disabled: stopLoading,
|
|
10995
|
+
sx: { textTransform: "none", bgcolor: "hsl(var(--severity-critical, 0 72% 55%))", color: "hsl(var(--primary-foreground))", "&:hover": { bgcolor: "hsla(var(--severity-critical, 0 72% 55%) / 0.9)" } },
|
|
10996
|
+
children: [
|
|
10997
|
+
stopLoading ? /* @__PURE__ */ jsx17(CircularProgress5, { size: 16, sx: { color: "hsl(var(--primary-foreground))", mr: 1 } }) : null,
|
|
10998
|
+
"Stop schedule"
|
|
10999
|
+
]
|
|
11000
|
+
}
|
|
11001
|
+
)
|
|
11002
|
+
] })
|
|
11003
|
+
]
|
|
11004
|
+
}
|
|
11005
|
+
)
|
|
10642
11006
|
]
|
|
10643
11007
|
}
|
|
10644
11008
|
);
|