Bladeren bron

feat(ui): M2 第一段——TaskDispatchModule 页面骨架(四区布局,未接线)

- 新建 task-dispatch/TaskDispatchModule.tsx:头部(标题+分析按钮)、项目选择器、
  主区(分组清单占位)、侧区(模块会话历史占位),遵守 DESIGN.md text-ui-* 体系
- workspaceOptions 由宿主注入(本地+远程 workspace),选择状态组件内自治
- i18n zh-CN/en-US 模块键
- 未接入路由(零破坏);下段沿 onOpenAutomations 链接线主视图切换

验证:root typecheck 通过
wubinggen 1 maand geleden
bovenliggende
commit
25c98133c4

+ 8 - 0
packages/ui/src/i18n/locales/en-US.ts

@@ -1863,6 +1863,14 @@ const enUS: Record<string, string> = {
   "taskDispatch.reparse": "Paste again",
   "taskDispatch.remove": "Remove this task",
   "taskDispatch.createDrafts": "Create {count} task(s) (drafts)",
+  "taskDispatch.module.title": "Task Dispatch",
+  "taskDispatch.module.analyze": "Analyze project",
+  "taskDispatch.module.targetProject": "Target project",
+  "taskDispatch.module.selectPlaceholder": "Select a project to analyze",
+  "taskDispatch.module.emptyAnalysis": "Pick a project and click \"Analyze project\"; the model will analyze it and propose a task list with an execution plan",
+  "taskDispatch.module.emptyAnalysisHint": "Tasks are grouped by execution plan: same-group tasks run in parallel, groups run in order",
+  "taskDispatch.module.history": "Analysis history",
+  "taskDispatch.module.historyEmpty": "No analysis records yet",
   "workspaceSidebar.renameProjectPlaceholder": "Custom project name (leave empty to reset)",
   "workspaceSidebar.renameProjectFailed": "Could not save project name",
   "chat.dashboard.turnsSteps": "{turns} turns · {steps} steps",

+ 8 - 0
packages/ui/src/i18n/locales/zh-CN.ts

@@ -1736,6 +1736,14 @@ const zhCN: Record<string, string> = {
   "taskDispatch.reparse": "重新粘贴",
   "taskDispatch.remove": "移除此任务",
   "taskDispatch.createDrafts": "创建 {count} 个任务(草稿)",
+  "taskDispatch.module.title": "任务分发",
+  "taskDispatch.module.analyze": "分析项目",
+  "taskDispatch.module.targetProject": "目标项目",
+  "taskDispatch.module.selectPlaceholder": "选择要分析的项目",
+  "taskDispatch.module.emptyAnalysis": "选择项目后点击\"分析项目\",模型将分析项目并给出任务清单与执行计划",
+  "taskDispatch.module.emptyAnalysisHint": "清单按执行计划分组:同组任务并行执行,组间按顺序执行",
+  "taskDispatch.module.history": "分析记录",
+  "taskDispatch.module.historyEmpty": "暂无分析记录",
   "workspaceSidebar.renameProjectPlaceholder": "自定义项目名称(留空恢复默认)",
   "workspaceSidebar.renameProjectFailed": "保存项目名称失败",
   "chat.dashboard.turnsSteps": "{turns} 轮 · {steps} 步",

+ 104 - 0
packages/ui/src/task-dispatch/TaskDispatchModule.tsx

@@ -0,0 +1,104 @@
+// ============================================================
+// TaskDispatchModule —— 任务分发独立模块(M2 骨架)
+// ============================================================
+// 设计合同:docs/specs/workspace-task-dispatch.md §8(三次/四次对齐形态)。
+// 四区布局:项目选择器 → 分析动作 → 按执行计划分组的任务清单 → 模块会话历史。
+// M2 骨架仅承载布局与状态框架;分析编排(M3)、确认执行(M4)、历史数据(M3)
+// 逐步填充。样式遵守 DESIGN.md(text-ui-* 字号体系)。
+
+import { useMemo, useState } from "react";
+import { Button } from "@/components/ui/button.js";
+import {
+  Select,
+  SelectContent,
+  SelectItem,
+  SelectTrigger,
+  SelectValue,
+} from "@/components/ui/select.js";
+import { useZCodeIntl } from "@/i18n/IntlProvider.js";
+import { cn } from "@/components/lib/utils.js";
+
+/** 模块内可选的项目目标(本地 + 远程 workspace)。 */
+export interface TaskDispatchWorkspaceOption {
+  key: string;
+  label: string;
+  workspacePath: string;
+  workspaceIdentity?: string;
+}
+
+export function TaskDispatchModule({
+  workspaceOptions,
+}: {
+  /** 由宿主注入可选项目列表(侧栏 workspace tabs 派生)。 */
+  workspaceOptions: TaskDispatchWorkspaceOption[];
+}) {
+  const { intl } = useZCodeIntl();
+  const [selectedKey, setSelectedKey] = useState<string | null>(
+    workspaceOptions[0]?.key ?? null,
+  );
+  const selected = useMemo(
+    () => workspaceOptions.find((option) => option.key === selectedKey) ?? null,
+    [workspaceOptions, selectedKey],
+  );
+
+  return (
+    <div className="flex h-full min-h-0 flex-col">
+      <header className="flex shrink-0 items-center justify-between gap-3 border-b border-border px-4 py-3">
+        <h1 className="text-ui-lg font-medium">
+          {intl.formatMessage({ id: "taskDispatch.module.title" })}
+        </h1>
+        {/* M3:选定项目后触发分析会话(moduleScope=task-dispatch)。 */}
+        <Button size="sm" disabled={!selected}>
+          {intl.formatMessage({ id: "taskDispatch.module.analyze" })}
+        </Button>
+      </header>
+      <div className="flex shrink-0 items-center gap-2 border-b border-border px-4 py-2">
+        <span className="text-ui-sm text-foreground-subtle">
+          {intl.formatMessage({ id: "taskDispatch.module.targetProject" })}
+        </span>
+        <Select
+          value={selectedKey ?? undefined}
+          onValueChange={(value) => setSelectedKey(value)}
+        >
+          <SelectTrigger className="h-8 w-[min(360px,60%)]" size="sm">
+            <SelectValue
+              placeholder={intl.formatMessage({
+                id: "taskDispatch.module.selectPlaceholder",
+              })}
+            />
+          </SelectTrigger>
+          <SelectContent>
+            {workspaceOptions.map((option) => (
+              <SelectItem key={option.key} value={option.key}>
+                {option.label}
+              </SelectItem>
+            ))}
+          </SelectContent>
+        </Select>
+      </div>
+      <div className="flex min-h-0 flex-1">
+        {/* 主区:按执行计划分组的任务清单(M2 占位;M3 填充模型分析结果)。 */}
+        <section
+          className={cn(
+            "flex min-w-0 flex-1 flex-col items-center justify-center gap-2 p-6",
+            "text-ui-base text-foreground-subtle",
+          )}
+        >
+          <p>{intl.formatMessage({ id: "taskDispatch.module.emptyAnalysis" })}</p>
+          <p className="text-ui-caption">
+            {intl.formatMessage({ id: "taskDispatch.module.emptyAnalysisHint" })}
+          </p>
+        </section>
+        {/* 侧区:模块会话历史(M2 占位;M3 按 moduleScope 过滤呈现)。 */}
+        <aside className="flex w-72 shrink-0 flex-col border-l border-border">
+          <div className="border-b border-border px-3 py-2 text-ui-sm font-medium text-foreground-subtle">
+            {intl.formatMessage({ id: "taskDispatch.module.history" })}
+          </div>
+          <div className="flex flex-1 items-center justify-center p-3 text-ui-caption text-foreground-subtlest">
+            {intl.formatMessage({ id: "taskDispatch.module.historyEmpty" })}
+          </div>
+        </aside>
+      </div>
+    </div>
+  );
+}