@axiom-lattice/react-sdk 2.1.62 → 2.1.64
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 +320 -185
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +320 -185
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -991,20 +991,20 @@ var DEFAULT_MIDDLEWARE_TYPES = [
|
|
|
991
991
|
type: "object",
|
|
992
992
|
title: "Filesystem Configuration",
|
|
993
993
|
description: "Configure filesystem isolation and access settings",
|
|
994
|
-
required: ["
|
|
994
|
+
required: ["vmIsolation"],
|
|
995
995
|
properties: {
|
|
996
|
-
|
|
996
|
+
vmIsolation: {
|
|
997
997
|
type: "string",
|
|
998
|
-
title: "Isolation
|
|
999
|
-
description: "Controls how filesystem access is isolated between agents and
|
|
1000
|
-
enum: ["global", "agent", "
|
|
998
|
+
title: "VM Isolation",
|
|
999
|
+
description: "Controls how filesystem access is isolated between agents and projects",
|
|
1000
|
+
enum: ["global", "agent", "project"],
|
|
1001
1001
|
default: "global",
|
|
1002
1002
|
widget: "segmented"
|
|
1003
1003
|
}
|
|
1004
1004
|
}
|
|
1005
1005
|
},
|
|
1006
1006
|
defaultConfig: {
|
|
1007
|
-
|
|
1007
|
+
vmIsolation: "global"
|
|
1008
1008
|
},
|
|
1009
1009
|
tools: [
|
|
1010
1010
|
{ id: "sandbox_ls", name: "List Files", description: "List files in the directory" },
|
|
@@ -1024,20 +1024,20 @@ var DEFAULT_MIDDLEWARE_TYPES = [
|
|
|
1024
1024
|
type: "object",
|
|
1025
1025
|
title: "Code Evaluation Configuration",
|
|
1026
1026
|
description: "Configure code execution sandbox settings",
|
|
1027
|
-
required: ["
|
|
1027
|
+
required: ["vmIsolation"],
|
|
1028
1028
|
properties: {
|
|
1029
|
-
|
|
1029
|
+
vmIsolation: {
|
|
1030
1030
|
type: "string",
|
|
1031
|
-
title: "Isolation
|
|
1032
|
-
description: "Controls how code execution is isolated between agents and
|
|
1033
|
-
enum: ["global", "agent", "
|
|
1031
|
+
title: "VM Isolation",
|
|
1032
|
+
description: "Controls how code execution is isolated between agents and projects",
|
|
1033
|
+
enum: ["global", "agent", "project"],
|
|
1034
1034
|
default: "global",
|
|
1035
1035
|
widget: "segmented"
|
|
1036
1036
|
}
|
|
1037
1037
|
}
|
|
1038
1038
|
},
|
|
1039
1039
|
defaultConfig: {
|
|
1040
|
-
|
|
1040
|
+
vmIsolation: "global"
|
|
1041
1041
|
},
|
|
1042
1042
|
tools: [
|
|
1043
1043
|
{ id: "execute_code", name: "Execute Code", description: "Execute code snippets" },
|
|
@@ -1053,20 +1053,20 @@ var DEFAULT_MIDDLEWARE_TYPES = [
|
|
|
1053
1053
|
type: "object",
|
|
1054
1054
|
title: "Browser Configuration",
|
|
1055
1055
|
description: "Configure browser automation settings",
|
|
1056
|
-
required: ["
|
|
1056
|
+
required: ["vmIsolation"],
|
|
1057
1057
|
properties: {
|
|
1058
|
-
|
|
1058
|
+
vmIsolation: {
|
|
1059
1059
|
type: "string",
|
|
1060
|
-
title: "Isolation
|
|
1061
|
-
description: "Controls how browser instances are isolated between agents and
|
|
1062
|
-
enum: ["global", "agent", "
|
|
1060
|
+
title: "VM Isolation",
|
|
1061
|
+
description: "Controls how browser instances are isolated between agents and projects",
|
|
1062
|
+
enum: ["global", "agent", "project"],
|
|
1063
1063
|
default: "agent",
|
|
1064
1064
|
widget: "segmented"
|
|
1065
1065
|
}
|
|
1066
1066
|
}
|
|
1067
1067
|
},
|
|
1068
1068
|
defaultConfig: {
|
|
1069
|
-
|
|
1069
|
+
vmIsolation: "agent",
|
|
1070
1070
|
headless: true
|
|
1071
1071
|
},
|
|
1072
1072
|
tools: [
|
|
@@ -5355,7 +5355,7 @@ import { Spin as Spin2, Alert as Alert4, Button as Button7 } from "antd";
|
|
|
5355
5355
|
import { createStyles as createStyles4 } from "antd-style";
|
|
5356
5356
|
|
|
5357
5357
|
// src/components/GenUI/MarkdownViewer.tsx
|
|
5358
|
-
import { useState as useState18, useEffect as useEffect11, useRef as useRef9 } from "react";
|
|
5358
|
+
import React9, { useState as useState18, useEffect as useEffect11, useRef as useRef9 } from "react";
|
|
5359
5359
|
import { Button as Button6, Tooltip, message } from "antd";
|
|
5360
5360
|
import {
|
|
5361
5361
|
CopyOutlined,
|
|
@@ -5367,6 +5367,233 @@ import {
|
|
|
5367
5367
|
import { jsPDF } from "jspdf";
|
|
5368
5368
|
import html2canvas from "html2canvas";
|
|
5369
5369
|
import { createStyles as createStyles3 } from "antd-style";
|
|
5370
|
+
|
|
5371
|
+
// src/utils/fileUtils.ts
|
|
5372
|
+
function extractFileName(pathOrUrl) {
|
|
5373
|
+
if (!pathOrUrl) return "";
|
|
5374
|
+
const withoutQuery = pathOrUrl.split("?")[0];
|
|
5375
|
+
return withoutQuery.split("/").pop() || pathOrUrl;
|
|
5376
|
+
}
|
|
5377
|
+
function getFileExtension(pathOrUrl) {
|
|
5378
|
+
const fileName = extractFileName(pathOrUrl);
|
|
5379
|
+
if (!fileName) return "";
|
|
5380
|
+
const extension = fileName.split(".").pop()?.toLowerCase();
|
|
5381
|
+
return extension || "";
|
|
5382
|
+
}
|
|
5383
|
+
function getFileCategory(pathOrUrl) {
|
|
5384
|
+
const extension = getFileExtension(pathOrUrl);
|
|
5385
|
+
if (!extension) return "unknown";
|
|
5386
|
+
if (["md", "markdown", "mdx"].includes(extension)) return "markdown";
|
|
5387
|
+
if ([
|
|
5388
|
+
"txt",
|
|
5389
|
+
"json",
|
|
5390
|
+
"csv",
|
|
5391
|
+
"xml",
|
|
5392
|
+
"yaml",
|
|
5393
|
+
"yml",
|
|
5394
|
+
"ini",
|
|
5395
|
+
"conf",
|
|
5396
|
+
"sh",
|
|
5397
|
+
"bat",
|
|
5398
|
+
"cmd",
|
|
5399
|
+
"ts",
|
|
5400
|
+
"tsx",
|
|
5401
|
+
"js",
|
|
5402
|
+
"jsx",
|
|
5403
|
+
"mjs",
|
|
5404
|
+
"cjs",
|
|
5405
|
+
"py",
|
|
5406
|
+
"rb",
|
|
5407
|
+
"go",
|
|
5408
|
+
"rs",
|
|
5409
|
+
"java",
|
|
5410
|
+
"kt",
|
|
5411
|
+
"swift",
|
|
5412
|
+
"c",
|
|
5413
|
+
"cpp",
|
|
5414
|
+
"h",
|
|
5415
|
+
"hpp",
|
|
5416
|
+
"cs",
|
|
5417
|
+
"php",
|
|
5418
|
+
"vue",
|
|
5419
|
+
"svelte",
|
|
5420
|
+
"sql",
|
|
5421
|
+
"css",
|
|
5422
|
+
"less",
|
|
5423
|
+
"scss",
|
|
5424
|
+
"bash",
|
|
5425
|
+
"zsh",
|
|
5426
|
+
"toml"
|
|
5427
|
+
].includes(extension)) {
|
|
5428
|
+
return "text";
|
|
5429
|
+
}
|
|
5430
|
+
if (["jpg", "jpeg", "png", "gif", "svg", "bmp", "webp", "ico", "tiff", "tif"].includes(extension)) {
|
|
5431
|
+
return "image";
|
|
5432
|
+
}
|
|
5433
|
+
if (extension === "pdf") return "pdf";
|
|
5434
|
+
if (["mp3", "wav", "ogg", "flac", "aac", "m4a", "wma"].includes(extension)) return "audio";
|
|
5435
|
+
if (["mp4", "webm", "ogv", "mov", "avi", "mkv", "flv"].includes(extension)) return "video";
|
|
5436
|
+
if (["html", "htm"].includes(extension)) return "iframe";
|
|
5437
|
+
return "unknown";
|
|
5438
|
+
}
|
|
5439
|
+
function getLanguageFromFileName(pathOrUrl) {
|
|
5440
|
+
const ext = getFileExtension(pathOrUrl);
|
|
5441
|
+
switch (ext) {
|
|
5442
|
+
case "ts":
|
|
5443
|
+
case "tsx":
|
|
5444
|
+
return "typescript";
|
|
5445
|
+
case "js":
|
|
5446
|
+
case "jsx":
|
|
5447
|
+
case "mjs":
|
|
5448
|
+
case "cjs":
|
|
5449
|
+
return "javascript";
|
|
5450
|
+
case "py":
|
|
5451
|
+
return "python";
|
|
5452
|
+
case "rb":
|
|
5453
|
+
return "ruby";
|
|
5454
|
+
case "go":
|
|
5455
|
+
return "go";
|
|
5456
|
+
case "md":
|
|
5457
|
+
case "markdown":
|
|
5458
|
+
case "mdx":
|
|
5459
|
+
return "markdown";
|
|
5460
|
+
case "json":
|
|
5461
|
+
return "json";
|
|
5462
|
+
case "html":
|
|
5463
|
+
case "htm":
|
|
5464
|
+
return "html";
|
|
5465
|
+
case "css":
|
|
5466
|
+
return "css";
|
|
5467
|
+
case "less":
|
|
5468
|
+
return "less";
|
|
5469
|
+
case "scss":
|
|
5470
|
+
return "scss";
|
|
5471
|
+
case "java":
|
|
5472
|
+
return "java";
|
|
5473
|
+
case "kt":
|
|
5474
|
+
return "kotlin";
|
|
5475
|
+
case "swift":
|
|
5476
|
+
return "swift";
|
|
5477
|
+
case "rs":
|
|
5478
|
+
return "rust";
|
|
5479
|
+
case "c":
|
|
5480
|
+
case "h":
|
|
5481
|
+
return "c";
|
|
5482
|
+
case "cpp":
|
|
5483
|
+
case "hpp":
|
|
5484
|
+
return "cpp";
|
|
5485
|
+
case "cs":
|
|
5486
|
+
return "csharp";
|
|
5487
|
+
case "php":
|
|
5488
|
+
return "php";
|
|
5489
|
+
case "vue":
|
|
5490
|
+
return "vue";
|
|
5491
|
+
case "svelte":
|
|
5492
|
+
return "svelte";
|
|
5493
|
+
case "yaml":
|
|
5494
|
+
case "yml":
|
|
5495
|
+
return "yaml";
|
|
5496
|
+
case "sql":
|
|
5497
|
+
return "sql";
|
|
5498
|
+
case "sh":
|
|
5499
|
+
case "bash":
|
|
5500
|
+
case "zsh":
|
|
5501
|
+
return "bash";
|
|
5502
|
+
case "toml":
|
|
5503
|
+
return "toml";
|
|
5504
|
+
case "xml":
|
|
5505
|
+
return "xml";
|
|
5506
|
+
case "ini":
|
|
5507
|
+
case "conf":
|
|
5508
|
+
return "ini";
|
|
5509
|
+
default:
|
|
5510
|
+
return "text";
|
|
5511
|
+
}
|
|
5512
|
+
}
|
|
5513
|
+
function canPreviewInline(pathOrUrl) {
|
|
5514
|
+
const category = getFileCategory(pathOrUrl);
|
|
5515
|
+
return category !== "unknown";
|
|
5516
|
+
}
|
|
5517
|
+
function isTextFile(pathOrUrl) {
|
|
5518
|
+
const category = getFileCategory(pathOrUrl);
|
|
5519
|
+
return category === "markdown" || category === "text";
|
|
5520
|
+
}
|
|
5521
|
+
var COMMON_FILE_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
5522
|
+
// Code
|
|
5523
|
+
"ts",
|
|
5524
|
+
"tsx",
|
|
5525
|
+
"js",
|
|
5526
|
+
"jsx",
|
|
5527
|
+
"mjs",
|
|
5528
|
+
"cjs",
|
|
5529
|
+
"html",
|
|
5530
|
+
"htm",
|
|
5531
|
+
"css",
|
|
5532
|
+
"less",
|
|
5533
|
+
"scss",
|
|
5534
|
+
"md",
|
|
5535
|
+
"txt",
|
|
5536
|
+
"mdx",
|
|
5537
|
+
"json",
|
|
5538
|
+
"yaml",
|
|
5539
|
+
"yml",
|
|
5540
|
+
"py",
|
|
5541
|
+
"rb",
|
|
5542
|
+
"go",
|
|
5543
|
+
"rs",
|
|
5544
|
+
"java",
|
|
5545
|
+
"kt",
|
|
5546
|
+
"swift",
|
|
5547
|
+
"c",
|
|
5548
|
+
"cpp",
|
|
5549
|
+
"h",
|
|
5550
|
+
"hpp",
|
|
5551
|
+
"cs",
|
|
5552
|
+
"php",
|
|
5553
|
+
"vue",
|
|
5554
|
+
"svelte",
|
|
5555
|
+
"sql",
|
|
5556
|
+
"sh",
|
|
5557
|
+
"bash",
|
|
5558
|
+
"zsh",
|
|
5559
|
+
"toml",
|
|
5560
|
+
"xml",
|
|
5561
|
+
// Media
|
|
5562
|
+
"png",
|
|
5563
|
+
"jpg",
|
|
5564
|
+
"jpeg",
|
|
5565
|
+
"gif",
|
|
5566
|
+
"svg",
|
|
5567
|
+
"webp",
|
|
5568
|
+
"ico",
|
|
5569
|
+
"mp4",
|
|
5570
|
+
"webm",
|
|
5571
|
+
"mp3",
|
|
5572
|
+
"wav",
|
|
5573
|
+
"pdf",
|
|
5574
|
+
// Office
|
|
5575
|
+
"ppt",
|
|
5576
|
+
"pptx",
|
|
5577
|
+
"doc",
|
|
5578
|
+
"docx",
|
|
5579
|
+
"xls",
|
|
5580
|
+
"xlsx",
|
|
5581
|
+
"odt",
|
|
5582
|
+
"ods",
|
|
5583
|
+
"odp",
|
|
5584
|
+
"rtf",
|
|
5585
|
+
"csv",
|
|
5586
|
+
"key",
|
|
5587
|
+
"numbers",
|
|
5588
|
+
"pages"
|
|
5589
|
+
]);
|
|
5590
|
+
function isFileName(value) {
|
|
5591
|
+
if (!value || typeof value !== "string" || !value.trim()) return false;
|
|
5592
|
+
const ext = getFileExtension(value);
|
|
5593
|
+
return ext ? COMMON_FILE_EXTENSIONS.has(ext) : false;
|
|
5594
|
+
}
|
|
5595
|
+
|
|
5596
|
+
// src/components/GenUI/MarkdownViewer.tsx
|
|
5370
5597
|
import { jsx as jsx16, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
5371
5598
|
var useStyles = createStyles3(({ token, css }) => ({
|
|
5372
5599
|
container: css`
|
|
@@ -5519,6 +5746,15 @@ var MarkdownViewer = ({
|
|
|
5519
5746
|
message.error({ content: "Failed to generate PDF", key: "pdf" });
|
|
5520
5747
|
}
|
|
5521
5748
|
};
|
|
5749
|
+
const displayContent = React9.useMemo(() => {
|
|
5750
|
+
const lang = getLanguageFromFileName(fileName);
|
|
5751
|
+
if (lang && lang !== "markdown" && lang !== "text") {
|
|
5752
|
+
return `\`\`\`${lang}
|
|
5753
|
+
${content}
|
|
5754
|
+
\`\`\``;
|
|
5755
|
+
}
|
|
5756
|
+
return content;
|
|
5757
|
+
}, [content, fileName]);
|
|
5522
5758
|
return /* @__PURE__ */ jsxs8("div", { className: cx(styles.container, className), style, children: [
|
|
5523
5759
|
/* @__PURE__ */ jsxs8("div", { className: styles.header, children: [
|
|
5524
5760
|
/* @__PURE__ */ jsx16(Tooltip, { title: "Copy Content", children: /* @__PURE__ */ jsx16(
|
|
@@ -5558,125 +5794,12 @@ var MarkdownViewer = ({
|
|
|
5558
5794
|
}
|
|
5559
5795
|
) })
|
|
5560
5796
|
] }),
|
|
5561
|
-
/* @__PURE__ */ jsx16("div", { className: styles.contentBody, ref: contentRef, children: /* @__PURE__ */ jsx16(MDResponse, { content }) })
|
|
5797
|
+
/* @__PURE__ */ jsx16("div", { className: styles.contentBody, ref: contentRef, children: /* @__PURE__ */ jsx16(MDResponse, { content: displayContent }) })
|
|
5562
5798
|
] });
|
|
5563
5799
|
};
|
|
5564
5800
|
|
|
5565
5801
|
// src/components/GenUI/FileRenderer.tsx
|
|
5566
5802
|
import { FileImageOutlined, FilePdfOutlined as FilePdfOutlined2, FileTextOutlined, FileUnknownOutlined } from "@ant-design/icons";
|
|
5567
|
-
|
|
5568
|
-
// src/utils/fileUtils.ts
|
|
5569
|
-
function extractFileName(pathOrUrl) {
|
|
5570
|
-
if (!pathOrUrl) return "";
|
|
5571
|
-
const withoutQuery = pathOrUrl.split("?")[0];
|
|
5572
|
-
return withoutQuery.split("/").pop() || pathOrUrl;
|
|
5573
|
-
}
|
|
5574
|
-
function getFileExtension(pathOrUrl) {
|
|
5575
|
-
const fileName = extractFileName(pathOrUrl);
|
|
5576
|
-
if (!fileName) return "";
|
|
5577
|
-
const extension = fileName.split(".").pop()?.toLowerCase();
|
|
5578
|
-
return extension || "";
|
|
5579
|
-
}
|
|
5580
|
-
function getFileCategory(pathOrUrl) {
|
|
5581
|
-
const extension = getFileExtension(pathOrUrl);
|
|
5582
|
-
if (!extension) return "unknown";
|
|
5583
|
-
if (["md", "markdown", "mdx"].includes(extension)) return "markdown";
|
|
5584
|
-
if (["txt", "json", "csv", "xml", "yaml", "yml", "ini", "conf", "sh", "bat", "cmd"].includes(extension)) {
|
|
5585
|
-
return "text";
|
|
5586
|
-
}
|
|
5587
|
-
if (["jpg", "jpeg", "png", "gif", "svg", "bmp", "webp", "ico", "tiff", "tif"].includes(extension)) {
|
|
5588
|
-
return "image";
|
|
5589
|
-
}
|
|
5590
|
-
if (extension === "pdf") return "pdf";
|
|
5591
|
-
if (["mp3", "wav", "ogg", "flac", "aac", "m4a", "wma"].includes(extension)) return "audio";
|
|
5592
|
-
if (["mp4", "webm", "ogv", "mov", "avi", "mkv", "flv"].includes(extension)) return "video";
|
|
5593
|
-
if (["html", "htm"].includes(extension)) return "iframe";
|
|
5594
|
-
return "unknown";
|
|
5595
|
-
}
|
|
5596
|
-
function canPreviewInline(pathOrUrl) {
|
|
5597
|
-
const category = getFileCategory(pathOrUrl);
|
|
5598
|
-
return category !== "unknown";
|
|
5599
|
-
}
|
|
5600
|
-
function isTextFile(pathOrUrl) {
|
|
5601
|
-
const category = getFileCategory(pathOrUrl);
|
|
5602
|
-
return category === "markdown" || category === "text";
|
|
5603
|
-
}
|
|
5604
|
-
var COMMON_FILE_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
5605
|
-
// Code
|
|
5606
|
-
"ts",
|
|
5607
|
-
"tsx",
|
|
5608
|
-
"js",
|
|
5609
|
-
"jsx",
|
|
5610
|
-
"mjs",
|
|
5611
|
-
"cjs",
|
|
5612
|
-
"html",
|
|
5613
|
-
"htm",
|
|
5614
|
-
"css",
|
|
5615
|
-
"less",
|
|
5616
|
-
"scss",
|
|
5617
|
-
"md",
|
|
5618
|
-
"txt",
|
|
5619
|
-
"mdx",
|
|
5620
|
-
"json",
|
|
5621
|
-
"yaml",
|
|
5622
|
-
"yml",
|
|
5623
|
-
"py",
|
|
5624
|
-
"rb",
|
|
5625
|
-
"go",
|
|
5626
|
-
"rs",
|
|
5627
|
-
"java",
|
|
5628
|
-
"kt",
|
|
5629
|
-
"swift",
|
|
5630
|
-
"c",
|
|
5631
|
-
"cpp",
|
|
5632
|
-
"h",
|
|
5633
|
-
"hpp",
|
|
5634
|
-
"cs",
|
|
5635
|
-
"php",
|
|
5636
|
-
"vue",
|
|
5637
|
-
"svelte",
|
|
5638
|
-
"sql",
|
|
5639
|
-
"sh",
|
|
5640
|
-
"bash",
|
|
5641
|
-
"zsh",
|
|
5642
|
-
"toml",
|
|
5643
|
-
"xml",
|
|
5644
|
-
// Media
|
|
5645
|
-
"png",
|
|
5646
|
-
"jpg",
|
|
5647
|
-
"jpeg",
|
|
5648
|
-
"gif",
|
|
5649
|
-
"svg",
|
|
5650
|
-
"webp",
|
|
5651
|
-
"ico",
|
|
5652
|
-
"mp4",
|
|
5653
|
-
"webm",
|
|
5654
|
-
"mp3",
|
|
5655
|
-
"wav",
|
|
5656
|
-
"pdf",
|
|
5657
|
-
// Office
|
|
5658
|
-
"ppt",
|
|
5659
|
-
"pptx",
|
|
5660
|
-
"doc",
|
|
5661
|
-
"docx",
|
|
5662
|
-
"xls",
|
|
5663
|
-
"xlsx",
|
|
5664
|
-
"odt",
|
|
5665
|
-
"ods",
|
|
5666
|
-
"odp",
|
|
5667
|
-
"rtf",
|
|
5668
|
-
"csv",
|
|
5669
|
-
"key",
|
|
5670
|
-
"numbers",
|
|
5671
|
-
"pages"
|
|
5672
|
-
]);
|
|
5673
|
-
function isFileName(value) {
|
|
5674
|
-
if (!value || typeof value !== "string" || !value.trim()) return false;
|
|
5675
|
-
const ext = getFileExtension(value);
|
|
5676
|
-
return ext ? COMMON_FILE_EXTENSIONS.has(ext) : false;
|
|
5677
|
-
}
|
|
5678
|
-
|
|
5679
|
-
// src/components/GenUI/FileRenderer.tsx
|
|
5680
5803
|
import { jsx as jsx17, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
5681
5804
|
var useStyles2 = createStyles4(({ token, css }) => ({
|
|
5682
5805
|
container: css`
|
|
@@ -13735,7 +13858,7 @@ var MiddlewareSectionCard = ({ middleware, middlewareType, onToggle, onConfigCha
|
|
|
13735
13858
|
if (key === "serverKeys" && middleware.config.connectAll === true) {
|
|
13736
13859
|
return null;
|
|
13737
13860
|
}
|
|
13738
|
-
if (key === "
|
|
13861
|
+
if (key === "vmIsolation") {
|
|
13739
13862
|
return null;
|
|
13740
13863
|
}
|
|
13741
13864
|
return renderConfigField(
|
|
@@ -18163,7 +18286,7 @@ var WorkspaceContextProvider = ({
|
|
|
18163
18286
|
);
|
|
18164
18287
|
const listPathByFolder = useCallback24(
|
|
18165
18288
|
async (folder) => {
|
|
18166
|
-
const normalizedPath = folder.startsWith("/") ? folder : `/${folder}`;
|
|
18289
|
+
const normalizedPath = folder.startsWith("/") || folder.startsWith("~/") ? folder : `/${folder}`;
|
|
18167
18290
|
return listPath(normalizedPath);
|
|
18168
18291
|
},
|
|
18169
18292
|
[listPath]
|
|
@@ -18190,8 +18313,7 @@ var WorkspaceContextProvider = ({
|
|
|
18190
18313
|
);
|
|
18191
18314
|
const uploadFileToFolder = useCallback24(
|
|
18192
18315
|
async (folder, file) => {
|
|
18193
|
-
|
|
18194
|
-
return uploadFile(normalizedPath, file);
|
|
18316
|
+
return uploadFile(folder, file);
|
|
18195
18317
|
},
|
|
18196
18318
|
[uploadFile]
|
|
18197
18319
|
);
|
|
@@ -26705,7 +26827,9 @@ var useStyles18 = createStyles31(({ token, css }) => ({
|
|
|
26705
26827
|
gap: 8px;
|
|
26706
26828
|
`
|
|
26707
26829
|
}));
|
|
26708
|
-
var ProjectSelector = (
|
|
26830
|
+
var ProjectSelector = ({
|
|
26831
|
+
disableDropdown = true
|
|
26832
|
+
}) => {
|
|
26709
26833
|
const { styles } = useStyles18();
|
|
26710
26834
|
const {
|
|
26711
26835
|
workspaceId,
|
|
@@ -26816,12 +26940,20 @@ var ProjectSelector = () => {
|
|
|
26816
26940
|
}
|
|
26817
26941
|
) }),
|
|
26818
26942
|
/* @__PURE__ */ jsx104("span", { className: styles.divider, children: "/" }),
|
|
26819
|
-
/* @__PURE__ */ jsxs75(
|
|
26820
|
-
|
|
26821
|
-
|
|
26822
|
-
|
|
26823
|
-
|
|
26824
|
-
|
|
26943
|
+
/* @__PURE__ */ jsxs75(
|
|
26944
|
+
"div",
|
|
26945
|
+
{
|
|
26946
|
+
className: styles.projectTrigger,
|
|
26947
|
+
onClick: disableDropdown ? void 0 : toggleProjectList,
|
|
26948
|
+
style: { cursor: disableDropdown ? "default" : "pointer" },
|
|
26949
|
+
children: [
|
|
26950
|
+
/* @__PURE__ */ jsx104("div", { className: styles.projectTriggerIcon, children: /* @__PURE__ */ jsx104(Folder, { size: 16 }) }),
|
|
26951
|
+
/* @__PURE__ */ jsx104("div", { className: styles.projectTriggerInfo, children: /* @__PURE__ */ jsx104("div", { className: styles.projectTriggerName, children: currentProject?.name || "Select Project" }) }),
|
|
26952
|
+
!disableDropdown && /* @__PURE__ */ jsx104("div", { className: `${styles.projectTriggerArrow} ${isProjectListOpen ? "expanded" : ""}`, children: /* @__PURE__ */ jsx104(ChevronDown4, { size: 14 }) })
|
|
26953
|
+
]
|
|
26954
|
+
}
|
|
26955
|
+
),
|
|
26956
|
+
!disableDropdown && isProjectListOpen && /* @__PURE__ */ jsxs75("div", { className: styles.projectDropdown, children: [
|
|
26825
26957
|
projects.map((project) => /* @__PURE__ */ jsxs75(
|
|
26826
26958
|
"div",
|
|
26827
26959
|
{
|
|
@@ -26894,6 +27026,8 @@ import { createStyles as createStyles32 } from "antd-style";
|
|
|
26894
27026
|
import { Fragment as Fragment22, jsx as jsx105, jsxs as jsxs76 } from "react/jsx-runtime";
|
|
26895
27027
|
var useStyles19 = createStyles32(({ token, css }) => ({
|
|
26896
27028
|
container: css`
|
|
27029
|
+
height: 100%;
|
|
27030
|
+
overflow-y: auto;
|
|
26897
27031
|
padding: 12px;
|
|
26898
27032
|
font-size: 13px;
|
|
26899
27033
|
background: transparent;
|
|
@@ -27248,42 +27382,46 @@ var ToolPanelFiles = () => {
|
|
|
27248
27382
|
const resourceFolders = useMemo27(() => {
|
|
27249
27383
|
return config.resourceFolders && config.resourceFolders.length > 0 ? config.resourceFolders : [{ name: "/", displayName: "Project Assets", allowUpload: true }];
|
|
27250
27384
|
}, [config.resourceFolders]);
|
|
27251
|
-
const loadAssetsForFolder = useCallback32(
|
|
27252
|
-
|
|
27253
|
-
|
|
27254
|
-
|
|
27255
|
-
|
|
27256
|
-
|
|
27257
|
-
|
|
27258
|
-
|
|
27259
|
-
|
|
27260
|
-
|
|
27261
|
-
|
|
27262
|
-
|
|
27263
|
-
|
|
27264
|
-
|
|
27265
|
-
|
|
27266
|
-
|
|
27267
|
-
|
|
27268
|
-
|
|
27269
|
-
|
|
27270
|
-
|
|
27271
|
-
|
|
27272
|
-
|
|
27273
|
-
|
|
27274
|
-
|
|
27275
|
-
|
|
27276
|
-
|
|
27277
|
-
|
|
27278
|
-
|
|
27279
|
-
|
|
27280
|
-
|
|
27281
|
-
|
|
27282
|
-
|
|
27283
|
-
|
|
27284
|
-
|
|
27285
|
-
|
|
27286
|
-
|
|
27385
|
+
const loadAssetsForFolder = useCallback32(
|
|
27386
|
+
async (folder, clearSubdirectoryCache = true) => {
|
|
27387
|
+
if (!workspaceId || !projectId) {
|
|
27388
|
+
setFolderEntries((prev) => ({ ...prev, [folder.name]: [] }));
|
|
27389
|
+
return;
|
|
27390
|
+
}
|
|
27391
|
+
setFolderLoading((prev) => ({ ...prev, [folder.name]: true }));
|
|
27392
|
+
try {
|
|
27393
|
+
const items = await listPathByFolder(folder.name);
|
|
27394
|
+
setFolderEntries((prev) => ({ ...prev, [folder.name]: items }));
|
|
27395
|
+
if (clearSubdirectoryCache) {
|
|
27396
|
+
const folderPath = folder.name === "/" ? "/" : folder.name.replace(/\/$/, "");
|
|
27397
|
+
setDirectoryChildren((prev) => {
|
|
27398
|
+
const next = { ...prev };
|
|
27399
|
+
Object.keys(next).forEach((key) => {
|
|
27400
|
+
if (key === folderPath || key.startsWith(`${folderPath}/`)) {
|
|
27401
|
+
delete next[key];
|
|
27402
|
+
}
|
|
27403
|
+
});
|
|
27404
|
+
return next;
|
|
27405
|
+
});
|
|
27406
|
+
setDirectoryExpanded((prev) => {
|
|
27407
|
+
const next = { ...prev };
|
|
27408
|
+
Object.keys(next).forEach((key) => {
|
|
27409
|
+
if (key === folderPath || key.startsWith(`${folderPath}/`)) {
|
|
27410
|
+
delete next[key];
|
|
27411
|
+
}
|
|
27412
|
+
});
|
|
27413
|
+
return next;
|
|
27414
|
+
});
|
|
27415
|
+
}
|
|
27416
|
+
} catch (error) {
|
|
27417
|
+
console.error(`Failed to load assets for folder ${folder.name}:`, error);
|
|
27418
|
+
setFolderEntries((prev) => ({ ...prev, [folder.name]: [] }));
|
|
27419
|
+
} finally {
|
|
27420
|
+
setFolderLoading((prev) => ({ ...prev, [folder.name]: false }));
|
|
27421
|
+
}
|
|
27422
|
+
},
|
|
27423
|
+
[workspaceId, projectId, listPathByFolder]
|
|
27424
|
+
);
|
|
27287
27425
|
const handleToggleDirectory = useCallback32(async (path) => {
|
|
27288
27426
|
const isExpanded = directoryExpanded[path] || false;
|
|
27289
27427
|
if (isExpanded) {
|
|
@@ -27291,9 +27429,6 @@ var ToolPanelFiles = () => {
|
|
|
27291
27429
|
return;
|
|
27292
27430
|
}
|
|
27293
27431
|
setDirectoryExpanded((prev) => ({ ...prev, [path]: true }));
|
|
27294
|
-
if (directoryChildren[path]) {
|
|
27295
|
-
return;
|
|
27296
|
-
}
|
|
27297
27432
|
setDirectoryLoading((prev) => ({ ...prev, [path]: true }));
|
|
27298
27433
|
try {
|
|
27299
27434
|
const items = await listPath(path);
|
|
@@ -27304,10 +27439,10 @@ var ToolPanelFiles = () => {
|
|
|
27304
27439
|
} finally {
|
|
27305
27440
|
setDirectoryLoading((prev) => ({ ...prev, [path]: false }));
|
|
27306
27441
|
}
|
|
27307
|
-
}, [
|
|
27442
|
+
}, [directoryExpanded, listPath]);
|
|
27308
27443
|
useEffect40(() => {
|
|
27309
27444
|
resourceFolders.forEach((folder) => {
|
|
27310
|
-
void loadAssetsForFolder(folder);
|
|
27445
|
+
void loadAssetsForFolder(folder, false);
|
|
27311
27446
|
});
|
|
27312
27447
|
}, [resourceFolders, loadAssetsForFolder]);
|
|
27313
27448
|
const handleAssetClick = useCallback32((asset) => {
|