@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.cjs
CHANGED
|
@@ -7465,6 +7465,10 @@ var AgentUI = ({
|
|
|
7465
7465
|
appPickerSubtitle = "Pick the tools the agent is allowed to use for this run",
|
|
7466
7466
|
submitTooltip = "\u2318+Enter to send",
|
|
7467
7467
|
submitIcon,
|
|
7468
|
+
submitOverride,
|
|
7469
|
+
submitLabel,
|
|
7470
|
+
disableSchedule,
|
|
7471
|
+
disableScheduleTooltip,
|
|
7468
7472
|
continuationPlaceholder = "Add more details to continue this task\u2026",
|
|
7469
7473
|
readUrlParams = true,
|
|
7470
7474
|
executionId,
|
|
@@ -8181,7 +8185,6 @@ var AgentUI = ({
|
|
|
8181
8185
|
if (json.success === false) {
|
|
8182
8186
|
toast({ title: "Failed to submit", description: json.reason || "Try again later.", variant: "destructive" });
|
|
8183
8187
|
} else {
|
|
8184
|
-
toast({ title: "Submitted", description: "Agent will continue shortly." });
|
|
8185
8188
|
setQuestionAnswers({});
|
|
8186
8189
|
setContinuationText("");
|
|
8187
8190
|
setTimeout(() => {
|
|
@@ -8449,10 +8452,17 @@ var AgentUI = ({
|
|
|
8449
8452
|
else next.add(i);
|
|
8450
8453
|
return next;
|
|
8451
8454
|
});
|
|
8455
|
+
const handlePrimarySubmit = (0, import_react12.useCallback)(() => {
|
|
8456
|
+
if (submitOverride) {
|
|
8457
|
+
submitOverride({ input: actionInput, apps: chosenApps });
|
|
8458
|
+
} else {
|
|
8459
|
+
submitInput(actionInput);
|
|
8460
|
+
}
|
|
8461
|
+
}, [submitOverride, actionInput, chosenApps, submitInput]);
|
|
8452
8462
|
const onKeyDown = (e) => {
|
|
8453
8463
|
if ((e.metaKey || e.ctrlKey) && e.key === "Enter") {
|
|
8454
8464
|
e.preventDefault();
|
|
8455
|
-
|
|
8465
|
+
handlePrimarySubmit();
|
|
8456
8466
|
}
|
|
8457
8467
|
};
|
|
8458
8468
|
const activeTab = showStarter ? "start" : viewMode;
|
|
@@ -9036,6 +9046,7 @@ var AgentUI = ({
|
|
|
9036
9046
|
await onSchedule({
|
|
9037
9047
|
cron,
|
|
9038
9048
|
input: actionInput || "",
|
|
9049
|
+
apps: chosenApps.filter((a) => !!a?.name).map((a) => ({ name: a.name, id: a.id, icon: a.icon })),
|
|
9039
9050
|
onStep: (ev) => {
|
|
9040
9051
|
setScheduleSteps((prev) => prev.map((p) => p.id === ev.id ? { ...p, state: ev.state, detail: ev.detail } : p));
|
|
9041
9052
|
}
|
|
@@ -9084,14 +9095,14 @@ var AgentUI = ({
|
|
|
9084
9095
|
...Array.isArray(contentSx) ? contentSx : contentSx ? [contentSx] : []
|
|
9085
9096
|
],
|
|
9086
9097
|
children: [
|
|
9087
|
-
|
|
9098
|
+
showRunSwitcher && tabBar,
|
|
9088
9099
|
showStarter ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
9089
9100
|
import_material13.Box,
|
|
9090
9101
|
{
|
|
9091
9102
|
component: "form",
|
|
9092
9103
|
onSubmit: (e) => {
|
|
9093
9104
|
e.preventDefault();
|
|
9094
|
-
|
|
9105
|
+
handlePrimarySubmit();
|
|
9095
9106
|
},
|
|
9096
9107
|
sx: { display: "flex", flexDirection: "column", alignItems: "center", gap: compact ? 2 : 3, py: compact ? 2 : 4 },
|
|
9097
9108
|
children: [
|
|
@@ -9204,9 +9215,10 @@ var AgentUI = ({
|
|
|
9204
9215
|
),
|
|
9205
9216
|
(() => {
|
|
9206
9217
|
const allowWithoutExecution = showStarter;
|
|
9207
|
-
const
|
|
9218
|
+
const promptTooShort = showStarter && (actionInput || "").trim().length < 6;
|
|
9219
|
+
const canSchedule = (hasExecution || allowWithoutExecution) && !scheduleDisabledReason && !promptTooShort && !disableSchedule;
|
|
9208
9220
|
const hintActive = Boolean(scheduleHint) && canSchedule;
|
|
9209
|
-
const tip = scheduleDisabledReason ? scheduleDisabledTooltip : hintActive ? `Detected schedule: ${scheduleHint.label}. Click to review and save.` : "Schedule this prompt to run repeatedly on a cron schedule";
|
|
9221
|
+
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";
|
|
9210
9222
|
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_material13.Tooltip, { title: tip, placement: "top", arrow: true, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_material13.Box, { sx: { display: "inline-flex", alignItems: "center", gap: 0.5 }, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
9211
9223
|
import_material13.IconButton,
|
|
9212
9224
|
{
|
|
@@ -9268,7 +9280,48 @@ var AgentUI = ({
|
|
|
9268
9280
|
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_AttachFile.default, { sx: { fontSize: 18 } })
|
|
9269
9281
|
}
|
|
9270
9282
|
),
|
|
9271
|
-
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_material13.Tooltip, { title: submitTooltip, placement: "top", arrow: true, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { children: /* @__PURE__ */ (0, import_jsx_runtime15.
|
|
9283
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_material13.Tooltip, { title: submitTooltip, placement: "top", arrow: true, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { children: submitLabel ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_material13.Box, { sx: { display: "inline-flex", alignItems: "center", gap: 1 }, children: [
|
|
9284
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_material13.Tooltip, { title: "Try this prompt without saving", placement: "top", arrow: true, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
9285
|
+
import_material13.IconButton,
|
|
9286
|
+
{
|
|
9287
|
+
type: "button",
|
|
9288
|
+
onClick: () => submitInput(actionInput),
|
|
9289
|
+
disabled: actionInput.trim().length < 6 || agentRequestLoading,
|
|
9290
|
+
sx: {
|
|
9291
|
+
width: 36,
|
|
9292
|
+
height: 36,
|
|
9293
|
+
bgcolor: "transparent",
|
|
9294
|
+
border: "1px solid hsl(var(--border))",
|
|
9295
|
+
color: "hsl(var(--foreground))",
|
|
9296
|
+
"&:hover": { bgcolor: "hsl(var(--muted))" },
|
|
9297
|
+
"&.Mui-disabled": { color: "hsl(var(--muted-foreground))" }
|
|
9298
|
+
},
|
|
9299
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_PlayArrowRounded2.default, {})
|
|
9300
|
+
}
|
|
9301
|
+
) }),
|
|
9302
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
9303
|
+
import_material13.Button,
|
|
9304
|
+
{
|
|
9305
|
+
type: "submit",
|
|
9306
|
+
variant: "contained",
|
|
9307
|
+
disabled: actionInput.trim().length < 6 || agentRequestLoading,
|
|
9308
|
+
startIcon: agentRequestLoading ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_material13.CircularProgress, { size: 14, sx: { color: "inherit" } }) : null,
|
|
9309
|
+
sx: {
|
|
9310
|
+
height: 36,
|
|
9311
|
+
px: 2,
|
|
9312
|
+
textTransform: "none",
|
|
9313
|
+
fontSize: "0.85rem",
|
|
9314
|
+
fontWeight: 600,
|
|
9315
|
+
boxShadow: "none",
|
|
9316
|
+
bgcolor: "hsl(var(--primary))",
|
|
9317
|
+
color: "hsl(var(--primary-foreground))",
|
|
9318
|
+
"&:hover": { bgcolor: "hsl(var(--primary))", filter: "brightness(1.1)", boxShadow: "none" },
|
|
9319
|
+
"&.Mui-disabled": { bgcolor: "hsl(var(--muted))", color: "hsl(var(--muted-foreground))" }
|
|
9320
|
+
},
|
|
9321
|
+
children: submitLabel
|
|
9322
|
+
}
|
|
9323
|
+
)
|
|
9324
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
9272
9325
|
import_material13.IconButton,
|
|
9273
9326
|
{
|
|
9274
9327
|
type: "submit",
|
|
@@ -10206,10 +10259,11 @@ var searchAgentActivity = async (params = {}) => {
|
|
|
10206
10259
|
suborgRuns = false,
|
|
10207
10260
|
apiKey,
|
|
10208
10261
|
apiBaseUrl,
|
|
10209
|
-
orgId
|
|
10262
|
+
orgId,
|
|
10263
|
+
workflowId = "AGENT"
|
|
10210
10264
|
} = params;
|
|
10211
10265
|
const payload = {
|
|
10212
|
-
workflow_id:
|
|
10266
|
+
workflow_id: workflowId,
|
|
10213
10267
|
cursor,
|
|
10214
10268
|
limit,
|
|
10215
10269
|
status,
|
|
@@ -10236,8 +10290,80 @@ var searchAgentActivity = async (params = {}) => {
|
|
|
10236
10290
|
cursor: data.cursor || ""
|
|
10237
10291
|
};
|
|
10238
10292
|
};
|
|
10293
|
+
var listAgentScheduleWorkflows = async (params = {}) => {
|
|
10294
|
+
const { apiKey, apiBaseUrl, orgId } = params;
|
|
10295
|
+
const response = await fetch(resolveUrl("/api/v1/workflows", apiBaseUrl), {
|
|
10296
|
+
method: "GET",
|
|
10297
|
+
credentials: "include",
|
|
10298
|
+
headers: { "Content-Type": "application/json", ...resolveHeaders(apiKey, orgId) }
|
|
10299
|
+
});
|
|
10300
|
+
if (!response.ok) {
|
|
10301
|
+
throw new Error(`Failed to fetch workflows: ${response.statusText}`);
|
|
10302
|
+
}
|
|
10303
|
+
const data = await response.json();
|
|
10304
|
+
const list = Array.isArray(data) ? data : data?.workflows || [];
|
|
10305
|
+
return list.filter((w) => w && w.workflow_type === "AGENT_SCHEDULE").map((w) => ({ id: w.id || w._id, name: w.name || "Untitled", description: w.description }));
|
|
10306
|
+
};
|
|
10307
|
+
var findAgentInputParam = (workflow) => {
|
|
10308
|
+
const actions = workflow?.actions || [];
|
|
10309
|
+
for (const a of actions) {
|
|
10310
|
+
if ((a?.app_name || "").toLowerCase().includes("ai agent") || a?.app_id === "shuffle_agent") {
|
|
10311
|
+
const params = a?.parameters || [];
|
|
10312
|
+
const p = params.find((x) => x?.name === "input");
|
|
10313
|
+
if (p) return { action: a, param: p };
|
|
10314
|
+
}
|
|
10315
|
+
}
|
|
10316
|
+
return null;
|
|
10317
|
+
};
|
|
10318
|
+
var getWorkflow = async (workflowId, params = {}) => {
|
|
10319
|
+
const { apiKey, apiBaseUrl, orgId } = params;
|
|
10320
|
+
const res = await fetch(resolveUrl(`/api/v1/workflows/${workflowId}`, apiBaseUrl), {
|
|
10321
|
+
method: "GET",
|
|
10322
|
+
credentials: "include",
|
|
10323
|
+
headers: { "Content-Type": "application/json", ...resolveHeaders(apiKey, orgId) }
|
|
10324
|
+
});
|
|
10325
|
+
if (!res.ok) throw new Error(`Failed to fetch workflow: ${res.statusText}`);
|
|
10326
|
+
return res.json();
|
|
10327
|
+
};
|
|
10328
|
+
var getAgentScheduleConfig = async (workflowId, params = {}) => {
|
|
10329
|
+
const workflow = await getWorkflow(workflowId, params);
|
|
10330
|
+
const found = findAgentInputParam(workflow);
|
|
10331
|
+
const prompt = String(found?.param?.value || "");
|
|
10332
|
+
const action = found?.action;
|
|
10333
|
+
const actionParams = action?.parameters || [];
|
|
10334
|
+
const appNameParam = actionParams.find((x) => x?.name === "app_name");
|
|
10335
|
+
const raw = String(appNameParam?.value || "");
|
|
10336
|
+
const apps = raw.split(",").map((s) => s.trim()).filter(Boolean).map((name) => ({ name }));
|
|
10337
|
+
return { workflow, prompt, apps };
|
|
10338
|
+
};
|
|
10339
|
+
var stopAgentSchedule = async (workflowId, params = {}) => {
|
|
10340
|
+
const { apiKey, apiBaseUrl, orgId } = params;
|
|
10341
|
+
const headers = { ...resolveHeaders(apiKey, orgId) };
|
|
10342
|
+
try {
|
|
10343
|
+
const workflow = await getWorkflow(workflowId, params);
|
|
10344
|
+
const triggers = workflow?.triggers || [];
|
|
10345
|
+
const scheduleIds = triggers.filter((t) => (t?.trigger_type || "").toUpperCase() === "SCHEDULE").map((t) => t?.id || t?.id_ || t?._id_).filter(Boolean);
|
|
10346
|
+
await Promise.all(
|
|
10347
|
+
scheduleIds.map(
|
|
10348
|
+
(sid) => fetch(resolveUrl(`/api/v1/workflows/${workflowId}/schedule/${sid}`, apiBaseUrl), {
|
|
10349
|
+
method: "DELETE",
|
|
10350
|
+
credentials: "include",
|
|
10351
|
+
headers
|
|
10352
|
+
}).catch(() => void 0)
|
|
10353
|
+
)
|
|
10354
|
+
);
|
|
10355
|
+
} catch {
|
|
10356
|
+
}
|
|
10357
|
+
const res = await fetch(resolveUrl(`/api/v1/workflows/${workflowId}`, apiBaseUrl), {
|
|
10358
|
+
method: "DELETE",
|
|
10359
|
+
credentials: "include",
|
|
10360
|
+
headers
|
|
10361
|
+
});
|
|
10362
|
+
if (!res.ok) throw new Error(`Failed to stop schedule: ${res.statusText}`);
|
|
10363
|
+
};
|
|
10239
10364
|
|
|
10240
10365
|
// AgentActivityList.tsx
|
|
10366
|
+
var import_lucide_react6 = require("lucide-react");
|
|
10241
10367
|
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
10242
10368
|
var STATUS_CONFIG = {
|
|
10243
10369
|
FINISHED: { icon: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react5.CheckCircle, { size: 16 }), color: "hsl(var(--severity-low, 142 71% 45%))", label: "Completed" },
|
|
@@ -10325,11 +10451,30 @@ var getRunSubtitle = (run) => {
|
|
|
10325
10451
|
}
|
|
10326
10452
|
return run.execution_source || "Agent execution";
|
|
10327
10453
|
};
|
|
10454
|
+
var getRunTools = (run) => {
|
|
10455
|
+
const out = /* @__PURE__ */ new Set();
|
|
10456
|
+
const add = (v) => {
|
|
10457
|
+
if (!v) return;
|
|
10458
|
+
const s = String(v).trim();
|
|
10459
|
+
if (!s) return;
|
|
10460
|
+
if (/^(ai\s*agent|shuffle\s*agent|shuffle_agent)$/i.test(s)) return;
|
|
10461
|
+
out.add(s);
|
|
10462
|
+
};
|
|
10463
|
+
(run.results || []).forEach((r) => {
|
|
10464
|
+
add(r?.action?.app_name);
|
|
10465
|
+
if (!r?.action?.app_name) add(r?.action?.label);
|
|
10466
|
+
});
|
|
10467
|
+
(run.decisions || []).forEach((d) => {
|
|
10468
|
+
add(typeof d?.tool === "string" ? d.tool : void 0);
|
|
10469
|
+
});
|
|
10470
|
+
return Array.from(out).slice(0, 6);
|
|
10471
|
+
};
|
|
10328
10472
|
var AgentRunRow = ({ run, onClick, sx }) => {
|
|
10329
10473
|
const statusKey = (run.status || "").toUpperCase();
|
|
10330
10474
|
const cfg = STATUS_CONFIG[statusKey] || STATUS_CONFIG.WAITING;
|
|
10331
10475
|
const iconColor = getRunIconColor(run);
|
|
10332
10476
|
const duration = formatDuration(run);
|
|
10477
|
+
const tools = getRunTools(run);
|
|
10333
10478
|
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
10334
10479
|
import_material15.Box,
|
|
10335
10480
|
{
|
|
@@ -10409,7 +10554,42 @@ var AgentRunRow = ({ run, onClick, sx }) => {
|
|
|
10409
10554
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_material15.Typography, { sx: { fontSize: "0.72rem", color: "hsl(var(--muted-foreground))", opacity: 0.7 }, children: duration })
|
|
10410
10555
|
] })
|
|
10411
10556
|
] })
|
|
10412
|
-
] })
|
|
10557
|
+
] }),
|
|
10558
|
+
tools.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
10559
|
+
import_material15.Box,
|
|
10560
|
+
{
|
|
10561
|
+
sx: {
|
|
10562
|
+
display: { xs: "none", sm: "flex" },
|
|
10563
|
+
alignItems: "center",
|
|
10564
|
+
gap: 0.5,
|
|
10565
|
+
flexWrap: "wrap",
|
|
10566
|
+
justifyContent: "flex-end",
|
|
10567
|
+
maxWidth: 220,
|
|
10568
|
+
flexShrink: 0
|
|
10569
|
+
},
|
|
10570
|
+
children: tools.map((t) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_material15.Tooltip, { title: t, arrow: true, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
10571
|
+
import_material15.Chip,
|
|
10572
|
+
{
|
|
10573
|
+
label: t,
|
|
10574
|
+
size: "small",
|
|
10575
|
+
sx: {
|
|
10576
|
+
height: 20,
|
|
10577
|
+
fontSize: "0.68rem",
|
|
10578
|
+
maxWidth: 120,
|
|
10579
|
+
bgcolor: "hsla(var(--muted) / 0.5)",
|
|
10580
|
+
color: "hsl(var(--muted-foreground))",
|
|
10581
|
+
border: "1px solid hsl(var(--border))",
|
|
10582
|
+
"& .MuiChip-label": {
|
|
10583
|
+
px: 0.75,
|
|
10584
|
+
overflow: "hidden",
|
|
10585
|
+
textOverflow: "ellipsis",
|
|
10586
|
+
whiteSpace: "nowrap"
|
|
10587
|
+
}
|
|
10588
|
+
}
|
|
10589
|
+
}
|
|
10590
|
+
) }, t))
|
|
10591
|
+
}
|
|
10592
|
+
)
|
|
10413
10593
|
]
|
|
10414
10594
|
}
|
|
10415
10595
|
);
|
|
@@ -10425,6 +10605,7 @@ var AgentActivityList = ({
|
|
|
10425
10605
|
apiBaseUrl,
|
|
10426
10606
|
orgId,
|
|
10427
10607
|
onRunClick,
|
|
10608
|
+
onEditWorkflow,
|
|
10428
10609
|
showSearchBar = true,
|
|
10429
10610
|
showStatusChips = true,
|
|
10430
10611
|
limit = 50,
|
|
@@ -10443,7 +10624,41 @@ var AgentActivityList = ({
|
|
|
10443
10624
|
const [statusFilter, setStatusFilter] = (0, import_react14.useState)("");
|
|
10444
10625
|
const [searchQuery, setSearchQuery] = (0, import_react14.useState)("");
|
|
10445
10626
|
const [debouncedQuery, setDebouncedQuery] = (0, import_react14.useState)("");
|
|
10627
|
+
const [agentWorkflows, setAgentWorkflows] = (0, import_react14.useState)([]);
|
|
10628
|
+
const [workflowFilter, setWorkflowFilter] = (0, import_react14.useState)("");
|
|
10629
|
+
const [stopOpen, setStopOpen] = (0, import_react14.useState)(false);
|
|
10630
|
+
const [stopLoading, setStopLoading] = (0, import_react14.useState)(false);
|
|
10446
10631
|
const debounceRef = (0, import_react14.useRef)();
|
|
10632
|
+
const selectedAgentWorkflow = agentWorkflows.find((w) => w.id === workflowFilter) || null;
|
|
10633
|
+
const openEditPrompt = (0, import_react14.useCallback)(async () => {
|
|
10634
|
+
if (!workflowFilter) return;
|
|
10635
|
+
try {
|
|
10636
|
+
const { prompt, apps } = await getAgentScheduleConfig(workflowFilter, { apiKey, apiBaseUrl, orgId });
|
|
10637
|
+
onEditWorkflow?.({
|
|
10638
|
+
workflowId: workflowFilter,
|
|
10639
|
+
name: selectedAgentWorkflow?.name || "Schedule",
|
|
10640
|
+
prompt,
|
|
10641
|
+
apps
|
|
10642
|
+
});
|
|
10643
|
+
} catch (e) {
|
|
10644
|
+
setError(e instanceof Error ? e.message : "Failed to load workflow");
|
|
10645
|
+
}
|
|
10646
|
+
}, [workflowFilter, selectedAgentWorkflow, apiKey, apiBaseUrl, orgId, onEditWorkflow]);
|
|
10647
|
+
const confirmStop = (0, import_react14.useCallback)(async () => {
|
|
10648
|
+
if (!workflowFilter) return;
|
|
10649
|
+
setStopLoading(true);
|
|
10650
|
+
try {
|
|
10651
|
+
await stopAgentSchedule(workflowFilter, { apiKey, apiBaseUrl, orgId });
|
|
10652
|
+
setStopOpen(false);
|
|
10653
|
+
const items = await listAgentScheduleWorkflows({ apiKey, apiBaseUrl, orgId });
|
|
10654
|
+
setAgentWorkflows(items);
|
|
10655
|
+
setWorkflowFilter("");
|
|
10656
|
+
} catch (e) {
|
|
10657
|
+
setError(e instanceof Error ? e.message : "Failed to stop schedule");
|
|
10658
|
+
} finally {
|
|
10659
|
+
setStopLoading(false);
|
|
10660
|
+
}
|
|
10661
|
+
}, [workflowFilter, apiKey, apiBaseUrl, orgId]);
|
|
10447
10662
|
const updateSearchQuery = (0, import_react14.useCallback)((q) => {
|
|
10448
10663
|
setSearchQuery(q);
|
|
10449
10664
|
if (debounceRef.current) clearTimeout(debounceRef.current);
|
|
@@ -10463,7 +10678,8 @@ var AgentActivityList = ({
|
|
|
10463
10678
|
cursor: cursorParam,
|
|
10464
10679
|
apiKey,
|
|
10465
10680
|
apiBaseUrl,
|
|
10466
|
-
orgId
|
|
10681
|
+
orgId,
|
|
10682
|
+
workflowId: workflowFilter || "AGENT"
|
|
10467
10683
|
});
|
|
10468
10684
|
if (result.success) {
|
|
10469
10685
|
setRuns((prev) => append ? [...prev, ...result.runs] : result.runs);
|
|
@@ -10478,11 +10694,21 @@ var AgentActivityList = ({
|
|
|
10478
10694
|
setIsLoading(false);
|
|
10479
10695
|
}
|
|
10480
10696
|
},
|
|
10481
|
-
[statusFilter, limit, apiKey, apiBaseUrl, orgId]
|
|
10697
|
+
[statusFilter, limit, apiKey, apiBaseUrl, orgId, workflowFilter]
|
|
10482
10698
|
);
|
|
10483
10699
|
(0, import_react14.useEffect)(() => {
|
|
10484
10700
|
fetchRuns(false, "");
|
|
10485
|
-
}, [statusFilter, apiKey, apiBaseUrl, orgId]);
|
|
10701
|
+
}, [statusFilter, apiKey, apiBaseUrl, orgId, workflowFilter]);
|
|
10702
|
+
(0, import_react14.useEffect)(() => {
|
|
10703
|
+
let cancelled = false;
|
|
10704
|
+
listAgentScheduleWorkflows({ apiKey, apiBaseUrl, orgId }).then((items) => {
|
|
10705
|
+
if (!cancelled) setAgentWorkflows(items);
|
|
10706
|
+
}).catch(() => {
|
|
10707
|
+
});
|
|
10708
|
+
return () => {
|
|
10709
|
+
cancelled = true;
|
|
10710
|
+
};
|
|
10711
|
+
}, [apiKey, apiBaseUrl, orgId]);
|
|
10486
10712
|
const loadMore = (0, import_react14.useCallback)(() => {
|
|
10487
10713
|
if (cursor && !isLoading) fetchRuns(true, cursor);
|
|
10488
10714
|
}, [cursor, isLoading, fetchRuns]);
|
|
@@ -10503,6 +10729,48 @@ var AgentActivityList = ({
|
|
|
10503
10729
|
sx: [{ display: "flex", flexDirection: "column", gap: 2 }, ...Array.isArray(sx) ? sx : sx ? [sx] : []],
|
|
10504
10730
|
children: [
|
|
10505
10731
|
(showSearchBar || showStatusChips) && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_material15.Box, { sx: [{ display: "flex", alignItems: "center", justifyContent: "center", gap: 1.5, flexWrap: "wrap" }, ...Array.isArray(toolbarSx) ? toolbarSx : toolbarSx ? [toolbarSx] : []], children: [
|
|
10732
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
10733
|
+
import_material15.Select,
|
|
10734
|
+
{
|
|
10735
|
+
size: "small",
|
|
10736
|
+
value: workflowFilter,
|
|
10737
|
+
onChange: (e) => setWorkflowFilter(String(e.target.value)),
|
|
10738
|
+
displayEmpty: true,
|
|
10739
|
+
renderValue: (val) => {
|
|
10740
|
+
if (!val) return "All Agent runs";
|
|
10741
|
+
const wf = agentWorkflows.find((w) => w.id === val);
|
|
10742
|
+
return wf?.name || "Selected workflow";
|
|
10743
|
+
},
|
|
10744
|
+
sx: {
|
|
10745
|
+
height: 36,
|
|
10746
|
+
minWidth: 200,
|
|
10747
|
+
maxWidth: 260,
|
|
10748
|
+
fontSize: "0.85rem",
|
|
10749
|
+
bgcolor: "hsl(var(--card))",
|
|
10750
|
+
color: "hsl(var(--foreground))",
|
|
10751
|
+
borderRadius: 1.5,
|
|
10752
|
+
"& .MuiOutlinedInput-notchedOutline": { borderColor: "hsl(var(--border))" },
|
|
10753
|
+
"&:hover .MuiOutlinedInput-notchedOutline": { borderColor: "hsl(var(--muted-foreground) / 0.3)" },
|
|
10754
|
+
"&.Mui-focused .MuiOutlinedInput-notchedOutline": { borderColor: "hsl(var(--primary))" }
|
|
10755
|
+
},
|
|
10756
|
+
MenuProps: {
|
|
10757
|
+
slotProps: {
|
|
10758
|
+
paper: {
|
|
10759
|
+
sx: {
|
|
10760
|
+
bgcolor: "hsl(var(--card))",
|
|
10761
|
+
border: "1px solid hsl(var(--border))",
|
|
10762
|
+
color: "hsl(var(--foreground))",
|
|
10763
|
+
maxHeight: 320
|
|
10764
|
+
}
|
|
10765
|
+
}
|
|
10766
|
+
}
|
|
10767
|
+
},
|
|
10768
|
+
children: [
|
|
10769
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_material15.MenuItem, { value: "", sx: { fontSize: "0.85rem" }, children: "All Agent runs" }),
|
|
10770
|
+
agentWorkflows.map((w) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_material15.MenuItem, { value: w.id, sx: { fontSize: "0.85rem" }, children: w.name }, w.id))
|
|
10771
|
+
]
|
|
10772
|
+
}
|
|
10773
|
+
),
|
|
10506
10774
|
showSearchBar && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
10507
10775
|
import_material15.TextField,
|
|
10508
10776
|
{
|
|
@@ -10552,6 +10820,64 @@ var AgentActivityList = ({
|
|
|
10552
10820
|
)),
|
|
10553
10821
|
isLoading && runs.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_material15.CircularProgress, { size: 16, sx: { color: "hsl(var(--primary))", ml: 0.5 } })
|
|
10554
10822
|
] }),
|
|
10823
|
+
selectedAgentWorkflow && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
10824
|
+
import_material15.Box,
|
|
10825
|
+
{
|
|
10826
|
+
sx: {
|
|
10827
|
+
display: "flex",
|
|
10828
|
+
alignItems: "center",
|
|
10829
|
+
gap: 1.5,
|
|
10830
|
+
p: 1.5,
|
|
10831
|
+
borderRadius: 2,
|
|
10832
|
+
border: "1px solid hsl(var(--border))",
|
|
10833
|
+
bgcolor: "hsl(var(--card))"
|
|
10834
|
+
},
|
|
10835
|
+
children: [
|
|
10836
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_material15.Box, { sx: { flex: 1, minWidth: 0 }, children: [
|
|
10837
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_material15.Typography, { sx: { fontSize: "0.85rem", fontWeight: 600, color: "hsl(var(--foreground))", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: selectedAgentWorkflow.name }),
|
|
10838
|
+
selectedAgentWorkflow.description && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_material15.Typography, { sx: { fontSize: "0.75rem", color: "hsl(var(--muted-foreground))", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: selectedAgentWorkflow.description })
|
|
10839
|
+
] }),
|
|
10840
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
10841
|
+
import_material15.Button,
|
|
10842
|
+
{
|
|
10843
|
+
size: "small",
|
|
10844
|
+
startIcon: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react6.Pencil, { size: 14 }),
|
|
10845
|
+
onClick: openEditPrompt,
|
|
10846
|
+
sx: {
|
|
10847
|
+
height: 36,
|
|
10848
|
+
border: "1px solid hsl(var(--border))",
|
|
10849
|
+
borderRadius: 1.5,
|
|
10850
|
+
color: "hsl(var(--foreground))",
|
|
10851
|
+
textTransform: "none",
|
|
10852
|
+
fontSize: "0.8rem",
|
|
10853
|
+
px: 1.5,
|
|
10854
|
+
"&:hover": { bgcolor: "hsl(var(--muted))" }
|
|
10855
|
+
},
|
|
10856
|
+
children: "Edit"
|
|
10857
|
+
}
|
|
10858
|
+
),
|
|
10859
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
10860
|
+
import_material15.Button,
|
|
10861
|
+
{
|
|
10862
|
+
size: "small",
|
|
10863
|
+
startIcon: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react6.StopCircle, { size: 14 }),
|
|
10864
|
+
onClick: () => setStopOpen(true),
|
|
10865
|
+
sx: {
|
|
10866
|
+
height: 36,
|
|
10867
|
+
border: "1px solid hsl(var(--severity-critical, 0 72% 55%) / 0.4)",
|
|
10868
|
+
borderRadius: 1.5,
|
|
10869
|
+
color: "hsl(var(--severity-critical, 0 72% 55%))",
|
|
10870
|
+
textTransform: "none",
|
|
10871
|
+
fontSize: "0.8rem",
|
|
10872
|
+
px: 1.5,
|
|
10873
|
+
"&:hover": { bgcolor: "hsla(var(--severity-critical, 0 72% 55%) / 0.08)" }
|
|
10874
|
+
},
|
|
10875
|
+
children: "Stop schedule"
|
|
10876
|
+
}
|
|
10877
|
+
)
|
|
10878
|
+
]
|
|
10879
|
+
}
|
|
10880
|
+
),
|
|
10555
10881
|
isLoading && runs.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_material15.Box, { sx: { display: "flex", justifyContent: "center", py: 8 }, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_material15.CircularProgress, { size: 28, sx: { color: "hsl(var(--primary))" } }) }) : error ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_material15.Box, { sx: { display: "flex", flexDirection: "column", alignItems: "center", textAlign: "center", py: 6 }, children: [
|
|
10556
10882
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react5.AlertCircle, { size: 28, style: { color: "hsl(var(--severity-critical, 0 72% 55%))", marginBottom: 8 } }),
|
|
10557
10883
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
@@ -10609,7 +10935,38 @@ var AgentActivityList = ({
|
|
|
10609
10935
|
]
|
|
10610
10936
|
}
|
|
10611
10937
|
) })
|
|
10612
|
-
] })
|
|
10938
|
+
] }),
|
|
10939
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
10940
|
+
import_material15.Dialog,
|
|
10941
|
+
{
|
|
10942
|
+
open: stopOpen,
|
|
10943
|
+
onClose: () => stopLoading ? null : setStopOpen(false),
|
|
10944
|
+
slotProps: { paper: { sx: { bgcolor: "hsl(var(--card))", color: "hsl(var(--foreground))", border: "1px solid hsl(var(--border))" } } },
|
|
10945
|
+
children: [
|
|
10946
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_material15.DialogTitle, { sx: { fontSize: "1rem", fontWeight: 600 }, children: "Stop schedule?" }),
|
|
10947
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_material15.DialogContent, { children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_material15.Typography, { sx: { fontSize: "0.85rem", color: "hsl(var(--muted-foreground))" }, children: [
|
|
10948
|
+
'This will stop "',
|
|
10949
|
+
selectedAgentWorkflow?.name,
|
|
10950
|
+
'" and delete the scheduled workflow. Past executions remain visible. This cannot be undone.'
|
|
10951
|
+
] }) }),
|
|
10952
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_material15.DialogActions, { sx: { px: 3, pb: 2 }, children: [
|
|
10953
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_material15.Button, { onClick: () => setStopOpen(false), disabled: stopLoading, sx: { textTransform: "none", color: "hsl(var(--muted-foreground))" }, children: "Cancel" }),
|
|
10954
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
10955
|
+
import_material15.Button,
|
|
10956
|
+
{
|
|
10957
|
+
onClick: confirmStop,
|
|
10958
|
+
disabled: stopLoading,
|
|
10959
|
+
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)" } },
|
|
10960
|
+
children: [
|
|
10961
|
+
stopLoading ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_material15.CircularProgress, { size: 16, sx: { color: "hsl(var(--primary-foreground))", mr: 1 } }) : null,
|
|
10962
|
+
"Stop schedule"
|
|
10963
|
+
]
|
|
10964
|
+
}
|
|
10965
|
+
)
|
|
10966
|
+
] })
|
|
10967
|
+
]
|
|
10968
|
+
}
|
|
10969
|
+
)
|
|
10613
10970
|
]
|
|
10614
10971
|
}
|
|
10615
10972
|
);
|