@blade-hq/agent-kit 0.4.21 → 0.4.23
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/{SkillStatusBar-DCOlTYcT.d.ts → SkillStatusBar-B7-EU8A4.d.ts} +1 -1
- package/dist/{blade-client-BEjbedNc.d.ts → blade-client-BKiP6U73.d.ts} +6 -1
- package/dist/{chunk-RMLZ4ZBY.js → chunk-LKOBHTL7.js} +19 -1
- package/dist/chunk-LKOBHTL7.js.map +1 -0
- package/dist/client/index.d.ts +24 -5
- package/dist/react/api/vibe-coding.d.ts +2 -2
- package/dist/react/components/chat/index.d.ts +3 -3
- package/dist/react/components/chat/index.js +1 -1
- package/dist/react/components/workspace/index.js +244 -131
- package/dist/react/components/workspace/index.js.map +1 -1
- package/dist/react/index.d.ts +4 -4
- package/dist/react/index.js +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/dist/chunk-RMLZ4ZBY.js.map +0 -1
package/dist/client/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as ApiKeyCreateResponse, g as ApiKeyPublic, h as ApiKeysResource, i as AuthResource, B as BladeApiError, j as BladeClient, k as BladeClientOptions, l as BladeFetchInit, m as BladeHubScenarioResource, n as ChatEndPayload, o as ChatSendPayload, p as CheckpointNode, q as ClientToServerEvents, r as CodingTask, s as CodingTaskTopic, t as ComputerUpgradeReason, u as ComputerUpgradeStatusResponse, v as ContentPart, w as CreateQuickScenarioPayload, x as CreateSessionRequest, y as CreateSocketOptions, z as CreateSoftwareFactorySharedFilePayload, E as CreateSoftwareFactorySoftwarePayload, f as CreateVibeCodingSessionParams, C as CreateVibeCodingSessionResult, D as DeployBumpMode, F as FileEntry, G as GisResource, H as GlobalSkillStats, I as HeadlessError, J as HeadlessResource, K as HeadlessRunOptions, L as HistoryNode, M as HttpMethod, N as ImportPreview, O as ImportPreviewScenario, Q as ImportPreviewSkill, R as InstalledRegistrySkill, S as JsonSchemaObject, T as MemoriesResource, U as Memory, W as MemoryCreateBody, X as MemoryListParams, Y as MemoryListResponse, Z as ModelOption, _ as ModelsConfig, $ as ModelsResource, a0 as PaginatedSessionsResult, P as PortMapping, a1 as PreviewUrlItem, a2 as ProvidersResponse, a3 as PublishedAppsResource, a4 as QuickScenario, a5 as REGISTRY_PREFIX, a6 as RegistryResource, a7 as ResourceApi, a8 as ScenariosResource, a9 as ServerToClientEvents, aa as SessionContextStats, ab as SessionHistory, ac as SessionUpdatedPayload, ad as SessionsResource, ae as ShareLinkResult, af as SkillDevSession, ag as SkillOrgListResponse, ah as SkillOrgOption, ai as SkillsResource, aj as SoftwareFactoryModuleBlueprint, ak as SoftwareFactoryResource, al as SoftwareFactorySharedFile, am as SoftwareFactorySoftware, an as SoftwareFactoryTopic, ao as SoftwareFactoryTopicModule, ap as SolutionsResource, aq as SystemErrorPayload, ar as SystemNotificationPayload, as as TokenizeResult, at as TurnProjectionPayload, au as TypedSocket, av as UpdateQuickScenarioPayload, aw as UpgradeComputerResponse, ax as UploadFileEntry, ay as UserInfo, az as UserPreferencesResource, b as VibeCodingDebugSessionStatus, d as VibeCodingDeployRecord, a as VibeCodingDeployStatus, V as VibeCodingResource, e as VibeCodingSessionInfo, c as VibeCodingSessionStatus, aA as createSocket, aB as normalizeResource } from '../blade-client-
|
|
1
|
+
export { A as ApiKeyCreateResponse, g as ApiKeyPublic, h as ApiKeysResource, i as AuthResource, B as BladeApiError, j as BladeClient, k as BladeClientOptions, l as BladeFetchInit, m as BladeHubScenarioResource, n as ChatEndPayload, o as ChatSendPayload, p as CheckpointNode, q as ClientToServerEvents, r as CodingTask, s as CodingTaskTopic, t as ComputerUpgradeReason, u as ComputerUpgradeStatusResponse, v as ContentPart, w as CreateQuickScenarioPayload, x as CreateSessionRequest, y as CreateSocketOptions, z as CreateSoftwareFactorySharedFilePayload, E as CreateSoftwareFactorySoftwarePayload, f as CreateVibeCodingSessionParams, C as CreateVibeCodingSessionResult, D as DeployBumpMode, F as FileEntry, G as GisResource, H as GlobalSkillStats, I as HeadlessError, J as HeadlessResource, K as HeadlessRunOptions, L as HistoryNode, M as HttpMethod, N as ImportPreview, O as ImportPreviewScenario, Q as ImportPreviewSkill, R as InstalledRegistrySkill, S as JsonSchemaObject, T as MemoriesResource, U as Memory, W as MemoryCreateBody, X as MemoryListParams, Y as MemoryListResponse, Z as ModelOption, _ as ModelsConfig, $ as ModelsResource, a0 as PaginatedSessionsResult, P as PortMapping, a1 as PreviewUrlItem, a2 as ProvidersResponse, a3 as PublishedAppsResource, a4 as QuickScenario, a5 as REGISTRY_PREFIX, a6 as RegistryResource, a7 as ResourceApi, a8 as ScenariosResource, a9 as ServerToClientEvents, aa as SessionContextStats, ab as SessionHistory, ac as SessionUpdatedPayload, ad as SessionsResource, ae as ShareLinkResult, af as SkillDevSession, ag as SkillOrgListResponse, ah as SkillOrgOption, ai as SkillsResource, aj as SoftwareFactoryModuleBlueprint, ak as SoftwareFactoryResource, al as SoftwareFactorySharedFile, am as SoftwareFactorySoftware, an as SoftwareFactoryTopic, ao as SoftwareFactoryTopicModule, ap as SolutionsResource, aq as SystemErrorPayload, ar as SystemNotificationPayload, as as TokenizeResult, at as TurnProjectionPayload, au as TypedSocket, av as UpdateQuickScenarioPayload, aw as UpgradeComputerResponse, ax as UploadFileEntry, ay as UserInfo, az as UserPreferencesResource, b as VibeCodingDebugSessionStatus, d as VibeCodingDeployRecord, a as VibeCodingDeployStatus, V as VibeCodingResource, e as VibeCodingSessionInfo, c as VibeCodingSessionStatus, aA as createSocket, aB as normalizeResource } from '../blade-client-BKiP6U73.js';
|
|
2
2
|
import 'arktype/internal/variants/object.ts';
|
|
3
3
|
import 'arktype/internal/variants/string.ts';
|
|
4
4
|
import '../projection-DIfyh6RK.js';
|
|
@@ -6093,7 +6093,9 @@ interface operations {
|
|
|
6093
6093
|
};
|
|
6094
6094
|
list_background_tasks_api_sessions__session_id__background_tasks_get: {
|
|
6095
6095
|
parameters: {
|
|
6096
|
-
query?:
|
|
6096
|
+
query?: {
|
|
6097
|
+
debug?: boolean;
|
|
6098
|
+
};
|
|
6097
6099
|
header?: never;
|
|
6098
6100
|
path: {
|
|
6099
6101
|
session_id: string;
|
|
@@ -6188,6 +6190,7 @@ interface operations {
|
|
|
6188
6190
|
parameters: {
|
|
6189
6191
|
query?: {
|
|
6190
6192
|
tail?: number;
|
|
6193
|
+
debug?: boolean;
|
|
6191
6194
|
};
|
|
6192
6195
|
header?: never;
|
|
6193
6196
|
path: {
|
|
@@ -6220,7 +6223,9 @@ interface operations {
|
|
|
6220
6223
|
};
|
|
6221
6224
|
stop_background_task_api_sessions__session_id__background_tasks__task_id__stop_post: {
|
|
6222
6225
|
parameters: {
|
|
6223
|
-
query?:
|
|
6226
|
+
query?: {
|
|
6227
|
+
debug?: boolean;
|
|
6228
|
+
};
|
|
6224
6229
|
header?: never;
|
|
6225
6230
|
path: {
|
|
6226
6231
|
session_id: string;
|
|
@@ -10949,6 +10954,10 @@ interface operations {
|
|
|
10949
10954
|
query?: {
|
|
10950
10955
|
type?: string | null;
|
|
10951
10956
|
subtype?: string | null;
|
|
10957
|
+
/** @description 可选过滤;目前只接受 'me',返回调用者自己拥有的 resource。 */
|
|
10958
|
+
owner?: string | null;
|
|
10959
|
+
/** @description 返回 secret 明文(仅 caller 是 owner 时生效);CLI / 前端要 secret 才透传。 */
|
|
10960
|
+
reveal?: boolean;
|
|
10952
10961
|
limit?: number;
|
|
10953
10962
|
offset?: number;
|
|
10954
10963
|
};
|
|
@@ -10983,6 +10992,10 @@ interface operations {
|
|
|
10983
10992
|
query?: {
|
|
10984
10993
|
type?: string | null;
|
|
10985
10994
|
subtype?: string | null;
|
|
10995
|
+
/** @description 可选过滤;目前只接受 'me',返回调用者自己拥有的 resource。 */
|
|
10996
|
+
owner?: string | null;
|
|
10997
|
+
/** @description 返回 secret 明文(仅 caller 是 owner 时生效);CLI / 前端要 secret 才透传。 */
|
|
10998
|
+
reveal?: boolean;
|
|
10986
10999
|
limit?: number;
|
|
10987
11000
|
offset?: number;
|
|
10988
11001
|
};
|
|
@@ -11014,7 +11027,10 @@ interface operations {
|
|
|
11014
11027
|
};
|
|
11015
11028
|
get_resource_api_registry_resources__resource_id__get: {
|
|
11016
11029
|
parameters: {
|
|
11017
|
-
query?:
|
|
11030
|
+
query?: {
|
|
11031
|
+
/** @description 返回 secret 明文(仅 caller 是 owner 时生效)。 */
|
|
11032
|
+
reveal?: boolean;
|
|
11033
|
+
};
|
|
11018
11034
|
header?: never;
|
|
11019
11035
|
path: {
|
|
11020
11036
|
resource_id: string;
|
|
@@ -11045,7 +11061,10 @@ interface operations {
|
|
|
11045
11061
|
};
|
|
11046
11062
|
get_resource_api_registry_resources__resource_id__get_2: {
|
|
11047
11063
|
parameters: {
|
|
11048
|
-
query?:
|
|
11064
|
+
query?: {
|
|
11065
|
+
/** @description 返回 secret 明文(仅 caller 是 owner 时生效)。 */
|
|
11066
|
+
reveal?: boolean;
|
|
11067
|
+
};
|
|
11049
11068
|
header?: never;
|
|
11050
11069
|
path: {
|
|
11051
11070
|
resource_id: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { V as VibeCodingResource, C as CreateVibeCodingSessionResult, a as VibeCodingDeployStatus, b as VibeCodingDebugSessionStatus, c as VibeCodingSessionStatus, d as VibeCodingDeployRecord, e as VibeCodingSessionInfo } from '../../blade-client-
|
|
2
|
-
export { f as CreateVibeCodingSessionParams, D as DeployBumpMode, P as PortMapping } from '../../blade-client-
|
|
1
|
+
import { V as VibeCodingResource, C as CreateVibeCodingSessionResult, a as VibeCodingDeployStatus, b as VibeCodingDebugSessionStatus, c as VibeCodingSessionStatus, d as VibeCodingDeployRecord, e as VibeCodingSessionInfo } from '../../blade-client-BKiP6U73.js';
|
|
2
|
+
export { f as CreateVibeCodingSessionParams, D as DeployBumpMode, P as PortMapping } from '../../blade-client-BKiP6U73.js';
|
|
3
3
|
import 'arktype/internal/variants/object.ts';
|
|
4
4
|
import 'arktype/internal/variants/string.ts';
|
|
5
5
|
import '../../projection-DIfyh6RK.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as ChatViewCustomization, P as ParsedWhatIfPrompt } from '../../../SkillStatusBar-
|
|
2
|
-
export { A as AssistantTurnComponentProps, a as ChatInput, b as ChatView, c as ChatViewClassNames, d as ChatViewComponents, e as ChatViewProps, f as ChatViewRenderers, E as ErrorMessageBlock, F as FileComposerAttachment, g as FileSizeLimitDialog, M as MessageList, S as SkillStatusBar, h as SkillStatusBarComponentProps, T as ToolCallComponentProps, i as ToolRendererProps, U as UserMessageBubble, j as isErrorMessage, k as isUserMessage } from '../../../SkillStatusBar-
|
|
1
|
+
import { C as ChatViewCustomization, P as ParsedWhatIfPrompt } from '../../../SkillStatusBar-B7-EU8A4.js';
|
|
2
|
+
export { A as AssistantTurnComponentProps, a as ChatInput, b as ChatView, c as ChatViewClassNames, d as ChatViewComponents, e as ChatViewProps, f as ChatViewRenderers, E as ErrorMessageBlock, F as FileComposerAttachment, g as FileSizeLimitDialog, M as MessageList, S as SkillStatusBar, h as SkillStatusBarComponentProps, T as ToolCallComponentProps, i as ToolRendererProps, U as UserMessageBubble, j as isErrorMessage, k as isUserMessage } from '../../../SkillStatusBar-B7-EU8A4.js';
|
|
3
3
|
import * as react from 'react';
|
|
4
4
|
import { ReactNode } from 'react';
|
|
5
5
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
@@ -10,7 +10,7 @@ import 'zustand';
|
|
|
10
10
|
import '../../../session-nZdIuWrS.js';
|
|
11
11
|
import 'arktype/internal/variants/object.ts';
|
|
12
12
|
import 'arktype/internal/variants/string.ts';
|
|
13
|
-
import '../../../blade-client-
|
|
13
|
+
import '../../../blade-client-BKiP6U73.js';
|
|
14
14
|
import 'socket.io-client';
|
|
15
15
|
|
|
16
16
|
/**
|
|
@@ -277,7 +277,7 @@ var GENERIC_FILE_ICON_ASSET = new URL("../../assets/file-icons/generic-file.png"
|
|
|
277
277
|
// src/react/components/workspace/FileTree.tsx
|
|
278
278
|
import { Fragment as Fragment2, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
279
279
|
var ROOT_PATH = ".";
|
|
280
|
-
var TREE_ROW_CLASS = "group flex w-full items-center gap-1 rounded px-2 py-1 text-left transition-colors hover:bg-muted/50";
|
|
280
|
+
var TREE_ROW_CLASS = "group flex w-full items-center gap-1.5 rounded-md px-2 py-1.5 text-left transition-colors hover:bg-muted/50";
|
|
281
281
|
function FileTree2({
|
|
282
282
|
sessionId,
|
|
283
283
|
checkActiveSession = true,
|
|
@@ -549,7 +549,7 @@ function FolderNode({
|
|
|
549
549
|
ChevronRight,
|
|
550
550
|
{
|
|
551
551
|
className: cn(
|
|
552
|
-
"size-
|
|
552
|
+
"size-5 shrink-0 text-[hsl(var(--muted-foreground))] transition-transform",
|
|
553
553
|
isExpanded && "rotate-90"
|
|
554
554
|
)
|
|
555
555
|
}
|
|
@@ -773,120 +773,131 @@ function FileNode({
|
|
|
773
773
|
setActiveAction(null);
|
|
774
774
|
}
|
|
775
775
|
};
|
|
776
|
-
return /* @__PURE__ */ jsxs2(
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
{
|
|
782
|
-
ref:
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
776
|
+
return /* @__PURE__ */ jsxs2(
|
|
777
|
+
"div",
|
|
778
|
+
{
|
|
779
|
+
className: cn(TREE_ROW_CLASS, isSelected && "bg-muted"),
|
|
780
|
+
draggable: !isRenaming,
|
|
781
|
+
onDragStart: (e) => {
|
|
782
|
+
e.dataTransfer.setData("application/blade-file-ref", JSON.stringify({ path: entry.path, name: entry.name }));
|
|
783
|
+
e.dataTransfer.effectAllowed = "copy";
|
|
784
|
+
},
|
|
785
|
+
children: [
|
|
786
|
+
/* @__PURE__ */ jsx2("span", { className: "size-5 shrink-0" }),
|
|
787
|
+
/* @__PURE__ */ jsx2(FileTreeIcon, { children: getFileIcon(entry.name) }),
|
|
788
|
+
isRenaming ? /* @__PURE__ */ jsx2(
|
|
789
|
+
"input",
|
|
790
|
+
{
|
|
791
|
+
ref: renameInputRef,
|
|
792
|
+
value: renamingValue,
|
|
793
|
+
className: "h-6 min-w-0 flex-1 rounded border border-[hsl(var(--border))] bg-background px-2 text-xs outline-none ring-offset-background focus-visible:ring-1 focus-visible:ring-[hsl(var(--ring))]",
|
|
794
|
+
disabled: activeAction === "rename",
|
|
795
|
+
onBlur: () => void finishRename(),
|
|
796
|
+
onChange: (event) => setRenamingValue(event.target.value),
|
|
797
|
+
onClick: (event) => event.stopPropagation(),
|
|
798
|
+
onKeyDown: (event) => {
|
|
799
|
+
event.stopPropagation();
|
|
800
|
+
if (event.key === "Enter") {
|
|
801
|
+
event.preventDefault();
|
|
802
|
+
void finishRename();
|
|
803
|
+
} else if (event.key === "Escape") {
|
|
804
|
+
event.preventDefault();
|
|
805
|
+
cancelRename();
|
|
806
|
+
}
|
|
807
|
+
}
|
|
797
808
|
}
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
title: "\u4E0B\u8F7D\u6587\u4EF6",
|
|
826
|
-
children: /* @__PURE__ */ jsx2(Download, { size: 12 })
|
|
827
|
-
}
|
|
828
|
-
),
|
|
829
|
-
/* @__PURE__ */ jsx2(
|
|
830
|
-
TreeActionButton,
|
|
831
|
-
{
|
|
832
|
-
disabled: activeAction !== null,
|
|
833
|
-
onClick: () => {
|
|
834
|
-
onSelectPath(entry.path);
|
|
835
|
-
setRenamingValue(entry.name);
|
|
836
|
-
setIsRenaming(true);
|
|
837
|
-
},
|
|
838
|
-
title: "\u91CD\u547D\u540D",
|
|
839
|
-
children: activeAction === "rename" ? /* @__PURE__ */ jsx2(Loader2, { size: 12, className: "animate-spin" }) : /* @__PURE__ */ jsx2(Pencil, { size: 12 })
|
|
840
|
-
}
|
|
841
|
-
),
|
|
842
|
-
/* @__PURE__ */ jsx2(
|
|
843
|
-
TreeActionButton,
|
|
844
|
-
{
|
|
845
|
-
disabled: activeAction !== null,
|
|
846
|
-
onClick: () => void handleCopy(),
|
|
847
|
-
title: "\u590D\u5236\u6587\u4EF6",
|
|
848
|
-
children: activeAction === "copy" ? /* @__PURE__ */ jsx2(Loader2, { size: 12, className: "animate-spin" }) : /* @__PURE__ */ jsx2(Copy, { size: 12 })
|
|
849
|
-
}
|
|
850
|
-
),
|
|
851
|
-
/* @__PURE__ */ jsx2(
|
|
852
|
-
TreeActionButton,
|
|
853
|
-
{
|
|
854
|
-
disabled: activeAction !== null || !onShareFile,
|
|
855
|
-
onClick: async () => {
|
|
856
|
-
if (!onShareFile) return;
|
|
857
|
-
setActiveAction("share");
|
|
858
|
-
try {
|
|
859
|
-
await onShareFile(entry.path, entry.name);
|
|
860
|
-
await queryClient.invalidateQueries({ queryKey: ["file-tree", sessionId] });
|
|
861
|
-
} catch (error) {
|
|
862
|
-
alert(getErrorMessage(error, "\u5171\u4EAB\u5931\u8D25"));
|
|
863
|
-
} finally {
|
|
864
|
-
setActiveAction(null);
|
|
809
|
+
) : /* @__PURE__ */ jsxs2(
|
|
810
|
+
"button",
|
|
811
|
+
{
|
|
812
|
+
type: "button",
|
|
813
|
+
className: "flex min-w-0 flex-1 cursor-pointer items-center border-none bg-transparent p-0 text-left",
|
|
814
|
+
onClick: () => {
|
|
815
|
+
onSelectPath(entry.path);
|
|
816
|
+
void onOpenFile(entry.path, entry.name);
|
|
817
|
+
},
|
|
818
|
+
children: [
|
|
819
|
+
/* @__PURE__ */ jsx2(FileTreeName, { className: "min-w-0 flex-1", children: entry.name }),
|
|
820
|
+
/* @__PURE__ */ jsx2(FileTagList, { tags: entry.tags })
|
|
821
|
+
]
|
|
822
|
+
}
|
|
823
|
+
),
|
|
824
|
+
isOpening ? /* @__PURE__ */ jsx2(Loader2, { size: 12, className: "ml-auto shrink-0 animate-spin text-[hsl(var(--muted-foreground))]" }) : !readOnly ? /* @__PURE__ */ jsxs2(FileTreeActions, { className: "ml-auto hidden shrink-0 group-hover:flex", children: [
|
|
825
|
+
/* @__PURE__ */ jsx2(
|
|
826
|
+
TreeActionButton,
|
|
827
|
+
{
|
|
828
|
+
onClick: () => {
|
|
829
|
+
const anchor = document.createElement("a");
|
|
830
|
+
anchor.href = downloadUrl;
|
|
831
|
+
anchor.download = entry.name;
|
|
832
|
+
anchor.click();
|
|
833
|
+
},
|
|
834
|
+
title: "\u4E0B\u8F7D\u6587\u4EF6",
|
|
835
|
+
children: /* @__PURE__ */ jsx2(Download, { size: 12 })
|
|
865
836
|
}
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
837
|
+
),
|
|
838
|
+
/* @__PURE__ */ jsx2(
|
|
839
|
+
TreeActionButton,
|
|
840
|
+
{
|
|
841
|
+
disabled: activeAction !== null,
|
|
842
|
+
onClick: () => {
|
|
843
|
+
onSelectPath(entry.path);
|
|
844
|
+
setRenamingValue(entry.name);
|
|
845
|
+
setIsRenaming(true);
|
|
846
|
+
},
|
|
847
|
+
title: "\u91CD\u547D\u540D",
|
|
848
|
+
children: activeAction === "rename" ? /* @__PURE__ */ jsx2(Loader2, { size: 12, className: "animate-spin" }) : /* @__PURE__ */ jsx2(Pencil, { size: 12 })
|
|
849
|
+
}
|
|
850
|
+
),
|
|
851
|
+
/* @__PURE__ */ jsx2(
|
|
852
|
+
TreeActionButton,
|
|
853
|
+
{
|
|
854
|
+
disabled: activeAction !== null,
|
|
855
|
+
onClick: () => void handleCopy(),
|
|
856
|
+
title: "\u590D\u5236\u6587\u4EF6",
|
|
857
|
+
children: activeAction === "copy" ? /* @__PURE__ */ jsx2(Loader2, { size: 12, className: "animate-spin" }) : /* @__PURE__ */ jsx2(Copy, { size: 12 })
|
|
858
|
+
}
|
|
859
|
+
),
|
|
860
|
+
/* @__PURE__ */ jsx2(
|
|
861
|
+
TreeActionButton,
|
|
862
|
+
{
|
|
863
|
+
disabled: activeAction !== null || !onShareFile,
|
|
864
|
+
onClick: async () => {
|
|
865
|
+
if (!onShareFile) return;
|
|
866
|
+
setActiveAction("share");
|
|
867
|
+
try {
|
|
868
|
+
await onShareFile(entry.path, entry.name);
|
|
869
|
+
await queryClient.invalidateQueries({ queryKey: ["file-tree", sessionId] });
|
|
870
|
+
} catch (error) {
|
|
871
|
+
alert(getErrorMessage(error, "\u5171\u4EAB\u5931\u8D25"));
|
|
872
|
+
} finally {
|
|
873
|
+
setActiveAction(null);
|
|
874
|
+
}
|
|
875
|
+
},
|
|
876
|
+
title: "\u5171\u4EAB\u5230 .share",
|
|
877
|
+
children: activeAction === "share" ? /* @__PURE__ */ jsx2(Loader2, { size: 12, className: "animate-spin" }) : /* @__PURE__ */ jsx2(Link2, { size: 12 })
|
|
878
|
+
}
|
|
879
|
+
),
|
|
880
|
+
/* @__PURE__ */ jsx2(
|
|
881
|
+
TreeActionButton,
|
|
882
|
+
{
|
|
883
|
+
disabled: activeAction !== null,
|
|
884
|
+
onClick: () => void handleDelete(),
|
|
885
|
+
title: "\u5220\u9664\u6587\u4EF6",
|
|
886
|
+
children: activeAction === "delete" ? /* @__PURE__ */ jsx2(Loader2, { size: 12, className: "animate-spin" }) : /* @__PURE__ */ jsx2(Trash2, { size: 12 })
|
|
887
|
+
}
|
|
888
|
+
)
|
|
889
|
+
] }) : allowDelete ? /* @__PURE__ */ jsx2(FileTreeActions, { className: "ml-auto hidden shrink-0 group-hover:flex", children: /* @__PURE__ */ jsx2(
|
|
890
|
+
TreeActionButton,
|
|
891
|
+
{
|
|
892
|
+
disabled: activeAction !== null,
|
|
893
|
+
onClick: () => void handleDelete(),
|
|
894
|
+
title: "\u5220\u9664\u6587\u4EF6",
|
|
895
|
+
children: activeAction === "delete" ? /* @__PURE__ */ jsx2(Loader2, { size: 12, className: "animate-spin" }) : /* @__PURE__ */ jsx2(Trash2, { size: 12 })
|
|
896
|
+
}
|
|
897
|
+
) }) : null
|
|
898
|
+
]
|
|
899
|
+
}
|
|
900
|
+
);
|
|
890
901
|
}
|
|
891
902
|
function LazyDirChildren({
|
|
892
903
|
dirPath,
|
|
@@ -961,12 +972,18 @@ function LazyDirChildren({
|
|
|
961
972
|
)
|
|
962
973
|
) });
|
|
963
974
|
}
|
|
975
|
+
var TAG_STYLES = {
|
|
976
|
+
"AI \u751F\u6210": "border-purple-500/30 bg-purple-500/10 text-purple-400",
|
|
977
|
+
"\u7528\u6237\u4E0A\u4F20": "border-blue-500/30 bg-blue-500/10 text-blue-400",
|
|
978
|
+
\u4EA7\u7269: "border-amber-500/30 bg-amber-500/10 text-amber-400"
|
|
979
|
+
};
|
|
980
|
+
var DEFAULT_TAG_STYLE = "border-[hsl(var(--border))] bg-[hsl(var(--muted))] text-[hsl(var(--muted-foreground))]";
|
|
964
981
|
function FileTagList({ tags }) {
|
|
965
982
|
if (!tags || tags.length === 0) return null;
|
|
966
|
-
return /* @__PURE__ */ jsx2("span", { className: "ml-
|
|
983
|
+
return /* @__PURE__ */ jsx2("span", { className: "ml-1 flex min-w-0 shrink-0 items-center gap-1", children: tags.map((tag) => /* @__PURE__ */ jsx2(
|
|
967
984
|
"span",
|
|
968
985
|
{
|
|
969
|
-
className:
|
|
986
|
+
className: `max-w-20 truncate rounded-full border px-1.5 py-0.5 text-[9px] font-medium leading-none ${TAG_STYLES[tag] ?? DEFAULT_TAG_STYLE}`,
|
|
970
987
|
title: tag,
|
|
971
988
|
children: tag
|
|
972
989
|
},
|
|
@@ -1000,25 +1017,121 @@ function EmptyState({ title, description }) {
|
|
|
1000
1017
|
] })
|
|
1001
1018
|
] });
|
|
1002
1019
|
}
|
|
1020
|
+
var ICO_DOC = /* @__PURE__ */ jsxs2("svg", { "aria-hidden": "true", width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
1021
|
+
/* @__PURE__ */ jsx2("path", { d: "M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z" }),
|
|
1022
|
+
/* @__PURE__ */ jsx2("polyline", { points: "14 2 14 8 20 8" })
|
|
1023
|
+
] });
|
|
1024
|
+
var ICO_CODE = /* @__PURE__ */ jsxs2("svg", { "aria-hidden": "true", width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
1025
|
+
/* @__PURE__ */ jsx2("polyline", { points: "16 18 22 12 16 6" }),
|
|
1026
|
+
/* @__PURE__ */ jsx2("polyline", { points: "8 6 2 12 8 18" })
|
|
1027
|
+
] });
|
|
1028
|
+
var ICO_TABLE = /* @__PURE__ */ jsxs2("svg", { "aria-hidden": "true", width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
1029
|
+
/* @__PURE__ */ jsx2("rect", { x: "3", y: "3", width: "18", height: "18", rx: "2" }),
|
|
1030
|
+
/* @__PURE__ */ jsx2("path", { d: "M3 9h18" }),
|
|
1031
|
+
/* @__PURE__ */ jsx2("path", { d: "M3 15h18" }),
|
|
1032
|
+
/* @__PURE__ */ jsx2("path", { d: "M9 3v18" })
|
|
1033
|
+
] });
|
|
1034
|
+
var ICO_SLIDES = /* @__PURE__ */ jsxs2("svg", { "aria-hidden": "true", width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
1035
|
+
/* @__PURE__ */ jsx2("rect", { x: "2", y: "3", width: "20", height: "14", rx: "2" }),
|
|
1036
|
+
/* @__PURE__ */ jsx2("path", { d: "M8 21h8" }),
|
|
1037
|
+
/* @__PURE__ */ jsx2("path", { d: "M12 17v4" })
|
|
1038
|
+
] });
|
|
1039
|
+
var ICO_PDF = /* @__PURE__ */ jsxs2("svg", { "aria-hidden": "true", width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
1040
|
+
/* @__PURE__ */ jsx2("path", { d: "M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z" }),
|
|
1041
|
+
/* @__PURE__ */ jsx2("path", { d: "M8 13h8" }),
|
|
1042
|
+
/* @__PURE__ */ jsx2("path", { d: "M8 17h5" })
|
|
1043
|
+
] });
|
|
1044
|
+
var ICO_IMAGE = /* @__PURE__ */ jsxs2("svg", { "aria-hidden": "true", width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
1045
|
+
/* @__PURE__ */ jsx2("rect", { x: "3", y: "3", width: "18", height: "18", rx: "2" }),
|
|
1046
|
+
/* @__PURE__ */ jsx2("circle", { cx: "9", cy: "9", r: "2" }),
|
|
1047
|
+
/* @__PURE__ */ jsx2("path", { d: "m21 15-3.09-3.09a2 2 0 0 0-2.82 0L6 21" })
|
|
1048
|
+
] });
|
|
1049
|
+
var ICO_AUDIO = /* @__PURE__ */ jsxs2("svg", { "aria-hidden": "true", width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
1050
|
+
/* @__PURE__ */ jsx2("path", { d: "M9 18V5l12-2v13" }),
|
|
1051
|
+
/* @__PURE__ */ jsx2("circle", { cx: "6", cy: "18", r: "3" }),
|
|
1052
|
+
/* @__PURE__ */ jsx2("circle", { cx: "18", cy: "16", r: "3" })
|
|
1053
|
+
] });
|
|
1054
|
+
var ICO_VIDEO = /* @__PURE__ */ jsxs2("svg", { "aria-hidden": "true", width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
1055
|
+
/* @__PURE__ */ jsx2("rect", { x: "2", y: "2", width: "20", height: "20", rx: "2" }),
|
|
1056
|
+
/* @__PURE__ */ jsx2("path", { d: "m10 8 6 4-6 4V8z" })
|
|
1057
|
+
] });
|
|
1058
|
+
var ICO_ARCHIVE = /* @__PURE__ */ jsxs2("svg", { "aria-hidden": "true", width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
1059
|
+
/* @__PURE__ */ jsx2("rect", { x: "2", y: "4", width: "20", height: "16", rx: "2" }),
|
|
1060
|
+
/* @__PURE__ */ jsx2("path", { d: "M12 4v16" }),
|
|
1061
|
+
/* @__PURE__ */ jsx2("path", { d: "m10 10 4 4" }),
|
|
1062
|
+
/* @__PURE__ */ jsx2("path", { d: "m14 10-4 4" })
|
|
1063
|
+
] });
|
|
1064
|
+
var ICO_CONFIG = /* @__PURE__ */ jsxs2("svg", { "aria-hidden": "true", width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
1065
|
+
/* @__PURE__ */ jsx2("path", { d: "M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z" }),
|
|
1066
|
+
/* @__PURE__ */ jsx2("circle", { cx: "12", cy: "15", r: "2" }),
|
|
1067
|
+
/* @__PURE__ */ jsx2("path", { d: "M12 11v2" })
|
|
1068
|
+
] });
|
|
1069
|
+
var ICO_TEXT = /* @__PURE__ */ jsxs2("svg", { "aria-hidden": "true", width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
1070
|
+
/* @__PURE__ */ jsx2("path", { d: "M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z" }),
|
|
1071
|
+
/* @__PURE__ */ jsx2("path", { d: "M8 13h8" }),
|
|
1072
|
+
/* @__PURE__ */ jsx2("path", { d: "M8 17h8" }),
|
|
1073
|
+
/* @__PURE__ */ jsx2("path", { d: "M8 9h3" })
|
|
1074
|
+
] });
|
|
1075
|
+
var ICO_DB = /* @__PURE__ */ jsxs2("svg", { "aria-hidden": "true", width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
1076
|
+
/* @__PURE__ */ jsx2("ellipse", { cx: "12", cy: "5", rx: "9", ry: "3" }),
|
|
1077
|
+
/* @__PURE__ */ jsx2("path", { d: "M3 5v14a9 3 0 0 0 18 0V5" }),
|
|
1078
|
+
/* @__PURE__ */ jsx2("path", { d: "M3 12a9 3 0 0 0 18 0" })
|
|
1079
|
+
] });
|
|
1080
|
+
var ICO_FOLDER = /* @__PURE__ */ jsx2("svg", { "aria-hidden": "true", width: "18", height: "18", viewBox: "0 0 24 24", fill: "currentColor", opacity: "0.85", children: /* @__PURE__ */ jsx2("path", { d: "M20 6h-8l-2-2H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2z" }) });
|
|
1081
|
+
var ICO_DESIGN = /* @__PURE__ */ jsxs2("svg", { "aria-hidden": "true", width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
1082
|
+
/* @__PURE__ */ jsx2("path", { d: "m12 19 7-7 3 3-7 7-3-3z" }),
|
|
1083
|
+
/* @__PURE__ */ jsx2("path", { d: "m18 13-1.5-7.5L2 2l3.5 14.5L13 18l5-5z" }),
|
|
1084
|
+
/* @__PURE__ */ jsx2("path", { d: "m2 2 7.586 7.586" }),
|
|
1085
|
+
/* @__PURE__ */ jsx2("circle", { cx: "11", cy: "11", r: "2" })
|
|
1086
|
+
] });
|
|
1087
|
+
var EXT_ICON = {};
|
|
1088
|
+
function reg(exts, icon, color) {
|
|
1089
|
+
for (const ext of exts) EXT_ICON[ext] = { icon, color };
|
|
1090
|
+
}
|
|
1091
|
+
reg(["py"], ICO_CODE, "text-[hsl(210,70%,58%)]");
|
|
1092
|
+
reg(["js", "jsx"], ICO_CODE, "text-[hsl(48,90%,50%)]");
|
|
1093
|
+
reg(["ts", "tsx"], ICO_CODE, "text-[hsl(210,80%,55%)]");
|
|
1094
|
+
reg(["go"], ICO_CODE, "text-[hsl(195,70%,50%)]");
|
|
1095
|
+
reg(["rs"], ICO_CODE, "text-[hsl(25,80%,55%)]");
|
|
1096
|
+
reg(["java", "kt"], ICO_CODE, "text-[hsl(20,85%,52%)]");
|
|
1097
|
+
reg(["rb"], ICO_CODE, "text-[hsl(0,70%,55%)]");
|
|
1098
|
+
reg(["c", "cpp", "h", "hpp"], ICO_CODE, "text-[hsl(210,60%,55%)]");
|
|
1099
|
+
reg(["cs"], ICO_CODE, "text-[hsl(265,55%,55%)]");
|
|
1100
|
+
reg(["swift"], ICO_CODE, "text-[hsl(20,90%,55%)]");
|
|
1101
|
+
reg(["html"], ICO_CODE, "text-[hsl(15,85%,55%)]");
|
|
1102
|
+
reg(["css", "scss"], ICO_CODE, "text-[hsl(210,70%,55%)]");
|
|
1103
|
+
reg(["vue"], ICO_CODE, "text-[hsl(153,60%,48%)]");
|
|
1104
|
+
reg(["svelte"], ICO_CODE, "text-[hsl(15,90%,55%)]");
|
|
1105
|
+
reg(["php"], ICO_CODE, "text-[hsl(240,40%,58%)]");
|
|
1106
|
+
reg(["sh", "zsh"], ICO_CODE, "text-[hsl(var(--muted-foreground))]");
|
|
1107
|
+
reg(["sql"], ICO_CODE, "text-[hsl(210,50%,55%)]");
|
|
1108
|
+
reg(["json", "jsonl", "ndjson"], ICO_CONFIG, "text-[hsl(158,55%,48%)]");
|
|
1109
|
+
reg(["yaml", "yml", "toml", "ini", "conf", "env", "lock"], ICO_CONFIG, "text-[hsl(var(--muted-foreground))]");
|
|
1110
|
+
reg(["xml"], ICO_CODE, "text-[hsl(25,65%,52%)]");
|
|
1111
|
+
reg(["db", "sqlite"], ICO_DB, "text-[hsl(210,50%,55%)]");
|
|
1112
|
+
reg(["parquet"], ICO_DB, "text-[hsl(158,50%,45%)]");
|
|
1113
|
+
reg(["doc", "docx", "odt", "rtf", "pages"], ICO_TEXT, "text-[hsl(210,65%,52%)]");
|
|
1114
|
+
reg(["xls", "xlsx", "csv", "tsv", "ods", "numbers"], ICO_TABLE, "text-[hsl(140,55%,42%)]");
|
|
1115
|
+
reg(["ppt", "pptx", "odp", "key"], ICO_SLIDES, "text-[hsl(15,80%,52%)]");
|
|
1116
|
+
reg(["pdf"], ICO_PDF, "text-[hsl(0,65%,50%)]");
|
|
1117
|
+
reg(["md", "markdown", "txt", "log", "tex", "epub"], ICO_TEXT, "text-[hsl(var(--muted-foreground))]");
|
|
1118
|
+
reg(["png", "jpg", "jpeg", "gif", "webp", "bmp", "ico", "heic", "heif", "avif", "tif", "tiff", "svg"], ICO_IMAGE, "text-[hsl(280,55%,58%)]");
|
|
1119
|
+
reg(["psd"], ICO_DESIGN, "text-[hsl(210,60%,55%)]");
|
|
1120
|
+
reg(["ai"], ICO_DESIGN, "text-[hsl(25,85%,52%)]");
|
|
1121
|
+
reg(["fig", "sketch", "xd", "blend"], ICO_DESIGN, "text-[hsl(280,50%,55%)]");
|
|
1122
|
+
reg(["mp3", "wav", "flac", "ogg", "aac", "aiff", "m4a", "mid"], ICO_AUDIO, "text-[hsl(330,60%,55%)]");
|
|
1123
|
+
reg(["mp4", "mov", "mkv", "avi", "webm", "wmv", "flv", "m4v"], ICO_VIDEO, "text-[hsl(340,65%,52%)]");
|
|
1124
|
+
reg(["zip", "tar", "gz", "rar", "7z", "bz2", "xz", "tgz", "dmg", "iso", "pkg"], ICO_ARCHIVE, "text-[hsl(30,50%,48%)]");
|
|
1125
|
+
reg(["ttf", "otf", "woff", "woff2"], ICO_DOC, "text-[hsl(var(--muted-foreground))]");
|
|
1126
|
+
var DEFAULT_ICON = { icon: ICO_DOC, color: "text-[hsl(var(--muted-foreground))]" };
|
|
1127
|
+
var FOLDER_COLOR = "text-[hsl(38,80%,55%)]";
|
|
1003
1128
|
function getFileIcon(fileName) {
|
|
1004
1129
|
const ext = fileName.split(".").pop()?.toLowerCase() ?? "";
|
|
1005
|
-
const
|
|
1006
|
-
return /* @__PURE__ */ jsx2(
|
|
1130
|
+
const entry = EXT_ICON[ext] ?? DEFAULT_ICON;
|
|
1131
|
+
return /* @__PURE__ */ jsx2("span", { className: `flex size-5 shrink-0 items-center justify-center ${entry.color}`, children: entry.icon });
|
|
1007
1132
|
}
|
|
1008
1133
|
function getFolderIcon() {
|
|
1009
|
-
return /* @__PURE__ */ jsx2(
|
|
1010
|
-
}
|
|
1011
|
-
function FileTypeIcon({ src, alt }) {
|
|
1012
|
-
return /* @__PURE__ */ jsx2(
|
|
1013
|
-
"img",
|
|
1014
|
-
{
|
|
1015
|
-
src,
|
|
1016
|
-
alt,
|
|
1017
|
-
className: "size-4 shrink-0 object-contain",
|
|
1018
|
-
draggable: false,
|
|
1019
|
-
loading: "lazy"
|
|
1020
|
-
}
|
|
1021
|
-
);
|
|
1134
|
+
return /* @__PURE__ */ jsx2("span", { className: `flex size-5 shrink-0 items-center justify-center ${FOLDER_COLOR}`, children: ICO_FOLDER });
|
|
1022
1135
|
}
|
|
1023
1136
|
function getErrorMessage(error, fallback) {
|
|
1024
1137
|
if (error instanceof Error && error.message) {
|