@axiom-lattice/react-sdk 3.0.1 → 3.1.0

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
@@ -4220,7 +4220,6 @@ var ConversationContextProvider = ({
4220
4220
  if (!assistantId || !client.assistantId) {
4221
4221
  throw new Error("No assistant selected");
4222
4222
  }
4223
- setIsLoading(true);
4224
4223
  setError(null);
4225
4224
  try {
4226
4225
  const existingThread = await client.threads.get(newThread.id);
@@ -4231,16 +4230,18 @@ var ConversationContextProvider = ({
4231
4230
  label: newThread.label
4232
4231
  }
4233
4232
  });
4234
- await loadThreads();
4233
+ setThreads(
4234
+ (prev) => prev.map(
4235
+ (t4) => t4.id === newThread.id ? { ...t4, label: newThread.label } : t4
4236
+ )
4237
+ );
4235
4238
  } catch (err) {
4236
4239
  const error2 = err instanceof Error ? err : new Error(String(err));
4237
4240
  setError(error2);
4238
4241
  throw error2;
4239
- } finally {
4240
- setIsLoading(false);
4241
4242
  }
4242
4243
  },
4243
- [assistantId, client, loadThreads]
4244
+ [assistantId, client]
4244
4245
  );
4245
4246
  const getThreadById = (0, import_react13.useCallback)(
4246
4247
  (targetThreadId) => {
@@ -68397,12 +68398,12 @@ function graticuleY(x06, x12, dx) {
68397
68398
  };
68398
68399
  }
68399
68400
  function graticule() {
68400
- var x12, x06, X13, X03, y12, y06, Y13, Y03, dx = 10, dy = dx, DX2 = 90, DY2 = 360, x4, y4, X7, Y4, precision = 2.5;
68401
+ var x12, x06, X13, X03, y12, y06, Y13, Y03, dx = 10, dy = dx, DX2 = 90, DY2 = 360, x4, y4, X8, Y4, precision = 2.5;
68401
68402
  function graticule2() {
68402
68403
  return { type: "MultiLineString", coordinates: lines() };
68403
68404
  }
68404
68405
  function lines() {
68405
- return range(ceil(X03 / DX2) * DX2, X13, DX2).map(X7).concat(range(ceil(Y03 / DY2) * DY2, Y13, DY2).map(Y4)).concat(range(ceil(x06 / dx) * dx, x12, dx).filter(function(x5) {
68406
+ return range(ceil(X03 / DX2) * DX2, X13, DX2).map(X8).concat(range(ceil(Y03 / DY2) * DY2, Y13, DY2).map(Y4)).concat(range(ceil(x06 / dx) * dx, x12, dx).filter(function(x5) {
68406
68407
  return abs4(x5 % DX2) > epsilon7;
68407
68408
  }).map(x4)).concat(range(ceil(y06 / dy) * dy, y12, dy).filter(function(y5) {
68408
68409
  return abs4(y5 % DY2) > epsilon7;
@@ -68417,9 +68418,9 @@ function graticule() {
68417
68418
  return {
68418
68419
  type: "Polygon",
68419
68420
  coordinates: [
68420
- X7(X03).concat(
68421
+ X8(X03).concat(
68421
68422
  Y4(Y13).slice(1),
68422
- X7(X13).reverse().slice(1),
68423
+ X8(X13).reverse().slice(1),
68423
68424
  Y4(Y03).reverse().slice(1)
68424
68425
  )
68425
68426
  ]
@@ -68464,7 +68465,7 @@ function graticule() {
68464
68465
  precision = +_2;
68465
68466
  x4 = graticuleX(y06, y12, 90);
68466
68467
  y4 = graticuleY(x06, x12, precision);
68467
- X7 = graticuleX(Y03, Y13, 90);
68468
+ X8 = graticuleX(Y03, Y13, 90);
68468
68469
  Y4 = graticuleY(X03, X13, precision);
68469
68470
  return graticule2;
68470
68471
  };
@@ -71147,9 +71148,9 @@ var gamma_default = (function sourceRandomGamma(source) {
71147
71148
  var beta_default = (function sourceRandomBeta(source) {
71148
71149
  var G3 = gamma_default.source(source);
71149
71150
  function randomBeta(alpha, beta) {
71150
- var X7 = G3(alpha), Y4 = G3(beta);
71151
+ var X8 = G3(alpha), Y4 = G3(beta);
71151
71152
  return function() {
71152
- var x4 = X7();
71153
+ var x4 = X8();
71153
71154
  return x4 === 0 ? 0 : x4 / (x4 + Y4());
71154
71155
  };
71155
71156
  }
@@ -112392,6 +112393,39 @@ var import_react189 = __toESM(require("react"));
112392
112393
  var import_antd_style66 = require("antd-style");
112393
112394
  var import_lucide_react72 = require("lucide-react");
112394
112395
  var import_antd145 = require("antd");
112396
+ var import_icons49 = require("@ant-design/icons");
112397
+
112398
+ // src/components/Chat/threadSort.ts
112399
+ function filterThreads(threads, query) {
112400
+ const q2 = query.trim().toLowerCase();
112401
+ if (!q2) return threads;
112402
+ return threads.filter(
112403
+ (thread) => (thread.label || "").toLowerCase().includes(q2)
112404
+ );
112405
+ }
112406
+ var getTime = (thread, sortKey) => {
112407
+ const raw = sortKey === "created" ? thread.createdAt : thread.updatedAt;
112408
+ if (!raw) return null;
112409
+ const time2 = Date.parse(raw);
112410
+ return Number.isNaN(time2) ? null : time2;
112411
+ };
112412
+ function sortThreads(threads, sortKey = "updated", direction = "desc") {
112413
+ return [...threads].sort((a4, b10) => {
112414
+ if (sortKey === "name") {
112415
+ const na = a4.label || "";
112416
+ const nb = b10.label || "";
112417
+ return direction === "asc" ? na.localeCompare(nb) : nb.localeCompare(na);
112418
+ }
112419
+ const ta = getTime(a4, sortKey);
112420
+ const tb = getTime(b10, sortKey);
112421
+ if (ta === null && tb === null) return 0;
112422
+ if (ta === null) return 1;
112423
+ if (tb === null) return -1;
112424
+ return direction === "asc" ? ta - tb : tb - ta;
112425
+ });
112426
+ }
112427
+
112428
+ // src/components/Chat/ThreadHistoryMenuContent.tsx
112395
112429
  var import_jsx_runtime300 = require("react/jsx-runtime");
112396
112430
  var useStyles50 = (0, import_antd_style66.createStyles)(({ token, css }) => ({
112397
112431
  container: css`
@@ -112399,6 +112433,17 @@ var useStyles50 = (0, import_antd_style66.createStyles)(({ token, css }) => ({
112399
112433
  font-size: 13px;
112400
112434
  background: transparent;
112401
112435
  `,
112436
+ toolbar: css`
112437
+ display: flex;
112438
+ flex-direction: column;
112439
+ gap: 6px;
112440
+ margin-bottom: 12px;
112441
+ `,
112442
+ toolbarRow: css`
112443
+ display: flex;
112444
+ align-items: center;
112445
+ gap: 6px;
112446
+ `,
112402
112447
  threadList: css`
112403
112448
  display: flex;
112404
112449
  flex-direction: column;
@@ -112457,7 +112502,7 @@ var useStyles50 = (0, import_antd_style66.createStyles)(({ token, css }) => ({
112457
112502
  text-overflow: ellipsis;
112458
112503
  white-space: nowrap;
112459
112504
  `,
112460
- deleteBtn: css`
112505
+ actionBtn: css`
112461
112506
  display: flex;
112462
112507
  align-items: center;
112463
112508
  justify-content: center;
@@ -112476,11 +112521,41 @@ var useStyles50 = (0, import_antd_style66.createStyles)(({ token, css }) => ({
112476
112521
  color: ${token.colorPrimary};
112477
112522
  }
112478
112523
 
112524
+ &:disabled {
112525
+ cursor: not-allowed;
112526
+ opacity: 0.4;
112527
+
112528
+ &:hover {
112529
+ background: transparent;
112530
+ color: ${token.colorTextSecondary};
112531
+ }
112532
+ }
112533
+
112479
112534
  svg {
112480
112535
  width: 16px;
112481
112536
  height: 16px;
112482
112537
  }
112483
112538
  `,
112539
+ actionBtnVisible: css`
112540
+ opacity: 1;
112541
+ `,
112542
+ renameInput: css`
112543
+ flex: 1;
112544
+ min-width: 0;
112545
+ font-size: 12px;
112546
+ font-weight: 500;
112547
+ color: ${token.colorText};
112548
+ padding: 2px 6px;
112549
+ border: 1px solid ${token.colorPrimary};
112550
+ border-radius: 4px;
112551
+ background: ${token.colorBgContainer};
112552
+ box-sizing: border-box;
112553
+
112554
+ &:focus {
112555
+ outline: none;
112556
+ box-shadow: 0 0 0 2px ${token.colorPrimaryBg};
112557
+ }
112558
+ `,
112484
112559
  emptyState: css`
112485
112560
  padding: 16px;
112486
112561
  text-align: center;
@@ -112501,10 +112576,19 @@ var ThreadHistoryMenuContent = () => {
112501
112576
  threadId,
112502
112577
  selectThread,
112503
112578
  deleteThread,
112579
+ updateThread,
112504
112580
  isLoading
112505
112581
  } = useConversationContext();
112506
112582
  const [threadToDelete, setThreadToDelete] = (0, import_react189.useState)(null);
112507
112583
  const [deleting, setDeleting] = (0, import_react189.useState)(false);
112584
+ const [editingId, setEditingId] = (0, import_react189.useState)(null);
112585
+ const [editValue, setEditValue] = (0, import_react189.useState)("");
112586
+ const [renaming, setRenaming] = (0, import_react189.useState)(false);
112587
+ const [searchQuery, setSearchQuery] = (0, import_react189.useState)("");
112588
+ const [sortKey, setSortKey] = (0, import_react189.useState)("updated");
112589
+ const [sortDirection, setSortDirection] = (0, import_react189.useState)("desc");
112590
+ const skipBlurRef = (0, import_react189.useRef)(false);
112591
+ const submittingRef = (0, import_react189.useRef)(false);
112508
112592
  const handleDeleteThread = (0, import_react189.useCallback)(
112509
112593
  (e8, threadIdToDelete) => {
112510
112594
  e8.stopPropagation();
@@ -112525,18 +112609,107 @@ var ThreadHistoryMenuContent = () => {
112525
112609
  setDeleting(false);
112526
112610
  }
112527
112611
  }, [threadToDelete, deleteThread]);
112528
- const sortedThreads = import_react189.default.useMemo(() => {
112529
- return [...threads].sort((a4, b10) => {
112530
- const dateA = a4.updatedAt ? new Date(a4.updatedAt).getTime() : 0;
112531
- const dateB = b10.updatedAt ? new Date(b10.updatedAt).getTime() : 0;
112532
- return dateB - dateA;
112533
- });
112534
- }, [threads]);
112535
- if (isLoading) {
112536
- return /* @__PURE__ */ (0, import_jsx_runtime300.jsx)("div", { className: styles.container, children: /* @__PURE__ */ (0, import_jsx_runtime300.jsx)("div", { className: styles.loading, children: "Loading conversations..." }) });
112537
- }
112612
+ const startRename = (0, import_react189.useCallback)((e8, thread) => {
112613
+ e8.stopPropagation();
112614
+ setEditingId(thread.id);
112615
+ setEditValue(thread.label);
112616
+ }, []);
112617
+ const finishRename = (0, import_react189.useCallback)(
112618
+ async (thread) => {
112619
+ if (submittingRef.current) return;
112620
+ const trimmed = editValue.trim();
112621
+ if (!trimmed || trimmed === thread.label) {
112622
+ setEditingId(null);
112623
+ return;
112624
+ }
112625
+ submittingRef.current = true;
112626
+ setRenaming(true);
112627
+ try {
112628
+ await updateThread({ ...thread, label: trimmed });
112629
+ import_antd145.message.success("Conversation renamed");
112630
+ } catch (error) {
112631
+ import_antd145.message.error("Failed to rename conversation");
112632
+ } finally {
112633
+ submittingRef.current = false;
112634
+ setRenaming(false);
112635
+ setEditingId(null);
112636
+ }
112637
+ },
112638
+ [editValue, updateThread]
112639
+ );
112640
+ const cancelRename = (0, import_react189.useCallback)(() => {
112641
+ skipBlurRef.current = true;
112642
+ setEditingId(null);
112643
+ }, []);
112644
+ const handleRenameKeyDown = (0, import_react189.useCallback)(
112645
+ (e8) => {
112646
+ if (e8.key === "Enter") {
112647
+ e8.preventDefault();
112648
+ e8.currentTarget.blur();
112649
+ } else if (e8.key === "Escape") {
112650
+ e8.preventDefault();
112651
+ cancelRename();
112652
+ }
112653
+ },
112654
+ [cancelRename]
112655
+ );
112656
+ const handleRenameBlur = (0, import_react189.useCallback)(
112657
+ (thread) => {
112658
+ if (skipBlurRef.current) {
112659
+ skipBlurRef.current = false;
112660
+ return;
112661
+ }
112662
+ finishRename(thread);
112663
+ },
112664
+ [finishRename]
112665
+ );
112666
+ const visibleThreads = import_react189.default.useMemo(
112667
+ () => sortThreads(
112668
+ filterThreads(threads, searchQuery),
112669
+ sortKey,
112670
+ sortDirection
112671
+ ),
112672
+ [threads, searchQuery, sortKey, sortDirection]
112673
+ );
112538
112674
  return /* @__PURE__ */ (0, import_jsx_runtime300.jsxs)("div", { className: styles.container, children: [
112539
- sortedThreads.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime300.jsx)("div", { className: styles.emptyState, children: "No conversations yet" }) : /* @__PURE__ */ (0, import_jsx_runtime300.jsx)("div", { className: styles.threadList, children: sortedThreads.map((thread) => /* @__PURE__ */ (0, import_jsx_runtime300.jsxs)(
112675
+ /* @__PURE__ */ (0, import_jsx_runtime300.jsxs)("div", { className: styles.toolbar, children: [
112676
+ /* @__PURE__ */ (0, import_jsx_runtime300.jsx)(
112677
+ import_antd145.Input,
112678
+ {
112679
+ size: "small",
112680
+ placeholder: "Search conversations\u2026",
112681
+ allowClear: true,
112682
+ value: searchQuery,
112683
+ onChange: (e8) => setSearchQuery(e8.target.value)
112684
+ }
112685
+ ),
112686
+ /* @__PURE__ */ (0, import_jsx_runtime300.jsxs)("div", { className: styles.toolbarRow, children: [
112687
+ /* @__PURE__ */ (0, import_jsx_runtime300.jsx)(
112688
+ import_antd145.Select,
112689
+ {
112690
+ size: "small",
112691
+ style: { flex: 1, minWidth: 0 },
112692
+ value: sortKey,
112693
+ onChange: (value) => setSortKey(value),
112694
+ options: [
112695
+ { value: "name", label: "Name" },
112696
+ { value: "updated", label: "Updated" },
112697
+ { value: "created", label: "Created" }
112698
+ ]
112699
+ }
112700
+ ),
112701
+ /* @__PURE__ */ (0, import_jsx_runtime300.jsx)(
112702
+ import_antd145.Button,
112703
+ {
112704
+ size: "small",
112705
+ icon: sortDirection === "asc" ? /* @__PURE__ */ (0, import_jsx_runtime300.jsx)(import_icons49.SortAscendingOutlined, {}) : /* @__PURE__ */ (0, import_jsx_runtime300.jsx)(import_icons49.SortDescendingOutlined, {}),
112706
+ onClick: () => setSortDirection((d3) => d3 === "asc" ? "desc" : "asc"),
112707
+ title: sortDirection === "asc" ? "Ascending" : "Descending"
112708
+ }
112709
+ )
112710
+ ] })
112711
+ ] }),
112712
+ isLoading ? /* @__PURE__ */ (0, import_jsx_runtime300.jsx)("div", { className: styles.loading, children: "Loading conversations..." }) : visibleThreads.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime300.jsx)("div", { className: styles.emptyState, children: searchQuery.trim() ? `No conversations match "${searchQuery.trim()}"` : "No conversations yet" }) : /* @__PURE__ */ (0, import_jsx_runtime300.jsx)("div", { className: styles.threadList, children: visibleThreads.map((thread) => /* @__PURE__ */ (0, import_jsx_runtime300.jsxs)(
112540
112713
  "div",
112541
112714
  {
112542
112715
  className: `${styles.threadItem} ${thread.id === threadId ? "active" : ""}`,
@@ -112544,22 +112717,76 @@ var ThreadHistoryMenuContent = () => {
112544
112717
  title: thread.label,
112545
112718
  children: [
112546
112719
  /* @__PURE__ */ (0, import_jsx_runtime300.jsx)("div", { className: styles.threadIcon, children: /* @__PURE__ */ (0, import_jsx_runtime300.jsx)(import_lucide_react72.MessageSquare, { size: 14 }) }),
112547
- /* @__PURE__ */ (0, import_jsx_runtime300.jsx)(
112720
+ editingId === thread.id ? /* @__PURE__ */ (0, import_jsx_runtime300.jsx)(
112721
+ "input",
112722
+ {
112723
+ className: styles.renameInput,
112724
+ "aria-label": "Conversation name",
112725
+ value: editValue,
112726
+ autoFocus: true,
112727
+ disabled: renaming,
112728
+ onClick: (e8) => e8.stopPropagation(),
112729
+ onFocus: (e8) => e8.target.select(),
112730
+ onChange: (e8) => setEditValue(e8.target.value),
112731
+ onKeyDown: (e8) => handleRenameKeyDown(e8),
112732
+ onBlur: () => handleRenameBlur(thread)
112733
+ }
112734
+ ) : /* @__PURE__ */ (0, import_jsx_runtime300.jsx)(
112548
112735
  "div",
112549
112736
  {
112550
112737
  className: thread.id === threadId ? styles.threadNameActive : styles.threadName,
112551
112738
  children: thread.label
112552
112739
  }
112553
112740
  ),
112554
- /* @__PURE__ */ (0, import_jsx_runtime300.jsx)(
112555
- "button",
112556
- {
112557
- className: styles.deleteBtn,
112558
- onClick: (e8) => handleDeleteThread(e8, thread.id),
112559
- title: "Delete conversation",
112560
- children: /* @__PURE__ */ (0, import_jsx_runtime300.jsx)(import_lucide_react72.Trash2, { size: 12 })
112561
- }
112562
- )
112741
+ editingId === thread.id ? /* @__PURE__ */ (0, import_jsx_runtime300.jsxs)(import_jsx_runtime300.Fragment, { children: [
112742
+ /* @__PURE__ */ (0, import_jsx_runtime300.jsx)(
112743
+ "button",
112744
+ {
112745
+ className: `${styles.actionBtn} ${styles.actionBtnVisible}`,
112746
+ title: "Save name",
112747
+ disabled: renaming,
112748
+ onMouseDown: (e8) => e8.preventDefault(),
112749
+ onClick: (e8) => {
112750
+ e8.stopPropagation();
112751
+ finishRename(thread);
112752
+ },
112753
+ children: /* @__PURE__ */ (0, import_jsx_runtime300.jsx)(import_lucide_react72.Check, { size: 12 })
112754
+ }
112755
+ ),
112756
+ /* @__PURE__ */ (0, import_jsx_runtime300.jsx)(
112757
+ "button",
112758
+ {
112759
+ className: `${styles.actionBtn} ${styles.actionBtnVisible}`,
112760
+ title: "Cancel rename",
112761
+ disabled: renaming,
112762
+ onMouseDown: (e8) => e8.preventDefault(),
112763
+ onClick: (e8) => {
112764
+ e8.stopPropagation();
112765
+ cancelRename();
112766
+ },
112767
+ children: /* @__PURE__ */ (0, import_jsx_runtime300.jsx)(import_lucide_react72.X, { size: 12 })
112768
+ }
112769
+ )
112770
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime300.jsxs)(import_jsx_runtime300.Fragment, { children: [
112771
+ /* @__PURE__ */ (0, import_jsx_runtime300.jsx)(
112772
+ "button",
112773
+ {
112774
+ className: styles.actionBtn,
112775
+ onClick: (e8) => startRename(e8, thread),
112776
+ title: "Rename conversation",
112777
+ children: /* @__PURE__ */ (0, import_jsx_runtime300.jsx)(import_lucide_react72.Pencil, { size: 12 })
112778
+ }
112779
+ ),
112780
+ /* @__PURE__ */ (0, import_jsx_runtime300.jsx)(
112781
+ "button",
112782
+ {
112783
+ className: styles.actionBtn,
112784
+ onClick: (e8) => handleDeleteThread(e8, thread.id),
112785
+ title: "Delete conversation",
112786
+ children: /* @__PURE__ */ (0, import_jsx_runtime300.jsx)(import_lucide_react72.Trash2, { size: 12 })
112787
+ }
112788
+ )
112789
+ ] })
112563
112790
  ]
112564
112791
  },
112565
112792
  thread.id
@@ -112919,7 +113146,7 @@ var CustomMenuPage = ({ component_key, data }) => {
112919
113146
  // src/components/Chat/SharesPage.tsx
112920
113147
  var import_react192 = require("react");
112921
113148
  var import_antd147 = require("antd");
112922
- var import_icons49 = require("@ant-design/icons");
113149
+ var import_icons50 = require("@ant-design/icons");
112923
113150
  var import_jsx_runtime303 = require("react/jsx-runtime");
112924
113151
  var { Text: Text77 } = import_antd147.Typography;
112925
113152
  var SharesPage = () => {
@@ -113011,14 +113238,14 @@ ${pwdText}`.trim());
113011
113238
  items: [
113012
113239
  {
113013
113240
  key: "copy",
113014
- icon: /* @__PURE__ */ (0, import_jsx_runtime303.jsx)(import_icons49.CopyOutlined, {}),
113241
+ icon: /* @__PURE__ */ (0, import_jsx_runtime303.jsx)(import_icons50.CopyOutlined, {}),
113015
113242
  label: "Copy Link",
113016
113243
  onClick: () => handleCopy(r6)
113017
113244
  },
113018
113245
  ...r6.revoked ? [] : [
113019
113246
  {
113020
113247
  key: "revoke",
113021
- icon: /* @__PURE__ */ (0, import_jsx_runtime303.jsx)(import_icons49.StopOutlined, {}),
113248
+ icon: /* @__PURE__ */ (0, import_jsx_runtime303.jsx)(import_icons50.StopOutlined, {}),
113022
113249
  label: "Revoke",
113023
113250
  danger: true,
113024
113251
  onClick: () => handleRevoke(r6.token)
@@ -113026,7 +113253,7 @@ ${pwdText}`.trim());
113026
113253
  ]
113027
113254
  ]
113028
113255
  },
113029
- children: /* @__PURE__ */ (0, import_jsx_runtime303.jsx)(import_antd147.Button, { type: "text", size: "small", icon: /* @__PURE__ */ (0, import_jsx_runtime303.jsx)(import_icons49.MoreOutlined, {}) })
113256
+ children: /* @__PURE__ */ (0, import_jsx_runtime303.jsx)(import_antd147.Button, { type: "text", size: "small", icon: /* @__PURE__ */ (0, import_jsx_runtime303.jsx)(import_icons50.MoreOutlined, {}) })
113030
113257
  }
113031
113258
  )
113032
113259
  }
@@ -113756,7 +113983,7 @@ var MigrationPage = () => {
113756
113983
  };
113757
113984
 
113758
113985
  // src/components/Chat/SideAppViewBrowser.tsx
113759
- var import_icons50 = require("@ant-design/icons");
113986
+ var import_icons51 = require("@ant-design/icons");
113760
113987
  var import_antd152 = require("antd");
113761
113988
  var import_antd_style67 = require("antd-style");
113762
113989
  var import_react197 = require("react");
@@ -114039,7 +114266,7 @@ var EmptySideAppView = ({ component_key, data }) => {
114039
114266
  ] });
114040
114267
  };
114041
114268
  var getTabIcon = (componentKey) => {
114042
- return /* @__PURE__ */ (0, import_jsx_runtime308.jsx)(import_icons50.AppstoreOutlined, { style: { fontSize: 12, opacity: 0.6 } });
114269
+ return /* @__PURE__ */ (0, import_jsx_runtime308.jsx)(import_icons51.AppstoreOutlined, { style: { fontSize: 12, opacity: 0.6 } });
114043
114270
  };
114044
114271
  var SideAppViewBrowser = ({ region = "side", compact = true, showCloseButton = true }) => {
114045
114272
  const { styles } = useStyle17();
@@ -114160,7 +114387,7 @@ var SideAppViewBrowser = ({ region = "side", compact = true, showCloseButton = t
114160
114387
  getTabIcon(item.componentKey),
114161
114388
  /* @__PURE__ */ (0, import_jsx_runtime308.jsx)("span", { style: { flex: 1 }, children: item.label }),
114162
114389
  /* @__PURE__ */ (0, import_jsx_runtime308.jsx)(
114163
- import_icons50.CloseOutlined,
114390
+ import_icons51.CloseOutlined,
114164
114391
  {
114165
114392
  style: { fontSize: 10, opacity: 0.5 },
114166
114393
  onClick: (e8) => {
@@ -114210,7 +114437,7 @@ var SideAppViewBrowser = ({ region = "side", compact = true, showCloseButton = t
114210
114437
  e8.stopPropagation();
114211
114438
  remove2(item.key);
114212
114439
  },
114213
- children: /* @__PURE__ */ (0, import_jsx_runtime308.jsx)(import_icons50.CloseOutlined, { style: { fontSize: 10 } })
114440
+ children: /* @__PURE__ */ (0, import_jsx_runtime308.jsx)(import_icons51.CloseOutlined, { style: { fontSize: 10 } })
114214
114441
  }
114215
114442
  )
114216
114443
  ]
@@ -114222,10 +114449,10 @@ var SideAppViewBrowser = ({ region = "side", compact = true, showCloseButton = t
114222
114449
  menu: { items: dropdownItems },
114223
114450
  placement: "bottomRight",
114224
114451
  trigger: ["click"],
114225
- children: /* @__PURE__ */ (0, import_jsx_runtime308.jsx)("button", { className: styles.actionBtn, title: "All tabs", children: /* @__PURE__ */ (0, import_jsx_runtime308.jsx)(import_icons50.MoreOutlined, {}) })
114452
+ children: /* @__PURE__ */ (0, import_jsx_runtime308.jsx)("button", { className: styles.actionBtn, title: "All tabs", children: /* @__PURE__ */ (0, import_jsx_runtime308.jsx)(import_icons51.MoreOutlined, {}) })
114226
114453
  }
114227
114454
  ),
114228
- showCloseButton && /* @__PURE__ */ (0, import_jsx_runtime308.jsx)(import_antd152.Tooltip, { title: "Close", children: /* @__PURE__ */ (0, import_jsx_runtime308.jsx)("button", { className: styles.actionBtn, onClick: closeApp, children: /* @__PURE__ */ (0, import_jsx_runtime308.jsx)(import_icons50.CloseOutlined, {}) }) })
114455
+ showCloseButton && /* @__PURE__ */ (0, import_jsx_runtime308.jsx)(import_antd152.Tooltip, { title: "Close", children: /* @__PURE__ */ (0, import_jsx_runtime308.jsx)("button", { className: styles.actionBtn, onClick: closeApp, children: /* @__PURE__ */ (0, import_jsx_runtime308.jsx)(import_icons51.CloseOutlined, {}) }) })
114229
114456
  ]
114230
114457
  }
114231
114458
  ) : activeItem && /* @__PURE__ */ (0, import_jsx_runtime308.jsxs)("div", { className: styles.compactPill, children: [
@@ -114254,7 +114481,7 @@ var SideAppViewBrowser = ({ region = "side", compact = true, showCloseButton = t
114254
114481
  e8.stopPropagation();
114255
114482
  remove2(item.key);
114256
114483
  },
114257
- children: /* @__PURE__ */ (0, import_jsx_runtime308.jsx)(import_icons50.CloseOutlined, { style: { fontSize: 10 } })
114484
+ children: /* @__PURE__ */ (0, import_jsx_runtime308.jsx)(import_icons51.CloseOutlined, { style: { fontSize: 10 } })
114258
114485
  }
114259
114486
  )
114260
114487
  ]
@@ -114268,10 +114495,10 @@ var SideAppViewBrowser = ({ region = "side", compact = true, showCloseButton = t
114268
114495
  menu: { items: dropdownItems },
114269
114496
  placement: "bottomRight",
114270
114497
  trigger: ["click"],
114271
- children: /* @__PURE__ */ (0, import_jsx_runtime308.jsx)("button", { className: styles.actionBtn, title: "All tabs", children: /* @__PURE__ */ (0, import_jsx_runtime308.jsx)(import_icons50.MoreOutlined, {}) })
114498
+ children: /* @__PURE__ */ (0, import_jsx_runtime308.jsx)("button", { className: styles.actionBtn, title: "All tabs", children: /* @__PURE__ */ (0, import_jsx_runtime308.jsx)(import_icons51.MoreOutlined, {}) })
114272
114499
  }
114273
114500
  ),
114274
- showCloseButton && /* @__PURE__ */ (0, import_jsx_runtime308.jsx)(import_antd152.Tooltip, { title: "Close", children: /* @__PURE__ */ (0, import_jsx_runtime308.jsx)("button", { className: styles.actionBtn, onClick: closeApp, children: /* @__PURE__ */ (0, import_jsx_runtime308.jsx)(import_icons50.CloseOutlined, {}) }) })
114501
+ showCloseButton && /* @__PURE__ */ (0, import_jsx_runtime308.jsx)(import_antd152.Tooltip, { title: "Close", children: /* @__PURE__ */ (0, import_jsx_runtime308.jsx)("button", { className: styles.actionBtn, onClick: closeApp, children: /* @__PURE__ */ (0, import_jsx_runtime308.jsx)(import_icons51.CloseOutlined, {}) }) })
114275
114502
  ] })
114276
114503
  ] }),
114277
114504
  /* @__PURE__ */ (0, import_jsx_runtime308.jsx)(
@@ -114280,7 +114507,7 @@ var SideAppViewBrowser = ({ region = "side", compact = true, showCloseButton = t
114280
114507
  className: styles.content,
114281
114508
  style: compact && items3.length > 0 ? { paddingTop: 10 } : void 0,
114282
114509
  children: /* @__PURE__ */ (0, import_jsx_runtime308.jsx)(SideAppBrowserContext.Provider, { value: sideAppBrowserValue, children: activeItem ? /* @__PURE__ */ (0, import_jsx_runtime308.jsx)("div", { className: styles.contentWrapper, children: activeItem.children }, activeItem.key) : /* @__PURE__ */ (0, import_jsx_runtime308.jsxs)("div", { className: styles.emptyState, children: [
114283
- /* @__PURE__ */ (0, import_jsx_runtime308.jsx)(import_icons50.AppstoreOutlined, { className: "icon" }),
114510
+ /* @__PURE__ */ (0, import_jsx_runtime308.jsx)(import_icons51.AppstoreOutlined, { className: "icon" }),
114284
114511
  /* @__PURE__ */ (0, import_jsx_runtime308.jsx)("span", { children: "Select an app to start" })
114285
114512
  ] }) })
114286
114513
  }
@@ -115112,7 +115339,76 @@ var import_react200 = __toESM(require("react"));
115112
115339
  var import_antd155 = require("antd");
115113
115340
  var import_lucide_react79 = require("lucide-react");
115114
115341
  var import_antd_style68 = require("antd-style");
115115
- var import_icons51 = require("@ant-design/icons");
115342
+
115343
+ // src/components/Chat/fileItemSort.ts
115344
+ var getFileName = (path2) => {
115345
+ if (!path2) return "";
115346
+ const parts = path2.split("/").filter(Boolean);
115347
+ return parts[parts.length - 1] ?? "";
115348
+ };
115349
+ var getTime2 = (item, sortKey) => {
115350
+ if (sortKey === "name") return null;
115351
+ const raw = sortKey === "created" ? item.created_at : item.modified_at;
115352
+ if (!raw) return null;
115353
+ const time2 = Date.parse(raw);
115354
+ return Number.isNaN(time2) ? null : time2;
115355
+ };
115356
+ function sortFileItems(items3, sortKey = "name", direction = "asc") {
115357
+ return [...items3].sort((a4, b10) => {
115358
+ if (!!a4.is_dir !== !!b10.is_dir) {
115359
+ return a4.is_dir ? -1 : 1;
115360
+ }
115361
+ if (sortKey === "name") {
115362
+ const na = getFileName(a4.path);
115363
+ const nb = getFileName(b10.path);
115364
+ return direction === "asc" ? na.localeCompare(nb) : nb.localeCompare(na);
115365
+ }
115366
+ const ta = getTime2(a4, sortKey);
115367
+ const tb = getTime2(b10, sortKey);
115368
+ if (ta === null && tb === null) return 0;
115369
+ if (ta === null) return 1;
115370
+ if (tb === null) return -1;
115371
+ return direction === "asc" ? ta - tb : tb - ta;
115372
+ });
115373
+ }
115374
+ function filterFileItems(files, query) {
115375
+ const q2 = query.trim().toLowerCase();
115376
+ if (!q2) return files;
115377
+ return files.filter((file) => {
115378
+ const path2 = (file.path || "").toLowerCase();
115379
+ const name = getFileName(file.path).toLowerCase();
115380
+ return path2.includes(q2) || name.includes(q2);
115381
+ });
115382
+ }
115383
+ function buildFileTree(files) {
115384
+ const root4 = [];
115385
+ files.forEach((file) => {
115386
+ const parts = (file.path || "").split("/").filter(Boolean);
115387
+ if (parts.length === 0) return;
115388
+ let current = root4;
115389
+ parts.forEach((part, index3) => {
115390
+ const isFile = index3 === parts.length - 1;
115391
+ const path2 = "/" + parts.slice(0, index3 + 1).join("/");
115392
+ let node = current.find((n4) => n4.path === path2);
115393
+ if (!node) {
115394
+ node = isFile ? { ...file, path: path2, name: part } : { path: path2, name: part, is_dir: true, children: [] };
115395
+ current.push(node);
115396
+ }
115397
+ if (!isFile) {
115398
+ current = node.children ?? (node.children = []);
115399
+ }
115400
+ });
115401
+ });
115402
+ return root4;
115403
+ }
115404
+ function sortFileTree(nodes, sortKey = "name", direction = "asc") {
115405
+ return sortFileItems(nodes, sortKey, direction).map(
115406
+ (node) => node.children ? { ...node, children: sortFileTree(node.children, sortKey, direction) } : node
115407
+ );
115408
+ }
115409
+
115410
+ // src/components/Chat/FileDirectoryPanel.tsx
115411
+ var import_icons52 = require("@ant-design/icons");
115116
115412
  var import_jsx_runtime311 = require("react/jsx-runtime");
115117
115413
  var useStyles51 = (0, import_antd_style68.createStyles)(({ token, css }) => ({
115118
115414
  container: css`
@@ -115143,6 +115439,17 @@ var useStyles51 = (0, import_antd_style68.createStyles)(({ token, css }) => ({
115143
115439
  color: ${token.colorTextSecondary};
115144
115440
  }
115145
115441
  `,
115442
+ toolbar: css`
115443
+ display: flex;
115444
+ flex-direction: column;
115445
+ gap: 6px;
115446
+ margin-bottom: 12px;
115447
+ `,
115448
+ toolbarRow: css`
115449
+ display: flex;
115450
+ align-items: center;
115451
+ gap: 6px;
115452
+ `,
115146
115453
  section: css`
115147
115454
  margin-bottom: 12px;
115148
115455
  `,
@@ -115321,12 +115628,12 @@ var formatDate8 = (dateStr) => {
115321
115628
  const date2 = new Date(dateStr);
115322
115629
  return date2.toLocaleDateString("en-US", { month: "short", day: "numeric" });
115323
115630
  };
115324
- var getFileName = (path2) => {
115631
+ var getFileName2 = (path2) => {
115325
115632
  if (!path2) return "";
115326
115633
  const parts = path2.split(/[/\\]/);
115327
115634
  return parts[parts.length - 1];
115328
115635
  };
115329
- var getEntryName = (entry) => getFileName(entry.name || entry.path);
115636
+ var getEntryName = (entry) => getFileName2(entry.name || entry.path);
115330
115637
  var MODAL_BODY_STYLE2 = {
115331
115638
  display: "flex",
115332
115639
  flexDirection: "column",
@@ -115349,7 +115656,7 @@ var FileDirectoryPanel = ({
115349
115656
  }) => {
115350
115657
  const { styles } = useStyles51();
115351
115658
  const { currentAssistant } = useAssistantContext();
115352
- const { getFileDownloadUrl, getDirectFileUrl } = useWorkspaceContext();
115659
+ const { getFileDownloadUrl, getDirectFileUrl, listPathByFolder } = useWorkspaceContext();
115353
115660
  const { openSideApp } = useChatUIContext();
115354
115661
  const { currentTenant } = useAuth();
115355
115662
  const tenantId = currentTenant?.id || "";
@@ -115365,6 +115672,11 @@ var FileDirectoryPanel = ({
115365
115672
  const [pinName, setPinName] = (0, import_react200.useState)("");
115366
115673
  const [pinGroup, setPinGroup] = (0, import_react200.useState)("");
115367
115674
  const [pinLoading, setPinLoading] = (0, import_react200.useState)(false);
115675
+ const [searchQuery, setSearchQuery] = (0, import_react200.useState)("");
115676
+ const [sortKey, setSortKey] = (0, import_react200.useState)("name");
115677
+ const [sortDirection, setSortDirection] = (0, import_react200.useState)("asc");
115678
+ const [searchFiles, setSearchFiles] = (0, import_react200.useState)(null);
115679
+ const [searchLoading, setSearchLoading] = (0, import_react200.useState)(false);
115368
115680
  (0, import_react200.useEffect)(() => {
115369
115681
  if (pinModalPath) {
115370
115682
  fetchExistingGroups(get4).then((apiGroups) => {
@@ -115372,6 +115684,34 @@ var FileDirectoryPanel = ({
115372
115684
  });
115373
115685
  }
115374
115686
  }, [pinModalPath]);
115687
+ (0, import_react200.useEffect)(() => {
115688
+ const q2 = searchQuery.trim();
115689
+ if (!q2) {
115690
+ setSearchFiles(null);
115691
+ setSearchLoading(false);
115692
+ return;
115693
+ }
115694
+ let cancelled = false;
115695
+ setSearchLoading(true);
115696
+ collectAllWorkspaceFiles(
115697
+ listPathByFolder,
115698
+ resourceFolders.map((folder) => folder.name),
115699
+ currentAssistant?.id
115700
+ ).then((all) => {
115701
+ if (!cancelled) setSearchFiles(filterFileItems(all, q2));
115702
+ }).catch(() => {
115703
+ if (!cancelled) setSearchFiles([]);
115704
+ }).finally(() => {
115705
+ if (!cancelled) setSearchLoading(false);
115706
+ });
115707
+ return () => {
115708
+ cancelled = true;
115709
+ };
115710
+ }, [searchQuery, listPathByFolder, resourceFolders, currentAssistant?.id]);
115711
+ const searchTree = (0, import_react200.useMemo)(() => {
115712
+ if (!searchFiles) return null;
115713
+ return sortFileTree(buildFileTree(searchFiles), sortKey, sortDirection);
115714
+ }, [searchFiles, sortKey, sortDirection]);
115375
115715
  const handleDropdownOpen = (0, import_react200.useCallback)(
115376
115716
  (filePath, open) => {
115377
115717
  if (!open || !enableCustomMenu) return;
@@ -115530,7 +115870,7 @@ var FileDirectoryPanel = ({
115530
115870
  }] : [],
115531
115871
  {
115532
115872
  key: "preview",
115533
- icon: /* @__PURE__ */ (0, import_jsx_runtime311.jsx)(import_icons51.EyeOutlined, {}),
115873
+ icon: /* @__PURE__ */ (0, import_jsx_runtime311.jsx)(import_icons52.EyeOutlined, {}),
115534
115874
  label: "Preview",
115535
115875
  onClick: () => {
115536
115876
  const url = getDirectFileUrl(entry.path);
@@ -115548,17 +115888,17 @@ var FileDirectoryPanel = ({
115548
115888
  },
115549
115889
  {
115550
115890
  key: "share",
115551
- icon: /* @__PURE__ */ (0, import_jsx_runtime311.jsx)(import_icons51.LinkOutlined, {}),
115891
+ icon: /* @__PURE__ */ (0, import_jsx_runtime311.jsx)(import_icons52.LinkOutlined, {}),
115552
115892
  label: "Share",
115553
115893
  onClick: () => setSharePath(entry.path)
115554
115894
  }
115555
115895
  ]
115556
115896
  },
115557
- children: /* @__PURE__ */ (0, import_jsx_runtime311.jsx)(import_antd155.Button, { type: "text", size: "small", icon: /* @__PURE__ */ (0, import_jsx_runtime311.jsx)(import_icons51.MoreOutlined, {}) })
115897
+ children: /* @__PURE__ */ (0, import_jsx_runtime311.jsx)(import_antd155.Button, { type: "text", size: "small", icon: /* @__PURE__ */ (0, import_jsx_runtime311.jsx)(import_icons52.MoreOutlined, {}) })
115558
115898
  }
115559
115899
  )
115560
115900
  ] }),
115561
- isExpanded ? isLoading ? /* @__PURE__ */ (0, import_jsx_runtime311.jsx)("div", { className: styles.loading, children: /* @__PURE__ */ (0, import_jsx_runtime311.jsx)(import_antd155.Spin, { size: "small" }) }) : children2.length > 0 ? children2.map((child) => renderEntry(child, depth + 1)) : /* @__PURE__ */ (0, import_jsx_runtime311.jsx)("div", { className: styles.emptyState, children: "No files in this folder" }) : null
115901
+ isExpanded ? isLoading ? /* @__PURE__ */ (0, import_jsx_runtime311.jsx)("div", { className: styles.loading, children: /* @__PURE__ */ (0, import_jsx_runtime311.jsx)(import_antd155.Spin, { size: "small" }) }) : children2.length > 0 ? sortFileItems(children2, sortKey, sortDirection).map((child) => renderEntry(child, depth + 1)) : /* @__PURE__ */ (0, import_jsx_runtime311.jsx)("div", { className: styles.emptyState, children: "No files in this folder" }) : null
115562
115902
  ] }, entry.path);
115563
115903
  }
115564
115904
  return /* @__PURE__ */ (0, import_jsx_runtime311.jsxs)("div", { className: styles.treeRow, children: [
@@ -115612,13 +115952,13 @@ var FileDirectoryPanel = ({
115612
115952
  ] : [],
115613
115953
  {
115614
115954
  key: "preview",
115615
- icon: /* @__PURE__ */ (0, import_jsx_runtime311.jsx)(import_icons51.EyeOutlined, {}),
115955
+ icon: /* @__PURE__ */ (0, import_jsx_runtime311.jsx)(import_icons52.EyeOutlined, {}),
115616
115956
  label: "Preview",
115617
115957
  onClick: () => onAssetClick(entry)
115618
115958
  },
115619
115959
  {
115620
115960
  key: "download",
115621
- icon: /* @__PURE__ */ (0, import_jsx_runtime311.jsx)(import_icons51.DownloadOutlined, {}),
115961
+ icon: /* @__PURE__ */ (0, import_jsx_runtime311.jsx)(import_icons52.DownloadOutlined, {}),
115622
115962
  label: "Download",
115623
115963
  onClick: () => {
115624
115964
  const url = getFileDownloadUrl(
@@ -115630,7 +115970,7 @@ var FileDirectoryPanel = ({
115630
115970
  },
115631
115971
  {
115632
115972
  key: "share",
115633
- icon: /* @__PURE__ */ (0, import_jsx_runtime311.jsx)(import_icons51.LinkOutlined, {}),
115973
+ icon: /* @__PURE__ */ (0, import_jsx_runtime311.jsx)(import_icons52.LinkOutlined, {}),
115634
115974
  label: "Share",
115635
115975
  onClick: () => setSharePath(entry.path)
115636
115976
  }
@@ -115641,13 +115981,81 @@ var FileDirectoryPanel = ({
115641
115981
  {
115642
115982
  type: "text",
115643
115983
  size: "small",
115644
- icon: /* @__PURE__ */ (0, import_jsx_runtime311.jsx)(import_icons51.MoreOutlined, {})
115984
+ icon: /* @__PURE__ */ (0, import_jsx_runtime311.jsx)(import_icons52.MoreOutlined, {})
115645
115985
  }
115646
115986
  )
115647
115987
  }
115648
115988
  )
115649
115989
  ] }, entry.path);
115650
- }, [directoryChildren, directoryExpanded, directoryLoading, onAssetClick, onToggleDirectory, styles, getFileDownloadUrl, currentAssistant?.id, enableCustomMenu, pinStates, handleDropdownOpen, handleUnpin]);
115990
+ }, [directoryChildren, directoryExpanded, directoryLoading, onAssetClick, onToggleDirectory, styles, getFileDownloadUrl, currentAssistant?.id, enableCustomMenu, pinStates, handleDropdownOpen, handleUnpin, sortKey, sortDirection]);
115991
+ const renderSearchNode = (node, depth) => {
115992
+ if (!node.is_dir) {
115993
+ return renderEntry(node, depth);
115994
+ }
115995
+ const entryName = getEntryName(node);
115996
+ return /* @__PURE__ */ (0, import_jsx_runtime311.jsxs)("div", { className: styles.treeChildren, children: [
115997
+ /* @__PURE__ */ (0, import_jsx_runtime311.jsxs)("div", { className: styles.treeRow, children: [
115998
+ Array.from({ length: depth }).map((_2, index3) => /* @__PURE__ */ (0, import_jsx_runtime311.jsx)("span", { className: styles.treeIndent }, `${node.path}-indent-${index3}`)),
115999
+ /* @__PURE__ */ (0, import_jsx_runtime311.jsx)("span", { className: styles.treeSpacer }),
116000
+ /* @__PURE__ */ (0, import_jsx_runtime311.jsxs)("button", { type: "button", className: styles.assetItem, title: entryName, children: [
116001
+ /* @__PURE__ */ (0, import_jsx_runtime311.jsx)("div", { className: styles.assetIcon, children: /* @__PURE__ */ (0, import_jsx_runtime311.jsx)(import_lucide_react79.FolderOpen, { size: 14 }) }),
116002
+ /* @__PURE__ */ (0, import_jsx_runtime311.jsx)("div", { className: styles.assetInfo, children: /* @__PURE__ */ (0, import_jsx_runtime311.jsx)("div", { className: styles.assetName, children: entryName }) })
116003
+ ] }),
116004
+ /* @__PURE__ */ (0, import_jsx_runtime311.jsx)(
116005
+ import_antd155.Dropdown,
116006
+ {
116007
+ trigger: ["click"],
116008
+ onOpenChange: (open) => handleDropdownOpen(node.path, open),
116009
+ menu: {
116010
+ items: [
116011
+ ...enableCustomMenu ? pinStates[node.path]?.isPinned ? [{
116012
+ key: "unpin",
116013
+ icon: /* @__PURE__ */ (0, import_jsx_runtime311.jsx)(import_lucide_react79.Pin, { size: 14 }),
116014
+ label: "Unpin from Menu",
116015
+ onClick: () => {
116016
+ const s4 = pinStates[node.path];
116017
+ if (s4?.pinnedId) handleUnpin(node.path, s4.pinnedId);
116018
+ }
116019
+ }] : [{
116020
+ key: "pin",
116021
+ icon: /* @__PURE__ */ (0, import_jsx_runtime311.jsx)(import_lucide_react79.Pin, { size: 14 }),
116022
+ label: "Pin to Menu",
116023
+ onClick: () => {
116024
+ setPinModalPath(node.path);
116025
+ setPinName(entryName);
116026
+ setPinGroup("");
116027
+ }
116028
+ }] : [],
116029
+ {
116030
+ key: "preview",
116031
+ icon: /* @__PURE__ */ (0, import_jsx_runtime311.jsx)(import_icons52.EyeOutlined, {}),
116032
+ label: "Preview",
116033
+ onClick: () => {
116034
+ const url = getDirectFileUrl(node.path);
116035
+ if (url) {
116036
+ openSideApp({
116037
+ component_key: "attachments",
116038
+ data: { file_id: node.path, url },
116039
+ message: entryName
116040
+ });
116041
+ }
116042
+ }
116043
+ },
116044
+ {
116045
+ key: "share",
116046
+ icon: /* @__PURE__ */ (0, import_jsx_runtime311.jsx)(import_icons52.LinkOutlined, {}),
116047
+ label: "Share",
116048
+ onClick: () => setSharePath(node.path)
116049
+ }
116050
+ ]
116051
+ },
116052
+ children: /* @__PURE__ */ (0, import_jsx_runtime311.jsx)(import_antd155.Button, { type: "text", size: "small", icon: /* @__PURE__ */ (0, import_jsx_runtime311.jsx)(import_icons52.MoreOutlined, {}) })
116053
+ }
116054
+ )
116055
+ ] }),
116056
+ node.children && node.children.length > 0 ? sortFileItems(node.children, sortKey, sortDirection).map((child) => renderSearchNode(child, depth + 1)) : null
116057
+ ] }, node.path);
116058
+ };
115651
116059
  if (!projectId) {
115652
116060
  return /* @__PURE__ */ (0, import_jsx_runtime311.jsx)("div", { className: styles.emptyState, children: "Please select a project to browse files" });
115653
116061
  }
@@ -115656,7 +116064,48 @@ var FileDirectoryPanel = ({
115656
116064
  /* @__PURE__ */ (0, import_jsx_runtime311.jsx)(import_lucide_react79.FolderOpen, { size: 16 }),
115657
116065
  /* @__PURE__ */ (0, import_jsx_runtime311.jsx)("span", { children: "Files" })
115658
116066
  ] }),
115659
- resourceFolders.map((folder) => {
116067
+ /* @__PURE__ */ (0, import_jsx_runtime311.jsxs)("div", { className: styles.toolbar, children: [
116068
+ /* @__PURE__ */ (0, import_jsx_runtime311.jsx)(
116069
+ import_antd155.Input,
116070
+ {
116071
+ size: "small",
116072
+ placeholder: "Search files\u2026",
116073
+ allowClear: true,
116074
+ value: searchQuery,
116075
+ onChange: (e8) => setSearchQuery(e8.target.value)
116076
+ }
116077
+ ),
116078
+ /* @__PURE__ */ (0, import_jsx_runtime311.jsxs)("div", { className: styles.toolbarRow, children: [
116079
+ /* @__PURE__ */ (0, import_jsx_runtime311.jsx)(
116080
+ import_antd155.Select,
116081
+ {
116082
+ size: "small",
116083
+ style: { flex: 1, minWidth: 0 },
116084
+ value: sortKey,
116085
+ onChange: (value) => setSortKey(value),
116086
+ options: [
116087
+ { value: "name", label: "Name" },
116088
+ { value: "created", label: "Created" },
116089
+ { value: "modified", label: "Modified" }
116090
+ ]
116091
+ }
116092
+ ),
116093
+ /* @__PURE__ */ (0, import_jsx_runtime311.jsx)(
116094
+ import_antd155.Button,
116095
+ {
116096
+ size: "small",
116097
+ icon: sortDirection === "asc" ? /* @__PURE__ */ (0, import_jsx_runtime311.jsx)(import_icons52.SortAscendingOutlined, {}) : /* @__PURE__ */ (0, import_jsx_runtime311.jsx)(import_icons52.SortDescendingOutlined, {}),
116098
+ onClick: () => setSortDirection((d3) => d3 === "asc" ? "desc" : "asc"),
116099
+ title: sortDirection === "asc" ? "Ascending" : "Descending"
116100
+ }
116101
+ )
116102
+ ] })
116103
+ ] }),
116104
+ searchFiles !== null ? /* @__PURE__ */ (0, import_jsx_runtime311.jsx)("div", { className: styles.assetList, children: searchLoading ? /* @__PURE__ */ (0, import_jsx_runtime311.jsx)("div", { className: styles.loading, children: /* @__PURE__ */ (0, import_jsx_runtime311.jsx)(import_antd155.Spin, { size: "small" }) }) : searchTree && searchTree.length > 0 ? searchTree.map((node) => renderSearchNode(node, 0)) : /* @__PURE__ */ (0, import_jsx_runtime311.jsxs)("div", { className: styles.emptyState, children: [
116105
+ 'No files match "',
116106
+ searchQuery.trim(),
116107
+ '"'
116108
+ ] }) }) : resourceFolders.map((folder) => {
115660
116109
  const entries = folderEntries[folder.name] || [];
115661
116110
  const isLoading = folderLoading[folder.name] || false;
115662
116111
  const itemCount = entries.length;
@@ -115674,7 +116123,7 @@ var FileDirectoryPanel = ({
115674
116123
  /* @__PURE__ */ (0, import_jsx_runtime311.jsx)("span", { className: styles.badge, children: itemCount })
115675
116124
  ] }),
115676
116125
  isLoading ? /* @__PURE__ */ (0, import_jsx_runtime311.jsx)("div", { className: styles.loading, children: /* @__PURE__ */ (0, import_jsx_runtime311.jsx)(import_antd155.Spin, { size: "small" }) }) : /* @__PURE__ */ (0, import_jsx_runtime311.jsxs)("div", { className: styles.assetList, children: [
115677
- entries.map((entry) => renderEntry(entry, 0)),
116126
+ sortFileItems(entries, sortKey, sortDirection).map((entry) => renderEntry(entry, 0)),
115678
116127
  entries.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime311.jsx)("div", { className: styles.emptyState, children: "No files in this folder" }) : null,
115679
116128
  folder.allowUpload ? /* @__PURE__ */ (0, import_jsx_runtime311.jsx)(
115680
116129
  "button",
@@ -116062,7 +116511,7 @@ var LatticeChatView = (props) => {
116062
116511
  // src/components/Chat/SettingsModal.tsx
116063
116512
  var import_react204 = require("react");
116064
116513
  var import_antd158 = require("antd");
116065
- var import_icons52 = require("@ant-design/icons");
116514
+ var import_icons53 = require("@ant-design/icons");
116066
116515
  var import_antd_style70 = require("antd-style");
116067
116516
  var import_jsx_runtime316 = require("react/jsx-runtime");
116068
116517
  var { Text: Text81, Title: Title19 } = import_antd158.Typography;
@@ -116412,12 +116861,12 @@ var SETTINGS_MENU_ITEMS = [
116412
116861
  {
116413
116862
  key: "environment",
116414
116863
  label: "Environment Variables",
116415
- icon: /* @__PURE__ */ (0, import_jsx_runtime316.jsx)(import_icons52.EnvironmentOutlined, {})
116864
+ icon: /* @__PURE__ */ (0, import_jsx_runtime316.jsx)(import_icons53.EnvironmentOutlined, {})
116416
116865
  },
116417
116866
  {
116418
116867
  key: "models",
116419
116868
  label: "Model Configuration",
116420
- icon: /* @__PURE__ */ (0, import_jsx_runtime316.jsx)(import_icons52.ApiOutlined, {})
116869
+ icon: /* @__PURE__ */ (0, import_jsx_runtime316.jsx)(import_icons53.ApiOutlined, {})
116421
116870
  }
116422
116871
  ];
116423
116872
  var SettingsModal = ({
@@ -116869,7 +117318,7 @@ var SettingsModal = ({
116869
117318
  description: /* @__PURE__ */ (0, import_jsx_runtime316.jsxs)("div", { children: [
116870
117319
  /* @__PURE__ */ (0, import_jsx_runtime316.jsxs)("div", { style: { marginBottom: 8 }, children: [
116871
117320
  /* @__PURE__ */ (0, import_jsx_runtime316.jsx)(
116872
- import_icons52.CheckCircleOutlined,
117321
+ import_icons53.CheckCircleOutlined,
116873
117322
  {
116874
117323
  style: { color: "#52c41a", marginRight: 8 }
116875
117324
  }
@@ -116878,7 +117327,7 @@ var SettingsModal = ({
116878
117327
  " QUEUE_SERVICE_TYPE, REDIS_URL, REDIS_PASSWORD, QUEUE_NAME"
116879
117328
  ] }),
116880
117329
  /* @__PURE__ */ (0, import_jsx_runtime316.jsxs)("div", { children: [
116881
- /* @__PURE__ */ (0, import_jsx_runtime316.jsx)(import_icons52.ReloadOutlined, { style: { color: "#faad14", marginRight: 8 } }),
117330
+ /* @__PURE__ */ (0, import_jsx_runtime316.jsx)(import_icons53.ReloadOutlined, { style: { color: "#faad14", marginRight: 8 } }),
116882
117331
  /* @__PURE__ */ (0, import_jsx_runtime316.jsx)("strong", { children: "Requires restart:" }),
116883
117332
  " PORT (server must be restarted to change port)"
116884
117333
  ] })
@@ -117165,7 +117614,7 @@ QUEUE_NAME=tasks`,
117165
117614
  const renderTabLabel = (connection) => {
117166
117615
  return /* @__PURE__ */ (0, import_jsx_runtime316.jsxs)("div", { style: { display: "flex", alignItems: "center" }, children: [
117167
117616
  /* @__PURE__ */ (0, import_jsx_runtime316.jsx)(
117168
- import_icons52.CloudServerOutlined,
117617
+ import_icons53.CloudServerOutlined,
117169
117618
  {
117170
117619
  style: {
117171
117620
  marginRight: 8,
@@ -117175,13 +117624,13 @@ QUEUE_NAME=tasks`,
117175
117624
  ),
117176
117625
  /* @__PURE__ */ (0, import_jsx_runtime316.jsx)("span", { children: connection.name }),
117177
117626
  connection.connected && /* @__PURE__ */ (0, import_jsx_runtime316.jsx)(
117178
- import_icons52.CheckCircleFilled,
117627
+ import_icons53.CheckCircleFilled,
117179
117628
  {
117180
117629
  style: { color: "#52c41a", fontSize: 12, marginLeft: 8 }
117181
117630
  }
117182
117631
  ),
117183
117632
  connection.error && !connection.connecting && /* @__PURE__ */ (0, import_jsx_runtime316.jsx)(
117184
- import_icons52.CloseCircleFilled,
117633
+ import_icons53.CloseCircleFilled,
117185
117634
  {
117186
117635
  style: { color: "#ff4d4f", fontSize: 12, marginLeft: 8 }
117187
117636
  }
@@ -117219,7 +117668,7 @@ QUEUE_NAME=tasks`,
117219
117668
  import_antd158.Button,
117220
117669
  {
117221
117670
  type: "primary",
117222
- icon: /* @__PURE__ */ (0, import_jsx_runtime316.jsx)(import_icons52.SaveOutlined, {}),
117671
+ icon: /* @__PURE__ */ (0, import_jsx_runtime316.jsx)(import_icons53.SaveOutlined, {}),
117223
117672
  onClick: handleSave,
117224
117673
  loading,
117225
117674
  children: "Save Configuration"
@@ -117242,14 +117691,14 @@ QUEUE_NAME=tasks`,
117242
117691
  padding: 48
117243
117692
  },
117244
117693
  children: connection.connecting ? /* @__PURE__ */ (0, import_jsx_runtime316.jsxs)(import_jsx_runtime316.Fragment, { children: [
117245
- /* @__PURE__ */ (0, import_jsx_runtime316.jsx)(import_icons52.LinkOutlined, { style: { fontSize: 64, color: "#1890ff" }, spin: true }),
117694
+ /* @__PURE__ */ (0, import_jsx_runtime316.jsx)(import_icons53.LinkOutlined, { style: { fontSize: 64, color: "#1890ff" }, spin: true }),
117246
117695
  /* @__PURE__ */ (0, import_jsx_runtime316.jsx)(Title19, { level: 4, children: "Connecting..." }),
117247
117696
  /* @__PURE__ */ (0, import_jsx_runtime316.jsxs)(Text81, { type: "secondary", style: { textAlign: "center" }, children: [
117248
117697
  "Connecting to ",
117249
117698
  connection.url
117250
117699
  ] })
117251
117700
  ] }) : /* @__PURE__ */ (0, import_jsx_runtime316.jsxs)(import_jsx_runtime316.Fragment, { children: [
117252
- /* @__PURE__ */ (0, import_jsx_runtime316.jsx)(import_icons52.LinkOutlined, { style: { fontSize: 64, color: "#d9d9d9" } }),
117701
+ /* @__PURE__ */ (0, import_jsx_runtime316.jsx)(import_icons53.LinkOutlined, { style: { fontSize: 64, color: "#d9d9d9" } }),
117253
117702
  /* @__PURE__ */ (0, import_jsx_runtime316.jsx)(Title19, { level: 4, type: "secondary", children: connection.error || "Not Connected" }),
117254
117703
  /* @__PURE__ */ (0, import_jsx_runtime316.jsx)(
117255
117704
  Text81,
@@ -117263,7 +117712,7 @@ QUEUE_NAME=tasks`,
117263
117712
  import_antd158.Button,
117264
117713
  {
117265
117714
  type: "primary",
117266
- icon: /* @__PURE__ */ (0, import_jsx_runtime316.jsx)(import_icons52.LinkOutlined, {}),
117715
+ icon: /* @__PURE__ */ (0, import_jsx_runtime316.jsx)(import_icons53.LinkOutlined, {}),
117267
117716
  onClick: () => checkConnection(connection.id),
117268
117717
  loading: connection.connecting,
117269
117718
  style: { marginTop: 16 },
@@ -117309,7 +117758,7 @@ QUEUE_NAME=tasks`,
117309
117758
  padding: "4px 8px"
117310
117759
  },
117311
117760
  children: [
117312
- /* @__PURE__ */ (0, import_jsx_runtime316.jsx)(import_icons52.PlusOutlined, {}),
117761
+ /* @__PURE__ */ (0, import_jsx_runtime316.jsx)(import_icons53.PlusOutlined, {}),
117313
117762
  /* @__PURE__ */ (0, import_jsx_runtime316.jsx)("span", { children: "Add Server" })
117314
117763
  ]
117315
117764
  }
@@ -117728,7 +118177,7 @@ var import_antd_style71 = require("antd-style");
117728
118177
  // src/components/Chat/AssistantNode.tsx
117729
118178
  var import_react206 = require("react");
117730
118179
  var import_antd160 = require("antd");
117731
- var import_icons53 = require("@ant-design/icons");
118180
+ var import_icons54 = require("@ant-design/icons");
117732
118181
  var import_lucide_react81 = require("lucide-react");
117733
118182
  var import_jsx_runtime320 = require("react/jsx-runtime");
117734
118183
  var { Text: Text83 } = import_antd160.Typography;
@@ -117931,7 +118380,7 @@ var AssistantNode = ({
117931
118380
  },
117932
118381
  children: [
117933
118382
  /* @__PURE__ */ (0, import_jsx_runtime320.jsx)(
117934
- import_icons53.SettingOutlined,
118383
+ import_icons54.SettingOutlined,
117935
118384
  {
117936
118385
  style: {
117937
118386
  fontSize: 14,
@@ -117986,7 +118435,7 @@ var AssistantNode = ({
117986
118435
  },
117987
118436
  children: [
117988
118437
  /* @__PURE__ */ (0, import_jsx_runtime320.jsx)(
117989
- import_icons53.CodeOutlined,
118438
+ import_icons54.CodeOutlined,
117990
118439
  {
117991
118440
  style: {
117992
118441
  fontSize: 14,
@@ -118049,7 +118498,7 @@ var AssistantNode = ({
118049
118498
  },
118050
118499
  children: [
118051
118500
  /* @__PURE__ */ (0, import_jsx_runtime320.jsx)(
118052
- import_icons53.ToolOutlined,
118501
+ import_icons54.ToolOutlined,
118053
118502
  {
118054
118503
  style: {
118055
118504
  fontSize: 14,
@@ -118118,7 +118567,7 @@ var AssistantNode = ({
118118
118567
  },
118119
118568
  children: [
118120
118569
  /* @__PURE__ */ (0, import_jsx_runtime320.jsx)(
118121
- import_icons53.BranchesOutlined,
118570
+ import_icons54.BranchesOutlined,
118122
118571
  {
118123
118572
  style: {
118124
118573
  fontSize: 14,
@@ -118256,7 +118705,7 @@ var AssistantNode = ({
118256
118705
  import_antd160.Avatar,
118257
118706
  {
118258
118707
  size: 44,
118259
- icon: /* @__PURE__ */ (0, import_jsx_runtime320.jsx)(import_icons53.UserOutlined, {}),
118708
+ icon: /* @__PURE__ */ (0, import_jsx_runtime320.jsx)(import_icons54.UserOutlined, {}),
118260
118709
  style: {
118261
118710
  backgroundColor: badgeColor,
118262
118711
  color: "#fff",
@@ -118321,7 +118770,7 @@ var AssistantNode = ({
118321
118770
  },
118322
118771
  children: [
118323
118772
  /* @__PURE__ */ (0, import_jsx_runtime320.jsx)(
118324
- import_icons53.IdcardOutlined,
118773
+ import_icons54.IdcardOutlined,
118325
118774
  {
118326
118775
  style: {
118327
118776
  fontSize: 9,
@@ -118540,7 +118989,7 @@ var AssistantNode = ({
118540
118989
  e8.currentTarget.style.backgroundColor = token.colorPrimary;
118541
118990
  },
118542
118991
  children: [
118543
- /* @__PURE__ */ (0, import_jsx_runtime320.jsx)(import_icons53.MessageOutlined, { style: { fontSize: 10 } }),
118992
+ /* @__PURE__ */ (0, import_jsx_runtime320.jsx)(import_icons54.MessageOutlined, { style: { fontSize: 10 } }),
118544
118993
  /* @__PURE__ */ (0, import_jsx_runtime320.jsx)("span", { children: "Chat" })
118545
118994
  ]
118546
118995
  }
@@ -118563,7 +119012,7 @@ var AssistantNode_default = AssistantNode;
118563
119012
 
118564
119013
  // src/components/Chat/AssistantFlow.tsx
118565
119014
  var import_antd161 = require("antd");
118566
- var import_icons54 = require("@ant-design/icons");
119015
+ var import_icons55 = require("@ant-design/icons");
118567
119016
  var import_jsx_runtime321 = require("react/jsx-runtime");
118568
119017
  var useStyles54 = (0, import_antd_style71.createStyles)(({ token, css }) => ({
118569
119018
  root: css`
@@ -119078,7 +119527,7 @@ var AssistantFlowInner = ({ onChat }) => {
119078
119527
  {
119079
119528
  type: "primary",
119080
119529
  size: "large",
119081
- icon: /* @__PURE__ */ (0, import_jsx_runtime321.jsx)(import_icons54.PlusOutlined, {}),
119530
+ icon: /* @__PURE__ */ (0, import_jsx_runtime321.jsx)(import_icons55.PlusOutlined, {}),
119082
119531
  onClick: () => setIsCreateModalOpen(true),
119083
119532
  style: {
119084
119533
  height: 48,