@axiom-lattice/react-sdk 2.1.76 → 2.1.78

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.js CHANGED
@@ -8804,7 +8804,7 @@ var import_antd72 = require("antd");
8804
8804
 
8805
8805
  // src/components/Chat/Chating.tsx
8806
8806
  var import_icons37 = require("@ant-design/icons");
8807
- var import_x7 = require("@ant-design/x");
8807
+ var import_x6 = require("@ant-design/x");
8808
8808
 
8809
8809
  // src/components/Chat/MessageList.tsx
8810
8810
  var import_x3 = require("@ant-design/x");
@@ -18090,142 +18090,10 @@ var TopologyNode_default = TopologyNode;
18090
18090
 
18091
18091
  // src/components/Chat/CopilotPanel.tsx
18092
18092
  var import_react61 = require("react");
18093
- var import_x4 = require("@ant-design/x");
18094
18093
  var import_antd54 = require("antd");
18095
18094
  var import_icons31 = require("@ant-design/icons");
18096
18095
  var import_jsx_runtime73 = require("react/jsx-runtime");
18097
18096
  var { Text: Text25 } = import_antd54.Typography;
18098
- var CopilotPanelChatBody = ({ workflowContext, initialMessage, onInitialMessageSent }) => {
18099
- const {
18100
- messages,
18101
- isLoading,
18102
- error: chatError,
18103
- sendMessage,
18104
- stopStreaming,
18105
- threadId
18106
- } = useAgentChat();
18107
- const [inputValue, setInputValue] = (0, import_react61.useState)("");
18108
- const contextSentRef = (0, import_react61.useRef)(false);
18109
- const initialMessageSentRef = (0, import_react61.useRef)(false);
18110
- const prevLoadingRef = (0, import_react61.useRef)(false);
18111
- const workflowId = workflowContext?.id;
18112
- const workflowName = workflowContext?.name;
18113
- (0, import_react61.useEffect)(() => {
18114
- contextSentRef.current = false;
18115
- }, [threadId]);
18116
- (0, import_react61.useEffect)(() => {
18117
- initialMessageSentRef.current = false;
18118
- }, [threadId]);
18119
- (0, import_react61.useEffect)(() => {
18120
- const wasLoading = prevLoadingRef.current;
18121
- prevLoadingRef.current = isLoading;
18122
- if (wasLoading && !isLoading && initialMessage && threadId && !initialMessageSentRef.current) {
18123
- initialMessageSentRef.current = true;
18124
- const message23 = initialMessage.trim();
18125
- if (message23) {
18126
- const formattedMessage = [
18127
- `Purpose: ${message23}`,
18128
- "",
18129
- `Configure the topology for workflow "${workflowId}" based on this purpose. Create sub-agents, set up the processing pipeline, and wire them together with topology edges.`,
18130
- `The current name is a placeholder \u2014 feel free to update it via update_processing_agent if you have a better one.`
18131
- ].join("\n");
18132
- sendMessage({
18133
- input: { message: formattedMessage },
18134
- streaming: true
18135
- });
18136
- onInitialMessageSent?.();
18137
- }
18138
- }
18139
- }, [isLoading, initialMessage, threadId, sendMessage, onInitialMessageSent, workflowId, workflowName]);
18140
- const handleSubmit = (0, import_react61.useCallback)(
18141
- (nextContent) => {
18142
- if (!nextContent.trim()) return;
18143
- let finalContent = nextContent;
18144
- if (workflowId && workflowName && !contextSentRef.current) {
18145
- finalContent = `[Context: You're viewing workflow "${workflowName}" (agent: ${workflowId})]
18146
- User: ${nextContent}`;
18147
- contextSentRef.current = true;
18148
- }
18149
- sendMessage({
18150
- input: { message: finalContent },
18151
- streaming: true
18152
- });
18153
- setInputValue("");
18154
- },
18155
- [workflowId, workflowName, sendMessage]
18156
- );
18157
- const isEmpty = messages.length === 0 && !isLoading;
18158
- const showContentLoading = isLoading && messages.length === 0;
18159
- const hasContent = !isEmpty;
18160
- return /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)(
18161
- "div",
18162
- {
18163
- style: {
18164
- flex: 1,
18165
- minHeight: 0,
18166
- display: "flex",
18167
- flexDirection: "column",
18168
- padding: 0
18169
- },
18170
- children: [
18171
- isEmpty && /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)(
18172
- "div",
18173
- {
18174
- style: {
18175
- display: "flex",
18176
- flexDirection: "column",
18177
- justifyContent: "center",
18178
- alignItems: "center",
18179
- height: "100%",
18180
- textAlign: "center",
18181
- gap: 4
18182
- },
18183
- children: [
18184
- /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(Text25, { strong: true, children: "Workflow Builder" }),
18185
- /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(Text25, { type: "secondary", children: "Ask me to design, review, or modify your workflows" })
18186
- ]
18187
- }
18188
- ),
18189
- showContentLoading && /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
18190
- "div",
18191
- {
18192
- style: {
18193
- display: "flex",
18194
- justifyContent: "center",
18195
- alignItems: "center",
18196
- height: "100%"
18197
- },
18198
- children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(import_antd54.Spin, {})
18199
- }
18200
- ),
18201
- hasContent && /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { style: { flex: 1, minHeight: 0, display: "flex" }, children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(MessageList, { messages }) }),
18202
- chatError && /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { style: { padding: "8px 8px" }, children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(Text25, { type: "danger", children: chatError.message }) }),
18203
- /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
18204
- "div",
18205
- {
18206
- style: {
18207
- padding: "12px 8px",
18208
- borderTop: "1px solid #f0f0f0",
18209
- flexShrink: 0
18210
- },
18211
- children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
18212
- import_x4.Sender,
18213
- {
18214
- value: inputValue,
18215
- placeholder: "Ask about workflows...",
18216
- onChange: setInputValue,
18217
- onSubmit: handleSubmit,
18218
- loading: isLoading,
18219
- onCancel: () => stopStreaming(),
18220
- allowSpeech: false
18221
- }
18222
- )
18223
- }
18224
- )
18225
- ]
18226
- }
18227
- );
18228
- };
18229
18097
  var CopilotPanel = ({
18230
18098
  workflowContext,
18231
18099
  onClose,
@@ -18235,6 +18103,21 @@ var CopilotPanel = ({
18235
18103
  }) => {
18236
18104
  const client = useClient("agent-architect");
18237
18105
  const threadId = workflowContext?.id ? `${client.tenantId}:${workflowContext.id}` : null;
18106
+ const systemContext = (0, import_react61.useMemo)(() => {
18107
+ if (workflowContext?.id && workflowContext?.name) {
18108
+ return `[Context: You're viewing workflow "${workflowContext.name}" (agent: ${workflowContext.id})]`;
18109
+ }
18110
+ return void 0;
18111
+ }, [workflowContext]);
18112
+ const initialMessageContent = (0, import_react61.useMemo)(() => {
18113
+ if (!initialMessage || !workflowContext?.id) return void 0;
18114
+ return [
18115
+ `Purpose: ${initialMessage.trim()}`,
18116
+ "",
18117
+ `Configure the topology for workflow "${workflowContext.id}" based on this purpose. Create sub-agents, set up the processing pipeline, and wire them together with topology edges.`,
18118
+ `The current name is a placeholder \u2014 feel free to update it via update_processing_agent if you have a better one.`
18119
+ ].join("\n");
18120
+ }, [initialMessage, workflowContext?.id]);
18238
18121
  return /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)(
18239
18122
  "div",
18240
18123
  {
@@ -18286,10 +18169,16 @@ var CopilotPanel = ({
18286
18169
  options: { streaming: true },
18287
18170
  onToolCompleted,
18288
18171
  children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
18289
- CopilotPanelChatBody,
18172
+ Chating,
18290
18173
  {
18291
- workflowContext,
18292
- initialMessage,
18174
+ showHeader: false,
18175
+ showEmptyState: false,
18176
+ showDatabaseSlot: false,
18177
+ showSkillSlot: false,
18178
+ showAgentSlot: false,
18179
+ showMetricsDataSourceSlot: false,
18180
+ systemContext,
18181
+ initialMessage: initialMessageContent,
18293
18182
  onInitialMessageSent
18294
18183
  }
18295
18184
  )
@@ -18530,6 +18419,7 @@ function TopologyFlowInner({
18530
18419
  selectedWorkflowId,
18531
18420
  onSelectWorkflow,
18532
18421
  onCreateWorkflow,
18422
+ onDeleteWorkflow,
18533
18423
  nodes: initialNodes,
18534
18424
  edges: initialEdges
18535
18425
  }) {
@@ -18661,7 +18551,8 @@ function TopologyFlowInner({
18661
18551
  display: "flex",
18662
18552
  alignItems: "center",
18663
18553
  gap: 6,
18664
- padding: "6px 14px",
18554
+ height: 32,
18555
+ padding: "0 14px",
18665
18556
  background: "rgba(255,255,255,0.95)",
18666
18557
  borderRadius: 10,
18667
18558
  boxShadow: "0 2px 12px rgba(0,0,0,0.08)",
@@ -18679,6 +18570,42 @@ function TopologyFlowInner({
18679
18570
  ]
18680
18571
  }
18681
18572
  ),
18573
+ /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
18574
+ "div",
18575
+ {
18576
+ style: {
18577
+ position: "absolute",
18578
+ top: 12,
18579
+ right: 12,
18580
+ zIndex: 10,
18581
+ display: "flex",
18582
+ alignItems: "center",
18583
+ height: 32,
18584
+ padding: "0 14px",
18585
+ background: "rgba(255,255,255,0.95)",
18586
+ borderRadius: 10,
18587
+ boxShadow: "0 2px 12px rgba(0,0,0,0.08)",
18588
+ border: "1px solid #f0f0f0"
18589
+ },
18590
+ children: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
18591
+ import_antd56.Popconfirm,
18592
+ {
18593
+ title: "Delete workflow",
18594
+ description: "This will delete the workflow and all associated topology. This action cannot be undone.",
18595
+ onConfirm: () => onDeleteWorkflow(selectedAgent.id),
18596
+ okText: "Delete",
18597
+ cancelText: "Cancel",
18598
+ okButtonProps: { danger: true },
18599
+ children: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
18600
+ import_icons32.DeleteOutlined,
18601
+ {
18602
+ style: { color: "#ff4d4f", cursor: "pointer", fontSize: 15 }
18603
+ }
18604
+ )
18605
+ }
18606
+ )
18607
+ }
18608
+ ),
18682
18609
  /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
18683
18610
  import_antd56.Modal,
18684
18611
  {
@@ -18707,7 +18634,7 @@ function TopologyFlowInner({
18707
18634
  ] });
18708
18635
  }
18709
18636
  var TopologyAutomationView = () => {
18710
- const { get } = useApi();
18637
+ const { get, del } = useApi();
18711
18638
  const [agents, setAgents] = (0, import_react63.useState)([]);
18712
18639
  const [agentNameMap, setAgentNameMap] = (0, import_react63.useState)(/* @__PURE__ */ new Map());
18713
18640
  const [selectedWorkflowId, setSelectedWorkflowId] = (0, import_react63.useState)(null);
@@ -18781,6 +18708,16 @@ var TopologyAutomationView = () => {
18781
18708
  const handleSelectWorkflow = (0, import_react63.useCallback)((id) => {
18782
18709
  setSelectedWorkflowId(id);
18783
18710
  }, []);
18711
+ const handleDeleteWorkflow = (0, import_react63.useCallback)(async (id) => {
18712
+ try {
18713
+ await del(`/api/assistants/${id}`);
18714
+ setSelectedWorkflowId(null);
18715
+ await fetchData();
18716
+ } catch (err) {
18717
+ const message23 = err instanceof Error ? err.message : "Failed to delete workflow";
18718
+ setError(message23);
18719
+ }
18720
+ }, [del, fetchData]);
18784
18721
  const selectedAgent = (0, import_react63.useMemo)(
18785
18722
  () => agents.find((a) => a.id === selectedWorkflowId) || null,
18786
18723
  [agents, selectedWorkflowId]
@@ -18851,6 +18788,7 @@ var TopologyAutomationView = () => {
18851
18788
  selectedWorkflowId,
18852
18789
  onSelectWorkflow: handleSelectWorkflow,
18853
18790
  onCreateWorkflow: () => setIsCreateModalOpen(true),
18791
+ onDeleteWorkflow: handleDeleteWorkflow,
18854
18792
  nodes,
18855
18793
  edges
18856
18794
  }
@@ -19391,26 +19329,69 @@ function RunSummaryBanner({ run, agentName }) {
19391
19329
  }
19392
19330
  );
19393
19331
  }
19394
- var RunDetail = ({ run, agentName, open, onClose }) => {
19332
+ var RunDetail = ({ run, agentName, open, onClose, onRunUpdate, autoRefresh, onAutoRefreshChange }) => {
19395
19333
  const { get } = useApi();
19396
19334
  const [steps, setSteps] = (0, import_react65.useState)([]);
19397
19335
  const [loading, setLoading] = (0, import_react65.useState)(false);
19336
+ const stepsPollTimeoutRef = (0, import_react65.useRef)(null);
19337
+ const stepsPollSessionRef = (0, import_react65.useRef)(0);
19338
+ const fetchSteps = (0, import_react65.useCallback)(async () => {
19339
+ try {
19340
+ const [stepsRes, runsRes] = await Promise.all([
19341
+ get(
19342
+ `/api/workflows/runs/${run.id}/steps`
19343
+ ),
19344
+ get(
19345
+ "/api/workflows/runs"
19346
+ )
19347
+ ]);
19348
+ if (stepsRes.success) setSteps(stepsRes.data?.records || []);
19349
+ if (runsRes.success && runsRes.data?.records) {
19350
+ const matched = runsRes.data.records.find((r) => r.id === run.id);
19351
+ if (matched) onRunUpdate(matched);
19352
+ }
19353
+ } catch {
19354
+ }
19355
+ }, [get, run.id, onRunUpdate]);
19398
19356
  (0, import_react65.useEffect)(() => {
19399
19357
  if (!open) return;
19400
19358
  setLoading(true);
19401
- get(
19402
- `/api/workflows/runs/${run.id}/steps`
19403
- ).then((res) => {
19404
- if (res.success) setSteps(res.data?.records || []);
19405
- }).catch(() => {
19406
- }).finally(() => setLoading(false));
19407
- }, [open, run.id, get]);
19359
+ fetchSteps().finally(() => setLoading(false));
19360
+ }, [open, run.id, fetchSteps]);
19361
+ (0, import_react65.useEffect)(() => {
19362
+ if (stepsPollTimeoutRef.current) {
19363
+ clearTimeout(stepsPollTimeoutRef.current);
19364
+ stepsPollTimeoutRef.current = null;
19365
+ }
19366
+ if (!open || run.status !== "running" || !autoRefresh) return;
19367
+ const sessionId = Date.now();
19368
+ stepsPollSessionRef.current = sessionId;
19369
+ const poll = async () => {
19370
+ if (stepsPollSessionRef.current !== sessionId) return;
19371
+ await fetchSteps();
19372
+ if (stepsPollSessionRef.current === sessionId) {
19373
+ stepsPollTimeoutRef.current = setTimeout(poll, POLLING_INTERVAL);
19374
+ }
19375
+ };
19376
+ poll();
19377
+ return () => {
19378
+ stepsPollSessionRef.current = 0;
19379
+ if (stepsPollTimeoutRef.current) {
19380
+ clearTimeout(stepsPollTimeoutRef.current);
19381
+ stepsPollTimeoutRef.current = null;
19382
+ }
19383
+ };
19384
+ }, [open, run.status, fetchSteps, autoRefresh]);
19408
19385
  return /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)(
19409
19386
  import_antd57.Drawer,
19410
19387
  {
19411
19388
  title: /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)(import_antd57.Space, { children: [
19412
19389
  /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(Text27, { strong: true, children: "Pipeline Execution" }),
19413
- /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(import_antd57.Tag, { color: "purple", style: { fontSize: 11 }, children: "Flow View" })
19390
+ /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(import_antd57.Tag, { color: "purple", style: { fontSize: 11 }, children: "Flow View" }),
19391
+ /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)(import_antd57.Space, { size: 4, style: { marginLeft: 12 }, children: [
19392
+ /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(Text27, { type: "secondary", style: { fontSize: 11 }, children: "Auto-refresh" }),
19393
+ /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(import_antd57.Switch, { size: "small", checked: autoRefresh, onChange: onAutoRefreshChange })
19394
+ ] })
19414
19395
  ] }),
19415
19396
  placement: "right",
19416
19397
  width: "90%",
@@ -19436,16 +19417,64 @@ var RunDetail = ({ run, agentName, open, onClose }) => {
19436
19417
  }
19437
19418
  );
19438
19419
  };
19420
+ var POLLING_INTERVAL = 3e3;
19439
19421
  var TopologyRuntimeView = () => {
19440
- const { get } = useApi();
19422
+ const { get, del } = useApi();
19441
19423
  const [runs, setRuns] = (0, import_react65.useState)([]);
19442
19424
  const [agentNames, setAgentNames] = (0, import_react65.useState)({});
19443
19425
  const [loading, setLoading] = (0, import_react65.useState)(true);
19444
19426
  const [error, setError] = (0, import_react65.useState)(null);
19445
19427
  const [selectedRun, setSelectedRun] = (0, import_react65.useState)(null);
19428
+ const [autoRefresh, setAutoRefresh] = (0, import_react65.useState)(true);
19429
+ const pollingSessionRef = (0, import_react65.useRef)(0);
19430
+ const handleRunUpdate = (0, import_react65.useCallback)((updated) => {
19431
+ setRuns(
19432
+ (prev) => prev.map((r) => r.id === updated.id ? updated : r)
19433
+ );
19434
+ setSelectedRun((prev) => prev?.id === updated.id ? updated : prev);
19435
+ }, []);
19436
+ const handleDeleteRun = (0, import_react65.useCallback)(async (runId) => {
19437
+ try {
19438
+ await del(`/api/workflows/runs/${runId}`);
19439
+ setRuns((prev) => prev.filter((r) => r.id !== runId));
19440
+ setSelectedRun((prev) => prev?.id === runId ? null : prev);
19441
+ } catch (err) {
19442
+ const message23 = err instanceof Error ? err.message : "Failed to delete run";
19443
+ setError(message23);
19444
+ }
19445
+ }, [del]);
19446
+ const refreshRuns = (0, import_react65.useCallback)(async () => {
19447
+ setLoading(true);
19448
+ try {
19449
+ const defsRes = await get("/api/workflows/definitions");
19450
+ const nameMap = {};
19451
+ if (defsRes.success && defsRes.data?.records) {
19452
+ defsRes.data.records.forEach((d) => {
19453
+ nameMap[d.assistantId] = d.assistantName;
19454
+ });
19455
+ }
19456
+ setAgentNames(nameMap);
19457
+ const runsRes = await get("/api/workflows/runs");
19458
+ if (runsRes.success && runsRes.data?.records) {
19459
+ runsRes.data.records.sort(
19460
+ (a, b) => new Date(b.startedAt).getTime() - new Date(a.startedAt).getTime()
19461
+ );
19462
+ setRuns(runsRes.data.records);
19463
+ setSelectedRun((prev) => {
19464
+ if (!prev) return null;
19465
+ return runsRes.data.records.find((r) => r.id === prev.id) || prev;
19466
+ });
19467
+ }
19468
+ setError(null);
19469
+ } catch (err) {
19470
+ setError(err instanceof Error ? err.message : "Failed to load workflow runs");
19471
+ } finally {
19472
+ setLoading(false);
19473
+ }
19474
+ }, [get]);
19446
19475
  (0, import_react65.useEffect)(() => {
19447
19476
  let cancelled = false;
19448
- const fetchData = async () => {
19477
+ const init2 = async () => {
19449
19478
  try {
19450
19479
  setLoading(true);
19451
19480
  const defsRes = await get("/api/workflows/definitions");
@@ -19474,11 +19503,16 @@ var TopologyRuntimeView = () => {
19474
19503
  if (!cancelled) setLoading(false);
19475
19504
  }
19476
19505
  };
19477
- fetchData();
19506
+ init2();
19478
19507
  return () => {
19479
19508
  cancelled = true;
19480
19509
  };
19481
19510
  }, [get]);
19511
+ (0, import_react65.useEffect)(() => {
19512
+ return () => {
19513
+ pollingSessionRef.current = 0;
19514
+ };
19515
+ }, []);
19482
19516
  if (loading) {
19483
19517
  return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("div", { style: { display: "flex", justifyContent: "center", alignItems: "center", height: "100%" }, children: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(import_antd57.Spin, { size: "large" }) });
19484
19518
  }
@@ -19489,7 +19523,16 @@ var TopologyRuntimeView = () => {
19489
19523
  return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(import_antd57.Empty, { description: "No workflow runs yet. Execute a processing agent to see results here." });
19490
19524
  }
19491
19525
  return /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)("div", { style: { padding: 16, overflow: "auto", height: "100%" }, children: [
19492
- /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(Title5, { level: 5, style: { marginBottom: 16 }, children: "Workflow Runs" }),
19526
+ /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center", marginBottom: 16 }, children: [
19527
+ /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(Title5, { level: 5, style: { marginBottom: 0 }, children: "Workflow Runs" }),
19528
+ /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(import_antd57.Tooltip, { title: "Refresh now", children: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
19529
+ import_icons33.ReloadOutlined,
19530
+ {
19531
+ style: { cursor: "pointer", color: "#999" },
19532
+ onClick: () => refreshRuns()
19533
+ }
19534
+ ) })
19535
+ ] }),
19493
19536
  /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
19494
19537
  import_antd57.List,
19495
19538
  {
@@ -19530,7 +19573,25 @@ var TopologyRuntimeView = () => {
19530
19573
  run.totalEdges
19531
19574
  ] }),
19532
19575
  /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(import_antd57.Tag, { color: sc.color, icon: sc.icon, children: sc.label }),
19533
- /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(Text27, { type: "secondary", style: { fontSize: 11 }, children: formatTime(run.startedAt) })
19576
+ /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(Text27, { type: "secondary", style: { fontSize: 11 }, children: formatTime(run.startedAt) }),
19577
+ /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
19578
+ import_antd57.Popconfirm,
19579
+ {
19580
+ title: "Delete run",
19581
+ description: "Delete this workflow run and all its step records?",
19582
+ onConfirm: () => handleDeleteRun(run.id),
19583
+ okText: "Delete",
19584
+ cancelText: "Cancel",
19585
+ okButtonProps: { danger: true },
19586
+ children: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
19587
+ import_icons33.DeleteOutlined,
19588
+ {
19589
+ style: { color: "#ff4d4f", cursor: "pointer", fontSize: 13 },
19590
+ onClick: (e) => e.stopPropagation()
19591
+ }
19592
+ )
19593
+ }
19594
+ )
19534
19595
  ] })
19535
19596
  ] })
19536
19597
  },
@@ -19545,7 +19606,10 @@ var TopologyRuntimeView = () => {
19545
19606
  run: selectedRun,
19546
19607
  agentName: agentNames[selectedRun.assistantId] || selectedRun.assistantId,
19547
19608
  open: !!selectedRun,
19548
- onClose: () => setSelectedRun(null)
19609
+ onClose: () => setSelectedRun(null),
19610
+ onRunUpdate: handleRunUpdate,
19611
+ autoRefresh,
19612
+ onAutoRefreshChange: setAutoRefresh
19549
19613
  }
19550
19614
  )
19551
19615
  ] });
@@ -22304,7 +22368,7 @@ var ModelSelector = ({
22304
22368
 
22305
22369
  // src/components/Chat/SkillCategoryPrompts.tsx
22306
22370
  var import_icons35 = require("@ant-design/icons");
22307
- var import_x5 = require("@ant-design/x");
22371
+ var import_x4 = require("@ant-design/x");
22308
22372
  var import_antd69 = require("antd");
22309
22373
  var import_react78 = require("react");
22310
22374
  var import_lucide_react19 = require("lucide-react");
@@ -22499,7 +22563,7 @@ var SkillCategoryPrompts = ({
22499
22563
  overflowX: "hidden"
22500
22564
  },
22501
22565
  children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
22502
- import_x5.Prompts,
22566
+ import_x4.Prompts,
22503
22567
  {
22504
22568
  title: "\u2728 Quick actions",
22505
22569
  items: getSimpleItems(),
@@ -22537,7 +22601,7 @@ var SkillCategoryPrompts = ({
22537
22601
  children: Object.entries(groupedSkills).map(([category, categorySkills]) => {
22538
22602
  const config = getCategoryConfig(category);
22539
22603
  return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("div", { style: { marginBottom: 16 }, children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
22540
- import_x5.Prompts,
22604
+ import_x4.Prompts,
22541
22605
  {
22542
22606
  title: /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)(import_antd69.Space, { children: [
22543
22607
  /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("span", { style: { color: config.color }, children: config.icon }),
@@ -22567,7 +22631,7 @@ var SkillCategoryPrompts_default = SkillCategoryPrompts;
22567
22631
 
22568
22632
  // src/components/Chat/BusinessAnalysisPrompts.tsx
22569
22633
  var import_icons36 = require("@ant-design/icons");
22570
- var import_x6 = require("@ant-design/x");
22634
+ var import_x5 = require("@ant-design/x");
22571
22635
  var import_antd70 = require("antd");
22572
22636
  var import_react79 = require("react");
22573
22637
  var import_jsx_runtime90 = require("react/jsx-runtime");
@@ -22859,7 +22923,7 @@ var BusinessAnalysisPrompts = ({
22859
22923
  margin: "0 auto"
22860
22924
  },
22861
22925
  children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
22862
- import_x6.Prompts,
22926
+ import_x5.Prompts,
22863
22927
  {
22864
22928
  title: simpleModeTitle,
22865
22929
  items: getSimpleItems(),
@@ -22905,7 +22969,7 @@ var BusinessAnalysisPrompts = ({
22905
22969
  /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("span", { children: category.title })
22906
22970
  ] }),
22907
22971
  children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
22908
- import_x6.Prompts,
22972
+ import_x5.Prompts,
22909
22973
  {
22910
22974
  items: getGroupedItems(category.items),
22911
22975
  onItemClick: (info) => {
@@ -22949,10 +23013,17 @@ var Chating = ({
22949
23013
  showHITL = true,
22950
23014
  showRefreshButton = false,
22951
23015
  showModelSelector,
23016
+ showDatabaseSlot,
23017
+ showSkillSlot,
23018
+ showAgentSlot,
23019
+ showMetricsDataSourceSlot,
22952
23020
  showEmptyState = true,
22953
23021
  emptyStateGreeting,
22954
23022
  emptyStateQuestion = "Ready to turn data into insightful charts in seconds?",
22955
- welcomePrefix = "Hey"
23023
+ welcomePrefix = "Hey",
23024
+ systemContext,
23025
+ initialMessage,
23026
+ onInitialMessageSent
22956
23027
  }) => {
22957
23028
  const [content, setContent] = (0, import_react80.useState)("");
22958
23029
  const [attachedFiles, setAttachedFiles] = (0, import_react80.useState)([]);
@@ -22991,6 +23062,27 @@ var Chating = ({
22991
23062
  return () => clearInterval(interval);
22992
23063
  }, [isStreaming]);
22993
23064
  const conversationContext = useConversationContext();
23065
+ const systemContextSentRef = (0, import_react80.useRef)(false);
23066
+ const initialMessageSentRef = (0, import_react80.useRef)(false);
23067
+ const prevLoadingRef = (0, import_react80.useRef)(false);
23068
+ (0, import_react80.useEffect)(() => {
23069
+ systemContextSentRef.current = false;
23070
+ }, [threadId]);
23071
+ (0, import_react80.useEffect)(() => {
23072
+ initialMessageSentRef.current = false;
23073
+ }, [threadId]);
23074
+ (0, import_react80.useEffect)(() => {
23075
+ const wasLoading = prevLoadingRef.current;
23076
+ prevLoadingRef.current = isLoading;
23077
+ if (wasLoading && !isLoading && initialMessage && threadId && !initialMessageSentRef.current) {
23078
+ initialMessageSentRef.current = true;
23079
+ sendMessage({
23080
+ input: { message: initialMessage },
23081
+ streaming: true
23082
+ });
23083
+ onInitialMessageSent?.();
23084
+ }
23085
+ }, [isLoading, initialMessage, threadId, sendMessage, onInitialMessageSent]);
22994
23086
  const [modelConfig, setModelConfig] = (0, import_react80.useState)(null);
22995
23087
  const handleModelChange = (0, import_react80.useCallback)((config2) => {
22996
23088
  setModelConfig(config2);
@@ -23115,6 +23207,11 @@ var Chating = ({
23115
23207
  if (!nextContent && attachedFiles.length > 0) {
23116
23208
  nextContent = default_submit_message || "";
23117
23209
  }
23210
+ if (systemContext && !systemContextSentRef.current) {
23211
+ systemContextSentRef.current = true;
23212
+ nextContent = `${systemContext}
23213
+ ${nextContent}`;
23214
+ }
23118
23215
  const files = attachedFiles.map(
23119
23216
  (file) => isArchiveFile(file) ? {
23120
23217
  name: file.response.zipFileName || file.response.rarFileName,
@@ -23183,7 +23280,7 @@ var Chating = ({
23183
23280
  return true;
23184
23281
  };
23185
23282
  const senderHeader = /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
23186
- import_x7.Sender.Header,
23283
+ import_x6.Sender.Header,
23187
23284
  {
23188
23285
  title: "Attachments",
23189
23286
  open: headerOpen,
@@ -23195,7 +23292,7 @@ var Chating = ({
23195
23292
  },
23196
23293
  forceRender: true,
23197
23294
  children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
23198
- import_x7.Attachments,
23295
+ import_x6.Attachments,
23199
23296
  {
23200
23297
  ref: attachmentsRef,
23201
23298
  items: attachedFiles,
@@ -23226,13 +23323,13 @@ var Chating = ({
23226
23323
  )
23227
23324
  }
23228
23325
  );
23229
- const showDatabaseSlot = config.enableDatabaseSlot;
23230
- const showSkillSlot = config.enableSkillSlot;
23231
- const showAgentSlot = config.enableAgentSlot;
23232
- const showMetricsDataSourceSlot = config.enableMetricsDataSourceSlot;
23326
+ const effectiveShowDatabaseSlot = showDatabaseSlot !== void 0 ? showDatabaseSlot : config.enableDatabaseSlot;
23327
+ const effectiveShowSkillSlot = showSkillSlot !== void 0 ? showSkillSlot : config.enableSkillSlot;
23328
+ const effectiveShowAgentSlot = showAgentSlot !== void 0 ? showAgentSlot : config.enableAgentSlot;
23329
+ const effectiveShowMetricsDataSourceSlot = showMetricsDataSourceSlot !== void 0 ? showMetricsDataSourceSlot : config.enableMetricsDataSourceSlot;
23233
23330
  const shouldShowModelSelector = showModelSelector !== void 0 ? showModelSelector : config.enableModelSelector;
23234
23331
  const senderFooter = (actionNode) => {
23235
- const hasSlotButtons = showAgentSlot || showDatabaseSlot || showSkillSlot || showMetricsDataSourceSlot;
23332
+ const hasSlotButtons = effectiveShowAgentSlot || effectiveShowDatabaseSlot || effectiveShowSkillSlot || effectiveShowMetricsDataSourceSlot;
23236
23333
  return /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(import_antd71.Flex, { justify: "space-between", align: "center", style: { padding: "8px 0" }, children: [
23237
23334
  /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(import_antd71.Flex, { align: "center", gap: 8, children: [
23238
23335
  /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(import_antd71.Badge, { dot: attachedFiles.length > 0 && !headerOpen, children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
@@ -23245,10 +23342,10 @@ var Chating = ({
23245
23342
  ) }),
23246
23343
  /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(import_antd71.Divider, { type: "vertical", style: { margin: 0 } }),
23247
23344
  hasSlotButtons && /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(import_antd71.Flex, { align: "center", gap: 8, children: [
23248
- showAgentSlot && /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(AgentPicker, { senderRef, iconOnly: true }),
23249
- showDatabaseSlot && /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(DatabasePicker, { senderRef, iconOnly: true }),
23250
- showSkillSlot && /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(SkillPicker, { senderRef, iconOnly: true }),
23251
- showMetricsDataSourceSlot && /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(MetricsDataSourcePicker, { senderRef, iconOnly: true })
23345
+ effectiveShowAgentSlot && /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(AgentPicker, { senderRef, iconOnly: true }),
23346
+ effectiveShowDatabaseSlot && /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(DatabasePicker, { senderRef, iconOnly: true }),
23347
+ effectiveShowSkillSlot && /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(SkillPicker, { senderRef, iconOnly: true }),
23348
+ effectiveShowMetricsDataSourceSlot && /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(MetricsDataSourcePicker, { senderRef, iconOnly: true })
23252
23349
  ] })
23253
23350
  ] }),
23254
23351
  /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(import_antd71.Flex, { align: "center", gap: 8, children: [
@@ -23317,7 +23414,7 @@ var Chating = ({
23317
23414
  label: file.path
23318
23415
  }));
23319
23416
  return /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
23320
- import_x7.Suggestion,
23417
+ import_x6.Suggestion,
23321
23418
  {
23322
23419
  items: suggestionItems,
23323
23420
  onSelect: (itemVal) => {
@@ -23349,7 +23446,7 @@ var Chating = ({
23349
23446
  }
23350
23447
  },
23351
23448
  children: ({ onTrigger, onKeyDown }) => /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
23352
- import_x7.Sender,
23449
+ import_x6.Sender,
23353
23450
  {
23354
23451
  slotConfig,
23355
23452
  disabled: isInputDisabled,
@@ -23470,7 +23567,7 @@ var Chating = ({
23470
23567
  className: `${styles.messages} ${isTransitioning ? styles.entering : ""}`
23471
23568
  }
23472
23569
  ),
23473
- !isLoading && messages.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(import_x7.Prompts, { items: senderPromptsItems, onItemClick: onPromptsItemClick }),
23570
+ !isLoading && messages.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(import_x6.Prompts, { items: senderPromptsItems, onItemClick: onPromptsItemClick }),
23474
23571
  error && /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("div", { style: { padding: "0 16px 8px" }, children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
23475
23572
  import_antd71.Alert,
23476
23573
  {
@@ -30632,7 +30729,7 @@ var LatticeChat = (props) => {
30632
30729
  };
30633
30730
 
30634
30731
  // src/components/Chat/AgentConversations.tsx
30635
- var import_x8 = require("@ant-design/x");
30732
+ var import_x7 = require("@ant-design/x");
30636
30733
  var import_antd93 = require("antd");
30637
30734
  var import_react99 = require("react");
30638
30735
  var import_jsx_runtime119 = require("react/jsx-runtime");
@@ -30675,7 +30772,7 @@ var AgentConversations = ({
30675
30772
  onClick: newChatClick
30676
30773
  } : void 0;
30677
30774
  return /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(
30678
- import_x8.Conversations,
30775
+ import_x7.Conversations,
30679
30776
  {
30680
30777
  creation,
30681
30778
  items,