@axiom-lattice/react-sdk 2.2.1 → 2.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -3242,6 +3242,13 @@ var WorkspaceContextProvider = ({
3242
3242
  },
3243
3243
  [client, workspaceId, projectId]
3244
3244
  );
3245
+ const getFileDownloadUrl = useCallback7(
3246
+ (filePath, assistantId) => {
3247
+ if (!workspaceId || !projectId) return "";
3248
+ return client.getFileDownloadUrl(workspaceId, projectId, filePath, assistantId);
3249
+ },
3250
+ [client, workspaceId, projectId]
3251
+ );
3245
3252
  const getDirectFileUrl = useCallback7(
3246
3253
  (filePath) => {
3247
3254
  if (!tenantId || !workspaceId || !projectId) return "";
@@ -3298,6 +3305,7 @@ var WorkspaceContextProvider = ({
3298
3305
  uploadFileToFolder,
3299
3306
  uploadFileToProject,
3300
3307
  getFileViewUrl,
3308
+ getFileDownloadUrl,
3301
3309
  getDirectFileUrl,
3302
3310
  shareFile,
3303
3311
  listShares,
@@ -5243,12 +5251,12 @@ var FilePanelToggle = () => {
5243
5251
  };
5244
5252
 
5245
5253
  // src/components/Chat/PinToMenuButton.tsx
5246
- import React125, { useState as useState126, useCallback as useCallback63, useEffect as useEffect96 } from "react";
5254
+ import React127, { useState as useState126, useCallback as useCallback63, useEffect as useEffect96 } from "react";
5247
5255
  import { Button as Button78, Input as Input33, Modal as Modal41, Tooltip as Tooltip33, AutoComplete, message as message40 } from "antd";
5248
5256
  import { Pin } from "lucide-react";
5249
5257
 
5250
5258
  // src/components/Chat/WorkspaceResourceManager.tsx
5251
- import React124, { useMemo as useMemo54, useEffect as useEffect95, useRef as useRef43, useState as useState125, useCallback as useCallback62 } from "react";
5259
+ import React126, { useMemo as useMemo54, useEffect as useEffect95, useRef as useRef43, useState as useState125, useCallback as useCallback62 } from "react";
5252
5260
  import { FolderOpen as FolderOpen3, Activity as Activity5, Database as Database8, Plug as Plug4, Bot as Bot12, Wrench as Wrench3, Zap as Zap3, Share2, History as History2, Inbox as Inbox3, FlaskConical as FlaskConical9, PinOff, Layers as Layers3, ArrowRightLeft as ArrowRightLeft2, ListChecks as ListChecks3 } from "lucide-react";
5253
5261
  import { Modal as Modal40, Avatar as Avatar11, Popover as Popover5, message as message39 } from "antd";
5254
5262
 
@@ -13508,7 +13516,7 @@ import dagre2 from "dagre";
13508
13516
 
13509
13517
  // src/components/GenUI/MDResponse.tsx
13510
13518
  import XMarkdown from "@ant-design/x-markdown";
13511
- import React79, { useRef as useRef27, useState as useState89, useMemo as useMemo36, useDeferredValue as useDeferredValue3 } from "react";
13519
+ import React81, { useRef as useRef27, useState as useState89, useMemo as useMemo36, useDeferredValue as useDeferredValue3 } from "react";
13512
13520
  import { createStyles as createStyles56 } from "antd-style";
13513
13521
 
13514
13522
  // src/components/GenUI/elements/confirm_feedback.tsx
@@ -19887,12 +19895,14 @@ var useStyles24 = createStyles33(({ token, css }) => ({
19887
19895
  var MarkdownViewer = ({
19888
19896
  content,
19889
19897
  fileName,
19898
+ downloadUrl,
19890
19899
  className,
19891
19900
  style
19892
19901
  }) => {
19893
19902
  const { styles, cx } = useStyles24();
19894
19903
  const [copied, setCopied] = useState60(false);
19895
19904
  const contentRef = useRef14(null);
19905
+ const downloadFileName = fileName.split("/").pop() || fileName;
19896
19906
  useEffect44(() => {
19897
19907
  if (copied) {
19898
19908
  const timer = setTimeout(() => setCopied(false), 2e3);
@@ -19910,7 +19920,6 @@ var MarkdownViewer = ({
19910
19920
  const url = URL.createObjectURL(blob);
19911
19921
  const a = document.createElement("a");
19912
19922
  a.href = url;
19913
- const downloadFileName = fileName.split("/").pop() || fileName;
19914
19923
  a.download = downloadFileName;
19915
19924
  document.body.appendChild(a);
19916
19925
  a.click();
@@ -20034,7 +20043,10 @@ ${content}
20034
20043
  {
20035
20044
  type: "text",
20036
20045
  icon: /* @__PURE__ */ jsx73(DownloadOutlined2, {}),
20037
- onClick: handleDownload,
20046
+ "aria-label": "Download File",
20047
+ href: downloadUrl,
20048
+ download: downloadUrl ? downloadFileName : void 0,
20049
+ onClick: downloadUrl ? void 0 : handleDownload,
20038
20050
  size: "small"
20039
20051
  }
20040
20052
  ) }),
@@ -20467,6 +20479,10 @@ var AttachmentsCard = ({
20467
20479
  const { config } = useLatticeChatShellContext();
20468
20480
  const workspaceCtx = useContext11(WorkspaceContext);
20469
20481
  const baseURL = config.baseURL;
20482
+ const getSandboxFileUrl = (filePath) => {
20483
+ const params = new URLSearchParams({ path: filePath });
20484
+ return `${baseURL}/api/assistants/${assistantId}/threads/${threadId}/sandbox/downloadfile?${params.toString()}`;
20485
+ };
20470
20486
  const getFileUrl = (item) => {
20471
20487
  if (typeof item.id === "string" && /^https?:\/\//i.test(item.id)) {
20472
20488
  return item.id;
@@ -20474,7 +20490,16 @@ var AttachmentsCard = ({
20474
20490
  if (workspaceCtx?.workspaceId && workspaceCtx?.projectId) {
20475
20491
  return workspaceCtx.getFileViewUrl(item.id, assistantId || void 0);
20476
20492
  }
20477
- return `${baseURL}/api/assistants/${assistantId}/threads/${threadId}/sandbox/downloadfile?path=${item.id}`;
20493
+ return getSandboxFileUrl(item.id);
20494
+ };
20495
+ const getFileDownloadUrl = (item) => {
20496
+ if (typeof item.id === "string" && /^https?:\/\//i.test(item.id)) {
20497
+ return item.id;
20498
+ }
20499
+ if (workspaceCtx?.workspaceId && workspaceCtx?.projectId) {
20500
+ return workspaceCtx.getFileDownloadUrl(item.id, assistantId || void 0);
20501
+ }
20502
+ return getSandboxFileUrl(item.id);
20478
20503
  };
20479
20504
  const { Text: Text77 } = Typography34;
20480
20505
  const [showAll, setShowAll] = useState62(false);
@@ -20510,7 +20535,12 @@ var AttachmentsCard = ({
20510
20535
  if (getFileCategory(item.name) === "image") return;
20511
20536
  openSideApp({
20512
20537
  component_key: "attachments",
20513
- data: { file_id: item.id, message: "Preview: " + item.name, full_url: getFileUrl(item) },
20538
+ data: {
20539
+ file_id: item.id,
20540
+ message: "Preview: " + item.name,
20541
+ full_url: getFileUrl(item),
20542
+ download_url: getFileDownloadUrl(item)
20543
+ },
20514
20544
  message: "Preview: " + item.name
20515
20545
  });
20516
20546
  };
@@ -20751,6 +20781,7 @@ var useStyles26 = createStyles35(({ token, css }) => ({
20751
20781
  var FileRenderer = ({
20752
20782
  fileUrl,
20753
20783
  fileName = "",
20784
+ downloadUrl,
20754
20785
  showHeader = true
20755
20786
  }) => {
20756
20787
  const { styles } = useStyles26();
@@ -20785,7 +20816,14 @@ var FileRenderer = ({
20785
20816
  switch (category) {
20786
20817
  case "markdown":
20787
20818
  case "text":
20788
- return /* @__PURE__ */ jsx77("div", { className: styles.container, children: /* @__PURE__ */ jsx77(MarkdownViewer, { content, fileName }) });
20819
+ return /* @__PURE__ */ jsx77("div", { className: styles.container, children: /* @__PURE__ */ jsx77(
20820
+ MarkdownViewer,
20821
+ {
20822
+ content,
20823
+ fileName,
20824
+ downloadUrl
20825
+ }
20826
+ ) });
20789
20827
  case "image":
20790
20828
  return /* @__PURE__ */ jsx77("div", { className: styles.container, children: /* @__PURE__ */ jsx77("div", { className: styles.contentWrapper, children: /* @__PURE__ */ jsx77("div", { className: styles.imageContainer, children: /* @__PURE__ */ jsx77("img", { src: fileUrl, alt: fileName, className: styles.image }) }) }) });
20791
20829
  case "pdf":
@@ -20812,19 +20850,24 @@ var FileRenderer = ({
20812
20850
  return /* @__PURE__ */ jsx77("div", { className: styles.container, children: /* @__PURE__ */ jsxs58("div", { className: styles.downloadContainer, children: [
20813
20851
  /* @__PURE__ */ jsx77(FileUnknownOutlined3, { className: styles.fileIcon }),
20814
20852
  /* @__PURE__ */ jsx77("span", { className: styles.fileName, children: fileName || "Unknown file" }),
20815
- /* @__PURE__ */ jsx77(Button32, { type: "primary", href: fileUrl, download: fileName, children: "Download File" })
20853
+ /* @__PURE__ */ jsx77(Button32, { type: "primary", href: downloadUrl || fileUrl, download: fileName, children: "Download File" })
20816
20854
  ] }) });
20817
20855
  }
20818
20856
  };
20819
20857
 
20820
20858
  // src/components/GenUI/RenderMDFromURL.tsx
20821
20859
  import { jsx as jsx78 } from "react/jsx-runtime";
20822
- var RenderMDFromURL = ({ url, file_id }) => {
20860
+ var RenderMDFromURL = ({
20861
+ url,
20862
+ file_id,
20863
+ downloadUrl
20864
+ }) => {
20823
20865
  return /* @__PURE__ */ jsx78(
20824
20866
  FileRenderer,
20825
20867
  {
20826
20868
  fileUrl: url,
20827
20869
  fileName: file_id,
20870
+ downloadUrl,
20828
20871
  showHeader: true
20829
20872
  }
20830
20873
  );
@@ -21069,7 +21112,7 @@ function AttachmentsViewerSideApp({
21069
21112
  }) {
21070
21113
  const [loading, setLoading] = useState65(false);
21071
21114
  const [shareOpen, setShareOpen] = useState65(false);
21072
- const { file_id, url, full_url } = data ?? {};
21115
+ const { file_id, url, full_url, download_url } = data ?? {};
21073
21116
  const [fileUri, setFileUri] = useState65({
21074
21117
  url: full_url || "",
21075
21118
  fileName: extractFileName(file_id || "")
@@ -21084,13 +21127,21 @@ function AttachmentsViewerSideApp({
21084
21127
  return /* @__PURE__ */ jsx80(Skeleton, { active: true });
21085
21128
  }
21086
21129
  const fileUrl = fileUri?.url || url;
21130
+ const downloadUrl = download_url || fileUrl || "";
21087
21131
  const fileName = fileUri?.fileName || "";
21088
21132
  const isText = isTextFile(fileName);
21089
21133
  const isPreviewable = canPreviewInline(fileName);
21090
21134
  const isDir = !!fileName && !fileName.includes(".");
21091
21135
  let content;
21092
21136
  if (isText && fileUrl) {
21093
- content = /* @__PURE__ */ jsx80(RenderMDFromURL, { url: fileUrl, file_id });
21137
+ content = /* @__PURE__ */ jsx80(
21138
+ RenderMDFromURL,
21139
+ {
21140
+ url: fileUrl,
21141
+ file_id,
21142
+ downloadUrl
21143
+ }
21144
+ );
21094
21145
  } else if (isPreviewable || url || isDir) {
21095
21146
  content = /* @__PURE__ */ jsx80(
21096
21147
  "iframe",
@@ -21105,10 +21156,10 @@ function AttachmentsViewerSideApp({
21105
21156
  {
21106
21157
  description: /* @__PURE__ */ jsxs60(Fragment20, { children: [
21107
21158
  /* @__PURE__ */ jsx80("div", { children: "Preview not supported. Please download to view." }),
21108
- /* @__PURE__ */ jsxs60(Button34, { type: "link", href: fileUri?.url, download: fileUri?.fileName, children: [
21159
+ downloadUrl ? /* @__PURE__ */ jsxs60(Button34, { type: "link", href: downloadUrl, download: fileName, children: [
21109
21160
  "Download ",
21110
- fileUri?.fileName
21111
- ] })
21161
+ fileName
21162
+ ] }) : null
21112
21163
  ] }),
21113
21164
  image: Empty8.PRESENTED_IMAGE_DEFAULT
21114
21165
  }
@@ -21116,17 +21167,17 @@ function AttachmentsViewerSideApp({
21116
21167
  }
21117
21168
  return /* @__PURE__ */ jsxs60("div", { style: { display: "flex", flexDirection: "column", height: "100%" }, children: [
21118
21169
  /* @__PURE__ */ jsxs60(Space22, { style: { padding: "8px 12px", borderBottom: "1px solid #f0f0f0", width: "100%" }, children: [
21119
- /* @__PURE__ */ jsx80(
21170
+ downloadUrl ? /* @__PURE__ */ jsx80(
21120
21171
  Button34,
21121
21172
  {
21122
21173
  type: "text",
21123
21174
  size: "small",
21124
21175
  icon: /* @__PURE__ */ jsx80(DownloadOutlined3, {}),
21125
- href: fileUrl,
21176
+ href: downloadUrl,
21126
21177
  download: fileName,
21127
21178
  children: "Download"
21128
21179
  }
21129
- ),
21180
+ ) : null,
21130
21181
  /* @__PURE__ */ jsx80(
21131
21182
  Button34,
21132
21183
  {
@@ -21946,7 +21997,7 @@ import {
21946
21997
  Space as Space33,
21947
21998
  Typography as Typography46
21948
21999
  } from "antd";
21949
- import React63, { useCallback as useCallback37, useContext as useContext13, useDeferredValue as useDeferredValue2, useEffect as useEffect57, useMemo as useMemo25, useRef as useRef22, useState as useState78 } from "react";
22000
+ import React64, { useCallback as useCallback37, useContext as useContext13, useDeferredValue as useDeferredValue2, useEffect as useEffect57, useMemo as useMemo25, useRef as useRef22, useState as useState78 } from "react";
21950
22001
  import { BrainCircuit as BrainCircuit4 } from "lucide-react";
21951
22002
 
21952
22003
  // src/components/GenUI/HITLContainer.tsx
@@ -24522,7 +24573,7 @@ var BusinessAnalysisPrompts = ({
24522
24573
  };
24523
24574
 
24524
24575
  // src/components/Chat/VoiceInputButton.tsx
24525
- import React62, { useCallback as useCallback36, useEffect as useEffect56, useRef as useRef21, useState as useState77 } from "react";
24576
+ import React63, { useCallback as useCallback36, useEffect as useEffect56, useRef as useRef21, useState as useState77 } from "react";
24526
24577
  import { Button as Button47, message as message22 } from "antd";
24527
24578
  import { AudioLines, Loader2 as Loader24, AlertCircle as AlertCircle2 } from "lucide-react";
24528
24579
  import { createStyles as createStyles42 } from "antd-style";
@@ -24622,7 +24673,7 @@ var VoiceInputButton = ({
24622
24673
  const hasError = !!state.error;
24623
24674
  const isAutoMode = state.mode === "auto";
24624
24675
  const lastErrorRef = useRef21("");
24625
- React62.useEffect(() => {
24676
+ React63.useEffect(() => {
24626
24677
  if (state.error) {
24627
24678
  const errorKey = `${state.error.type}:${state.error.message}`;
24628
24679
  if (errorKey !== lastErrorRef.current) {
@@ -24797,7 +24848,7 @@ var Chating = ({
24797
24848
  const { styles } = useStyle();
24798
24849
  const [headerOpen, setHeaderOpen] = useState78(false);
24799
24850
  const attachmentsRef = useRef22(null);
24800
- const senderRef = React63.useRef(null);
24851
+ const senderRef = React64.useRef(null);
24801
24852
  const {
24802
24853
  assistantId,
24803
24854
  threadId,
@@ -26331,7 +26382,7 @@ import { RefreshCw as RefreshCw3 } from "lucide-react";
26331
26382
  import { createStyles as createStyles53 } from "antd-style";
26332
26383
 
26333
26384
  // src/components/GenUI/elements/TeamWorkspace/TeamWorkspaceMenu.tsx
26334
- import React65, { useState as useState80 } from "react";
26385
+ import React66, { useState as useState80 } from "react";
26335
26386
  import {
26336
26387
  LayoutDashboard,
26337
26388
  Inbox,
@@ -26553,7 +26604,7 @@ var TeamWorkspaceMenu = ({
26553
26604
  if (showTooltip && !isExpanded) {
26554
26605
  return /* @__PURE__ */ jsx115(Tooltip20, { title: item.name, placement: "right", children: content }, item.id);
26555
26606
  }
26556
- return /* @__PURE__ */ jsx115(React65.Fragment, { children: content }, item.id);
26607
+ return /* @__PURE__ */ jsx115(React66.Fragment, { children: content }, item.id);
26557
26608
  };
26558
26609
  const renderGroup = (groupItems, groupLabel, showDivider) => {
26559
26610
  if (groupItems.length === 0) return null;
@@ -28086,7 +28137,7 @@ var IssuesView = ({
28086
28137
  };
28087
28138
 
28088
28139
  // src/components/GenUI/elements/TeamWorkspace/TeamOrgCanvas.tsx
28089
- import React68, { useMemo as useMemo28 } from "react";
28140
+ import React69, { useMemo as useMemo28 } from "react";
28090
28141
  import {
28091
28142
  ReactFlow as ReactFlow3,
28092
28143
  Background as Background3,
@@ -28327,7 +28378,7 @@ var TeamOrgCanvasInner = ({
28327
28378
  }, [team, teammates, taskStatsByTeammate]);
28328
28379
  const [flowNodes, setNodes, onNodesChange] = useNodesState3(nodes);
28329
28380
  const [flowEdges, setEdges, onEdgesChange] = useEdgesState3(edges);
28330
- React68.useEffect(() => {
28381
+ React69.useEffect(() => {
28331
28382
  setNodes(nodes);
28332
28383
  setEdges(edges);
28333
28384
  setTimeout(() => fitView({ padding: 0.2 }), 100);
@@ -30086,7 +30137,7 @@ import { Button as Button55, Typography as Typography60 } from "antd";
30086
30137
  import { ExpandOutlined } from "@ant-design/icons";
30087
30138
 
30088
30139
  // src/streaming-html/StreamingHTMLRenderer.tsx
30089
- import React73, { useEffect as useEffect60, useRef as useRef24, useCallback as useCallback39, useState as useState86 } from "react";
30140
+ import React74, { useEffect as useEffect60, useRef as useRef24, useCallback as useCallback39, useState as useState86 } from "react";
30090
30141
 
30091
30142
  // src/streaming-html/show-widget-css-generator.ts
30092
30143
  function generateShowWidgetCSS(tokens) {
@@ -30785,8 +30836,8 @@ var StreamingHTMLRenderer = ({
30785
30836
  const pendingChunksRef = useRef24([]);
30786
30837
  const isCompleteRef = useRef24(isComplete);
30787
30838
  const isScriptExecuted = useRef24(false);
30788
- const [iframeHeight, setIframeHeight] = React73.useState(0);
30789
- const [iframeWidth, setIframeWidth] = React73.useState(void 0);
30839
+ const [iframeHeight, setIframeHeight] = React74.useState(0);
30840
+ const [iframeWidth, setIframeWidth] = React74.useState(void 0);
30790
30841
  const [currentMessageIndex, setCurrentMessageIndex] = useState86(0);
30791
30842
  const [showLoading, setShowLoading] = useState86(true);
30792
30843
  useEffect60(() => {
@@ -32105,25 +32156,28 @@ var FileLink = ({ data }) => {
32105
32156
  const openSideApp = useSideAppOpener();
32106
32157
  const { threadId, assistantId } = useConversationContext();
32107
32158
  const { config } = useLatticeChatShellContext();
32108
- const fileBaseURL = useMemo34(() => {
32159
+ const fileEndpoint = useMemo34(() => {
32109
32160
  if (!config?.baseURL || !assistantId || !threadId) {
32110
32161
  return null;
32111
32162
  }
32112
- return `${config.baseURL}/api/assistants/${assistantId}/threads/${threadId}/sandbox/downloadfile?path=`;
32163
+ return `${config.baseURL}/api/assistants/${assistantId}/threads/${threadId}/sandbox/downloadfile`;
32113
32164
  }, [config?.baseURL, assistantId, threadId]);
32114
32165
  const handleItemClick = useCallback42((path) => {
32115
- if (!fileBaseURL) return;
32166
+ if (!fileEndpoint) return;
32167
+ const params = new URLSearchParams({ path });
32168
+ const fileUrl = `${fileEndpoint}?${params.toString()}`;
32116
32169
  openSideApp({
32117
32170
  component_key: "attachments",
32118
32171
  data: {
32119
32172
  file_id: path,
32120
32173
  message: "\u9884\u89C8\uFF1A" + path.split("/").pop(),
32121
- full_url: `${fileBaseURL}${path}`
32174
+ full_url: fileUrl,
32175
+ download_url: fileUrl
32122
32176
  },
32123
32177
  message: "\u9884\u89C8\uFF1A" + path.split("/").pop()
32124
32178
  });
32125
- }, [fileBaseURL, openSideApp]);
32126
- if (!fileBaseURL) {
32179
+ }, [fileEndpoint, openSideApp]);
32180
+ if (!fileEndpoint) {
32127
32181
  return /* @__PURE__ */ jsx137("span", { children: data });
32128
32182
  }
32129
32183
  return /* @__PURE__ */ jsx137(Button57, { type: "link", size: "small", onClick: () => handleItemClick(data), children: data });
@@ -32295,7 +32349,7 @@ var useStyles40 = createStyles56(({ token, css }) => ({
32295
32349
  }
32296
32350
  `
32297
32351
  }));
32298
- var MarkdownErrorBoundary = class extends React79.Component {
32352
+ var MarkdownErrorBoundary = class extends React81.Component {
32299
32353
  constructor(props) {
32300
32354
  super(props);
32301
32355
  this.state = { hasError: false };
@@ -32313,7 +32367,7 @@ var MarkdownErrorBoundary = class extends React79.Component {
32313
32367
  return this.props.children;
32314
32368
  }
32315
32369
  };
32316
- var SafeXMarkdown = React79.memo(({ content, components, className }) => {
32370
+ var SafeXMarkdown = React81.memo(({ content, components, className }) => {
32317
32371
  const deferredContent = useDeferredValue3(content);
32318
32372
  if (typeof deferredContent !== "string") {
32319
32373
  console.warn("[MDResponse] Content is not a string:", typeof deferredContent, deferredContent);
@@ -32348,7 +32402,7 @@ var MDResponseInner = ({
32348
32402
  }
32349
32403
  ) });
32350
32404
  };
32351
- var MDResponse = React79.memo(MDResponseInner);
32405
+ var MDResponse = React81.memo(MDResponseInner);
32352
32406
  MDResponse.displayName = "MDResponse";
32353
32407
  var MDViewFormItem = ({ value }) => {
32354
32408
  return /* @__PURE__ */ jsx139(MDResponse, { content: value || "" });
@@ -35645,7 +35699,7 @@ var WorkflowAutomationView = () => {
35645
35699
  };
35646
35700
 
35647
35701
  // src/components/Governance/AgentGovernanceWorkbench.tsx
35648
- import React112, { useCallback as useCallback55, useEffect as useEffect88, useState as useState115 } from "react";
35702
+ import React114, { useCallback as useCallback55, useEffect as useEffect88, useState as useState115 } from "react";
35649
35703
  import { message as message34, Modal as Modal34 } from "antd";
35650
35704
 
35651
35705
  // src/components/Governance/AgentList.tsx
@@ -36211,7 +36265,7 @@ import { ArrowLeftOutlined, DeleteOutlined as DeleteOutlined6, InfoCircleOutline
36211
36265
  import { Bot as Bot9, Workflow as WorkflowIcon2, Play as Play4, FlaskConical as FlaskConical7, Settings2 as Settings22 } from "lucide-react";
36212
36266
 
36213
36267
  // src/components/Chat/AgentConfigPanel.tsx
36214
- import React93, { useState as useState98, useEffect as useEffect72, useMemo as useMemo45, useCallback as useCallback47 } from "react";
36268
+ import React95, { useState as useState98, useEffect as useEffect72, useMemo as useMemo45, useCallback as useCallback47 } from "react";
36215
36269
  import {
36216
36270
  Form as Form11,
36217
36271
  Input as Input23,
@@ -38011,7 +38065,7 @@ var AgentConfigPanel = ({
38011
38065
  item.key
38012
38066
  );
38013
38067
  }
38014
- return /* @__PURE__ */ jsxs116(React93.Fragment, { children: [
38068
+ return /* @__PURE__ */ jsxs116(React95.Fragment, { children: [
38015
38069
  /* @__PURE__ */ jsxs116(
38016
38070
  "div",
38017
38071
  {
@@ -38955,7 +39009,7 @@ var GROUP_LABEL = {
38955
39009
  };
38956
39010
 
38957
39011
  // src/components/Governance/AgentOverview.tsx
38958
- import React97, { useMemo as useMemo47, useCallback as useCallback50 } from "react";
39012
+ import React99, { useMemo as useMemo47, useCallback as useCallback50 } from "react";
38959
39013
  import { Spin as Spin30 } from "antd";
38960
39014
  import { Activity as Activity4, FlaskConical as FlaskConical6, TrendingUp as TrendingUp3, Bot as Bot8, MessageCircle } from "lucide-react";
38961
39015
 
@@ -38987,9 +39041,9 @@ var EChart = ({ option, height = 200 }) => {
38987
39041
  import { jsx as jsx163, jsxs as jsxs119 } from "react/jsx-runtime";
38988
39042
  function useThreadStats(assistantId) {
38989
39043
  const { get } = useApi();
38990
- const [stats, setStats] = React97.useState({ total: 0, last7d: 0, last30d: 0, lastActive: null, daily7d: [], daily30d: [] });
38991
- const [loading, setLoading] = React97.useState(true);
38992
- const fetch2 = React97.useCallback(async () => {
39044
+ const [stats, setStats] = React99.useState({ total: 0, last7d: 0, last30d: 0, lastActive: null, daily7d: [], daily30d: [] });
39045
+ const [loading, setLoading] = React99.useState(true);
39046
+ const fetch2 = React99.useCallback(async () => {
38993
39047
  setLoading(true);
38994
39048
  try {
38995
39049
  const data = await get(
@@ -39025,7 +39079,7 @@ function useThreadStats(assistantId) {
39025
39079
  setLoading(false);
39026
39080
  }
39027
39081
  }, [get, assistantId]);
39028
- React97.useEffect(() => {
39082
+ React99.useEffect(() => {
39029
39083
  fetch2();
39030
39084
  }, [fetch2]);
39031
39085
  return { stats, loading };
@@ -39721,7 +39775,7 @@ var LearningProgressCard = ({
39721
39775
  };
39722
39776
 
39723
39777
  // src/components/Governance/EvalRunInsights.tsx
39724
- import React101, { useEffect as useEffect77, useState as useState104 } from "react";
39778
+ import React103, { useEffect as useEffect77, useState as useState104 } from "react";
39725
39779
  import { jsx as jsx167, jsxs as jsxs123 } from "react/jsx-runtime";
39726
39780
  function latestVisibleRunId(runs) {
39727
39781
  for (let i = runs.length - 1; i >= 0; i--) {
@@ -39733,7 +39787,7 @@ function latestVisibleRunId(runs) {
39733
39787
  var EvalRunInsights = ({ runId }) => {
39734
39788
  const { get } = useApi();
39735
39789
  const [results, setResults] = useState104(null);
39736
- const getRef = React101.useRef(get);
39790
+ const getRef = React103.useRef(get);
39737
39791
  getRef.current = get;
39738
39792
  useEffect77(() => {
39739
39793
  if (!runId) {
@@ -39763,7 +39817,7 @@ var EvalRunInsights = ({ runId }) => {
39763
39817
  };
39764
39818
 
39765
39819
  // src/components/Governance/RoundTrendChart.tsx
39766
- import React102, { useEffect as useEffect78, useMemo as useMemo48, useState as useState105 } from "react";
39820
+ import React104, { useEffect as useEffect78, useMemo as useMemo48, useState as useState105 } from "react";
39767
39821
  import { jsx as jsx168, jsxs as jsxs124 } from "react/jsx-runtime";
39768
39822
  function scoreColor2(score) {
39769
39823
  return score >= 80 ? "#22c55e" : score >= 50 ? "#f59e0b" : "#ef4444";
@@ -39772,7 +39826,7 @@ var RoundTrendChart = ({ agentId, runs }) => {
39772
39826
  const { get } = useApi();
39773
39827
  const [rounds, setRounds] = useState105([]);
39774
39828
  const [loaded, setLoaded] = useState105(false);
39775
- const getRef = React102.useRef(get);
39829
+ const getRef = React104.useRef(get);
39776
39830
  getRef.current = get;
39777
39831
  useEffect78(() => {
39778
39832
  let cancelled = false;
@@ -42263,7 +42317,7 @@ var AgentGovernanceWorkbench = () => {
42263
42317
  useEffect88(() => {
42264
42318
  loadAgents();
42265
42319
  }, [loadAgents]);
42266
- const items = React112.useMemo(() => buildAgentListItems(assistants), [assistants]);
42320
+ const items = React114.useMemo(() => buildAgentListItems(assistants), [assistants]);
42267
42321
  const selectedAssistant = assistants.find((a) => a.id === selectedId) ?? null;
42268
42322
  const openDetail = useCallback55((id, tab = "graph") => {
42269
42323
  setSelectedId(id);
@@ -43722,7 +43776,7 @@ import {
43722
43776
  } from "lucide-react";
43723
43777
 
43724
43778
  // src/components/Chat/ThreadHistoryMenuContent.tsx
43725
- import React115, { useCallback as useCallback58, useState as useState118 } from "react";
43779
+ import React117, { useCallback as useCallback58, useState as useState118 } from "react";
43726
43780
  import { createStyles as createStyles63 } from "antd-style";
43727
43781
  import { MessageSquare as MessageSquare4, Trash2 as Trash215 } from "lucide-react";
43728
43782
  import { message as message37, Modal as Modal37 } from "antd";
@@ -43859,7 +43913,7 @@ var ThreadHistoryMenuContent = () => {
43859
43913
  setDeleting(false);
43860
43914
  }
43861
43915
  }, [threadToDelete, deleteThread]);
43862
- const sortedThreads = React115.useMemo(() => {
43916
+ const sortedThreads = React117.useMemo(() => {
43863
43917
  return [...threads].sort((a, b) => {
43864
43918
  const dateA = a.updatedAt ? new Date(a.updatedAt).getTime() : 0;
43865
43919
  const dateB = b.updatedAt ? new Date(b.updatedAt).getTime() : 0;
@@ -44741,7 +44795,7 @@ import { Upload as AntUpload, Button as Button75, Alert as Alert11, Progress as
44741
44795
  import { Upload as Upload3, CheckCircle as CheckCircle6, XCircle as XCircle5, MinusCircle } from "lucide-react";
44742
44796
 
44743
44797
  // src/components/Migration/ConflictResolver.tsx
44744
- import React120 from "react";
44798
+ import React122 from "react";
44745
44799
  import { Table as Table5, Select as Select18, Tag as Tag43, Input as Input32 } from "antd";
44746
44800
  import { Fragment as Fragment46, jsx as jsx188, jsxs as jsxs143 } from "react/jsx-runtime";
44747
44801
  var ConflictResolver = ({
@@ -44749,7 +44803,7 @@ var ConflictResolver = ({
44749
44803
  insertions,
44750
44804
  onChange
44751
44805
  }) => {
44752
- const [resolutions, setResolutions] = React120.useState({});
44806
+ const [resolutions, setResolutions] = React122.useState({});
44753
44807
  const handleResolution = (_exportId, action, newId) => {
44754
44808
  const updated = { ...resolutions, [_exportId]: { action, newId } };
44755
44809
  setResolutions(updated);
@@ -45926,7 +45980,7 @@ var WorkspaceResourceManager = ({
45926
45980
  return [
45927
45981
  {
45928
45982
  key: "unpin",
45929
- icon: React124.createElement(PinOff, { size: 14 }),
45983
+ icon: React126.createElement(PinOff, { size: 14 }),
45930
45984
  label: "Unpin from Menu",
45931
45985
  onClick: async () => {
45932
45986
  try {
@@ -46210,7 +46264,7 @@ async function unpinItem(del, pinnedId) {
46210
46264
  }
46211
46265
  }
46212
46266
  function usePinMenuActions() {
46213
- const workspaceCtx = React125.useContext(WorkspaceContext);
46267
+ const workspaceCtx = React127.useContext(WorkspaceContext);
46214
46268
  const { config } = useLatticeChatShellContext();
46215
46269
  const { post, get, del } = useApi();
46216
46270
  const enableCustomMenu = config.enableCustomMenu ?? false;
@@ -46243,12 +46297,12 @@ function extractGroups(items) {
46243
46297
  }
46244
46298
  function useMenuGroups() {
46245
46299
  const { config } = useLatticeChatShellContext();
46246
- const defaultGroups = React125.useMemo(() => extractGroups(DEFAULT_WORKSPACE_MENU_ITEMS), []);
46247
- const configGroups = React125.useMemo(
46300
+ const defaultGroups = React127.useMemo(() => extractGroups(DEFAULT_WORKSPACE_MENU_ITEMS), []);
46301
+ const configGroups = React127.useMemo(
46248
46302
  () => extractGroups(config.workspaceMenuItems ?? []),
46249
46303
  [config.workspaceMenuItems]
46250
46304
  );
46251
- return React125.useMemo(
46305
+ return React127.useMemo(
46252
46306
  () => Array.from(/* @__PURE__ */ new Set([...defaultGroups, ...configGroups])).sort(),
46253
46307
  [defaultGroups, configGroups]
46254
46308
  );
@@ -46434,7 +46488,7 @@ import { useCallback as useCallback65, useEffect as useEffect98, useMemo as useM
46434
46488
  import { message as message42 } from "antd";
46435
46489
 
46436
46490
  // src/components/Chat/FileDirectoryPanel.tsx
46437
- import React126, { useState as useState127, useCallback as useCallback64, useEffect as useEffect97 } from "react";
46491
+ import React128, { useState as useState127, useCallback as useCallback64, useEffect as useEffect97 } from "react";
46438
46492
  import { Spin as Spin33, Dropdown as Dropdown8, Button as Button79, Input as Input34, Modal as Modal42, AutoComplete as AutoComplete2, message as message41 } from "antd";
46439
46493
  import { ChevronRight as ChevronRight9, FolderOpen as FolderOpen4, Upload as Upload5, Pin as Pin2 } from "lucide-react";
46440
46494
  import { createStyles as createStyles65 } from "antd-style";
@@ -46675,7 +46729,7 @@ var FileDirectoryPanel = ({
46675
46729
  }) => {
46676
46730
  const { styles } = useStyles48();
46677
46731
  const { currentAssistant } = useAssistantContext();
46678
- const { getFileViewUrl, getDirectFileUrl } = useWorkspaceContext();
46732
+ const { getFileDownloadUrl, getDirectFileUrl } = useWorkspaceContext();
46679
46733
  const { openSideApp } = useChatUIContext();
46680
46734
  const { currentTenant } = useAuth();
46681
46735
  const tenantId = currentTenant?.id || "";
@@ -46796,7 +46850,7 @@ var FileDirectoryPanel = ({
46796
46850
  },
46797
46851
  [doUnpin]
46798
46852
  );
46799
- const renderEntry = React126.useCallback((entry, depth) => {
46853
+ const renderEntry = React128.useCallback((entry, depth) => {
46800
46854
  const entryName = getEntryName(entry);
46801
46855
  if (entry.is_dir) {
46802
46856
  const isExpanded = directoryExpanded[entry.path] || false;
@@ -46947,7 +47001,7 @@ var FileDirectoryPanel = ({
46947
47001
  icon: /* @__PURE__ */ jsx194(DownloadOutlined4, {}),
46948
47002
  label: "Download",
46949
47003
  onClick: () => {
46950
- const url = getFileViewUrl(
47004
+ const url = getFileDownloadUrl(
46951
47005
  entry.path,
46952
47006
  currentAssistant?.id
46953
47007
  );
@@ -46973,7 +47027,7 @@ var FileDirectoryPanel = ({
46973
47027
  }
46974
47028
  )
46975
47029
  ] }, entry.path);
46976
- }, [directoryChildren, directoryExpanded, directoryLoading, onAssetClick, onToggleDirectory, styles, getFileViewUrl, currentAssistant?.id, enableCustomMenu, pinStates, handleDropdownOpen, handleUnpin]);
47030
+ }, [directoryChildren, directoryExpanded, directoryLoading, onAssetClick, onToggleDirectory, styles, getFileDownloadUrl, currentAssistant?.id, enableCustomMenu, pinStates, handleDropdownOpen, handleUnpin]);
46977
47031
  if (!projectId) {
46978
47032
  return /* @__PURE__ */ jsx194("div", { className: styles.emptyState, children: "Please select a project to browse files" });
46979
47033
  }
@@ -47076,6 +47130,7 @@ var ToolPanelFiles = () => {
47076
47130
  listPath,
47077
47131
  listPathByFolder,
47078
47132
  getFileViewUrl,
47133
+ getFileDownloadUrl,
47079
47134
  uploadFileToFolder
47080
47135
  } = useWorkspaceContext();
47081
47136
  const { currentAssistant } = useAssistantContext();
@@ -47153,7 +47208,8 @@ var ToolPanelFiles = () => {
47153
47208
  }, [resourceFolders, loadAssetsForFolder]);
47154
47209
  const handleAssetClick = useCallback65((asset) => {
47155
47210
  const fileUrl = getFileViewUrl(asset.path, currentAssistant?.id);
47156
- if (!fileUrl) {
47211
+ const downloadUrl = getFileDownloadUrl(asset.path, currentAssistant?.id);
47212
+ if (!fileUrl || !downloadUrl) {
47157
47213
  message42.warning("Please select a workspace and project first.");
47158
47214
  return;
47159
47215
  }
@@ -47162,11 +47218,12 @@ var ToolPanelFiles = () => {
47162
47218
  data: {
47163
47219
  file_id: asset.path,
47164
47220
  message: `Preview: ${asset.name || asset.path}`,
47165
- full_url: fileUrl
47221
+ full_url: fileUrl,
47222
+ download_url: downloadUrl
47166
47223
  },
47167
47224
  message: `Preview: ${asset.name || asset.path}`
47168
47225
  });
47169
- }, [getFileViewUrl, openSideApp, currentAssistant?.id]);
47226
+ }, [getFileViewUrl, getFileDownloadUrl, openSideApp, currentAssistant?.id]);
47170
47227
  const handleUploadFolder = useCallback65(async (folderName) => {
47171
47228
  if (!workspaceId || !projectId) {
47172
47229
  message42.warning("Please select a workspace and project before uploading.");