@axiom-lattice/react-sdk 2.1.77 → 2.1.79

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.mjs CHANGED
@@ -8794,7 +8794,7 @@ import {
8794
8794
  import {
8795
8795
  Attachments,
8796
8796
  Prompts as Prompts3,
8797
- Sender as Sender2,
8797
+ Sender,
8798
8798
  Suggestion
8799
8799
  } from "@ant-design/x";
8800
8800
 
@@ -8982,7 +8982,7 @@ import {
8982
8982
  Space as Space30,
8983
8983
  Typography as Typography42
8984
8984
  } from "antd";
8985
- import React51, { useCallback as useCallback34, useContext as useContext10, useEffect as useEffect46, useRef as useRef24, useState as useState66 } from "react";
8985
+ import React51, { useCallback as useCallback33, useContext as useContext10, useEffect as useEffect45, useRef as useRef23, useState as useState65 } from "react";
8986
8986
  import { BrainCircuit as BrainCircuit3 } from "lucide-react";
8987
8987
 
8988
8988
  // src/components/GenUI/HITLContainer.tsx
@@ -10043,14 +10043,14 @@ var ThreadManagementButtons = () => {
10043
10043
  import React43, {
10044
10044
  createContext as createContext8,
10045
10045
  useContext as useContext9,
10046
- useState as useState58,
10047
- useCallback as useCallback32,
10048
- useEffect as useEffect41
10046
+ useState as useState57,
10047
+ useCallback as useCallback31,
10048
+ useEffect as useEffect40
10049
10049
  } from "react";
10050
10050
  import { WorkspaceClient, Client as Client2 } from "@axiom-lattice/client-sdk";
10051
10051
 
10052
10052
  // src/components/Chat/WorkspaceResourceManager.tsx
10053
- import { useMemo as useMemo19, useEffect as useEffect40, useRef as useRef18, useState as useState57 } from "react";
10053
+ import { useMemo as useMemo20, useEffect as useEffect39, useRef as useRef17, useState as useState56 } from "react";
10054
10054
  import { FolderOpen as FolderOpen2, Activity as Activity3, Database as Database4, Plug as Plug2, Bot as Bot2, Wrench, Zap, LogOut as LogOut3, Building2 as Building23, Key, Share2, History, Inbox, FlaskConical as FlaskConical3 } from "lucide-react";
10055
10055
  import { Modal as Modal13, Avatar as Avatar8, Popover as Popover2, Button as Button41 } from "antd";
10056
10056
 
@@ -18089,7 +18089,7 @@ var ToolsList = ({
18089
18089
  };
18090
18090
 
18091
18091
  // src/components/Chat/TopologyAutomationView.tsx
18092
- import { useEffect as useEffect36, useState as useState51, useCallback as useCallback30, useMemo as useMemo16 } from "react";
18092
+ import { useEffect as useEffect35, useState as useState50, useCallback as useCallback29, useMemo as useMemo17 } from "react";
18093
18093
  import {
18094
18094
  ReactFlow as ReactFlow3,
18095
18095
  Background as Background3,
@@ -18102,8 +18102,8 @@ import {
18102
18102
  ReactFlowProvider as ReactFlowProvider3
18103
18103
  } from "@xyflow/react";
18104
18104
  import "@xyflow/react/dist/style.css";
18105
- import { Spin as Spin9, Empty as Empty5, Card as Card16, Typography as Typography29, Tag as Tag15, Avatar as Avatar7, Button as Button36, Modal as Modal11 } from "antd";
18106
- import { PlusOutlined as PlusOutlined8, InfoCircleOutlined as InfoCircleOutlined5 } from "@ant-design/icons";
18105
+ import { Spin as Spin8, Empty as Empty5, Card as Card16, Typography as Typography29, Tag as Tag15, Avatar as Avatar7, Button as Button36, Modal as Modal11, Popconfirm as Popconfirm4 } from "antd";
18106
+ import { PlusOutlined as PlusOutlined8, InfoCircleOutlined as InfoCircleOutlined5, DeleteOutlined as DeleteOutlined3 } from "@ant-design/icons";
18107
18107
 
18108
18108
  // src/components/Chat/TopologyNode.tsx
18109
18109
  import { Handle as Handle3, Position as Position3 } from "@xyflow/react";
@@ -18220,143 +18220,11 @@ var TopologyNode = ({ data }) => {
18220
18220
  var TopologyNode_default = TopologyNode;
18221
18221
 
18222
18222
  // src/components/Chat/CopilotPanel.tsx
18223
- import { useState as useState50, useEffect as useEffect34, useCallback as useCallback29, useRef as useRef16 } from "react";
18224
- import { Sender } from "@ant-design/x";
18225
- import { Button as Button35, Typography as Typography28, Spin as Spin8 } from "antd";
18223
+ import { useMemo as useMemo16 } from "react";
18224
+ import { Button as Button35, Typography as Typography28 } from "antd";
18226
18225
  import { CloseOutlined as CloseOutlined2 } from "@ant-design/icons";
18227
18226
  import { jsx as jsx73, jsxs as jsxs48 } from "react/jsx-runtime";
18228
18227
  var { Text: Text25 } = Typography28;
18229
- var CopilotPanelChatBody = ({ workflowContext, initialMessage, onInitialMessageSent }) => {
18230
- const {
18231
- messages,
18232
- isLoading,
18233
- error: chatError,
18234
- sendMessage,
18235
- stopStreaming,
18236
- threadId
18237
- } = useAgentChat();
18238
- const [inputValue, setInputValue] = useState50("");
18239
- const contextSentRef = useRef16(false);
18240
- const initialMessageSentRef = useRef16(false);
18241
- const prevLoadingRef = useRef16(false);
18242
- const workflowId = workflowContext?.id;
18243
- const workflowName = workflowContext?.name;
18244
- useEffect34(() => {
18245
- contextSentRef.current = false;
18246
- }, [threadId]);
18247
- useEffect34(() => {
18248
- initialMessageSentRef.current = false;
18249
- }, [threadId]);
18250
- useEffect34(() => {
18251
- const wasLoading = prevLoadingRef.current;
18252
- prevLoadingRef.current = isLoading;
18253
- if (wasLoading && !isLoading && initialMessage && threadId && !initialMessageSentRef.current) {
18254
- initialMessageSentRef.current = true;
18255
- const message23 = initialMessage.trim();
18256
- if (message23) {
18257
- const formattedMessage = [
18258
- `Purpose: ${message23}`,
18259
- "",
18260
- `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.`,
18261
- `The current name is a placeholder \u2014 feel free to update it via update_processing_agent if you have a better one.`
18262
- ].join("\n");
18263
- sendMessage({
18264
- input: { message: formattedMessage },
18265
- streaming: true
18266
- });
18267
- onInitialMessageSent?.();
18268
- }
18269
- }
18270
- }, [isLoading, initialMessage, threadId, sendMessage, onInitialMessageSent, workflowId, workflowName]);
18271
- const handleSubmit = useCallback29(
18272
- (nextContent) => {
18273
- if (!nextContent.trim()) return;
18274
- let finalContent = nextContent;
18275
- if (workflowId && workflowName && !contextSentRef.current) {
18276
- finalContent = `[Context: You're viewing workflow "${workflowName}" (agent: ${workflowId})]
18277
- User: ${nextContent}`;
18278
- contextSentRef.current = true;
18279
- }
18280
- sendMessage({
18281
- input: { message: finalContent },
18282
- streaming: true
18283
- });
18284
- setInputValue("");
18285
- },
18286
- [workflowId, workflowName, sendMessage]
18287
- );
18288
- const isEmpty = messages.length === 0 && !isLoading;
18289
- const showContentLoading = isLoading && messages.length === 0;
18290
- const hasContent = !isEmpty;
18291
- return /* @__PURE__ */ jsxs48(
18292
- "div",
18293
- {
18294
- style: {
18295
- flex: 1,
18296
- minHeight: 0,
18297
- display: "flex",
18298
- flexDirection: "column",
18299
- padding: 0
18300
- },
18301
- children: [
18302
- isEmpty && /* @__PURE__ */ jsxs48(
18303
- "div",
18304
- {
18305
- style: {
18306
- display: "flex",
18307
- flexDirection: "column",
18308
- justifyContent: "center",
18309
- alignItems: "center",
18310
- height: "100%",
18311
- textAlign: "center",
18312
- gap: 4
18313
- },
18314
- children: [
18315
- /* @__PURE__ */ jsx73(Text25, { strong: true, children: "Workflow Builder" }),
18316
- /* @__PURE__ */ jsx73(Text25, { type: "secondary", children: "Ask me to design, review, or modify your workflows" })
18317
- ]
18318
- }
18319
- ),
18320
- showContentLoading && /* @__PURE__ */ jsx73(
18321
- "div",
18322
- {
18323
- style: {
18324
- display: "flex",
18325
- justifyContent: "center",
18326
- alignItems: "center",
18327
- height: "100%"
18328
- },
18329
- children: /* @__PURE__ */ jsx73(Spin8, {})
18330
- }
18331
- ),
18332
- hasContent && /* @__PURE__ */ jsx73("div", { style: { flex: 1, minHeight: 0, display: "flex" }, children: /* @__PURE__ */ jsx73(MessageList, { messages }) }),
18333
- chatError && /* @__PURE__ */ jsx73("div", { style: { padding: "8px 8px" }, children: /* @__PURE__ */ jsx73(Text25, { type: "danger", children: chatError.message }) }),
18334
- /* @__PURE__ */ jsx73(
18335
- "div",
18336
- {
18337
- style: {
18338
- padding: "12px 8px",
18339
- borderTop: "1px solid #f0f0f0",
18340
- flexShrink: 0
18341
- },
18342
- children: /* @__PURE__ */ jsx73(
18343
- Sender,
18344
- {
18345
- value: inputValue,
18346
- placeholder: "Ask about workflows...",
18347
- onChange: setInputValue,
18348
- onSubmit: handleSubmit,
18349
- loading: isLoading,
18350
- onCancel: () => stopStreaming(),
18351
- allowSpeech: false
18352
- }
18353
- )
18354
- }
18355
- )
18356
- ]
18357
- }
18358
- );
18359
- };
18360
18228
  var CopilotPanel = ({
18361
18229
  workflowContext,
18362
18230
  onClose,
@@ -18366,6 +18234,21 @@ var CopilotPanel = ({
18366
18234
  }) => {
18367
18235
  const client = useClient("agent-architect");
18368
18236
  const threadId = workflowContext?.id ? `${client.tenantId}:${workflowContext.id}` : null;
18237
+ const systemContext = useMemo16(() => {
18238
+ if (workflowContext?.id && workflowContext?.name) {
18239
+ return `[Context: You're viewing workflow "${workflowContext.name}" (agent: ${workflowContext.id})]`;
18240
+ }
18241
+ return void 0;
18242
+ }, [workflowContext]);
18243
+ const initialMessageContent = useMemo16(() => {
18244
+ if (!initialMessage || !workflowContext?.id) return void 0;
18245
+ return [
18246
+ `Purpose: ${initialMessage.trim()}`,
18247
+ "",
18248
+ `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.`,
18249
+ `The current name is a placeholder \u2014 feel free to update it via update_processing_agent if you have a better one.`
18250
+ ].join("\n");
18251
+ }, [initialMessage, workflowContext?.id]);
18369
18252
  return /* @__PURE__ */ jsxs48(
18370
18253
  "div",
18371
18254
  {
@@ -18417,10 +18300,16 @@ var CopilotPanel = ({
18417
18300
  options: { streaming: true },
18418
18301
  onToolCompleted,
18419
18302
  children: /* @__PURE__ */ jsx73(
18420
- CopilotPanelChatBody,
18303
+ Chating,
18421
18304
  {
18422
- workflowContext,
18423
- initialMessage,
18305
+ showHeader: false,
18306
+ showEmptyState: false,
18307
+ showDatabaseSlot: false,
18308
+ showSkillSlot: false,
18309
+ showAgentSlot: false,
18310
+ showMetricsDataSourceSlot: false,
18311
+ systemContext,
18312
+ initialMessage: initialMessageContent,
18424
18313
  onInitialMessageSent
18425
18314
  }
18426
18315
  )
@@ -18452,7 +18341,7 @@ var CopilotPanel = ({
18452
18341
  };
18453
18342
 
18454
18343
  // src/components/Chat/CreateWorkflowModal.tsx
18455
- import { useEffect as useEffect35 } from "react";
18344
+ import { useEffect as useEffect34 } from "react";
18456
18345
  import { Modal as Modal10, Form as Form7, Input as Input13 } from "antd";
18457
18346
  import { jsx as jsx74 } from "react/jsx-runtime";
18458
18347
  function extractName(purpose) {
@@ -18477,7 +18366,7 @@ var CreateWorkflowModal = ({
18477
18366
  }) => {
18478
18367
  const { post } = useApi();
18479
18368
  const [form] = Form7.useForm();
18480
- useEffect35(() => {
18369
+ useEffect34(() => {
18481
18370
  if (open) {
18482
18371
  form.resetFields();
18483
18372
  }
@@ -18661,14 +18550,15 @@ function TopologyFlowInner({
18661
18550
  selectedWorkflowId,
18662
18551
  onSelectWorkflow,
18663
18552
  onCreateWorkflow,
18553
+ onDeleteWorkflow,
18664
18554
  nodes: initialNodes,
18665
18555
  edges: initialEdges
18666
18556
  }) {
18667
18557
  const [nodes, setNodes, onNodesChange] = useNodesState3(initialNodes);
18668
18558
  const [edges, setEdges, onEdgesChange] = useEdgesState3(initialEdges);
18669
- const [specModalOpen, setSpecModalOpen] = useState51(false);
18670
- const nodeTypes2 = useMemo16(() => ({ topologyNode: TopologyNode_default }), []);
18671
- useEffect36(() => {
18559
+ const [specModalOpen, setSpecModalOpen] = useState50(false);
18560
+ const nodeTypes2 = useMemo17(() => ({ topologyNode: TopologyNode_default }), []);
18561
+ useEffect35(() => {
18672
18562
  setNodes(initialNodes);
18673
18563
  setEdges(initialEdges);
18674
18564
  }, [initialNodes, initialEdges, setNodes, setEdges]);
@@ -18792,7 +18682,8 @@ function TopologyFlowInner({
18792
18682
  display: "flex",
18793
18683
  alignItems: "center",
18794
18684
  gap: 6,
18795
- padding: "6px 14px",
18685
+ height: 32,
18686
+ padding: "0 14px",
18796
18687
  background: "rgba(255,255,255,0.95)",
18797
18688
  borderRadius: 10,
18798
18689
  boxShadow: "0 2px 12px rgba(0,0,0,0.08)",
@@ -18810,6 +18701,42 @@ function TopologyFlowInner({
18810
18701
  ]
18811
18702
  }
18812
18703
  ),
18704
+ /* @__PURE__ */ jsx75(
18705
+ "div",
18706
+ {
18707
+ style: {
18708
+ position: "absolute",
18709
+ top: 12,
18710
+ right: 12,
18711
+ zIndex: 10,
18712
+ display: "flex",
18713
+ alignItems: "center",
18714
+ height: 32,
18715
+ padding: "0 14px",
18716
+ background: "rgba(255,255,255,0.95)",
18717
+ borderRadius: 10,
18718
+ boxShadow: "0 2px 12px rgba(0,0,0,0.08)",
18719
+ border: "1px solid #f0f0f0"
18720
+ },
18721
+ children: /* @__PURE__ */ jsx75(
18722
+ Popconfirm4,
18723
+ {
18724
+ title: "Delete workflow",
18725
+ description: "This will delete the workflow and all associated topology. This action cannot be undone.",
18726
+ onConfirm: () => onDeleteWorkflow(selectedAgent.id),
18727
+ okText: "Delete",
18728
+ cancelText: "Cancel",
18729
+ okButtonProps: { danger: true },
18730
+ children: /* @__PURE__ */ jsx75(
18731
+ DeleteOutlined3,
18732
+ {
18733
+ style: { color: "#ff4d4f", cursor: "pointer", fontSize: 15 }
18734
+ }
18735
+ )
18736
+ }
18737
+ )
18738
+ }
18739
+ ),
18813
18740
  /* @__PURE__ */ jsx75(
18814
18741
  Modal11,
18815
18742
  {
@@ -18838,16 +18765,16 @@ function TopologyFlowInner({
18838
18765
  ] });
18839
18766
  }
18840
18767
  var TopologyAutomationView = () => {
18841
- const { get } = useApi();
18842
- const [agents, setAgents] = useState51([]);
18843
- const [agentNameMap, setAgentNameMap] = useState51(/* @__PURE__ */ new Map());
18844
- const [selectedWorkflowId, setSelectedWorkflowId] = useState51(null);
18845
- const [copilotOpen, setCopilotOpen] = useState51(true);
18846
- const [initialLoading, setInitialLoading] = useState51(true);
18847
- const [error, setError] = useState51(null);
18848
- const [isCreateModalOpen, setIsCreateModalOpen] = useState51(false);
18849
- const [initialMessage, setInitialMessage] = useState51(null);
18850
- const workflowTools = useMemo16(
18768
+ const { get, del } = useApi();
18769
+ const [agents, setAgents] = useState50([]);
18770
+ const [agentNameMap, setAgentNameMap] = useState50(/* @__PURE__ */ new Map());
18771
+ const [selectedWorkflowId, setSelectedWorkflowId] = useState50(null);
18772
+ const [copilotOpen, setCopilotOpen] = useState50(true);
18773
+ const [initialLoading, setInitialLoading] = useState50(true);
18774
+ const [error, setError] = useState50(null);
18775
+ const [isCreateModalOpen, setIsCreateModalOpen] = useState50(false);
18776
+ const [initialMessage, setInitialMessage] = useState50(null);
18777
+ const workflowTools = useMemo17(
18851
18778
  () => [
18852
18779
  "create_agent",
18853
18780
  "create_processing_agent",
@@ -18857,7 +18784,7 @@ var TopologyAutomationView = () => {
18857
18784
  ],
18858
18785
  []
18859
18786
  );
18860
- const fetchData = useCallback30(async () => {
18787
+ const fetchData = useCallback29(async () => {
18861
18788
  const [wfRes, assistantsRes] = await Promise.all([
18862
18789
  get("/api/workflows/definitions"),
18863
18790
  get("/api/assistants")
@@ -18881,7 +18808,7 @@ var TopologyAutomationView = () => {
18881
18808
  }
18882
18809
  setError(null);
18883
18810
  }, [get]);
18884
- useEffect36(() => {
18811
+ useEffect35(() => {
18885
18812
  let cancelled = false;
18886
18813
  const load = async () => {
18887
18814
  try {
@@ -18900,7 +18827,7 @@ var TopologyAutomationView = () => {
18900
18827
  cancelled = true;
18901
18828
  };
18902
18829
  }, [fetchData]);
18903
- const handleWorkflowCreated = useCallback30((id, purpose) => {
18830
+ const handleWorkflowCreated = useCallback29((id, purpose) => {
18904
18831
  setIsCreateModalOpen(false);
18905
18832
  fetchData().then(() => {
18906
18833
  setSelectedWorkflowId(id);
@@ -18909,27 +18836,37 @@ var TopologyAutomationView = () => {
18909
18836
  }
18910
18837
  });
18911
18838
  }, [fetchData]);
18912
- const handleSelectWorkflow = useCallback30((id) => {
18839
+ const handleSelectWorkflow = useCallback29((id) => {
18913
18840
  setSelectedWorkflowId(id);
18914
18841
  }, []);
18915
- const selectedAgent = useMemo16(
18842
+ const handleDeleteWorkflow = useCallback29(async (id) => {
18843
+ try {
18844
+ await del(`/api/assistants/${id}`);
18845
+ setSelectedWorkflowId(null);
18846
+ await fetchData();
18847
+ } catch (err) {
18848
+ const message23 = err instanceof Error ? err.message : "Failed to delete workflow";
18849
+ setError(message23);
18850
+ }
18851
+ }, [del, fetchData]);
18852
+ const selectedAgent = useMemo17(
18916
18853
  () => agents.find((a) => a.id === selectedWorkflowId) || null,
18917
18854
  [agents, selectedWorkflowId]
18918
18855
  );
18919
- const selectedWorkflowName = useMemo16(
18856
+ const selectedWorkflowName = useMemo17(
18920
18857
  () => selectedAgent?.name || null,
18921
18858
  [selectedAgent]
18922
18859
  );
18923
- const workflowContext = useMemo16(
18860
+ const workflowContext = useMemo17(
18924
18861
  () => selectedWorkflowId && selectedWorkflowName ? { id: selectedWorkflowId, name: selectedWorkflowName } : null,
18925
18862
  [selectedWorkflowId, selectedWorkflowName]
18926
18863
  );
18927
- const { nodes, edges } = useMemo16(
18864
+ const { nodes, edges } = useMemo17(
18928
18865
  () => selectedAgent ? buildGraph([selectedAgent], agentNameMap) : { nodes: [], edges: [] },
18929
18866
  [selectedAgent, agentNameMap]
18930
18867
  );
18931
18868
  if (initialLoading) {
18932
- return /* @__PURE__ */ jsx75("div", { style: { display: "flex", justifyContent: "center", alignItems: "center", height: "100%" }, children: /* @__PURE__ */ jsx75(Spin9, { size: "large", tip: "Loading workflows..." }) });
18869
+ return /* @__PURE__ */ jsx75("div", { style: { display: "flex", justifyContent: "center", alignItems: "center", height: "100%" }, children: /* @__PURE__ */ jsx75(Spin8, { size: "large", tip: "Loading workflows..." }) });
18933
18870
  }
18934
18871
  if (error) {
18935
18872
  return /* @__PURE__ */ jsx75(Empty5, { description: error });
@@ -18982,6 +18919,7 @@ var TopologyAutomationView = () => {
18982
18919
  selectedWorkflowId,
18983
18920
  onSelectWorkflow: handleSelectWorkflow,
18984
18921
  onCreateWorkflow: () => setIsCreateModalOpen(true),
18922
+ onDeleteWorkflow: handleDeleteWorkflow,
18985
18923
  nodes,
18986
18924
  edges
18987
18925
  }
@@ -19039,9 +18977,9 @@ var TopologyAutomationView = () => {
19039
18977
  };
19040
18978
 
19041
18979
  // src/components/Chat/TopologyRuntimeView.tsx
19042
- import { useEffect as useEffect37, useState as useState52, useMemo as useMemo17, useCallback as useCallback31, useRef as useRef17 } from "react";
18980
+ import { useEffect as useEffect36, useState as useState51, useMemo as useMemo18, useCallback as useCallback30, useRef as useRef16 } from "react";
19043
18981
  import {
19044
- Spin as Spin10,
18982
+ Spin as Spin9,
19045
18983
  Empty as Empty6,
19046
18984
  List as List7,
19047
18985
  Tag as Tag16,
@@ -19052,14 +18990,16 @@ import {
19052
18990
  Badge as Badge5,
19053
18991
  Tooltip as Tooltip13,
19054
18992
  Progress as Progress3,
19055
- Switch as Switch3
18993
+ Switch as Switch3,
18994
+ Popconfirm as Popconfirm5
19056
18995
  } from "antd";
19057
18996
  import {
19058
18997
  CheckCircleOutlined as CheckCircleOutlined5,
19059
18998
  SyncOutlined as SyncOutlined2,
19060
18999
  CloseCircleOutlined as CloseCircleOutlined2,
19061
19000
  ClockCircleOutlined as ClockCircleOutlined3,
19062
- ReloadOutlined as ReloadOutlined2
19001
+ ReloadOutlined as ReloadOutlined2,
19002
+ DeleteOutlined as DeleteOutlined4
19063
19003
  } from "@ant-design/icons";
19064
19004
  import {
19065
19005
  ReactFlow as ReactFlow4,
@@ -19182,7 +19122,7 @@ function StepNode({ data, selected }) {
19182
19122
  }
19183
19123
  var nodeTypes = { stepNode: StepNode };
19184
19124
  function useLayoutedElements(steps) {
19185
- return useMemo17(() => {
19125
+ return useMemo18(() => {
19186
19126
  if (steps.length === 0) return [];
19187
19127
  const g = new dagre.graphlib.Graph();
19188
19128
  g.setGraph({ rankdir: "TB", nodesep: 40, ranksep: 40 });
@@ -19208,7 +19148,7 @@ function useLayoutedElements(steps) {
19208
19148
  }, [steps]);
19209
19149
  }
19210
19150
  function useEdgesFromSteps(steps) {
19211
- return useMemo17(() => {
19151
+ return useMemo18(() => {
19212
19152
  const edges = [];
19213
19153
  for (let i = 0; i < steps.length - 1; i++) {
19214
19154
  const fromStep = steps[i];
@@ -19351,16 +19291,16 @@ function FlowCanvas({ steps }) {
19351
19291
  const initialEdges = useEdgesFromSteps(steps);
19352
19292
  const [nodes, setNodes, onNodesChange] = useNodesState4(initialNodes);
19353
19293
  const [edges, setEdges, onEdgesChange] = useEdgesState4(initialEdges);
19354
- const [selectedNodeId, setSelectedNodeId] = useState52(null);
19355
- const selectedStep = useMemo17(
19294
+ const [selectedNodeId, setSelectedNodeId] = useState51(null);
19295
+ const selectedStep = useMemo18(
19356
19296
  () => steps.find((s) => s.id === selectedNodeId) || null,
19357
19297
  [steps, selectedNodeId]
19358
19298
  );
19359
- useEffect37(() => {
19299
+ useEffect36(() => {
19360
19300
  setNodes(initialNodes);
19361
19301
  setEdges(initialEdges);
19362
19302
  }, [initialNodes, initialEdges, setNodes, setEdges]);
19363
- useEffect37(() => {
19303
+ useEffect36(() => {
19364
19304
  if (selectedNodeId) {
19365
19305
  setNodes(
19366
19306
  (nds) => nds.map((n) => ({
@@ -19370,13 +19310,13 @@ function FlowCanvas({ steps }) {
19370
19310
  );
19371
19311
  }
19372
19312
  }, [selectedNodeId, setNodes]);
19373
- const onNodeClick = useCallback31(
19313
+ const onNodeClick = useCallback30(
19374
19314
  (_event, node) => {
19375
19315
  setSelectedNodeId(node.id);
19376
19316
  },
19377
19317
  []
19378
19318
  );
19379
- const onPaneClick = useCallback31(() => {
19319
+ const onPaneClick = useCallback30(() => {
19380
19320
  setNodes(
19381
19321
  (nds) => nds.map((n) => ({
19382
19322
  ...n,
@@ -19553,13 +19493,13 @@ function RunSummaryBanner({ run, agentName }) {
19553
19493
  }
19554
19494
  );
19555
19495
  }
19556
- var RunDetail = ({ run, agentName, open, onClose, onRunUpdate, autoRefresh }) => {
19496
+ var RunDetail = ({ run, agentName, open, onClose, onRunUpdate, autoRefresh, onAutoRefreshChange }) => {
19557
19497
  const { get } = useApi();
19558
- const [steps, setSteps] = useState52([]);
19559
- const [loading, setLoading] = useState52(false);
19560
- const stepsPollTimeoutRef = useRef17(null);
19561
- const stepsPollSessionRef = useRef17(0);
19562
- const fetchSteps = useCallback31(async () => {
19498
+ const [steps, setSteps] = useState51([]);
19499
+ const [loading, setLoading] = useState51(false);
19500
+ const stepsPollTimeoutRef = useRef16(null);
19501
+ const stepsPollSessionRef = useRef16(0);
19502
+ const fetchSteps = useCallback30(async () => {
19563
19503
  try {
19564
19504
  const [stepsRes, runsRes] = await Promise.all([
19565
19505
  get(
@@ -19577,12 +19517,12 @@ var RunDetail = ({ run, agentName, open, onClose, onRunUpdate, autoRefresh }) =>
19577
19517
  } catch {
19578
19518
  }
19579
19519
  }, [get, run.id, onRunUpdate]);
19580
- useEffect37(() => {
19520
+ useEffect36(() => {
19581
19521
  if (!open) return;
19582
19522
  setLoading(true);
19583
19523
  fetchSteps().finally(() => setLoading(false));
19584
19524
  }, [open, run.id, fetchSteps]);
19585
- useEffect37(() => {
19525
+ useEffect36(() => {
19586
19526
  if (stepsPollTimeoutRef.current) {
19587
19527
  clearTimeout(stepsPollTimeoutRef.current);
19588
19528
  stepsPollTimeoutRef.current = null;
@@ -19611,7 +19551,11 @@ var RunDetail = ({ run, agentName, open, onClose, onRunUpdate, autoRefresh }) =>
19611
19551
  {
19612
19552
  title: /* @__PURE__ */ jsxs50(Space23, { children: [
19613
19553
  /* @__PURE__ */ jsx76(Text27, { strong: true, children: "Pipeline Execution" }),
19614
- /* @__PURE__ */ jsx76(Tag16, { color: "purple", style: { fontSize: 11 }, children: "Flow View" })
19554
+ /* @__PURE__ */ jsx76(Tag16, { color: "purple", style: { fontSize: 11 }, children: "Flow View" }),
19555
+ /* @__PURE__ */ jsxs50(Space23, { size: 4, style: { marginLeft: 12 }, children: [
19556
+ /* @__PURE__ */ jsx76(Text27, { type: "secondary", style: { fontSize: 11 }, children: "Auto-refresh" }),
19557
+ /* @__PURE__ */ jsx76(Switch3, { size: "small", checked: autoRefresh, onChange: onAutoRefreshChange })
19558
+ ] })
19615
19559
  ] }),
19616
19560
  placement: "right",
19617
19561
  width: "90%",
@@ -19620,7 +19564,7 @@ var RunDetail = ({ run, agentName, open, onClose, onRunUpdate, autoRefresh }) =>
19620
19564
  styles: { body: { padding: "12px 0" } },
19621
19565
  children: [
19622
19566
  /* @__PURE__ */ jsx76("div", { style: { padding: "0 12px", marginBottom: 12 }, children: /* @__PURE__ */ jsx76(RunSummaryBanner, { run, agentName }) }),
19623
- loading ? /* @__PURE__ */ jsx76("div", { style: { display: "flex", justifyContent: "center", alignItems: "center", height: 300 }, children: /* @__PURE__ */ jsx76(Spin10, { size: "large" }) }) : steps.length === 0 ? /* @__PURE__ */ jsx76("div", { style: { padding: "0 12px" }, children: /* @__PURE__ */ jsx76(Text27, { type: "secondary", children: "No step records yet" }) }) : /* @__PURE__ */ jsx76("div", { style: { width: "100%", height: "calc(100vh - 200px)", position: "relative" }, children: /* @__PURE__ */ jsx76(ReactFlowProvider4, { children: /* @__PURE__ */ jsx76(FlowCanvas, { steps }) }) }),
19567
+ loading ? /* @__PURE__ */ jsx76("div", { style: { display: "flex", justifyContent: "center", alignItems: "center", height: 300 }, children: /* @__PURE__ */ jsx76(Spin9, { size: "large" }) }) : steps.length === 0 ? /* @__PURE__ */ jsx76("div", { style: { padding: "0 12px" }, children: /* @__PURE__ */ jsx76(Text27, { type: "secondary", children: "No step records yet" }) }) : /* @__PURE__ */ jsx76("div", { style: { width: "100%", height: "calc(100vh - 200px)", position: "relative" }, children: /* @__PURE__ */ jsx76(ReactFlowProvider4, { children: /* @__PURE__ */ jsx76(FlowCanvas, { steps }) }) }),
19624
19568
  run.errorMessage && /* @__PURE__ */ jsx76("div", { style: { padding: "0 12px", marginTop: 12 }, children: /* @__PURE__ */ jsx76(
19625
19569
  "div",
19626
19570
  {
@@ -19639,21 +19583,31 @@ var RunDetail = ({ run, agentName, open, onClose, onRunUpdate, autoRefresh }) =>
19639
19583
  };
19640
19584
  var POLLING_INTERVAL = 3e3;
19641
19585
  var TopologyRuntimeView = () => {
19642
- const { get } = useApi();
19643
- const [runs, setRuns] = useState52([]);
19644
- const [agentNames, setAgentNames] = useState52({});
19645
- const [loading, setLoading] = useState52(true);
19646
- const [error, setError] = useState52(null);
19647
- const [selectedRun, setSelectedRun] = useState52(null);
19648
- const [autoRefresh, setAutoRefresh] = useState52(true);
19649
- const pollingSessionRef = useRef17(0);
19650
- const handleRunUpdate = useCallback31((updated) => {
19586
+ const { get, del } = useApi();
19587
+ const [runs, setRuns] = useState51([]);
19588
+ const [agentNames, setAgentNames] = useState51({});
19589
+ const [loading, setLoading] = useState51(true);
19590
+ const [error, setError] = useState51(null);
19591
+ const [selectedRun, setSelectedRun] = useState51(null);
19592
+ const [autoRefresh, setAutoRefresh] = useState51(true);
19593
+ const pollingSessionRef = useRef16(0);
19594
+ const handleRunUpdate = useCallback30((updated) => {
19651
19595
  setRuns(
19652
19596
  (prev) => prev.map((r) => r.id === updated.id ? updated : r)
19653
19597
  );
19654
19598
  setSelectedRun((prev) => prev?.id === updated.id ? updated : prev);
19655
19599
  }, []);
19656
- const refreshRuns = useCallback31(async () => {
19600
+ const handleDeleteRun = useCallback30(async (runId) => {
19601
+ try {
19602
+ await del(`/api/workflows/runs/${runId}`);
19603
+ setRuns((prev) => prev.filter((r) => r.id !== runId));
19604
+ setSelectedRun((prev) => prev?.id === runId ? null : prev);
19605
+ } catch (err) {
19606
+ const message23 = err instanceof Error ? err.message : "Failed to delete run";
19607
+ setError(message23);
19608
+ }
19609
+ }, [del]);
19610
+ const refreshRuns = useCallback30(async () => {
19657
19611
  setLoading(true);
19658
19612
  try {
19659
19613
  const defsRes = await get("/api/workflows/definitions");
@@ -19682,7 +19636,7 @@ var TopologyRuntimeView = () => {
19682
19636
  setLoading(false);
19683
19637
  }
19684
19638
  }, [get]);
19685
- useEffect37(() => {
19639
+ useEffect36(() => {
19686
19640
  let cancelled = false;
19687
19641
  const init2 = async () => {
19688
19642
  try {
@@ -19718,13 +19672,13 @@ var TopologyRuntimeView = () => {
19718
19672
  cancelled = true;
19719
19673
  };
19720
19674
  }, [get]);
19721
- useEffect37(() => {
19675
+ useEffect36(() => {
19722
19676
  return () => {
19723
19677
  pollingSessionRef.current = 0;
19724
19678
  };
19725
19679
  }, []);
19726
19680
  if (loading) {
19727
- return /* @__PURE__ */ jsx76("div", { style: { display: "flex", justifyContent: "center", alignItems: "center", height: "100%" }, children: /* @__PURE__ */ jsx76(Spin10, { size: "large" }) });
19681
+ return /* @__PURE__ */ jsx76("div", { style: { display: "flex", justifyContent: "center", alignItems: "center", height: "100%" }, children: /* @__PURE__ */ jsx76(Spin9, { size: "large" }) });
19728
19682
  }
19729
19683
  if (error) {
19730
19684
  return /* @__PURE__ */ jsx76(Empty6, { description: error });
@@ -19735,24 +19689,13 @@ var TopologyRuntimeView = () => {
19735
19689
  return /* @__PURE__ */ jsxs50("div", { style: { padding: 16, overflow: "auto", height: "100%" }, children: [
19736
19690
  /* @__PURE__ */ jsxs50("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center", marginBottom: 16 }, children: [
19737
19691
  /* @__PURE__ */ jsx76(Title5, { level: 5, style: { marginBottom: 0 }, children: "Workflow Runs" }),
19738
- /* @__PURE__ */ jsxs50(Space23, { size: 8, children: [
19739
- /* @__PURE__ */ jsx76(Text27, { type: "secondary", style: { fontSize: 11 }, children: "Auto-refresh" }),
19740
- /* @__PURE__ */ jsx76(
19741
- Switch3,
19742
- {
19743
- size: "small",
19744
- checked: autoRefresh,
19745
- onChange: setAutoRefresh
19746
- }
19747
- ),
19748
- /* @__PURE__ */ jsx76(Tooltip13, { title: "Refresh now", children: /* @__PURE__ */ jsx76(
19749
- ReloadOutlined2,
19750
- {
19751
- style: { cursor: "pointer", color: "#999" },
19752
- onClick: () => refreshRuns()
19753
- }
19754
- ) })
19755
- ] })
19692
+ /* @__PURE__ */ jsx76(Tooltip13, { title: "Refresh now", children: /* @__PURE__ */ jsx76(
19693
+ ReloadOutlined2,
19694
+ {
19695
+ style: { cursor: "pointer", color: "#999" },
19696
+ onClick: () => refreshRuns()
19697
+ }
19698
+ ) })
19756
19699
  ] }),
19757
19700
  /* @__PURE__ */ jsx76(
19758
19701
  List7,
@@ -19794,7 +19737,25 @@ var TopologyRuntimeView = () => {
19794
19737
  run.totalEdges
19795
19738
  ] }),
19796
19739
  /* @__PURE__ */ jsx76(Tag16, { color: sc.color, icon: sc.icon, children: sc.label }),
19797
- /* @__PURE__ */ jsx76(Text27, { type: "secondary", style: { fontSize: 11 }, children: formatTime(run.startedAt) })
19740
+ /* @__PURE__ */ jsx76(Text27, { type: "secondary", style: { fontSize: 11 }, children: formatTime(run.startedAt) }),
19741
+ /* @__PURE__ */ jsx76(
19742
+ Popconfirm5,
19743
+ {
19744
+ title: "Delete run",
19745
+ description: "Delete this workflow run and all its step records?",
19746
+ onConfirm: () => handleDeleteRun(run.id),
19747
+ okText: "Delete",
19748
+ cancelText: "Cancel",
19749
+ okButtonProps: { danger: true },
19750
+ children: /* @__PURE__ */ jsx76(
19751
+ DeleteOutlined4,
19752
+ {
19753
+ style: { color: "#ff4d4f", cursor: "pointer", fontSize: 13 },
19754
+ onClick: (e) => e.stopPropagation()
19755
+ }
19756
+ )
19757
+ }
19758
+ )
19798
19759
  ] })
19799
19760
  ] })
19800
19761
  },
@@ -19811,22 +19772,23 @@ var TopologyRuntimeView = () => {
19811
19772
  open: !!selectedRun,
19812
19773
  onClose: () => setSelectedRun(null),
19813
19774
  onRunUpdate: handleRunUpdate,
19814
- autoRefresh
19775
+ autoRefresh,
19776
+ onAutoRefreshChange: setAutoRefresh
19815
19777
  }
19816
19778
  )
19817
19779
  ] });
19818
19780
  };
19819
19781
 
19820
19782
  // src/components/Chat/TopologyInboxView.tsx
19821
- import { useEffect as useEffect38, useState as useState53 } from "react";
19822
- import { Card as Card18, Typography as Typography31, Spin as Spin11, Empty as Empty7, List as List8, Button as Button37, Space as Space24, Tag as Tag17 } from "antd";
19783
+ import { useEffect as useEffect37, useState as useState52 } from "react";
19784
+ import { Card as Card18, Typography as Typography31, Spin as Spin10, Empty as Empty7, List as List8, Button as Button37, Space as Space24, Tag as Tag17 } from "antd";
19823
19785
  import { InboxOutlined, ReloadOutlined as ReloadOutlined3 } from "@ant-design/icons";
19824
19786
  import { jsx as jsx77, jsxs as jsxs51 } from "react/jsx-runtime";
19825
19787
  var { Text: Text28, Title: Title6 } = Typography31;
19826
19788
  var TopologyInboxView = () => {
19827
19789
  const { get } = useApi();
19828
- const [items, setItems] = useState53([]);
19829
- const [loading, setLoading] = useState53(true);
19790
+ const [items, setItems] = useState52([]);
19791
+ const [loading, setLoading] = useState52(true);
19830
19792
  const fetchInbox = async () => {
19831
19793
  setLoading(true);
19832
19794
  try {
@@ -19853,7 +19815,7 @@ var TopologyInboxView = () => {
19853
19815
  setLoading(false);
19854
19816
  }
19855
19817
  };
19856
- useEffect38(() => {
19818
+ useEffect37(() => {
19857
19819
  fetchInbox();
19858
19820
  }, [get]);
19859
19821
  return /* @__PURE__ */ jsxs51("div", { style: { height: "100%", display: "flex", flexDirection: "column" }, children: [
@@ -19896,7 +19858,7 @@ var TopologyInboxView = () => {
19896
19858
  justifyContent: "center",
19897
19859
  height: 200
19898
19860
  },
19899
- children: /* @__PURE__ */ jsx77(Spin11, { size: "large" })
19861
+ children: /* @__PURE__ */ jsx77(Spin10, { size: "large" })
19900
19862
  }
19901
19863
  ) : items.length === 0 ? /* @__PURE__ */ jsx77(Empty7, { description: "Inbox is empty" }) : /* @__PURE__ */ jsx77(
19902
19864
  List8,
@@ -19936,14 +19898,14 @@ var TopologyInboxView = () => {
19936
19898
  };
19937
19899
 
19938
19900
  // src/components/Eval/EvalPanel.tsx
19939
- import React41, { useState as useState56, useMemo as useMemo18 } from "react";
19901
+ import React41, { useState as useState55, useMemo as useMemo19 } from "react";
19940
19902
  import { createStyles as createStyles22 } from "antd-style";
19941
- import { Button as Button40, Card as Card22, Typography as Typography35, Row as Row3, Col as Col3, Tag as Tag20, theme as theme15, Dropdown as Dropdown2, Popconfirm as Popconfirm7, message as message14 } from "antd";
19903
+ import { Button as Button40, Card as Card22, Typography as Typography35, Row as Row3, Col as Col3, Tag as Tag20, theme as theme15, Dropdown as Dropdown2, Popconfirm as Popconfirm9, message as message14 } from "antd";
19942
19904
  import { Play as Play2, FlaskConical as FlaskConical2, TestTube2 as TestTube26, TrendingUp, CheckCircle as CheckCircle2, XCircle as XCircle2, ArrowRight as ArrowRight2, ChevronDown as ChevronDown3, Trash2 as Trash27, Clock } from "lucide-react";
19943
19905
 
19944
19906
  // src/components/Eval/EvalSuiteCardList.tsx
19945
19907
  import { createStyles as createStyles19 } from "antd-style";
19946
- import { Card as Card19, Typography as Typography32, Row as Row2, Col as Col2, Empty as Empty8, Popconfirm as Popconfirm4, Spin as Spin12 } from "antd";
19908
+ import { Card as Card19, Typography as Typography32, Row as Row2, Col as Col2, Empty as Empty8, Popconfirm as Popconfirm6, Spin as Spin11 } from "antd";
19947
19909
  import { Trash2 as Trash24, TestTube2 as TestTube24 } from "lucide-react";
19948
19910
  import { jsx as jsx78, jsxs as jsxs52 } from "react/jsx-runtime";
19949
19911
  var { Text: Text29 } = Typography32;
@@ -20008,7 +19970,7 @@ var EvalSuiteCardList = ({ projectId, onSelectSuite }) => {
20008
19970
  const { styles } = useStyle9();
20009
19971
  const { suites, loading, remove } = useEvalSuites(projectId);
20010
19972
  if (loading) {
20011
- return /* @__PURE__ */ jsx78("div", { style: { display: "flex", justifyContent: "center", padding: 48 }, children: /* @__PURE__ */ jsx78(Spin12, {}) });
19973
+ return /* @__PURE__ */ jsx78("div", { style: { display: "flex", justifyContent: "center", padding: 48 }, children: /* @__PURE__ */ jsx78(Spin11, {}) });
20012
19974
  }
20013
19975
  if (suites.length === 0) {
20014
19976
  return /* @__PURE__ */ jsx78(Empty8, { image: Empty8.PRESENTED_IMAGE_SIMPLE, description: /* @__PURE__ */ jsx78(Text29, { type: "secondary", children: "No test suites yet" }) });
@@ -20028,7 +19990,7 @@ var EvalSuiteCardList = ({ projectId, onSelectSuite }) => {
20028
19990
  /* @__PURE__ */ jsx78("div", { className: styles.subtitle, children: "Server-side agent testing" })
20029
19991
  ] }),
20030
19992
  /* @__PURE__ */ jsx78(
20031
- Popconfirm4,
19993
+ Popconfirm6,
20032
19994
  {
20033
19995
  title: "Delete this suite?",
20034
19996
  onConfirm: (e) => {
@@ -20053,9 +20015,9 @@ var EvalSuiteCardList = ({ projectId, onSelectSuite }) => {
20053
20015
  };
20054
20016
 
20055
20017
  // src/components/Eval/EvalSuiteDetail.tsx
20056
- import { useState as useState54 } from "react";
20018
+ import { useState as useState53 } from "react";
20057
20019
  import { createStyles as createStyles20 } from "antd-style";
20058
- import { Button as Button38, Card as Card20, Typography as Typography33, Modal as Modal12, Form as Form8, Input as Input14, Select as Select6, Table as Table3, Popconfirm as Popconfirm5, Empty as Empty9 } from "antd";
20020
+ import { Button as Button38, Card as Card20, Typography as Typography33, Modal as Modal12, Form as Form8, Input as Input14, Select as Select6, Table as Table3, Popconfirm as Popconfirm7, Empty as Empty9 } from "antd";
20059
20021
  import { Play, Plus as Plus6, Trash2 as Trash25, Bot, MessageSquare, FlaskConical } from "lucide-react";
20060
20022
  import { jsx as jsx79, jsxs as jsxs53 } from "react/jsx-runtime";
20061
20023
  var { Text: Text30 } = Typography33;
@@ -20157,9 +20119,9 @@ var EvalSuiteDetail = ({ projectId, suiteId, onBack, onRun }) => {
20157
20119
  const { suites } = useEvalSuites(projectId);
20158
20120
  const { cases, create: createCase, remove: removeCase } = useEvalCases(projectId, suiteId);
20159
20121
  const { start } = useEvalRuns(projectId);
20160
- const [modalOpen, setModalOpen] = useState54(false);
20122
+ const [modalOpen, setModalOpen] = useState53(false);
20161
20123
  const [form] = Form8.useForm();
20162
- const [agents, setAgents] = useState54([]);
20124
+ const [agents, setAgents] = useState53([]);
20163
20125
  const suite = suites.find((s) => s.id === suiteId) || {};
20164
20126
  const loadAgents = async () => {
20165
20127
  try {
@@ -20215,7 +20177,7 @@ var EvalSuiteDetail = ({ projectId, suiteId, onBack, onRun }) => {
20215
20177
  title: "",
20216
20178
  key: "actions",
20217
20179
  width: 40,
20218
- render: (_, c) => /* @__PURE__ */ jsx79(Popconfirm5, { title: "Delete?", onConfirm: () => removeCase(projectId, suiteId, c.id), children: /* @__PURE__ */ jsx79(Button38, { type: "text", danger: true, size: "small", icon: /* @__PURE__ */ jsx79(Trash25, { size: 14 }) }) })
20180
+ render: (_, c) => /* @__PURE__ */ jsx79(Popconfirm7, { title: "Delete?", onConfirm: () => removeCase(projectId, suiteId, c.id), children: /* @__PURE__ */ jsx79(Button38, { type: "text", danger: true, size: "small", icon: /* @__PURE__ */ jsx79(Trash25, { size: 14 }) }) })
20219
20181
  }
20220
20182
  ];
20221
20183
  return /* @__PURE__ */ jsxs53("div", { className: styles.shell, children: [
@@ -20292,9 +20254,9 @@ var EvalSuiteDetail = ({ projectId, suiteId, onBack, onRun }) => {
20292
20254
  };
20293
20255
 
20294
20256
  // src/components/Eval/EvalRunResults.tsx
20295
- import { useEffect as useEffect39, useState as useState55 } from "react";
20257
+ import { useEffect as useEffect38, useState as useState54 } from "react";
20296
20258
  import { createStyles as createStyles21 } from "antd-style";
20297
- import { Button as Button39, Card as Card21, Typography as Typography34, Progress as Progress4, Tag as Tag19, Table as Table4, Empty as Empty10, Popconfirm as Popconfirm6, message as message13 } from "antd";
20259
+ import { Button as Button39, Card as Card21, Typography as Typography34, Progress as Progress4, Tag as Tag19, Table as Table4, Empty as Empty10, Popconfirm as Popconfirm8, message as message13 } from "antd";
20298
20260
  import { CheckCircle, XCircle, Trash2 as Trash26 } from "lucide-react";
20299
20261
  import { jsx as jsx80, jsxs as jsxs54 } from "react/jsx-runtime";
20300
20262
  var { Text: Text31 } = Typography34;
@@ -20381,9 +20343,9 @@ var useStyle11 = createStyles21(({ token, css }) => ({
20381
20343
  var EvalRunResults = ({ runId, onBack }) => {
20382
20344
  const { styles } = useStyle11();
20383
20345
  const client = useClient("__GLOBAL__");
20384
- const [run, setRun] = useState55(null);
20346
+ const [run, setRun] = useState54(null);
20385
20347
  const { status: streamingStatus, progress, connected } = useEvalRunStream(runId);
20386
- useEffect39(() => {
20348
+ useEffect38(() => {
20387
20349
  client.eval.runs.get(runId).then(setRun).catch(console.error);
20388
20350
  }, [runId, client]);
20389
20351
  if (!run) {
@@ -20403,7 +20365,7 @@ var EvalRunResults = ({ runId, onBack }) => {
20403
20365
  /* @__PURE__ */ jsx80(Tag19, { color: run.status === "completed" ? "success" : run.status === "running" ? "processing" : run.status === "failed" ? "error" : "warning", children: run.status })
20404
20366
  ] }),
20405
20367
  /* @__PURE__ */ jsx80(
20406
- Popconfirm6,
20368
+ Popconfirm8,
20407
20369
  {
20408
20370
  title: "Delete this run?",
20409
20371
  description: "Run results will be permanently deleted.",
@@ -20734,10 +20696,10 @@ var EvalPanel = () => {
20734
20696
  const { styles, cx } = useStyle12();
20735
20697
  const { token } = theme15.useToken();
20736
20698
  const { projects } = useEvalProjects();
20737
- const [projectId, setProjectId] = useState56("");
20738
- const [page, setPage] = useState56("dashboard");
20739
- const [suiteId, setSuiteId] = useState56("");
20740
- const [runId, setRunId] = useState56("");
20699
+ const [projectId, setProjectId] = useState55("");
20700
+ const [page, setPage] = useState55("dashboard");
20701
+ const [suiteId, setSuiteId] = useState55("");
20702
+ const [runId, setRunId] = useState55("");
20741
20703
  React41.useEffect(() => {
20742
20704
  if (!projectId && projects.length > 0) {
20743
20705
  setProjectId(projects[0].id);
@@ -20745,7 +20707,7 @@ var EvalPanel = () => {
20745
20707
  }, [projects, projectId]);
20746
20708
  const { suites } = useEvalSuites(projectId);
20747
20709
  const { runs, start, remove } = useEvalRuns(projectId);
20748
- const stats = useMemo18(() => {
20710
+ const stats = useMemo19(() => {
20749
20711
  const totalCases = suites.reduce((s, x) => s + (x.caseCount ?? 0), 0);
20750
20712
  const latest = runs[0];
20751
20713
  const passRate = latest?.totalCases > 0 ? Math.round(latest.passedCases / latest.totalCases * 100) : null;
@@ -20893,7 +20855,7 @@ var EvalPanel = () => {
20893
20855
  /* @__PURE__ */ jsx81(Tag20, { color: meta.color, style: { margin: 0 }, children: meta.label }),
20894
20856
  /* @__PURE__ */ jsx81(Text32, { strong: true, style: { fontSize: 15, minWidth: 40, textAlign: "right" }, children: typeof r.avgScore === "number" ? r.avgScore.toFixed(1) : "\u2014" }),
20895
20857
  /* @__PURE__ */ jsx81(
20896
- Popconfirm7,
20858
+ Popconfirm9,
20897
20859
  {
20898
20860
  title: "Delete this run?",
20899
20861
  description: "Run results will be permanently deleted.",
@@ -20925,8 +20887,8 @@ var EvalPanel = () => {
20925
20887
  ] });
20926
20888
  }
20927
20889
  const SuiteListPage = () => {
20928
- const [showAdd, setShowAdd] = useState56(false);
20929
- const [name, setName] = useState56("");
20890
+ const [showAdd, setShowAdd] = useState55(false);
20891
+ const [name, setName] = useState55("");
20930
20892
  const { create } = useEvalSuites(projectId);
20931
20893
  const handleAdd = async () => {
20932
20894
  if (!name.trim()) return;
@@ -21108,9 +21070,9 @@ var WorkspaceResourceManager = ({
21108
21070
  logo
21109
21071
  }) => {
21110
21072
  const { openContentApp, menuCollapsed, setMenuCollapsed } = useChatUIContext();
21111
- const hasOpenedDefault = useRef18(false);
21112
- const hasRegistered = useRef18(false);
21113
- useEffect40(() => {
21073
+ const hasOpenedDefault = useRef17(false);
21074
+ const hasRegistered = useRef17(false);
21075
+ useEffect39(() => {
21114
21076
  if (!hasRegistered.current) {
21115
21077
  hasRegistered.current = true;
21116
21078
  regsiterElement("workspace_projects", {
@@ -21169,9 +21131,9 @@ var WorkspaceResourceManager = ({
21169
21131
  const { user, logout, tenants, currentTenant, selectTenant, isLoading } = useAuth();
21170
21132
  const { setWorkspace, setProject } = useWorkspaceContext();
21171
21133
  const { config } = useLatticeChatShellContext();
21172
- const [tenantModalOpen, setTenantModalOpen] = useState57(false);
21173
- const [changePasswordOpen, setChangePasswordOpen] = useState57(false);
21174
- const menuItems = useMemo19(() => {
21134
+ const [tenantModalOpen, setTenantModalOpen] = useState56(false);
21135
+ const [changePasswordOpen, setChangePasswordOpen] = useState56(false);
21136
+ const menuItems = useMemo20(() => {
21175
21137
  const items = config.workspaceMenuItems?.length ? [...config.workspaceMenuItems] : [...DEFAULT_WORKSPACE_MENU_ITEMS];
21176
21138
  return items.sort((a, b) => (a.order ?? 0) - (b.order ?? 0));
21177
21139
  }, [config.workspaceMenuItems]);
@@ -21202,7 +21164,7 @@ var WorkspaceResourceManager = ({
21202
21164
  });
21203
21165
  }
21204
21166
  };
21205
- useEffect40(() => {
21167
+ useEffect39(() => {
21206
21168
  if (!hasOpenedDefault.current && menuItems.length > 0) {
21207
21169
  hasOpenedDefault.current = true;
21208
21170
  const firstRoute = menuItems.find((item) => item.type === "route");
@@ -21418,8 +21380,8 @@ var WorkspaceContextProvider = ({
21418
21380
  }
21419
21381
  return null;
21420
21382
  };
21421
- const [workspaceId, setWorkspaceId] = useState58(getInitialWorkspaceId);
21422
- const [projectId, setProjectId] = useState58(getInitialProjectId);
21383
+ const [workspaceId, setWorkspaceId] = useState57(getInitialWorkspaceId);
21384
+ const [projectId, setProjectId] = useState57(getInitialProjectId);
21423
21385
  React43.useEffect(() => {
21424
21386
  const wsId = getInitialWorkspaceId();
21425
21387
  const pjId = getInitialProjectId();
@@ -21427,13 +21389,13 @@ var WorkspaceContextProvider = ({
21427
21389
  Client2.setWorkspaceContext(wsId || void 0, pjId || void 0);
21428
21390
  }
21429
21391
  }, []);
21430
- useEffect41(() => {
21392
+ useEffect40(() => {
21431
21393
  Client2.setWorkspaceContext(workspaceId || void 0, projectId || void 0);
21432
21394
  }, [workspaceId, projectId]);
21433
- const [workspaces, setWorkspaces] = useState58([]);
21434
- const [projects, setProjects] = useState58([]);
21435
- const [loading, setLoading] = useState58(false);
21436
- const [error, setError] = useState58(null);
21395
+ const [workspaces, setWorkspaces] = useState57([]);
21396
+ const [projects, setProjects] = useState57([]);
21397
+ const [loading, setLoading] = useState57(false);
21398
+ const [error, setError] = useState57(null);
21437
21399
  const client = React43.useMemo(() => {
21438
21400
  const authApiKey = isAuthenticated ? sessionStorage.getItem("lattice_token") || config.apiKey || "" : config.apiKey || "";
21439
21401
  return new WorkspaceClient({
@@ -21443,22 +21405,22 @@ var WorkspaceContextProvider = ({
21443
21405
  transport: "sse"
21444
21406
  }, tenantId);
21445
21407
  }, [config.baseURL, config.apiKey, tenantId, isAuthenticated]);
21446
- const resetSelectedWorkspace = useCallback32(() => {
21408
+ const resetSelectedWorkspace = useCallback31(() => {
21447
21409
  setProjects([]);
21448
21410
  setWorkspaceId(null);
21449
21411
  sessionStorage.removeItem("workspaceId");
21450
21412
  setProjectId(null);
21451
21413
  sessionStorage.removeItem("projectId");
21452
21414
  }, [setProjects, setWorkspaceId, setProjectId]);
21453
- const resetWS = useCallback32(() => {
21415
+ const resetWS = useCallback31(() => {
21454
21416
  setWorkspaces([]);
21455
21417
  resetSelectedWorkspace();
21456
21418
  }, [resetSelectedWorkspace, setWorkspaces]);
21457
- useEffect41(() => {
21419
+ useEffect40(() => {
21458
21420
  resetWS();
21459
21421
  refreshWorkspaces();
21460
21422
  }, [tenantId]);
21461
- const refreshWorkspaces = useCallback32(async () => {
21423
+ const refreshWorkspaces = useCallback31(async () => {
21462
21424
  setLoading(true);
21463
21425
  setError(null);
21464
21426
  try {
@@ -21470,7 +21432,7 @@ var WorkspaceContextProvider = ({
21470
21432
  setLoading(false);
21471
21433
  }
21472
21434
  }, [client]);
21473
- const refreshProjects = useCallback32(async (wsId) => {
21435
+ const refreshProjects = useCallback31(async (wsId) => {
21474
21436
  const targetWorkspaceId = wsId || workspaceId;
21475
21437
  if (!targetWorkspaceId) {
21476
21438
  setProjects([]);
@@ -21487,28 +21449,28 @@ var WorkspaceContextProvider = ({
21487
21449
  setLoading(false);
21488
21450
  }
21489
21451
  }, [client, workspaceId]);
21490
- useEffect41(() => {
21452
+ useEffect40(() => {
21491
21453
  if (workspaceId && typeof window !== "undefined") {
21492
21454
  sessionStorage.setItem("workspaceId", workspaceId);
21493
21455
  }
21494
21456
  }, [workspaceId]);
21495
- useEffect41(() => {
21457
+ useEffect40(() => {
21496
21458
  if (projectId && typeof window !== "undefined") {
21497
21459
  sessionStorage.setItem("projectId", projectId);
21498
21460
  }
21499
21461
  }, [projectId]);
21500
- useEffect41(() => {
21462
+ useEffect40(() => {
21501
21463
  refreshWorkspaces().catch((err) => {
21502
21464
  console.warn("Failed to load workspaces:", err);
21503
21465
  });
21504
21466
  }, [refreshWorkspaces]);
21505
- useEffect41(() => {
21467
+ useEffect40(() => {
21506
21468
  if (workspaces.length > 0 && !workspaceId) {
21507
21469
  const firstWorkspace = workspaces[0];
21508
21470
  setWorkspaceId(firstWorkspace.id);
21509
21471
  }
21510
21472
  }, [workspaces, workspaceId]);
21511
- useEffect41(() => {
21473
+ useEffect40(() => {
21512
21474
  if (workspaceId) {
21513
21475
  refreshProjects(workspaceId);
21514
21476
  } else {
@@ -21516,7 +21478,7 @@ var WorkspaceContextProvider = ({
21516
21478
  }
21517
21479
  setProjectId(null);
21518
21480
  }, [workspaceId, refreshProjects]);
21519
- const createWorkspace = useCallback32(async (data) => {
21481
+ const createWorkspace = useCallback31(async (data) => {
21520
21482
  setLoading(true);
21521
21483
  setError(null);
21522
21484
  try {
@@ -21531,7 +21493,7 @@ var WorkspaceContextProvider = ({
21531
21493
  setLoading(false);
21532
21494
  }
21533
21495
  }, [client, refreshWorkspaces]);
21534
- const updateWorkspace = useCallback32(async (id, updates) => {
21496
+ const updateWorkspace = useCallback31(async (id, updates) => {
21535
21497
  setLoading(true);
21536
21498
  setError(null);
21537
21499
  try {
@@ -21546,7 +21508,7 @@ var WorkspaceContextProvider = ({
21546
21508
  setLoading(false);
21547
21509
  }
21548
21510
  }, [client, refreshWorkspaces]);
21549
- const deleteWorkspace = useCallback32(async (id) => {
21511
+ const deleteWorkspace = useCallback31(async (id) => {
21550
21512
  setLoading(true);
21551
21513
  setError(null);
21552
21514
  try {
@@ -21563,7 +21525,7 @@ var WorkspaceContextProvider = ({
21563
21525
  setLoading(false);
21564
21526
  }
21565
21527
  }, [client, workspaceId, refreshWorkspaces]);
21566
- const createProject = useCallback32(async (wsId, data) => {
21528
+ const createProject = useCallback31(async (wsId, data) => {
21567
21529
  setLoading(true);
21568
21530
  setError(null);
21569
21531
  try {
@@ -21578,7 +21540,7 @@ var WorkspaceContextProvider = ({
21578
21540
  setLoading(false);
21579
21541
  }
21580
21542
  }, [client, refreshProjects]);
21581
- const updateProject = useCallback32(async (wsId, id, updates) => {
21543
+ const updateProject = useCallback31(async (wsId, id, updates) => {
21582
21544
  setLoading(true);
21583
21545
  setError(null);
21584
21546
  try {
@@ -21593,7 +21555,7 @@ var WorkspaceContextProvider = ({
21593
21555
  setLoading(false);
21594
21556
  }
21595
21557
  }, [client, refreshProjects]);
21596
- const deleteProject = useCallback32(async (wsId, id) => {
21558
+ const deleteProject = useCallback31(async (wsId, id) => {
21597
21559
  setLoading(true);
21598
21560
  setError(null);
21599
21561
  try {
@@ -21610,7 +21572,7 @@ var WorkspaceContextProvider = ({
21610
21572
  setLoading(false);
21611
21573
  }
21612
21574
  }, [client, projectId, refreshProjects]);
21613
- const listPath = useCallback32(
21575
+ const listPath = useCallback31(
21614
21576
  async (path = "/", assistantId) => {
21615
21577
  if (!workspaceId || !projectId) {
21616
21578
  return [];
@@ -21629,7 +21591,7 @@ var WorkspaceContextProvider = ({
21629
21591
  },
21630
21592
  [client, workspaceId, projectId]
21631
21593
  );
21632
- const listPathByFolder = useCallback32(
21594
+ const listPathByFolder = useCallback31(
21633
21595
  async (folder, assistantId) => {
21634
21596
  let normalizedPath = folder;
21635
21597
  if (normalizedPath.startsWith("~/")) {
@@ -21642,7 +21604,7 @@ var WorkspaceContextProvider = ({
21642
21604
  },
21643
21605
  [listPath]
21644
21606
  );
21645
- const uploadFile = useCallback32(
21607
+ const uploadFile = useCallback31(
21646
21608
  async (path, file, assistantId) => {
21647
21609
  if (!workspaceId || !projectId) {
21648
21610
  throw new Error("Workspace and project must be selected before uploading files");
@@ -21662,7 +21624,7 @@ var WorkspaceContextProvider = ({
21662
21624
  },
21663
21625
  [client, workspaceId, projectId]
21664
21626
  );
21665
- const uploadFileToFolder = useCallback32(
21627
+ const uploadFileToFolder = useCallback31(
21666
21628
  async (folder, file, assistantId) => {
21667
21629
  let normalizedFolder = folder;
21668
21630
  if (normalizedFolder.startsWith("~/")) {
@@ -21672,7 +21634,7 @@ var WorkspaceContextProvider = ({
21672
21634
  },
21673
21635
  [uploadFile]
21674
21636
  );
21675
- const getFileViewUrl = useCallback32(
21637
+ const getFileViewUrl = useCallback31(
21676
21638
  (filePath, assistantId) => {
21677
21639
  if (!workspaceId || !projectId) {
21678
21640
  return "";
@@ -21724,17 +21686,17 @@ var WorkspaceContextProvider = ({
21724
21686
  };
21725
21687
 
21726
21688
  // src/components/Chat/DatabasePicker.tsx
21727
- import { useRef as useRef19, useState as useState59 } from "react";
21728
- import { Modal as Modal14, List as List9, Checkbox as Checkbox5, Spin as Spin13, Empty as Empty11, Typography as Typography36, Button as Button42, Space as Space25, Tooltip as Tooltip14 } from "antd";
21689
+ import { useRef as useRef18, useState as useState58 } from "react";
21690
+ import { Modal as Modal14, List as List9, Checkbox as Checkbox5, Spin as Spin12, Empty as Empty11, Typography as Typography36, Button as Button42, Space as Space25, Tooltip as Tooltip14 } from "antd";
21729
21691
  import { Database as Database5 } from "lucide-react";
21730
21692
  import { Fragment as Fragment14, jsx as jsx84, jsxs as jsxs57 } from "react/jsx-runtime";
21731
21693
  var DatabasePicker = ({ senderRef, iconOnly }) => {
21732
- const [modalOpen, setModalOpen] = useState59(false);
21733
- const [databases, setDatabases] = useState59([]);
21734
- const [loading, setLoading] = useState59(false);
21735
- const [selectedDatabases, setSelectedDatabases] = useState59([]);
21694
+ const [modalOpen, setModalOpen] = useState58(false);
21695
+ const [databases, setDatabases] = useState58([]);
21696
+ const [loading, setLoading] = useState58(false);
21697
+ const [selectedDatabases, setSelectedDatabases] = useState58([]);
21736
21698
  const { get } = useApi();
21737
- const fetchedRef = useRef19(false);
21699
+ const fetchedRef = useRef18(false);
21738
21700
  const loadDatabases = async () => {
21739
21701
  setLoading(true);
21740
21702
  try {
@@ -21814,7 +21776,7 @@ var DatabasePicker = ({ senderRef, iconOnly }) => {
21814
21776
  width: 600,
21815
21777
  okText: "Confirm",
21816
21778
  cancelText: "Cancel",
21817
- children: loading ? /* @__PURE__ */ jsx84("div", { style: { textAlign: "center", padding: 40 }, children: /* @__PURE__ */ jsx84(Spin13, { size: "large" }) }) : databases.length === 0 ? /* @__PURE__ */ jsx84(
21779
+ children: loading ? /* @__PURE__ */ jsx84("div", { style: { textAlign: "center", padding: 40 }, children: /* @__PURE__ */ jsx84(Spin12, { size: "large" }) }) : databases.length === 0 ? /* @__PURE__ */ jsx84(
21818
21780
  Empty11,
21819
21781
  {
21820
21782
  description: "No databases available",
@@ -21874,17 +21836,17 @@ var DatabasePicker = ({ senderRef, iconOnly }) => {
21874
21836
  };
21875
21837
 
21876
21838
  // src/components/Chat/SkillPicker.tsx
21877
- import { useRef as useRef20, useState as useState60 } from "react";
21878
- import { Modal as Modal15, List as List10, Checkbox as Checkbox6, Spin as Spin14, Empty as Empty12, Typography as Typography37, Button as Button43, Space as Space26, Tooltip as Tooltip15 } from "antd";
21839
+ import { useRef as useRef19, useState as useState59 } from "react";
21840
+ import { Modal as Modal15, List as List10, Checkbox as Checkbox6, Spin as Spin13, Empty as Empty12, Typography as Typography37, Button as Button43, Space as Space26, Tooltip as Tooltip15 } from "antd";
21879
21841
  import { BrainCircuit } from "lucide-react";
21880
21842
  import { Fragment as Fragment15, jsx as jsx85, jsxs as jsxs58 } from "react/jsx-runtime";
21881
21843
  var SkillPicker = ({ senderRef, iconOnly }) => {
21882
- const [modalOpen, setModalOpen] = useState60(false);
21883
- const [skills, setSkills] = useState60([]);
21884
- const [loading, setLoading] = useState60(false);
21885
- const [selectedSkills, setSelectedSkills] = useState60([]);
21844
+ const [modalOpen, setModalOpen] = useState59(false);
21845
+ const [skills, setSkills] = useState59([]);
21846
+ const [loading, setLoading] = useState59(false);
21847
+ const [selectedSkills, setSelectedSkills] = useState59([]);
21886
21848
  const { get } = useApi();
21887
- const fetchedRef = useRef20(false);
21849
+ const fetchedRef = useRef19(false);
21888
21850
  const loadSkills = async () => {
21889
21851
  setLoading(true);
21890
21852
  try {
@@ -21964,7 +21926,7 @@ var SkillPicker = ({ senderRef, iconOnly }) => {
21964
21926
  width: 600,
21965
21927
  okText: "Confirm",
21966
21928
  cancelText: "Cancel",
21967
- children: loading ? /* @__PURE__ */ jsx85("div", { style: { textAlign: "center", padding: 40 }, children: /* @__PURE__ */ jsx85(Spin14, { size: "large" }) }) : skills.length === 0 ? /* @__PURE__ */ jsx85(
21929
+ children: loading ? /* @__PURE__ */ jsx85("div", { style: { textAlign: "center", padding: 40 }, children: /* @__PURE__ */ jsx85(Spin13, { size: "large" }) }) : skills.length === 0 ? /* @__PURE__ */ jsx85(
21968
21930
  Empty12,
21969
21931
  {
21970
21932
  description: "No skills available",
@@ -22024,16 +21986,16 @@ var SkillPicker = ({ senderRef, iconOnly }) => {
22024
21986
  };
22025
21987
 
22026
21988
  // src/components/Chat/AgentPicker.tsx
22027
- import { useRef as useRef21, useState as useState61 } from "react";
21989
+ import { useRef as useRef20, useState as useState60 } from "react";
22028
21990
  import { Modal as Modal16, List as List11, Empty as Empty13, Typography as Typography38, Button as Button44, Tooltip as Tooltip16 } from "antd";
22029
21991
  import { Bot as Bot3 } from "lucide-react";
22030
21992
  import { Fragment as Fragment16, jsx as jsx86, jsxs as jsxs59 } from "react/jsx-runtime";
22031
21993
  var AgentPicker = ({ senderRef, iconOnly }) => {
22032
- const [modalOpen, setModalOpen] = useState61(false);
22033
- const [loading, setLoading] = useState61(false);
22034
- const [selectedAgent, setSelectedAgent] = useState61(null);
21994
+ const [modalOpen, setModalOpen] = useState60(false);
21995
+ const [loading, setLoading] = useState60(false);
21996
+ const [selectedAgent, setSelectedAgent] = useState60(null);
22035
21997
  const { assistants, currentAssistant, selectAssistant } = useAssistantContext();
22036
- const fetchedRef = useRef21(false);
21998
+ const fetchedRef = useRef20(false);
22037
21999
  const handleOpenModal = () => {
22038
22000
  setSelectedAgent(currentAssistant?.id || null);
22039
22001
  setModalOpen(true);
@@ -22140,8 +22102,8 @@ var AgentPicker = ({ senderRef, iconOnly }) => {
22140
22102
  };
22141
22103
 
22142
22104
  // src/components/Chat/MetricsDataSourcePicker.tsx
22143
- import { useEffect as useEffect43, useState as useState62, useRef as useRef22 } from "react";
22144
- import { Modal as Modal17, List as List12, Spin as Spin16, Empty as Empty14, Typography as Typography39, Button as Button45, Tag as Tag21, Tooltip as Tooltip17 } from "antd";
22105
+ import { useEffect as useEffect42, useState as useState61, useRef as useRef21 } from "react";
22106
+ import { Modal as Modal17, List as List12, Spin as Spin15, Empty as Empty14, Typography as Typography39, Button as Button45, Tag as Tag21, Tooltip as Tooltip17 } from "antd";
22145
22107
  import { Database as Database6, Check as Check4, Server as Server3 } from "lucide-react";
22146
22108
  import { Fragment as Fragment17, jsx as jsx87, jsxs as jsxs60 } from "react/jsx-runtime";
22147
22109
  var SESSION_STORAGE_KEY = "metrics_datasource_selection";
@@ -22149,13 +22111,13 @@ var MetricsDataSourcePicker = ({
22149
22111
  senderRef,
22150
22112
  iconOnly
22151
22113
  }) => {
22152
- const [modalOpen, setModalOpen] = useState62(false);
22153
- const [loading, setLoading] = useState62(false);
22154
- const [dataSources, setDataSources] = useState62([]);
22114
+ const [modalOpen, setModalOpen] = useState61(false);
22115
+ const [loading, setLoading] = useState61(false);
22116
+ const [dataSources, setDataSources] = useState61([]);
22155
22117
  const { config } = useLatticeChatShellContext();
22156
22118
  const { customRunConfig, updateCustomRunConfig } = useConversationContext();
22157
22119
  const { get } = useApi();
22158
- const hasInitializedRef = useRef22(false);
22120
+ const hasInitializedRef = useRef21(false);
22159
22121
  const loadDataSources = async () => {
22160
22122
  setLoading(true);
22161
22123
  try {
@@ -22229,7 +22191,7 @@ var MetricsDataSourcePicker = ({
22229
22191
  console.error("Failed to save datasource to sessionStorage:", error);
22230
22192
  }
22231
22193
  };
22232
- useEffect43(() => {
22194
+ useEffect42(() => {
22233
22195
  if (hasInitializedRef.current) return;
22234
22196
  hasInitializedRef.current = true;
22235
22197
  loadDataSources().then(() => {
@@ -22326,7 +22288,7 @@ var MetricsDataSourcePicker = ({
22326
22288
  overflowY: "auto"
22327
22289
  }
22328
22290
  },
22329
- children: loading ? /* @__PURE__ */ jsx87("div", { style: { textAlign: "center", padding: 40 }, children: /* @__PURE__ */ jsx87(Spin16, { size: "large" }) }) : dataSources.length === 0 ? /* @__PURE__ */ jsx87(
22291
+ children: loading ? /* @__PURE__ */ jsx87("div", { style: { textAlign: "center", padding: 40 }, children: /* @__PURE__ */ jsx87(Spin15, { size: "large" }) }) : dataSources.length === 0 ? /* @__PURE__ */ jsx87(
22330
22292
  Empty14,
22331
22293
  {
22332
22294
  description: "No Metrics Data Sources Available",
@@ -22480,7 +22442,7 @@ var MetricsDataSourcePicker = ({
22480
22442
  };
22481
22443
 
22482
22444
  // src/components/Chat/ModelSelector.tsx
22483
- import { useState as useState63, useEffect as useEffect44, useCallback as useCallback33, useRef as useRef23 } from "react";
22445
+ import { useState as useState62, useEffect as useEffect43, useCallback as useCallback32, useRef as useRef22 } from "react";
22484
22446
  import { Select as Select7 } from "antd";
22485
22447
  import { jsx as jsx88 } from "react/jsx-runtime";
22486
22448
  var ModelSelector = ({
@@ -22489,22 +22451,22 @@ var ModelSelector = ({
22489
22451
  defaultModelKey = "default",
22490
22452
  style
22491
22453
  }) => {
22492
- const [models, setModels] = useState63([]);
22493
- const [isLoading, setIsLoading] = useState63(false);
22494
- const [internalValue, setInternalValue] = useState63(null);
22495
- const [dropdownOpen, setDropdownOpen] = useState63(false);
22496
- const [isHovered, setIsHovered] = useState63(false);
22497
- const hasFetchedRef = useRef23(false);
22498
- const hasSetDefaultRef = useRef23(false);
22454
+ const [models, setModels] = useState62([]);
22455
+ const [isLoading, setIsLoading] = useState62(false);
22456
+ const [internalValue, setInternalValue] = useState62(null);
22457
+ const [dropdownOpen, setDropdownOpen] = useState62(false);
22458
+ const [isHovered, setIsHovered] = useState62(false);
22459
+ const hasFetchedRef = useRef22(false);
22460
+ const hasSetDefaultRef = useRef22(false);
22499
22461
  const { get } = useApi();
22500
22462
  const selectedModelConfig = value !== void 0 ? value : internalValue;
22501
- const setSelectedModelConfig = useCallback33((config) => {
22463
+ const setSelectedModelConfig = useCallback32((config) => {
22502
22464
  if (value === void 0) {
22503
22465
  setInternalValue(config);
22504
22466
  }
22505
22467
  onChange?.(config);
22506
22468
  }, [value, onChange]);
22507
- const fetchModels = useCallback33(async () => {
22469
+ const fetchModels = useCallback32(async () => {
22508
22470
  if (hasFetchedRef.current) return;
22509
22471
  hasFetchedRef.current = true;
22510
22472
  setIsLoading(true);
@@ -22525,7 +22487,7 @@ var ModelSelector = ({
22525
22487
  setIsLoading(false);
22526
22488
  }
22527
22489
  }, [get, defaultModelKey]);
22528
- useEffect44(() => {
22490
+ useEffect43(() => {
22529
22491
  fetchModels();
22530
22492
  }, [fetchModels]);
22531
22493
  const handleChange = (modelKey) => {
@@ -22587,8 +22549,8 @@ import {
22587
22549
  WarningOutlined
22588
22550
  } from "@ant-design/icons";
22589
22551
  import { Prompts } from "@ant-design/x";
22590
- import { Space as Space28, Typography as Typography40, Spin as Spin17 } from "antd";
22591
- import { useEffect as useEffect45, useState as useState64, useMemo as useMemo20 } from "react";
22552
+ import { Space as Space28, Typography as Typography40, Spin as Spin16 } from "antd";
22553
+ import { useEffect as useEffect44, useState as useState63, useMemo as useMemo21 } from "react";
22592
22554
  import { BrainCircuit as BrainCircuit2 } from "lucide-react";
22593
22555
  import { jsx as jsx89, jsxs as jsxs61 } from "react/jsx-runtime";
22594
22556
  var categoryConfig = {
@@ -22673,12 +22635,12 @@ var SkillCategoryPrompts = ({
22673
22635
  senderRef,
22674
22636
  visible = true
22675
22637
  }) => {
22676
- const [skills, setSkills] = useState64([]);
22677
- const [loading, setLoading] = useState64(false);
22678
- const [showAll, setShowAll] = useState64(false);
22638
+ const [skills, setSkills] = useState63([]);
22639
+ const [loading, setLoading] = useState63(false);
22640
+ const [showAll, setShowAll] = useState63(false);
22679
22641
  const { get } = useApi();
22680
22642
  const MAX_SIMPLE_ITEMS = 10;
22681
- useEffect45(() => {
22643
+ useEffect44(() => {
22682
22644
  const loadSkills = async () => {
22683
22645
  setLoading(true);
22684
22646
  try {
@@ -22696,7 +22658,7 @@ var SkillCategoryPrompts = ({
22696
22658
  loadSkills();
22697
22659
  }
22698
22660
  }, [get, visible]);
22699
- const groupedSkills = useMemo20(() => {
22661
+ const groupedSkills = useMemo21(() => {
22700
22662
  const groups = {};
22701
22663
  skills.forEach((skill) => {
22702
22664
  const category = skill.metadata?.category || "global";
@@ -22765,7 +22727,7 @@ var SkillCategoryPrompts = ({
22765
22727
  return null;
22766
22728
  }
22767
22729
  if (loading) {
22768
- return /* @__PURE__ */ jsx89("div", { style: { textAlign: "center", padding: 40 }, children: /* @__PURE__ */ jsx89(Spin17, { size: "large" }) });
22730
+ return /* @__PURE__ */ jsx89("div", { style: { textAlign: "center", padding: 40 }, children: /* @__PURE__ */ jsx89(Spin16, { size: "large" }) });
22769
22731
  }
22770
22732
  if (skills.length === 0) {
22771
22733
  return null;
@@ -22857,7 +22819,7 @@ import {
22857
22819
  } from "@ant-design/icons";
22858
22820
  import { Prompts as Prompts2 } from "@ant-design/x";
22859
22821
  import { Space as Space29, Tabs } from "antd";
22860
- import { useState as useState65, useMemo as useMemo21 } from "react";
22822
+ import { useState as useState64, useMemo as useMemo22 } from "react";
22861
22823
  import { jsx as jsx90, jsxs as jsxs62 } from "react/jsx-runtime";
22862
22824
  var defaultCategoryIcons = {
22863
22825
  financial: /* @__PURE__ */ jsx90(DollarOutlined, {}),
@@ -23076,9 +23038,9 @@ var BusinessAnalysisPrompts = ({
23076
23038
  simpleModeTitle = "Quick Analysis",
23077
23039
  expandModeTitle = "Analysis Categories"
23078
23040
  }) => {
23079
- const [showAll, setShowAll] = useState65(false);
23041
+ const [showAll, setShowAll] = useState64(false);
23080
23042
  const { config } = useLatticeChatShellContext();
23081
- const analysisData = useMemo21(() => {
23043
+ const analysisData = useMemo22(() => {
23082
23044
  const customData = config.quickPromptsData;
23083
23045
  if (customData && Array.isArray(customData) && customData.length > 0) {
23084
23046
  return customData.map((category) => ({
@@ -23098,7 +23060,7 @@ var BusinessAnalysisPrompts = ({
23098
23060
  color: defaultCategoryColors[category.key] || "#8C8C8C"
23099
23061
  }));
23100
23062
  }, [config.quickPromptsData]);
23101
- const allItems = useMemo21(() => {
23063
+ const allItems = useMemo22(() => {
23102
23064
  const items = [];
23103
23065
  analysisData.forEach((category) => {
23104
23066
  category.items.forEach((item) => {
@@ -23237,16 +23199,23 @@ var Chating = ({
23237
23199
  showHITL = true,
23238
23200
  showRefreshButton = false,
23239
23201
  showModelSelector,
23202
+ showDatabaseSlot,
23203
+ showSkillSlot,
23204
+ showAgentSlot,
23205
+ showMetricsDataSourceSlot,
23240
23206
  showEmptyState = true,
23241
23207
  emptyStateGreeting,
23242
23208
  emptyStateQuestion = "Ready to turn data into insightful charts in seconds?",
23243
- welcomePrefix = "Hey"
23209
+ welcomePrefix = "Hey",
23210
+ systemContext,
23211
+ initialMessage,
23212
+ onInitialMessageSent
23244
23213
  }) => {
23245
- const [content, setContent] = useState66("");
23246
- const [attachedFiles, setAttachedFiles] = useState66([]);
23214
+ const [content, setContent] = useState65("");
23215
+ const [attachedFiles, setAttachedFiles] = useState65([]);
23247
23216
  const { styles } = useStyle();
23248
- const [headerOpen, setHeaderOpen] = useState66(false);
23249
- const attachmentsRef = useRef24(null);
23217
+ const [headerOpen, setHeaderOpen] = useState65(false);
23218
+ const attachmentsRef = useRef23(null);
23250
23219
  const senderRef = React51.useRef(null);
23251
23220
  const {
23252
23221
  assistantId,
@@ -23270,8 +23239,8 @@ var Chating = ({
23270
23239
  const hasPendingMessages = pendingMessages?.length > 0;
23271
23240
  const isInputDisabled = interrupts && interrupts.length > 0;
23272
23241
  const typingFrames = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
23273
- const [typingFrameIndex, setTypingFrameIndex] = useState66(0);
23274
- useEffect46(() => {
23242
+ const [typingFrameIndex, setTypingFrameIndex] = useState65(0);
23243
+ useEffect45(() => {
23275
23244
  if (!isStreaming) return;
23276
23245
  const interval = setInterval(() => {
23277
23246
  setTypingFrameIndex((prev) => (prev + 1) % typingFrames.length);
@@ -23279,16 +23248,37 @@ var Chating = ({
23279
23248
  return () => clearInterval(interval);
23280
23249
  }, [isStreaming]);
23281
23250
  const conversationContext = useConversationContext();
23282
- const [modelConfig, setModelConfig] = useState66(null);
23283
- const handleModelChange = useCallback34((config2) => {
23251
+ const systemContextSentRef = useRef23(false);
23252
+ const initialMessageSentRef = useRef23(false);
23253
+ const prevLoadingRef = useRef23(false);
23254
+ useEffect45(() => {
23255
+ systemContextSentRef.current = false;
23256
+ }, [threadId]);
23257
+ useEffect45(() => {
23258
+ initialMessageSentRef.current = false;
23259
+ }, [threadId]);
23260
+ useEffect45(() => {
23261
+ const wasLoading = prevLoadingRef.current;
23262
+ prevLoadingRef.current = isLoading;
23263
+ if (wasLoading && !isLoading && initialMessage && threadId && !initialMessageSentRef.current) {
23264
+ initialMessageSentRef.current = true;
23265
+ sendMessage({
23266
+ input: { message: initialMessage },
23267
+ streaming: true
23268
+ });
23269
+ onInitialMessageSent?.();
23270
+ }
23271
+ }, [isLoading, initialMessage, threadId, sendMessage, onInitialMessageSent]);
23272
+ const [modelConfig, setModelConfig] = useState65(null);
23273
+ const handleModelChange = useCallback33((config2) => {
23284
23274
  setModelConfig(config2);
23285
23275
  if (config2) {
23286
23276
  updateCustomRunConfig({ modelConfig: config2 });
23287
23277
  }
23288
23278
  }, [updateCustomRunConfig]);
23289
- const [isEmptyState, setIsEmptyState] = useState66(showEmptyState && messages.length === 0 && !pendingMessages?.length);
23290
- const [isTransitioning, setIsTransitioning] = useState66(false);
23291
- useEffect46(() => {
23279
+ const [isEmptyState, setIsEmptyState] = useState65(showEmptyState && messages.length === 0 && !pendingMessages?.length);
23280
+ const [isTransitioning, setIsTransitioning] = useState65(false);
23281
+ useEffect45(() => {
23292
23282
  if (!showEmptyState) {
23293
23283
  setIsEmptyState(false);
23294
23284
  return;
@@ -23313,9 +23303,9 @@ var Chating = ({
23313
23303
  const listPathByFolder = workspaceContext?.listPathByFolder ?? (async () => []);
23314
23304
  const workspaceId = workspaceContext?.workspaceId ?? null;
23315
23305
  const projectId = workspaceContext?.projectId ?? null;
23316
- const [workspaceFiles, setWorkspaceFiles] = useState66([]);
23317
- const [suggestionsLoading, setSuggestionsLoading] = useState66(false);
23318
- const [suggestionsOpen, setSuggestionsOpen] = useState66(false);
23306
+ const [workspaceFiles, setWorkspaceFiles] = useState65([]);
23307
+ const [suggestionsLoading, setSuggestionsLoading] = useState65(false);
23308
+ const [suggestionsOpen, setSuggestionsOpen] = useState65(false);
23319
23309
  const getFileIcon3 = (filename) => {
23320
23310
  const ext = filename.split(".").pop()?.toLowerCase();
23321
23311
  const iconStyle = { fontSize: 16 };
@@ -23375,7 +23365,7 @@ var Chating = ({
23375
23365
  setSuggestionsLoading(false);
23376
23366
  }
23377
23367
  };
23378
- useEffect46(() => {
23368
+ useEffect45(() => {
23379
23369
  regsiterElement("action_show_attachments_uploader", {
23380
23370
  card_view: () => null,
23381
23371
  action: (data) => {
@@ -23403,6 +23393,11 @@ var Chating = ({
23403
23393
  if (!nextContent && attachedFiles.length > 0) {
23404
23394
  nextContent = default_submit_message || "";
23405
23395
  }
23396
+ if (systemContext && !systemContextSentRef.current) {
23397
+ systemContextSentRef.current = true;
23398
+ nextContent = `${systemContext}
23399
+ ${nextContent}`;
23400
+ }
23406
23401
  const files = attachedFiles.map(
23407
23402
  (file) => isArchiveFile(file) ? {
23408
23403
  name: file.response.zipFileName || file.response.rarFileName,
@@ -23471,7 +23466,7 @@ var Chating = ({
23471
23466
  return true;
23472
23467
  };
23473
23468
  const senderHeader = /* @__PURE__ */ jsx91(
23474
- Sender2.Header,
23469
+ Sender.Header,
23475
23470
  {
23476
23471
  title: "Attachments",
23477
23472
  open: headerOpen,
@@ -23514,13 +23509,13 @@ var Chating = ({
23514
23509
  )
23515
23510
  }
23516
23511
  );
23517
- const showDatabaseSlot = config.enableDatabaseSlot;
23518
- const showSkillSlot = config.enableSkillSlot;
23519
- const showAgentSlot = config.enableAgentSlot;
23520
- const showMetricsDataSourceSlot = config.enableMetricsDataSourceSlot;
23512
+ const effectiveShowDatabaseSlot = showDatabaseSlot !== void 0 ? showDatabaseSlot : config.enableDatabaseSlot;
23513
+ const effectiveShowSkillSlot = showSkillSlot !== void 0 ? showSkillSlot : config.enableSkillSlot;
23514
+ const effectiveShowAgentSlot = showAgentSlot !== void 0 ? showAgentSlot : config.enableAgentSlot;
23515
+ const effectiveShowMetricsDataSourceSlot = showMetricsDataSourceSlot !== void 0 ? showMetricsDataSourceSlot : config.enableMetricsDataSourceSlot;
23521
23516
  const shouldShowModelSelector = showModelSelector !== void 0 ? showModelSelector : config.enableModelSelector;
23522
23517
  const senderFooter = (actionNode) => {
23523
- const hasSlotButtons = showAgentSlot || showDatabaseSlot || showSkillSlot || showMetricsDataSourceSlot;
23518
+ const hasSlotButtons = effectiveShowAgentSlot || effectiveShowDatabaseSlot || effectiveShowSkillSlot || effectiveShowMetricsDataSourceSlot;
23524
23519
  return /* @__PURE__ */ jsxs63(Flex5, { justify: "space-between", align: "center", style: { padding: "8px 0" }, children: [
23525
23520
  /* @__PURE__ */ jsxs63(Flex5, { align: "center", gap: 8, children: [
23526
23521
  /* @__PURE__ */ jsx91(Badge6, { dot: attachedFiles.length > 0 && !headerOpen, children: /* @__PURE__ */ jsx91(
@@ -23533,10 +23528,10 @@ var Chating = ({
23533
23528
  ) }),
23534
23529
  /* @__PURE__ */ jsx91(Divider6, { type: "vertical", style: { margin: 0 } }),
23535
23530
  hasSlotButtons && /* @__PURE__ */ jsxs63(Flex5, { align: "center", gap: 8, children: [
23536
- showAgentSlot && /* @__PURE__ */ jsx91(AgentPicker, { senderRef, iconOnly: true }),
23537
- showDatabaseSlot && /* @__PURE__ */ jsx91(DatabasePicker, { senderRef, iconOnly: true }),
23538
- showSkillSlot && /* @__PURE__ */ jsx91(SkillPicker, { senderRef, iconOnly: true }),
23539
- showMetricsDataSourceSlot && /* @__PURE__ */ jsx91(MetricsDataSourcePicker, { senderRef, iconOnly: true })
23531
+ effectiveShowAgentSlot && /* @__PURE__ */ jsx91(AgentPicker, { senderRef, iconOnly: true }),
23532
+ effectiveShowDatabaseSlot && /* @__PURE__ */ jsx91(DatabasePicker, { senderRef, iconOnly: true }),
23533
+ effectiveShowSkillSlot && /* @__PURE__ */ jsx91(SkillPicker, { senderRef, iconOnly: true }),
23534
+ effectiveShowMetricsDataSourceSlot && /* @__PURE__ */ jsx91(MetricsDataSourcePicker, { senderRef, iconOnly: true })
23540
23535
  ] })
23541
23536
  ] }),
23542
23537
  /* @__PURE__ */ jsxs63(Flex5, { align: "center", gap: 8, children: [
@@ -23568,8 +23563,8 @@ var Chating = ({
23568
23563
  ...showRefreshButton ? [refreshButton] : [],
23569
23564
  /* @__PURE__ */ jsx91(ThreadManagementButtons, {}, "thread-buttons")
23570
23565
  ];
23571
- const [skills, setSkills] = useState66([]);
23572
- const [skillsLoading, setSkillsLoading] = useState66(false);
23566
+ const [skills, setSkills] = useState65([]);
23567
+ const [skillsLoading, setSkillsLoading] = useState65(false);
23573
23568
  const { get: apiGet } = useApi();
23574
23569
  const loadSkills = async () => {
23575
23570
  if (skills.length > 0) return;
@@ -23593,7 +23588,7 @@ var Chating = ({
23593
23588
  return isEmpty ? "Type / to see available skills, or @ to reference files" : void 0;
23594
23589
  };
23595
23590
  const renderSender = (isEmpty) => {
23596
- const [suggestionMode, setSuggestionMode] = useState66(null);
23591
+ const [suggestionMode, setSuggestionMode] = useState65(null);
23597
23592
  const suggestionItems = suggestionMode === "skills" ? skills.map((skill) => ({
23598
23593
  value: skill.name,
23599
23594
  icon: /* @__PURE__ */ jsx91(BrainCircuit3, { size: 14, style: { color: "#722ed1" } }),
@@ -23637,7 +23632,7 @@ var Chating = ({
23637
23632
  }
23638
23633
  },
23639
23634
  children: ({ onTrigger, onKeyDown }) => /* @__PURE__ */ jsx91(
23640
- Sender2,
23635
+ Sender,
23641
23636
  {
23642
23637
  slotConfig,
23643
23638
  disabled: isInputDisabled,
@@ -23972,16 +23967,16 @@ var InternetSearchCard = ({
23972
23967
  };
23973
23968
 
23974
23969
  // src/components/GenUI/elements/schedule_viewer.tsx
23975
- import { useState as useState67, useEffect as useEffect47, useCallback as useCallback35 } from "react";
23970
+ import { useState as useState66, useEffect as useEffect46, useCallback as useCallback34 } from "react";
23976
23971
  import {
23977
23972
  Tag as Tag22,
23978
23973
  Button as Button48,
23979
23974
  Empty as Empty16,
23980
- Spin as Spin18,
23975
+ Spin as Spin17,
23981
23976
  Typography as Typography45,
23982
23977
  Space as Space32,
23983
23978
  Tooltip as Tooltip18,
23984
- Popconfirm as Popconfirm8,
23979
+ Popconfirm as Popconfirm10,
23985
23980
  message as message16,
23986
23981
  Card as Card23
23987
23982
  } from "antd";
@@ -24136,10 +24131,10 @@ var ScheduleViewer = ({ data }) => {
24136
24131
  const { styles } = useStyles8();
24137
24132
  const { threadId, assistantId, tasks: initialTasks, onRefresh } = data ?? {};
24138
24133
  const client = useClient(assistantId || "");
24139
- const [tasks, setTasks] = useState67(initialTasks || []);
24140
- const [loading, setLoading] = useState67(false);
24141
- const [actionLoading, setActionLoading] = useState67(null);
24142
- const handleRefresh = useCallback35(async () => {
24134
+ const [tasks, setTasks] = useState66(initialTasks || []);
24135
+ const [loading, setLoading] = useState66(false);
24136
+ const [actionLoading, setActionLoading] = useState66(null);
24137
+ const handleRefresh = useCallback34(async () => {
24143
24138
  if (!threadId) return;
24144
24139
  setLoading(true);
24145
24140
  try {
@@ -24153,7 +24148,7 @@ var ScheduleViewer = ({ data }) => {
24153
24148
  setLoading(false);
24154
24149
  }
24155
24150
  }, [client, threadId, onRefresh]);
24156
- const handleCancel = useCallback35(
24151
+ const handleCancel = useCallback34(
24157
24152
  async (taskId) => {
24158
24153
  setActionLoading(taskId);
24159
24154
  try {
@@ -24169,7 +24164,7 @@ var ScheduleViewer = ({ data }) => {
24169
24164
  },
24170
24165
  [client, handleRefresh]
24171
24166
  );
24172
- const handlePause = useCallback35(
24167
+ const handlePause = useCallback34(
24173
24168
  async (taskId) => {
24174
24169
  setActionLoading(taskId);
24175
24170
  try {
@@ -24185,7 +24180,7 @@ var ScheduleViewer = ({ data }) => {
24185
24180
  },
24186
24181
  [client, handleRefresh]
24187
24182
  );
24188
- const handleResume = useCallback35(
24183
+ const handleResume = useCallback34(
24189
24184
  async (taskId) => {
24190
24185
  setActionLoading(taskId);
24191
24186
  try {
@@ -24201,12 +24196,12 @@ var ScheduleViewer = ({ data }) => {
24201
24196
  },
24202
24197
  [client, handleRefresh]
24203
24198
  );
24204
- useEffect47(() => {
24199
+ useEffect46(() => {
24205
24200
  if (threadId && (!initialTasks || initialTasks.length === 0)) {
24206
24201
  handleRefresh();
24207
24202
  }
24208
24203
  }, [threadId]);
24209
- useEffect47(() => {
24204
+ useEffect46(() => {
24210
24205
  if (initialTasks) {
24211
24206
  setTasks(initialTasks);
24212
24207
  }
@@ -24238,7 +24233,7 @@ var ScheduleViewer = ({ data }) => {
24238
24233
  }
24239
24234
  ) }),
24240
24235
  (isPending || isPaused) && /* @__PURE__ */ jsx94(
24241
- Popconfirm8,
24236
+ Popconfirm10,
24242
24237
  {
24243
24238
  title: "Cancel this scheduled task?",
24244
24239
  description: "This action cannot be undone.",
@@ -24332,7 +24327,7 @@ var ScheduleViewer = ({ data }) => {
24332
24327
  ) })
24333
24328
  ] }),
24334
24329
  loading && tasks.length === 0 ? /* @__PURE__ */ jsxs65("div", { className: styles.emptyContainer, children: [
24335
- /* @__PURE__ */ jsx94(Spin18, { size: "large" }),
24330
+ /* @__PURE__ */ jsx94(Spin17, { size: "large" }),
24336
24331
  /* @__PURE__ */ jsx94(Text35, { type: "secondary", style: { marginTop: 16 }, children: "Loading scheduled tasks..." })
24337
24332
  ] }) : tasks.length === 0 ? /* @__PURE__ */ jsx94("div", { className: styles.emptyContainer, children: /* @__PURE__ */ jsx94(
24338
24333
  Empty16,
@@ -24674,13 +24669,13 @@ var TeamGraph = ({ data }) => {
24674
24669
  var TeamGraph_default = TeamGraph;
24675
24670
 
24676
24671
  // src/components/GenUI/elements/TeamWorkspace/index.tsx
24677
- import { useState as useState72, useMemo as useMemo26 } from "react";
24678
- import { Layout, Spin as Spin19, Button as Button52 } from "antd";
24672
+ import { useState as useState71, useMemo as useMemo27 } from "react";
24673
+ import { Layout, Spin as Spin18, Button as Button52 } from "antd";
24679
24674
  import { RefreshCw } from "lucide-react";
24680
24675
  import { createStyles as createStyles33 } from "antd-style";
24681
24676
 
24682
24677
  // src/components/GenUI/elements/TeamWorkspace/TeamWorkspaceMenu.tsx
24683
- import React53, { useState as useState68 } from "react";
24678
+ import React53, { useState as useState67 } from "react";
24684
24679
  import {
24685
24680
  LayoutDashboard,
24686
24681
  Inbox as Inbox2,
@@ -24874,7 +24869,7 @@ var TeamWorkspaceMenu = ({
24874
24869
  onItemClick
24875
24870
  }) => {
24876
24871
  const { styles } = useStyles9();
24877
- const [isExpanded, setIsExpanded] = useState68(false);
24872
+ const [isExpanded, setIsExpanded] = useState67(false);
24878
24873
  const mainItems = items.filter((item) => !item.group);
24879
24874
  const teammateItems = items.filter((item) => item.group === "Teammates");
24880
24875
  const teamItems = items.filter((item) => item.group === "Team");
@@ -24956,13 +24951,13 @@ import {
24956
24951
  import { createStyles as createStyles26 } from "antd-style";
24957
24952
 
24958
24953
  // src/components/GenUI/elements/TeamWorkspace/hooks/useTeamWorkspaceData.ts
24959
- import { useMemo as useMemo22 } from "react";
24954
+ import { useMemo as useMemo23 } from "react";
24960
24955
  function useTeamWorkspaceData(threadId, assistantId) {
24961
24956
  const { agentState, isLoading, error, refresh } = useAgentState(threadId, assistantId, {
24962
24957
  pollingInterval: 5e3,
24963
24958
  autoStart: true
24964
24959
  });
24965
- const data = useMemo22(() => {
24960
+ const data = useMemo23(() => {
24966
24961
  const team = agentState?.values?.team || null;
24967
24962
  const tasks = agentState?.values?.tasks || [];
24968
24963
  const mailbox = agentState?.values?.team_mailbox || [];
@@ -25351,7 +25346,7 @@ var TeamDashboard = ({
25351
25346
  };
25352
25347
 
25353
25348
  // src/components/GenUI/elements/TeamWorkspace/IssuesView.tsx
25354
- import { useState as useState70, useMemo as useMemo23 } from "react";
25349
+ import { useState as useState69, useMemo as useMemo24 } from "react";
25355
25350
  import { Typography as Typography51, Badge as Badge8, Empty as Empty17, Tooltip as Tooltip21 } from "antd";
25356
25351
  import {
25357
25352
  CheckCircle2 as CheckCircle24,
@@ -25366,7 +25361,7 @@ import {
25366
25361
  import { createStyles as createStyles28 } from "antd-style";
25367
25362
 
25368
25363
  // src/components/GenUI/elements/TeamWorkspace/TaskDetailModal.tsx
25369
- import { useState as useState69 } from "react";
25364
+ import { useState as useState68 } from "react";
25370
25365
  import { Modal as Modal18, Typography as Typography50, Tag as Tag24, Divider as Divider7, Tabs as Tabs2, Timeline } from "antd";
25371
25366
  import { createStyles as createStyles27 } from "antd-style";
25372
25367
  import {
@@ -25791,7 +25786,7 @@ var TaskDetailModal = ({
25791
25786
  onClose
25792
25787
  }) => {
25793
25788
  const { styles } = useStyles11();
25794
- const [activeTab, setActiveTab] = useState69("comments");
25789
+ const [activeTab, setActiveTab] = useState68("comments");
25795
25790
  if (!task) return null;
25796
25791
  const statusConfig2 = getStatusConfig2(task.status);
25797
25792
  const tabItems = [
@@ -26217,7 +26212,7 @@ var formatDate2 = (timestamp) => {
26217
26212
  });
26218
26213
  };
26219
26214
  var ListGroupComponent = ({ group, styles, defaultExpanded = true, onTaskClick }) => {
26220
- const [isExpanded, setIsExpanded] = useState70(defaultExpanded);
26215
+ const [isExpanded, setIsExpanded] = useState69(defaultExpanded);
26221
26216
  return /* @__PURE__ */ jsxs72("div", { className: styles.listGroup, children: [
26222
26217
  /* @__PURE__ */ jsxs72(
26223
26218
  "div",
@@ -26260,10 +26255,10 @@ var IssuesView = ({
26260
26255
  teammates
26261
26256
  }) => {
26262
26257
  const { styles } = useStyles12();
26263
- const [viewMode, setViewMode] = useState70("list");
26264
- const [selectedTask, setSelectedTask] = useState70(null);
26265
- const [modalVisible, setModalVisible] = useState70(false);
26266
- const listGroups = useMemo23(() => {
26258
+ const [viewMode, setViewMode] = useState69("list");
26259
+ const [selectedTask, setSelectedTask] = useState69(null);
26260
+ const [modalVisible, setModalVisible] = useState69(false);
26261
+ const listGroups = useMemo24(() => {
26267
26262
  const groups = [
26268
26263
  {
26269
26264
  id: "pending",
@@ -26302,7 +26297,7 @@ var IssuesView = ({
26302
26297
  });
26303
26298
  return groups;
26304
26299
  }, [tasks]);
26305
- const tasksByStatus = useMemo23(() => {
26300
+ const tasksByStatus = useMemo24(() => {
26306
26301
  const grouped = {
26307
26302
  pending: [],
26308
26303
  claimed: [],
@@ -26435,7 +26430,7 @@ var IssuesView = ({
26435
26430
  };
26436
26431
 
26437
26432
  // src/components/GenUI/elements/TeamWorkspace/TeamOrgCanvas.tsx
26438
- import React56, { useMemo as useMemo24 } from "react";
26433
+ import React56, { useMemo as useMemo25 } from "react";
26439
26434
  import {
26440
26435
  ReactFlow as ReactFlow5,
26441
26436
  Background as Background5,
@@ -26601,7 +26596,7 @@ var TeamOrgCanvasInner = ({
26601
26596
  }) => {
26602
26597
  const { styles } = useStyles13();
26603
26598
  const { fitView } = useReactFlow2();
26604
- const taskStatsByTeammate = useMemo24(() => {
26599
+ const taskStatsByTeammate = useMemo25(() => {
26605
26600
  const stats = {};
26606
26601
  teammates.forEach((t) => {
26607
26602
  stats[t.name] = { completed: 0, inProgress: 0, pending: 0 };
@@ -26619,7 +26614,7 @@ var TeamOrgCanvasInner = ({
26619
26614
  });
26620
26615
  return stats;
26621
26616
  }, [teammates, tasks]);
26622
- const { nodes, edges } = useMemo24(() => {
26617
+ const { nodes, edges } = useMemo25(() => {
26623
26618
  const newNodes = [];
26624
26619
  const newEdges = [];
26625
26620
  const teamLeadId = team?.teamLeadId || "team_lead";
@@ -26873,7 +26868,7 @@ var TeamMemberChat = ({
26873
26868
  };
26874
26869
 
26875
26870
  // src/components/GenUI/elements/MailboxPanel.tsx
26876
- import { useState as useState71, useMemo as useMemo25 } from "react";
26871
+ import { useState as useState70, useMemo as useMemo26 } from "react";
26877
26872
  import { Typography as Typography55, Empty as Empty18 } from "antd";
26878
26873
  import { createStyles as createStyles32 } from "antd-style";
26879
26874
  import {
@@ -27296,7 +27291,7 @@ var getMessagePreview = (content) => {
27296
27291
  return firstLine.length > 80 ? firstLine.slice(0, 80) + "..." : firstLine;
27297
27292
  };
27298
27293
  var MessageGroupComponent = ({ group, styles, defaultExpanded = true, onMessageClick }) => {
27299
- const [isExpanded, setIsExpanded] = useState71(defaultExpanded);
27294
+ const [isExpanded, setIsExpanded] = useState70(defaultExpanded);
27300
27295
  return /* @__PURE__ */ jsxs76("div", { className: styles.listGroup, children: [
27301
27296
  /* @__PURE__ */ jsxs76(
27302
27297
  "div",
@@ -27351,10 +27346,10 @@ var MessageGroupComponent = ({ group, styles, defaultExpanded = true, onMessageC
27351
27346
  };
27352
27347
  var MailboxPanel = ({ data }) => {
27353
27348
  const { styles } = useStyles16();
27354
- const [selectedMessage, setSelectedMessage] = useState71(null);
27355
- const [modalVisible, setModalVisible] = useState71(false);
27349
+ const [selectedMessage, setSelectedMessage] = useState70(null);
27350
+ const [modalVisible, setModalVisible] = useState70(false);
27356
27351
  const { teamMailbox = [] } = data || {};
27357
- const messageGroups = useMemo25(() => {
27352
+ const messageGroups = useMemo26(() => {
27358
27353
  const groupsMap = /* @__PURE__ */ new Map();
27359
27354
  teamMailbox.forEach((message23) => {
27360
27355
  const sender = message23.from;
@@ -27482,8 +27477,8 @@ var TeamWorkspace = ({
27482
27477
  isLoading,
27483
27478
  refresh
27484
27479
  } = useTeamWorkspaceData(parent_thread_id || null, assistantId);
27485
- const [activeMenuId, setActiveMenuId] = useState72("dashboard");
27486
- const menuItems = useMemo26(() => {
27480
+ const [activeMenuId, setActiveMenuId] = useState71("dashboard");
27481
+ const menuItems = useMemo27(() => {
27487
27482
  const items = [
27488
27483
  {
27489
27484
  id: "dashboard",
@@ -27525,7 +27520,7 @@ var TeamWorkspace = ({
27525
27520
  };
27526
27521
  const renderContent = () => {
27527
27522
  if (isLoading) {
27528
- return /* @__PURE__ */ jsx106("div", { className: styles.loadingContainer, children: /* @__PURE__ */ jsx106(Spin19, { size: "large" }) });
27523
+ return /* @__PURE__ */ jsx106("div", { className: styles.loadingContainer, children: /* @__PURE__ */ jsx106(Spin18, { size: "large" }) });
27529
27524
  }
27530
27525
  const activeItem = menuItems.find((item) => item.id === activeMenuId);
27531
27526
  switch (activeItem?.type) {
@@ -27620,7 +27615,7 @@ var TeamWorkspace = ({
27620
27615
  };
27621
27616
 
27622
27617
  // src/components/GenUI/elements/TaskBoard.tsx
27623
- import { useMemo as useMemo27 } from "react";
27618
+ import { useMemo as useMemo28 } from "react";
27624
27619
 
27625
27620
  // src/components/GenUI/elements/TaskBoardCard.tsx
27626
27621
  import { jsx as jsx107, jsxs as jsxs78 } from "react/jsx-runtime";
@@ -27899,7 +27894,7 @@ var TaskBoard = ({
27899
27894
  const { tasks: contextTasks } = useAgentChat();
27900
27895
  const { tasks: propTasks, onAddTask, teammates } = data || {};
27901
27896
  const tasks = contextTasks || propTasks || [];
27902
- const tasksByStatus = useMemo27(() => {
27897
+ const tasksByStatus = useMemo28(() => {
27903
27898
  const grouped = {
27904
27899
  pending: [],
27905
27900
  in_progress: [],
@@ -27965,7 +27960,7 @@ var TaskBoard = ({
27965
27960
  };
27966
27961
 
27967
27962
  // src/components/GenUI/elements/Mailbox.tsx
27968
- import { useState as useState73, useMemo as useMemo28, useRef as useRef25, useEffect as useEffect48 } from "react";
27963
+ import { useState as useState72, useMemo as useMemo29, useRef as useRef24, useEffect as useEffect47 } from "react";
27969
27964
  import { jsx as jsx109, jsxs as jsxs80 } from "react/jsx-runtime";
27970
27965
  var useStyle16 = () => {
27971
27966
  return {
@@ -28251,17 +28246,17 @@ var renderMessageWithMentions = (content, mentions, styles) => {
28251
28246
  var TeamChat = ({ data }) => {
28252
28247
  const styles = useStyle16();
28253
28248
  const { teamName, currentUser, teammates, messages, onSendMessage } = data || {};
28254
- const [inputValue, setInputValue] = useState73("");
28255
- const messagesEndRef = useRef25(null);
28256
- const sortedMessages = useMemo28(() => {
28249
+ const [inputValue, setInputValue] = useState72("");
28250
+ const messagesEndRef = useRef24(null);
28251
+ const sortedMessages = useMemo29(() => {
28257
28252
  return [...messages || []].sort(
28258
28253
  (a, b) => new Date(a.timestamp).getTime() - new Date(b.timestamp).getTime()
28259
28254
  );
28260
28255
  }, [messages]);
28261
- const mentions = useMemo28(() => {
28256
+ const mentions = useMemo29(() => {
28262
28257
  return teammates?.map((t) => t.name) || [];
28263
28258
  }, [teammates]);
28264
- useEffect48(() => {
28259
+ useEffect47(() => {
28265
28260
  messagesEndRef.current?.scrollIntoView({ behavior: "smooth" });
28266
28261
  }, [sortedMessages]);
28267
28262
  const handleSend = () => {
@@ -28430,12 +28425,12 @@ var TeamChat = ({ data }) => {
28430
28425
  };
28431
28426
 
28432
28427
  // src/components/GenUI/elements/ShowWidget.tsx
28433
- import { useCallback as useCallback37 } from "react";
28428
+ import { useCallback as useCallback36 } from "react";
28434
28429
  import { Button as Button53, Typography as Typography56 } from "antd";
28435
28430
  import { ExpandOutlined as ExpandOutlined2 } from "@ant-design/icons";
28436
28431
 
28437
28432
  // src/streaming-html/StreamingHTMLRenderer.tsx
28438
- import React61, { useEffect as useEffect49, useRef as useRef26, useCallback as useCallback36, useState as useState74 } from "react";
28433
+ import React61, { useEffect as useEffect48, useRef as useRef25, useCallback as useCallback35, useState as useState73 } from "react";
28439
28434
 
28440
28435
  // src/streaming-html/show-widget-css-generator.ts
28441
28436
  function generateShowWidgetCSS(tokens) {
@@ -29126,22 +29121,22 @@ var StreamingHTMLRenderer = ({
29126
29121
  title,
29127
29122
  loadingMessages
29128
29123
  }) => {
29129
- const iframeRef = useRef26(null);
29130
- const containerRef = useRef26(null);
29131
- const resizeObserverRef = useRef26(null);
29132
- const prevHTMLRef = useRef26("");
29133
- const isReadyRef = useRef26(false);
29134
- const pendingChunksRef = useRef26([]);
29135
- const isCompleteRef = useRef26(isComplete);
29136
- const isScriptExecuted = useRef26(false);
29124
+ const iframeRef = useRef25(null);
29125
+ const containerRef = useRef25(null);
29126
+ const resizeObserverRef = useRef25(null);
29127
+ const prevHTMLRef = useRef25("");
29128
+ const isReadyRef = useRef25(false);
29129
+ const pendingChunksRef = useRef25([]);
29130
+ const isCompleteRef = useRef25(isComplete);
29131
+ const isScriptExecuted = useRef25(false);
29137
29132
  const [iframeHeight, setIframeHeight] = React61.useState(0);
29138
29133
  const [iframeWidth, setIframeWidth] = React61.useState(void 0);
29139
- const [currentMessageIndex, setCurrentMessageIndex] = useState74(0);
29140
- const [showLoading, setShowLoading] = useState74(true);
29141
- useEffect49(() => {
29134
+ const [currentMessageIndex, setCurrentMessageIndex] = useState73(0);
29135
+ const [showLoading, setShowLoading] = useState73(true);
29136
+ useEffect48(() => {
29142
29137
  isCompleteRef.current = isComplete;
29143
29138
  }, [isComplete]);
29144
- useEffect49(() => {
29139
+ useEffect48(() => {
29145
29140
  if (iframeHeight > 0) {
29146
29141
  setShowLoading(false);
29147
29142
  return;
@@ -29166,7 +29161,7 @@ var StreamingHTMLRenderer = ({
29166
29161
  }, 1500);
29167
29162
  return () => clearInterval(interval);
29168
29163
  }, [iframeHeight, loadingMessages]);
29169
- const executeScripts = useCallback36(() => {
29164
+ const executeScripts = useCallback35(() => {
29170
29165
  if (isScriptExecuted.current) {
29171
29166
  console.log("[StreamingHTMLRenderer] scripts is executed");
29172
29167
  return;
@@ -29193,7 +29188,7 @@ var StreamingHTMLRenderer = ({
29193
29188
  onError?.(streamingError);
29194
29189
  }
29195
29190
  }, [onError]);
29196
- const sendChunk = useCallback36((chunk) => {
29191
+ const sendChunk = useCallback35((chunk) => {
29197
29192
  const iframe = iframeRef.current;
29198
29193
  if (!iframe || !iframe.contentWindow) {
29199
29194
  return;
@@ -29217,7 +29212,7 @@ var StreamingHTMLRenderer = ({
29217
29212
  onError?.(streamingError);
29218
29213
  }
29219
29214
  }, [onError]);
29220
- useEffect49(() => {
29215
+ useEffect48(() => {
29221
29216
  const handleMessage = (event) => {
29222
29217
  const iframe = iframeRef.current;
29223
29218
  if (!iframe || event.source !== iframe.contentWindow) {
@@ -29270,7 +29265,7 @@ var StreamingHTMLRenderer = ({
29270
29265
  window.removeEventListener("message", handleMessage);
29271
29266
  };
29272
29267
  }, [onError, onPrompt, sendChunk, executeScripts]);
29273
- useEffect49(() => {
29268
+ useEffect48(() => {
29274
29269
  if (html === prevHTMLRef.current) {
29275
29270
  return;
29276
29271
  }
@@ -29281,12 +29276,12 @@ var StreamingHTMLRenderer = ({
29281
29276
  sendChunk(newChunk);
29282
29277
  }
29283
29278
  }, [html, sendChunk]);
29284
- useEffect49(() => {
29279
+ useEffect48(() => {
29285
29280
  if (isComplete && isReadyRef.current) {
29286
29281
  executeScripts();
29287
29282
  }
29288
29283
  }, [isComplete, executeScripts]);
29289
- useEffect49(() => {
29284
+ useEffect48(() => {
29290
29285
  const container = containerRef.current;
29291
29286
  if (!container) return;
29292
29287
  const antBubble = container.closest(".ant-bubble");
@@ -29312,7 +29307,7 @@ var StreamingHTMLRenderer = ({
29312
29307
  resizeObserverRef.current = null;
29313
29308
  };
29314
29309
  }, []);
29315
- useEffect49(() => {
29310
+ useEffect48(() => {
29316
29311
  return () => {
29317
29312
  isReadyRef.current = false;
29318
29313
  pendingChunksRef.current = [];
@@ -29415,14 +29410,14 @@ var ShowWidget = ({
29415
29410
  console.warn("Failed to parse tool response:", e);
29416
29411
  }
29417
29412
  }
29418
- const sendPrompt = useCallback37((text) => {
29413
+ const sendPrompt = useCallback36((text) => {
29419
29414
  sendMessage({
29420
29415
  input: {
29421
29416
  message: text
29422
29417
  }
29423
29418
  });
29424
29419
  }, [sendMessage]);
29425
- const handleOpenInSideApp = useCallback37(() => {
29420
+ const handleOpenInSideApp = useCallback36(() => {
29426
29421
  openSideApp({
29427
29422
  component_key: "show_widget",
29428
29423
  data: {
@@ -29491,14 +29486,14 @@ var ShowWidget = ({
29491
29486
  };
29492
29487
 
29493
29488
  // src/components/GenUI/elements/ShowWidgetApp.tsx
29494
- import { useCallback as useCallback38 } from "react";
29489
+ import { useCallback as useCallback37 } from "react";
29495
29490
  import { jsx as jsx112 } from "react/jsx-runtime";
29496
29491
  var ShowWidgetApp = ({
29497
29492
  data
29498
29493
  }) => {
29499
29494
  const { widget_code, title } = data || {};
29500
29495
  const { sendMessage } = useAgentChat();
29501
- const sendPrompt = useCallback38(
29496
+ const sendPrompt = useCallback37(
29502
29497
  (text) => {
29503
29498
  sendMessage({
29504
29499
  input: {
@@ -29625,7 +29620,7 @@ var regsiterElement = (language, ElementMeta) => {
29625
29620
  // src/components/Chat/SideAppViewBrowser.tsx
29626
29621
  import { Dropdown as Dropdown3, Tooltip as Tooltip23 } from "antd";
29627
29622
  import { createStyles as createStyles34 } from "antd-style";
29628
- import { useEffect as useEffect50, useState as useState75 } from "react";
29623
+ import { useEffect as useEffect49, useState as useState74 } from "react";
29629
29624
  import { Fragment as Fragment21, jsx as jsx113, jsxs as jsxs83 } from "react/jsx-runtime";
29630
29625
  var useStyle17 = createStyles34(({ token, css }) => {
29631
29626
  return {
@@ -29823,11 +29818,11 @@ var SideAppViewBrowser = ({ region = "side" }) => {
29823
29818
  } = useChatUIContext();
29824
29819
  const selectedCard = region === "side" ? sideAppSelectedCard : contextAppSelectedCard;
29825
29820
  const closeApp = region === "side" ? closeSideApp : closeContentApp;
29826
- const [activeKey, setActiveKey] = useState75(
29821
+ const [activeKey, setActiveKey] = useState74(
29827
29822
  JSON.stringify(selectedCard)
29828
29823
  );
29829
- const [hoveredTab, setHoveredTab] = useState75(null);
29830
- const [items, setItems] = useState75([]);
29824
+ const [hoveredTab, setHoveredTab] = useState74(null);
29825
+ const [items, setItems] = useState74([]);
29831
29826
  const add = (key, label, children, componentKey) => {
29832
29827
  const newPanes = [...items, { label, children, key, componentKey }];
29833
29828
  setItems(newPanes);
@@ -29854,7 +29849,7 @@ var SideAppViewBrowser = ({ region = "side" }) => {
29854
29849
  const switchTab = (key) => {
29855
29850
  setActiveKey(key);
29856
29851
  };
29857
- useEffect50(() => {
29852
+ useEffect49(() => {
29858
29853
  if (!selectedCard) return;
29859
29854
  const key = JSON.stringify(selectedCard);
29860
29855
  if (items.find((item) => item.key === key)) {
@@ -29959,7 +29954,7 @@ var SideAppViewBrowser = ({ region = "side" }) => {
29959
29954
  };
29960
29955
 
29961
29956
  // src/components/Chat/ProjectSelector.tsx
29962
- import { useState as useState76, useCallback as useCallback39, useMemo as useMemo29, useRef as useRef27 } from "react";
29957
+ import { useState as useState75, useCallback as useCallback38, useMemo as useMemo30, useRef as useRef26 } from "react";
29963
29958
  import { Modal as Modal20, Input as Input15, Button as Button54, message as message18 } from "antd";
29964
29959
  import { createStyles as createStyles35 } from "antd-style";
29965
29960
  import { Folder, ChevronDown as ChevronDown6, Building2 as Building24 } from "lucide-react";
@@ -30195,34 +30190,34 @@ var ProjectSelector = ({
30195
30190
  setProject,
30196
30191
  createProject
30197
30192
  } = useWorkspaceContext();
30198
- const [isWorkspaceListOpen, setIsWorkspaceListOpen] = useState76(false);
30199
- const workspaceDropdownRef = useRef27(null);
30200
- const [isProjectListOpen, setIsProjectListOpen] = useState76(false);
30201
- const [isModalOpen, setIsModalOpen] = useState76(false);
30202
- const [projectName, setProjectName] = useState76("");
30203
- const [validationError, setValidationError] = useState76(null);
30204
- const [isCreating, setIsCreating] = useState76(false);
30205
- const projectNameInputRef = useRef27(null);
30206
- const currentProject = useMemo29(() => {
30193
+ const [isWorkspaceListOpen, setIsWorkspaceListOpen] = useState75(false);
30194
+ const workspaceDropdownRef = useRef26(null);
30195
+ const [isProjectListOpen, setIsProjectListOpen] = useState75(false);
30196
+ const [isModalOpen, setIsModalOpen] = useState75(false);
30197
+ const [projectName, setProjectName] = useState75("");
30198
+ const [validationError, setValidationError] = useState75(null);
30199
+ const [isCreating, setIsCreating] = useState75(false);
30200
+ const projectNameInputRef = useRef26(null);
30201
+ const currentProject = useMemo30(() => {
30207
30202
  return projects.find((p) => p.id === projectId);
30208
30203
  }, [projects, projectId]);
30209
- const currentWorkspace = useMemo29(() => {
30204
+ const currentWorkspace = useMemo30(() => {
30210
30205
  return workspaces.find((w) => w.id === workspaceId);
30211
30206
  }, [workspaces, workspaceId]);
30212
- const handleSelectProject = useCallback39((selectedProjectId) => {
30207
+ const handleSelectProject = useCallback38((selectedProjectId) => {
30213
30208
  setProject(selectedProjectId);
30214
30209
  setIsProjectListOpen(false);
30215
30210
  }, [setProject]);
30216
- const handleWorkspaceClick = useCallback39(() => {
30211
+ const handleWorkspaceClick = useCallback38(() => {
30217
30212
  setProject(null);
30218
30213
  }, [setProject]);
30219
- const toggleProjectList = useCallback39(() => {
30214
+ const toggleProjectList = useCallback38(() => {
30220
30215
  setIsProjectListOpen((prev) => !prev);
30221
30216
  }, []);
30222
- const toggleWorkspaceList = useCallback39(() => {
30217
+ const toggleWorkspaceList = useCallback38(() => {
30223
30218
  setIsWorkspaceListOpen((prev) => !prev);
30224
30219
  }, []);
30225
- const validateProjectName = useCallback39((name) => {
30220
+ const validateProjectName = useCallback38((name) => {
30226
30221
  const trimmed = name.trim();
30227
30222
  if (!trimmed) return "Project name is required";
30228
30223
  if (trimmed.length > PROJECT_NAME_MAX_LENGTH) {
@@ -30230,7 +30225,7 @@ var ProjectSelector = ({
30230
30225
  }
30231
30226
  return null;
30232
30227
  }, []);
30233
- const handleOpenModal = useCallback39((e) => {
30228
+ const handleOpenModal = useCallback38((e) => {
30234
30229
  e.stopPropagation();
30235
30230
  if (!workspaceId) {
30236
30231
  message18.warning("Please select a workspace first");
@@ -30241,7 +30236,7 @@ var ProjectSelector = ({
30241
30236
  setIsModalOpen(true);
30242
30237
  setTimeout(() => projectNameInputRef.current?.input?.focus(), 100);
30243
30238
  }, [workspaceId]);
30244
- const handleCloseModal = useCallback39(() => {
30239
+ const handleCloseModal = useCallback38(() => {
30245
30240
  setIsModalOpen(false);
30246
30241
  setProjectName("");
30247
30242
  setValidationError(null);
@@ -30251,7 +30246,7 @@ var ProjectSelector = ({
30251
30246
  setProjectName(value);
30252
30247
  setValidationError(validateProjectName(value));
30253
30248
  };
30254
- const handleCreateProject = useCallback39(async () => {
30249
+ const handleCreateProject = useCallback38(async () => {
30255
30250
  if (!workspaceId) return;
30256
30251
  const trimmed = projectName.trim();
30257
30252
  const error = validateProjectName(trimmed);
@@ -30370,12 +30365,12 @@ var ProjectSelector = ({
30370
30365
  };
30371
30366
 
30372
30367
  // src/components/Chat/ToolPanelFiles.tsx
30373
- import { useCallback as useCallback40, useEffect as useEffect51, useMemo as useMemo30, useState as useState77 } from "react";
30368
+ import { useCallback as useCallback39, useEffect as useEffect50, useMemo as useMemo31, useState as useState76 } from "react";
30374
30369
  import { message as message19 } from "antd";
30375
30370
 
30376
30371
  // src/components/Chat/FileDirectoryPanel.tsx
30377
30372
  import React66 from "react";
30378
- import { Spin as Spin20 } from "antd";
30373
+ import { Spin as Spin19 } from "antd";
30379
30374
  import { ChevronRight as ChevronRight8, FolderOpen as FolderOpen3, Upload } from "lucide-react";
30380
30375
  import { createStyles as createStyles36 } from "antd-style";
30381
30376
  import { Fragment as Fragment23, jsx as jsx115, jsxs as jsxs85 } from "react/jsx-runtime";
@@ -30640,7 +30635,7 @@ var FileDirectoryPanel = ({
30640
30635
  }
30641
30636
  )
30642
30637
  ] }),
30643
- isExpanded ? isLoading ? /* @__PURE__ */ jsx115("div", { className: styles.loading, children: /* @__PURE__ */ jsx115(Spin20, { size: "small" }) }) : children.length > 0 ? children.map((child) => renderEntry(child, depth + 1)) : /* @__PURE__ */ jsx115("div", { className: styles.emptyState, children: "No files in this folder" }) : null
30638
+ isExpanded ? isLoading ? /* @__PURE__ */ jsx115("div", { className: styles.loading, children: /* @__PURE__ */ jsx115(Spin19, { size: "small" }) }) : children.length > 0 ? children.map((child) => renderEntry(child, depth + 1)) : /* @__PURE__ */ jsx115("div", { className: styles.emptyState, children: "No files in this folder" }) : null
30644
30639
  ] }, entry.path);
30645
30640
  }
30646
30641
  return /* @__PURE__ */ jsxs85("div", { className: styles.treeRow, children: [
@@ -30690,7 +30685,7 @@ var FileDirectoryPanel = ({
30690
30685
  ),
30691
30686
  /* @__PURE__ */ jsx115("span", { className: styles.badge, children: itemCount })
30692
30687
  ] }),
30693
- isLoading ? /* @__PURE__ */ jsx115("div", { className: styles.loading, children: /* @__PURE__ */ jsx115(Spin20, { size: "small" }) }) : /* @__PURE__ */ jsxs85("div", { className: styles.assetList, children: [
30688
+ isLoading ? /* @__PURE__ */ jsx115("div", { className: styles.loading, children: /* @__PURE__ */ jsx115(Spin19, { size: "small" }) }) : /* @__PURE__ */ jsxs85("div", { className: styles.assetList, children: [
30694
30689
  entries.map((entry) => renderEntry(entry, 0)),
30695
30690
  entries.length === 0 ? /* @__PURE__ */ jsx115("div", { className: styles.emptyState, children: "No files in this folder" }) : null,
30696
30691
  folder.allowUpload ? /* @__PURE__ */ jsx115(
@@ -30701,7 +30696,7 @@ var FileDirectoryPanel = ({
30701
30696
  onClick: () => void onUploadFolder(folder.name),
30702
30697
  disabled: !workspaceId || !projectId || uploadingFolder === folder.name,
30703
30698
  children: uploadingFolder === folder.name ? /* @__PURE__ */ jsxs85(Fragment23, { children: [
30704
- /* @__PURE__ */ jsx115(Spin20, { size: "small" }),
30699
+ /* @__PURE__ */ jsx115(Spin19, { size: "small" }),
30705
30700
  /* @__PURE__ */ jsx115("span", { children: "Uploading..." })
30706
30701
  ] }) : /* @__PURE__ */ jsxs85(Fragment23, { children: [
30707
30702
  /* @__PURE__ */ jsx115(Upload, { size: 14 }),
@@ -30729,16 +30724,16 @@ var ToolPanelFiles = () => {
30729
30724
  uploadFileToFolder
30730
30725
  } = useWorkspaceContext();
30731
30726
  const { currentAssistant } = useAssistantContext();
30732
- const [folderEntries, setFolderEntries] = useState77({});
30733
- const [folderLoading, setFolderLoading] = useState77({});
30734
- const [directoryChildren, setDirectoryChildren] = useState77({});
30735
- const [directoryLoading, setDirectoryLoading] = useState77({});
30736
- const [directoryExpanded, setDirectoryExpanded] = useState77({});
30737
- const [uploadingFolder, setUploadingFolder] = useState77(null);
30738
- const resourceFolders = useMemo30(() => {
30727
+ const [folderEntries, setFolderEntries] = useState76({});
30728
+ const [folderLoading, setFolderLoading] = useState76({});
30729
+ const [directoryChildren, setDirectoryChildren] = useState76({});
30730
+ const [directoryLoading, setDirectoryLoading] = useState76({});
30731
+ const [directoryExpanded, setDirectoryExpanded] = useState76({});
30732
+ const [uploadingFolder, setUploadingFolder] = useState76(null);
30733
+ const resourceFolders = useMemo31(() => {
30739
30734
  return config.resourceFolders && config.resourceFolders.length > 0 ? config.resourceFolders : [{ name: "/", displayName: "Project Assets", allowUpload: true }];
30740
30735
  }, [config.resourceFolders]);
30741
- const loadAssetsForFolder = useCallback40(
30736
+ const loadAssetsForFolder = useCallback39(
30742
30737
  async (folder, clearSubdirectoryCache = true) => {
30743
30738
  if (!workspaceId || !projectId) {
30744
30739
  setFolderEntries((prev) => ({ ...prev, [folder.name]: [] }));
@@ -30778,7 +30773,7 @@ var ToolPanelFiles = () => {
30778
30773
  },
30779
30774
  [workspaceId, projectId, listPathByFolder, currentAssistant?.id]
30780
30775
  );
30781
- const handleToggleDirectory = useCallback40(async (path) => {
30776
+ const handleToggleDirectory = useCallback39(async (path) => {
30782
30777
  const isExpanded = directoryExpanded[path] || false;
30783
30778
  if (isExpanded) {
30784
30779
  setDirectoryExpanded((prev) => ({ ...prev, [path]: false }));
@@ -30796,12 +30791,12 @@ var ToolPanelFiles = () => {
30796
30791
  setDirectoryLoading((prev) => ({ ...prev, [path]: false }));
30797
30792
  }
30798
30793
  }, [directoryExpanded, listPath, currentAssistant?.id]);
30799
- useEffect51(() => {
30794
+ useEffect50(() => {
30800
30795
  resourceFolders.forEach((folder) => {
30801
30796
  void loadAssetsForFolder(folder, false);
30802
30797
  });
30803
30798
  }, [resourceFolders, loadAssetsForFolder]);
30804
- const handleAssetClick = useCallback40((asset) => {
30799
+ const handleAssetClick = useCallback39((asset) => {
30805
30800
  const fileUrl = getFileViewUrl(asset.path, currentAssistant?.id);
30806
30801
  if (!fileUrl) {
30807
30802
  message19.warning("Please select a workspace and project first.");
@@ -30817,7 +30812,7 @@ var ToolPanelFiles = () => {
30817
30812
  message: `Preview: ${asset.name || asset.path}`
30818
30813
  });
30819
30814
  }, [getFileViewUrl, openSideApp, currentAssistant?.id]);
30820
- const handleUploadFolder = useCallback40(async (folderName) => {
30815
+ const handleUploadFolder = useCallback39(async (folderName) => {
30821
30816
  if (!workspaceId || !projectId) {
30822
30817
  message19.warning("Please select a workspace and project before uploading.");
30823
30818
  return;
@@ -30997,7 +30992,7 @@ var LatticeChat = (props) => {
30997
30992
  // src/components/Chat/AgentConversations.tsx
30998
30993
  import { Conversations } from "@ant-design/x";
30999
30994
  import { theme as theme16 } from "antd";
31000
- import { useMemo as useMemo31 } from "react";
30995
+ import { useMemo as useMemo32 } from "react";
31001
30996
  import { jsx as jsx119 } from "react/jsx-runtime";
31002
30997
  var AgentConversations = ({
31003
30998
  enableThreadCreation = true,
@@ -31018,7 +31013,7 @@ var AgentConversations = ({
31018
31013
  background: "transparent",
31019
31014
  borderRadius: token.borderRadius
31020
31015
  };
31021
- const threadItems = useMemo31(() => {
31016
+ const threadItems = useMemo32(() => {
31022
31017
  return threads || [];
31023
31018
  }, [threads]);
31024
31019
  const items = threadItems.map((thread2) => ({
@@ -31056,7 +31051,7 @@ var AgentConversations = ({
31056
31051
  import { useContext as useContext11 } from "react";
31057
31052
 
31058
31053
  // src/components/Chat/ChatSidebar.tsx
31059
- import { useState as useState78, useMemo as useMemo32, useCallback as useCallback42 } from "react";
31054
+ import { useState as useState77, useMemo as useMemo33, useCallback as useCallback41 } from "react";
31060
31055
  import { Drawer as Drawer3, Avatar as Avatar14, Popover as Popover3, Button as Button56 } from "antd";
31061
31056
  import {
31062
31057
  History as History2,
@@ -31067,7 +31062,7 @@ import {
31067
31062
  } from "lucide-react";
31068
31063
 
31069
31064
  // src/components/Chat/ThreadHistoryMenuContent.tsx
31070
- import React69, { useCallback as useCallback41 } from "react";
31065
+ import React69, { useCallback as useCallback40 } from "react";
31071
31066
  import { createStyles as createStyles39 } from "antd-style";
31072
31067
  import { MessageSquare as MessageSquare3, Trash2 as Trash28 } from "lucide-react";
31073
31068
  import { message as message20, Modal as Modal21 } from "antd";
@@ -31181,7 +31176,7 @@ var ThreadHistoryMenuContent = () => {
31181
31176
  deleteThread,
31182
31177
  isLoading
31183
31178
  } = useConversationContext();
31184
- const handleDeleteThread = useCallback41(
31179
+ const handleDeleteThread = useCallback40(
31185
31180
  async (e, threadIdToDelete) => {
31186
31181
  e.stopPropagation();
31187
31182
  Modal21.confirm({
@@ -31294,8 +31289,8 @@ var ChatSidebar = ({
31294
31289
  const { sideAppVisible, menuCollapsed, setMenuCollapsed } = useChatUIContext();
31295
31290
  const { user, logout } = useAuth();
31296
31291
  const { createThread } = useConversationContext();
31297
- const [drawerStates, setDrawerStates] = useState78({});
31298
- const [changePasswordOpen, setChangePasswordOpen] = useState78(false);
31292
+ const [drawerStates, setDrawerStates] = useState77({});
31293
+ const [changePasswordOpen, setChangePasswordOpen] = useState77(false);
31299
31294
  const {
31300
31295
  sidebarMode,
31301
31296
  sidebarShowToggle,
@@ -31304,11 +31299,11 @@ var ChatSidebar = ({
31304
31299
  sidebarLogoIcon
31305
31300
  } = config;
31306
31301
  const isExpandedMode = sidebarMode === "expanded";
31307
- const menuItems = useMemo32(() => {
31302
+ const menuItems = useMemo33(() => {
31308
31303
  const items = customMenuItems.length > 0 ? [...customMenuItems] : [...DEFAULT_MENU_ITEMS];
31309
31304
  return items.sort((a, b) => (a.order ?? 0) - (b.order ?? 0));
31310
31305
  }, [customMenuItems]);
31311
- const handleMenuClick = useCallback42(async (item) => {
31306
+ const handleMenuClick = useCallback41(async (item) => {
31312
31307
  if (item.builtin === "settings") {
31313
31308
  setSettingsModalOpen(true);
31314
31309
  onSettingsClick?.();
@@ -31331,17 +31326,17 @@ var ChatSidebar = ({
31331
31326
  }
31332
31327
  }
31333
31328
  }, [onSettingsClick, setSettingsModalOpen, createThread, logout]);
31334
- const handleCloseDrawer = useCallback42((itemId) => {
31329
+ const handleCloseDrawer = useCallback41((itemId) => {
31335
31330
  setDrawerStates((prev) => ({ ...prev, [itemId]: false }));
31336
31331
  }, []);
31337
- const handleNewAnalysis = useCallback42(async () => {
31332
+ const handleNewAnalysis = useCallback41(async () => {
31338
31333
  try {
31339
31334
  await createThread("New Analysis");
31340
31335
  } catch (error) {
31341
31336
  console.error("Failed to create new thread:", error);
31342
31337
  }
31343
31338
  }, [createThread]);
31344
- const renderDrawerContent = useCallback42((item) => {
31339
+ const renderDrawerContent = useCallback41((item) => {
31345
31340
  switch (item.builtin) {
31346
31341
  case "thread-history":
31347
31342
  return /* @__PURE__ */ jsx121(ThreadHistoryMenuContent, {});
@@ -31554,7 +31549,7 @@ var LatticeChatView = (props) => {
31554
31549
  };
31555
31550
 
31556
31551
  // src/components/Chat/SettingsModal.tsx
31557
- import { useState as useState79, useEffect as useEffect52, useRef as useRef28 } from "react";
31552
+ import { useState as useState78, useEffect as useEffect51, useRef as useRef27 } from "react";
31558
31553
  import {
31559
31554
  Modal as Modal22,
31560
31555
  Input as Input16,
@@ -31943,7 +31938,7 @@ var SettingsModal = ({
31943
31938
  }) => {
31944
31939
  const { styles } = useStyles23();
31945
31940
  const { config: shellConfig, updateConfigValue } = useLatticeChatShellContext();
31946
- const [connections, setConnections] = useState79(() => {
31941
+ const [connections, setConnections] = useState78(() => {
31947
31942
  if (typeof window !== "undefined") {
31948
31943
  try {
31949
31944
  const stored = localStorage.getItem("lattice_server_connections");
@@ -31966,21 +31961,21 @@ var SettingsModal = ({
31966
31961
  }
31967
31962
  return [];
31968
31963
  });
31969
- const [serverConfigs, setServerConfigs] = useState79({});
31970
- const connectionsRef = useRef28(connections);
31971
- useEffect52(() => {
31964
+ const [serverConfigs, setServerConfigs] = useState78({});
31965
+ const connectionsRef = useRef27(connections);
31966
+ useEffect51(() => {
31972
31967
  connectionsRef.current = connections;
31973
31968
  }, [connections]);
31974
- const [activeTabKey, setActiveTabKey] = useState79(
31969
+ const [activeTabKey, setActiveTabKey] = useState78(
31975
31970
  connections.length > 0 ? connections[0].id : ""
31976
31971
  );
31977
- const [activeMenu, setActiveMenu] = useState79("environment");
31978
- const [loading, setLoading] = useState79(false);
31979
- const [showAddServerModal, setShowAddServerModal] = useState79(false);
31980
- const [newServerUrl, setNewServerUrl] = useState79("");
31981
- const [newServerName, setNewServerName] = useState79("");
31982
- const [newServerApiKey, setNewServerApiKey] = useState79("");
31983
- const [addingServer, setAddingServer] = useState79(false);
31972
+ const [activeMenu, setActiveMenu] = useState78("environment");
31973
+ const [loading, setLoading] = useState78(false);
31974
+ const [showAddServerModal, setShowAddServerModal] = useState78(false);
31975
+ const [newServerUrl, setNewServerUrl] = useState78("");
31976
+ const [newServerName, setNewServerName] = useState78("");
31977
+ const [newServerApiKey, setNewServerApiKey] = useState78("");
31978
+ const [addingServer, setAddingServer] = useState78(false);
31984
31979
  const saveConnections = (newConnections) => {
31985
31980
  setConnections(newConnections);
31986
31981
  if (typeof window !== "undefined") {
@@ -32170,7 +32165,7 @@ var SettingsModal = ({
32170
32165
  console.error("Failed to load models configuration:", error);
32171
32166
  }
32172
32167
  };
32173
- useEffect52(() => {
32168
+ useEffect51(() => {
32174
32169
  if (open && activeTabKey) {
32175
32170
  initializeServerConfig(activeTabKey);
32176
32171
  const connection = connections.find((c) => c.id === activeTabKey);
@@ -32179,7 +32174,7 @@ var SettingsModal = ({
32179
32174
  }
32180
32175
  }
32181
32176
  }, [open, activeTabKey]);
32182
- useEffect52(() => {
32177
+ useEffect51(() => {
32183
32178
  if (open && activeTabKey) {
32184
32179
  const connection = connections.find((c) => c.id === activeTabKey);
32185
32180
  if (connection?.connected) {
@@ -32959,15 +32954,15 @@ var LatticeChatShell = (props) => {
32959
32954
  };
32960
32955
 
32961
32956
  // src/components/Chat/ChannelInstallationsDrawerContent.tsx
32962
- import { useEffect as useEffect53, useState as useState80 } from "react";
32957
+ import { useEffect as useEffect52, useState as useState79 } from "react";
32963
32958
  import {
32964
32959
  Button as Button58,
32965
32960
  Card as Card30,
32966
32961
  Form as Form9,
32967
32962
  Input as Input17,
32968
32963
  Modal as Modal23,
32969
- Popconfirm as Popconfirm10,
32970
- Spin as Spin21,
32964
+ Popconfirm as Popconfirm12,
32965
+ Spin as Spin20,
32971
32966
  Tag as Tag29,
32972
32967
  Typography as Typography58,
32973
32968
  message as message22
@@ -32977,10 +32972,10 @@ import { jsx as jsx126, jsxs as jsxs91 } from "react/jsx-runtime";
32977
32972
  var { Text: Text47, Title: Title17 } = Typography58;
32978
32973
  var ChannelInstallationsDrawerContent = () => {
32979
32974
  const { get, post, put, del } = useApi();
32980
- const [installations, setInstallations] = useState80([]);
32981
- const [loading, setLoading] = useState80(false);
32982
- const [formModalOpen, setFormModalOpen] = useState80(false);
32983
- const [editingInstallation, setEditingInstallation] = useState80(null);
32975
+ const [installations, setInstallations] = useState79([]);
32976
+ const [loading, setLoading] = useState79(false);
32977
+ const [formModalOpen, setFormModalOpen] = useState79(false);
32978
+ const [editingInstallation, setEditingInstallation] = useState79(null);
32984
32979
  const loadInstallations = async () => {
32985
32980
  setLoading(true);
32986
32981
  try {
@@ -33001,7 +32996,7 @@ var ChannelInstallationsDrawerContent = () => {
33001
32996
  setLoading(false);
33002
32997
  }
33003
32998
  };
33004
- useEffect53(() => {
32999
+ useEffect52(() => {
33005
33000
  loadInstallations();
33006
33001
  }, []);
33007
33002
  const handleDelete = async (installation) => {
@@ -33048,7 +33043,7 @@ var ChannelInstallationsDrawerContent = () => {
33048
33043
  ]
33049
33044
  }
33050
33045
  ) }),
33051
- /* @__PURE__ */ jsx126("div", { style: { flex: 1, overflowY: "auto", padding: 16 }, children: loading ? /* @__PURE__ */ jsx126("div", { style: { display: "flex", justifyContent: "center", padding: 32 }, children: /* @__PURE__ */ jsx126(Spin21, {}) }) : installations.length === 0 ? /* @__PURE__ */ jsxs91(
33046
+ /* @__PURE__ */ jsx126("div", { style: { flex: 1, overflowY: "auto", padding: 16 }, children: loading ? /* @__PURE__ */ jsx126("div", { style: { display: "flex", justifyContent: "center", padding: 32 }, children: /* @__PURE__ */ jsx126(Spin20, {}) }) : installations.length === 0 ? /* @__PURE__ */ jsxs91(
33052
33047
  "div",
33053
33048
  {
33054
33049
  style: {
@@ -33113,7 +33108,7 @@ var ChannelInstallationsDrawerContent = () => {
33113
33108
  }
33114
33109
  ),
33115
33110
  /* @__PURE__ */ jsx126(
33116
- Popconfirm10,
33111
+ Popconfirm12,
33117
33112
  {
33118
33113
  title: "Delete Channel Installation",
33119
33114
  description: `Are you sure you want to delete "${installation.name || installation.id}"?`,
@@ -33149,7 +33144,7 @@ var ChannelInstallationsDrawerContent = () => {
33149
33144
  };
33150
33145
  var LarkChannelInstallationFormModal = ({ installation, open, post, put, onCancel, onSave }) => {
33151
33146
  const [form] = Form9.useForm();
33152
- useEffect53(() => {
33147
+ useEffect52(() => {
33153
33148
  if (installation) {
33154
33149
  const config = installation.config;
33155
33150
  form.setFieldsValue({