|
|
@@ -21,6 +21,7 @@ import { Textarea } from "@/components/ui/textarea.js";
|
|
|
import { useTabStore } from "@/store/TabStoreProvider.js";
|
|
|
import { isWorkspaceTab } from "@/store/tabStore.js";
|
|
|
import { useLocalWorkspaceScopes } from "@/hooks/useLocalWorkspaceScopes.js";
|
|
|
+import { useWorkspaceAliases } from "@/hooks/useWorkspaceAliases.js";
|
|
|
import { useSessionsIndex } from "@/v4/useSessionsIndex.js";
|
|
|
import { getWorkspaceKey } from "@/lib/workspaceKey.js";
|
|
|
import {
|
|
|
@@ -56,19 +57,27 @@ function useTaskDispatchWorkspaceOptions(): TaskDispatchWorkspaceOption[] {
|
|
|
const tabs = useTabStore((state) => state.tabs);
|
|
|
const workspaceTabs = useMemo(() => tabs.filter(isWorkspaceTab), [tabs]);
|
|
|
const localWorkspaceTabs = useLocalWorkspaceScopes({ workspaceTabs });
|
|
|
+ // 项目重命名(别名)与侧栏同源:别名优先展示,回退 tab label / 目录名。
|
|
|
+ const { resolveWorkspaceAlias } = useWorkspaceAliases();
|
|
|
return useMemo(
|
|
|
() =>
|
|
|
localWorkspaceTabs
|
|
|
// 只保留真实项目 tab;conversation backing path 不参与任务分发。
|
|
|
.filter((tab) => tab.workspacePurpose !== "conversation")
|
|
|
- .map((tab) => ({
|
|
|
- // 身份 key 统一走 getWorkspaceKey(workspaceIdentity 优先,trim 后回退路径)。
|
|
|
- key: getWorkspaceKey(tab.workspacePath, tab.workspaceIdentity),
|
|
|
- label: tab.label || workspaceBasename(tab.workspacePath),
|
|
|
- workspacePath: tab.workspacePath,
|
|
|
- workspaceIdentity: tab.workspaceIdentity,
|
|
|
- })),
|
|
|
- [localWorkspaceTabs],
|
|
|
+ .map((tab) => {
|
|
|
+ const workspaceKey = getWorkspaceKey(tab.workspacePath, tab.workspaceIdentity);
|
|
|
+ return {
|
|
|
+ // 身份 key 统一走 getWorkspaceKey(workspaceIdentity 优先,trim 后回退路径)。
|
|
|
+ key: workspaceKey,
|
|
|
+ label:
|
|
|
+ resolveWorkspaceAlias(workspaceKey) ||
|
|
|
+ tab.label ||
|
|
|
+ workspaceBasename(tab.workspacePath),
|
|
|
+ workspacePath: tab.workspacePath,
|
|
|
+ workspaceIdentity: tab.workspaceIdentity,
|
|
|
+ };
|
|
|
+ }),
|
|
|
+ [localWorkspaceTabs, resolveWorkspaceAlias],
|
|
|
);
|
|
|
}
|
|
|
|