@axiom-lattice/react-sdk 2.1.50 → 2.1.51

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
@@ -82,8 +82,8 @@ var AuthProvider = ({
82
82
  onLoginSuccess?.(userData, tenantList || []);
83
83
  return { requiresTenantSelection, hasTenants };
84
84
  } catch (err) {
85
- const message18 = err instanceof Error ? err.message : "Login failed";
86
- setError(message18);
85
+ const message19 = err instanceof Error ? err.message : "Login failed";
86
+ setError(message19);
87
87
  throw err;
88
88
  } finally {
89
89
  setIsLoading(false);
@@ -107,8 +107,8 @@ var AuthProvider = ({
107
107
  }
108
108
  return { message: data.message || "Registration successful!", token: data.data?.token };
109
109
  } catch (err) {
110
- const message18 = err instanceof Error ? err.message : "Registration failed";
111
- setError(message18);
110
+ const message19 = err instanceof Error ? err.message : "Registration failed";
111
+ setError(message19);
112
112
  throw err;
113
113
  } finally {
114
114
  setIsLoading(false);
@@ -155,8 +155,8 @@ var AuthProvider = ({
155
155
  }
156
156
  onTenantSelected?.(tenantData);
157
157
  } catch (err) {
158
- const message18 = err instanceof Error ? err.message : "Failed to select tenant";
159
- setError(message18);
158
+ const message19 = err instanceof Error ? err.message : "Failed to select tenant";
159
+ setError(message19);
160
160
  throw err;
161
161
  } finally {
162
162
  setIsLoading(false);
@@ -195,8 +195,8 @@ var AuthProvider = ({
195
195
  setTenants(tenantList);
196
196
  sessionStorage.setItem("lattice_tenants", JSON.stringify(tenantList));
197
197
  } catch (err) {
198
- const message18 = err instanceof Error ? err.message : "Failed to fetch tenants";
199
- setError(message18);
198
+ const message19 = err instanceof Error ? err.message : "Failed to fetch tenants";
199
+ setError(message19);
200
200
  } finally {
201
201
  setIsLoading(false);
202
202
  }
@@ -226,8 +226,8 @@ var AuthProvider = ({
226
226
  setUser(data);
227
227
  sessionStorage.setItem("lattice_user", JSON.stringify(data));
228
228
  } catch (err) {
229
- const message18 = err instanceof Error ? err.message : "Failed to refresh user";
230
- setError(message18);
229
+ const message19 = err instanceof Error ? err.message : "Failed to refresh user";
230
+ setError(message19);
231
231
  } finally {
232
232
  setIsLoading(false);
233
233
  }
@@ -430,7 +430,7 @@ function useChat(threadId, assistantId, options = {}) {
430
430
  stopStreamingRef.current = null;
431
431
  }
432
432
  const { input, command, streaming = true } = data;
433
- const { message: message18, files, ...rest } = input || {};
433
+ const { message: message19, files, ...rest } = input || {};
434
434
  setState((prev) => ({
435
435
  ...prev,
436
436
  isLoading: true,
@@ -439,7 +439,7 @@ function useChat(threadId, assistantId, options = {}) {
439
439
  }));
440
440
  const userMessage = {
441
441
  id: Date.now().toString(),
442
- content: message18 || command?.resume?.message || "",
442
+ content: message19 || command?.resume?.message || "",
443
443
  files,
444
444
  role: "human"
445
445
  };
@@ -1154,6 +1154,22 @@ var DEFAULT_MIDDLEWARE_TYPES = [
1154
1154
  tools: [
1155
1155
  { id: "ask_user_to_clarify", name: "Ask User To Clarify", description: "Ask user clarifying questions with options" }
1156
1156
  ]
1157
+ },
1158
+ {
1159
+ type: "widget",
1160
+ name: "Widget",
1161
+ description: "Enables the agent to render interactive HTML widgets and visualizations",
1162
+ schema: {
1163
+ type: "object",
1164
+ title: "Widget Configuration",
1165
+ description: "Configure widget rendering capabilities (zero configuration required)",
1166
+ properties: {}
1167
+ },
1168
+ defaultConfig: {},
1169
+ tools: [
1170
+ { id: "load_guidelines", name: "Load Guidelines", description: "Load widget development guidelines for specific modules" },
1171
+ { id: "show_widget", name: "Show Widget", description: "Render interactive HTML widgets or SVG diagrams" }
1172
+ ]
1157
1173
  }
1158
1174
  ];
1159
1175
  var DEFAULT_CONFIG = {
@@ -1316,8 +1332,8 @@ function convertThreadToConversationThread(thread, label) {
1316
1332
  function getThreadMetadata(label) {
1317
1333
  return label ? { label } : {};
1318
1334
  }
1319
- function generateLabelFromMessage(message18) {
1320
- const cleanMessage = message18.replace(/```attachments[\s\S]*?```/g, "").trim();
1335
+ function generateLabelFromMessage(message19) {
1336
+ const cleanMessage = message19.replace(/```attachments[\s\S]*?```/g, "").trim();
1321
1337
  if (!cleanMessage) {
1322
1338
  return "";
1323
1339
  }
@@ -1731,7 +1747,7 @@ function AgentThreadProvider({
1731
1747
  stopStreamingRef.current = null;
1732
1748
  }
1733
1749
  const { input, command, streaming = true } = data;
1734
- const { message: message18, files, ...rest } = input || {};
1750
+ const { message: message19, files, ...rest } = input || {};
1735
1751
  setState((prev) => ({
1736
1752
  ...prev,
1737
1753
  isLoading: true,
@@ -1740,7 +1756,7 @@ function AgentThreadProvider({
1740
1756
  }));
1741
1757
  const userMessage = {
1742
1758
  id: Date.now().toString(),
1743
- content: message18 || command?.resume?.message || "",
1759
+ content: message19 || command?.resume?.message || "",
1744
1760
  files,
1745
1761
  role: "human"
1746
1762
  };
@@ -1756,8 +1772,8 @@ function AgentThreadProvider({
1756
1772
  messages: chunkMessageMerger.current.getMessages()
1757
1773
  }));
1758
1774
  const isFirstMessage = messageCountRef.current === 0;
1759
- if (isFirstMessage && message18 && conversationContext) {
1760
- const label = generateLabelFromMessage(message18);
1775
+ if (isFirstMessage && message19 && conversationContext) {
1776
+ const label = generateLabelFromMessage(message19);
1761
1777
  if (label) {
1762
1778
  conversationContext.updateThread({
1763
1779
  id: threadId,
@@ -3201,8 +3217,8 @@ function useTenants(options) {
3201
3217
  const { data } = await response.json();
3202
3218
  setTenants(data || []);
3203
3219
  } catch (err) {
3204
- const message18 = err instanceof Error ? err.message : "Failed to fetch tenants";
3205
- setError(message18);
3220
+ const message19 = err instanceof Error ? err.message : "Failed to fetch tenants";
3221
+ setError(message19);
3206
3222
  } finally {
3207
3223
  setIsLoading(false);
3208
3224
  }
@@ -3244,8 +3260,8 @@ function useUsers(options) {
3244
3260
  const { data } = await response.json();
3245
3261
  setUsers(data || []);
3246
3262
  } catch (err) {
3247
- const message18 = err instanceof Error ? err.message : "Failed to fetch users";
3248
- setError(message18);
3263
+ const message19 = err instanceof Error ? err.message : "Failed to fetch users";
3264
+ setError(message19);
3249
3265
  } finally {
3250
3266
  setIsLoading(false);
3251
3267
  }
@@ -3502,7 +3518,7 @@ var useStyle = createStyles2(({ token, css }) => {
3502
3518
  `,
3503
3519
  chat: css`
3504
3520
  width: 100%;
3505
- max-width: 1000px;
3521
+ max-width: 1400px;
3506
3522
  box-sizing: border-box;
3507
3523
  display: flex;
3508
3524
  flex-direction: column;
@@ -4210,7 +4226,7 @@ import { DownloadOutlined, ExpandAltOutlined } from "@ant-design/icons";
4210
4226
  import { jsx as jsx13, jsxs as jsxs5 } from "react/jsx-runtime";
4211
4227
  var { Text: Text3 } = Typography3;
4212
4228
  var GenericDataTable = ({ data, interactive = true, default_open_in_side_app = true }) => {
4213
- const { dataSource, message: message18 } = data ?? {};
4229
+ const { dataSource, message: message19 } = data ?? {};
4214
4230
  const [expandedRowKeys, setExpandedRowKeys] = useState15([]);
4215
4231
  const { openSideApp } = useChatUIContext();
4216
4232
  const processedData = dataSource?.map((item, index) => ({
@@ -4309,7 +4325,7 @@ var GenericDataTable = ({ data, interactive = true, default_open_in_side_app = t
4309
4325
  type: "text/csv;charset=utf-8;"
4310
4326
  });
4311
4327
  const link = document.createElement("a");
4312
- const filename = `${message18 || "data"}_${(/* @__PURE__ */ new Date()).toISOString().split("T")[0]}.csv`;
4328
+ const filename = `${message19 || "data"}_${(/* @__PURE__ */ new Date()).toISOString().split("T")[0]}.csv`;
4313
4329
  link.href = URL.createObjectURL(blob);
4314
4330
  link.download = filename;
4315
4331
  document.body.appendChild(link);
@@ -4330,7 +4346,7 @@ var GenericDataTable = ({ data, interactive = true, default_open_in_side_app = t
4330
4346
  tableLayout: "fixed",
4331
4347
  style: { width: "100% !important" },
4332
4348
  title: () => /* @__PURE__ */ jsxs5(Flex, { justify: "space-between", align: "center", children: [
4333
- /* @__PURE__ */ jsx13(Space2, { children: /* @__PURE__ */ jsx13(Text3, { strong: true, style: { fontSize: 16 }, children: message18 || "" }) }),
4349
+ /* @__PURE__ */ jsx13(Space2, { children: /* @__PURE__ */ jsx13(Text3, { strong: true, style: { fontSize: 16 }, children: message19 || "" }) }),
4334
4350
  /* @__PURE__ */ jsxs5(Space2, { children: [
4335
4351
  /* @__PURE__ */ jsx13(
4336
4352
  Button4,
@@ -4352,8 +4368,8 @@ var GenericDataTable = ({ data, interactive = true, default_open_in_side_app = t
4352
4368
  onClick: () => {
4353
4369
  openSideApp({
4354
4370
  component_key: "generic_data_table",
4355
- message: message18 || "",
4356
- data: { dataSource, message: message18 }
4371
+ message: message19 || "",
4372
+ data: { dataSource, message: message19 }
4357
4373
  });
4358
4374
  },
4359
4375
  children: /* @__PURE__ */ jsx13(ExpandAltOutlined, {})
@@ -5789,11 +5805,11 @@ var ConfirmFeedback = ({
5789
5805
  data,
5790
5806
  interactive = true
5791
5807
  }) => {
5792
- const { message: message18, type, config, feedback, options } = data ?? {};
5808
+ const { message: message19, type, config, feedback, options } = data ?? {};
5793
5809
  const { sendMessage } = useAgentChat();
5794
5810
  const [clicked, setClicked] = useState20(false);
5795
5811
  return /* @__PURE__ */ jsxs10(Space3, { direction: "vertical", style: { width: "100%" }, children: [
5796
- /* @__PURE__ */ jsx23(MDResponse, { content: message18 }),
5812
+ /* @__PURE__ */ jsx23(MDResponse, { content: message19 }),
5797
5813
  options ? /* @__PURE__ */ jsx23(Space3, { style: { justifyContent: "flex-end", width: "100%" }, children: options?.map((option) => /* @__PURE__ */ jsx23(
5798
5814
  Button8,
5799
5815
  {
@@ -7882,7 +7898,7 @@ import {
7882
7898
  } from "react";
7883
7899
  import { jsx as jsx41 } from "react/jsx-runtime";
7884
7900
  var LazyBubble = ({
7885
- message: message18,
7901
+ message: message19,
7886
7902
  renderContent,
7887
7903
  autoLoadRightPanel
7888
7904
  }) => {
@@ -7913,10 +7929,10 @@ var LazyBubble = ({
7913
7929
  autoLoadRightPanel?.();
7914
7930
  }, []);
7915
7931
  const getPlaceholder = () => {
7916
- const estimatedHeight = message18.content ? Math.min(100, message18.content.length / 5) : 100;
7932
+ const estimatedHeight = message19.content ? Math.min(100, message19.content.length / 5) : 100;
7917
7933
  return /* @__PURE__ */ jsx41("div", { style: { height: `${estimatedHeight}px`, minHeight: "50px" } });
7918
7934
  };
7919
- return /* @__PURE__ */ jsx41(ErrorBoundary, { children: /* @__PURE__ */ jsx41("div", { ref, style: { width: "100%" }, children: isVisible || wasEverVisible ? renderContent(message18) : getPlaceholder() }) });
7935
+ return /* @__PURE__ */ jsx41(ErrorBoundary, { children: /* @__PURE__ */ jsx41("div", { ref, style: { width: "100%" }, children: isVisible || wasEverVisible ? renderContent(message19) : getPlaceholder() }) });
7920
7936
  };
7921
7937
  var MemoizedBubbleList = memo(
7922
7938
  ({
@@ -7947,8 +7963,8 @@ var MessageList = ({
7947
7963
  messageLengthRef.current = messages?.length;
7948
7964
  }
7949
7965
  }, [messages?.length]);
7950
- const renderContent = useCallback16((message18) => {
7951
- const { content } = message18;
7966
+ const renderContent = useCallback16((message19) => {
7967
+ const { content } = message19;
7952
7968
  try {
7953
7969
  const json = JSON.parse(content);
7954
7970
  if (json.action && json.message) {
@@ -7956,7 +7972,7 @@ var MessageList = ({
7956
7972
  }
7957
7973
  } catch (error) {
7958
7974
  }
7959
- const tool_calls_md = message18.tool_calls?.map((tool_call) => {
7975
+ const tool_calls_md = message19.tool_calls?.map((tool_call) => {
7960
7976
  return `\`\`\`tool_call
7961
7977
  ${JSON.stringify(tool_call)}
7962
7978
  \`\`\``;
@@ -7965,17 +7981,17 @@ ${JSON.stringify(tool_call)}
7965
7981
  return /* @__PURE__ */ jsx41(Space12, { direction: "vertical", style: { width: "100%" }, children: /* @__PURE__ */ jsx41(MDResponse, { content: content_md }) });
7966
7982
  }, []);
7967
7983
  const items = useMemo9(
7968
- () => messages.map((message18, index) => ({
7969
- key: message18.id,
7970
- role: message18.role,
7984
+ () => messages.map((message19, index) => ({
7985
+ key: message19.id,
7986
+ role: message19.role,
7971
7987
  typing: false,
7972
7988
  content: /* @__PURE__ */ jsx41(
7973
7989
  LazyBubble,
7974
7990
  {
7975
- message: message18,
7991
+ message: message19,
7976
7992
  renderContent,
7977
7993
  autoLoadRightPanel: () => {
7978
- const { content, role: role2 } = message18;
7994
+ const { content, role: role2 } = message19;
7979
7995
  const isNewAddedMessage = messageLengthRef.current > 1 && messageLengthRef.current + 1 === messages.length;
7980
7996
  if (index === messages.length - 1 && isNewAddedMessage && role2 === "ai") {
7981
7997
  try {
@@ -22517,12 +22533,12 @@ var formatDate3 = (timestamp) => {
22517
22533
  });
22518
22534
  };
22519
22535
  var MailboxDetailModal = ({
22520
- message: message18,
22536
+ message: message19,
22521
22537
  visible,
22522
22538
  onClose
22523
22539
  }) => {
22524
22540
  const { styles } = useStyles14();
22525
- if (!message18) return null;
22541
+ if (!message19) return null;
22526
22542
  return /* @__PURE__ */ jsx90(
22527
22543
  Modal15,
22528
22544
  {
@@ -22545,12 +22561,12 @@ var MailboxDetailModal = ({
22545
22561
  children: /* @__PURE__ */ jsxs63("div", { className: styles.modalContent, children: [
22546
22562
  /* @__PURE__ */ jsxs63("div", { className: styles.header, children: [
22547
22563
  /* @__PURE__ */ jsx90("div", { className: styles.messageIcon, children: /* @__PURE__ */ jsx90(Mail2, { size: 20 }) }),
22548
- /* @__PURE__ */ jsx90(Text35, { className: styles.messageId, children: message18.id }),
22549
- !message18.read && /* @__PURE__ */ jsx90(Tag20, { color: "red", children: "Unread" })
22564
+ /* @__PURE__ */ jsx90(Text35, { className: styles.messageId, children: message19.id }),
22565
+ !message19.read && /* @__PURE__ */ jsx90(Tag20, { color: "red", children: "Unread" })
22550
22566
  ] }),
22551
22567
  /* @__PURE__ */ jsxs63(Title11, { level: 4, className: styles.title, children: [
22552
22568
  "Message from ",
22553
- message18.from
22569
+ message19.from
22554
22570
  ] }),
22555
22571
  /* @__PURE__ */ jsxs63("div", { className: styles.metaSection, children: [
22556
22572
  /* @__PURE__ */ jsxs63("div", { className: styles.metaItem, children: [
@@ -22560,11 +22576,11 @@ var MailboxDetailModal = ({
22560
22576
  "div",
22561
22577
  {
22562
22578
  className: styles.avatar,
22563
- style: { background: getAvatarColor7(message18.from) },
22564
- children: getInitials7(message18.from)
22579
+ style: { background: getAvatarColor7(message19.from) },
22580
+ children: getInitials7(message19.from)
22565
22581
  }
22566
22582
  ),
22567
- /* @__PURE__ */ jsx90("span", { children: message18.from })
22583
+ /* @__PURE__ */ jsx90("span", { children: message19.from })
22568
22584
  ] })
22569
22585
  ] }),
22570
22586
  /* @__PURE__ */ jsxs63("div", { className: styles.metaItem, children: [
@@ -22574,29 +22590,29 @@ var MailboxDetailModal = ({
22574
22590
  "div",
22575
22591
  {
22576
22592
  className: styles.avatar,
22577
- style: { background: getAvatarColor7(message18.to) },
22578
- children: getInitials7(message18.to)
22593
+ style: { background: getAvatarColor7(message19.to) },
22594
+ children: getInitials7(message19.to)
22579
22595
  }
22580
22596
  ),
22581
- /* @__PURE__ */ jsx90("span", { children: message18.to })
22597
+ /* @__PURE__ */ jsx90("span", { children: message19.to })
22582
22598
  ] })
22583
22599
  ] }),
22584
22600
  /* @__PURE__ */ jsxs63("div", { className: styles.metaItem, children: [
22585
22601
  /* @__PURE__ */ jsx90(Text35, { className: styles.metaLabel, children: "Time" }),
22586
22602
  /* @__PURE__ */ jsxs63("div", { className: styles.metaValue, children: [
22587
22603
  /* @__PURE__ */ jsx90(Calendar2, { size: 14 }),
22588
- /* @__PURE__ */ jsx90("span", { children: formatDate3(message18.timestamp) })
22604
+ /* @__PURE__ */ jsx90("span", { children: formatDate3(message19.timestamp) })
22589
22605
  ] })
22590
22606
  ] }),
22591
22607
  /* @__PURE__ */ jsxs63("div", { className: styles.metaItem, children: [
22592
22608
  /* @__PURE__ */ jsx90(Text35, { className: styles.metaLabel, children: "Type" }),
22593
- /* @__PURE__ */ jsx90("div", { className: styles.metaValue, children: /* @__PURE__ */ jsx90(Tag20, { color: message18.type === "broadcast" ? "blue" : "default", children: message18.type }) })
22609
+ /* @__PURE__ */ jsx90("div", { className: styles.metaValue, children: /* @__PURE__ */ jsx90(Tag20, { color: message19.type === "broadcast" ? "blue" : "default", children: message19.type }) })
22594
22610
  ] })
22595
22611
  ] }),
22596
22612
  /* @__PURE__ */ jsx90(Divider8, {}),
22597
22613
  /* @__PURE__ */ jsxs63("div", { className: styles.contentSection, children: [
22598
22614
  /* @__PURE__ */ jsx90(Text35, { className: styles.contentLabel, children: "Message Content" }),
22599
- /* @__PURE__ */ jsx90("div", { className: styles.contentBox, children: /* @__PURE__ */ jsx90(Paragraph2, { className: styles.messageContent, children: message18.content }) })
22615
+ /* @__PURE__ */ jsx90("div", { className: styles.contentBox, children: /* @__PURE__ */ jsx90(Paragraph2, { className: styles.messageContent, children: message19.content }) })
22600
22616
  ] })
22601
22617
  ] })
22602
22618
  }
@@ -22825,26 +22841,26 @@ var MessageGroupComponent = ({ group, styles, defaultExpanded = true, onMessageC
22825
22841
  ]
22826
22842
  }
22827
22843
  ),
22828
- isExpanded && /* @__PURE__ */ jsx91("div", { className: styles.listGroupContent, children: group.messages.map((message18) => /* @__PURE__ */ jsxs64(
22844
+ isExpanded && /* @__PURE__ */ jsx91("div", { className: styles.listGroupContent, children: group.messages.map((message19) => /* @__PURE__ */ jsxs64(
22829
22845
  "div",
22830
22846
  {
22831
- className: `${styles.listItem} ${!message18.read ? styles.listItemUnread : ""}`,
22832
- onClick: () => onMessageClick(message18),
22847
+ className: `${styles.listItem} ${!message19.read ? styles.listItemUnread : ""}`,
22848
+ onClick: () => onMessageClick(message19),
22833
22849
  children: [
22834
- /* @__PURE__ */ jsx91("div", { className: styles.listItemIcon, children: !message18.read ? /* @__PURE__ */ jsx91("div", { className: styles.unreadBadge }) : /* @__PURE__ */ jsx91(Circle2, { size: 8, style: { color: "#d9d9d9" } }) }),
22850
+ /* @__PURE__ */ jsx91("div", { className: styles.listItemIcon, children: !message19.read ? /* @__PURE__ */ jsx91("div", { className: styles.unreadBadge }) : /* @__PURE__ */ jsx91(Circle2, { size: 8, style: { color: "#d9d9d9" } }) }),
22835
22851
  /* @__PURE__ */ jsxs64("div", { className: styles.listItemContent, children: [
22836
- /* @__PURE__ */ jsx91("span", { className: styles.listItemPreview, children: getMessagePreview(message18.content) }),
22852
+ /* @__PURE__ */ jsx91("span", { className: styles.listItemPreview, children: getMessagePreview(message19.content) }),
22837
22853
  /* @__PURE__ */ jsxs64("span", { className: styles.listItemMeta, children: [
22838
22854
  "To: ",
22839
- message18.to,
22855
+ message19.to,
22840
22856
  " \u2022 ",
22841
- message18.type
22857
+ message19.type
22842
22858
  ] })
22843
22859
  ] }),
22844
- /* @__PURE__ */ jsx91("div", { className: styles.listItemRight, children: /* @__PURE__ */ jsx91("span", { className: styles.listItemDate, children: formatDate4(message18.timestamp) }) })
22860
+ /* @__PURE__ */ jsx91("div", { className: styles.listItemRight, children: /* @__PURE__ */ jsx91("span", { className: styles.listItemDate, children: formatDate4(message19.timestamp) }) })
22845
22861
  ]
22846
22862
  },
22847
- message18.id
22863
+ message19.id
22848
22864
  )) })
22849
22865
  ] });
22850
22866
  };
@@ -22855,12 +22871,12 @@ var MailboxPanel = ({ data }) => {
22855
22871
  const { teamMailbox = [] } = data || {};
22856
22872
  const messageGroups = useMemo22(() => {
22857
22873
  const groupsMap = /* @__PURE__ */ new Map();
22858
- teamMailbox.forEach((message18) => {
22859
- const sender = message18.from;
22874
+ teamMailbox.forEach((message19) => {
22875
+ const sender = message19.from;
22860
22876
  if (!groupsMap.has(sender)) {
22861
22877
  groupsMap.set(sender, []);
22862
22878
  }
22863
- groupsMap.get(sender).push(message18);
22879
+ groupsMap.get(sender).push(message19);
22864
22880
  });
22865
22881
  const groups = Array.from(groupsMap.entries()).map(([sender, messages]) => ({
22866
22882
  sender,
@@ -22877,8 +22893,8 @@ var MailboxPanel = ({ data }) => {
22877
22893
  return groups;
22878
22894
  }, [teamMailbox]);
22879
22895
  const totalUnread = teamMailbox.filter((m) => !m.read).length;
22880
- const handleMessageClick = (message18) => {
22881
- setSelectedMessage(message18);
22896
+ const handleMessageClick = (message19) => {
22897
+ setSelectedMessage(message19);
22882
22898
  setModalVisible(true);
22883
22899
  };
22884
22900
  const handleCloseModal = () => {
@@ -23928,6 +23944,1099 @@ var TeamChat = ({ data }) => {
23928
23944
  ] });
23929
23945
  };
23930
23946
 
23947
+ // src/components/GenUI/elements/ShowWidget.tsx
23948
+ import { useCallback as useCallback27 } from "react";
23949
+ import { Button as Button44, Typography as Typography46 } from "antd";
23950
+ import { ExpandOutlined as ExpandOutlined2 } from "@ant-design/icons";
23951
+
23952
+ // src/streaming-html/StreamingHTMLRenderer.tsx
23953
+ import React50, { useEffect as useEffect37, useRef as useRef22, useCallback as useCallback26, useState as useState59 } from "react";
23954
+
23955
+ // src/streaming-html/show-widget-css-generator.ts
23956
+ function generateShowWidgetCSS(tokens) {
23957
+ const { colors: colors3, radius: radius4, typography: typography3 } = tokens;
23958
+ return `
23959
+ :root {
23960
+ /* ============================================
23961
+ Background Colors (from Axiom tokens)
23962
+ ============================================ */
23963
+
23964
+ --color-background-primary: ${colors3.light.surface};
23965
+ --color-background-secondary: ${colors3.light.surfaceHover};
23966
+ --color-background-tertiary: ${colors3.light.bg};
23967
+
23968
+ /* Semantic backgrounds - derived from functional colors */
23969
+ --color-background-info: ${colors3.info}1a;
23970
+ --color-background-danger: ${colors3.error}1a;
23971
+ --color-background-success: ${colors3.success}1a;
23972
+ --color-background-warning: ${colors3.warning}1a;
23973
+
23974
+ /* ============================================
23975
+ Text Colors (from Axiom tokens)
23976
+ ============================================ */
23977
+
23978
+ --color-text-primary: ${colors3.light.text};
23979
+ --color-text-secondary: ${colors3.light.textSecondary};
23980
+ --color-text-tertiary: ${colors3.light.textMuted};
23981
+
23982
+ /* Semantic text - from functional colors */
23983
+ --color-text-info: ${colors3.info};
23984
+ --color-text-danger: ${colors3.error};
23985
+ --color-text-success: ${colors3.success};
23986
+ --color-text-warning: ${colors3.warning};
23987
+
23988
+ /* ============================================
23989
+ Border Colors (derived from Axiom tokens)
23990
+ ============================================ */
23991
+
23992
+ --color-border-tertiary: ${colors3.light.border}99;
23993
+ --color-border-secondary: ${colors3.light.borderHover}b3;
23994
+ --color-border-primary: ${colors3.light.textMuted}cc;
23995
+
23996
+ /* Semantic borders */
23997
+ --color-border-info: ${colors3.info}80;
23998
+ --color-border-danger: ${colors3.error}80;
23999
+ --color-border-success: ${colors3.success}80;
24000
+ --color-border-warning: ${colors3.warning}80;
24001
+
24002
+ /* ============================================
24003
+ Typography (from Axiom tokens)
24004
+ ============================================ */
24005
+
24006
+ --font-sans: ${typography3.fontFamily};
24007
+ --font-serif: Georgia, 'Times New Roman', serif;
24008
+ --font-mono: 'Fira Code', 'Monaco', 'Consolas', monospace;
24009
+
24010
+ /* ============================================
24011
+ Border Radius (from Axiom tokens, adjusted)
24012
+ ============================================ */
24013
+
24014
+ --border-radius-md: ${radius4.md};
24015
+ --border-radius-lg: ${radius4.lg};
24016
+ --border-radius-xl: ${radius4.xl};
24017
+
24018
+ /* ============================================
24019
+ Color Ramps (9 ramps x 7 stops)
24020
+ Derived from Axiom primary and functional colors
24021
+ ============================================ */
24022
+
24023
+ /* Purple - from Axiom primary indigo */
24024
+ --color-purple-50: ${colors3.primary[50]};
24025
+ --color-purple-100: ${colors3.primary[100]};
24026
+ --color-purple-200: ${colors3.primary[200]};
24027
+ --color-purple-400: ${colors3.primary[400]};
24028
+ --color-purple-600: ${colors3.primary[600]};
24029
+ --color-purple-800: ${colors3.primary[800]};
24030
+ --color-purple-900: ${colors3.primary[900]};
24031
+
24032
+ /* Teal - cool accent (complementary to primary) */
24033
+ --color-teal-50: #e1f5ee;
24034
+ --color-teal-100: #9fe1cb;
24035
+ --color-teal-200: #5dcaa5;
24036
+ --color-teal-400: #1d9e75;
24037
+ --color-teal-600: #0f6e56;
24038
+ --color-teal-800: #085041;
24039
+ --color-teal-900: #04342c;
24040
+
24041
+ /* Coral - warm accent */
24042
+ --color-coral-50: #faece7;
24043
+ --color-coral-100: #f5c4b3;
24044
+ --color-coral-200: #f0997b;
24045
+ --color-coral-400: #d85a30;
24046
+ --color-coral-600: #993c1d;
24047
+ --color-coral-800: #712b13;
24048
+ --color-coral-900: #4a1b0c;
24049
+
24050
+ /* Pink - soft accent */
24051
+ --color-pink-50: #fbeaf0;
24052
+ --color-pink-100: #f4c0d1;
24053
+ --color-pink-200: #ed93b1;
24054
+ --color-pink-400: #d4537e;
24055
+ --color-pink-600: #993556;
24056
+ --color-pink-800: #72243e;
24057
+ --color-pink-900: #4b1528;
24058
+
24059
+ /* Gray - neutral scale (derived from text colors) */
24060
+ --color-gray-50: #f1efe8;
24061
+ --color-gray-100: #d3d1c7;
24062
+ --color-gray-200: #b4b2a9;
24063
+ --color-gray-400: #888780;
24064
+ --color-gray-600: #5f5e5a;
24065
+ --color-gray-800: #444441;
24066
+ --color-gray-900: #2c2c2a;
24067
+
24068
+ /* Blue - from Axiom info color */
24069
+ --color-blue-50: #e6f1fb;
24070
+ --color-blue-100: #b5d4f4;
24071
+ --color-blue-200: #85b7eb;
24072
+ --color-blue-400: ${colors3.info};
24073
+ --color-blue-600: #185fa5;
24074
+ --color-blue-800: #0c447c;
24075
+ --color-blue-900: #042c53;
24076
+
24077
+ /* Green - from Axiom success color */
24078
+ --color-green-50: #eaf3de;
24079
+ --color-green-100: #c0dd97;
24080
+ --color-green-200: #97c459;
24081
+ --color-green-400: ${colors3.success};
24082
+ --color-green-600: #3b6d11;
24083
+ --color-green-800: #27500a;
24084
+ --color-green-900: #173404;
24085
+
24086
+ /* Amber - from Axiom warning color */
24087
+ --color-amber-50: #faeeda;
24088
+ --color-amber-100: #fac775;
24089
+ --color-amber-200: #ef9f27;
24090
+ --color-amber-400: ${colors3.warning};
24091
+ --color-amber-600: #854f0b;
24092
+ --color-amber-800: #633806;
24093
+ --color-amber-900: #412402;
24094
+
24095
+ /* Red - from Axiom error color */
24096
+ --color-red-50: #fcebeb;
24097
+ --color-red-100: #f7c1c1;
24098
+ --color-red-200: #f09595;
24099
+ --color-red-400: ${colors3.error};
24100
+ --color-red-600: #a32d2d;
24101
+ --color-red-800: #791f1f;
24102
+ --color-red-900: #501313;
24103
+
24104
+ /* Short Aliases */
24105
+ --p: var(--color-text-primary);
24106
+ --s: var(--color-text-secondary);
24107
+ --t: var(--color-text-tertiary);
24108
+ --bg2: var(--color-background-secondary);
24109
+ --b: var(--color-border-tertiary);
24110
+ }
24111
+
24112
+ /* Dark Mode - using Axiom dark tokens */
24113
+ @media (prefers-color-scheme: dark) {
24114
+ :root {
24115
+ --color-background-primary: ${colors3.dark.surface};
24116
+ --color-background-secondary: ${colors3.dark.surfaceHover};
24117
+ --color-background-tertiary: ${colors3.dark.bg};
24118
+
24119
+ --color-background-info: ${colors3.info}26;
24120
+ --color-background-danger: ${colors3.error}26;
24121
+ --color-background-success: ${colors3.success}26;
24122
+ --color-background-warning: ${colors3.warning}26;
24123
+
24124
+ --color-text-primary: ${colors3.dark.text};
24125
+ --color-text-secondary: ${colors3.dark.textSecondary};
24126
+ --color-text-tertiary: ${colors3.dark.textMuted};
24127
+
24128
+ --color-border-tertiary: ${colors3.dark.border}99;
24129
+ --color-border-secondary: ${colors3.dark.borderHover}b3;
24130
+ --color-border-primary: ${colors3.dark.textMuted}cc;
24131
+ --color-border-info: ${colors3.info}66;
24132
+ --color-border-danger: ${colors3.error}66;
24133
+ --color-border-success: ${colors3.success}66;
24134
+ --color-border-warning: ${colors3.warning}66;
24135
+ }
24136
+ }
24137
+
24138
+ /* Base Styles */
24139
+ html, body {
24140
+ margin: 0;
24141
+ padding: 0;
24142
+ font-family: var(--font-sans);
24143
+ color: var(--color-text-primary);
24144
+ background: transparent;
24145
+ overflow: hidden;
24146
+ width: fit-content;
24147
+ min-width: 100%;
24148
+ box-sizing: border-box;
24149
+ }
24150
+
24151
+ #root {
24152
+ overflow: hidden;
24153
+ width: fit-content;
24154
+ min-width: 100%;
24155
+ box-sizing: border-box;
24156
+ }
24157
+
24158
+ #root img, #root video, #root canvas, #root svg {
24159
+ max-width: 100%;
24160
+ height: 100%;
24161
+ }
24162
+
24163
+ /* SVG Text Classes */
24164
+ .t {
24165
+ font-family: var(--font-sans);
24166
+ font-size: 14px;
24167
+ font-weight: 400;
24168
+ fill: var(--color-text-primary);
24169
+ }
24170
+
24171
+ .ts {
24172
+ font-family: var(--font-sans);
24173
+ font-size: 12px;
24174
+ font-weight: 400;
24175
+ fill: var(--color-text-secondary);
24176
+ }
24177
+
24178
+ .th {
24179
+ font-family: var(--font-sans);
24180
+ font-size: 14px;
24181
+ font-weight: 500;
24182
+ fill: var(--color-text-primary);
24183
+ }
24184
+
24185
+ /* Box & Node Classes */
24186
+ .box {
24187
+ fill: var(--color-background-secondary);
24188
+ stroke: var(--color-border-tertiary);
24189
+ stroke-width: 0.5px;
24190
+ }
24191
+
24192
+ .node {
24193
+ cursor: pointer;
24194
+ }
24195
+
24196
+ .node:hover {
24197
+ opacity: 0.85;
24198
+ }
24199
+
24200
+ /* Arrow & Leader Lines */
24201
+ .arr {
24202
+ stroke: var(--color-text-tertiary);
24203
+ stroke-width: 1.5px;
24204
+ fill: none;
24205
+ }
24206
+
24207
+ .leader {
24208
+ stroke: var(--color-text-tertiary);
24209
+ stroke-width: 0.5px;
24210
+ stroke-dasharray: 4 2;
24211
+ fill: none;
24212
+ }
24213
+
24214
+ /* Color Ramp Classes for SVG */
24215
+ .c-purple { fill: var(--color-purple-200); stroke: var(--color-purple-600); }
24216
+ .c-purple .t, .c-purple .th { fill: var(--color-purple-800); }
24217
+ .c-purple .ts { fill: var(--color-purple-600); }
24218
+
24219
+ .c-teal { fill: var(--color-teal-200); stroke: var(--color-teal-600); }
24220
+ .c-teal .t, .c-teal .th { fill: var(--color-teal-800); }
24221
+ .c-teal .ts { fill: var(--color-teal-600); }
24222
+
24223
+ .c-coral { fill: var(--color-coral-200); stroke: var(--color-coral-600); }
24224
+ .c-coral .t, .c-coral .th { fill: var(--color-coral-800); }
24225
+ .c-coral .ts { fill: var(--color-coral-600); }
24226
+
24227
+ .c-pink { fill: var(--color-pink-200); stroke: var(--color-pink-600); }
24228
+ .c-pink .t, .c-pink .th { fill: var(--color-pink-800); }
24229
+ .c-pink .ts { fill: var(--color-pink-600); }
24230
+
24231
+ .c-gray { fill: var(--color-gray-200); stroke: var(--color-gray-600); }
24232
+ .c-gray .t, .c-gray .th { fill: var(--color-gray-800); }
24233
+ .c-gray .ts { fill: var(--color-gray-600); }
24234
+
24235
+ .c-blue { fill: var(--color-blue-200); stroke: var(--color-blue-600); }
24236
+ .c-blue .t, .c-blue .th { fill: var(--color-blue-800); }
24237
+ .c-blue .ts { fill: var(--color-blue-600); }
24238
+
24239
+ .c-green { fill: var(--color-green-200); stroke: var(--color-green-600); }
24240
+ .c-green .t, .c-green .th { fill: var(--color-green-800); }
24241
+ .c-green .ts { fill: var(--color-green-600); }
24242
+
24243
+ .c-amber { fill: var(--color-amber-200); stroke: var(--color-amber-600); }
24244
+ .c-amber .t, .c-amber .th { fill: var(--color-amber-800); }
24245
+ .c-amber .ts { fill: var(--color-amber-600); }
24246
+
24247
+ .c-red { fill: var(--color-red-200); stroke: var(--color-red-600); }
24248
+ .c-red .t, .c-red .th { fill: var(--color-red-800); }
24249
+ .c-red .ts { fill: var(--color-red-600); }
24250
+
24251
+ /* Dark Mode Color Ramps */
24252
+ @media (prefers-color-scheme: dark) {
24253
+ .c-purple { fill: var(--color-purple-800); stroke: var(--color-purple-200); }
24254
+ .c-purple .t, .c-purple .th { fill: var(--color-purple-100); }
24255
+ .c-purple .ts { fill: var(--color-purple-200); }
24256
+
24257
+ .c-teal { fill: var(--color-teal-800); stroke: var(--color-teal-200); }
24258
+ .c-teal .t, .c-teal .th { fill: var(--color-teal-100); }
24259
+ .c-teal .ts { fill: var(--color-teal-200); }
24260
+
24261
+ .c-coral { fill: var(--color-coral-800); stroke: var(--color-coral-200); }
24262
+ .c-coral .t, .c-coral .th { fill: var(--color-coral-100); }
24263
+ .c-coral .ts { fill: var(--color-coral-200); }
24264
+
24265
+ .c-pink { fill: var(--color-pink-800); stroke: var(--color-pink-200); }
24266
+ .c-pink .t, .c-pink .th { fill: var(--color-pink-100); }
24267
+ .c-pink .ts { fill: var(--color-pink-200); }
24268
+
24269
+ .c-gray { fill: var(--color-gray-800); stroke: var(--color-gray-200); }
24270
+ .c-gray .t, .c-gray .th { fill: var(--color-gray-100); }
24271
+ .c-gray .ts { fill: var(--color-gray-200); }
24272
+
24273
+ .c-blue { fill: var(--color-blue-800); stroke: var(--color-blue-200); }
24274
+ .c-blue .t, .c-blue .th { fill: var(--color-blue-100); }
24275
+ .c-blue .ts { fill: var(--color-blue-200); }
24276
+
24277
+ .c-green { fill: var(--color-green-800); stroke: var(--color-green-200); }
24278
+ .c-green .t, .c-green .th { fill: var(--color-green-100); }
24279
+ .c-green .ts { fill: var(--color-green-200); }
24280
+
24281
+ .c-amber { fill: var(--color-amber-800); stroke: var(--color-amber-200); }
24282
+ .c-amber .t, .c-amber .th { fill: var(--color-amber-100); }
24283
+ .c-amber .ts { fill: var(--color-amber-200); }
24284
+
24285
+ .c-red { fill: var(--color-red-800); stroke: var(--color-red-200); }
24286
+ .c-red .t, .c-red .th { fill: var(--color-red-100); }
24287
+ .c-red .ts { fill: var(--color-red-200); }
24288
+ }
24289
+ /* Pre-styled form elements */
24290
+ button {
24291
+ background: transparent;
24292
+ border: 0.5px solid var(--color-border-secondary);
24293
+ border-radius: var(--border-radius-md);
24294
+ color: var(--color-text-primary);
24295
+ padding: 6px 14px;
24296
+ font-size: 14px;
24297
+ cursor: pointer;
24298
+ font-family: var(--font-sans);
24299
+ }
24300
+ button:hover { background: var(--color-background-secondary); }
24301
+ button:active { transform: scale(0.98); }
24302
+
24303
+ input[type="range"] {
24304
+ -webkit-appearance: none;
24305
+ height: 4px;
24306
+ background: var(--color-border-secondary);
24307
+ border-radius: 2px;
24308
+ outline: none;
24309
+ }
24310
+ input[type="range"]::-webkit-slider-thumb {
24311
+ -webkit-appearance: none;
24312
+ width: 18px;
24313
+ height: 18px;
24314
+ border-radius: 50%;
24315
+ background: var(--color-text-primary);
24316
+ cursor: pointer;
24317
+ }
24318
+
24319
+ input[type="text"], input[type="number"], textarea, select {
24320
+ height: 36px;
24321
+ background: var(--color-background-primary);
24322
+ border: 0.5px solid var(--color-border-tertiary);
24323
+ border-radius: var(--border-radius-md);
24324
+ color: var(--color-text-primary);
24325
+ padding: 0 10px;
24326
+ font-size: 14px;
24327
+ font-family: var(--font-sans);
24328
+ outline: none;
24329
+ }
24330
+ input[type="text"]:hover, input[type="number"]:hover, textarea:hover, select:hover {
24331
+ border-color: var(--color-border-secondary);
24332
+ }
24333
+ input[type="text"]:focus, input[type="number"]:focus, textarea:focus, select:focus {
24334
+ border-color: var(--color-border-primary);
24335
+ box-shadow: 0 0 0 2px rgba(255,255,255,0.1);
24336
+ }
24337
+ `;
24338
+ }
24339
+ var showWidgetCSS = generateShowWidgetCSS(axiomTokens);
24340
+
24341
+ // src/streaming-html/IframeHTMLBridge.ts
24342
+ function generateIframeSrcdoc() {
24343
+ return `<!DOCTYPE html>
24344
+ <html>
24345
+ <head>
24346
+ <meta charset="UTF-8">
24347
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
24348
+ <style>
24349
+ *{box-sizing:border-box}
24350
+ body{margin:0;padding:1rem;font-family:system-ui,-apple-system,sans-serif;}
24351
+ svg { height:100%}
24352
+ @keyframes _fadeIn{from{opacity:0;transform:translateY(4px);}to{opacity:1;transform:none;}}
24353
+
24354
+ ${showWidgetCSS}
24355
+ </style>
24356
+ <script>
24357
+ // Load morphdom from CDN with fallback
24358
+ (function() {
24359
+ if (typeof morphdom === 'undefined') {
24360
+ var script = document.createElement('script');
24361
+ script.src = 'https://cdn.jsdelivr.net/npm/morphdom@2.7.4/dist/morphdom-umd.min.js';
24362
+ script.onload = function() {
24363
+ window.parent.postMessage({ type: 'iframe-ready' }, '*');
24364
+ };
24365
+ script.onerror = function() {
24366
+ window.parent.postMessage({ type: 'iframe-error', error: 'Failed to load morphdom' }, '*');
24367
+ };
24368
+ document.head.appendChild(script);
24369
+ }
24370
+ })();
24371
+ </script>
24372
+ </head>
24373
+ <body>
24374
+ <div id="root"></div>
24375
+ <script>
24376
+ class TagBalancer {
24377
+ constructor() {
24378
+ this.voidElements = new Set([
24379
+ 'area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input',
24380
+ 'link', 'meta', 'param', 'source', 'track', 'wbr'
24381
+ ]);
24382
+ this.openTags = [];
24383
+ this.accumulatedHTML = '';
24384
+ }
24385
+
24386
+ parseChunk(chunk) {
24387
+ this.accumulatedHTML += chunk;
24388
+
24389
+ // Parse tags from chunk
24390
+ const tagRegex = /<\\/?([a-zA-Z][a-zA-Z0-9]*)[^>]*?>/g;
24391
+ let match;
24392
+
24393
+ while ((match = tagRegex.exec(chunk)) !== null) {
24394
+ const fullTag = match[0];
24395
+ const tagName = match[1].toLowerCase();
24396
+ const isClosing = fullTag.startsWith('</');
24397
+ const isSelfClosing = fullTag.endsWith('/>') || this.voidElements.has(tagName);
24398
+
24399
+ if (isSelfClosing) {
24400
+ // Void elements don't affect stack
24401
+ continue;
24402
+ }
24403
+
24404
+ if (isClosing) {
24405
+ // Remove matching open tag if present
24406
+ const idx = this.openTags.lastIndexOf(tagName);
24407
+ if (idx !== -1) {
24408
+ this.openTags.splice(idx, 1);
24409
+ }
24410
+ } else {
24411
+ // Opening tag - add to stack
24412
+ this.openTags.push(tagName);
24413
+ }
24414
+ }
24415
+ }
24416
+
24417
+ getAccumulatedHTML() {
24418
+ return this.accumulatedHTML;
24419
+ }
24420
+
24421
+ getStack() {
24422
+ return [...this.openTags];
24423
+ }
24424
+ }
24425
+
24426
+ const tagBalancer = new TagBalancer();
24427
+ const root = document.getElementById('root');
24428
+ let renderTimeout = null;
24429
+
24430
+ function preserveInputValues() {
24431
+ const inputs = document.querySelectorAll('input, textarea');
24432
+ const values = new Map();
24433
+ inputs.forEach((input, index) => {
24434
+ const key = input.tagName + '-' + index + '-' + (input.name || input.id || '');
24435
+ values.set(key, input.value);
24436
+ });
24437
+ return values;
24438
+ }
24439
+
24440
+ function restoreInputValues(values) {
24441
+ const inputs = document.querySelectorAll('input, textarea');
24442
+ inputs.forEach((input, index) => {
24443
+ const key = input.tagName + '-' + index + '-' + (input.name || input.id || '');
24444
+ if (values.has(key)) {
24445
+ input.value = values.get(key);
24446
+ }
24447
+ });
24448
+ }
24449
+
24450
+ function render() {
24451
+ try {
24452
+ const preservedValues = preserveInputValues();
24453
+
24454
+ // Build complete HTML with auto-closing tags
24455
+ const openTags = tagBalancer.getStack();
24456
+ const closingTags = openTags
24457
+ .slice()
24458
+ .reverse()
24459
+ .map(tag => '</' + tag + '>')
24460
+ .join('');
24461
+ const balancedHTML = tagBalancer.getAccumulatedHTML() + closingTags;
24462
+
24463
+ // Use morphdom to update DOM
24464
+ if (root) {
24465
+ const temp = document.createElement('div');
24466
+ temp.innerHTML = balancedHTML;
24467
+
24468
+ if (!root.firstChild) {
24469
+ root.innerHTML = balancedHTML;
24470
+ } else if (temp.firstChild) {
24471
+ morphdom(root, temp, {
24472
+ childrenOnly: true,
24473
+ onBeforeElUpdated: function(fromEl, toEl) {
24474
+ // Preserve input/textarea values
24475
+ if (fromEl.tagName === 'INPUT' || fromEl.tagName === 'TEXTAREA') {
24476
+ toEl.value = fromEl.value;
24477
+ }
24478
+ return true;
24479
+ },
24480
+ onNodeAdded: function(node) {
24481
+ // Add fade-in animation to newly added elements
24482
+ if (node.nodeType === Node.ELEMENT_NODE) {
24483
+ node.style.animation = '_fadeIn 0.3s ease-out';
24484
+ }
24485
+ return node;
24486
+ }
24487
+ });
24488
+ }
24489
+ }
24490
+
24491
+ restoreInputValues(preservedValues);
24492
+ } catch (error) {
24493
+ console.error('[iframe] Render error:', error);
24494
+ parent.postMessage({ type: 'iframe-error', error: error.message }, '*');
24495
+ }
24496
+ }
24497
+
24498
+ function scheduleRender() {
24499
+ if (renderTimeout) {
24500
+ clearTimeout(renderTimeout);
24501
+ }
24502
+ renderTimeout = setTimeout(render, 50);
24503
+ }
24504
+
24505
+ function notifyHeight() {
24506
+ try {
24507
+ const height = document.body.scrollHeight;
24508
+ parent.postMessage({ type: 'iframe-height', height }, '*');
24509
+ } catch (error) {
24510
+ console.error('[iframe] Failed to notify height:', error);
24511
+ }
24512
+ }
24513
+
24514
+ function notifyWidth() {
24515
+ try {
24516
+ const width = document.body.scrollWidth;
24517
+ parent.postMessage({ type: 'iframe-width', width }, '*');
24518
+ } catch (error) {
24519
+ console.error('[iframe] Failed to notify width:', error);
24520
+ }
24521
+ }
24522
+
24523
+ function notifySize() {
24524
+ notifyHeight();
24525
+ notifyWidth();
24526
+ }
24527
+
24528
+ // Observe size changes
24529
+ const resizeObserver = new ResizeObserver(() => {
24530
+ notifySize();
24531
+ });
24532
+
24533
+ if (root) {
24534
+ resizeObserver.observe(root);
24535
+ }
24536
+
24537
+ // Also notify on initial load
24538
+ window.addEventListener('load', notifySize);
24539
+
24540
+ function executeScripts() {
24541
+ try {
24542
+ const scripts = root.querySelectorAll('script');
24543
+ const executedScripts = new Set();
24544
+
24545
+ scripts.forEach((oldScript) => {
24546
+ // \u901A\u8FC7\u5185\u5BB9\u54C8\u5E0C\u907F\u514D\u91CD\u590D\u6267\u884C\u76F8\u540C\u811A\u672C
24547
+ const scriptKey = oldScript.src || oldScript.textContent;
24548
+ if (executedScripts.has(scriptKey)) {
24549
+ oldScript.remove();
24550
+ return;
24551
+ }
24552
+ executedScripts.add(scriptKey);
24553
+
24554
+ const newScript = document.createElement('script');
24555
+
24556
+ // Copy attributes
24557
+ Array.from(oldScript.attributes).forEach(attr => {
24558
+ newScript.setAttribute(attr.name, attr.value);
24559
+ });
24560
+
24561
+ // Copy content
24562
+ if (oldScript.src) {
24563
+ newScript.src = oldScript.src;
24564
+ } else {
24565
+ newScript.textContent = oldScript.textContent;
24566
+ }
24567
+
24568
+ // Replace old script with new one to execute it
24569
+ oldScript.parentNode.replaceChild(newScript, oldScript);
24570
+ });
24571
+ } catch (error) {
24572
+ console.error('[iframe] Script execution error:', error);
24573
+ parent.postMessage({ type: 'iframe-error', error: error.message }, '*');
24574
+ }
24575
+ }
24576
+
24577
+ // Listen for messages from parent
24578
+ window.addEventListener('message', function(event) {
24579
+ try {
24580
+ const message = event.data;
24581
+
24582
+ if (!message || typeof message !== 'object') {
24583
+ return;
24584
+ }
24585
+
24586
+ switch (message.type) {
24587
+ case 'stream-chunk':
24588
+ if (message.chunk) {
24589
+ tagBalancer.parseChunk(message.chunk);
24590
+ scheduleRender();
24591
+ }
24592
+ break;
24593
+
24594
+ case 'execute-scripts':
24595
+ // \u5EF6\u8FDF\u6267\u884C\u811A\u672C\uFF0C\u786E\u4FDD render \u5DF2\u5B8C\u6210
24596
+ setTimeout(() => {
24597
+ executeScripts();
24598
+ }, 100);
24599
+ break;
24600
+ }
24601
+ } catch (error) {
24602
+ parent.postMessage({ type: 'iframe-error', error: error.message }, '*');
24603
+ }
24604
+ });
24605
+
24606
+ // Global sendPrompt function for widgets to communicate with parent
24607
+ window.sendPrompt = function(text) {
24608
+ if (typeof text !== 'string') {
24609
+ console.error('[iframe] sendPrompt requires a string argument');
24610
+ return;
24611
+ }
24612
+ parent.postMessage({ type: 'widget-prompt', text: text }, '*');
24613
+ };
24614
+
24615
+ // Also expose openLink for opening URLs
24616
+ window.openLink = function(url) {
24617
+ if (typeof url !== 'string') {
24618
+ console.error('[iframe] openLink requires a string argument');
24619
+ return;
24620
+ }
24621
+ parent.postMessage({ type: 'widget-open-link', url: url }, '*');
24622
+ };
24623
+
24624
+ // Signal that iframe is ready (only if morphdom was already loaded)
24625
+ if (typeof morphdom !== 'undefined') {
24626
+ parent.postMessage({ type: 'iframe-ready' }, '*');
24627
+ }
24628
+ </script>
24629
+ </body>
24630
+ </html>`;
24631
+ }
24632
+
24633
+ // src/streaming-html/StreamingHTMLRenderer.tsx
24634
+ import { jsx as jsx96, jsxs as jsxs69 } from "react/jsx-runtime";
24635
+ var StreamingHTMLRenderer = ({
24636
+ html,
24637
+ className = "",
24638
+ isComplete = false,
24639
+ onError,
24640
+ onPrompt,
24641
+ title,
24642
+ loadingMessages
24643
+ }) => {
24644
+ const iframeRef = useRef22(null);
24645
+ const containerRef = useRef22(null);
24646
+ const resizeObserverRef = useRef22(null);
24647
+ const prevHTMLRef = useRef22("");
24648
+ const isReadyRef = useRef22(false);
24649
+ const pendingChunksRef = useRef22([]);
24650
+ const isCompleteRef = useRef22(isComplete);
24651
+ const isScriptExecuted = useRef22(false);
24652
+ const [iframeHeight, setIframeHeight] = React50.useState(0);
24653
+ const [iframeWidth, setIframeWidth] = React50.useState(void 0);
24654
+ const [currentMessageIndex, setCurrentMessageIndex] = useState59(0);
24655
+ const [showLoading, setShowLoading] = useState59(true);
24656
+ useEffect37(() => {
24657
+ isCompleteRef.current = isComplete;
24658
+ }, [isComplete]);
24659
+ useEffect37(() => {
24660
+ if (iframeHeight > 0) {
24661
+ setShowLoading(false);
24662
+ return;
24663
+ }
24664
+ if (!loadingMessages || loadingMessages.length === 0) {
24665
+ setShowLoading(false);
24666
+ return;
24667
+ }
24668
+ setShowLoading(true);
24669
+ if (loadingMessages.length === 1) {
24670
+ setCurrentMessageIndex(0);
24671
+ return;
24672
+ }
24673
+ const interval = setInterval(() => {
24674
+ setCurrentMessageIndex((prev) => {
24675
+ if (prev >= loadingMessages.length - 1) {
24676
+ clearInterval(interval);
24677
+ return prev;
24678
+ }
24679
+ return prev + 1;
24680
+ });
24681
+ }, 1500);
24682
+ return () => clearInterval(interval);
24683
+ }, [iframeHeight, loadingMessages]);
24684
+ const executeScripts = useCallback26(() => {
24685
+ if (isScriptExecuted.current) {
24686
+ console.log("[StreamingHTMLRenderer] scripts is executed");
24687
+ return;
24688
+ }
24689
+ console.log("[StreamingHTMLRenderer] Executing scripts...");
24690
+ const iframe = iframeRef.current;
24691
+ if (!iframe || !iframe.contentWindow) {
24692
+ console.log("[StreamingHTMLRenderer] No iframe or contentWindow");
24693
+ return;
24694
+ }
24695
+ try {
24696
+ console.log("[StreamingHTMLRenderer] Sending execute-scripts message");
24697
+ isScriptExecuted.current = true;
24698
+ iframe.contentWindow.postMessage(
24699
+ { type: "execute-scripts" },
24700
+ "*"
24701
+ );
24702
+ } catch (error) {
24703
+ console.error("[StreamingHTMLRenderer] Failed to execute scripts:", error);
24704
+ const streamingError = {
24705
+ type: "POSTMESSAGE_ERROR",
24706
+ message: error instanceof Error ? error.message : "Failed to execute scripts in iframe"
24707
+ };
24708
+ onError?.(streamingError);
24709
+ }
24710
+ }, [onError]);
24711
+ const sendChunk = useCallback26((chunk) => {
24712
+ const iframe = iframeRef.current;
24713
+ if (!iframe || !iframe.contentWindow) {
24714
+ return;
24715
+ }
24716
+ if (!isReadyRef.current) {
24717
+ console.log("[StreamingHTMLRenderer] Iframe not ready, queueing chunk");
24718
+ pendingChunksRef.current.push(chunk);
24719
+ return;
24720
+ }
24721
+ try {
24722
+ iframe.contentWindow.postMessage(
24723
+ { type: "stream-chunk", chunk },
24724
+ "*"
24725
+ );
24726
+ } catch (error) {
24727
+ console.error("[StreamingHTMLRenderer] Failed to send chunk:", error);
24728
+ const streamingError = {
24729
+ type: "POSTMESSAGE_ERROR",
24730
+ message: error instanceof Error ? error.message : "Failed to send chunk to iframe"
24731
+ };
24732
+ onError?.(streamingError);
24733
+ }
24734
+ }, [onError]);
24735
+ useEffect37(() => {
24736
+ const handleMessage = (event) => {
24737
+ const iframe = iframeRef.current;
24738
+ if (!iframe || event.source !== iframe.contentWindow) {
24739
+ return;
24740
+ }
24741
+ const message19 = event.data;
24742
+ if (!message19 || typeof message19 !== "object") {
24743
+ return;
24744
+ }
24745
+ switch (message19.type) {
24746
+ case "iframe-ready":
24747
+ console.log("[StreamingHTMLRenderer] Iframe ready");
24748
+ isReadyRef.current = true;
24749
+ while (pendingChunksRef.current.length > 0) {
24750
+ const chunk = pendingChunksRef.current.shift();
24751
+ if (chunk) {
24752
+ sendChunk(chunk);
24753
+ }
24754
+ }
24755
+ if (isCompleteRef.current) {
24756
+ executeScripts();
24757
+ }
24758
+ break;
24759
+ case "iframe-height":
24760
+ if (typeof message19.height === "number" && message19.height > 0) {
24761
+ setIframeHeight(message19.height);
24762
+ }
24763
+ break;
24764
+ case "iframe-error":
24765
+ const streamingError = {
24766
+ type: "RENDER_ERROR",
24767
+ message: message19.error || "Unknown iframe error"
24768
+ };
24769
+ onError?.(streamingError);
24770
+ break;
24771
+ case "widget-prompt":
24772
+ if (typeof message19.text === "string") {
24773
+ onPrompt?.(message19.text);
24774
+ }
24775
+ break;
24776
+ case "widget-open-link":
24777
+ if (typeof message19.url === "string") {
24778
+ window.open(message19.url, "_blank", "noopener,noreferrer");
24779
+ }
24780
+ break;
24781
+ }
24782
+ };
24783
+ window.addEventListener("message", handleMessage);
24784
+ return () => {
24785
+ window.removeEventListener("message", handleMessage);
24786
+ };
24787
+ }, [onError, onPrompt, sendChunk, executeScripts]);
24788
+ useEffect37(() => {
24789
+ if (html === prevHTMLRef.current) {
24790
+ return;
24791
+ }
24792
+ const prevLength = prevHTMLRef.current.length;
24793
+ const newChunk = html.slice(prevLength);
24794
+ prevHTMLRef.current = html;
24795
+ if (newChunk) {
24796
+ sendChunk(newChunk);
24797
+ }
24798
+ }, [html, sendChunk]);
24799
+ useEffect37(() => {
24800
+ if (isComplete && isReadyRef.current) {
24801
+ executeScripts();
24802
+ }
24803
+ }, [isComplete, executeScripts]);
24804
+ useEffect37(() => {
24805
+ const container = containerRef.current;
24806
+ if (!container) return;
24807
+ const antBubble = container.closest(".ant-bubble");
24808
+ if (!antBubble) {
24809
+ console.warn("[StreamingHTMLRenderer] .ant-bubble ancestor not found");
24810
+ return;
24811
+ }
24812
+ resizeObserverRef.current = new ResizeObserver((entries) => {
24813
+ for (const entry of entries) {
24814
+ const width = entry.contentRect.width;
24815
+ if (width > 0) {
24816
+ setIframeWidth(width);
24817
+ }
24818
+ }
24819
+ });
24820
+ resizeObserverRef.current.observe(antBubble);
24821
+ const initialWidth = antBubble.getBoundingClientRect().width;
24822
+ if (initialWidth > 0) {
24823
+ setIframeWidth(initialWidth);
24824
+ }
24825
+ return () => {
24826
+ resizeObserverRef.current?.disconnect();
24827
+ resizeObserverRef.current = null;
24828
+ };
24829
+ }, []);
24830
+ useEffect37(() => {
24831
+ return () => {
24832
+ isReadyRef.current = false;
24833
+ pendingChunksRef.current = [];
24834
+ prevHTMLRef.current = "";
24835
+ };
24836
+ }, []);
24837
+ return /* @__PURE__ */ jsxs69(
24838
+ "div",
24839
+ {
24840
+ ref: containerRef,
24841
+ className: `streaming-html-renderer ${className}`,
24842
+ style: { minHeight: "100px", position: "relative" },
24843
+ children: [
24844
+ showLoading && /* @__PURE__ */ jsxs69(
24845
+ "div",
24846
+ {
24847
+ style: {
24848
+ position: "absolute",
24849
+ top: 0,
24850
+ left: 0,
24851
+ right: 0,
24852
+ bottom: 0,
24853
+ display: "flex",
24854
+ alignItems: "center",
24855
+ justifyContent: "center",
24856
+ borderRadius: radius.lg,
24857
+ background: `linear-gradient(90deg, ${colors.light.surfaceHover} 25%, ${colors.light.surface} 50%, ${colors.light.surfaceHover} 75%)`,
24858
+ backgroundSize: "200% 100%",
24859
+ animation: "shimmer 1.5s infinite",
24860
+ zIndex: 10
24861
+ },
24862
+ children: [
24863
+ /* @__PURE__ */ jsx96("style", { children: `
24864
+ @keyframes shimmer {
24865
+ 0% { background-position: -200% 0; }
24866
+ 100% { background-position: 200% 0; }
24867
+ }
24868
+ ` }),
24869
+ /* @__PURE__ */ jsx96(
24870
+ "span",
24871
+ {
24872
+ style: {
24873
+ fontSize: "14px",
24874
+ color: colors.light.textSecondary,
24875
+ textAlign: "center",
24876
+ padding: "0 16px"
24877
+ },
24878
+ children: loadingMessages?.[currentMessageIndex] || "Loading..."
24879
+ }
24880
+ )
24881
+ ]
24882
+ }
24883
+ ),
24884
+ /* @__PURE__ */ jsx96(
24885
+ "iframe",
24886
+ {
24887
+ ref: iframeRef,
24888
+ srcDoc: generateIframeSrcdoc(),
24889
+ sandbox: "allow-scripts",
24890
+ style: {
24891
+ width: iframeWidth ? `${iframeWidth}px` : "100%",
24892
+ height: iframeHeight > 0 ? `${iframeHeight}px` : "100px",
24893
+ border: "none",
24894
+ display: "block",
24895
+ overflow: "hidden"
24896
+ },
24897
+ title
24898
+ }
24899
+ )
24900
+ ]
24901
+ }
24902
+ );
24903
+ };
24904
+ var StreamingHTMLRenderer_default = StreamingHTMLRenderer;
24905
+
24906
+ // src/components/GenUI/elements/ShowWidget.tsx
24907
+ import { jsx as jsx97, jsxs as jsxs70 } from "react/jsx-runtime";
24908
+ var ShowWidget = ({
24909
+ data,
24910
+ component_key,
24911
+ interactive = true
24912
+ }) => {
24913
+ const toolCallData = data;
24914
+ const { title, loading_messages, widget_code } = toolCallData?.args || {};
24915
+ const { openSideApp } = useChatUIContext();
24916
+ const { sendMessage } = useAgentChat();
24917
+ if (!toolCallData) {
24918
+ return null;
24919
+ }
24920
+ let isComplete = false;
24921
+ let finalHTML = widget_code || "";
24922
+ if (toolCallData?.response) {
24923
+ try {
24924
+ const responseObj = JSON.parse(toolCallData.response);
24925
+ if (toolCallData.status === "success") {
24926
+ isComplete = true;
24927
+ finalHTML = responseObj.widget_code || widget_code || "";
24928
+ }
24929
+ } catch (e) {
24930
+ console.warn("Failed to parse tool response:", e);
24931
+ }
24932
+ }
24933
+ const sendPrompt = useCallback27((text) => {
24934
+ sendMessage({
24935
+ input: {
24936
+ message: text
24937
+ }
24938
+ });
24939
+ }, [sendMessage]);
24940
+ const handleOpenInSideApp = useCallback27(() => {
24941
+ openSideApp({
24942
+ component_key: "show_widget",
24943
+ data: {
24944
+ widget_code: finalHTML,
24945
+ title: title || "Widget"
24946
+ },
24947
+ message: title || "Widget"
24948
+ });
24949
+ }, [openSideApp, finalHTML, title]);
24950
+ return /* @__PURE__ */ jsxs70("div", { style: {
24951
+ display: "flex",
24952
+ flexDirection: "column",
24953
+ borderRadius: radius.lg,
24954
+ overflow: "hidden"
24955
+ }, children: [
24956
+ isComplete && /* @__PURE__ */ jsxs70(
24957
+ "div",
24958
+ {
24959
+ style: {
24960
+ display: "flex",
24961
+ alignItems: "center",
24962
+ justifyContent: "center",
24963
+ padding: "8px 12px",
24964
+ position: "relative"
24965
+ },
24966
+ children: [
24967
+ /* @__PURE__ */ jsx97(
24968
+ Typography46.Text,
24969
+ {
24970
+ strong: true,
24971
+ style: {
24972
+ fontSize: "14px",
24973
+ color: colors.light.text
24974
+ },
24975
+ children: title || "Widget"
24976
+ }
24977
+ ),
24978
+ /* @__PURE__ */ jsx97(
24979
+ Button44,
24980
+ {
24981
+ type: "text",
24982
+ size: "small",
24983
+ icon: /* @__PURE__ */ jsx97(ExpandOutlined2, {}),
24984
+ onClick: handleOpenInSideApp,
24985
+ style: {
24986
+ position: "absolute",
24987
+ right: 8
24988
+ },
24989
+ title: "Open in side app"
24990
+ }
24991
+ )
24992
+ ]
24993
+ }
24994
+ ),
24995
+ /* @__PURE__ */ jsx97("div", { style: { position: "relative", flex: 1 }, children: /* @__PURE__ */ jsx97(
24996
+ StreamingHTMLRenderer_default,
24997
+ {
24998
+ html: finalHTML,
24999
+ isComplete,
25000
+ onError: (err) => console.error("Widget render error:", err),
25001
+ onPrompt: sendPrompt,
25002
+ loadingMessages: loading_messages
25003
+ }
25004
+ ) })
25005
+ ] });
25006
+ };
25007
+
25008
+ // src/components/GenUI/elements/ShowWidgetApp.tsx
25009
+ import { useCallback as useCallback28 } from "react";
25010
+ import { jsx as jsx98 } from "react/jsx-runtime";
25011
+ var ShowWidgetApp = ({
25012
+ data
25013
+ }) => {
25014
+ const { widget_code, title } = data || {};
25015
+ const { sendMessage } = useAgentChat();
25016
+ const sendPrompt = useCallback28(
25017
+ (text) => {
25018
+ sendMessage({
25019
+ input: {
25020
+ message: text
25021
+ }
25022
+ });
25023
+ },
25024
+ [sendMessage]
25025
+ );
25026
+ if (!widget_code) {
25027
+ return null;
25028
+ }
25029
+ return /* @__PURE__ */ jsx98("div", { style: { padding: 24 }, children: /* @__PURE__ */ jsx98(
25030
+ StreamingHTMLRenderer_default,
25031
+ {
25032
+ html: widget_code,
25033
+ isComplete: true,
25034
+ onError: (err) => console.error("Widget render error:", err),
25035
+ onPrompt: sendPrompt
25036
+ }
25037
+ ) });
25038
+ };
25039
+
23931
25040
  // src/components/GenUI/elements/builtIns.tsx
23932
25041
  var elements = {
23933
25042
  action_show_attachments_uploader: {
@@ -24008,6 +25117,10 @@ var elements = {
24008
25117
  mailbox: {
24009
25118
  card_view: TeamChat,
24010
25119
  side_app_view: MailboxPanel
25120
+ },
25121
+ show_widget: {
25122
+ card_view: ShowWidget,
25123
+ side_app_view: ShowWidgetApp
24011
25124
  }
24012
25125
  };
24013
25126
 
@@ -24027,8 +25140,8 @@ var regsiterElement = (language, ElementMeta) => {
24027
25140
  // src/components/Chat/SideAppViewBrowser.tsx
24028
25141
  import { Dropdown as Dropdown2, Tooltip as Tooltip22 } from "antd";
24029
25142
  import { createStyles as createStyles28 } from "antd-style";
24030
- import { useEffect as useEffect37, useState as useState59 } from "react";
24031
- import { Fragment as Fragment21, jsx as jsx96, jsxs as jsxs69 } from "react/jsx-runtime";
25143
+ import { useEffect as useEffect38, useState as useState60 } from "react";
25144
+ import { Fragment as Fragment21, jsx as jsx99, jsxs as jsxs71 } from "react/jsx-runtime";
24032
25145
  var useStyle12 = createStyles28(({ token, css }) => {
24033
25146
  return {
24034
25147
  container: css`
@@ -24205,15 +25318,15 @@ var useStyle12 = createStyles28(({ token, css }) => {
24205
25318
  });
24206
25319
  var EmptySideAppView = ({ component_key, data }) => {
24207
25320
  if (data?.component) {
24208
- return /* @__PURE__ */ jsx96(Fragment21, { children: data.component });
25321
+ return /* @__PURE__ */ jsx99(Fragment21, { children: data.component });
24209
25322
  }
24210
- return /* @__PURE__ */ jsxs69("div", { children: [
24211
- /* @__PURE__ */ jsx96("p", { children: "Component view not found" }),
24212
- /* @__PURE__ */ jsx96("pre", { children: JSON.stringify({ component_key, data }, null, 2) })
25323
+ return /* @__PURE__ */ jsxs71("div", { children: [
25324
+ /* @__PURE__ */ jsx99("p", { children: "Component view not found" }),
25325
+ /* @__PURE__ */ jsx99("pre", { children: JSON.stringify({ component_key, data }, null, 2) })
24213
25326
  ] });
24214
25327
  };
24215
25328
  var getTabIcon = (componentKey) => {
24216
- return /* @__PURE__ */ jsx96(AppstoreOutlined, { style: { fontSize: 12, opacity: 0.6 } });
25329
+ return /* @__PURE__ */ jsx99(AppstoreOutlined, { style: { fontSize: 12, opacity: 0.6 } });
24217
25330
  };
24218
25331
  var SideAppViewBrowser = ({ region = "side" }) => {
24219
25332
  const { styles } = useStyle12();
@@ -24225,11 +25338,11 @@ var SideAppViewBrowser = ({ region = "side" }) => {
24225
25338
  } = useChatUIContext();
24226
25339
  const selectedCard = region === "side" ? sideAppSelectedCard : contextAppSelectedCard;
24227
25340
  const closeApp = region === "side" ? closeSideApp : closeContentApp;
24228
- const [activeKey, setActiveKey] = useState59(
25341
+ const [activeKey, setActiveKey] = useState60(
24229
25342
  JSON.stringify(selectedCard)
24230
25343
  );
24231
- const [hoveredTab, setHoveredTab] = useState59(null);
24232
- const [items, setItems] = useState59([]);
25344
+ const [hoveredTab, setHoveredTab] = useState60(null);
25345
+ const [items, setItems] = useState60([]);
24233
25346
  const add = (key, label, children, componentKey) => {
24234
25347
  const newPanes = [...items, { label, children, key, componentKey }];
24235
25348
  setItems(newPanes);
@@ -24256,7 +25369,7 @@ var SideAppViewBrowser = ({ region = "side" }) => {
24256
25369
  const switchTab = (key) => {
24257
25370
  setActiveKey(key);
24258
25371
  };
24259
- useEffect37(() => {
25372
+ useEffect38(() => {
24260
25373
  if (!selectedCard) return;
24261
25374
  const key = JSON.stringify(selectedCard);
24262
25375
  if (items.find((item) => item.key === key)) {
@@ -24271,7 +25384,7 @@ var SideAppViewBrowser = ({ region = "side" }) => {
24271
25384
  add(
24272
25385
  key,
24273
25386
  selectedCard?.message || selectedCard?.data?.message || "Unnamed",
24274
- /* @__PURE__ */ jsx96(
25387
+ /* @__PURE__ */ jsx99(
24275
25388
  SideAppView,
24276
25389
  {
24277
25390
  component_key: selectedCard?.component_key || "",
@@ -24285,7 +25398,7 @@ var SideAppViewBrowser = ({ region = "side" }) => {
24285
25398
  const activeItem = items.find((item) => item.key === activeKey);
24286
25399
  const dropdownItems = items.map((item) => ({
24287
25400
  key: item.key,
24288
- label: /* @__PURE__ */ jsxs69(
25401
+ label: /* @__PURE__ */ jsxs71(
24289
25402
  "div",
24290
25403
  {
24291
25404
  style: {
@@ -24296,8 +25409,8 @@ var SideAppViewBrowser = ({ region = "side" }) => {
24296
25409
  },
24297
25410
  children: [
24298
25411
  getTabIcon(item.componentKey),
24299
- /* @__PURE__ */ jsx96("span", { style: { flex: 1 }, children: item.label }),
24300
- /* @__PURE__ */ jsx96(
25412
+ /* @__PURE__ */ jsx99("span", { style: { flex: 1 }, children: item.label }),
25413
+ /* @__PURE__ */ jsx99(
24301
25414
  CloseOutlined2,
24302
25415
  {
24303
25416
  style: { fontSize: 10, opacity: 0.5 },
@@ -24312,9 +25425,9 @@ var SideAppViewBrowser = ({ region = "side" }) => {
24312
25425
  ),
24313
25426
  onClick: () => switchTab(item.key)
24314
25427
  }));
24315
- return /* @__PURE__ */ jsxs69("div", { className: styles.container, children: [
24316
- /* @__PURE__ */ jsxs69("div", { className: styles.header, children: [
24317
- /* @__PURE__ */ jsx96("div", { className: styles.tabsStrip, children: items.map((item) => /* @__PURE__ */ jsx96(Tooltip22, { title: item.label, placement: "bottom", children: /* @__PURE__ */ jsxs69(
25428
+ return /* @__PURE__ */ jsxs71("div", { className: styles.container, children: [
25429
+ /* @__PURE__ */ jsxs71("div", { className: styles.header, children: [
25430
+ /* @__PURE__ */ jsx99("div", { className: styles.tabsStrip, children: items.map((item) => /* @__PURE__ */ jsx99(Tooltip22, { title: item.label, placement: "bottom", children: /* @__PURE__ */ jsxs71(
24318
25431
  "div",
24319
25432
  {
24320
25433
  "data-tab-key": item.key,
@@ -24324,8 +25437,8 @@ var SideAppViewBrowser = ({ region = "side" }) => {
24324
25437
  onMouseLeave: () => setHoveredTab(null),
24325
25438
  children: [
24326
25439
  getTabIcon(item.componentKey),
24327
- /* @__PURE__ */ jsx96("span", { className: styles.tabLabel, children: item.label }),
24328
- /* @__PURE__ */ jsx96(
25440
+ /* @__PURE__ */ jsx99("span", { className: styles.tabLabel, children: item.label }),
25441
+ /* @__PURE__ */ jsx99(
24329
25442
  "span",
24330
25443
  {
24331
25444
  className: `${styles.closeIndicator} ${hoveredTab === item.key || item.key === activeKey ? "always-visible" : ""}`,
@@ -24333,39 +25446,39 @@ var SideAppViewBrowser = ({ region = "side" }) => {
24333
25446
  e.stopPropagation();
24334
25447
  remove(item.key);
24335
25448
  },
24336
- children: /* @__PURE__ */ jsx96(CloseOutlined2, { style: { fontSize: 10 } })
25449
+ children: /* @__PURE__ */ jsx99(CloseOutlined2, { style: { fontSize: 10 } })
24337
25450
  }
24338
25451
  )
24339
25452
  ]
24340
25453
  }
24341
25454
  ) }, item.key)) }),
24342
- /* @__PURE__ */ jsxs69("div", { className: styles.actions, children: [
24343
- items.length > 0 && /* @__PURE__ */ jsx96("div", { className: styles.tabCounter, children: items.length }),
24344
- items.length > 1 && /* @__PURE__ */ jsx96(
25455
+ /* @__PURE__ */ jsxs71("div", { className: styles.actions, children: [
25456
+ items.length > 0 && /* @__PURE__ */ jsx99("div", { className: styles.tabCounter, children: items.length }),
25457
+ items.length > 1 && /* @__PURE__ */ jsx99(
24345
25458
  Dropdown2,
24346
25459
  {
24347
25460
  menu: { items: dropdownItems },
24348
25461
  placement: "bottomRight",
24349
25462
  trigger: ["click"],
24350
- children: /* @__PURE__ */ jsx96("button", { className: styles.actionBtn, title: "All tabs", children: /* @__PURE__ */ jsx96(MoreOutlined3, {}) })
25463
+ children: /* @__PURE__ */ jsx99("button", { className: styles.actionBtn, title: "All tabs", children: /* @__PURE__ */ jsx99(MoreOutlined3, {}) })
24351
25464
  }
24352
25465
  ),
24353
- /* @__PURE__ */ jsx96(Tooltip22, { title: "Close", children: /* @__PURE__ */ jsx96("button", { className: styles.actionBtn, onClick: closeApp, children: /* @__PURE__ */ jsx96(CloseOutlined2, {}) }) })
25466
+ /* @__PURE__ */ jsx99(Tooltip22, { title: "Close", children: /* @__PURE__ */ jsx99("button", { className: styles.actionBtn, onClick: closeApp, children: /* @__PURE__ */ jsx99(CloseOutlined2, {}) }) })
24354
25467
  ] })
24355
25468
  ] }),
24356
- /* @__PURE__ */ jsx96("div", { className: styles.content, children: activeItem ? /* @__PURE__ */ jsx96("div", { className: styles.contentWrapper, children: activeItem.children }, activeItem.key) : /* @__PURE__ */ jsxs69("div", { className: styles.emptyState, children: [
24357
- /* @__PURE__ */ jsx96(AppstoreOutlined, { className: "icon" }),
24358
- /* @__PURE__ */ jsx96("span", { children: "Select an app to start" })
25469
+ /* @__PURE__ */ jsx99("div", { className: styles.content, children: activeItem ? /* @__PURE__ */ jsx99("div", { className: styles.contentWrapper, children: activeItem.children }, activeItem.key) : /* @__PURE__ */ jsxs71("div", { className: styles.emptyState, children: [
25470
+ /* @__PURE__ */ jsx99(AppstoreOutlined, { className: "icon" }),
25471
+ /* @__PURE__ */ jsx99("span", { children: "Select an app to start" })
24359
25472
  ] }) })
24360
25473
  ] });
24361
25474
  };
24362
25475
 
24363
25476
  // src/components/Chat/ProjectSelector.tsx
24364
- import { useState as useState60, useCallback as useCallback26, useMemo as useMemo26, useRef as useRef22 } from "react";
24365
- import { Modal as Modal16, Input as Input12, Button as Button44, message as message14 } from "antd";
25477
+ import { useState as useState61, useCallback as useCallback29, useMemo as useMemo26, useRef as useRef23 } from "react";
25478
+ import { Modal as Modal16, Input as Input12, Button as Button45, message as message15 } from "antd";
24366
25479
  import { createStyles as createStyles29 } from "antd-style";
24367
25480
  import { Folder, ChevronDown as ChevronDown4, Building2 as Building24 } from "lucide-react";
24368
- import { Fragment as Fragment22, jsx as jsx97, jsxs as jsxs70 } from "react/jsx-runtime";
25481
+ import { Fragment as Fragment22, jsx as jsx100, jsxs as jsxs72 } from "react/jsx-runtime";
24369
25482
  var PROJECT_NAME_MAX_LENGTH = 50;
24370
25483
  var useStyles17 = createStyles29(({ token, css }) => ({
24371
25484
  container: css`
@@ -24595,34 +25708,34 @@ var ProjectSelector = () => {
24595
25708
  setProject,
24596
25709
  createProject
24597
25710
  } = useWorkspaceContext();
24598
- const [isWorkspaceListOpen, setIsWorkspaceListOpen] = useState60(false);
24599
- const workspaceDropdownRef = useRef22(null);
24600
- const [isProjectListOpen, setIsProjectListOpen] = useState60(false);
24601
- const [isModalOpen, setIsModalOpen] = useState60(false);
24602
- const [projectName, setProjectName] = useState60("");
24603
- const [validationError, setValidationError] = useState60(null);
24604
- const [isCreating, setIsCreating] = useState60(false);
24605
- const projectNameInputRef = useRef22(null);
25711
+ const [isWorkspaceListOpen, setIsWorkspaceListOpen] = useState61(false);
25712
+ const workspaceDropdownRef = useRef23(null);
25713
+ const [isProjectListOpen, setIsProjectListOpen] = useState61(false);
25714
+ const [isModalOpen, setIsModalOpen] = useState61(false);
25715
+ const [projectName, setProjectName] = useState61("");
25716
+ const [validationError, setValidationError] = useState61(null);
25717
+ const [isCreating, setIsCreating] = useState61(false);
25718
+ const projectNameInputRef = useRef23(null);
24606
25719
  const currentProject = useMemo26(() => {
24607
25720
  return projects.find((p) => p.id === projectId);
24608
25721
  }, [projects, projectId]);
24609
25722
  const currentWorkspace = useMemo26(() => {
24610
25723
  return workspaces.find((w) => w.id === workspaceId);
24611
25724
  }, [workspaces, workspaceId]);
24612
- const handleSelectProject = useCallback26((selectedProjectId) => {
25725
+ const handleSelectProject = useCallback29((selectedProjectId) => {
24613
25726
  setProject(selectedProjectId);
24614
25727
  setIsProjectListOpen(false);
24615
25728
  }, [setProject]);
24616
- const handleWorkspaceClick = useCallback26(() => {
25729
+ const handleWorkspaceClick = useCallback29(() => {
24617
25730
  setProject(null);
24618
25731
  }, [setProject]);
24619
- const toggleProjectList = useCallback26(() => {
25732
+ const toggleProjectList = useCallback29(() => {
24620
25733
  setIsProjectListOpen((prev) => !prev);
24621
25734
  }, []);
24622
- const toggleWorkspaceList = useCallback26(() => {
25735
+ const toggleWorkspaceList = useCallback29(() => {
24623
25736
  setIsWorkspaceListOpen((prev) => !prev);
24624
25737
  }, []);
24625
- const validateProjectName = useCallback26((name) => {
25738
+ const validateProjectName = useCallback29((name) => {
24626
25739
  const trimmed = name.trim();
24627
25740
  if (!trimmed) return "Project name is required";
24628
25741
  if (trimmed.length > PROJECT_NAME_MAX_LENGTH) {
@@ -24630,10 +25743,10 @@ var ProjectSelector = () => {
24630
25743
  }
24631
25744
  return null;
24632
25745
  }, []);
24633
- const handleOpenModal = useCallback26((e) => {
25746
+ const handleOpenModal = useCallback29((e) => {
24634
25747
  e.stopPropagation();
24635
25748
  if (!workspaceId) {
24636
- message14.warning("Please select a workspace first");
25749
+ message15.warning("Please select a workspace first");
24637
25750
  return;
24638
25751
  }
24639
25752
  setProjectName("");
@@ -24641,7 +25754,7 @@ var ProjectSelector = () => {
24641
25754
  setIsModalOpen(true);
24642
25755
  setTimeout(() => projectNameInputRef.current?.input?.focus(), 100);
24643
25756
  }, [workspaceId]);
24644
- const handleCloseModal = useCallback26(() => {
25757
+ const handleCloseModal = useCallback29(() => {
24645
25758
  setIsModalOpen(false);
24646
25759
  setProjectName("");
24647
25760
  setValidationError(null);
@@ -24651,7 +25764,7 @@ var ProjectSelector = () => {
24651
25764
  setProjectName(value);
24652
25765
  setValidationError(validateProjectName(value));
24653
25766
  };
24654
- const handleCreateProject = useCallback26(async () => {
25767
+ const handleCreateProject = useCallback29(async () => {
24655
25768
  if (!workspaceId) return;
24656
25769
  const trimmed = projectName.trim();
24657
25770
  const error = validateProjectName(trimmed);
@@ -24667,7 +25780,7 @@ var ProjectSelector = () => {
24667
25780
  setProjectName("");
24668
25781
  setValidationError(null);
24669
25782
  setProject(project.id);
24670
- message14.success(`Project "${project.name}" created`);
25783
+ message15.success(`Project "${project.name}" created`);
24671
25784
  } catch (err) {
24672
25785
  const errMsg = err instanceof Error ? err.message : "Failed to create project";
24673
25786
  setValidationError(errMsg);
@@ -24683,40 +25796,40 @@ var ProjectSelector = () => {
24683
25796
  }
24684
25797
  };
24685
25798
  const isProjectNameValid = !validateProjectName(projectName.trim());
24686
- return /* @__PURE__ */ jsxs70(Fragment22, { children: [
24687
- /* @__PURE__ */ jsx97("div", { className: styles.container, children: /* @__PURE__ */ jsxs70("div", { className: styles.selectorWrapper, children: [
24688
- /* @__PURE__ */ jsx97("div", { style: { position: "relative" }, ref: workspaceDropdownRef, children: /* @__PURE__ */ jsx97(
25799
+ return /* @__PURE__ */ jsxs72(Fragment22, { children: [
25800
+ /* @__PURE__ */ jsx100("div", { className: styles.container, children: /* @__PURE__ */ jsxs72("div", { className: styles.selectorWrapper, children: [
25801
+ /* @__PURE__ */ jsx100("div", { style: { position: "relative" }, ref: workspaceDropdownRef, children: /* @__PURE__ */ jsx100(
24689
25802
  "button",
24690
25803
  {
24691
25804
  className: styles.workspaceButton,
24692
25805
  onClick: handleWorkspaceClick,
24693
25806
  title: currentWorkspace?.name || "Select Workspace",
24694
- children: /* @__PURE__ */ jsx97("div", { className: styles.workspaceButtonIcon, children: /* @__PURE__ */ jsx97(Building24, { size: 16 }) })
25807
+ children: /* @__PURE__ */ jsx100("div", { className: styles.workspaceButtonIcon, children: /* @__PURE__ */ jsx100(Building24, { size: 16 }) })
24695
25808
  }
24696
25809
  ) }),
24697
- /* @__PURE__ */ jsx97("span", { className: styles.divider, children: "/" }),
24698
- /* @__PURE__ */ jsxs70("div", { className: styles.projectTrigger, onClick: toggleProjectList, children: [
24699
- /* @__PURE__ */ jsx97("div", { className: styles.projectTriggerIcon, children: /* @__PURE__ */ jsx97(Folder, { size: 16 }) }),
24700
- /* @__PURE__ */ jsx97("div", { className: styles.projectTriggerInfo, children: /* @__PURE__ */ jsx97("div", { className: styles.projectTriggerName, children: currentProject?.name || "Select Project" }) }),
24701
- /* @__PURE__ */ jsx97("div", { className: `${styles.projectTriggerArrow} ${isProjectListOpen ? "expanded" : ""}`, children: /* @__PURE__ */ jsx97(ChevronDown4, { size: 14 }) })
25810
+ /* @__PURE__ */ jsx100("span", { className: styles.divider, children: "/" }),
25811
+ /* @__PURE__ */ jsxs72("div", { className: styles.projectTrigger, onClick: toggleProjectList, children: [
25812
+ /* @__PURE__ */ jsx100("div", { className: styles.projectTriggerIcon, children: /* @__PURE__ */ jsx100(Folder, { size: 16 }) }),
25813
+ /* @__PURE__ */ jsx100("div", { className: styles.projectTriggerInfo, children: /* @__PURE__ */ jsx100("div", { className: styles.projectTriggerName, children: currentProject?.name || "Select Project" }) }),
25814
+ /* @__PURE__ */ jsx100("div", { className: `${styles.projectTriggerArrow} ${isProjectListOpen ? "expanded" : ""}`, children: /* @__PURE__ */ jsx100(ChevronDown4, { size: 14 }) })
24702
25815
  ] }),
24703
- isProjectListOpen && /* @__PURE__ */ jsxs70("div", { className: styles.projectDropdown, children: [
24704
- projects.map((project) => /* @__PURE__ */ jsxs70(
25816
+ isProjectListOpen && /* @__PURE__ */ jsxs72("div", { className: styles.projectDropdown, children: [
25817
+ projects.map((project) => /* @__PURE__ */ jsxs72(
24705
25818
  "div",
24706
25819
  {
24707
25820
  className: `${styles.projectDropdownItem} ${project.id === projectId ? "active" : ""}`,
24708
25821
  onClick: () => handleSelectProject(project.id),
24709
25822
  children: [
24710
- /* @__PURE__ */ jsx97("div", { className: styles.projectDropdownItemIcon, children: /* @__PURE__ */ jsx97(Folder, { size: 14 }) }),
24711
- /* @__PURE__ */ jsx97("div", { className: project.id === projectId ? styles.projectDropdownItemNameActive : styles.projectDropdownItemName, children: project.name })
25823
+ /* @__PURE__ */ jsx100("div", { className: styles.projectDropdownItemIcon, children: /* @__PURE__ */ jsx100(Folder, { size: 14 }) }),
25824
+ /* @__PURE__ */ jsx100("div", { className: project.id === projectId ? styles.projectDropdownItemNameActive : styles.projectDropdownItemName, children: project.name })
24712
25825
  ]
24713
25826
  },
24714
25827
  project.id
24715
25828
  )),
24716
- projects.length === 0 && /* @__PURE__ */ jsx97("div", { className: styles.emptyState, children: "No projects" })
25829
+ projects.length === 0 && /* @__PURE__ */ jsx100("div", { className: styles.emptyState, children: "No projects" })
24717
25830
  ] })
24718
25831
  ] }) }),
24719
- /* @__PURE__ */ jsxs70(
25832
+ /* @__PURE__ */ jsxs72(
24720
25833
  Modal16,
24721
25834
  {
24722
25835
  title: "Create New Project",
@@ -24728,10 +25841,10 @@ var ProjectSelector = () => {
24728
25841
  maskClosable: !isCreating,
24729
25842
  keyboard: true,
24730
25843
  closable: true,
24731
- footer: /* @__PURE__ */ jsxs70("div", { className: styles.modalFooter, children: [
24732
- /* @__PURE__ */ jsx97(Button44, { onClick: handleCloseModal, disabled: isCreating, children: "Cancel" }),
24733
- /* @__PURE__ */ jsx97(
24734
- Button44,
25844
+ footer: /* @__PURE__ */ jsxs72("div", { className: styles.modalFooter, children: [
25845
+ /* @__PURE__ */ jsx100(Button45, { onClick: handleCloseModal, disabled: isCreating, children: "Cancel" }),
25846
+ /* @__PURE__ */ jsx100(
25847
+ Button45,
24735
25848
  {
24736
25849
  type: "primary",
24737
25850
  onClick: handleCreateProject,
@@ -24742,7 +25855,7 @@ var ProjectSelector = () => {
24742
25855
  )
24743
25856
  ] }),
24744
25857
  children: [
24745
- /* @__PURE__ */ jsx97(
25858
+ /* @__PURE__ */ jsx100(
24746
25859
  Input12,
24747
25860
  {
24748
25861
  ref: projectNameInputRef,
@@ -24754,7 +25867,7 @@ var ProjectSelector = () => {
24754
25867
  status: validationError ? "error" : void 0
24755
25868
  }
24756
25869
  ),
24757
- validationError && /* @__PURE__ */ jsx97("div", { style: { color: "#ff4d4f", fontSize: "12px", marginTop: "4px" }, children: validationError })
25870
+ validationError && /* @__PURE__ */ jsx100("div", { style: { color: "#ff4d4f", fontSize: "12px", marginTop: "4px" }, children: validationError })
24758
25871
  ]
24759
25872
  }
24760
25873
  )
@@ -24762,13 +25875,13 @@ var ProjectSelector = () => {
24762
25875
  };
24763
25876
 
24764
25877
  // src/components/Chat/LatticeChat.tsx
24765
- import { jsx as jsx98, jsxs as jsxs71 } from "react/jsx-runtime";
25878
+ import { jsx as jsx101, jsxs as jsxs73 } from "react/jsx-runtime";
24766
25879
  var LatticeChat = (props) => {
24767
25880
  const { assistant_id, thread_id = "", menu, header, ...chatingProps } = props;
24768
25881
  const { config } = useLatticeChatShellContext();
24769
25882
  const showWorkspaceSelector = config.enableWorkspace;
24770
- const leftTop = showWorkspaceSelector ? /* @__PURE__ */ jsx98(ProjectSelector, {}) : null;
24771
- return /* @__PURE__ */ jsx98(
25883
+ const leftTop = showWorkspaceSelector ? /* @__PURE__ */ jsx101(ProjectSelector, {}) : null;
25884
+ return /* @__PURE__ */ jsx101(
24772
25885
  AgentThreadProvider,
24773
25886
  {
24774
25887
  assistantId: assistant_id,
@@ -24778,7 +25891,7 @@ var LatticeChat = (props) => {
24778
25891
  enableReturnStateWhenStreamCompleted: true,
24779
25892
  enableResumeStream: true
24780
25893
  },
24781
- children: /* @__PURE__ */ jsx98(ChatUIContextProvider, { children: /* @__PURE__ */ jsxs71(
25894
+ children: /* @__PURE__ */ jsx101(ChatUIContextProvider, { children: /* @__PURE__ */ jsxs73(
24782
25895
  "div",
24783
25896
  {
24784
25897
  style: {
@@ -24789,13 +25902,13 @@ var LatticeChat = (props) => {
24789
25902
  },
24790
25903
  children: [
24791
25904
  header,
24792
- /* @__PURE__ */ jsx98(
25905
+ /* @__PURE__ */ jsx101(
24793
25906
  ColumnLayout,
24794
25907
  {
24795
25908
  menu,
24796
25909
  header: leftTop,
24797
- left: thread_id ? /* @__PURE__ */ jsx98(Chating, { ...chatingProps }) : /* @__PURE__ */ jsx98("div", { children: "Please create a conversation first" }),
24798
- right: /* @__PURE__ */ jsx98(SideAppViewBrowser, {})
25910
+ left: thread_id ? /* @__PURE__ */ jsx101(Chating, { ...chatingProps }) : /* @__PURE__ */ jsx101("div", { children: "Please create a conversation first" }),
25911
+ right: /* @__PURE__ */ jsx101(SideAppViewBrowser, {})
24799
25912
  }
24800
25913
  )
24801
25914
  ]
@@ -24809,7 +25922,7 @@ var LatticeChat = (props) => {
24809
25922
  import { Conversations } from "@ant-design/x";
24810
25923
  import { theme as theme14 } from "antd";
24811
25924
  import { useMemo as useMemo27 } from "react";
24812
- import { jsx as jsx99 } from "react/jsx-runtime";
25925
+ import { jsx as jsx102 } from "react/jsx-runtime";
24813
25926
  var AgentConversations = ({
24814
25927
  enableThreadCreation = true,
24815
25928
  enableThreadList = true
@@ -24848,7 +25961,7 @@ var AgentConversations = ({
24848
25961
  const creation = enableThreadCreation ? {
24849
25962
  onClick: newChatClick
24850
25963
  } : void 0;
24851
- return /* @__PURE__ */ jsx99(
25964
+ return /* @__PURE__ */ jsx102(
24852
25965
  Conversations,
24853
25966
  {
24854
25967
  creation,
@@ -24867,7 +25980,7 @@ var AgentConversations = ({
24867
25980
  import { useContext as useContext11 } from "react";
24868
25981
 
24869
25982
  // src/components/Chat/ChatSidebar.tsx
24870
- import { useState as useState62, useMemo as useMemo29, useCallback as useCallback29 } from "react";
25983
+ import { useState as useState63, useMemo as useMemo29, useCallback as useCallback32 } from "react";
24871
25984
  import { Drawer as Drawer2 } from "antd";
24872
25985
  import {
24873
25986
  History,
@@ -24878,11 +25991,11 @@ import {
24878
25991
  } from "lucide-react";
24879
25992
 
24880
25993
  // src/components/Chat/ProjectsMenuContent.tsx
24881
- import { useState as useState61, useEffect as useEffect38, useCallback as useCallback27, useMemo as useMemo28, useRef as useRef23 } from "react";
24882
- import { Spin as Spin15, Modal as Modal17, Input as Input13, Button as Button45, message as message15 } from "antd";
25994
+ import { useState as useState62, useEffect as useEffect39, useCallback as useCallback30, useMemo as useMemo28, useRef as useRef24 } from "react";
25995
+ import { Spin as Spin15, Modal as Modal17, Input as Input13, Button as Button46, message as message16 } from "antd";
24883
25996
  import { createStyles as createStyles30 } from "antd-style";
24884
25997
  import { Upload } from "lucide-react";
24885
- import { Fragment as Fragment23, jsx as jsx100, jsxs as jsxs72 } from "react/jsx-runtime";
25998
+ import { Fragment as Fragment23, jsx as jsx103, jsxs as jsxs74 } from "react/jsx-runtime";
24886
25999
  var PROJECT_NAME_MAX_LENGTH2 = 50;
24887
26000
  var useStyles18 = createStyles30(({ token, css }) => ({
24888
26001
  container: css`
@@ -25251,22 +26364,22 @@ var ProjectsMenuContent = () => {
25251
26364
  getFileViewUrl,
25252
26365
  uploadFileToFolder
25253
26366
  } = useWorkspaceContext();
25254
- const [folderAssets, setFolderAssets] = useState61({});
25255
- const [folderLoading, setFolderLoading] = useState61({});
25256
- const [isProjectListOpen, setIsProjectListOpen] = useState61(false);
25257
- const [uploadingFolder, setUploadingFolder] = useState61(null);
25258
- const [isModalOpen, setIsModalOpen] = useState61(false);
25259
- const [projectName, setProjectName] = useState61("");
25260
- const [validationError, setValidationError] = useState61(null);
25261
- const [isCreating, setIsCreating] = useState61(false);
25262
- const projectNameInputRef = useRef23(null);
26367
+ const [folderAssets, setFolderAssets] = useState62({});
26368
+ const [folderLoading, setFolderLoading] = useState62({});
26369
+ const [isProjectListOpen, setIsProjectListOpen] = useState62(false);
26370
+ const [uploadingFolder, setUploadingFolder] = useState62(null);
26371
+ const [isModalOpen, setIsModalOpen] = useState62(false);
26372
+ const [projectName, setProjectName] = useState62("");
26373
+ const [validationError, setValidationError] = useState62(null);
26374
+ const [isCreating, setIsCreating] = useState62(false);
26375
+ const projectNameInputRef = useRef24(null);
25263
26376
  const resourceFolders = useMemo28(() => {
25264
26377
  return config.resourceFolders && config.resourceFolders.length > 0 ? config.resourceFolders : [{ name: "/", displayName: "Project Assets", allowUpload: true }];
25265
26378
  }, [config.resourceFolders]);
25266
26379
  const currentProject = useMemo28(() => {
25267
26380
  return projects.find((p) => p.id === projectId);
25268
26381
  }, [projects, projectId]);
25269
- const loadAssetsForFolder = useCallback27(async (folder) => {
26382
+ const loadAssetsForFolder = useCallback30(async (folder) => {
25270
26383
  if (!workspaceId || !projectId) {
25271
26384
  setFolderAssets((prev) => ({ ...prev, [folder.name]: [] }));
25272
26385
  return;
@@ -25282,19 +26395,19 @@ var ProjectsMenuContent = () => {
25282
26395
  setFolderLoading((prev) => ({ ...prev, [folder.name]: false }));
25283
26396
  }
25284
26397
  }, [workspaceId, projectId, listPathByFolder]);
25285
- useEffect38(() => {
26398
+ useEffect39(() => {
25286
26399
  resourceFolders.forEach((folder) => {
25287
26400
  loadAssetsForFolder(folder);
25288
26401
  });
25289
26402
  }, [workspaceId, projectId, loadAssetsForFolder, resourceFolders]);
25290
- const handleSelectProject = useCallback27((selectedProjectId) => {
26403
+ const handleSelectProject = useCallback30((selectedProjectId) => {
25291
26404
  setProject(selectedProjectId);
25292
26405
  setIsProjectListOpen(false);
25293
26406
  }, [setProject]);
25294
- const toggleProjectList = useCallback27(() => {
26407
+ const toggleProjectList = useCallback30(() => {
25295
26408
  setIsProjectListOpen((prev) => !prev);
25296
26409
  }, []);
25297
- const validateProjectName = useCallback27((name) => {
26410
+ const validateProjectName = useCallback30((name) => {
25298
26411
  const trimmed = name.trim();
25299
26412
  if (!trimmed) return "Project name is required";
25300
26413
  if (trimmed.length > PROJECT_NAME_MAX_LENGTH2) {
@@ -25302,9 +26415,9 @@ var ProjectsMenuContent = () => {
25302
26415
  }
25303
26416
  return null;
25304
26417
  }, []);
25305
- const handleOpenModal = useCallback27(() => {
26418
+ const handleOpenModal = useCallback30(() => {
25306
26419
  if (!workspaceId) {
25307
- message15.warning("Please select a workspace first");
26420
+ message16.warning("Please select a workspace first");
25308
26421
  return;
25309
26422
  }
25310
26423
  setProjectName("");
@@ -25312,7 +26425,7 @@ var ProjectsMenuContent = () => {
25312
26425
  setIsModalOpen(true);
25313
26426
  setTimeout(() => projectNameInputRef.current?.input?.focus(), 100);
25314
26427
  }, [workspaceId]);
25315
- const handleCloseModal = useCallback27(() => {
26428
+ const handleCloseModal = useCallback30(() => {
25316
26429
  setIsModalOpen(false);
25317
26430
  setProjectName("");
25318
26431
  setValidationError(null);
@@ -25322,7 +26435,7 @@ var ProjectsMenuContent = () => {
25322
26435
  setProjectName(value);
25323
26436
  setValidationError(validateProjectName(value));
25324
26437
  };
25325
- const handleCreateProject = useCallback27(async () => {
26438
+ const handleCreateProject = useCallback30(async () => {
25326
26439
  if (!workspaceId) return;
25327
26440
  const trimmed = projectName.trim();
25328
26441
  const error = validateProjectName(trimmed);
@@ -25338,7 +26451,7 @@ var ProjectsMenuContent = () => {
25338
26451
  setProjectName("");
25339
26452
  setValidationError(null);
25340
26453
  setProject(project.id);
25341
- message15.success(`Project "${project.name}" created`);
26454
+ message16.success(`Project "${project.name}" created`);
25342
26455
  } catch (err) {
25343
26456
  const errMsg = err instanceof Error ? err.message : "Failed to create project";
25344
26457
  setValidationError(errMsg);
@@ -25356,7 +26469,7 @@ var ProjectsMenuContent = () => {
25356
26469
  const isProjectNameValid = !validateProjectName(projectName.trim());
25357
26470
  const handleUploadClick = async (folderName) => {
25358
26471
  if (!workspaceId || !projectId) {
25359
- message15.warning("Please select a workspace and project before uploading.");
26472
+ message16.warning("Please select a workspace and project before uploading.");
25360
26473
  return;
25361
26474
  }
25362
26475
  const input = document.createElement("input");
@@ -25370,14 +26483,14 @@ var ProjectsMenuContent = () => {
25370
26483
  setUploadingFolder(folderName);
25371
26484
  try {
25372
26485
  await uploadFileToFolder(folderName, file);
25373
- message15.success(`Uploaded "${file.name}" successfully`);
26486
+ message16.success(`Uploaded "${file.name}" successfully`);
25374
26487
  const folder = resourceFolders.find((f) => f.name === folderName);
25375
26488
  if (folder) {
25376
26489
  await loadAssetsForFolder(folder);
25377
26490
  }
25378
26491
  } catch (error) {
25379
26492
  const errMsg = error instanceof Error ? error.message : "Failed to upload file";
25380
- message15.error(errMsg);
26493
+ message16.error(errMsg);
25381
26494
  } finally {
25382
26495
  setUploadingFolder(null);
25383
26496
  input.remove();
@@ -25388,7 +26501,7 @@ var ProjectsMenuContent = () => {
25388
26501
  const handleAssetClick = (asset) => {
25389
26502
  const fileUrl = getFileViewUrl(asset.path);
25390
26503
  if (!fileUrl) {
25391
- message15.warning("Please select a workspace and project first.");
26504
+ message16.warning("Please select a workspace and project first.");
25392
26505
  return;
25393
26506
  }
25394
26507
  openSideApp({
@@ -25411,13 +26524,13 @@ var ProjectsMenuContent = () => {
25411
26524
  const parts = path.split(/[/\\]/);
25412
26525
  return parts[parts.length - 1];
25413
26526
  };
25414
- return /* @__PURE__ */ jsxs72("div", { className: styles.container, children: [
26527
+ return /* @__PURE__ */ jsxs74("div", { className: styles.container, children: [
25415
26528
  resourceFolders.map((folder) => {
25416
26529
  const assets = folderAssets[folder.name] || [];
25417
26530
  const isLoading = folderLoading[folder.name] || false;
25418
- return /* @__PURE__ */ jsxs72("div", { className: styles.section, children: [
25419
- /* @__PURE__ */ jsxs72("div", { className: styles.sectionHeader, children: [
25420
- /* @__PURE__ */ jsx100(
26531
+ return /* @__PURE__ */ jsxs74("div", { className: styles.section, children: [
26532
+ /* @__PURE__ */ jsxs74("div", { className: styles.sectionHeader, children: [
26533
+ /* @__PURE__ */ jsx103(
25421
26534
  "span",
25422
26535
  {
25423
26536
  className: styles.sectionTitle,
@@ -25426,46 +26539,46 @@ var ProjectsMenuContent = () => {
25426
26539
  children: folder.displayName || folder.name
25427
26540
  }
25428
26541
  ),
25429
- /* @__PURE__ */ jsx100("span", { className: styles.badge, children: assets.length })
26542
+ /* @__PURE__ */ jsx103("span", { className: styles.badge, children: assets.length })
25430
26543
  ] }),
25431
- isLoading ? /* @__PURE__ */ jsx100("div", { className: styles.loading, children: /* @__PURE__ */ jsx100(Spin15, { size: "small" }) }) : /* @__PURE__ */ jsxs72("div", { className: styles.assetList, children: [
25432
- assets.map((asset) => /* @__PURE__ */ jsxs72(
26544
+ isLoading ? /* @__PURE__ */ jsx103("div", { className: styles.loading, children: /* @__PURE__ */ jsx103(Spin15, { size: "small" }) }) : /* @__PURE__ */ jsxs74("div", { className: styles.assetList, children: [
26545
+ assets.map((asset) => /* @__PURE__ */ jsxs74(
25433
26546
  "div",
25434
26547
  {
25435
26548
  className: styles.assetItem,
25436
26549
  onClick: () => handleAssetClick(asset),
25437
26550
  title: getFileName(asset.name || asset.path),
25438
26551
  children: [
25439
- /* @__PURE__ */ jsx100("div", { className: styles.assetIcon, children: getFileIcon2(getFileName(asset.name || asset.path)) }),
25440
- /* @__PURE__ */ jsxs72("div", { className: styles.assetInfo, children: [
25441
- /* @__PURE__ */ jsx100("div", { className: styles.assetName, children: getFileName(asset.name || asset.path) }),
25442
- /* @__PURE__ */ jsx100("div", { className: styles.assetMeta, children: formatDate5(asset.modified_at) })
26552
+ /* @__PURE__ */ jsx103("div", { className: styles.assetIcon, children: getFileIcon2(getFileName(asset.name || asset.path)) }),
26553
+ /* @__PURE__ */ jsxs74("div", { className: styles.assetInfo, children: [
26554
+ /* @__PURE__ */ jsx103("div", { className: styles.assetName, children: getFileName(asset.name || asset.path) }),
26555
+ /* @__PURE__ */ jsx103("div", { className: styles.assetMeta, children: formatDate5(asset.modified_at) })
25443
26556
  ] })
25444
26557
  ]
25445
26558
  },
25446
26559
  asset.path
25447
26560
  )),
25448
- assets.length === 0 && /* @__PURE__ */ jsx100("div", { className: styles.emptyState, children: "No files in this folder" }),
25449
- folder.allowUpload && /* @__PURE__ */ jsx100(
26561
+ assets.length === 0 && /* @__PURE__ */ jsx103("div", { className: styles.emptyState, children: "No files in this folder" }),
26562
+ folder.allowUpload && /* @__PURE__ */ jsx103(
25450
26563
  "button",
25451
26564
  {
25452
26565
  type: "button",
25453
26566
  className: styles.uploadBtn,
25454
26567
  onClick: () => handleUploadClick(folder.name),
25455
26568
  disabled: !workspaceId || !projectId || uploadingFolder === folder.name,
25456
- children: uploadingFolder === folder.name ? /* @__PURE__ */ jsxs72(Fragment23, { children: [
25457
- /* @__PURE__ */ jsx100(Spin15, { size: "small" }),
25458
- /* @__PURE__ */ jsx100("span", { children: "Uploading..." })
25459
- ] }) : /* @__PURE__ */ jsxs72(Fragment23, { children: [
25460
- /* @__PURE__ */ jsx100(Upload, { size: 14 }),
25461
- /* @__PURE__ */ jsx100("span", { children: "Upload" })
26569
+ children: uploadingFolder === folder.name ? /* @__PURE__ */ jsxs74(Fragment23, { children: [
26570
+ /* @__PURE__ */ jsx103(Spin15, { size: "small" }),
26571
+ /* @__PURE__ */ jsx103("span", { children: "Uploading..." })
26572
+ ] }) : /* @__PURE__ */ jsxs74(Fragment23, { children: [
26573
+ /* @__PURE__ */ jsx103(Upload, { size: 14 }),
26574
+ /* @__PURE__ */ jsx103("span", { children: "Upload" })
25462
26575
  ] })
25463
26576
  }
25464
26577
  )
25465
26578
  ] })
25466
26579
  ] }, folder.name);
25467
26580
  }),
25468
- /* @__PURE__ */ jsxs72(
26581
+ /* @__PURE__ */ jsxs74(
25469
26582
  Modal17,
25470
26583
  {
25471
26584
  title: "Create New Project",
@@ -25477,10 +26590,10 @@ var ProjectsMenuContent = () => {
25477
26590
  maskClosable: !isCreating,
25478
26591
  keyboard: true,
25479
26592
  closable: true,
25480
- footer: /* @__PURE__ */ jsxs72("div", { className: styles.modalFooter, children: [
25481
- /* @__PURE__ */ jsx100(Button45, { onClick: handleCloseModal, disabled: isCreating, children: "Cancel" }),
25482
- /* @__PURE__ */ jsx100(
25483
- Button45,
26593
+ footer: /* @__PURE__ */ jsxs74("div", { className: styles.modalFooter, children: [
26594
+ /* @__PURE__ */ jsx103(Button46, { onClick: handleCloseModal, disabled: isCreating, children: "Cancel" }),
26595
+ /* @__PURE__ */ jsx103(
26596
+ Button46,
25484
26597
  {
25485
26598
  type: "primary",
25486
26599
  onClick: handleCreateProject,
@@ -25491,8 +26604,8 @@ var ProjectsMenuContent = () => {
25491
26604
  )
25492
26605
  ] }),
25493
26606
  children: [
25494
- /* @__PURE__ */ jsx100("label", { className: styles.formLabel, htmlFor: "project-name", children: "Project Name" }),
25495
- /* @__PURE__ */ jsx100(
26607
+ /* @__PURE__ */ jsx103("label", { className: styles.formLabel, htmlFor: "project-name", children: "Project Name" }),
26608
+ /* @__PURE__ */ jsx103(
25496
26609
  Input13,
25497
26610
  {
25498
26611
  id: "project-name",
@@ -25507,7 +26620,7 @@ var ProjectsMenuContent = () => {
25507
26620
  disabled: isCreating
25508
26621
  }
25509
26622
  ),
25510
- validationError && /* @__PURE__ */ jsx100("div", { className: styles.formError, role: "alert", children: validationError })
26623
+ validationError && /* @__PURE__ */ jsx103("div", { className: styles.formError, role: "alert", children: validationError })
25511
26624
  ]
25512
26625
  }
25513
26626
  )
@@ -25515,11 +26628,11 @@ var ProjectsMenuContent = () => {
25515
26628
  };
25516
26629
 
25517
26630
  // src/components/Chat/ThreadHistoryMenuContent.tsx
25518
- import React54, { useCallback as useCallback28 } from "react";
26631
+ import React57, { useCallback as useCallback31 } from "react";
25519
26632
  import { createStyles as createStyles31 } from "antd-style";
25520
26633
  import { MessageSquare as MessageSquare2, Trash2 as Trash24 } from "lucide-react";
25521
- import { message as message16, Modal as Modal18 } from "antd";
25522
- import { jsx as jsx101, jsxs as jsxs73 } from "react/jsx-runtime";
26634
+ import { message as message17, Modal as Modal18 } from "antd";
26635
+ import { jsx as jsx104, jsxs as jsxs75 } from "react/jsx-runtime";
25523
26636
  var useStyles19 = createStyles31(({ token, css }) => ({
25524
26637
  container: css`
25525
26638
  padding: 4px;
@@ -25629,7 +26742,7 @@ var ThreadHistoryMenuContent = () => {
25629
26742
  deleteThread,
25630
26743
  isLoading
25631
26744
  } = useConversationContext();
25632
- const handleDeleteThread = useCallback28(
26745
+ const handleDeleteThread = useCallback31(
25633
26746
  async (e, threadIdToDelete) => {
25634
26747
  e.stopPropagation();
25635
26748
  Modal18.confirm({
@@ -25641,16 +26754,16 @@ var ThreadHistoryMenuContent = () => {
25641
26754
  onOk: async () => {
25642
26755
  try {
25643
26756
  await deleteThread(threadIdToDelete);
25644
- message16.success("Conversation deleted");
26757
+ message17.success("Conversation deleted");
25645
26758
  } catch (error) {
25646
- message16.error("Failed to delete conversation");
26759
+ message17.error("Failed to delete conversation");
25647
26760
  }
25648
26761
  }
25649
26762
  });
25650
26763
  },
25651
26764
  [deleteThread]
25652
26765
  );
25653
- const sortedThreads = React54.useMemo(() => {
26766
+ const sortedThreads = React57.useMemo(() => {
25654
26767
  return [...threads].sort((a, b) => {
25655
26768
  const dateA = a.updatedAt ? new Date(a.updatedAt).getTime() : 0;
25656
26769
  const dateB = b.updatedAt ? new Date(b.updatedAt).getTime() : 0;
@@ -25658,30 +26771,30 @@ var ThreadHistoryMenuContent = () => {
25658
26771
  });
25659
26772
  }, [threads]);
25660
26773
  if (isLoading) {
25661
- return /* @__PURE__ */ jsx101("div", { className: styles.container, children: /* @__PURE__ */ jsx101("div", { className: styles.loading, children: "Loading conversations..." }) });
26774
+ return /* @__PURE__ */ jsx104("div", { className: styles.container, children: /* @__PURE__ */ jsx104("div", { className: styles.loading, children: "Loading conversations..." }) });
25662
26775
  }
25663
- return /* @__PURE__ */ jsx101("div", { className: styles.container, children: sortedThreads.length === 0 ? /* @__PURE__ */ jsx101("div", { className: styles.emptyState, children: "No conversations yet" }) : /* @__PURE__ */ jsx101("div", { className: styles.threadList, children: sortedThreads.map((thread) => /* @__PURE__ */ jsxs73(
26776
+ return /* @__PURE__ */ jsx104("div", { className: styles.container, children: sortedThreads.length === 0 ? /* @__PURE__ */ jsx104("div", { className: styles.emptyState, children: "No conversations yet" }) : /* @__PURE__ */ jsx104("div", { className: styles.threadList, children: sortedThreads.map((thread) => /* @__PURE__ */ jsxs75(
25664
26777
  "div",
25665
26778
  {
25666
26779
  className: `${styles.threadItem} ${thread.id === threadId ? "active" : ""}`,
25667
26780
  onClick: () => selectThread(thread.id),
25668
26781
  title: thread.label,
25669
26782
  children: [
25670
- /* @__PURE__ */ jsx101("div", { className: styles.threadIcon, children: /* @__PURE__ */ jsx101(MessageSquare2, { size: 14 }) }),
25671
- /* @__PURE__ */ jsx101(
26783
+ /* @__PURE__ */ jsx104("div", { className: styles.threadIcon, children: /* @__PURE__ */ jsx104(MessageSquare2, { size: 14 }) }),
26784
+ /* @__PURE__ */ jsx104(
25672
26785
  "div",
25673
26786
  {
25674
26787
  className: thread.id === threadId ? styles.threadNameActive : styles.threadName,
25675
26788
  children: thread.label
25676
26789
  }
25677
26790
  ),
25678
- /* @__PURE__ */ jsx101(
26791
+ /* @__PURE__ */ jsx104(
25679
26792
  "button",
25680
26793
  {
25681
26794
  className: styles.deleteBtn,
25682
26795
  onClick: (e) => handleDeleteThread(e, thread.id),
25683
26796
  title: "Delete conversation",
25684
- children: /* @__PURE__ */ jsx101(Trash24, { size: 12 })
26797
+ children: /* @__PURE__ */ jsx104(Trash24, { size: 12 })
25685
26798
  }
25686
26799
  )
25687
26800
  ]
@@ -25691,7 +26804,7 @@ var ThreadHistoryMenuContent = () => {
25691
26804
  };
25692
26805
 
25693
26806
  // src/components/Chat/ChatSidebar.tsx
25694
- import { Fragment as Fragment24, jsx as jsx102, jsxs as jsxs74 } from "react/jsx-runtime";
26807
+ import { Fragment as Fragment24, jsx as jsx105, jsxs as jsxs76 } from "react/jsx-runtime";
25695
26808
  var DRAWER_STYLES2 = {
25696
26809
  wrapper: {
25697
26810
  background: "transparent",
@@ -25717,7 +26830,7 @@ var DEFAULT_MENU_ITEMS = [
25717
26830
  builtin: "new-analysis",
25718
26831
  type: "action",
25719
26832
  name: "New Analysis",
25720
- icon: /* @__PURE__ */ jsx102(PlusCircle, { size: 20 }),
26833
+ icon: /* @__PURE__ */ jsx105(PlusCircle, { size: 20 }),
25721
26834
  order: 0
25722
26835
  },
25723
26836
  // Second: Thread History (inline drawer)
@@ -25726,13 +26839,13 @@ var DEFAULT_MENU_ITEMS = [
25726
26839
  builtin: "thread-history",
25727
26840
  type: "drawer",
25728
26841
  name: "History",
25729
- icon: /* @__PURE__ */ jsx102(History, { size: 20 }),
26842
+ icon: /* @__PURE__ */ jsx105(History, { size: 20 }),
25730
26843
  order: 1,
25731
26844
  title: "Conversation History",
25732
26845
  width: 320,
25733
26846
  inline: true,
25734
26847
  inlineDefaultExpanded: false,
25735
- content: /* @__PURE__ */ jsx102(ThreadHistoryMenuContent, {})
26848
+ content: /* @__PURE__ */ jsx105(ThreadHistoryMenuContent, {})
25736
26849
  },
25737
26850
  // Third: Projects (inline drawer)
25738
26851
  {
@@ -25740,13 +26853,13 @@ var DEFAULT_MENU_ITEMS = [
25740
26853
  builtin: "projects",
25741
26854
  type: "drawer",
25742
26855
  name: "Project Files",
25743
- icon: /* @__PURE__ */ jsx102(FolderOpen4, {}),
26856
+ icon: /* @__PURE__ */ jsx105(FolderOpen4, {}),
25744
26857
  order: 2,
25745
26858
  title: "Project Files",
25746
26859
  width: 320,
25747
26860
  inline: true,
25748
26861
  inlineDefaultExpanded: true,
25749
- content: /* @__PURE__ */ jsx102(ProjectsMenuContent, {})
26862
+ content: /* @__PURE__ */ jsx105(ProjectsMenuContent, {})
25750
26863
  },
25751
26864
  // Logout action
25752
26865
  {
@@ -25754,7 +26867,7 @@ var DEFAULT_MENU_ITEMS = [
25754
26867
  builtin: "logout",
25755
26868
  type: "action",
25756
26869
  name: "Logout",
25757
- icon: /* @__PURE__ */ jsx102(LogOut4, { size: 20 }),
26870
+ icon: /* @__PURE__ */ jsx105(LogOut4, { size: 20 }),
25758
26871
  order: 1e3,
25759
26872
  group: "Account"
25760
26873
  }
@@ -25768,7 +26881,7 @@ var ChatSidebar = ({
25768
26881
  const { sideAppVisible, menuCollapsed, setMenuCollapsed } = useChatUIContext();
25769
26882
  const { logout } = useAuth();
25770
26883
  const { createThread } = useConversationContext();
25771
- const [drawerStates, setDrawerStates] = useState62({});
26884
+ const [drawerStates, setDrawerStates] = useState63({});
25772
26885
  const {
25773
26886
  sidebarMode,
25774
26887
  sidebarShowToggle,
@@ -25784,7 +26897,7 @@ var ChatSidebar = ({
25784
26897
  }
25785
26898
  return items.sort((a, b) => (a.order ?? 0) - (b.order ?? 0));
25786
26899
  }, [customMenuItems]);
25787
- const handleMenuClick = useCallback29(async (item) => {
26900
+ const handleMenuClick = useCallback32(async (item) => {
25788
26901
  if (item.builtin === "settings") {
25789
26902
  setSettingsModalOpen(true);
25790
26903
  onSettingsClick?.();
@@ -25809,28 +26922,28 @@ var ChatSidebar = ({
25809
26922
  }
25810
26923
  }
25811
26924
  }, [onSettingsClick, setSettingsModalOpen, createThread, logout]);
25812
- const handleCloseDrawer = useCallback29((itemId) => {
26925
+ const handleCloseDrawer = useCallback32((itemId) => {
25813
26926
  setDrawerStates((prev) => ({ ...prev, [itemId]: false }));
25814
26927
  }, []);
25815
- const handleNewAnalysis = useCallback29(async () => {
26928
+ const handleNewAnalysis = useCallback32(async () => {
25816
26929
  try {
25817
26930
  await createThread("New Analysis");
25818
26931
  } catch (error) {
25819
26932
  console.error("Failed to create new thread:", error);
25820
26933
  }
25821
26934
  }, [createThread]);
25822
- const renderDrawerContent = useCallback29((item) => {
26935
+ const renderDrawerContent = useCallback32((item) => {
25823
26936
  switch (item.builtin) {
25824
26937
  case "projects":
25825
- return /* @__PURE__ */ jsx102(ProjectsMenuContent, {});
26938
+ return /* @__PURE__ */ jsx105(ProjectsMenuContent, {});
25826
26939
  case "thread-history":
25827
- return /* @__PURE__ */ jsx102(ThreadHistoryMenuContent, {});
26940
+ return /* @__PURE__ */ jsx105(ThreadHistoryMenuContent, {});
25828
26941
  default:
25829
26942
  return item.content;
25830
26943
  }
25831
26944
  }, []);
25832
- return /* @__PURE__ */ jsxs74(Fragment24, { children: [
25833
- /* @__PURE__ */ jsx102(
26945
+ return /* @__PURE__ */ jsxs76(Fragment24, { children: [
26946
+ /* @__PURE__ */ jsx105(
25834
26947
  Menu,
25835
26948
  {
25836
26949
  items: menuItems,
@@ -25846,12 +26959,12 @@ var ChatSidebar = ({
25846
26959
  onCollapsedChange: setMenuCollapsed
25847
26960
  }
25848
26961
  ),
25849
- menuItems.filter((item) => item.type === "drawer" && !item.inline).map((item) => /* @__PURE__ */ jsx102(
26962
+ menuItems.filter((item) => item.type === "drawer" && !item.inline).map((item) => /* @__PURE__ */ jsx105(
25850
26963
  Drawer2,
25851
26964
  {
25852
- title: /* @__PURE__ */ jsxs74("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", width: "100%" }, children: [
25853
- /* @__PURE__ */ jsx102("span", { style: { fontSize: 16, fontWeight: 600, textTransform: "uppercase", letterSpacing: 0.5 }, children: item.title || item.name }),
25854
- /* @__PURE__ */ jsx102(
26965
+ title: /* @__PURE__ */ jsxs76("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", width: "100%" }, children: [
26966
+ /* @__PURE__ */ jsx105("span", { style: { fontSize: 16, fontWeight: 600, textTransform: "uppercase", letterSpacing: 0.5 }, children: item.title || item.name }),
26967
+ /* @__PURE__ */ jsx105(
25855
26968
  "button",
25856
26969
  {
25857
26970
  onClick: () => handleCloseDrawer(item.id),
@@ -25866,7 +26979,7 @@ var ChatSidebar = ({
25866
26979
  background: "rgba(255, 255, 255, 0.5)",
25867
26980
  cursor: "pointer"
25868
26981
  },
25869
- children: /* @__PURE__ */ jsx102(PanelLeftClose2, { size: 24 })
26982
+ children: /* @__PURE__ */ jsx105(PanelLeftClose2, { size: 24 })
25870
26983
  }
25871
26984
  )
25872
26985
  ] }),
@@ -25897,7 +27010,7 @@ var ChatSidebar = ({
25897
27010
  };
25898
27011
 
25899
27012
  // src/components/Chat/LatticeChatView.tsx
25900
- import { jsx as jsx103 } from "react/jsx-runtime";
27013
+ import { jsx as jsx106 } from "react/jsx-runtime";
25901
27014
  var LatticeChatView = (props) => {
25902
27015
  const shellContext = useContext11(LatticeChatShellContext);
25903
27016
  const { showSideMenu, sideMenuItems } = shellContext.config;
@@ -25906,7 +27019,7 @@ var LatticeChatView = (props) => {
25906
27019
  const {
25907
27020
  config: { baseURL }
25908
27021
  } = useLatticeChatShellContext();
25909
- return assistantId && thread ? /* @__PURE__ */ jsx103(
27022
+ return assistantId && thread ? /* @__PURE__ */ jsx106(
25910
27023
  AxiomLatticeProvider,
25911
27024
  {
25912
27025
  config: {
@@ -25915,14 +27028,14 @@ var LatticeChatView = (props) => {
25915
27028
  assistantId,
25916
27029
  transport: "sse"
25917
27030
  },
25918
- children: /* @__PURE__ */ jsx103(
27031
+ children: /* @__PURE__ */ jsx106(
25919
27032
  LatticeChat,
25920
27033
  {
25921
27034
  thread_id: thread?.id,
25922
27035
  assistant_id: assistantId,
25923
27036
  name: currentAssistant?.name,
25924
27037
  description: currentAssistant?.description,
25925
- menu: showSideMenu ? /* @__PURE__ */ jsx103(ChatSidebar, { customMenuItems: sideMenuItems }) : void 0
27038
+ menu: showSideMenu ? /* @__PURE__ */ jsx106(ChatSidebar, { customMenuItems: sideMenuItems }) : void 0
25926
27039
  }
25927
27040
  )
25928
27041
  }
@@ -25930,18 +27043,18 @@ var LatticeChatView = (props) => {
25930
27043
  };
25931
27044
 
25932
27045
  // src/components/Chat/SettingsModal.tsx
25933
- import { useState as useState63, useEffect as useEffect39, useRef as useRef24 } from "react";
27046
+ import { useState as useState64, useEffect as useEffect40, useRef as useRef25 } from "react";
25934
27047
  import {
25935
27048
  Modal as Modal19,
25936
27049
  Input as Input14,
25937
- Button as Button46,
25938
- message as message17,
27050
+ Button as Button47,
27051
+ message as message18,
25939
27052
  notification as notification5,
25940
- Typography as Typography46,
27053
+ Typography as Typography47,
25941
27054
  Alert as Alert8,
25942
27055
  Select as Select6,
25943
27056
  Switch as Switch3,
25944
- Space as Space35,
27057
+ Space as Space36,
25945
27058
  Tabs as Tabs3
25946
27059
  } from "antd";
25947
27060
  import {
@@ -25957,8 +27070,8 @@ import {
25957
27070
  CloudServerOutlined
25958
27071
  } from "@ant-design/icons";
25959
27072
  import { createStyles as createStyles32 } from "antd-style";
25960
- import { Fragment as Fragment25, jsx as jsx104, jsxs as jsxs75 } from "react/jsx-runtime";
25961
- var { Text: Text37, Title: Title13 } = Typography46;
27073
+ import { Fragment as Fragment25, jsx as jsx107, jsxs as jsxs77 } from "react/jsx-runtime";
27074
+ var { Text: Text37, Title: Title13 } = Typography47;
25962
27075
  var { TextArea: TextArea8 } = Input14;
25963
27076
  var useStyles20 = createStyles32(({ token, css }) => ({
25964
27077
  // settingsModal: css`
@@ -26305,12 +27418,12 @@ var SETTINGS_MENU_ITEMS = [
26305
27418
  {
26306
27419
  key: "environment",
26307
27420
  label: "Environment Variables",
26308
- icon: /* @__PURE__ */ jsx104(EnvironmentOutlined, {})
27421
+ icon: /* @__PURE__ */ jsx107(EnvironmentOutlined, {})
26309
27422
  },
26310
27423
  {
26311
27424
  key: "models",
26312
27425
  label: "Model Configuration",
26313
- icon: /* @__PURE__ */ jsx104(ApiOutlined, {})
27426
+ icon: /* @__PURE__ */ jsx107(ApiOutlined, {})
26314
27427
  }
26315
27428
  ];
26316
27429
  var SettingsModal = ({
@@ -26319,7 +27432,7 @@ var SettingsModal = ({
26319
27432
  }) => {
26320
27433
  const { styles } = useStyles20();
26321
27434
  const { config: shellConfig, updateConfigValue } = useLatticeChatShellContext();
26322
- const [connections, setConnections] = useState63(() => {
27435
+ const [connections, setConnections] = useState64(() => {
26323
27436
  if (typeof window !== "undefined") {
26324
27437
  try {
26325
27438
  const stored = localStorage.getItem("lattice_server_connections");
@@ -26342,21 +27455,21 @@ var SettingsModal = ({
26342
27455
  }
26343
27456
  return [];
26344
27457
  });
26345
- const [serverConfigs, setServerConfigs] = useState63({});
26346
- const connectionsRef = useRef24(connections);
26347
- useEffect39(() => {
27458
+ const [serverConfigs, setServerConfigs] = useState64({});
27459
+ const connectionsRef = useRef25(connections);
27460
+ useEffect40(() => {
26348
27461
  connectionsRef.current = connections;
26349
27462
  }, [connections]);
26350
- const [activeTabKey, setActiveTabKey] = useState63(
27463
+ const [activeTabKey, setActiveTabKey] = useState64(
26351
27464
  connections.length > 0 ? connections[0].id : ""
26352
27465
  );
26353
- const [activeMenu, setActiveMenu] = useState63("environment");
26354
- const [loading, setLoading] = useState63(false);
26355
- const [showAddServerModal, setShowAddServerModal] = useState63(false);
26356
- const [newServerUrl, setNewServerUrl] = useState63("");
26357
- const [newServerName, setNewServerName] = useState63("");
26358
- const [newServerApiKey, setNewServerApiKey] = useState63("");
26359
- const [addingServer, setAddingServer] = useState63(false);
27466
+ const [activeMenu, setActiveMenu] = useState64("environment");
27467
+ const [loading, setLoading] = useState64(false);
27468
+ const [showAddServerModal, setShowAddServerModal] = useState64(false);
27469
+ const [newServerUrl, setNewServerUrl] = useState64("");
27470
+ const [newServerName, setNewServerName] = useState64("");
27471
+ const [newServerApiKey, setNewServerApiKey] = useState64("");
27472
+ const [addingServer, setAddingServer] = useState64(false);
26360
27473
  const saveConnections = (newConnections) => {
26361
27474
  setConnections(newConnections);
26362
27475
  if (typeof window !== "undefined") {
@@ -26495,7 +27608,7 @@ var SettingsModal = ({
26495
27608
  }
26496
27609
  } catch (error) {
26497
27610
  console.error("Failed to load configuration:", error);
26498
- message17.error("Failed to load current configuration");
27611
+ message18.error("Failed to load current configuration");
26499
27612
  }
26500
27613
  };
26501
27614
  const loadModelsConfig = async (serverId) => {
@@ -26546,7 +27659,7 @@ var SettingsModal = ({
26546
27659
  console.error("Failed to load models configuration:", error);
26547
27660
  }
26548
27661
  };
26549
- useEffect39(() => {
27662
+ useEffect40(() => {
26550
27663
  if (open && activeTabKey) {
26551
27664
  initializeServerConfig(activeTabKey);
26552
27665
  const connection = connections.find((c) => c.id === activeTabKey);
@@ -26555,7 +27668,7 @@ var SettingsModal = ({
26555
27668
  }
26556
27669
  }
26557
27670
  }, [open, activeTabKey]);
26558
- useEffect39(() => {
27671
+ useEffect40(() => {
26559
27672
  if (open && activeTabKey) {
26560
27673
  const connection = connections.find((c) => c.id === activeTabKey);
26561
27674
  if (connection?.connected) {
@@ -26569,7 +27682,7 @@ var SettingsModal = ({
26569
27682
  }, [open, activeTabKey, activeMenu]);
26570
27683
  const handleAddServer = async () => {
26571
27684
  if (!newServerUrl.trim()) {
26572
- message17.error("Please enter a server URL");
27685
+ message18.error("Please enter a server URL");
26573
27686
  return;
26574
27687
  }
26575
27688
  let normalizedUrl = newServerUrl.trim();
@@ -26632,12 +27745,12 @@ var SettingsModal = ({
26632
27745
  const handleSave = async () => {
26633
27746
  const connection = connections.find((c) => c.id === activeTabKey);
26634
27747
  if (!connection || !connection.connected) {
26635
- message17.error("Please connect to a server first");
27748
+ message18.error("Please connect to a server first");
26636
27749
  return;
26637
27750
  }
26638
27751
  const url = connection.url;
26639
27752
  if (!url) {
26640
- message17.error("Please connect to a server first");
27753
+ message18.error("Please connect to a server first");
26641
27754
  return;
26642
27755
  }
26643
27756
  try {
@@ -26701,7 +27814,7 @@ var SettingsModal = ({
26701
27814
  const data = await response.json();
26702
27815
  if (response.ok && data.success) {
26703
27816
  if (data.requiresRestart && data.requiresRestart.length > 0) {
26704
- message17.warning(
27817
+ message18.warning(
26705
27818
  `Configuration saved. Please restart the server for ${data.requiresRestart.join(
26706
27819
  ", "
26707
27820
  )} to take effect.`,
@@ -26715,12 +27828,12 @@ var SettingsModal = ({
26715
27828
  }
26716
27829
  if (data.warnings && data.warnings.length > 0) {
26717
27830
  data.warnings.forEach((warning) => {
26718
- message17.warning(warning, 5);
27831
+ message18.warning(warning, 5);
26719
27832
  });
26720
27833
  }
26721
27834
  onClose();
26722
27835
  } else {
26723
- message17.error(data.error || "Failed to save configuration");
27836
+ message18.error(data.error || "Failed to save configuration");
26724
27837
  }
26725
27838
  } else if (activeMenu === "models") {
26726
27839
  const validModels = config.models.filter(
@@ -26745,12 +27858,12 @@ var SettingsModal = ({
26745
27858
  });
26746
27859
  onClose();
26747
27860
  } else {
26748
- message17.error(data.error || "Failed to save model configuration");
27861
+ message18.error(data.error || "Failed to save model configuration");
26749
27862
  }
26750
27863
  }
26751
27864
  } catch (error) {
26752
27865
  console.error("Failed to save configuration:", error);
26753
- message17.error(error.message || "Failed to save configuration");
27866
+ message18.error(error.message || "Failed to save configuration");
26754
27867
  } finally {
26755
27868
  setLoading(false);
26756
27869
  }
@@ -26766,25 +27879,25 @@ var SettingsModal = ({
26766
27879
  }
26767
27880
  }));
26768
27881
  };
26769
- return /* @__PURE__ */ jsxs75("div", { className: styles.formContainer, children: [
26770
- /* @__PURE__ */ jsx104(
27882
+ return /* @__PURE__ */ jsxs77("div", { className: styles.formContainer, children: [
27883
+ /* @__PURE__ */ jsx107(
26771
27884
  Alert8,
26772
27885
  {
26773
27886
  message: "Configuration Effect",
26774
- description: /* @__PURE__ */ jsxs75("div", { children: [
26775
- /* @__PURE__ */ jsxs75("div", { style: { marginBottom: 8 }, children: [
26776
- /* @__PURE__ */ jsx104(
27887
+ description: /* @__PURE__ */ jsxs77("div", { children: [
27888
+ /* @__PURE__ */ jsxs77("div", { style: { marginBottom: 8 }, children: [
27889
+ /* @__PURE__ */ jsx107(
26777
27890
  CheckCircleOutlined8,
26778
27891
  {
26779
27892
  style: { color: "#52c41a", marginRight: 8 }
26780
27893
  }
26781
27894
  ),
26782
- /* @__PURE__ */ jsx104("strong", { children: "Immediately effective:" }),
27895
+ /* @__PURE__ */ jsx107("strong", { children: "Immediately effective:" }),
26783
27896
  " QUEUE_SERVICE_TYPE, REDIS_URL, REDIS_PASSWORD, QUEUE_NAME"
26784
27897
  ] }),
26785
- /* @__PURE__ */ jsxs75("div", { children: [
26786
- /* @__PURE__ */ jsx104(ReloadOutlined4, { style: { color: "#faad14", marginRight: 8 } }),
26787
- /* @__PURE__ */ jsx104("strong", { children: "Requires restart:" }),
27898
+ /* @__PURE__ */ jsxs77("div", { children: [
27899
+ /* @__PURE__ */ jsx107(ReloadOutlined4, { style: { color: "#faad14", marginRight: 8 } }),
27900
+ /* @__PURE__ */ jsx107("strong", { children: "Requires restart:" }),
26788
27901
  " PORT (server must be restarted to change port)"
26789
27902
  ] })
26790
27903
  ] }),
@@ -26793,8 +27906,8 @@ var SettingsModal = ({
26793
27906
  className: styles.alertCard
26794
27907
  }
26795
27908
  ),
26796
- /* @__PURE__ */ jsx104("div", { style: { marginBottom: 24 }, children: /* @__PURE__ */ jsx104(Text37, { type: "secondary", style: { fontSize: 14, lineHeight: 1.6 }, children: "Configure environment variables in .env format (key=value). One variable per line. Leave password fields empty to keep current values." }) }),
26797
- /* @__PURE__ */ jsx104(
27909
+ /* @__PURE__ */ jsx107("div", { style: { marginBottom: 24 }, children: /* @__PURE__ */ jsx107(Text37, { type: "secondary", style: { fontSize: 14, lineHeight: 1.6 }, children: "Configure environment variables in .env format (key=value). One variable per line. Leave password fields empty to keep current values." }) }),
27910
+ /* @__PURE__ */ jsx107(
26798
27911
  TextArea8,
26799
27912
  {
26800
27913
  value: config.envText,
@@ -26871,10 +27984,10 @@ QUEUE_NAME=tasks`,
26871
27984
  }));
26872
27985
  }
26873
27986
  };
26874
- return /* @__PURE__ */ jsxs75("div", { className: styles.formContainer, children: [
26875
- /* @__PURE__ */ jsx104("div", { style: { marginBottom: 32 }, children: /* @__PURE__ */ jsx104(Text37, { type: "secondary", style: { fontSize: 14, lineHeight: 1.6 }, children: "Configure model lattices. Each model will be registered with the provided key and can be used by agents." }) }),
26876
- config.models.map((model, index) => /* @__PURE__ */ jsxs75("div", { className: styles.card, children: [
26877
- /* @__PURE__ */ jsxs75(
27987
+ return /* @__PURE__ */ jsxs77("div", { className: styles.formContainer, children: [
27988
+ /* @__PURE__ */ jsx107("div", { style: { marginBottom: 32 }, children: /* @__PURE__ */ jsx107(Text37, { type: "secondary", style: { fontSize: 14, lineHeight: 1.6 }, children: "Configure model lattices. Each model will be registered with the provided key and can be used by agents." }) }),
27989
+ config.models.map((model, index) => /* @__PURE__ */ jsxs77("div", { className: styles.card, children: [
27990
+ /* @__PURE__ */ jsxs77(
26878
27991
  "div",
26879
27992
  {
26880
27993
  style: {
@@ -26886,12 +27999,12 @@ QUEUE_NAME=tasks`,
26886
27999
  borderBottom: "1px solid rgba(0, 0, 0, 0.06)"
26887
28000
  },
26888
28001
  children: [
26889
- /* @__PURE__ */ jsxs75("div", { children: [
26890
- /* @__PURE__ */ jsxs75(Text37, { strong: true, style: { fontSize: 16 }, children: [
28002
+ /* @__PURE__ */ jsxs77("div", { children: [
28003
+ /* @__PURE__ */ jsxs77(Text37, { strong: true, style: { fontSize: 16 }, children: [
26891
28004
  "Model ",
26892
28005
  index + 1
26893
28006
  ] }),
26894
- model.key && /* @__PURE__ */ jsxs75(
28007
+ model.key && /* @__PURE__ */ jsxs77(
26895
28008
  Text37,
26896
28009
  {
26897
28010
  type: "secondary",
@@ -26904,8 +28017,8 @@ QUEUE_NAME=tasks`,
26904
28017
  }
26905
28018
  )
26906
28019
  ] }),
26907
- config.models.length > 1 && /* @__PURE__ */ jsx104(
26908
- Button46,
28020
+ config.models.length > 1 && /* @__PURE__ */ jsx107(
28021
+ Button47,
26909
28022
  {
26910
28023
  type: "text",
26911
28024
  danger: true,
@@ -26921,10 +28034,10 @@ QUEUE_NAME=tasks`,
26921
28034
  ]
26922
28035
  }
26923
28036
  ),
26924
- /* @__PURE__ */ jsxs75(Space35, { direction: "vertical", style: { width: "100%" }, size: "large", children: [
26925
- /* @__PURE__ */ jsxs75("div", { children: [
26926
- /* @__PURE__ */ jsx104(Text37, { className: styles.formLabel, children: "Key *" }),
26927
- /* @__PURE__ */ jsx104(
28037
+ /* @__PURE__ */ jsxs77(Space36, { direction: "vertical", style: { width: "100%" }, size: "large", children: [
28038
+ /* @__PURE__ */ jsxs77("div", { children: [
28039
+ /* @__PURE__ */ jsx107(Text37, { className: styles.formLabel, children: "Key *" }),
28040
+ /* @__PURE__ */ jsx107(
26928
28041
  Input14,
26929
28042
  {
26930
28043
  placeholder: "e.g., default, gpt-4, claude",
@@ -26933,11 +28046,11 @@ QUEUE_NAME=tasks`,
26933
28046
  style: { height: 40 }
26934
28047
  }
26935
28048
  ),
26936
- /* @__PURE__ */ jsx104(Text37, { className: styles.formDescription, children: "Unique identifier for this model" })
28049
+ /* @__PURE__ */ jsx107(Text37, { className: styles.formDescription, children: "Unique identifier for this model" })
26937
28050
  ] }),
26938
- /* @__PURE__ */ jsxs75("div", { children: [
26939
- /* @__PURE__ */ jsx104(Text37, { className: styles.formLabel, children: "Provider *" }),
26940
- /* @__PURE__ */ jsx104(
28051
+ /* @__PURE__ */ jsxs77("div", { children: [
28052
+ /* @__PURE__ */ jsx107(Text37, { className: styles.formLabel, children: "Provider *" }),
28053
+ /* @__PURE__ */ jsx107(
26941
28054
  Select6,
26942
28055
  {
26943
28056
  style: { width: "100%", height: 40 },
@@ -26953,9 +28066,9 @@ QUEUE_NAME=tasks`,
26953
28066
  }
26954
28067
  )
26955
28068
  ] }),
26956
- /* @__PURE__ */ jsxs75("div", { children: [
26957
- /* @__PURE__ */ jsx104(Text37, { className: styles.formLabel, children: "Model Name *" }),
26958
- /* @__PURE__ */ jsx104(
28069
+ /* @__PURE__ */ jsxs77("div", { children: [
28070
+ /* @__PURE__ */ jsx107(Text37, { className: styles.formLabel, children: "Model Name *" }),
28071
+ /* @__PURE__ */ jsx107(
26959
28072
  Input14,
26960
28073
  {
26961
28074
  placeholder: "e.g., gpt-4, claude-3-opus, kimi-k2-250905",
@@ -26965,9 +28078,9 @@ QUEUE_NAME=tasks`,
26965
28078
  }
26966
28079
  )
26967
28080
  ] }),
26968
- /* @__PURE__ */ jsxs75("div", { children: [
26969
- /* @__PURE__ */ jsx104(Text37, { className: styles.formLabel, children: "API Key" }),
26970
- /* @__PURE__ */ jsx104(
28081
+ /* @__PURE__ */ jsxs77("div", { children: [
28082
+ /* @__PURE__ */ jsx107(Text37, { className: styles.formLabel, children: "API Key" }),
28083
+ /* @__PURE__ */ jsx107(
26971
28084
  Input14.Password,
26972
28085
  {
26973
28086
  placeholder: "Enter your API key",
@@ -26976,11 +28089,11 @@ QUEUE_NAME=tasks`,
26976
28089
  style: { height: 40 }
26977
28090
  }
26978
28091
  ),
26979
- /* @__PURE__ */ jsx104(Text37, { className: styles.formDescription, children: "API key for the model provider. Leave empty to use environment variable." })
28092
+ /* @__PURE__ */ jsx107(Text37, { className: styles.formDescription, children: "API key for the model provider. Leave empty to use environment variable." })
26980
28093
  ] }),
26981
- /* @__PURE__ */ jsxs75("div", { children: [
26982
- /* @__PURE__ */ jsx104(Text37, { className: styles.formLabel, children: "Base URL" }),
26983
- /* @__PURE__ */ jsx104(
28094
+ /* @__PURE__ */ jsxs77("div", { children: [
28095
+ /* @__PURE__ */ jsx107(Text37, { className: styles.formLabel, children: "Base URL" }),
28096
+ /* @__PURE__ */ jsx107(
26984
28097
  Input14,
26985
28098
  {
26986
28099
  placeholder: "e.g., https://api.openai.com/v1",
@@ -26989,22 +28102,22 @@ QUEUE_NAME=tasks`,
26989
28102
  style: { height: 40 }
26990
28103
  }
26991
28104
  ),
26992
- /* @__PURE__ */ jsx104(Text37, { className: styles.formDescription, children: "Optional custom base URL for the API" })
28105
+ /* @__PURE__ */ jsx107(Text37, { className: styles.formDescription, children: "Optional custom base URL for the API" })
26993
28106
  ] }),
26994
- /* @__PURE__ */ jsx104("div", { children: /* @__PURE__ */ jsxs75(Space35, { children: [
26995
- /* @__PURE__ */ jsx104(
28107
+ /* @__PURE__ */ jsx107("div", { children: /* @__PURE__ */ jsxs77(Space36, { children: [
28108
+ /* @__PURE__ */ jsx107(
26996
28109
  Switch3,
26997
28110
  {
26998
28111
  checked: model.streaming,
26999
28112
  onChange: (checked) => handleModelChange(index, "streaming", checked)
27000
28113
  }
27001
28114
  ),
27002
- /* @__PURE__ */ jsx104(Text37, { children: "Enable Streaming" })
28115
+ /* @__PURE__ */ jsx107(Text37, { children: "Enable Streaming" })
27003
28116
  ] }) }),
27004
- /* @__PURE__ */ jsxs75("div", { style: { display: "flex", gap: 20 }, children: [
27005
- /* @__PURE__ */ jsxs75("div", { style: { flex: 1 }, children: [
27006
- /* @__PURE__ */ jsx104(Text37, { className: styles.formLabel, children: "Max Tokens" }),
27007
- /* @__PURE__ */ jsx104(
28117
+ /* @__PURE__ */ jsxs77("div", { style: { display: "flex", gap: 20 }, children: [
28118
+ /* @__PURE__ */ jsxs77("div", { style: { flex: 1 }, children: [
28119
+ /* @__PURE__ */ jsx107(Text37, { className: styles.formLabel, children: "Max Tokens" }),
28120
+ /* @__PURE__ */ jsx107(
27008
28121
  Input14,
27009
28122
  {
27010
28123
  type: "number",
@@ -27019,9 +28132,9 @@ QUEUE_NAME=tasks`,
27019
28132
  }
27020
28133
  )
27021
28134
  ] }),
27022
- /* @__PURE__ */ jsxs75("div", { style: { flex: 1 }, children: [
27023
- /* @__PURE__ */ jsx104(Text37, { className: styles.formLabel, children: "Temperature" }),
27024
- /* @__PURE__ */ jsx104(
28135
+ /* @__PURE__ */ jsxs77("div", { style: { flex: 1 }, children: [
28136
+ /* @__PURE__ */ jsx107(Text37, { className: styles.formLabel, children: "Temperature" }),
28137
+ /* @__PURE__ */ jsx107(
27025
28138
  Input14,
27026
28139
  {
27027
28140
  type: "number",
@@ -27040,8 +28153,8 @@ QUEUE_NAME=tasks`,
27040
28153
  ] })
27041
28154
  ] })
27042
28155
  ] }, index)),
27043
- /* @__PURE__ */ jsx104(
27044
- Button46,
28156
+ /* @__PURE__ */ jsx107(
28157
+ Button47,
27045
28158
  {
27046
28159
  type: "dashed",
27047
28160
  onClick: handleAddModel,
@@ -27068,8 +28181,8 @@ QUEUE_NAME=tasks`,
27068
28181
  );
27069
28182
  const currentConnection = connections.find((c) => c.id === activeTabKey);
27070
28183
  const renderTabLabel = (connection) => {
27071
- return /* @__PURE__ */ jsxs75("div", { style: { display: "flex", alignItems: "center" }, children: [
27072
- /* @__PURE__ */ jsx104(
28184
+ return /* @__PURE__ */ jsxs77("div", { style: { display: "flex", alignItems: "center" }, children: [
28185
+ /* @__PURE__ */ jsx107(
27073
28186
  CloudServerOutlined,
27074
28187
  {
27075
28188
  style: {
@@ -27078,14 +28191,14 @@ QUEUE_NAME=tasks`,
27078
28191
  }
27079
28192
  }
27080
28193
  ),
27081
- /* @__PURE__ */ jsx104("span", { children: connection.name }),
27082
- connection.connected && /* @__PURE__ */ jsx104(
28194
+ /* @__PURE__ */ jsx107("span", { children: connection.name }),
28195
+ connection.connected && /* @__PURE__ */ jsx107(
27083
28196
  CheckCircleFilled,
27084
28197
  {
27085
28198
  style: { color: "#52c41a", fontSize: 12, marginLeft: 8 }
27086
28199
  }
27087
28200
  ),
27088
- connection.error && !connection.connecting && /* @__PURE__ */ jsx104(
28201
+ connection.error && !connection.connecting && /* @__PURE__ */ jsx107(
27089
28202
  CloseCircleFilled,
27090
28203
  {
27091
28204
  style: { color: "#ff4d4f", fontSize: 12, marginLeft: 8 }
@@ -27096,35 +28209,35 @@ QUEUE_NAME=tasks`,
27096
28209
  const tabItems = connections.map((connection) => ({
27097
28210
  key: connection.id,
27098
28211
  label: renderTabLabel(connection),
27099
- children: /* @__PURE__ */ jsx104("div", { className: styles.tabContent, children: connection.connected ? /* @__PURE__ */ jsx104(Fragment25, { children: /* @__PURE__ */ jsxs75("div", { style: { display: "flex", height: "100%" }, children: [
27100
- /* @__PURE__ */ jsx104("div", { className: styles.sidebar, children: SETTINGS_MENU_ITEMS.map((item) => /* @__PURE__ */ jsxs75(
28212
+ children: /* @__PURE__ */ jsx107("div", { className: styles.tabContent, children: connection.connected ? /* @__PURE__ */ jsx107(Fragment25, { children: /* @__PURE__ */ jsxs77("div", { style: { display: "flex", height: "100%" }, children: [
28213
+ /* @__PURE__ */ jsx107("div", { className: styles.sidebar, children: SETTINGS_MENU_ITEMS.map((item) => /* @__PURE__ */ jsxs77(
27101
28214
  "div",
27102
28215
  {
27103
28216
  className: `${styles.menuItem} ${activeMenu === item.key ? "active" : ""}`,
27104
28217
  onClick: () => setActiveMenu(item.key),
27105
28218
  children: [
27106
- /* @__PURE__ */ jsx104("span", { className: styles.menuItemIcon, children: item.icon }),
27107
- /* @__PURE__ */ jsx104("span", { className: styles.menuItemText, children: item.label })
28219
+ /* @__PURE__ */ jsx107("span", { className: styles.menuItemIcon, children: item.icon }),
28220
+ /* @__PURE__ */ jsx107("span", { className: styles.menuItemText, children: item.label })
27108
28221
  ]
27109
28222
  },
27110
28223
  item.key
27111
28224
  )) }),
27112
- /* @__PURE__ */ jsxs75("div", { className: styles.content, children: [
27113
- /* @__PURE__ */ jsxs75("div", { className: styles.contentHeader, children: [
27114
- /* @__PURE__ */ jsxs75("div", { className: styles.contentHeaderLeft, children: [
27115
- /* @__PURE__ */ jsx104(Title13, { level: 3, className: styles.contentTitle, children: activeMenuItem?.label }),
27116
- /* @__PURE__ */ jsxs75(Text37, { className: styles.contentDescription, children: [
28225
+ /* @__PURE__ */ jsxs77("div", { className: styles.content, children: [
28226
+ /* @__PURE__ */ jsxs77("div", { className: styles.contentHeader, children: [
28227
+ /* @__PURE__ */ jsxs77("div", { className: styles.contentHeaderLeft, children: [
28228
+ /* @__PURE__ */ jsx107(Title13, { level: 3, className: styles.contentTitle, children: activeMenuItem?.label }),
28229
+ /* @__PURE__ */ jsxs77(Text37, { className: styles.contentDescription, children: [
27117
28230
  activeMenu === "environment" && "Manage environment variables for the gateway server",
27118
28231
  activeMenu === "models" && "Configure and register model lattices for use by agents"
27119
28232
  ] })
27120
28233
  ] }),
27121
- /* @__PURE__ */ jsxs75("div", { className: styles.contentHeaderRight, children: [
27122
- /* @__PURE__ */ jsx104(Button46, { onClick: onClose, children: "Cancel" }),
27123
- /* @__PURE__ */ jsx104(
27124
- Button46,
28234
+ /* @__PURE__ */ jsxs77("div", { className: styles.contentHeaderRight, children: [
28235
+ /* @__PURE__ */ jsx107(Button47, { onClick: onClose, children: "Cancel" }),
28236
+ /* @__PURE__ */ jsx107(
28237
+ Button47,
27125
28238
  {
27126
28239
  type: "primary",
27127
- icon: /* @__PURE__ */ jsx104(SaveOutlined2, {}),
28240
+ icon: /* @__PURE__ */ jsx107(SaveOutlined2, {}),
27128
28241
  onClick: handleSave,
27129
28242
  loading,
27130
28243
  children: "Save Configuration"
@@ -27132,9 +28245,9 @@ QUEUE_NAME=tasks`,
27132
28245
  )
27133
28246
  ] })
27134
28247
  ] }),
27135
- /* @__PURE__ */ jsx104("div", { className: styles.contentBody, children: renderContent(connection.id) })
28248
+ /* @__PURE__ */ jsx107("div", { className: styles.contentBody, children: renderContent(connection.id) })
27136
28249
  ] })
27137
- ] }) }) : /* @__PURE__ */ jsx104(
28250
+ ] }) }) : /* @__PURE__ */ jsx107(
27138
28251
  "div",
27139
28252
  {
27140
28253
  style: {
@@ -27146,17 +28259,17 @@ QUEUE_NAME=tasks`,
27146
28259
  gap: 16,
27147
28260
  padding: 48
27148
28261
  },
27149
- children: connection.connecting ? /* @__PURE__ */ jsxs75(Fragment25, { children: [
27150
- /* @__PURE__ */ jsx104(LinkOutlined2, { style: { fontSize: 64, color: "#1890ff" }, spin: true }),
27151
- /* @__PURE__ */ jsx104(Title13, { level: 4, children: "Connecting..." }),
27152
- /* @__PURE__ */ jsxs75(Text37, { type: "secondary", style: { textAlign: "center" }, children: [
28262
+ children: connection.connecting ? /* @__PURE__ */ jsxs77(Fragment25, { children: [
28263
+ /* @__PURE__ */ jsx107(LinkOutlined2, { style: { fontSize: 64, color: "#1890ff" }, spin: true }),
28264
+ /* @__PURE__ */ jsx107(Title13, { level: 4, children: "Connecting..." }),
28265
+ /* @__PURE__ */ jsxs77(Text37, { type: "secondary", style: { textAlign: "center" }, children: [
27153
28266
  "Connecting to ",
27154
28267
  connection.url
27155
28268
  ] })
27156
- ] }) : /* @__PURE__ */ jsxs75(Fragment25, { children: [
27157
- /* @__PURE__ */ jsx104(LinkOutlined2, { style: { fontSize: 64, color: "#d9d9d9" } }),
27158
- /* @__PURE__ */ jsx104(Title13, { level: 4, type: "secondary", children: connection.error || "Not Connected" }),
27159
- /* @__PURE__ */ jsx104(
28269
+ ] }) : /* @__PURE__ */ jsxs77(Fragment25, { children: [
28270
+ /* @__PURE__ */ jsx107(LinkOutlined2, { style: { fontSize: 64, color: "#d9d9d9" } }),
28271
+ /* @__PURE__ */ jsx107(Title13, { level: 4, type: "secondary", children: connection.error || "Not Connected" }),
28272
+ /* @__PURE__ */ jsx107(
27160
28273
  Text37,
27161
28274
  {
27162
28275
  type: "secondary",
@@ -27164,11 +28277,11 @@ QUEUE_NAME=tasks`,
27164
28277
  children: connection.error ? `Failed to connect to ${connection.url}. Please check the server URL and try again.` : `Click "Reconnect" to connect to ${connection.url}`
27165
28278
  }
27166
28279
  ),
27167
- /* @__PURE__ */ jsx104(
27168
- Button46,
28280
+ /* @__PURE__ */ jsx107(
28281
+ Button47,
27169
28282
  {
27170
28283
  type: "primary",
27171
- icon: /* @__PURE__ */ jsx104(LinkOutlined2, {}),
28284
+ icon: /* @__PURE__ */ jsx107(LinkOutlined2, {}),
27172
28285
  onClick: () => checkConnection(connection.id),
27173
28286
  loading: connection.connecting,
27174
28287
  style: { marginTop: 16 },
@@ -27180,8 +28293,8 @@ QUEUE_NAME=tasks`,
27180
28293
  ) }),
27181
28294
  closable: connections.length > 1
27182
28295
  }));
27183
- return /* @__PURE__ */ jsxs75(Fragment25, { children: [
27184
- /* @__PURE__ */ jsx104(
28296
+ return /* @__PURE__ */ jsxs77(Fragment25, { children: [
28297
+ /* @__PURE__ */ jsx107(
27185
28298
  Modal19,
27186
28299
  {
27187
28300
  open,
@@ -27190,7 +28303,7 @@ QUEUE_NAME=tasks`,
27190
28303
  width: "80%",
27191
28304
  footer: null,
27192
28305
  title: "Settings",
27193
- children: /* @__PURE__ */ jsx104("div", { children: /* @__PURE__ */ jsx104(
28306
+ children: /* @__PURE__ */ jsx107("div", { children: /* @__PURE__ */ jsx107(
27194
28307
  Tabs3,
27195
28308
  {
27196
28309
  activeKey: activeTabKey,
@@ -27204,7 +28317,7 @@ QUEUE_NAME=tasks`,
27204
28317
  }
27205
28318
  },
27206
28319
  items: tabItems,
27207
- addIcon: /* @__PURE__ */ jsxs75(
28320
+ addIcon: /* @__PURE__ */ jsxs77(
27208
28321
  "div",
27209
28322
  {
27210
28323
  style: {
@@ -27214,8 +28327,8 @@ QUEUE_NAME=tasks`,
27214
28327
  padding: "4px 8px"
27215
28328
  },
27216
28329
  children: [
27217
- /* @__PURE__ */ jsx104(PlusOutlined7, {}),
27218
- /* @__PURE__ */ jsx104("span", { children: "Add Server" })
28330
+ /* @__PURE__ */ jsx107(PlusOutlined7, {}),
28331
+ /* @__PURE__ */ jsx107("span", { children: "Add Server" })
27219
28332
  ]
27220
28333
  }
27221
28334
  )
@@ -27223,7 +28336,7 @@ QUEUE_NAME=tasks`,
27223
28336
  ) })
27224
28337
  }
27225
28338
  ),
27226
- /* @__PURE__ */ jsx104(
28339
+ /* @__PURE__ */ jsx107(
27227
28340
  Modal19,
27228
28341
  {
27229
28342
  title: "Add New Server",
@@ -27237,10 +28350,10 @@ QUEUE_NAME=tasks`,
27237
28350
  },
27238
28351
  confirmLoading: addingServer,
27239
28352
  className: styles.addServerModal,
27240
- children: /* @__PURE__ */ jsxs75(Space35, { direction: "vertical", style: { width: "100%" }, size: "large", children: [
27241
- /* @__PURE__ */ jsxs75("div", { children: [
27242
- /* @__PURE__ */ jsx104(Text37, { strong: true, style: { display: "block", marginBottom: 8 }, children: "Server Name" }),
27243
- /* @__PURE__ */ jsx104(
28353
+ children: /* @__PURE__ */ jsxs77(Space36, { direction: "vertical", style: { width: "100%" }, size: "large", children: [
28354
+ /* @__PURE__ */ jsxs77("div", { children: [
28355
+ /* @__PURE__ */ jsx107(Text37, { strong: true, style: { display: "block", marginBottom: 8 }, children: "Server Name" }),
28356
+ /* @__PURE__ */ jsx107(
27244
28357
  Input14,
27245
28358
  {
27246
28359
  placeholder: "e.g., Production Server",
@@ -27249,11 +28362,11 @@ QUEUE_NAME=tasks`,
27249
28362
  onPressEnter: handleAddServer
27250
28363
  }
27251
28364
  ),
27252
- /* @__PURE__ */ jsx104(Text37, { type: "secondary", style: { fontSize: 12, marginTop: 4 }, children: "Optional: Leave empty to use URL as name" })
28365
+ /* @__PURE__ */ jsx107(Text37, { type: "secondary", style: { fontSize: 12, marginTop: 4 }, children: "Optional: Leave empty to use URL as name" })
27253
28366
  ] }),
27254
- /* @__PURE__ */ jsxs75("div", { children: [
27255
- /* @__PURE__ */ jsx104(Text37, { strong: true, style: { display: "block", marginBottom: 8 }, children: "Server URL *" }),
27256
- /* @__PURE__ */ jsx104(
28367
+ /* @__PURE__ */ jsxs77("div", { children: [
28368
+ /* @__PURE__ */ jsx107(Text37, { strong: true, style: { display: "block", marginBottom: 8 }, children: "Server URL *" }),
28369
+ /* @__PURE__ */ jsx107(
27257
28370
  Input14,
27258
28371
  {
27259
28372
  placeholder: "e.g., http://localhost:4001",
@@ -27262,11 +28375,11 @@ QUEUE_NAME=tasks`,
27262
28375
  onPressEnter: handleAddServer
27263
28376
  }
27264
28377
  ),
27265
- /* @__PURE__ */ jsx104(Text37, { type: "secondary", style: { fontSize: 12, marginTop: 4 }, children: "Enter the full URL of the gateway server" })
28378
+ /* @__PURE__ */ jsx107(Text37, { type: "secondary", style: { fontSize: 12, marginTop: 4 }, children: "Enter the full URL of the gateway server" })
27266
28379
  ] }),
27267
- /* @__PURE__ */ jsxs75("div", { children: [
27268
- /* @__PURE__ */ jsx104(Text37, { strong: true, style: { display: "block", marginBottom: 8 }, children: "API Key" }),
27269
- /* @__PURE__ */ jsx104(
28380
+ /* @__PURE__ */ jsxs77("div", { children: [
28381
+ /* @__PURE__ */ jsx107(Text37, { strong: true, style: { display: "block", marginBottom: 8 }, children: "API Key" }),
28382
+ /* @__PURE__ */ jsx107(
27270
28383
  Input14.Password,
27271
28384
  {
27272
28385
  placeholder: "Optional: Enter API key for authentication",
@@ -27275,7 +28388,7 @@ QUEUE_NAME=tasks`,
27275
28388
  onPressEnter: handleAddServer
27276
28389
  }
27277
28390
  ),
27278
- /* @__PURE__ */ jsx104(Text37, { type: "secondary", style: { fontSize: 12, marginTop: 4 }, children: "Optional: API key for server authentication" })
28391
+ /* @__PURE__ */ jsx107(Text37, { type: "secondary", style: { fontSize: 12, marginTop: 4 }, children: "Optional: API key for server authentication" })
27279
28392
  ] })
27280
28393
  ] })
27281
28394
  }
@@ -27284,10 +28397,10 @@ QUEUE_NAME=tasks`,
27284
28397
  };
27285
28398
 
27286
28399
  // src/components/Chat/AgentServerSetting.tsx
27287
- import { jsx as jsx105 } from "react/jsx-runtime";
28400
+ import { jsx as jsx108 } from "react/jsx-runtime";
27288
28401
  var AgentServerSetting = () => {
27289
28402
  const { settingsModalOpen, setSettingsModalOpen } = useLatticeChatShellContext();
27290
- return /* @__PURE__ */ jsx105(
28403
+ return /* @__PURE__ */ jsx108(
27291
28404
  SettingsModal,
27292
28405
  {
27293
28406
  open: settingsModalOpen,
@@ -27297,24 +28410,24 @@ var AgentServerSetting = () => {
27297
28410
  };
27298
28411
 
27299
28412
  // src/components/Chat/LatticeChatShell.tsx
27300
- import { Fragment as Fragment26, jsx as jsx106, jsxs as jsxs76 } from "react/jsx-runtime";
28413
+ import { Fragment as Fragment26, jsx as jsx109, jsxs as jsxs78 } from "react/jsx-runtime";
27301
28414
  var ShellContent = ({
27302
28415
  initialAssistantId,
27303
28416
  enableWorkspace
27304
28417
  }) => {
27305
28418
  const { currentTenant } = useAuth();
27306
- return /* @__PURE__ */ jsx106(Fragment26, { children: enableWorkspace ? /* @__PURE__ */ jsxs76(WorkspaceContextProvider, { children: [
27307
- /* @__PURE__ */ jsx106(AssistantContextProvider, { autoLoad: true, initialAssistantId, children: /* @__PURE__ */ jsx106(ConversationContextProvider, { children: /* @__PURE__ */ jsx106(LatticeChatView, {}) }) }),
27308
- /* @__PURE__ */ jsx106(AgentServerSetting, {})
27309
- ] }) : /* @__PURE__ */ jsxs76(Fragment26, { children: [
27310
- /* @__PURE__ */ jsx106(AssistantContextProvider, { autoLoad: true, initialAssistantId, children: /* @__PURE__ */ jsx106(ConversationContextProvider, { children: /* @__PURE__ */ jsx106(LatticeChatView, {}) }) }),
27311
- /* @__PURE__ */ jsx106(AgentServerSetting, {})
28419
+ return /* @__PURE__ */ jsx109(Fragment26, { children: enableWorkspace ? /* @__PURE__ */ jsxs78(WorkspaceContextProvider, { children: [
28420
+ /* @__PURE__ */ jsx109(AssistantContextProvider, { autoLoad: true, initialAssistantId, children: /* @__PURE__ */ jsx109(ConversationContextProvider, { children: /* @__PURE__ */ jsx109(LatticeChatView, {}) }) }),
28421
+ /* @__PURE__ */ jsx109(AgentServerSetting, {})
28422
+ ] }) : /* @__PURE__ */ jsxs78(Fragment26, { children: [
28423
+ /* @__PURE__ */ jsx109(AssistantContextProvider, { autoLoad: true, initialAssistantId, children: /* @__PURE__ */ jsx109(ConversationContextProvider, { children: /* @__PURE__ */ jsx109(LatticeChatView, {}) }) }),
28424
+ /* @__PURE__ */ jsx109(AgentServerSetting, {})
27312
28425
  ] }) });
27313
28426
  };
27314
28427
  var LatticeChatShell = (props) => {
27315
28428
  const { enableAssistantCreation, enableAssistantEditing, enableWorkspace: enableWorkspaceProp, ...restProps } = props;
27316
28429
  const enableWorkspace = enableWorkspaceProp ?? restProps.initialConfig?.enableWorkspace ?? false;
27317
- return /* @__PURE__ */ jsx106(
28430
+ return /* @__PURE__ */ jsx109(
27318
28431
  LatticeChatShellContextProvider,
27319
28432
  {
27320
28433
  initialConfig: {
@@ -27323,7 +28436,7 @@ var LatticeChatShell = (props) => {
27323
28436
  enableWorkspace,
27324
28437
  ...restProps.initialConfig
27325
28438
  },
27326
- children: /* @__PURE__ */ jsx106(
28439
+ children: /* @__PURE__ */ jsx109(
27327
28440
  ShellContent,
27328
28441
  {
27329
28442
  initialAssistantId: restProps.initialConfig?.assistantId,
@@ -27366,6 +28479,7 @@ export {
27366
28479
  SkillCategoryPrompts_default as SkillCategoryPrompts,
27367
28480
  SkillFlow_default as SkillFlow,
27368
28481
  SkillNode_default as SkillNode,
28482
+ StreamingHTMLRenderer,
27369
28483
  TenantSelector,
27370
28484
  UserProfile,
27371
28485
  WorkspaceResourceManager,
@@ -27375,6 +28489,7 @@ export {
27375
28489
  axiomAntdThemeDark,
27376
28490
  axiomTokens,
27377
28491
  colors,
28492
+ generateIframeSrcdoc,
27378
28493
  generateLabelFromMessage,
27379
28494
  getAxiomAntdTheme,
27380
28495
  getElement,