@axiom-lattice/react-sdk 2.1.23 → 2.1.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -35,6 +35,8 @@ __export(index_exports, {
35
35
  AgentThreadProvider: () => AgentThreadProvider,
36
36
  AssistantContext: () => AssistantContext,
37
37
  AssistantContextProvider: () => AssistantContextProvider,
38
+ AssistantFlow: () => AssistantFlow_default,
39
+ AssistantNode: () => AssistantNode_default,
38
40
  AxiomLatticeProvider: () => AxiomLatticeProvider,
39
41
  ChatUIContext: () => ChatUIContext,
40
42
  ChatUIContextProvider: () => ChatUIContextProvider,
@@ -51,6 +53,8 @@ __export(index_exports, {
51
53
  MDViewFormItem: () => MDViewFormItem,
52
54
  ScheduleButton: () => ScheduleButton,
53
55
  SideAppViewBrowser: () => SideAppViewBrowser,
56
+ SkillFlow: () => SkillFlow_default,
57
+ SkillNode: () => SkillNode_default,
54
58
  getElement: () => getElement,
55
59
  regsiterElement: () => regsiterElement,
56
60
  useAgentChat: () => useAgentChat,
@@ -198,7 +202,7 @@ function useChat(threadId, options = {}) {
198
202
  stopStreamingRef.current = null;
199
203
  }
200
204
  const { input, command, streaming = true } = data;
201
- const { message: message6, files, ...rest } = input || {};
205
+ const { message: message8, files, ...rest } = input || {};
202
206
  setState((prev) => ({
203
207
  ...prev,
204
208
  isLoading: true,
@@ -207,7 +211,7 @@ function useChat(threadId, options = {}) {
207
211
  }));
208
212
  const userMessage = {
209
213
  id: Date.now().toString(),
210
- content: message6 || command?.resume?.message || "",
214
+ content: message8 || command?.resume?.message || "",
211
215
  files,
212
216
  role: "human"
213
217
  };
@@ -536,7 +540,7 @@ function AgentThreadProvider({
536
540
  stopStreamingRef.current = null;
537
541
  }
538
542
  const { input, command, streaming = true } = data;
539
- const { message: message6, files, ...rest } = input || {};
543
+ const { message: message8, files, ...rest } = input || {};
540
544
  setState((prev) => ({
541
545
  ...prev,
542
546
  isLoading: true,
@@ -544,7 +548,7 @@ function AgentThreadProvider({
544
548
  }));
545
549
  const userMessage = {
546
550
  id: Date.now().toString(),
547
- content: message6 || command?.resume?.message || "",
551
+ content: message8 || command?.resume?.message || "",
548
552
  files,
549
553
  role: "human"
550
554
  };
@@ -1890,7 +1894,7 @@ var import_icons = require("@ant-design/icons");
1890
1894
  var import_jsx_runtime9 = require("react/jsx-runtime");
1891
1895
  var { Text } = import_antd2.Typography;
1892
1896
  var GenericDataTable = ({ data, interactive = true, default_open_in_side_app = true }) => {
1893
- const { dataSource, message: message6 } = data ?? {};
1897
+ const { dataSource, message: message8 } = data ?? {};
1894
1898
  const [expandedRowKeys, setExpandedRowKeys] = (0, import_react9.useState)([]);
1895
1899
  const { openSideApp } = useChatUIContext();
1896
1900
  const processedData = dataSource?.map((item, index) => ({
@@ -1974,7 +1978,7 @@ var GenericDataTable = ({ data, interactive = true, default_open_in_side_app = t
1974
1978
  {
1975
1979
  size: "small",
1976
1980
  title: () => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_antd2.Flex, { justify: "space-between", align: "center", children: [
1977
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_antd2.Space, { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { strong: true, style: { fontSize: 16 }, children: message6 || "" }) }),
1981
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_antd2.Space, { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { strong: true, style: { fontSize: 16 }, children: message8 || "" }) }),
1978
1982
  /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_antd2.Space, { children: [
1979
1983
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1980
1984
  import_antd2.Button,
@@ -1995,8 +1999,8 @@ var GenericDataTable = ({ data, interactive = true, default_open_in_side_app = t
1995
1999
  onClick: () => {
1996
2000
  openSideApp({
1997
2001
  component_key: "generic_data_table",
1998
- message: message6 || "",
1999
- data: { dataSource, message: message6 }
2002
+ message: message8 || "",
2003
+ data: { dataSource, message: message8 }
2000
2004
  });
2001
2005
  },
2002
2006
  children: [
@@ -2152,11 +2156,11 @@ var ConfirmFeedback = ({
2152
2156
  data,
2153
2157
  interactive = true
2154
2158
  }) => {
2155
- const { message: message6, type, config, feedback, options } = data ?? {};
2159
+ const { message: message8, type, config, feedback, options } = data ?? {};
2156
2160
  const { sendMessage } = useAgentChat();
2157
2161
  const [clicked, setClicked] = (0, import_react11.useState)(false);
2158
2162
  return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_antd3.Space, { direction: "vertical", style: { width: "100%" }, children: [
2159
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(MDResponse, { content: message6 }),
2163
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(MDResponse, { content: message8 }),
2160
2164
  options ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_antd3.Space, { style: { justifyContent: "flex-end", width: "100%" }, children: options?.map((option) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2161
2165
  import_antd3.Button,
2162
2166
  {
@@ -3281,7 +3285,7 @@ var AttachmentsCard = ({
3281
3285
  columns = 1,
3282
3286
  showDownloadButton = false
3283
3287
  }) => {
3284
- const { Text: Text15 } = import_antd9.Typography;
3288
+ const { Text: Text18 } = import_antd9.Typography;
3285
3289
  const [showAll, setShowAll] = (0, import_react14.useState)(false);
3286
3290
  const { openSideApp } = useChatUIContext();
3287
3291
  const getStyles = () => {
@@ -3356,7 +3360,7 @@ var AttachmentsCard = ({
3356
3360
  );
3357
3361
  };
3358
3362
  const renderFileDescription = (item) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_antd9.Space, { direction: "vertical", size: size === "small" ? 2 : 4, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_antd9.Space, { children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
3359
- Text15,
3363
+ Text18,
3360
3364
  {
3361
3365
  type: "secondary",
3362
3366
  style: {
@@ -3428,7 +3432,7 @@ var AttachmentsCard = ({
3428
3432
  }
3429
3433
  ),
3430
3434
  item.files && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { style: { paddingLeft: "12px" }, children: [
3431
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Text15, { type: "secondary", style: { fontSize: "12px" }, children: [
3435
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Text18, { type: "secondary", style: { fontSize: "12px" }, children: [
3432
3436
  "\u5305\u542B\u6587\u4EF6(",
3433
3437
  item.files.length,
3434
3438
  ")"
@@ -4078,7 +4082,7 @@ var import_ErrorBoundary = __toESM(require("antd/es/alert/ErrorBoundary"));
4078
4082
  var import_react17 = require("react");
4079
4083
  var import_jsx_runtime26 = require("react/jsx-runtime");
4080
4084
  var LazyBubble = ({
4081
- message: message6,
4085
+ message: message8,
4082
4086
  renderContent,
4083
4087
  autoLoadRightPanel
4084
4088
  }) => {
@@ -4109,10 +4113,10 @@ var LazyBubble = ({
4109
4113
  autoLoadRightPanel?.();
4110
4114
  }, []);
4111
4115
  const getPlaceholder = () => {
4112
- const estimatedHeight = message6.content ? Math.min(100, message6.content.length / 5) : 100;
4116
+ const estimatedHeight = message8.content ? Math.min(100, message8.content.length / 5) : 100;
4113
4117
  return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { style: { height: `${estimatedHeight}px`, minHeight: "50px" } });
4114
4118
  };
4115
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_ErrorBoundary.default, { children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { ref, style: { width: "100%" }, children: isVisible || wasEverVisible ? renderContent(message6) : getPlaceholder() }) });
4119
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_ErrorBoundary.default, { children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { ref, style: { width: "100%" }, children: isVisible || wasEverVisible ? renderContent(message8) : getPlaceholder() }) });
4116
4120
  };
4117
4121
  var MemoizedBubbleList = (0, import_react17.memo)(
4118
4122
  ({
@@ -4143,8 +4147,8 @@ var MessageList = ({
4143
4147
  messageLengthRef.current = messages?.length;
4144
4148
  }
4145
4149
  }, [messages?.length]);
4146
- const renderContent = (0, import_react17.useCallback)((message6) => {
4147
- const { content } = message6;
4150
+ const renderContent = (0, import_react17.useCallback)((message8) => {
4151
+ const { content } = message8;
4148
4152
  try {
4149
4153
  const json = JSON.parse(content);
4150
4154
  if (json.action && json.message) {
@@ -4152,7 +4156,7 @@ var MessageList = ({
4152
4156
  }
4153
4157
  } catch (error) {
4154
4158
  }
4155
- const tool_calls_md = message6.tool_calls?.map((tool_call) => {
4159
+ const tool_calls_md = message8.tool_calls?.map((tool_call) => {
4156
4160
  return `\`\`\`tool_call
4157
4161
  ${JSON.stringify(tool_call)}
4158
4162
  \`\`\``;
@@ -4161,17 +4165,17 @@ ${JSON.stringify(tool_call)}
4161
4165
  return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_antd15.Space, { direction: "vertical", style: { width: "100%" }, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(MDResponse, { content: content_md }) });
4162
4166
  }, []);
4163
4167
  const items = (0, import_react17.useMemo)(
4164
- () => messages.map((message6, index) => ({
4165
- key: message6.id,
4166
- role: message6.role,
4168
+ () => messages.map((message8, index) => ({
4169
+ key: message8.id,
4170
+ role: message8.role,
4167
4171
  typing: false,
4168
4172
  content: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
4169
4173
  LazyBubble,
4170
4174
  {
4171
- message: message6,
4175
+ message: message8,
4172
4176
  renderContent,
4173
4177
  autoLoadRightPanel: () => {
4174
- const { content, role: role2 } = message6;
4178
+ const { content, role: role2 } = message8;
4175
4179
  const isNewAddedMessage = messageLengthRef.current > 1 && messageLengthRef.current + 1 === messages.length;
4176
4180
  if (index === messages.length - 1 && isNewAddedMessage && role2 === "ai") {
4177
4181
  try {
@@ -6304,53 +6308,2713 @@ var AgentConversations = () => {
6304
6308
  };
6305
6309
 
6306
6310
  // src/components/Chat/ChatSidebar.tsx
6311
+ var import_react36 = require("react");
6312
+ var import_antd33 = require("antd");
6313
+ var import_icons20 = require("@ant-design/icons");
6314
+
6315
+ // src/components/Chat/AssistantList.tsx
6316
+ var import_x7 = require("@ant-design/x");
6317
+ var import_antd27 = require("antd");
6318
+ var import_jsx_runtime42 = require("react/jsx-runtime");
6319
+ var AssistantList = () => {
6320
+ const { token } = import_antd27.theme.useToken();
6321
+ const { assistants, selectAssistant, currentAssistant } = useAssistantContext();
6322
+ const style = {
6323
+ width: "100%",
6324
+ background: "transparent",
6325
+ borderRadius: token.borderRadius
6326
+ };
6327
+ const items = assistants.map((assistant) => ({
6328
+ key: assistant.id,
6329
+ label: assistant.name,
6330
+ icon: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
6331
+ import_antd27.Avatar,
6332
+ {
6333
+ size: "small",
6334
+ style: {
6335
+ backgroundColor: token.colorFillSecondary,
6336
+ color: token.colorText
6337
+ },
6338
+ children: assistant.name.charAt(0).toUpperCase()
6339
+ }
6340
+ )
6341
+ }));
6342
+ return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
6343
+ import_x7.Conversations,
6344
+ {
6345
+ items,
6346
+ activeKey: currentAssistant?.id,
6347
+ style,
6348
+ onActiveChange: (key) => {
6349
+ selectAssistant(key);
6350
+ }
6351
+ }
6352
+ );
6353
+ };
6354
+
6355
+ // src/components/Chat/ChatSidebar.tsx
6356
+ var import_antd_style12 = require("antd-style");
6357
+
6358
+ // src/components/Chat/AssistantFlow.tsx
6359
+ var import_react29 = require("react");
6360
+ var import_react30 = require("@xyflow/react");
6361
+ var import_style = require("@xyflow/react/dist/style.css");
6362
+
6363
+ // src/components/Chat/AssistantNode.tsx
6307
6364
  var import_react27 = require("react");
6365
+ var import_react28 = require("@xyflow/react");
6308
6366
  var import_antd28 = require("antd");
6309
6367
  var import_icons16 = require("@ant-design/icons");
6368
+ var import_jsx_runtime43 = require("react/jsx-runtime");
6369
+ var { Text: Text14 } = import_antd28.Typography;
6370
+ var getBadgeColor = (id) => {
6371
+ const colors = [
6372
+ "#1890ff",
6373
+ // Blue
6374
+ "#52c41a",
6375
+ // Green
6376
+ "#faad14",
6377
+ // Orange
6378
+ "#f5222d",
6379
+ // Red
6380
+ "#722ed1",
6381
+ // Purple
6382
+ "#13c2c2",
6383
+ // Cyan
6384
+ "#eb2f96",
6385
+ // Magenta
6386
+ "#fa8c16"
6387
+ // Orange Red
6388
+ ];
6389
+ let hash = 0;
6390
+ for (let i = 0; i < id.length; i++) {
6391
+ hash = id.charCodeAt(i) + ((hash << 5) - hash);
6392
+ }
6393
+ return colors[Math.abs(hash) % colors.length];
6394
+ };
6395
+ var AssistantNode = ({
6396
+ data
6397
+ }) => {
6398
+ const { token } = import_antd28.theme.useToken();
6399
+ if (!data) {
6400
+ return null;
6401
+ }
6402
+ const { assistant, onClick } = data;
6403
+ if (!assistant) {
6404
+ return null;
6405
+ }
6406
+ const badgeColor = getBadgeColor(assistant.id);
6407
+ const initials = assistant.name?.split(" ").map((n) => n.charAt(0)).join("").toUpperCase().slice(0, 2) || "A";
6408
+ const { modelKey, tools, agentType, prompt, subAgents } = (0, import_react27.useMemo)(() => {
6409
+ if (!assistant.graphDefinition) {
6410
+ return {
6411
+ modelKey: void 0,
6412
+ tools: [],
6413
+ agentType: void 0,
6414
+ prompt: void 0,
6415
+ subAgents: []
6416
+ };
6417
+ }
6418
+ try {
6419
+ const graphDef = typeof assistant.graphDefinition === "string" ? JSON.parse(assistant.graphDefinition) : assistant.graphDefinition;
6420
+ return {
6421
+ modelKey: graphDef.modelKey || graphDef.model,
6422
+ tools: graphDef.tools || [],
6423
+ agentType: graphDef.type,
6424
+ prompt: graphDef.prompt,
6425
+ subAgents: graphDef.subAgents || []
6426
+ };
6427
+ } catch (error) {
6428
+ return {
6429
+ modelKey: void 0,
6430
+ tools: [],
6431
+ agentType: void 0,
6432
+ prompt: void 0,
6433
+ subAgents: []
6434
+ };
6435
+ }
6436
+ }, [assistant.graphDefinition]);
6437
+ const getAgentTypeLabel = (type) => {
6438
+ if (!type) return "";
6439
+ const typeMap = {
6440
+ react: "REACT",
6441
+ deep_agent: "DEEP AGENT",
6442
+ plan_execute: "PLAN EXECUTE",
6443
+ sequential: "SEQUENTIAL"
6444
+ };
6445
+ return typeMap[type] || type.toUpperCase();
6446
+ };
6447
+ const handleCopy = (text) => {
6448
+ navigator.clipboard.writeText(text);
6449
+ };
6450
+ const detailCardContent = /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
6451
+ "div",
6452
+ {
6453
+ style: {
6454
+ width: 480,
6455
+ maxHeight: "80vh",
6456
+ overflowY: "auto",
6457
+ padding: 16
6458
+ },
6459
+ children: [
6460
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
6461
+ "div",
6462
+ {
6463
+ style: {
6464
+ display: "flex",
6465
+ alignItems: "flex-start",
6466
+ justifyContent: "space-between",
6467
+ marginBottom: 16
6468
+ },
6469
+ children: /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { style: { flex: 1 }, children: [
6470
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
6471
+ "div",
6472
+ {
6473
+ style: {
6474
+ display: "flex",
6475
+ alignItems: "center",
6476
+ gap: 8,
6477
+ marginBottom: 8
6478
+ },
6479
+ children: [
6480
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
6481
+ Text14,
6482
+ {
6483
+ strong: true,
6484
+ style: {
6485
+ fontSize: 18,
6486
+ fontWeight: 600,
6487
+ color: token.colorText
6488
+ },
6489
+ children: assistant.name
6490
+ }
6491
+ ),
6492
+ agentType && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
6493
+ import_antd28.Tag,
6494
+ {
6495
+ color: "purple",
6496
+ style: {
6497
+ margin: 0,
6498
+ fontSize: 10,
6499
+ padding: "2px 8px",
6500
+ fontWeight: 600
6501
+ },
6502
+ children: getAgentTypeLabel(agentType)
6503
+ }
6504
+ )
6505
+ ]
6506
+ }
6507
+ ),
6508
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
6509
+ "div",
6510
+ {
6511
+ style: {
6512
+ display: "flex",
6513
+ alignItems: "center",
6514
+ gap: 6
6515
+ },
6516
+ children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
6517
+ Text14,
6518
+ {
6519
+ style: {
6520
+ fontSize: 11,
6521
+ color: token.colorTextTertiary,
6522
+ fontFamily: "monospace"
6523
+ },
6524
+ children: `>_ ${assistant.id}`
6525
+ }
6526
+ )
6527
+ }
6528
+ )
6529
+ ] })
6530
+ }
6531
+ ),
6532
+ assistant.description && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { style: { marginBottom: 16 }, children: /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
6533
+ Text14,
6534
+ {
6535
+ style: {
6536
+ fontSize: 12,
6537
+ color: token.colorText,
6538
+ lineHeight: 1.6,
6539
+ fontStyle: "italic"
6540
+ },
6541
+ children: [
6542
+ '"',
6543
+ assistant.description,
6544
+ '"'
6545
+ ]
6546
+ }
6547
+ ) }),
6548
+ modelKey && /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { style: { marginBottom: 16 }, children: [
6549
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
6550
+ "div",
6551
+ {
6552
+ style: {
6553
+ display: "flex",
6554
+ alignItems: "center",
6555
+ gap: 8,
6556
+ marginBottom: 8
6557
+ },
6558
+ children: [
6559
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
6560
+ import_icons16.SettingOutlined,
6561
+ {
6562
+ style: {
6563
+ fontSize: 14,
6564
+ color: token.colorTextSecondary
6565
+ }
6566
+ }
6567
+ ),
6568
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
6569
+ Text14,
6570
+ {
6571
+ style: {
6572
+ fontSize: 12,
6573
+ color: token.colorTextSecondary,
6574
+ fontWeight: 500
6575
+ },
6576
+ children: "Model Engine"
6577
+ }
6578
+ )
6579
+ ]
6580
+ }
6581
+ ),
6582
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
6583
+ import_antd28.Tag,
6584
+ {
6585
+ color: "blue",
6586
+ style: {
6587
+ fontSize: 11,
6588
+ padding: "4px 12px"
6589
+ },
6590
+ children: modelKey
6591
+ }
6592
+ )
6593
+ ] }),
6594
+ prompt && /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { style: { marginBottom: 16 }, children: [
6595
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
6596
+ "div",
6597
+ {
6598
+ style: {
6599
+ display: "flex",
6600
+ alignItems: "center",
6601
+ gap: 8,
6602
+ marginBottom: 8
6603
+ },
6604
+ children: [
6605
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
6606
+ import_icons16.CodeOutlined,
6607
+ {
6608
+ style: {
6609
+ fontSize: 14,
6610
+ color: token.colorTextSecondary
6611
+ }
6612
+ }
6613
+ ),
6614
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
6615
+ Text14,
6616
+ {
6617
+ style: {
6618
+ fontSize: 12,
6619
+ color: token.colorTextSecondary,
6620
+ fontWeight: 600,
6621
+ letterSpacing: 0.5
6622
+ },
6623
+ children: "SYSTEM PROMPT"
6624
+ }
6625
+ )
6626
+ ]
6627
+ }
6628
+ ),
6629
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
6630
+ "div",
6631
+ {
6632
+ style: {
6633
+ padding: 12,
6634
+ background: token.colorFillTertiary,
6635
+ border: `1px solid ${token.colorBorderSecondary}`,
6636
+ borderRadius: 4,
6637
+ maxHeight: 200,
6638
+ overflowY: "auto"
6639
+ },
6640
+ children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
6641
+ Text14,
6642
+ {
6643
+ style: {
6644
+ fontSize: 11,
6645
+ color: token.colorText,
6646
+ lineHeight: 1.6,
6647
+ whiteSpace: "pre-wrap"
6648
+ },
6649
+ children: prompt
6650
+ }
6651
+ )
6652
+ }
6653
+ )
6654
+ ] }),
6655
+ tools && tools.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { style: { marginBottom: 16 }, children: [
6656
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
6657
+ "div",
6658
+ {
6659
+ style: {
6660
+ display: "flex",
6661
+ alignItems: "center",
6662
+ gap: 8,
6663
+ marginBottom: 8
6664
+ },
6665
+ children: [
6666
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
6667
+ import_icons16.ToolOutlined,
6668
+ {
6669
+ style: {
6670
+ fontSize: 14,
6671
+ color: token.colorTextSecondary
6672
+ }
6673
+ }
6674
+ ),
6675
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
6676
+ Text14,
6677
+ {
6678
+ style: {
6679
+ fontSize: 12,
6680
+ color: token.colorTextSecondary,
6681
+ fontWeight: 500
6682
+ },
6683
+ children: [
6684
+ "Available Tools (",
6685
+ tools.length,
6686
+ ")"
6687
+ ]
6688
+ }
6689
+ )
6690
+ ]
6691
+ }
6692
+ ),
6693
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_antd28.Space, { size: [8, 8], wrap: true, children: tools.map((tool, index) => /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
6694
+ import_antd28.Tag,
6695
+ {
6696
+ color: "blue",
6697
+ style: {
6698
+ fontSize: 11,
6699
+ padding: "4px 12px"
6700
+ },
6701
+ children: tool.replace(/_/g, " ")
6702
+ },
6703
+ index
6704
+ )) })
6705
+ ] }),
6706
+ subAgents && subAgents.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { style: { marginBottom: 16 }, children: [
6707
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
6708
+ "div",
6709
+ {
6710
+ style: {
6711
+ display: "flex",
6712
+ alignItems: "center",
6713
+ gap: 8,
6714
+ marginBottom: 8
6715
+ },
6716
+ children: [
6717
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
6718
+ import_icons16.BranchesOutlined,
6719
+ {
6720
+ style: {
6721
+ fontSize: 14,
6722
+ color: token.colorTextSecondary
6723
+ }
6724
+ }
6725
+ ),
6726
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
6727
+ Text14,
6728
+ {
6729
+ style: {
6730
+ fontSize: 12,
6731
+ color: token.colorTextSecondary,
6732
+ fontWeight: 500
6733
+ },
6734
+ children: [
6735
+ "Sub-Agent Architecture (",
6736
+ subAgents.length,
6737
+ ")"
6738
+ ]
6739
+ }
6740
+ )
6741
+ ]
6742
+ }
6743
+ ),
6744
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_antd28.Space, { size: [8, 8], wrap: true, children: subAgents.map((subAgent, index) => /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
6745
+ import_antd28.Tag,
6746
+ {
6747
+ style: {
6748
+ fontSize: 11,
6749
+ padding: "4px 12px",
6750
+ backgroundColor: token.colorFillTertiary,
6751
+ color: token.colorText,
6752
+ border: `1px solid ${token.colorBorderSecondary}`
6753
+ },
6754
+ children: `> ${subAgent}`
6755
+ },
6756
+ index
6757
+ )) })
6758
+ ] }),
6759
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_antd28.Divider, { style: { margin: "16px 0" } }),
6760
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
6761
+ "div",
6762
+ {
6763
+ style: {
6764
+ display: "flex",
6765
+ alignItems: "center",
6766
+ justifyContent: "space-between",
6767
+ gap: 8
6768
+ },
6769
+ children: [
6770
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
6771
+ import_antd28.Button,
6772
+ {
6773
+ type: "primary",
6774
+ block: true,
6775
+ onClick: () => onClick?.(assistant),
6776
+ style: {
6777
+ flex: 1
6778
+ },
6779
+ children: "Configure Agent"
6780
+ }
6781
+ ),
6782
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
6783
+ import_antd28.Button,
6784
+ {
6785
+ icon: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_icons16.CopyOutlined, {}),
6786
+ onClick: () => handleCopy(assistant.id),
6787
+ title: "\u590D\u5236 ID"
6788
+ }
6789
+ )
6790
+ ]
6791
+ }
6792
+ )
6793
+ ]
6794
+ }
6795
+ );
6796
+ return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
6797
+ "div",
6798
+ {
6799
+ style: {
6800
+ padding: 4
6801
+ },
6802
+ children: [
6803
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_react28.Handle, { type: "target", position: import_react28.Position.Top }),
6804
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
6805
+ "div",
6806
+ {
6807
+ onClick: () => onClick?.(assistant),
6808
+ style: {
6809
+ width: 260,
6810
+ minHeight: 180,
6811
+ background: token.colorBgContainer,
6812
+ borderRadius: 8,
6813
+ boxShadow: `0 1px 4px rgba(0, 0, 0, 0.08)`,
6814
+ cursor: onClick ? "pointer" : "default",
6815
+ overflow: "hidden",
6816
+ transition: "all 0.2s ease",
6817
+ position: "relative",
6818
+ border: `1px solid ${token.colorBorder}`,
6819
+ display: "flex",
6820
+ flexDirection: "column"
6821
+ },
6822
+ onMouseEnter: (e) => {
6823
+ if (onClick) {
6824
+ e.currentTarget.style.transform = "translateY(-2px)";
6825
+ e.currentTarget.style.boxShadow = `0 2px 8px rgba(0, 0, 0, 0.12)`;
6826
+ }
6827
+ },
6828
+ onMouseLeave: (e) => {
6829
+ e.currentTarget.style.transform = "translateY(0)";
6830
+ e.currentTarget.style.boxShadow = `0 1px 4px rgba(0, 0, 0, 0.08)`;
6831
+ },
6832
+ children: [
6833
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
6834
+ import_antd28.Popover,
6835
+ {
6836
+ content: detailCardContent,
6837
+ title: null,
6838
+ trigger: "hover",
6839
+ placement: "rightTop",
6840
+ overlayStyle: {
6841
+ maxWidth: "none"
6842
+ },
6843
+ overlayInnerStyle: {
6844
+ padding: 0
6845
+ },
6846
+ children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
6847
+ "div",
6848
+ {
6849
+ onClick: (e) => {
6850
+ e.stopPropagation();
6851
+ },
6852
+ style: {
6853
+ position: "absolute",
6854
+ top: 8,
6855
+ right: 8,
6856
+ zIndex: 10,
6857
+ cursor: "pointer",
6858
+ padding: 4,
6859
+ borderRadius: 4,
6860
+ background: token.colorBgContainer,
6861
+ display: "flex",
6862
+ alignItems: "center",
6863
+ justifyContent: "center",
6864
+ transition: "all 0.2s ease"
6865
+ },
6866
+ onMouseEnter: (e) => {
6867
+ e.currentTarget.style.background = token.colorFillSecondary;
6868
+ },
6869
+ onMouseLeave: (e) => {
6870
+ e.currentTarget.style.background = token.colorBgContainer;
6871
+ },
6872
+ children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
6873
+ import_icons16.InfoCircleOutlined,
6874
+ {
6875
+ style: {
6876
+ fontSize: 14,
6877
+ color: token.colorTextSecondary
6878
+ }
6879
+ }
6880
+ )
6881
+ }
6882
+ )
6883
+ }
6884
+ ),
6885
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
6886
+ "div",
6887
+ {
6888
+ style: {
6889
+ padding: 12,
6890
+ display: "flex",
6891
+ flexDirection: "column",
6892
+ gap: 10
6893
+ },
6894
+ children: [
6895
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
6896
+ "div",
6897
+ {
6898
+ style: {
6899
+ display: "flex",
6900
+ alignItems: "flex-start",
6901
+ gap: 10
6902
+ },
6903
+ children: [
6904
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
6905
+ "div",
6906
+ {
6907
+ style: {
6908
+ position: "relative",
6909
+ flexShrink: 0
6910
+ },
6911
+ children: [
6912
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
6913
+ import_antd28.Avatar,
6914
+ {
6915
+ size: 44,
6916
+ icon: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_icons16.UserOutlined, {}),
6917
+ style: {
6918
+ backgroundColor: badgeColor,
6919
+ color: "#fff",
6920
+ fontSize: 16,
6921
+ fontWeight: 600
6922
+ },
6923
+ children: initials
6924
+ }
6925
+ ),
6926
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
6927
+ "div",
6928
+ {
6929
+ style: {
6930
+ position: "absolute",
6931
+ bottom: 0,
6932
+ right: 0,
6933
+ width: 10,
6934
+ height: 10,
6935
+ borderRadius: "50%",
6936
+ background: "#52c41a",
6937
+ border: `2px solid ${token.colorBgContainer}`
6938
+ }
6939
+ }
6940
+ )
6941
+ ]
6942
+ }
6943
+ ),
6944
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
6945
+ "div",
6946
+ {
6947
+ style: {
6948
+ flex: 1,
6949
+ minWidth: 0
6950
+ },
6951
+ children: [
6952
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
6953
+ Text14,
6954
+ {
6955
+ strong: true,
6956
+ style: {
6957
+ fontSize: 14,
6958
+ fontWeight: 600,
6959
+ display: "block",
6960
+ marginBottom: 3,
6961
+ color: token.colorText,
6962
+ lineHeight: 1.3
6963
+ },
6964
+ ellipsis: { tooltip: assistant.name },
6965
+ children: assistant.name
6966
+ }
6967
+ ),
6968
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
6969
+ "div",
6970
+ {
6971
+ style: {
6972
+ display: "flex",
6973
+ alignItems: "center",
6974
+ gap: 4
6975
+ },
6976
+ children: [
6977
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
6978
+ import_icons16.IdcardOutlined,
6979
+ {
6980
+ style: {
6981
+ fontSize: 9,
6982
+ color: token.colorTextTertiary
6983
+ }
6984
+ }
6985
+ ),
6986
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
6987
+ Text14,
6988
+ {
6989
+ style: {
6990
+ fontSize: 9,
6991
+ color: token.colorTextTertiary
6992
+ },
6993
+ ellipsis: { tooltip: assistant.id },
6994
+ children: assistant.id
6995
+ }
6996
+ )
6997
+ ]
6998
+ }
6999
+ )
7000
+ ]
7001
+ }
7002
+ )
7003
+ ]
7004
+ }
7005
+ ),
7006
+ assistant.description && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
7007
+ "div",
7008
+ {
7009
+ style: {
7010
+ padding: 8,
7011
+ background: token.colorFillTertiary,
7012
+ border: `1px solid ${token.colorBorderSecondary}`,
7013
+ borderRadius: 4,
7014
+ borderLeft: `2px solid ${badgeColor}`
7015
+ },
7016
+ children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
7017
+ import_antd28.Tooltip,
7018
+ {
7019
+ title: assistant.description.length > 150 ? assistant.description : void 0,
7020
+ placement: "top",
7021
+ children: /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
7022
+ "div",
7023
+ {
7024
+ style: {
7025
+ fontSize: 10,
7026
+ color: token.colorText,
7027
+ lineHeight: 1.5,
7028
+ fontStyle: "italic",
7029
+ display: "-webkit-box",
7030
+ WebkitLineClamp: 3,
7031
+ WebkitBoxOrient: "vertical",
7032
+ overflow: "hidden",
7033
+ textOverflow: "ellipsis",
7034
+ cursor: assistant.description.length > 150 ? "help" : "default"
7035
+ },
7036
+ children: [
7037
+ '"',
7038
+ assistant.description,
7039
+ '"'
7040
+ ]
7041
+ }
7042
+ )
7043
+ }
7044
+ )
7045
+ }
7046
+ ),
7047
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
7048
+ "div",
7049
+ {
7050
+ style: {
7051
+ display: "flex",
7052
+ flexWrap: "wrap",
7053
+ gap: 4,
7054
+ padding: "4px 0",
7055
+ marginTop: "auto"
7056
+ },
7057
+ children: [
7058
+ agentType && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
7059
+ import_antd28.Tag,
7060
+ {
7061
+ style: {
7062
+ margin: 0,
7063
+ fontSize: 7,
7064
+ padding: "2px 6px",
7065
+ borderRadius: 6,
7066
+ backgroundColor: token.colorPrimaryBg,
7067
+ color: token.colorPrimary,
7068
+ border: `1px solid ${token.colorPrimaryBorder}`,
7069
+ fontWeight: 500,
7070
+ lineHeight: "14px"
7071
+ },
7072
+ children: getAgentTypeLabel(agentType)
7073
+ }
7074
+ ),
7075
+ tools && tools.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
7076
+ import_antd28.Tag,
7077
+ {
7078
+ style: {
7079
+ margin: 0,
7080
+ fontSize: 7,
7081
+ padding: "2px 6px",
7082
+ borderRadius: 6,
7083
+ backgroundColor: token.colorSuccessBg,
7084
+ color: token.colorSuccess,
7085
+ border: `1px solid ${token.colorSuccessBorder}`,
7086
+ fontWeight: 500,
7087
+ lineHeight: "14px"
7088
+ },
7089
+ children: [
7090
+ tools.length,
7091
+ " Tools"
7092
+ ]
7093
+ }
7094
+ ),
7095
+ modelKey && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
7096
+ import_antd28.Tag,
7097
+ {
7098
+ style: {
7099
+ margin: 0,
7100
+ fontSize: 7,
7101
+ padding: "2px 6px",
7102
+ borderRadius: 6,
7103
+ backgroundColor: token.colorWarningBg,
7104
+ color: token.colorWarning,
7105
+ border: `1px solid ${token.colorWarningBorder}`,
7106
+ fontWeight: 500,
7107
+ lineHeight: "14px"
7108
+ },
7109
+ title: modelKey,
7110
+ children: modelKey.length > 12 ? `${modelKey.slice(0, 12)}...` : modelKey
7111
+ }
7112
+ )
7113
+ ]
7114
+ }
7115
+ )
7116
+ ]
7117
+ }
7118
+ )
7119
+ ]
7120
+ }
7121
+ ),
7122
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_react28.Handle, { type: "source", position: import_react28.Position.Bottom })
7123
+ ]
7124
+ }
7125
+ );
7126
+ };
7127
+ var AssistantNode_default = AssistantNode;
7128
+
7129
+ // src/components/Chat/AssistantFlow.tsx
7130
+ var import_jsx_runtime44 = require("react/jsx-runtime");
7131
+ var AssistantFlowInner = ({
7132
+ assistants,
7133
+ onNodeClick
7134
+ }) => {
7135
+ const [nodes, setNodes, onNodesChange] = (0, import_react30.useNodesState)([]);
7136
+ const [edges, setEdges, onEdgesChange] = (0, import_react30.useEdgesState)([]);
7137
+ const nodeTypes = (0, import_react29.useMemo)(
7138
+ () => ({
7139
+ assistant: AssistantNode_default
7140
+ }),
7141
+ []
7142
+ );
7143
+ (0, import_react29.useEffect)(() => {
7144
+ if (!assistants || assistants.length === 0) {
7145
+ setNodes([]);
7146
+ setEdges([]);
7147
+ return;
7148
+ }
7149
+ const initialNodes = [];
7150
+ const initialEdges = [];
7151
+ const nodeWidth = 280;
7152
+ const nodeHeight = 200;
7153
+ const horizontalSpacing = 320;
7154
+ const verticalSpacing = 300;
7155
+ const nodesPerRow = Math.ceil(Math.sqrt(assistants.length));
7156
+ const assistantMap = /* @__PURE__ */ new Map();
7157
+ const relationships = [];
7158
+ assistants.forEach((assistant) => {
7159
+ assistantMap.set(assistant.id, assistant);
7160
+ });
7161
+ assistants.forEach((assistant) => {
7162
+ if (assistant.graphDefinition) {
7163
+ try {
7164
+ const graphDef = typeof assistant.graphDefinition === "string" ? JSON.parse(assistant.graphDefinition) : assistant.graphDefinition;
7165
+ if (graphDef.subAgents && Array.isArray(graphDef.subAgents)) {
7166
+ graphDef.subAgents.forEach((subAgentKey) => {
7167
+ const subAssistant = assistants.find(
7168
+ (a) => a.id === subAgentKey || a.id === String(subAgentKey)
7169
+ );
7170
+ if (subAssistant && subAssistant.id !== assistant.id) {
7171
+ relationships.push({
7172
+ source: assistant.id,
7173
+ target: subAssistant.id
7174
+ });
7175
+ }
7176
+ });
7177
+ }
7178
+ if (graphDef.internalSubAgents && Array.isArray(graphDef.internalSubAgents)) {
7179
+ graphDef.internalSubAgents.forEach((internalSubAgent) => {
7180
+ if (internalSubAgent.key) {
7181
+ const subAssistant = assistants.find(
7182
+ (a) => a.id === internalSubAgent.key || a.id === String(internalSubAgent.key)
7183
+ );
7184
+ if (subAssistant && subAssistant.id !== assistant.id) {
7185
+ relationships.push({
7186
+ source: assistant.id,
7187
+ target: subAssistant.id
7188
+ });
7189
+ }
7190
+ }
7191
+ });
7192
+ }
7193
+ if (graphDef.nodes && Array.isArray(graphDef.nodes)) {
7194
+ graphDef.nodes.forEach((node) => {
7195
+ if (node.assistantId && node.assistantId !== assistant.id) {
7196
+ const targetAssistant = assistants.find(
7197
+ (a) => a.id === node.assistantId || a.id === String(node.assistantId)
7198
+ );
7199
+ if (targetAssistant) {
7200
+ relationships.push({
7201
+ source: assistant.id,
7202
+ target: targetAssistant.id
7203
+ });
7204
+ }
7205
+ }
7206
+ });
7207
+ }
7208
+ if (graphDef.edges && Array.isArray(graphDef.edges)) {
7209
+ graphDef.edges.forEach((edge) => {
7210
+ if (edge.source && edge.target) {
7211
+ const sourceId = typeof edge.source === "string" ? edge.source : edge.source.id || edge.source.assistantId;
7212
+ const targetId = typeof edge.target === "string" ? edge.target : edge.target.id || edge.target.assistantId;
7213
+ const sourceAssistant = assistants.find(
7214
+ (a) => a.id === sourceId || a.id === String(sourceId)
7215
+ );
7216
+ const targetAssistant = assistants.find(
7217
+ (a) => a.id === targetId || a.id === String(targetId)
7218
+ );
7219
+ if (sourceAssistant && targetAssistant) {
7220
+ relationships.push({
7221
+ source: sourceAssistant.id,
7222
+ target: targetAssistant.id
7223
+ });
7224
+ }
7225
+ }
7226
+ });
7227
+ }
7228
+ } catch (error) {
7229
+ console.warn(
7230
+ `Failed to parse graphDefinition for assistant ${assistant.id}:`,
7231
+ error
7232
+ );
7233
+ }
7234
+ }
7235
+ });
7236
+ const hasRelationships = relationships.length > 0;
7237
+ if (hasRelationships) {
7238
+ const processedIds = /* @__PURE__ */ new Set();
7239
+ const levelMap = /* @__PURE__ */ new Map();
7240
+ const childrenMap = /* @__PURE__ */ new Map();
7241
+ relationships.forEach((rel) => {
7242
+ if (!childrenMap.has(rel.source)) {
7243
+ childrenMap.set(rel.source, []);
7244
+ }
7245
+ childrenMap.get(rel.source).push(rel.target);
7246
+ });
7247
+ const queue = [];
7248
+ const rootNodes = assistants.filter(
7249
+ (a) => !relationships.some((r) => r.target === a.id)
7250
+ );
7251
+ if (rootNodes.length === 0 && assistants.length > 0) {
7252
+ queue.push({ id: assistants[0].id, level: 0 });
7253
+ } else {
7254
+ rootNodes.forEach((root) => {
7255
+ queue.push({ id: root.id, level: 0 });
7256
+ });
7257
+ }
7258
+ while (queue.length > 0) {
7259
+ const { id, level } = queue.shift();
7260
+ if (processedIds.has(id)) continue;
7261
+ processedIds.add(id);
7262
+ levelMap.set(id, level);
7263
+ const children = childrenMap.get(id) || [];
7264
+ children.forEach((childId) => {
7265
+ if (!processedIds.has(childId)) {
7266
+ queue.push({ id: childId, level: level + 1 });
7267
+ }
7268
+ });
7269
+ }
7270
+ assistants.forEach((assistant) => {
7271
+ if (!levelMap.has(assistant.id)) {
7272
+ levelMap.set(assistant.id, 0);
7273
+ }
7274
+ });
7275
+ const levelGroups = /* @__PURE__ */ new Map();
7276
+ assistants.forEach((assistant) => {
7277
+ const level = levelMap.get(assistant.id) || 0;
7278
+ if (!levelGroups.has(level)) {
7279
+ levelGroups.set(level, []);
7280
+ }
7281
+ levelGroups.get(level).push(assistant);
7282
+ });
7283
+ levelGroups.forEach((group, level) => {
7284
+ const y = level * verticalSpacing;
7285
+ const groupWidth = (group.length - 1) * horizontalSpacing;
7286
+ const startX = -groupWidth / 2;
7287
+ group.forEach((assistant, index) => {
7288
+ const x = startX + index * horizontalSpacing;
7289
+ initialNodes.push({
7290
+ id: assistant.id,
7291
+ type: "assistant",
7292
+ data: {
7293
+ assistant,
7294
+ onClick: () => onNodeClick?.(assistant)
7295
+ },
7296
+ position: { x, y }
7297
+ });
7298
+ });
7299
+ });
7300
+ relationships.forEach((rel) => {
7301
+ if (assistantMap.has(rel.source) && assistantMap.has(rel.target)) {
7302
+ initialEdges.push({
7303
+ id: `e${rel.source}-${rel.target}`,
7304
+ source: rel.source,
7305
+ target: rel.target,
7306
+ animated: true,
7307
+ style: { stroke: "#1677ff" },
7308
+ type: "smoothstep"
7309
+ });
7310
+ }
7311
+ });
7312
+ } else {
7313
+ assistants.forEach((assistant, index) => {
7314
+ const row = Math.floor(index / nodesPerRow);
7315
+ const col = index % nodesPerRow;
7316
+ const x = col * horizontalSpacing - (nodesPerRow - 1) * horizontalSpacing / 2;
7317
+ const y = row * verticalSpacing;
7318
+ initialNodes.push({
7319
+ id: assistant.id,
7320
+ type: "assistant",
7321
+ data: {
7322
+ assistant,
7323
+ onClick: () => onNodeClick?.(assistant)
7324
+ },
7325
+ position: { x, y }
7326
+ });
7327
+ });
7328
+ }
7329
+ setNodes(initialNodes);
7330
+ setEdges(initialEdges);
7331
+ }, [assistants, setNodes, setEdges, onNodeClick]);
7332
+ return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { style: { width: "100%", height: "100%", background: "#fafafa" }, children: /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
7333
+ import_react30.ReactFlow,
7334
+ {
7335
+ nodes,
7336
+ edges,
7337
+ onNodesChange,
7338
+ onEdgesChange,
7339
+ nodeTypes,
7340
+ fitView: true,
7341
+ children: [
7342
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_react30.Background, { color: "#eee", gap: 20 }),
7343
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_react30.Controls, {})
7344
+ ]
7345
+ }
7346
+ ) });
7347
+ };
7348
+ var AssistantFlow = (props) => /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_react30.ReactFlowProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(AssistantFlowInner, { ...props }) });
7349
+ var AssistantFlow_default = AssistantFlow;
7350
+
7351
+ // src/components/Chat/SkillFlow.tsx
7352
+ var import_react34 = require("react");
7353
+ var import_react35 = require("@xyflow/react");
7354
+ var import_style2 = require("@xyflow/react/dist/style.css");
7355
+ var import_antd32 = require("antd");
7356
+ var import_icons19 = require("@ant-design/icons");
7357
+
7358
+ // src/components/Chat/SkillNode.tsx
7359
+ var import_react31 = require("react");
7360
+ var import_react32 = require("@xyflow/react");
7361
+ var import_antd29 = require("antd");
7362
+ var import_icons17 = require("@ant-design/icons");
7363
+ var import_jsx_runtime45 = require("react/jsx-runtime");
7364
+ var { Text: Text15 } = import_antd29.Typography;
7365
+ var { TextArea } = import_antd29.Input;
7366
+ var getBadgeColor2 = (name) => {
7367
+ const colors = [
7368
+ "#1890ff",
7369
+ // Blue
7370
+ "#52c41a",
7371
+ // Green
7372
+ "#faad14",
7373
+ // Orange
7374
+ "#f5222d",
7375
+ // Red
7376
+ "#722ed1",
7377
+ // Purple
7378
+ "#13c2c2",
7379
+ // Cyan
7380
+ "#eb2f96",
7381
+ // Magenta
7382
+ "#fa8c16"
7383
+ // Orange Red
7384
+ ];
7385
+ let hash = 0;
7386
+ for (let i = 0; i < name.length; i++) {
7387
+ hash = name.charCodeAt(i) + ((hash << 5) - hash);
7388
+ }
7389
+ return colors[Math.abs(hash) % colors.length];
7390
+ };
7391
+ var SkillNode = ({ data }) => {
7392
+ const { token } = import_antd29.theme.useToken();
7393
+ const { config } = useLatticeChatShellContext();
7394
+ if (!data) {
7395
+ return null;
7396
+ }
7397
+ const { skill, onClick } = data;
7398
+ if (!skill) {
7399
+ return null;
7400
+ }
7401
+ const [currentSkill, setCurrentSkill] = (0, import_react31.useState)(skill);
7402
+ const badgeColor = getBadgeColor2(currentSkill.name);
7403
+ const initials = currentSkill.name?.split("-").map((n) => n.charAt(0)).join("").toUpperCase().slice(0, 2) || "SK";
7404
+ const hasSubSkills = currentSkill.subSkills && currentSkill.subSkills.length > 0;
7405
+ const category = currentSkill.metadata && currentSkill.metadata.category || "global";
7406
+ const metadataEntries = (0, import_react31.useMemo)(
7407
+ () => currentSkill.metadata ? Object.entries(
7408
+ currentSkill.metadata
7409
+ ).filter(
7410
+ ([key, value]) => key && value
7411
+ ) : [],
7412
+ [currentSkill.metadata]
7413
+ );
7414
+ const formatDate = (value) => {
7415
+ if (!value) return "";
7416
+ const date = value instanceof Date ? value : new Date(value);
7417
+ if (Number.isNaN(date.getTime())) return "";
7418
+ return date.toLocaleString();
7419
+ };
7420
+ const handleCopy = (text) => {
7421
+ navigator.clipboard.writeText(text);
7422
+ };
7423
+ const [isEditing, setIsEditing] = (0, import_react31.useState)(false);
7424
+ const [draftSkill, setDraftSkill] = (0, import_react31.useState)({
7425
+ ...skill,
7426
+ id: skill.name
7427
+ });
7428
+ const [metadataRows, setMetadataRows] = (0, import_react31.useState)(
7429
+ metadataEntries.map(([key, value]) => ({
7430
+ key,
7431
+ value
7432
+ }))
7433
+ );
7434
+ const [isModalOpen, setIsModalOpen] = (0, import_react31.useState)(false);
7435
+ const [saving, setSaving] = (0, import_react31.useState)(false);
7436
+ (0, import_react31.useEffect)(() => {
7437
+ setIsEditing(false);
7438
+ setCurrentSkill(skill);
7439
+ setDraftSkill({ ...skill, id: skill.name });
7440
+ setMetadataRows(
7441
+ Object.entries(
7442
+ skill.metadata || {}
7443
+ ).map(([key, value]) => ({ key, value }))
7444
+ );
7445
+ }, [skill]);
7446
+ const handleFieldChange = (field, value) => {
7447
+ if (field === "name") {
7448
+ setDraftSkill((prev) => ({
7449
+ ...prev,
7450
+ name: value,
7451
+ id: value
7452
+ // keep id and name identical
7453
+ }));
7454
+ return;
7455
+ }
7456
+ setDraftSkill((prev) => ({
7457
+ ...prev,
7458
+ [field]: value
7459
+ }));
7460
+ };
7461
+ const handleDelete = () => {
7462
+ import_antd29.Modal.confirm({
7463
+ title: "Delete skill",
7464
+ content: `Are you sure you want to delete "${currentSkill.name}"? This action cannot be undone.`,
7465
+ okText: "Delete",
7466
+ okType: "danger",
7467
+ cancelText: "Cancel",
7468
+ onOk: async () => {
7469
+ try {
7470
+ const headers = {};
7471
+ if (config.apiKey) {
7472
+ headers["Authorization"] = `Bearer ${config.apiKey}`;
7473
+ }
7474
+ const response = await fetch(
7475
+ `${config.baseURL}/api/skills/${currentSkill.id}`,
7476
+ {
7477
+ method: "DELETE",
7478
+ headers
7479
+ }
7480
+ );
7481
+ let data2 = {};
7482
+ try {
7483
+ data2 = await response.json();
7484
+ } catch {
7485
+ }
7486
+ if (response.ok && (data2.success ?? true)) {
7487
+ import_antd29.message.success("Skill deleted successfully");
7488
+ setIsModalOpen(false);
7489
+ onClick?.(currentSkill);
7490
+ } else {
7491
+ import_antd29.message.error(data2.message || "Failed to delete skill");
7492
+ }
7493
+ } catch (error) {
7494
+ import_antd29.message.error(
7495
+ error?.message || "An error occurred while deleting the skill"
7496
+ );
7497
+ }
7498
+ }
7499
+ });
7500
+ };
7501
+ const syncMetadataRows = (rows) => {
7502
+ setMetadataRows(rows);
7503
+ const metadataObject = rows.reduce((acc, curr) => {
7504
+ if (curr.key) {
7505
+ acc[curr.key] = curr.value;
7506
+ }
7507
+ return acc;
7508
+ }, {});
7509
+ setDraftSkill((prev) => ({
7510
+ ...prev,
7511
+ metadata: metadataObject
7512
+ }));
7513
+ };
7514
+ const handleMetadataChange = (index, field, value) => {
7515
+ const next = [...metadataRows];
7516
+ next[index] = {
7517
+ ...next[index],
7518
+ [field]: value
7519
+ };
7520
+ syncMetadataRows(next);
7521
+ };
7522
+ const handleAddMetadataRow = () => {
7523
+ syncMetadataRows([...metadataRows, { key: "", value: "" }]);
7524
+ };
7525
+ const handleSave = async () => {
7526
+ try {
7527
+ setSaving(true);
7528
+ const headers = {
7529
+ "Content-Type": "application/json"
7530
+ };
7531
+ if (config.apiKey) {
7532
+ headers["Authorization"] = `Bearer ${config.apiKey}`;
7533
+ }
7534
+ const requestBody = {
7535
+ name: draftSkill.name,
7536
+ description: draftSkill.description,
7537
+ license: draftSkill.license || void 0,
7538
+ compatibility: draftSkill.compatibility || void 0,
7539
+ metadata: draftSkill.metadata || void 0,
7540
+ content: draftSkill.content || void 0,
7541
+ subSkills: draftSkill.subSkills || void 0
7542
+ };
7543
+ const response = await fetch(
7544
+ `${config.baseURL}/api/skills/${currentSkill.id}`,
7545
+ {
7546
+ method: "PUT",
7547
+ headers,
7548
+ body: JSON.stringify(requestBody)
7549
+ }
7550
+ );
7551
+ const data2 = await response.json();
7552
+ if (response.ok && data2.success) {
7553
+ import_antd29.message.success("Skill updated successfully");
7554
+ const updatedSkill = data2.data || draftSkill;
7555
+ setCurrentSkill(updatedSkill);
7556
+ setDraftSkill({ ...updatedSkill, id: updatedSkill.name });
7557
+ setMetadataRows(
7558
+ Object.entries(
7559
+ updatedSkill.metadata || {}
7560
+ ).map(([key, value]) => ({ key, value }))
7561
+ );
7562
+ setIsEditing(false);
7563
+ onClick?.(updatedSkill);
7564
+ } else {
7565
+ import_antd29.message.error(data2.message || "Failed to update skill");
7566
+ }
7567
+ } catch (error) {
7568
+ import_antd29.message.error(
7569
+ error.message || "An error occurred while updating the skill"
7570
+ );
7571
+ } finally {
7572
+ setSaving(false);
7573
+ }
7574
+ };
7575
+ const editingView = /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
7576
+ "div",
7577
+ {
7578
+ style: {
7579
+ display: "flex",
7580
+ flexDirection: "column",
7581
+ gap: 12
7582
+ },
7583
+ children: [
7584
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: 6 }, children: [
7585
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Text15, { style: { fontSize: 12, color: token.colorTextSecondary }, children: "Description" }),
7586
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
7587
+ TextArea,
7588
+ {
7589
+ value: draftSkill.description,
7590
+ onChange: (e) => handleFieldChange("description", e.target.value),
7591
+ placeholder: "Description",
7592
+ autoSize: { minRows: 2, maxRows: 4 }
7593
+ }
7594
+ )
7595
+ ] }),
7596
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: 6 }, children: [
7597
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Text15, { style: { fontSize: 12, color: token.colorTextSecondary }, children: "License" }),
7598
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
7599
+ import_antd29.Input,
7600
+ {
7601
+ value: draftSkill.license,
7602
+ onChange: (e) => handleFieldChange("license", e.target.value),
7603
+ placeholder: "License"
7604
+ }
7605
+ )
7606
+ ] }),
7607
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: 6 }, children: [
7608
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Text15, { style: { fontSize: 12, color: token.colorTextSecondary }, children: "Compatibility" }),
7609
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
7610
+ import_antd29.Input,
7611
+ {
7612
+ value: draftSkill.compatibility,
7613
+ onChange: (e) => handleFieldChange("compatibility", e.target.value),
7614
+ placeholder: "Compatibility"
7615
+ }
7616
+ )
7617
+ ] }),
7618
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
7619
+ "div",
7620
+ {
7621
+ style: {
7622
+ display: "flex",
7623
+ alignItems: "center",
7624
+ justifyContent: "space-between",
7625
+ gap: 8
7626
+ },
7627
+ children: [
7628
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
7629
+ Text15,
7630
+ {
7631
+ style: {
7632
+ fontSize: 12,
7633
+ color: token.colorTextSecondary,
7634
+ fontWeight: 500
7635
+ },
7636
+ children: "Metadata"
7637
+ }
7638
+ ),
7639
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
7640
+ import_antd29.Button,
7641
+ {
7642
+ size: "small",
7643
+ icon: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_icons17.PlusOutlined, {}),
7644
+ onClick: handleAddMetadataRow,
7645
+ children: "Add"
7646
+ }
7647
+ )
7648
+ ]
7649
+ }
7650
+ ),
7651
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_antd29.Space, { direction: "vertical", size: 8, style: { width: "100%" }, children: [
7652
+ metadataRows.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
7653
+ Text15,
7654
+ {
7655
+ style: {
7656
+ fontSize: 11,
7657
+ color: token.colorTextTertiary
7658
+ },
7659
+ children: "No metadata yet. Use Add to create one."
7660
+ }
7661
+ ),
7662
+ metadataRows.map((row, index) => /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
7663
+ "div",
7664
+ {
7665
+ style: {
7666
+ display: "flex",
7667
+ flexDirection: "column",
7668
+ gap: 4,
7669
+ width: "100%"
7670
+ },
7671
+ children: [
7672
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(Text15, { style: { fontSize: 11, color: token.colorTextSecondary }, children: [
7673
+ "Meta ",
7674
+ index + 1
7675
+ ] }),
7676
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_antd29.Space, { style: { width: "100%" }, size: 8, wrap: true, children: [
7677
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
7678
+ import_antd29.Input,
7679
+ {
7680
+ value: row.key,
7681
+ placeholder: "Key",
7682
+ style: { width: 140 },
7683
+ onChange: (e) => handleMetadataChange(index, "key", e.target.value)
7684
+ }
7685
+ ),
7686
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
7687
+ import_antd29.Input,
7688
+ {
7689
+ value: row.value,
7690
+ placeholder: "Value",
7691
+ style: { flex: 1, minWidth: 200 },
7692
+ onChange: (e) => handleMetadataChange(index, "value", e.target.value)
7693
+ }
7694
+ )
7695
+ ] })
7696
+ ]
7697
+ },
7698
+ index
7699
+ ))
7700
+ ] }),
7701
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: 6 }, children: [
7702
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Text15, { style: { fontSize: 12, color: token.colorTextSecondary }, children: "Content" }),
7703
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
7704
+ TextArea,
7705
+ {
7706
+ value: draftSkill.content,
7707
+ onChange: (e) => handleFieldChange("content", e.target.value),
7708
+ placeholder: "Content",
7709
+ autoSize: { minRows: 4, maxRows: 8 }
7710
+ }
7711
+ )
7712
+ ] })
7713
+ ]
7714
+ }
7715
+ );
7716
+ const detailCardContent = /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
7717
+ "div",
7718
+ {
7719
+ style: {
7720
+ width: 480,
7721
+ maxHeight: "80vh",
7722
+ overflowY: "auto",
7723
+ padding: 16
7724
+ },
7725
+ children: [
7726
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
7727
+ "div",
7728
+ {
7729
+ style: {
7730
+ display: "flex",
7731
+ alignItems: "flex-start",
7732
+ justifyContent: "space-between",
7733
+ marginBottom: 16
7734
+ },
7735
+ children: /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { style: { flex: 1 }, children: [
7736
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
7737
+ "div",
7738
+ {
7739
+ style: {
7740
+ display: "flex",
7741
+ alignItems: "center",
7742
+ gap: 8,
7743
+ marginBottom: 8
7744
+ },
7745
+ children: [
7746
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
7747
+ Text15,
7748
+ {
7749
+ strong: true,
7750
+ style: {
7751
+ fontSize: 18,
7752
+ fontWeight: 600,
7753
+ color: token.colorText
7754
+ },
7755
+ children: currentSkill.name
7756
+ }
7757
+ ),
7758
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
7759
+ import_antd29.Tag,
7760
+ {
7761
+ style: {
7762
+ margin: 0,
7763
+ fontSize: 10,
7764
+ padding: "2px 8px",
7765
+ fontWeight: 600
7766
+ },
7767
+ color: "geekblue",
7768
+ children: category.toUpperCase()
7769
+ }
7770
+ )
7771
+ ]
7772
+ }
7773
+ ),
7774
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
7775
+ "div",
7776
+ {
7777
+ style: {
7778
+ display: "flex",
7779
+ alignItems: "center",
7780
+ gap: 6
7781
+ },
7782
+ children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
7783
+ Text15,
7784
+ {
7785
+ style: {
7786
+ fontSize: 11,
7787
+ color: token.colorTextTertiary,
7788
+ fontFamily: "monospace"
7789
+ },
7790
+ children: `>_ ${currentSkill.id}`
7791
+ }
7792
+ )
7793
+ }
7794
+ )
7795
+ ] })
7796
+ }
7797
+ ),
7798
+ isEditing ? editingView : /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_jsx_runtime45.Fragment, { children: [
7799
+ currentSkill.description && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { style: { marginBottom: 16 }, children: /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
7800
+ Text15,
7801
+ {
7802
+ style: {
7803
+ fontSize: 12,
7804
+ color: token.colorText,
7805
+ lineHeight: 1.6,
7806
+ fontStyle: "italic"
7807
+ },
7808
+ children: [
7809
+ '"',
7810
+ currentSkill.description,
7811
+ '"'
7812
+ ]
7813
+ }
7814
+ ) }),
7815
+ metadataEntries.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { style: { marginBottom: 16 }, children: [
7816
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
7817
+ "div",
7818
+ {
7819
+ style: {
7820
+ display: "flex",
7821
+ alignItems: "center",
7822
+ gap: 8,
7823
+ marginBottom: 8
7824
+ },
7825
+ children: [
7826
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
7827
+ import_icons17.InfoCircleOutlined,
7828
+ {
7829
+ style: {
7830
+ fontSize: 14,
7831
+ color: token.colorTextSecondary
7832
+ }
7833
+ }
7834
+ ),
7835
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
7836
+ Text15,
7837
+ {
7838
+ style: {
7839
+ fontSize: 12,
7840
+ color: token.colorTextSecondary,
7841
+ fontWeight: 500
7842
+ },
7843
+ children: [
7844
+ "Metadata (",
7845
+ metadataEntries.length,
7846
+ ")"
7847
+ ]
7848
+ }
7849
+ )
7850
+ ]
7851
+ }
7852
+ ),
7853
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
7854
+ "div",
7855
+ {
7856
+ style: {
7857
+ border: `1px solid ${token.colorBorderSecondary}`,
7858
+ borderRadius: 6,
7859
+ overflow: "hidden"
7860
+ },
7861
+ children: metadataEntries.map(([key, value], index) => /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
7862
+ "div",
7863
+ {
7864
+ style: {
7865
+ display: "flex",
7866
+ alignItems: "stretch",
7867
+ borderBottom: index === metadataEntries.length - 1 ? "none" : `1px solid ${token.colorBorderSecondary}`
7868
+ },
7869
+ children: [
7870
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
7871
+ "div",
7872
+ {
7873
+ style: {
7874
+ width: 140,
7875
+ padding: "8px 10px",
7876
+ background: token.colorFillTertiary,
7877
+ borderRight: `1px solid ${token.colorBorderSecondary}`,
7878
+ fontSize: 11,
7879
+ color: token.colorTextSecondary,
7880
+ fontWeight: 600,
7881
+ textTransform: "capitalize"
7882
+ },
7883
+ children: key
7884
+ }
7885
+ ),
7886
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
7887
+ "div",
7888
+ {
7889
+ style: {
7890
+ flex: 1,
7891
+ padding: "8px 10px",
7892
+ fontSize: 11,
7893
+ color: token.colorText,
7894
+ wordBreak: "break-word"
7895
+ },
7896
+ children: value
7897
+ }
7898
+ )
7899
+ ]
7900
+ },
7901
+ key
7902
+ ))
7903
+ }
7904
+ )
7905
+ ] }),
7906
+ hasSubSkills && /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { style: { marginBottom: 16 }, children: [
7907
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
7908
+ "div",
7909
+ {
7910
+ style: {
7911
+ display: "flex",
7912
+ alignItems: "center",
7913
+ gap: 8,
7914
+ marginBottom: 8
7915
+ },
7916
+ children: [
7917
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
7918
+ import_icons17.BranchesOutlined,
7919
+ {
7920
+ style: {
7921
+ fontSize: 14,
7922
+ color: token.colorTextSecondary
7923
+ }
7924
+ }
7925
+ ),
7926
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
7927
+ Text15,
7928
+ {
7929
+ style: {
7930
+ fontSize: 12,
7931
+ color: token.colorTextSecondary,
7932
+ fontWeight: 500
7933
+ },
7934
+ children: [
7935
+ "Sub-Skills (",
7936
+ currentSkill.subSkills.length,
7937
+ ")"
7938
+ ]
7939
+ }
7940
+ )
7941
+ ]
7942
+ }
7943
+ ),
7944
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_antd29.Space, { size: [8, 8], wrap: true, children: currentSkill.subSkills.map(
7945
+ (subSkill, index) => /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
7946
+ import_antd29.Tag,
7947
+ {
7948
+ style: {
7949
+ fontSize: 11,
7950
+ padding: "4px 12px",
7951
+ backgroundColor: token.colorFillTertiary,
7952
+ color: token.colorText,
7953
+ border: `1px solid ${token.colorBorderSecondary}`
7954
+ },
7955
+ children: subSkill
7956
+ },
7957
+ index
7958
+ )
7959
+ ) })
7960
+ ] }),
7961
+ (currentSkill.license || currentSkill.compatibility) && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { style: { marginBottom: 16 }, children: /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_antd29.Space, { size: [8, 8], wrap: true, children: [
7962
+ currentSkill.license && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
7963
+ import_antd29.Tag,
7964
+ {
7965
+ icon: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_icons17.CopyrightOutlined, {}),
7966
+ style: {
7967
+ margin: 0,
7968
+ fontSize: 11,
7969
+ padding: "4px 12px",
7970
+ borderRadius: 6,
7971
+ backgroundColor: token.colorInfoBg,
7972
+ color: token.colorInfo,
7973
+ border: `1px solid ${token.colorInfoBorder}`,
7974
+ fontWeight: 500,
7975
+ lineHeight: "16px"
7976
+ },
7977
+ children: currentSkill.license
7978
+ }
7979
+ ),
7980
+ currentSkill.compatibility && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
7981
+ import_antd29.Tag,
7982
+ {
7983
+ style: {
7984
+ margin: 0,
7985
+ fontSize: 11,
7986
+ padding: "4px 12px",
7987
+ borderRadius: 6,
7988
+ backgroundColor: token.colorSuccessBg,
7989
+ color: token.colorSuccess,
7990
+ border: `1px solid ${token.colorSuccessBorder}`,
7991
+ fontWeight: 500,
7992
+ lineHeight: "16px",
7993
+ display: "inline-flex",
7994
+ alignItems: "center",
7995
+ gap: 4
7996
+ },
7997
+ children: currentSkill.compatibility
7998
+ }
7999
+ )
8000
+ ] }) }),
8001
+ (currentSkill.createdAt || currentSkill.updatedAt) && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { style: { marginBottom: 16 }, children: /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_antd29.Space, { direction: "vertical", size: 4, children: [
8002
+ currentSkill.createdAt && /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
8003
+ Text15,
8004
+ {
8005
+ style: {
8006
+ fontSize: 11,
8007
+ color: token.colorTextTertiary,
8008
+ fontFamily: "monospace"
8009
+ },
8010
+ children: [
8011
+ "Created: ",
8012
+ formatDate(currentSkill.createdAt)
8013
+ ]
8014
+ }
8015
+ ),
8016
+ currentSkill.updatedAt && /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
8017
+ Text15,
8018
+ {
8019
+ style: {
8020
+ fontSize: 11,
8021
+ color: token.colorTextTertiary,
8022
+ fontFamily: "monospace"
8023
+ },
8024
+ children: [
8025
+ "Updated: ",
8026
+ formatDate(currentSkill.updatedAt)
8027
+ ]
8028
+ }
8029
+ )
8030
+ ] }) }),
8031
+ currentSkill.content && /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { style: { marginBottom: 0 }, children: [
8032
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
8033
+ "div",
8034
+ {
8035
+ style: {
8036
+ display: "flex",
8037
+ alignItems: "center",
8038
+ gap: 8,
8039
+ marginBottom: 8
8040
+ },
8041
+ children: [
8042
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
8043
+ import_icons17.FileTextOutlined,
8044
+ {
8045
+ style: {
8046
+ fontSize: 14,
8047
+ color: token.colorTextSecondary
8048
+ }
8049
+ }
8050
+ ),
8051
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
8052
+ Text15,
8053
+ {
8054
+ style: {
8055
+ fontSize: 12,
8056
+ color: token.colorTextSecondary,
8057
+ fontWeight: 600,
8058
+ letterSpacing: 0.5
8059
+ },
8060
+ children: "CONTENT"
8061
+ }
8062
+ )
8063
+ ]
8064
+ }
8065
+ ),
8066
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
8067
+ "div",
8068
+ {
8069
+ style: {
8070
+ padding: 12,
8071
+ background: token.colorFillTertiary,
8072
+ border: `1px solid ${token.colorBorderSecondary}`,
8073
+ borderRadius: 4,
8074
+ maxHeight: 200,
8075
+ overflowY: "auto"
8076
+ },
8077
+ children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
8078
+ Text15,
8079
+ {
8080
+ style: {
8081
+ fontSize: 11,
8082
+ color: token.colorText,
8083
+ lineHeight: 1.6,
8084
+ whiteSpace: "pre-wrap"
8085
+ },
8086
+ children: currentSkill.content
8087
+ }
8088
+ )
8089
+ }
8090
+ )
8091
+ ] })
8092
+ ] }),
8093
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_antd29.Divider, { style: { margin: "16px 0" } }),
8094
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
8095
+ "div",
8096
+ {
8097
+ style: {
8098
+ display: "flex",
8099
+ alignItems: "center",
8100
+ justifyContent: "space-between",
8101
+ gap: 8
8102
+ },
8103
+ children: isEditing ? /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_jsx_runtime45.Fragment, { children: [
8104
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
8105
+ import_antd29.Button,
8106
+ {
8107
+ block: true,
8108
+ onClick: () => {
8109
+ setIsEditing(false);
8110
+ setDraftSkill(skill);
8111
+ },
8112
+ style: {
8113
+ flex: 1
8114
+ },
8115
+ children: "Cancel"
8116
+ }
8117
+ ),
8118
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
8119
+ import_antd29.Button,
8120
+ {
8121
+ type: "primary",
8122
+ block: true,
8123
+ onClick: handleSave,
8124
+ loading: saving,
8125
+ style: {
8126
+ flex: 1
8127
+ },
8128
+ children: "Save"
8129
+ }
8130
+ )
8131
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_jsx_runtime45.Fragment, { children: [
8132
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
8133
+ import_antd29.Button,
8134
+ {
8135
+ type: "primary",
8136
+ block: true,
8137
+ onClick: () => setIsEditing(true),
8138
+ style: {
8139
+ flex: 1
8140
+ },
8141
+ children: "Edit Skill"
8142
+ }
8143
+ ),
8144
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_antd29.Button, { danger: true, onClick: handleDelete, children: "Delete" }),
8145
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
8146
+ import_antd29.Button,
8147
+ {
8148
+ icon: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_icons17.CopyOutlined, {}),
8149
+ onClick: () => handleCopy(currentSkill.id),
8150
+ title: "Copy ID"
8151
+ }
8152
+ )
8153
+ ] })
8154
+ }
8155
+ )
8156
+ ]
8157
+ }
8158
+ );
8159
+ const hiddenHandleStyle = {
8160
+ opacity: 0,
8161
+ background: "transparent",
8162
+ border: "none",
8163
+ width: 0,
8164
+ height: 0,
8165
+ pointerEvents: "none"
8166
+ };
8167
+ return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
8168
+ "div",
8169
+ {
8170
+ style: {
8171
+ padding: 4
8172
+ },
8173
+ children: [
8174
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
8175
+ import_react32.Handle,
8176
+ {
8177
+ type: "target",
8178
+ position: import_react32.Position.Top,
8179
+ style: hiddenHandleStyle,
8180
+ isConnectable: false
8181
+ }
8182
+ ),
8183
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
8184
+ "div",
8185
+ {
8186
+ onClick: () => {
8187
+ setIsModalOpen(true);
8188
+ },
8189
+ style: {
8190
+ width: 280,
8191
+ minHeight: 200,
8192
+ background: token.colorBgContainer,
8193
+ borderRadius: 8,
8194
+ boxShadow: `0 1px 6px rgba(0, 0, 0, 0.08)`,
8195
+ cursor: onClick ? "pointer" : "default",
8196
+ overflow: "hidden",
8197
+ transition: "all 0.2s ease",
8198
+ position: "relative",
8199
+ border: `1px solid ${token.colorBorder}`,
8200
+ display: "flex",
8201
+ flexDirection: "column"
8202
+ },
8203
+ onMouseEnter: (e) => {
8204
+ if (onClick) {
8205
+ e.currentTarget.style.transform = "translateY(-2px)";
8206
+ e.currentTarget.style.boxShadow = `0 2px 8px rgba(0, 0, 0, 0.12)`;
8207
+ }
8208
+ },
8209
+ onMouseLeave: (e) => {
8210
+ e.currentTarget.style.transform = "translateY(0)";
8211
+ e.currentTarget.style.boxShadow = `0 1px 4px rgba(0, 0, 0, 0.08)`;
8212
+ },
8213
+ children: /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
8214
+ "div",
8215
+ {
8216
+ style: {
8217
+ padding: 12,
8218
+ display: "flex",
8219
+ flexDirection: "column",
8220
+ gap: 10
8221
+ },
8222
+ children: [
8223
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
8224
+ "div",
8225
+ {
8226
+ style: {
8227
+ display: "flex",
8228
+ alignItems: "flex-start",
8229
+ gap: 10
8230
+ },
8231
+ children: [
8232
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
8233
+ "div",
8234
+ {
8235
+ style: {
8236
+ position: "relative",
8237
+ flexShrink: 0
8238
+ },
8239
+ children: [
8240
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
8241
+ import_antd29.Avatar,
8242
+ {
8243
+ size: 44,
8244
+ icon: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_icons17.BookOutlined, {}),
8245
+ style: {
8246
+ backgroundColor: badgeColor,
8247
+ color: "#fff",
8248
+ fontSize: 16,
8249
+ fontWeight: 600
8250
+ },
8251
+ children: initials
8252
+ }
8253
+ ),
8254
+ hasSubSkills && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
8255
+ "div",
8256
+ {
8257
+ style: {
8258
+ position: "absolute",
8259
+ bottom: -2,
8260
+ right: -2,
8261
+ width: 18,
8262
+ height: 18,
8263
+ borderRadius: "50%",
8264
+ background: token.colorPrimary,
8265
+ border: `2px solid ${token.colorBgContainer}`,
8266
+ display: "flex",
8267
+ alignItems: "center",
8268
+ justifyContent: "center"
8269
+ },
8270
+ children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
8271
+ import_icons17.BranchesOutlined,
8272
+ {
8273
+ style: {
8274
+ fontSize: 10,
8275
+ color: "#fff"
8276
+ }
8277
+ }
8278
+ )
8279
+ }
8280
+ )
8281
+ ]
8282
+ }
8283
+ ),
8284
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
8285
+ "div",
8286
+ {
8287
+ style: {
8288
+ flex: 1,
8289
+ minWidth: 0
8290
+ },
8291
+ children: [
8292
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
8293
+ Text15,
8294
+ {
8295
+ strong: true,
8296
+ style: {
8297
+ fontSize: 14,
8298
+ fontWeight: 600,
8299
+ display: "block",
8300
+ marginBottom: 3,
8301
+ color: token.colorText,
8302
+ lineHeight: 1.3
8303
+ },
8304
+ ellipsis: { tooltip: currentSkill.name },
8305
+ children: currentSkill.name
8306
+ }
8307
+ ),
8308
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
8309
+ "div",
8310
+ {
8311
+ style: {
8312
+ display: "flex",
8313
+ alignItems: "center",
8314
+ gap: 4
8315
+ },
8316
+ children: [
8317
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
8318
+ import_icons17.FileTextOutlined,
8319
+ {
8320
+ style: {
8321
+ fontSize: 9,
8322
+ color: token.colorTextTertiary
8323
+ }
8324
+ }
8325
+ ),
8326
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
8327
+ Text15,
8328
+ {
8329
+ style: {
8330
+ fontSize: 9,
8331
+ color: token.colorTextTertiary
8332
+ },
8333
+ ellipsis: { tooltip: currentSkill.id },
8334
+ children: currentSkill.id
8335
+ }
8336
+ )
8337
+ ]
8338
+ }
8339
+ )
8340
+ ]
8341
+ }
8342
+ )
8343
+ ]
8344
+ }
8345
+ ),
8346
+ currentSkill.description && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
8347
+ "div",
8348
+ {
8349
+ style: {
8350
+ padding: 8,
8351
+ background: token.colorFillTertiary,
8352
+ border: `1px solid ${token.colorBorderSecondary}`,
8353
+ borderRadius: 4,
8354
+ borderLeft: `2px solid ${badgeColor}`
8355
+ },
8356
+ children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
8357
+ import_antd29.Tooltip,
8358
+ {
8359
+ title: currentSkill.description.length > 150 ? currentSkill.description : void 0,
8360
+ placement: "top",
8361
+ children: /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
8362
+ "div",
8363
+ {
8364
+ style: {
8365
+ fontSize: 10,
8366
+ color: token.colorText,
8367
+ lineHeight: 1.5,
8368
+ fontStyle: "italic",
8369
+ display: "-webkit-box",
8370
+ WebkitLineClamp: 3,
8371
+ WebkitBoxOrient: "vertical",
8372
+ overflow: "hidden",
8373
+ textOverflow: "ellipsis",
8374
+ cursor: currentSkill.description.length > 150 ? "help" : "default"
8375
+ },
8376
+ children: [
8377
+ '"',
8378
+ currentSkill.description,
8379
+ '"'
8380
+ ]
8381
+ }
8382
+ )
8383
+ }
8384
+ )
8385
+ }
8386
+ ),
8387
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
8388
+ "div",
8389
+ {
8390
+ style: {
8391
+ display: "flex",
8392
+ flexWrap: "wrap",
8393
+ gap: 4,
8394
+ padding: "4px 0",
8395
+ marginTop: "auto"
8396
+ },
8397
+ children: [
8398
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
8399
+ import_antd29.Tag,
8400
+ {
8401
+ style: {
8402
+ margin: 0,
8403
+ fontSize: 8,
8404
+ padding: "2px 6px",
8405
+ borderRadius: 6,
8406
+ backgroundColor: token.colorPrimaryBg,
8407
+ color: token.colorPrimary,
8408
+ border: `1px solid ${token.colorPrimaryBorder}`,
8409
+ fontWeight: 600,
8410
+ lineHeight: "14px",
8411
+ textTransform: "capitalize"
8412
+ },
8413
+ children: category.toUpperCase()
8414
+ }
8415
+ ),
8416
+ hasSubSkills && /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
8417
+ import_antd29.Tag,
8418
+ {
8419
+ style: {
8420
+ margin: 0,
8421
+ fontSize: 8,
8422
+ padding: "2px 6px",
8423
+ borderRadius: 6,
8424
+ backgroundColor: token.colorSuccessBg,
8425
+ color: token.colorSuccess,
8426
+ border: `1px solid ${token.colorSuccessBorder}`,
8427
+ fontWeight: 500,
8428
+ lineHeight: "14px",
8429
+ display: "inline-flex",
8430
+ alignItems: "center"
8431
+ },
8432
+ children: [
8433
+ "SUB-SKILLS (",
8434
+ currentSkill.subSkills.length,
8435
+ ")"
8436
+ ]
8437
+ }
8438
+ ),
8439
+ currentSkill.license && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
8440
+ import_antd29.Tag,
8441
+ {
8442
+ style: {
8443
+ margin: 0,
8444
+ fontSize: 7,
8445
+ padding: "2px 6px",
8446
+ borderRadius: 6,
8447
+ backgroundColor: token.colorInfoBg,
8448
+ color: token.colorInfo,
8449
+ border: `1px solid ${token.colorInfoBorder}`,
8450
+ fontWeight: 500,
8451
+ lineHeight: "14px"
8452
+ },
8453
+ icon: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_icons17.CopyrightOutlined, {}),
8454
+ children: currentSkill.license
8455
+ }
8456
+ ),
8457
+ currentSkill.compatibility && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
8458
+ import_antd29.Tag,
8459
+ {
8460
+ style: {
8461
+ margin: 0,
8462
+ fontSize: 7,
8463
+ padding: "2px 6px",
8464
+ borderRadius: 6,
8465
+ backgroundColor: token.colorSuccessBg,
8466
+ color: token.colorSuccess,
8467
+ border: `1px solid ${token.colorSuccessBorder}`,
8468
+ fontWeight: 500,
8469
+ lineHeight: "14px"
8470
+ },
8471
+ icon: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_icons17.InfoCircleOutlined, {}),
8472
+ children: currentSkill.compatibility
8473
+ }
8474
+ )
8475
+ ]
8476
+ }
8477
+ )
8478
+ ]
8479
+ }
8480
+ )
8481
+ }
8482
+ ),
8483
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
8484
+ import_antd29.Modal,
8485
+ {
8486
+ open: isModalOpen,
8487
+ onCancel: () => {
8488
+ setIsModalOpen(false);
8489
+ setIsEditing(false);
8490
+ setDraftSkill({ ...currentSkill, id: currentSkill.name });
8491
+ },
8492
+ footer: null,
8493
+ width: 520,
8494
+ destroyOnClose: true,
8495
+ title: null,
8496
+ styles: {
8497
+ body: { padding: 0 }
8498
+ },
8499
+ children: detailCardContent
8500
+ }
8501
+ ),
8502
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
8503
+ import_react32.Handle,
8504
+ {
8505
+ type: "source",
8506
+ position: import_react32.Position.Bottom,
8507
+ style: hiddenHandleStyle,
8508
+ isConnectable: false
8509
+ }
8510
+ )
8511
+ ]
8512
+ }
8513
+ );
8514
+ };
8515
+ var SkillNode_default = SkillNode;
6310
8516
 
6311
- // src/components/Chat/AssistantList.tsx
6312
- var import_x7 = require("@ant-design/x");
6313
- var import_antd27 = require("antd");
6314
- var import_jsx_runtime42 = require("react/jsx-runtime");
6315
- var AssistantList = () => {
6316
- const { token } = import_antd27.theme.useToken();
6317
- const { assistants, selectAssistant, currentAssistant } = useAssistantContext();
6318
- const style = {
6319
- width: "100%",
6320
- background: "transparent",
6321
- borderRadius: token.borderRadius
8517
+ // src/components/Chat/CreateSkillModal.tsx
8518
+ var import_react33 = require("react");
8519
+ var import_antd30 = require("antd");
8520
+ var import_icons18 = require("@ant-design/icons");
8521
+ var import_antd31 = require("antd");
8522
+ var import_jsx_runtime46 = require("react/jsx-runtime");
8523
+ var { TextArea: TextArea2 } = import_antd30.Input;
8524
+ var { Text: Text16 } = import_antd30.Typography;
8525
+ var CreateSkillModal = ({
8526
+ open,
8527
+ onCancel,
8528
+ onSuccess
8529
+ }) => {
8530
+ const [form] = import_antd30.Form.useForm();
8531
+ const [loading, setLoading] = (0, import_react33.useState)(false);
8532
+ const { config } = useLatticeChatShellContext();
8533
+ const { token } = import_antd31.theme.useToken();
8534
+ const defaultMetadataRows = [{ key: "category", value: "global" }];
8535
+ const [metadataRows, setMetadataRows] = (0, import_react33.useState)(defaultMetadataRows);
8536
+ const handleSubmit = async () => {
8537
+ try {
8538
+ const values = await form.validateFields();
8539
+ setLoading(true);
8540
+ const headers = {
8541
+ "Content-Type": "application/json"
8542
+ };
8543
+ if (config.apiKey) {
8544
+ headers["Authorization"] = `Bearer ${config.apiKey}`;
8545
+ }
8546
+ const metadataObject = metadataRows.length > 0 ? metadataRows.reduce((acc, curr) => {
8547
+ if (curr.key) {
8548
+ acc[curr.key] = curr.value;
8549
+ }
8550
+ return acc;
8551
+ }, {}) : void 0;
8552
+ const requestBody = {
8553
+ id: values.name,
8554
+ // id must equal name
8555
+ name: values.name,
8556
+ description: values.description,
8557
+ license: values.license || void 0,
8558
+ compatibility: values.compatibility || void 0,
8559
+ metadata: metadataObject,
8560
+ content: values.content || void 0,
8561
+ subSkills: void 0
8562
+ // subSkills not in create form
8563
+ };
8564
+ const response = await fetch(`${config.baseURL}/api/skills`, {
8565
+ method: "POST",
8566
+ headers,
8567
+ body: JSON.stringify(requestBody)
8568
+ });
8569
+ const data = await response.json();
8570
+ if (response.ok && data.success) {
8571
+ import_antd30.message.success("Skill created successfully");
8572
+ form.resetFields();
8573
+ setMetadataRows(defaultMetadataRows);
8574
+ onSuccess?.();
8575
+ onCancel();
8576
+ } else {
8577
+ import_antd30.message.error(data.message || "Failed to create skill");
8578
+ }
8579
+ } catch (error) {
8580
+ if (error.errorFields) {
8581
+ return;
8582
+ }
8583
+ import_antd30.message.error(
8584
+ error.message || "An error occurred while creating the skill"
8585
+ );
8586
+ } finally {
8587
+ setLoading(false);
8588
+ }
6322
8589
  };
6323
- const items = assistants.map((assistant) => ({
6324
- key: assistant.id,
6325
- label: assistant.name,
6326
- icon: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
6327
- import_antd27.Avatar,
8590
+ const handleCancel = () => {
8591
+ form.resetFields();
8592
+ setMetadataRows(defaultMetadataRows);
8593
+ onCancel();
8594
+ };
8595
+ const handleMetadataChange = (index, field, value) => {
8596
+ const next = [...metadataRows];
8597
+ next[index] = {
8598
+ ...next[index],
8599
+ [field]: value
8600
+ };
8601
+ setMetadataRows(next);
8602
+ };
8603
+ const handleAddMetadataRow = () => {
8604
+ setMetadataRows([...metadataRows, { key: "", value: "" }]);
8605
+ };
8606
+ return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
8607
+ import_antd30.Modal,
8608
+ {
8609
+ title: "Create New Skill",
8610
+ open,
8611
+ onCancel: handleCancel,
8612
+ footer: null,
8613
+ width: 520,
8614
+ destroyOnClose: true,
8615
+ styles: {
8616
+ body: { padding: 16 }
8617
+ },
8618
+ children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
8619
+ import_antd30.Form,
8620
+ {
8621
+ form,
8622
+ layout: "vertical",
8623
+ onFinish: handleSubmit,
8624
+ autoComplete: "off",
8625
+ children: /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
8626
+ "div",
8627
+ {
8628
+ style: {
8629
+ display: "flex",
8630
+ flexDirection: "column",
8631
+ gap: 12
8632
+ },
8633
+ children: [
8634
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: 6 }, children: [
8635
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(Text16, { style: { fontSize: 12, color: token.colorTextSecondary }, children: "Name" }),
8636
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
8637
+ import_antd30.Form.Item,
8638
+ {
8639
+ name: "name",
8640
+ rules: [
8641
+ { required: true, message: "Please enter skill name" },
8642
+ {
8643
+ pattern: /^[a-z0-9]+(-[a-z0-9]+)*$/,
8644
+ message: "Name must be lowercase alphanumeric with single hyphens (e.g., 'my-skill')"
8645
+ },
8646
+ { min: 1, max: 64, message: "Name must be 1-64 characters" }
8647
+ ],
8648
+ style: { marginBottom: 0 },
8649
+ children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_antd30.Input, { placeholder: "e.g., data-analysis" })
8650
+ }
8651
+ )
8652
+ ] }),
8653
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: 6 }, children: [
8654
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(Text16, { style: { fontSize: 12, color: token.colorTextSecondary }, children: "Description" }),
8655
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
8656
+ import_antd30.Form.Item,
8657
+ {
8658
+ name: "description",
8659
+ rules: [
8660
+ { required: true, message: "Please enter skill description" }
8661
+ ],
8662
+ style: { marginBottom: 0 },
8663
+ children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
8664
+ TextArea2,
8665
+ {
8666
+ placeholder: "Description",
8667
+ autoSize: { minRows: 2, maxRows: 4 }
8668
+ }
8669
+ )
8670
+ }
8671
+ )
8672
+ ] }),
8673
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: 6 }, children: [
8674
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(Text16, { style: { fontSize: 12, color: token.colorTextSecondary }, children: "License" }),
8675
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_antd30.Form.Item, { name: "license", style: { marginBottom: 0 }, children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_antd30.Input, { placeholder: "License" }) })
8676
+ ] }),
8677
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: 6 }, children: [
8678
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(Text16, { style: { fontSize: 12, color: token.colorTextSecondary }, children: "Compatibility" }),
8679
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_antd30.Form.Item, { name: "compatibility", style: { marginBottom: 0 }, children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_antd30.Input, { placeholder: "Compatibility" }) })
8680
+ ] }),
8681
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: 6 }, children: [
8682
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
8683
+ "div",
8684
+ {
8685
+ style: {
8686
+ display: "flex",
8687
+ alignItems: "center",
8688
+ justifyContent: "space-between",
8689
+ gap: 8
8690
+ },
8691
+ children: [
8692
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
8693
+ Text16,
8694
+ {
8695
+ style: {
8696
+ fontSize: 12,
8697
+ color: token.colorTextSecondary,
8698
+ fontWeight: 500
8699
+ },
8700
+ children: "Metadata"
8701
+ }
8702
+ ),
8703
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
8704
+ import_antd30.Button,
8705
+ {
8706
+ size: "small",
8707
+ icon: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_icons18.PlusOutlined, {}),
8708
+ onClick: handleAddMetadataRow,
8709
+ children: "Add"
8710
+ }
8711
+ )
8712
+ ]
8713
+ }
8714
+ ),
8715
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_antd30.Space, { direction: "vertical", size: 8, style: { width: "100%" }, children: [
8716
+ metadataRows.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
8717
+ Text16,
8718
+ {
8719
+ style: {
8720
+ fontSize: 11,
8721
+ color: token.colorTextTertiary
8722
+ },
8723
+ children: "No metadata yet. Use Add to create one."
8724
+ }
8725
+ ),
8726
+ metadataRows.map((row, index) => /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
8727
+ "div",
8728
+ {
8729
+ style: {
8730
+ display: "flex",
8731
+ flexDirection: "column",
8732
+ gap: 4,
8733
+ width: "100%"
8734
+ },
8735
+ children: [
8736
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
8737
+ Text16,
8738
+ {
8739
+ style: { fontSize: 11, color: token.colorTextSecondary },
8740
+ children: [
8741
+ "Meta ",
8742
+ index + 1
8743
+ ]
8744
+ }
8745
+ ),
8746
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_antd30.Space, { style: { width: "100%" }, size: 8, wrap: true, children: [
8747
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
8748
+ import_antd30.Input,
8749
+ {
8750
+ value: row.key,
8751
+ placeholder: "Key",
8752
+ style: { width: 140 },
8753
+ onChange: (e) => handleMetadataChange(index, "key", e.target.value)
8754
+ }
8755
+ ),
8756
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
8757
+ import_antd30.Input,
8758
+ {
8759
+ value: row.value,
8760
+ placeholder: "Value",
8761
+ style: { flex: 1, minWidth: 200 },
8762
+ onChange: (e) => handleMetadataChange(index, "value", e.target.value)
8763
+ }
8764
+ )
8765
+ ] })
8766
+ ]
8767
+ },
8768
+ index
8769
+ ))
8770
+ ] })
8771
+ ] }),
8772
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: 6 }, children: [
8773
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(Text16, { style: { fontSize: 12, color: token.colorTextSecondary }, children: "Content" }),
8774
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_antd30.Form.Item, { name: "content", style: { marginBottom: 0 }, children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
8775
+ TextArea2,
8776
+ {
8777
+ placeholder: "Content",
8778
+ autoSize: { minRows: 4, maxRows: 8 }
8779
+ }
8780
+ ) })
8781
+ ] }),
8782
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
8783
+ "div",
8784
+ {
8785
+ style: {
8786
+ display: "flex",
8787
+ alignItems: "center",
8788
+ justifyContent: "flex-end",
8789
+ gap: 8,
8790
+ marginTop: 8
8791
+ },
8792
+ children: [
8793
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_antd30.Button, { onClick: handleCancel, children: "Cancel" }),
8794
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_antd30.Button, { type: "primary", htmlType: "submit", loading, children: "Create Skill" })
8795
+ ]
8796
+ }
8797
+ )
8798
+ ]
8799
+ }
8800
+ )
8801
+ }
8802
+ )
8803
+ }
8804
+ );
8805
+ };
8806
+ var CreateSkillModal_default = CreateSkillModal;
8807
+
8808
+ // src/components/Chat/SkillFlow.tsx
8809
+ var import_jsx_runtime47 = require("react/jsx-runtime");
8810
+ var SkillFlowInner = ({
8811
+ skills,
8812
+ onNodeClick,
8813
+ onRefresh
8814
+ }) => {
8815
+ const [nodes, setNodes, onNodesChange] = (0, import_react35.useNodesState)([]);
8816
+ const [edges, setEdges, onEdgesChange] = (0, import_react35.useEdgesState)([]);
8817
+ const [isCreateModalOpen, setIsCreateModalOpen] = (0, import_react34.useState)(false);
8818
+ const { token } = import_antd32.theme.useToken();
8819
+ const nodeTypes = (0, import_react34.useMemo)(
8820
+ () => ({
8821
+ skill: SkillNode_default
8822
+ }),
8823
+ []
8824
+ );
8825
+ (0, import_react34.useEffect)(() => {
8826
+ if (!skills || skills.length === 0) {
8827
+ setNodes([]);
8828
+ setEdges([]);
8829
+ return;
8830
+ }
8831
+ const initialNodes = [];
8832
+ const initialEdges = [];
8833
+ const nodeWidth = 280;
8834
+ const nodeHeight = 220;
8835
+ const horizontalSpacing = 320;
8836
+ const verticalSpacing = 300;
8837
+ const skillMap = /* @__PURE__ */ new Map();
8838
+ const relationships = [];
8839
+ const childrenMap = /* @__PURE__ */ new Map();
8840
+ skills.forEach((skill) => {
8841
+ skillMap.set(skill.name, skill);
8842
+ if (skill.subSkills && skill.subSkills.length > 0) {
8843
+ if (!childrenMap.has(skill.name)) {
8844
+ childrenMap.set(skill.name, []);
8845
+ }
8846
+ skill.subSkills.forEach((subSkillName) => {
8847
+ const subSkill = skills.find((s) => s.name === subSkillName);
8848
+ if (subSkill) {
8849
+ relationships.push({
8850
+ source: skill.name,
8851
+ target: subSkillName
8852
+ });
8853
+ childrenMap.get(skill.name).push(subSkillName);
8854
+ }
8855
+ });
8856
+ }
8857
+ });
8858
+ const hasRelationships = relationships.length > 0;
8859
+ if (hasRelationships) {
8860
+ const processedIds = /* @__PURE__ */ new Set();
8861
+ const levelMap = /* @__PURE__ */ new Map();
8862
+ const parentMap = /* @__PURE__ */ new Map();
8863
+ relationships.forEach((rel) => {
8864
+ parentMap.set(rel.target, rel.source);
8865
+ });
8866
+ const queue = [];
8867
+ const rootNodes = skills.filter(
8868
+ (s) => !parentMap.has(s.name)
8869
+ // No parent means it's a root
8870
+ );
8871
+ if (rootNodes.length === 0 && skills.length > 0) {
8872
+ queue.push({ id: skills[0].name, level: 0 });
8873
+ } else {
8874
+ rootNodes.forEach((root) => {
8875
+ queue.push({ id: root.name, level: 0 });
8876
+ });
8877
+ }
8878
+ while (queue.length > 0) {
8879
+ const { id, level } = queue.shift();
8880
+ if (processedIds.has(id)) continue;
8881
+ processedIds.add(id);
8882
+ levelMap.set(id, level);
8883
+ const children = childrenMap.get(id) || [];
8884
+ children.forEach((childId) => {
8885
+ if (!processedIds.has(childId)) {
8886
+ queue.push({ id: childId, level: level + 1 });
8887
+ }
8888
+ });
8889
+ }
8890
+ skills.forEach((skill) => {
8891
+ if (!levelMap.has(skill.name)) {
8892
+ levelMap.set(skill.name, 0);
8893
+ }
8894
+ });
8895
+ const levelGroups = /* @__PURE__ */ new Map();
8896
+ skills.forEach((skill) => {
8897
+ const level = levelMap.get(skill.name) || 0;
8898
+ if (!levelGroups.has(level)) {
8899
+ levelGroups.set(level, []);
8900
+ }
8901
+ levelGroups.get(level).push(skill);
8902
+ });
8903
+ levelGroups.forEach((group, level) => {
8904
+ const y = level * verticalSpacing;
8905
+ const groupWidth = (group.length - 1) * horizontalSpacing;
8906
+ const startX = -groupWidth / 2;
8907
+ group.forEach((skill, index) => {
8908
+ const x = startX + index * horizontalSpacing;
8909
+ initialNodes.push({
8910
+ id: skill.name,
8911
+ type: "skill",
8912
+ data: {
8913
+ skill,
8914
+ onClick: () => onNodeClick?.(skill)
8915
+ },
8916
+ position: { x, y }
8917
+ });
8918
+ });
8919
+ });
8920
+ relationships.forEach((rel) => {
8921
+ if (skillMap.has(rel.source) && skillMap.has(rel.target)) {
8922
+ initialEdges.push({
8923
+ id: `e${rel.source}-${rel.target}`,
8924
+ source: rel.source,
8925
+ target: rel.target,
8926
+ style: { stroke: "#1677ff", strokeWidth: 2 },
8927
+ type: "smoothstep"
8928
+ });
8929
+ }
8930
+ });
8931
+ } else {
8932
+ const nodesPerRow = Math.ceil(Math.sqrt(skills.length));
8933
+ skills.forEach((skill, index) => {
8934
+ const row = Math.floor(index / nodesPerRow);
8935
+ const col = index % nodesPerRow;
8936
+ const x = col * horizontalSpacing - (nodesPerRow - 1) * horizontalSpacing / 2;
8937
+ const y = row * verticalSpacing;
8938
+ initialNodes.push({
8939
+ id: skill.name,
8940
+ type: "skill",
8941
+ data: {
8942
+ skill,
8943
+ onClick: () => onNodeClick?.(skill)
8944
+ },
8945
+ position: { x, y }
8946
+ });
8947
+ });
8948
+ }
8949
+ setNodes(initialNodes);
8950
+ setEdges(initialEdges);
8951
+ }, [skills, setNodes, setEdges, onNodeClick]);
8952
+ const handleSkillCreated = async () => {
8953
+ if (onRefresh) {
8954
+ await onRefresh();
8955
+ }
8956
+ };
8957
+ return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { style: { width: "100%", height: "100%", background: "#fafafa", position: "relative" }, children: [
8958
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
8959
+ import_react35.ReactFlow,
8960
+ {
8961
+ nodes,
8962
+ edges,
8963
+ onNodesChange,
8964
+ onEdgesChange,
8965
+ nodeTypes,
8966
+ fitView: true,
8967
+ children: [
8968
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_react35.Background, { color: "#eee", gap: 20 }),
8969
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_react35.Controls, {})
8970
+ ]
8971
+ }
8972
+ ),
8973
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
8974
+ "div",
6328
8975
  {
6329
- size: "small",
6330
8976
  style: {
6331
- backgroundColor: token.colorFillSecondary,
6332
- color: token.colorText
8977
+ position: "absolute",
8978
+ bottom: 20,
8979
+ right: 20,
8980
+ zIndex: 10
6333
8981
  },
6334
- children: assistant.name.charAt(0).toUpperCase()
8982
+ children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
8983
+ import_antd32.Button,
8984
+ {
8985
+ type: "primary",
8986
+ size: "large",
8987
+ icon: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_icons19.PlusOutlined, {}),
8988
+ onClick: () => setIsCreateModalOpen(true),
8989
+ style: {
8990
+ height: 48,
8991
+ width: 48,
8992
+ borderRadius: "50%",
8993
+ boxShadow: token.boxShadowTertiary,
8994
+ display: "flex",
8995
+ alignItems: "center",
8996
+ justifyContent: "center",
8997
+ padding: 0
8998
+ }
8999
+ }
9000
+ )
6335
9001
  }
6336
- )
6337
- }));
6338
- return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
6339
- import_x7.Conversations,
6340
- {
6341
- items,
6342
- activeKey: currentAssistant?.id,
6343
- style,
6344
- onActiveChange: (key) => {
6345
- selectAssistant(key);
9002
+ ),
9003
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
9004
+ CreateSkillModal_default,
9005
+ {
9006
+ open: isCreateModalOpen,
9007
+ onCancel: () => setIsCreateModalOpen(false),
9008
+ onSuccess: handleSkillCreated
6346
9009
  }
6347
- }
6348
- );
9010
+ )
9011
+ ] });
6349
9012
  };
9013
+ var SkillFlow = (props) => /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_react35.ReactFlowProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(SkillFlowInner, { ...props }) });
9014
+ var SkillFlow_default = SkillFlow;
6350
9015
 
6351
9016
  // src/components/Chat/ChatSidebar.tsx
6352
- var import_antd_style12 = require("antd-style");
6353
- var import_jsx_runtime43 = require("react/jsx-runtime");
9017
+ var import_jsx_runtime48 = require("react/jsx-runtime");
6354
9018
  var useStyles4 = (0, import_antd_style12.createStyles)(({ token, css }) => ({
6355
9019
  sidebar: css`
6356
9020
  display: flex;
@@ -6453,6 +9117,22 @@ var useStyles4 = (0, import_antd_style12.createStyles)(({ token, css }) => ({
6453
9117
  letter-spacing: 0.5px;
6454
9118
  padding: 0 ${token.paddingXS}px;
6455
9119
  margin-bottom: ${token.marginSM}px;
9120
+ display: flex;
9121
+ align-items: center;
9122
+ justify-content: space-between;
9123
+ `,
9124
+ sectionTitleButton: css`
9125
+ font-size: ${token.fontSizeSM}px;
9126
+ padding: 0;
9127
+ height: auto;
9128
+ color: ${token.colorTextSecondary};
9129
+ border: none;
9130
+ background: transparent;
9131
+
9132
+ &:hover {
9133
+ color: ${token.colorPrimary};
9134
+ background: transparent;
9135
+ }
6456
9136
  `,
6457
9137
  footer: css`
6458
9138
  display: flex;
@@ -6558,10 +9238,15 @@ var ChatSidebar = ({
6558
9238
  }) => {
6559
9239
  const { styles } = useStyles4();
6560
9240
  const { setMenuCollapsed, menuCollapsed, sideAppVisible } = useChatUIContext();
6561
- const { setSettingsModalOpen } = useLatticeChatShellContext();
6562
- const [isHovered, setIsHovered] = (0, import_react27.useState)(false);
6563
- const [isFirstCollapse, setIsFirstCollapse] = (0, import_react27.useState)(false);
6564
- const prevIsCollapsedRef = (0, import_react27.useRef)(false);
9241
+ const { setSettingsModalOpen, config } = useLatticeChatShellContext();
9242
+ const { assistants, selectAssistant } = useAssistantContext();
9243
+ const [isHovered, setIsHovered] = (0, import_react36.useState)(false);
9244
+ const [isFirstCollapse, setIsFirstCollapse] = (0, import_react36.useState)(false);
9245
+ const [isFlowModalOpen, setIsFlowModalOpen] = (0, import_react36.useState)(false);
9246
+ const [isSkillFlowModalOpen, setIsSkillFlowModalOpen] = (0, import_react36.useState)(false);
9247
+ const [skills, setSkills] = (0, import_react36.useState)([]);
9248
+ const [skillsLoading, setSkillsLoading] = (0, import_react36.useState)(false);
9249
+ const prevIsCollapsedRef = (0, import_react36.useRef)(false);
6565
9250
  const handleToggleCollapse = () => {
6566
9251
  setMenuCollapsed(!menuCollapsed);
6567
9252
  };
@@ -6569,8 +9254,37 @@ var ChatSidebar = ({
6569
9254
  setSettingsModalOpen(true);
6570
9255
  onSettingsClick?.();
6571
9256
  };
9257
+ const handleSkillFlowClick = async () => {
9258
+ setIsSkillFlowModalOpen(true);
9259
+ if (skills.length === 0 && !skillsLoading) {
9260
+ await fetchSkills();
9261
+ }
9262
+ };
9263
+ const fetchSkills = async () => {
9264
+ setSkillsLoading(true);
9265
+ try {
9266
+ const headers = {};
9267
+ if (config.apiKey) {
9268
+ headers["Authorization"] = `Bearer ${config.apiKey}`;
9269
+ }
9270
+ const response = await fetch(`${config.baseURL}/api/skills`, {
9271
+ headers
9272
+ });
9273
+ if (response.ok) {
9274
+ const data = await response.json();
9275
+ if (data.success && data.data && Array.isArray(data.data.records)) {
9276
+ setSkills(data.data.records);
9277
+ }
9278
+ }
9279
+ } catch (error) {
9280
+ console.error("Failed to fetch skills:", error);
9281
+ setSkills([]);
9282
+ } finally {
9283
+ setSkillsLoading(false);
9284
+ }
9285
+ };
6572
9286
  const isCollapsed = menuCollapsed || sideAppVisible;
6573
- (0, import_react27.useEffect)(() => {
9287
+ (0, import_react36.useEffect)(() => {
6574
9288
  const prevIsCollapsed = prevIsCollapsedRef.current;
6575
9289
  if (isCollapsed) {
6576
9290
  const hasSeenFirstCollapse = localStorage.getItem(FIRST_COLLAPSE_KEY);
@@ -6599,54 +9313,77 @@ var ChatSidebar = ({
6599
9313
  const handleMouseLeave = () => {
6600
9314
  setIsHovered(false);
6601
9315
  };
6602
- return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_jsx_runtime43.Fragment, { children: [
6603
- /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
9316
+ return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_jsx_runtime48.Fragment, { children: [
9317
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
6604
9318
  "div",
6605
9319
  {
6606
9320
  className: `${styles.sidebar} ${isFirstCollapse ? "firstTimeHighlight" : ""}`,
6607
9321
  onMouseEnter: handleMouseEnter,
6608
9322
  onMouseLeave: handleMouseLeave,
6609
9323
  children: [
6610
- /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
6611
- import_antd28.Tooltip,
9324
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
9325
+ import_antd33.Tooltip,
6612
9326
  {
6613
9327
  title: "Move the mouse over the collapsed sidebar to see the assistants and threads",
6614
9328
  open: isFirstCollapse,
6615
9329
  placement: "right",
6616
- children: isFirstCollapse && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { style: { marginTop: "400px" } })
9330
+ children: isFirstCollapse && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { style: { marginTop: "400px" } })
6617
9331
  }
6618
9332
  ),
6619
- !isCollapsed && /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_jsx_runtime43.Fragment, { children: [
6620
- /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: styles.content, children: [
6621
- /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: styles.section, children: [
6622
- /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: styles.sectionTitle, children: "Assistants" }),
6623
- /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(AssistantList, {})
9333
+ !isCollapsed && /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_jsx_runtime48.Fragment, { children: [
9334
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: styles.content, children: [
9335
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: styles.section, children: [
9336
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: styles.sectionTitle, children: [
9337
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { children: "Assistants" }),
9338
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
9339
+ import_antd33.Button,
9340
+ {
9341
+ type: "text",
9342
+ icon: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_icons20.ApartmentOutlined, {}),
9343
+ onClick: () => setIsFlowModalOpen(true),
9344
+ className: styles.sectionTitleButton,
9345
+ title: "View Assistant Flow Canvas",
9346
+ size: "small"
9347
+ }
9348
+ )
9349
+ ] }),
9350
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(AssistantList, {})
6624
9351
  ] }),
6625
- /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_antd28.Divider, { className: styles.divider }),
6626
- /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: styles.section, children: [
6627
- /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: styles.sectionTitle, children: "Threads" }),
6628
- /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(AgentConversations, {})
9352
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_antd33.Divider, { className: styles.divider }),
9353
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: styles.section, children: [
9354
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: styles.sectionTitle, children: "Threads" }),
9355
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(AgentConversations, {})
6629
9356
  ] })
6630
9357
  ] }),
6631
- /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: styles.footer, children: [
6632
- /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
9358
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: styles.footer, children: [
9359
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
6633
9360
  "button",
6634
9361
  {
6635
9362
  className: styles.actionButton,
6636
9363
  onClick: handleToggleCollapse,
6637
9364
  title: isCollapsed ? "Expand sidebar" : "Collapse sidebar",
6638
9365
  "aria-label": isCollapsed ? "Expand sidebar" : "Collapse sidebar",
6639
- children: isCollapsed ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_icons16.MenuUnfoldOutlined, {}) : /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_icons16.MenuFoldOutlined, {})
9366
+ children: isCollapsed ? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_icons20.MenuUnfoldOutlined, {}) : /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_icons20.MenuFoldOutlined, {})
6640
9367
  }
6641
9368
  ),
6642
- /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
9369
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
9370
+ "button",
9371
+ {
9372
+ className: styles.actionButton,
9373
+ onClick: handleSkillFlowClick,
9374
+ title: "Skill Flow Canvas",
9375
+ "aria-label": "Skill Flow Canvas",
9376
+ children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_icons20.ThunderboltOutlined, {})
9377
+ }
9378
+ ),
9379
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
6643
9380
  "button",
6644
9381
  {
6645
9382
  className: styles.actionButton,
6646
9383
  onClick: handleSettingsClick,
6647
9384
  title: "Settings",
6648
9385
  "aria-label": "Settings",
6649
- children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_icons16.SettingOutlined, {})
9386
+ children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_icons20.SettingOutlined, {})
6650
9387
  }
6651
9388
  )
6652
9389
  ] })
@@ -6654,61 +9391,145 @@ var ChatSidebar = ({
6654
9391
  ]
6655
9392
  }
6656
9393
  ),
6657
- isCollapsed && /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
9394
+ isCollapsed && /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
6658
9395
  "div",
6659
9396
  {
6660
9397
  className: `${styles.hoverOverlay} ${isHovered ? "visible" : ""}`,
6661
9398
  onMouseEnter: handleMouseEnter,
6662
9399
  onMouseLeave: handleMouseLeave,
6663
9400
  children: [
6664
- /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: styles.hoverContent, children: [
6665
- /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: styles.section, children: [
6666
- /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: styles.sectionTitle, children: "Assistants" }),
6667
- /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(AssistantList, {})
9401
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: styles.hoverContent, children: [
9402
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: styles.section, children: [
9403
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: styles.sectionTitle, children: [
9404
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { children: "Assistants" }),
9405
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
9406
+ import_antd33.Button,
9407
+ {
9408
+ type: "text",
9409
+ icon: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_icons20.ApartmentOutlined, {}),
9410
+ onClick: () => setIsFlowModalOpen(true),
9411
+ className: styles.sectionTitleButton,
9412
+ title: "View Assistant Flow Canvas",
9413
+ size: "small"
9414
+ }
9415
+ )
9416
+ ] }),
9417
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(AssistantList, {})
6668
9418
  ] }),
6669
- /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_antd28.Divider, { className: styles.divider }),
6670
- /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: styles.section, children: [
6671
- /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: styles.sectionTitle, children: "Threads" }),
6672
- /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(AgentConversations, {})
9419
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_antd33.Divider, { className: styles.divider }),
9420
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: styles.section, children: [
9421
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: styles.sectionTitle, children: "Threads" }),
9422
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(AgentConversations, {})
6673
9423
  ] })
6674
9424
  ] }),
6675
- /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: styles.footer, children: [
6676
- /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
9425
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: styles.footer, children: [
9426
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
6677
9427
  "button",
6678
9428
  {
6679
9429
  className: styles.actionButton,
6680
9430
  onClick: handleToggleCollapse,
6681
9431
  title: isCollapsed ? "Expand sidebar" : "Collapse sidebar",
6682
9432
  "aria-label": isCollapsed ? "Expand sidebar" : "Collapse sidebar",
6683
- children: isCollapsed ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_icons16.MenuUnfoldOutlined, {}) : /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_icons16.MenuFoldOutlined, {})
9433
+ children: isCollapsed ? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_icons20.MenuUnfoldOutlined, {}) : /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_icons20.MenuFoldOutlined, {})
9434
+ }
9435
+ ),
9436
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
9437
+ "button",
9438
+ {
9439
+ className: styles.actionButton,
9440
+ onClick: handleSkillFlowClick,
9441
+ title: "Skill Flow Canvas",
9442
+ "aria-label": "Skill Flow Canvas",
9443
+ children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_icons20.ThunderboltOutlined, {})
6684
9444
  }
6685
9445
  ),
6686
- /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
9446
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
6687
9447
  "button",
6688
9448
  {
6689
9449
  className: styles.actionButton,
6690
9450
  onClick: handleSettingsClick,
6691
9451
  title: "Settings",
6692
9452
  "aria-label": "Settings",
6693
- children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_icons16.SettingOutlined, {})
9453
+ children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_icons20.SettingOutlined, {})
6694
9454
  }
6695
9455
  )
6696
9456
  ] })
6697
9457
  ]
6698
9458
  }
9459
+ ),
9460
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
9461
+ import_antd33.Modal,
9462
+ {
9463
+ title: "Assistant Overview",
9464
+ open: isFlowModalOpen,
9465
+ onCancel: () => setIsFlowModalOpen(false),
9466
+ footer: null,
9467
+ width: "90%",
9468
+ style: { top: 20 },
9469
+ bodyStyle: {
9470
+ height: "calc(100vh - 120px)",
9471
+ padding: 0
9472
+ },
9473
+ children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { style: { width: "100%", height: "100%" }, children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
9474
+ AssistantFlow_default,
9475
+ {
9476
+ assistants,
9477
+ onNodeClick: (assistant) => {
9478
+ selectAssistant(assistant.id);
9479
+ setIsFlowModalOpen(false);
9480
+ }
9481
+ }
9482
+ ) })
9483
+ }
9484
+ ),
9485
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
9486
+ import_antd33.Modal,
9487
+ {
9488
+ title: "Skill Overview",
9489
+ open: isSkillFlowModalOpen,
9490
+ onCancel: () => setIsSkillFlowModalOpen(false),
9491
+ footer: null,
9492
+ width: "90%",
9493
+ style: { top: 20 },
9494
+ bodyStyle: {
9495
+ height: "calc(100vh - 120px)",
9496
+ padding: 0
9497
+ },
9498
+ children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { style: { width: "100%", height: "100%" }, children: skillsLoading ? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
9499
+ "div",
9500
+ {
9501
+ style: {
9502
+ display: "flex",
9503
+ justifyContent: "center",
9504
+ alignItems: "center",
9505
+ height: "100%"
9506
+ },
9507
+ children: "Loading skills..."
9508
+ }
9509
+ ) : /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
9510
+ SkillFlow_default,
9511
+ {
9512
+ skills,
9513
+ onNodeClick: (skill) => {
9514
+ console.log("Skill clicked:", skill);
9515
+ },
9516
+ onRefresh: fetchSkills
9517
+ }
9518
+ ) })
9519
+ }
6699
9520
  )
6700
9521
  ] });
6701
9522
  };
6702
9523
 
6703
9524
  // src/components/Chat/LatticeChatView.tsx
6704
- var import_jsx_runtime44 = require("react/jsx-runtime");
9525
+ var import_jsx_runtime49 = require("react/jsx-runtime");
6705
9526
  var LatticeChatView = (props) => {
6706
9527
  const { assistantId, thread } = useConversationContext();
6707
9528
  const { currentAssistant } = useAssistantContext();
6708
9529
  const {
6709
9530
  config: { baseURL }
6710
9531
  } = useLatticeChatShellContext();
6711
- return assistantId && thread ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
9532
+ return assistantId && thread ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
6712
9533
  AxiomLatticeProvider,
6713
9534
  {
6714
9535
  config: {
@@ -6717,14 +9538,14 @@ var LatticeChatView = (props) => {
6717
9538
  assistantId,
6718
9539
  transport: "sse"
6719
9540
  },
6720
- children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
9541
+ children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
6721
9542
  LatticeChat,
6722
9543
  {
6723
9544
  thread_id: thread?.id,
6724
9545
  assistant_id: assistantId,
6725
9546
  name: currentAssistant?.name,
6726
9547
  description: currentAssistant?.description,
6727
- menu: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(ChatSidebar, {})
9548
+ menu: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(ChatSidebar, {})
6728
9549
  }
6729
9550
  )
6730
9551
  }
@@ -6732,13 +9553,13 @@ var LatticeChatView = (props) => {
6732
9553
  };
6733
9554
 
6734
9555
  // src/components/Chat/SettingsModal.tsx
6735
- var import_react28 = require("react");
6736
- var import_antd29 = require("antd");
6737
- var import_icons17 = require("@ant-design/icons");
9556
+ var import_react37 = require("react");
9557
+ var import_antd34 = require("antd");
9558
+ var import_icons21 = require("@ant-design/icons");
6738
9559
  var import_antd_style13 = require("antd-style");
6739
- var import_jsx_runtime45 = require("react/jsx-runtime");
6740
- var { Text: Text14, Title: Title3 } = import_antd29.Typography;
6741
- var { TextArea } = import_antd29.Input;
9560
+ var import_jsx_runtime50 = require("react/jsx-runtime");
9561
+ var { Text: Text17, Title: Title3 } = import_antd34.Typography;
9562
+ var { TextArea: TextArea3 } = import_antd34.Input;
6742
9563
  var useStyles5 = (0, import_antd_style13.createStyles)(({ token, css }) => ({
6743
9564
  // settingsModal: css`
6744
9565
  // .ant-modal {
@@ -7085,12 +9906,12 @@ var SETTINGS_MENU_ITEMS = [
7085
9906
  {
7086
9907
  key: "environment",
7087
9908
  label: "Environment Variables",
7088
- icon: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_icons17.EnvironmentOutlined, {})
9909
+ icon: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_icons21.EnvironmentOutlined, {})
7089
9910
  },
7090
9911
  {
7091
9912
  key: "models",
7092
9913
  label: "Model Configuration",
7093
- icon: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_icons17.ApiOutlined, {})
9914
+ icon: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_icons21.ApiOutlined, {})
7094
9915
  }
7095
9916
  ];
7096
9917
  var SettingsModal = ({
@@ -7099,7 +9920,7 @@ var SettingsModal = ({
7099
9920
  }) => {
7100
9921
  const { styles } = useStyles5();
7101
9922
  const { config: shellConfig, updateConfigValue } = useLatticeChatShellContext();
7102
- const [connections, setConnections] = (0, import_react28.useState)(() => {
9923
+ const [connections, setConnections] = (0, import_react37.useState)(() => {
7103
9924
  if (typeof window !== "undefined") {
7104
9925
  try {
7105
9926
  const stored = localStorage.getItem("lattice_server_connections");
@@ -7122,21 +9943,21 @@ var SettingsModal = ({
7122
9943
  }
7123
9944
  return [];
7124
9945
  });
7125
- const [serverConfigs, setServerConfigs] = (0, import_react28.useState)({});
7126
- const connectionsRef = (0, import_react28.useRef)(connections);
7127
- (0, import_react28.useEffect)(() => {
9946
+ const [serverConfigs, setServerConfigs] = (0, import_react37.useState)({});
9947
+ const connectionsRef = (0, import_react37.useRef)(connections);
9948
+ (0, import_react37.useEffect)(() => {
7128
9949
  connectionsRef.current = connections;
7129
9950
  }, [connections]);
7130
- const [activeTabKey, setActiveTabKey] = (0, import_react28.useState)(
9951
+ const [activeTabKey, setActiveTabKey] = (0, import_react37.useState)(
7131
9952
  connections.length > 0 ? connections[0].id : ""
7132
9953
  );
7133
- const [activeMenu, setActiveMenu] = (0, import_react28.useState)("environment");
7134
- const [loading, setLoading] = (0, import_react28.useState)(false);
7135
- const [showAddServerModal, setShowAddServerModal] = (0, import_react28.useState)(false);
7136
- const [newServerUrl, setNewServerUrl] = (0, import_react28.useState)("");
7137
- const [newServerName, setNewServerName] = (0, import_react28.useState)("");
7138
- const [newServerApiKey, setNewServerApiKey] = (0, import_react28.useState)("");
7139
- const [addingServer, setAddingServer] = (0, import_react28.useState)(false);
9954
+ const [activeMenu, setActiveMenu] = (0, import_react37.useState)("environment");
9955
+ const [loading, setLoading] = (0, import_react37.useState)(false);
9956
+ const [showAddServerModal, setShowAddServerModal] = (0, import_react37.useState)(false);
9957
+ const [newServerUrl, setNewServerUrl] = (0, import_react37.useState)("");
9958
+ const [newServerName, setNewServerName] = (0, import_react37.useState)("");
9959
+ const [newServerApiKey, setNewServerApiKey] = (0, import_react37.useState)("");
9960
+ const [addingServer, setAddingServer] = (0, import_react37.useState)(false);
7140
9961
  const saveConnections = (newConnections) => {
7141
9962
  setConnections(newConnections);
7142
9963
  if (typeof window !== "undefined") {
@@ -7275,7 +10096,7 @@ var SettingsModal = ({
7275
10096
  }
7276
10097
  } catch (error) {
7277
10098
  console.error("Failed to load configuration:", error);
7278
- import_antd29.message.error("Failed to load current configuration");
10099
+ import_antd34.message.error("Failed to load current configuration");
7279
10100
  }
7280
10101
  };
7281
10102
  const loadModelsConfig = async (serverId) => {
@@ -7326,7 +10147,7 @@ var SettingsModal = ({
7326
10147
  console.error("Failed to load models configuration:", error);
7327
10148
  }
7328
10149
  };
7329
- (0, import_react28.useEffect)(() => {
10150
+ (0, import_react37.useEffect)(() => {
7330
10151
  if (open && activeTabKey) {
7331
10152
  initializeServerConfig(activeTabKey);
7332
10153
  const connection = connections.find((c) => c.id === activeTabKey);
@@ -7335,7 +10156,7 @@ var SettingsModal = ({
7335
10156
  }
7336
10157
  }
7337
10158
  }, [open, activeTabKey]);
7338
- (0, import_react28.useEffect)(() => {
10159
+ (0, import_react37.useEffect)(() => {
7339
10160
  if (open && activeTabKey) {
7340
10161
  const connection = connections.find((c) => c.id === activeTabKey);
7341
10162
  if (connection?.connected) {
@@ -7349,7 +10170,7 @@ var SettingsModal = ({
7349
10170
  }, [open, activeTabKey, activeMenu]);
7350
10171
  const handleAddServer = async () => {
7351
10172
  if (!newServerUrl.trim()) {
7352
- import_antd29.message.error("Please enter a server URL");
10173
+ import_antd34.message.error("Please enter a server URL");
7353
10174
  return;
7354
10175
  }
7355
10176
  let normalizedUrl = newServerUrl.trim();
@@ -7375,7 +10196,7 @@ var SettingsModal = ({
7375
10196
  setNewServerUrl("");
7376
10197
  setNewServerName("");
7377
10198
  setNewServerApiKey("");
7378
- import_antd29.message.success("Server added successfully");
10199
+ import_antd34.message.success("Server added successfully");
7379
10200
  };
7380
10201
  const handleDeleteServer = (serverId) => {
7381
10202
  const newConnections = connections.filter((c) => c.id !== serverId);
@@ -7392,7 +10213,7 @@ var SettingsModal = ({
7392
10213
  setActiveTabKey("");
7393
10214
  }
7394
10215
  }
7395
- import_antd29.message.success("Server deleted");
10216
+ import_antd34.message.success("Server deleted");
7396
10217
  };
7397
10218
  const handleTabChange = (newTabKey) => {
7398
10219
  setConnections(
@@ -7406,12 +10227,12 @@ var SettingsModal = ({
7406
10227
  const handleSave = async () => {
7407
10228
  const connection = connections.find((c) => c.id === activeTabKey);
7408
10229
  if (!connection || !connection.connected) {
7409
- import_antd29.message.error("Please connect to a server first");
10230
+ import_antd34.message.error("Please connect to a server first");
7410
10231
  return;
7411
10232
  }
7412
10233
  const url = connection.url;
7413
10234
  if (!url) {
7414
- import_antd29.message.error("Please connect to a server first");
10235
+ import_antd34.message.error("Please connect to a server first");
7415
10236
  return;
7416
10237
  }
7417
10238
  try {
@@ -7475,23 +10296,23 @@ var SettingsModal = ({
7475
10296
  const data = await response.json();
7476
10297
  if (response.ok && data.success) {
7477
10298
  if (data.requiresRestart && data.requiresRestart.length > 0) {
7478
- import_antd29.message.warning(
10299
+ import_antd34.message.warning(
7479
10300
  `Configuration saved. Please restart the server for ${data.requiresRestart.join(
7480
10301
  ", "
7481
10302
  )} to take effect.`,
7482
10303
  5
7483
10304
  );
7484
10305
  } else {
7485
- import_antd29.message.success("Configuration saved and applied successfully");
10306
+ import_antd34.message.success("Configuration saved and applied successfully");
7486
10307
  }
7487
10308
  if (data.warnings && data.warnings.length > 0) {
7488
10309
  data.warnings.forEach((warning) => {
7489
- import_antd29.message.warning(warning, 5);
10310
+ import_antd34.message.warning(warning, 5);
7490
10311
  });
7491
10312
  }
7492
10313
  onClose();
7493
10314
  } else {
7494
- import_antd29.message.error(data.error || "Failed to save configuration");
10315
+ import_antd34.message.error(data.error || "Failed to save configuration");
7495
10316
  }
7496
10317
  } else if (activeMenu === "models") {
7497
10318
  const validModels = config.models.filter(
@@ -7510,17 +10331,17 @@ var SettingsModal = ({
7510
10331
  });
7511
10332
  const data = await response.json();
7512
10333
  if (response.ok && data.success) {
7513
- import_antd29.message.success(
10334
+ import_antd34.message.success(
7514
10335
  "Model configuration saved and registered successfully"
7515
10336
  );
7516
10337
  onClose();
7517
10338
  } else {
7518
- import_antd29.message.error(data.error || "Failed to save model configuration");
10339
+ import_antd34.message.error(data.error || "Failed to save model configuration");
7519
10340
  }
7520
10341
  }
7521
10342
  } catch (error) {
7522
10343
  console.error("Failed to save configuration:", error);
7523
- import_antd29.message.error(error.message || "Failed to save configuration");
10344
+ import_antd34.message.error(error.message || "Failed to save configuration");
7524
10345
  } finally {
7525
10346
  setLoading(false);
7526
10347
  }
@@ -7536,25 +10357,25 @@ var SettingsModal = ({
7536
10357
  }
7537
10358
  }));
7538
10359
  };
7539
- return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: styles.formContainer, children: [
7540
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
7541
- import_antd29.Alert,
10360
+ return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: styles.formContainer, children: [
10361
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10362
+ import_antd34.Alert,
7542
10363
  {
7543
10364
  message: "Configuration Effect",
7544
- description: /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { children: [
7545
- /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { style: { marginBottom: 8 }, children: [
7546
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
7547
- import_icons17.CheckCircleOutlined,
10365
+ description: /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { children: [
10366
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { style: { marginBottom: 8 }, children: [
10367
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10368
+ import_icons21.CheckCircleOutlined,
7548
10369
  {
7549
10370
  style: { color: "#52c41a", marginRight: 8 }
7550
10371
  }
7551
10372
  ),
7552
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("strong", { children: "Immediately effective:" }),
10373
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("strong", { children: "Immediately effective:" }),
7553
10374
  " QUEUE_SERVICE_TYPE, REDIS_URL, REDIS_PASSWORD, QUEUE_NAME"
7554
10375
  ] }),
7555
- /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { children: [
7556
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_icons17.ReloadOutlined, { style: { color: "#faad14", marginRight: 8 } }),
7557
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("strong", { children: "Requires restart:" }),
10376
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { children: [
10377
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_icons21.ReloadOutlined, { style: { color: "#faad14", marginRight: 8 } }),
10378
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("strong", { children: "Requires restart:" }),
7558
10379
  " PORT (server must be restarted to change port)"
7559
10380
  ] })
7560
10381
  ] }),
@@ -7563,9 +10384,9 @@ var SettingsModal = ({
7563
10384
  className: styles.alertCard
7564
10385
  }
7565
10386
  ),
7566
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { style: { marginBottom: 24 }, children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Text14, { 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." }) }),
7567
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
7568
- TextArea,
10387
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { style: { marginBottom: 24 }, children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Text17, { 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." }) }),
10388
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10389
+ TextArea3,
7569
10390
  {
7570
10391
  value: config.envText,
7571
10392
  onChange: (e) => setEnvText(e.target.value),
@@ -7641,10 +10462,10 @@ QUEUE_NAME=tasks`,
7641
10462
  }));
7642
10463
  }
7643
10464
  };
7644
- return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: styles.formContainer, children: [
7645
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { style: { marginBottom: 32 }, children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Text14, { 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." }) }),
7646
- config.models.map((model, index) => /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: styles.card, children: [
7647
- /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
10465
+ return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: styles.formContainer, children: [
10466
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { style: { marginBottom: 32 }, children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Text17, { 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." }) }),
10467
+ config.models.map((model, index) => /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: styles.card, children: [
10468
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(
7648
10469
  "div",
7649
10470
  {
7650
10471
  style: {
@@ -7656,13 +10477,13 @@ QUEUE_NAME=tasks`,
7656
10477
  borderBottom: "1px solid rgba(0, 0, 0, 0.06)"
7657
10478
  },
7658
10479
  children: [
7659
- /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { children: [
7660
- /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(Text14, { strong: true, style: { fontSize: 16 }, children: [
10480
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { children: [
10481
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(Text17, { strong: true, style: { fontSize: 16 }, children: [
7661
10482
  "Model ",
7662
10483
  index + 1
7663
10484
  ] }),
7664
- model.key && /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
7665
- Text14,
10485
+ model.key && /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(
10486
+ Text17,
7666
10487
  {
7667
10488
  type: "secondary",
7668
10489
  style: { marginLeft: 8, fontSize: 12 },
@@ -7674,8 +10495,8 @@ QUEUE_NAME=tasks`,
7674
10495
  }
7675
10496
  )
7676
10497
  ] }),
7677
- config.models.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
7678
- import_antd29.Button,
10498
+ config.models.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10499
+ import_antd34.Button,
7679
10500
  {
7680
10501
  type: "text",
7681
10502
  danger: true,
@@ -7691,11 +10512,11 @@ QUEUE_NAME=tasks`,
7691
10512
  ]
7692
10513
  }
7693
10514
  ),
7694
- /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_antd29.Space, { direction: "vertical", style: { width: "100%" }, size: "large", children: [
7695
- /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { children: [
7696
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Text14, { className: styles.formLabel, children: "Key *" }),
7697
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
7698
- import_antd29.Input,
10515
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(import_antd34.Space, { direction: "vertical", style: { width: "100%" }, size: "large", children: [
10516
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { children: [
10517
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Text17, { className: styles.formLabel, children: "Key *" }),
10518
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10519
+ import_antd34.Input,
7699
10520
  {
7700
10521
  placeholder: "e.g., default, gpt-4, claude",
7701
10522
  value: model.key,
@@ -7703,12 +10524,12 @@ QUEUE_NAME=tasks`,
7703
10524
  style: { height: 40 }
7704
10525
  }
7705
10526
  ),
7706
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Text14, { className: styles.formDescription, children: "Unique identifier for this model" })
10527
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Text17, { className: styles.formDescription, children: "Unique identifier for this model" })
7707
10528
  ] }),
7708
- /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { children: [
7709
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Text14, { className: styles.formLabel, children: "Provider *" }),
7710
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
7711
- import_antd29.Select,
10529
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { children: [
10530
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Text17, { className: styles.formLabel, children: "Provider *" }),
10531
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10532
+ import_antd34.Select,
7712
10533
  {
7713
10534
  style: { width: "100%", height: 40 },
7714
10535
  value: model.provider,
@@ -7723,10 +10544,10 @@ QUEUE_NAME=tasks`,
7723
10544
  }
7724
10545
  )
7725
10546
  ] }),
7726
- /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { children: [
7727
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Text14, { className: styles.formLabel, children: "Model Name *" }),
7728
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
7729
- import_antd29.Input,
10547
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { children: [
10548
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Text17, { className: styles.formLabel, children: "Model Name *" }),
10549
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10550
+ import_antd34.Input,
7730
10551
  {
7731
10552
  placeholder: "e.g., gpt-4, claude-3-opus, kimi-k2-250905",
7732
10553
  value: model.model,
@@ -7735,10 +10556,10 @@ QUEUE_NAME=tasks`,
7735
10556
  }
7736
10557
  )
7737
10558
  ] }),
7738
- /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { children: [
7739
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Text14, { className: styles.formLabel, children: "API Key" }),
7740
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
7741
- import_antd29.Input.Password,
10559
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { children: [
10560
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Text17, { className: styles.formLabel, children: "API Key" }),
10561
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10562
+ import_antd34.Input.Password,
7742
10563
  {
7743
10564
  placeholder: "Enter your API key",
7744
10565
  value: model.apiKey,
@@ -7746,12 +10567,12 @@ QUEUE_NAME=tasks`,
7746
10567
  style: { height: 40 }
7747
10568
  }
7748
10569
  ),
7749
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Text14, { className: styles.formDescription, children: "API key for the model provider. Leave empty to use environment variable." })
10570
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Text17, { className: styles.formDescription, children: "API key for the model provider. Leave empty to use environment variable." })
7750
10571
  ] }),
7751
- /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { children: [
7752
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Text14, { className: styles.formLabel, children: "Base URL" }),
7753
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
7754
- import_antd29.Input,
10572
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { children: [
10573
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Text17, { className: styles.formLabel, children: "Base URL" }),
10574
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10575
+ import_antd34.Input,
7755
10576
  {
7756
10577
  placeholder: "e.g., https://api.openai.com/v1",
7757
10578
  value: model.baseURL,
@@ -7759,23 +10580,23 @@ QUEUE_NAME=tasks`,
7759
10580
  style: { height: 40 }
7760
10581
  }
7761
10582
  ),
7762
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Text14, { className: styles.formDescription, children: "Optional custom base URL for the API" })
10583
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Text17, { className: styles.formDescription, children: "Optional custom base URL for the API" })
7763
10584
  ] }),
7764
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_antd29.Space, { children: [
7765
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
7766
- import_antd29.Switch,
10585
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(import_antd34.Space, { children: [
10586
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10587
+ import_antd34.Switch,
7767
10588
  {
7768
10589
  checked: model.streaming,
7769
10590
  onChange: (checked) => handleModelChange(index, "streaming", checked)
7770
10591
  }
7771
10592
  ),
7772
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Text14, { children: "Enable Streaming" })
10593
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Text17, { children: "Enable Streaming" })
7773
10594
  ] }) }),
7774
- /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { style: { display: "flex", gap: 20 }, children: [
7775
- /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { style: { flex: 1 }, children: [
7776
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Text14, { className: styles.formLabel, children: "Max Tokens" }),
7777
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
7778
- import_antd29.Input,
10595
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { style: { display: "flex", gap: 20 }, children: [
10596
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { style: { flex: 1 }, children: [
10597
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Text17, { className: styles.formLabel, children: "Max Tokens" }),
10598
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10599
+ import_antd34.Input,
7779
10600
  {
7780
10601
  type: "number",
7781
10602
  placeholder: "e.g., 4096",
@@ -7789,10 +10610,10 @@ QUEUE_NAME=tasks`,
7789
10610
  }
7790
10611
  )
7791
10612
  ] }),
7792
- /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { style: { flex: 1 }, children: [
7793
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Text14, { className: styles.formLabel, children: "Temperature" }),
7794
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
7795
- import_antd29.Input,
10613
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { style: { flex: 1 }, children: [
10614
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Text17, { className: styles.formLabel, children: "Temperature" }),
10615
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10616
+ import_antd34.Input,
7796
10617
  {
7797
10618
  type: "number",
7798
10619
  step: "0.1",
@@ -7810,8 +10631,8 @@ QUEUE_NAME=tasks`,
7810
10631
  ] })
7811
10632
  ] })
7812
10633
  ] }, index)),
7813
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
7814
- import_antd29.Button,
10634
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10635
+ import_antd34.Button,
7815
10636
  {
7816
10637
  type: "dashed",
7817
10638
  onClick: handleAddModel,
@@ -7838,9 +10659,9 @@ QUEUE_NAME=tasks`,
7838
10659
  );
7839
10660
  const currentConnection = connections.find((c) => c.id === activeTabKey);
7840
10661
  const renderTabLabel = (connection) => {
7841
- return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { style: { display: "flex", alignItems: "center" }, children: [
7842
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
7843
- import_icons17.CloudServerOutlined,
10662
+ return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { style: { display: "flex", alignItems: "center" }, children: [
10663
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10664
+ import_icons21.CloudServerOutlined,
7844
10665
  {
7845
10666
  style: {
7846
10667
  marginRight: 8,
@@ -7848,15 +10669,15 @@ QUEUE_NAME=tasks`,
7848
10669
  }
7849
10670
  }
7850
10671
  ),
7851
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { children: connection.name }),
7852
- connection.connected && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
7853
- import_icons17.CheckCircleFilled,
10672
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { children: connection.name }),
10673
+ connection.connected && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10674
+ import_icons21.CheckCircleFilled,
7854
10675
  {
7855
10676
  style: { color: "#52c41a", fontSize: 12, marginLeft: 8 }
7856
10677
  }
7857
10678
  ),
7858
- connection.error && !connection.connecting && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
7859
- import_icons17.CloseCircleFilled,
10679
+ connection.error && !connection.connecting && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10680
+ import_icons21.CloseCircleFilled,
7860
10681
  {
7861
10682
  style: { color: "#ff4d4f", fontSize: 12, marginLeft: 8 }
7862
10683
  }
@@ -7866,35 +10687,35 @@ QUEUE_NAME=tasks`,
7866
10687
  const tabItems = connections.map((connection) => ({
7867
10688
  key: connection.id,
7868
10689
  label: renderTabLabel(connection),
7869
- children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { className: styles.tabContent, children: connection.connected ? /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_jsx_runtime45.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { style: { display: "flex", height: "100%" }, children: [
7870
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { className: styles.sidebar, children: SETTINGS_MENU_ITEMS.map((item) => /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
10690
+ children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className: styles.tabContent, children: connection.connected ? /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_jsx_runtime50.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { style: { display: "flex", height: "100%" }, children: [
10691
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className: styles.sidebar, children: SETTINGS_MENU_ITEMS.map((item) => /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(
7871
10692
  "div",
7872
10693
  {
7873
10694
  className: `${styles.menuItem} ${activeMenu === item.key ? "active" : ""}`,
7874
10695
  onClick: () => setActiveMenu(item.key),
7875
10696
  children: [
7876
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { className: styles.menuItemIcon, children: item.icon }),
7877
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { className: styles.menuItemText, children: item.label })
10697
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: styles.menuItemIcon, children: item.icon }),
10698
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: styles.menuItemText, children: item.label })
7878
10699
  ]
7879
10700
  },
7880
10701
  item.key
7881
10702
  )) }),
7882
- /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: styles.content, children: [
7883
- /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: styles.contentHeader, children: [
7884
- /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: styles.contentHeaderLeft, children: [
7885
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Title3, { level: 3, className: styles.contentTitle, children: activeMenuItem?.label }),
7886
- /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(Text14, { className: styles.contentDescription, children: [
10703
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: styles.content, children: [
10704
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: styles.contentHeader, children: [
10705
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: styles.contentHeaderLeft, children: [
10706
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Title3, { level: 3, className: styles.contentTitle, children: activeMenuItem?.label }),
10707
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(Text17, { className: styles.contentDescription, children: [
7887
10708
  activeMenu === "environment" && "Manage environment variables for the gateway server",
7888
10709
  activeMenu === "models" && "Configure and register model lattices for use by agents"
7889
10710
  ] })
7890
10711
  ] }),
7891
- /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: styles.contentHeaderRight, children: [
7892
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_antd29.Button, { onClick: onClose, children: "Cancel" }),
7893
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
7894
- import_antd29.Button,
10712
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: styles.contentHeaderRight, children: [
10713
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_antd34.Button, { onClick: onClose, children: "Cancel" }),
10714
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10715
+ import_antd34.Button,
7895
10716
  {
7896
10717
  type: "primary",
7897
- icon: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_icons17.SaveOutlined, {}),
10718
+ icon: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_icons21.SaveOutlined, {}),
7898
10719
  onClick: handleSave,
7899
10720
  loading,
7900
10721
  children: "Save Configuration"
@@ -7902,9 +10723,9 @@ QUEUE_NAME=tasks`,
7902
10723
  )
7903
10724
  ] })
7904
10725
  ] }),
7905
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { className: styles.contentBody, children: renderContent(connection.id) })
10726
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className: styles.contentBody, children: renderContent(connection.id) })
7906
10727
  ] })
7907
- ] }) }) : /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
10728
+ ] }) }) : /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
7908
10729
  "div",
7909
10730
  {
7910
10731
  style: {
@@ -7916,29 +10737,29 @@ QUEUE_NAME=tasks`,
7916
10737
  gap: 16,
7917
10738
  padding: 48
7918
10739
  },
7919
- children: connection.connecting ? /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_jsx_runtime45.Fragment, { children: [
7920
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_icons17.LinkOutlined, { style: { fontSize: 64, color: "#1890ff" }, spin: true }),
7921
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Title3, { level: 4, children: "Connecting..." }),
7922
- /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(Text14, { type: "secondary", style: { textAlign: "center" }, children: [
10740
+ children: connection.connecting ? /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(import_jsx_runtime50.Fragment, { children: [
10741
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_icons21.LinkOutlined, { style: { fontSize: 64, color: "#1890ff" }, spin: true }),
10742
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Title3, { level: 4, children: "Connecting..." }),
10743
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(Text17, { type: "secondary", style: { textAlign: "center" }, children: [
7923
10744
  "Connecting to ",
7924
10745
  connection.url
7925
10746
  ] })
7926
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_jsx_runtime45.Fragment, { children: [
7927
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_icons17.LinkOutlined, { style: { fontSize: 64, color: "#d9d9d9" } }),
7928
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Title3, { level: 4, type: "secondary", children: connection.error || "Not Connected" }),
7929
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
7930
- Text14,
10747
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(import_jsx_runtime50.Fragment, { children: [
10748
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_icons21.LinkOutlined, { style: { fontSize: 64, color: "#d9d9d9" } }),
10749
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Title3, { level: 4, type: "secondary", children: connection.error || "Not Connected" }),
10750
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10751
+ Text17,
7931
10752
  {
7932
10753
  type: "secondary",
7933
10754
  style: { textAlign: "center", maxWidth: 400 },
7934
10755
  children: connection.error ? `Failed to connect to ${connection.url}. Please check the server URL and try again.` : `Click "Reconnect" to connect to ${connection.url}`
7935
10756
  }
7936
10757
  ),
7937
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
7938
- import_antd29.Button,
10758
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10759
+ import_antd34.Button,
7939
10760
  {
7940
10761
  type: "primary",
7941
- icon: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_icons17.LinkOutlined, {}),
10762
+ icon: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_icons21.LinkOutlined, {}),
7942
10763
  onClick: () => checkConnection(connection.id),
7943
10764
  loading: connection.connecting,
7944
10765
  style: { marginTop: 16 },
@@ -7950,9 +10771,9 @@ QUEUE_NAME=tasks`,
7950
10771
  ) }),
7951
10772
  closable: connections.length > 1
7952
10773
  }));
7953
- return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_jsx_runtime45.Fragment, { children: [
7954
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
7955
- import_antd29.Modal,
10774
+ return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(import_jsx_runtime50.Fragment, { children: [
10775
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10776
+ import_antd34.Modal,
7956
10777
  {
7957
10778
  open,
7958
10779
  onCancel: onClose,
@@ -7960,8 +10781,8 @@ QUEUE_NAME=tasks`,
7960
10781
  width: "80%",
7961
10782
  footer: null,
7962
10783
  title: "Settings",
7963
- children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
7964
- import_antd29.Tabs,
10784
+ children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10785
+ import_antd34.Tabs,
7965
10786
  {
7966
10787
  activeKey: activeTabKey,
7967
10788
  onChange: handleTabChange,
@@ -7974,7 +10795,7 @@ QUEUE_NAME=tasks`,
7974
10795
  }
7975
10796
  },
7976
10797
  items: tabItems,
7977
- addIcon: /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
10798
+ addIcon: /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(
7978
10799
  "div",
7979
10800
  {
7980
10801
  style: {
@@ -7984,8 +10805,8 @@ QUEUE_NAME=tasks`,
7984
10805
  padding: "4px 8px"
7985
10806
  },
7986
10807
  children: [
7987
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_icons17.PlusOutlined, {}),
7988
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { children: "Add Server" })
10808
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_icons21.PlusOutlined, {}),
10809
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { children: "Add Server" })
7989
10810
  ]
7990
10811
  }
7991
10812
  )
@@ -7993,8 +10814,8 @@ QUEUE_NAME=tasks`,
7993
10814
  ) })
7994
10815
  }
7995
10816
  ),
7996
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
7997
- import_antd29.Modal,
10817
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10818
+ import_antd34.Modal,
7998
10819
  {
7999
10820
  title: "Add New Server",
8000
10821
  open: showAddServerModal,
@@ -8007,11 +10828,11 @@ QUEUE_NAME=tasks`,
8007
10828
  },
8008
10829
  confirmLoading: addingServer,
8009
10830
  className: styles.addServerModal,
8010
- children: /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_antd29.Space, { direction: "vertical", style: { width: "100%" }, size: "large", children: [
8011
- /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { children: [
8012
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Text14, { strong: true, style: { display: "block", marginBottom: 8 }, children: "Server Name" }),
8013
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
8014
- import_antd29.Input,
10831
+ children: /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(import_antd34.Space, { direction: "vertical", style: { width: "100%" }, size: "large", children: [
10832
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { children: [
10833
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Text17, { strong: true, style: { display: "block", marginBottom: 8 }, children: "Server Name" }),
10834
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10835
+ import_antd34.Input,
8015
10836
  {
8016
10837
  placeholder: "e.g., Production Server",
8017
10838
  value: newServerName,
@@ -8019,12 +10840,12 @@ QUEUE_NAME=tasks`,
8019
10840
  onPressEnter: handleAddServer
8020
10841
  }
8021
10842
  ),
8022
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Text14, { type: "secondary", style: { fontSize: 12, marginTop: 4 }, children: "Optional: Leave empty to use URL as name" })
10843
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Text17, { type: "secondary", style: { fontSize: 12, marginTop: 4 }, children: "Optional: Leave empty to use URL as name" })
8023
10844
  ] }),
8024
- /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { children: [
8025
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Text14, { strong: true, style: { display: "block", marginBottom: 8 }, children: "Server URL *" }),
8026
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
8027
- import_antd29.Input,
10845
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { children: [
10846
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Text17, { strong: true, style: { display: "block", marginBottom: 8 }, children: "Server URL *" }),
10847
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10848
+ import_antd34.Input,
8028
10849
  {
8029
10850
  placeholder: "e.g., http://localhost:4001",
8030
10851
  value: newServerUrl,
@@ -8032,12 +10853,12 @@ QUEUE_NAME=tasks`,
8032
10853
  onPressEnter: handleAddServer
8033
10854
  }
8034
10855
  ),
8035
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Text14, { type: "secondary", style: { fontSize: 12, marginTop: 4 }, children: "Enter the full URL of the gateway server" })
10856
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Text17, { type: "secondary", style: { fontSize: 12, marginTop: 4 }, children: "Enter the full URL of the gateway server" })
8036
10857
  ] }),
8037
- /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { children: [
8038
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Text14, { strong: true, style: { display: "block", marginBottom: 8 }, children: "API Key" }),
8039
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
8040
- import_antd29.Input.Password,
10858
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { children: [
10859
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Text17, { strong: true, style: { display: "block", marginBottom: 8 }, children: "API Key" }),
10860
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10861
+ import_antd34.Input.Password,
8041
10862
  {
8042
10863
  placeholder: "Optional: Enter API key for authentication",
8043
10864
  value: newServerApiKey,
@@ -8045,7 +10866,7 @@ QUEUE_NAME=tasks`,
8045
10866
  onPressEnter: handleAddServer
8046
10867
  }
8047
10868
  ),
8048
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Text14, { type: "secondary", style: { fontSize: 12, marginTop: 4 }, children: "Optional: API key for server authentication" })
10869
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Text17, { type: "secondary", style: { fontSize: 12, marginTop: 4 }, children: "Optional: API key for server authentication" })
8049
10870
  ] })
8050
10871
  ] })
8051
10872
  }
@@ -8054,10 +10875,10 @@ QUEUE_NAME=tasks`,
8054
10875
  };
8055
10876
 
8056
10877
  // src/components/Chat/AgentServerSetting.tsx
8057
- var import_jsx_runtime46 = require("react/jsx-runtime");
10878
+ var import_jsx_runtime51 = require("react/jsx-runtime");
8058
10879
  var AgentServerSetting = () => {
8059
10880
  const { settingsModalOpen, setSettingsModalOpen } = useLatticeChatShellContext();
8060
- return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
10881
+ return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
8061
10882
  SettingsModal,
8062
10883
  {
8063
10884
  open: settingsModalOpen,
@@ -8067,11 +10888,11 @@ var AgentServerSetting = () => {
8067
10888
  };
8068
10889
 
8069
10890
  // src/components/Chat/LatticeChatShell.tsx
8070
- var import_jsx_runtime47 = require("react/jsx-runtime");
10891
+ var import_jsx_runtime52 = require("react/jsx-runtime");
8071
10892
  var LatticeChatShell = (props) => {
8072
- return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(LatticeChatShellContextProvider, { ...props, children: [
8073
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(AssistantContextProvider, { autoLoad: true, children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(ConversationContextProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(LatticeChatView, {}) }) }),
8074
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(AgentServerSetting, {})
10893
+ return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(LatticeChatShellContextProvider, { ...props, children: [
10894
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(AssistantContextProvider, { autoLoad: true, children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(ConversationContextProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(LatticeChatView, {}) }) }),
10895
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(AgentServerSetting, {})
8075
10896
  ] });
8076
10897
  };
8077
10898
  // Annotate the CommonJS export names for ESM import in node:
@@ -8080,6 +10901,8 @@ var LatticeChatShell = (props) => {
8080
10901
  AgentThreadProvider,
8081
10902
  AssistantContext,
8082
10903
  AssistantContextProvider,
10904
+ AssistantFlow,
10905
+ AssistantNode,
8083
10906
  AxiomLatticeProvider,
8084
10907
  ChatUIContext,
8085
10908
  ChatUIContextProvider,
@@ -8096,6 +10919,8 @@ var LatticeChatShell = (props) => {
8096
10919
  MDViewFormItem,
8097
10920
  ScheduleButton,
8098
10921
  SideAppViewBrowser,
10922
+ SkillFlow,
10923
+ SkillNode,
8099
10924
  getElement,
8100
10925
  regsiterElement,
8101
10926
  useAgentChat,