Просмотр исходного кода

chore(desktop): 合并 main 成果库与插件工作台集成版本

保留远端 main 的成果库和运行详情,并与统一工作台、应用插件入口及明暗主题合并。

- 合并预览面板可见性,兼顾成果库预览与代码区隔离。
- 保留运行详情和成果库样式,维持嵌入代码区的样式边界。
- 合并后通过 31 项界面回归、42 项相关单元测试、类型检查及 Desktop 构建。
- 记录配套 PaaS 提交和交付边界;本次不发布安装包。
邵勃源 3 дней назад
Родитель
Сommit
4f1017b32b

+ 8 - 0
BRANCHES.zh-CN.md

@@ -30,3 +30,11 @@
 本轮统一字体层级、连接表单对齐、浅深色样式与阅读宽度,将新会话调整为居中的研究输入区,并补充外部工具寻找、接入和缺少凭证的状态显示。窄窗口、面板拖动、文件预览和桌面导出已完成相关回归与原生测试包验收。
 
 配套 PaaS 提交为 `ac95c54`(包含 `7dfd1d6` 的运行中发现与接入远程 MCP 工具能力,以及科研生成与修订恢复改进)。动态工具能力需部署到 PaaS 执行服务后生效;桌面安装包不包含该后端更新。此快照仍为内测版本,不能据此声称已完成签名公证、自动更新发布或真实模型自主选型评测。
+
+## 2026-12-01 统一工作台与插件集成
+
+统一 λ-Agent 工作台,将 λ-Scientist 作为科研应用;增加应用包发现、导入与依赖检查,以及 MCP 工具选择、启停和移除。保留 main 上新增的成果库、运行详情及技术文件归类,统一明暗主题和表单控件。
+
+配套 PaaS 为 `237228f8`,包含 Desktop MCP 会话协议检查和运行隔离、同会话顺序、项目记忆边界修复(`235d9d39`)。后端提交位于 `paas-branch-merge`,需单独部署。
+
+合并后通过 31 项界面回归、42 项相关单元测试、app/desktop 类型检查、E2E 类型检查及 Desktop 构建。该快照不等同于安装包发布,未重启现有 Desktop 或服务;真实模型验收和 PostgreSQL 实机验收边界仍保留。

+ 1 - 1
PAAS_PRODUCT_IMPLEMENTATION_PLAN.zh-CN.md

@@ -1442,7 +1442,7 @@ git commit -m "test(paas): cover project workspace and agent routing"
 
 1. **P0-B Research Inbox**:统一聚合待审批、失败、完成未读、连接异常和预算告警。
 2. **P1 Run Inspector 2.0**:阶段时间线、子智能体参与、证据、成本、恢复点。
-3. **P1 成果资产库**:项目级文件树、来源、版本、比较、打包导出。
+3. **P1 成果资产库**:项目级文件树、来源、版本、比较、打包导出。(2026-12-01 已落地第一阶段:最近 40 个已结束任务的成果聚合、来源会话、搜索/类型筛选、预览与保存;文件树、版本与打包导出留待后续。)
 4. **P2 项目上下文与团队能力**:上下文包、记忆、分享、权限、云端同步。
 
 ## Self-Review

+ 76 - 0
packages/app/e2e/paas/artifacts.spec.ts

@@ -0,0 +1,76 @@
+import { expect, test } from "@playwright/test"
+
+test("project artifact library aggregates ended runs and previews files", async ({ page }) => {
+  await page.goto("/e2e/paas/index.html?completed&files")
+  await page.getByLabel("API Key", { exact: true }).fill("artifacts")
+  await page.getByRole("button", { name: "连接平台", exact: true }).click()
+  await page
+    .getByRole("button", { name: /已有研究/ })
+    .first()
+    .click()
+
+  await page.locator(".paas-sidebar").getByRole("button", { name: "成果", exact: true }).click()
+  await expect(page.getByRole("heading", { name: "成果", exact: true })).toBeVisible()
+  const group = page.getByRole("region", { name: "已有研究 的成果" })
+  await expect(group).toBeVisible()
+  await expect(group.getByText("研究计划.pdf", { exact: true })).toBeVisible()
+  await expect(group.getByText("研究计划.md", { exact: true })).toBeVisible()
+  await expect(group.getByText("config.yml", { exact: true })).toBeVisible()
+  await expect(page.getByText("7 个文件", { exact: true })).toBeVisible()
+
+  // Duplicate artifact names collapse into one row.
+  await expect(group.getByText("manifest.json", { exact: true })).toHaveCount(1)
+
+  await page.getByRole("button", { name: "预览 研究计划.md", exact: true }).click()
+  const preview = page.getByLabel("右侧预览", { exact: true })
+  await expect(preview).toBeVisible()
+  await expect(preview.getByText("可预览的研究计划", { exact: true })).toBeVisible()
+
+  await page.getByRole("button", { name: "保存 研究计划.md", exact: true }).click()
+  await expect(page.getByText("已保存 研究计划.md", { exact: true })).toBeVisible()
+})
+
+test("artifact library filters by type and search", async ({ page }) => {
+  await page.goto("/e2e/paas/index.html?completed&files")
+  await page.getByLabel("API Key", { exact: true }).fill("artifacts-filter")
+  await page.getByRole("button", { name: "连接平台", exact: true }).click()
+  await page
+    .getByRole("button", { name: /已有研究/ })
+    .first()
+    .click()
+  await page.locator(".paas-sidebar").getByRole("button", { name: "成果", exact: true }).click()
+  const library = page.locator(".paas-artifact-page")
+
+  await page.getByRole("button", { name: "数据 · 3", exact: true }).click()
+  await expect(library.getByText("config.yml", { exact: true })).toBeVisible()
+  await expect(library.getByText("研究计划.md", { exact: true })).toHaveCount(0)
+
+  await page.getByRole("button", { name: "代码 · 1", exact: true }).click()
+  await expect(library.getByText("analysis.py", { exact: true })).toBeVisible()
+  await expect(library.getByText("config.yml", { exact: true })).toHaveCount(0)
+
+  await page.getByRole("button", { name: "全部 · 7", exact: true }).click()
+  await page.getByLabel("搜索成果", { exact: true }).fill("不存在")
+  await expect(library.getByText("没有匹配的成果", { exact: true })).toBeVisible()
+  await page.getByRole("button", { name: "清除筛选", exact: true }).click()
+  await expect(library.getByText("研究计划.md", { exact: true })).toBeVisible()
+})
+
+test("artifact library is scoped to the active project", async ({ page }) => {
+  await page.goto("/e2e/paas/index.html?completed")
+  await page.getByLabel("API Key", { exact: true }).fill("artifacts-scope")
+  await page.getByRole("button", { name: "连接平台", exact: true }).click()
+  await page
+    .getByRole("button", { name: /已有研究/ })
+    .first()
+    .click()
+
+  await page.getByRole("button", { name: "新建项目", exact: true }).click()
+  await page.getByLabel("项目名称", { exact: true }).fill("第二个项目")
+  await page.getByRole("button", { name: "创建项目", exact: true }).click()
+  await expect(page.getByLabel("切换项目", { exact: true })).toContainText("第二个项目")
+
+  await page.locator(".paas-sidebar").getByRole("button", { name: "成果", exact: true }).click()
+  await expect(page.getByText("还没有可归档的成果", { exact: true })).toBeVisible()
+  await expect(page.getByText("研究计划.md", { exact: true })).toHaveCount(0)
+})

+ 1 - 0
packages/app/e2e/paas/fixture.tsx

@@ -331,6 +331,7 @@ const api: PaasPlatform = {
             ? [
                 { name: "config.yml", path: "work/config.yml" },
                 { name: "trace.json", path: "work/trace.json" },
+                { name: "analysis.py", path: "work/analysis.py" },
               ]
             : []),
         ],

+ 29 - 1
packages/app/e2e/paas/panel-fixture.tsx

@@ -6,7 +6,13 @@ import type { PaasPlatform } from "../../src/paas"
 export function PanelFixture() {
   const [state, setState] = createStore({ runID: "run_1" })
   const runs: Record<string, Record<string, unknown>> = {
-    run_1: { run_id: "run_1", agent_id: "research", status: "running", output: "第一项任务" },
+    run_1: {
+      run_id: "run_1",
+      agent_id: "research",
+      status: "running",
+      output: "第一项任务",
+      usage: { duration_ms: 5000, cost_usd: 0.0012 },
+    },
     run_2: { run_id: "run_2", agent_id: "research", status: "completed", output: "第二项任务" },
   }
   const control = {
@@ -46,6 +52,28 @@ export function PanelFixture() {
         if (control.failFiles) throw new Error("HTTP 503:文件服务暂时不可用")
         return { files: control.files }
       }
+      if (request.action === "run-events")
+        return {
+          run_id: request.runID,
+          stages: [
+            {
+              stage_id: "collect",
+              status: "completed",
+              details: { round: 1 },
+              started_at: "2026-11-30T10:00:00Z",
+              completed_at: "2026-11-30T10:00:05Z",
+            },
+          ],
+          events: [
+            {
+              sequence: 1,
+              event_type: "tool_call",
+              stage_id: "collect",
+              data: { tool: "Bash", content: "pwd" },
+              created_at: "2026-11-30T10:00:01Z",
+            },
+          ],
+        }
       if (request.action === "download") return { saved: !control.cancelDownload }
       if (request.action === "pause") {
         if (control.failPause) throw new Error("暂时无法暂停,请稍后再试。")

+ 10 - 0
packages/app/e2e/paas/panel.spec.ts

@@ -56,6 +56,16 @@ test("a slow snapshot cannot undo a pause and obsolete approval fields are remov
   await expect(page.getByRole("button", { name: "同意并继续" })).toHaveCount(0)
 })
 
+test("run inspector shows real stages, events, cost and duration", async ({ page }) => {
+  await page.locator(".paas-run-inspector > summary").click()
+  const inspector = page.locator(".paas-run-inspector")
+  await expect(inspector.getByRole("heading", { name: "阶段", exact: true })).toBeVisible()
+  await expect(inspector.getByLabel("执行阶段").getByText("collect", { exact: true })).toBeVisible()
+  await expect(inspector.getByLabel("执行事件").getByText("工具调用", { exact: true })).toBeVisible()
+  await expect(inspector.getByText("$0.0012", { exact: true })).toBeVisible()
+  await expect(inspector.getByLabel("执行阶段").getByText("5.0 秒", { exact: true })).toBeVisible()
+})
+
 test("work files stay hidden until requested and report an honest empty state", async ({ page }) => {
   await expect(page.getByText("没有可保存的工作文件。", { exact: true })).toHaveCount(0)
   await page.getByRole("button", { name: "查看工作文件", exact: true }).click()

+ 5 - 3
packages/app/e2e/paas/qa-fixes.spec.ts

@@ -45,7 +45,7 @@ test("generated files separate preview cards from collapsed technical files", as
     .first()
     .click()
   const section = page.getByRole("region", { name: "生成文件" })
-  await expect(section.locator("header span")).toHaveText("6")
+  await expect(section.locator("header span")).toHaveText("7")
   const card = section.getByRole("button", { name: "预览 研究计划.md", exact: true })
   await expect(card).toBeVisible()
   const alignment = await card.evaluate((element) => {
@@ -54,11 +54,13 @@ test("generated files separate preview cards from collapsed technical files", as
     return Math.abs(label.top + label.height / 2 - (box.top + box.height / 2))
   })
   expect(alignment).toBeLessThanOrEqual(1)
-  await expect(section.getByText("技术文件 · 3", { exact: true })).toBeVisible()
+  await expect(section.getByText("技术文件 · 4", { exact: true })).toBeVisible()
   await expect(section.locator('button[aria-label="预览 manifest.json"]')).toHaveCount(1)
   await expect(section.locator('button[aria-label="预览 trace.json"]')).toBeHidden()
-  await section.getByText("技术文件 · 3", { exact: true }).click()
+  await expect(section.locator('button[aria-label="预览 analysis.py"]')).toBeHidden()
+  await section.getByText("技术文件 · 4", { exact: true }).click()
   await expect(section.getByRole("button", { name: "预览 trace.json", exact: true })).toBeVisible()
+  await expect(section.getByRole("button", { name: "预览 analysis.py", exact: true })).toBeVisible()
   await expect(section.locator('button[aria-label="预览 manifest.json"]')).toHaveCount(1)
 })
 

+ 3 - 2
packages/app/e2e/paas/workbench.spec.ts

@@ -113,6 +113,7 @@ test("header actions stay aligned when the more menu opens", async ({ page }) =>
   await page.getByLabel("API Key", { exact: true }).fill("test-only")
   await page.getByRole("button", { name: "连接平台", exact: true }).click()
   await expect(page.getByRole("button", { name: "刷新历史会话", exact: true })).toBeVisible()
+  await expect(page.locator(".paas-chat-header-actions")).toHaveCSS("display", "flex")
   const settings = page.locator(".paas-chat-header-actions").getByRole("button", { name: "研究设置", exact: true })
   const create = page.locator(".paas-chat-header-actions").getByRole("button", { name: "新会话", exact: true })
   const more = page.locator(".paas-more-actions > summary")
@@ -196,7 +197,7 @@ test("history hides unused agents, collapses groups and starts a new session fro
   await expect(page.locator(".paas-topbar-chat-title")).toHaveText("新会话")
 })
 
-test("agent directory filters locally and keeps distinct monograms", async ({ page }) => {
+test("agent directory filters locally and keeps distinct illustrations", async ({ page }) => {
   await page.goto("/e2e/paas/index.html?groups")
   await page.getByLabel("平台地址", { exact: true }).fill("https://research.example")
   await page.getByLabel("API Key", { exact: true }).fill("test-only")
@@ -207,7 +208,7 @@ test("agent directory filters locally and keeps distinct monograms", async ({ pa
   await page.getByLabel("搜索智能体", { exact: true }).fill("未使用")
   await expect(cards).toHaveCount(1)
   await expect(cards.locator("h2")).toHaveText("未使用智能体")
-  await expect(cards.locator(".paas-agent-monogram")).toHaveText("未")
+  await expect(cards.locator(".paas-agent-illustration")).toHaveAttribute("data-kind", "agent")
   await page.getByLabel("搜索智能体", { exact: true }).fill("")
   await expect(cards).toHaveCount(2)
 })

+ 1 - 0
packages/app/src/paas.ts

@@ -67,6 +67,7 @@ export type PaasRequest =
   | { action: "upload-file"; agentID: string; threadID?: string; name: string; data: Uint8Array; uploadID?: string }
   | { action: "upload-selected"; agentID: string; threadID?: string; selectionID: string; uploadID: string }
   | { action: "run-files" | "cancel" | "pause"; agentID: string; runID: string }
+  | { action: "run-events"; agentID: string; runID: string; after?: number; source?: "projection" | "service" }
   | { action: "resume"; agentID: string; runID: string; checkpointID: string }
   | {
       action: "confirm"

+ 21 - 0
packages/app/src/pages/paas/README.md

@@ -45,6 +45,27 @@
 - 未归属任何项目线程的平台任务不进入 v1;需要在 P1 任务中心一并处理。
 - 复用线程仍沿用首次项目的归属,跨项目线程所有权留到后续。
 
+## P1 Run Inspector(2026-12-01)
+
+- 任务面板新增“执行检查器”,按需读取平台阶段与事件投影。
+- 展示真实阶段状态、耗时、事件类型、事件内容和平台返回的任务时长/成本。
+- 投影缺失时明确说明“平台未返回”,不推断执行进度。
+- 可切换到执行服务日志回放;读取失败可重试,不影响任务控制与成果。
+- 不包含跨阶段证据台账、checkpoint 可视化时间线和子智能体关系图。
+
+## P1 成果资产库(2026-12-01)
+
+- 侧栏新增“成果”页,按当前项目聚合**已结束任务**生成的成果与工作文件,支持全文搜索与文档/图片/数据/代码/文件筛选。
+- Python、Shell 等脚本与配置、日志、中间产物按技术文件处理:会话“生成文件”中折叠,成果页归入“代码/数据”分类并排在同分组的末尾。
+- 来源任务来自平台任务索引与本机会话记录,按 `thread_id` 归属当前项目;归档项目与归档会话不纳入。
+- 同名文件去重,优先保留带平台身份的平台成果;工作文件补齐路径、大小等缺失信息。
+- 按来源会话分组;同一会话的多次运行合并,同名文件保留最新一版;每个分组只展开前 8 个文件,其余折叠(最多展开 200 个)。
+- 工作区列表中的虚拟环境、依赖目录(`site-packages`、`node_modules`、`venv`、`__pycache__` 等)不纳入成果。
+- 每个分组显示来源会话、智能体、时间与文件数,可打开任务回到会话中的运行详情。
+- 文件可直接在右侧预览或保存;预览沿用会话页的同一控制器与缓存,切换到其他页面会关闭预览栏。
+- 只聚合最近 40 个已结束任务;更早记录需在平台任务中查看。单任务读取失败不阻断其余成果,并明确列出未同步任务。
+- 运行中任务不纳入,避免把持续变化的中间文件当作成果。
+
 ---
 
 # AgentPaaS 工作台:第一阶段 GUI

+ 150 - 0
packages/app/src/pages/paas/artifact-library.test.ts

@@ -0,0 +1,150 @@
+import { expect, test } from "bun:test"
+import { artifactCategory, artifactRuns, filterArtifacts, readRunArtifacts, type ArtifactChat } from "./artifact-library"
+
+const chats: ArtifactChat[] = [
+  {
+    id: "chat-a",
+    agentID: "research",
+    projectID: "project-a",
+    title: "已有研究",
+    threadID: "thread-a",
+    messages: [
+      { role: "user", status: "completed", runID: "run-message" },
+      { role: "assistant", status: "completed", runID: "run-message", updated: 1000 },
+      { role: "assistant", status: "running", runID: "run-active" },
+    ],
+  },
+  {
+    id: "chat-b",
+    agentID: "research",
+    projectID: "project-a",
+    title: "已归档会话",
+    threadID: "thread-b",
+    archived: true,
+    messages: [],
+  },
+  {
+    id: "chat-c",
+    agentID: "data67",
+    projectID: "project-b",
+    title: "另一个项目",
+    threadID: "thread-c",
+    messages: [{ role: "assistant", status: "completed", runID: "run-other", updated: 5000 }],
+  },
+]
+
+test("collects archived runs for one project from tasks and loaded messages", () => {
+  const runs = artifactRuns({
+    chats,
+    projectID: "project-a",
+    tasks: [
+      {
+        run_id: "run-task",
+        agent_id: "research",
+        thread_id: "thread-a",
+        status: "completed",
+        created_at: "2026-11-30T10:00:00Z",
+        updated_at: "2026-11-30T10:00:05Z",
+      },
+      { run_id: "run-message", agent_id: "research", thread_id: "thread-a", status: "completed", updated_at: "2026-11-30T09:00:00Z" },
+      { run_id: "run-running", agent_id: "research", thread_id: "thread-a", status: "running" },
+      { run_id: "run-archived", agent_id: "research", thread_id: "thread-b", status: "completed" },
+      { run_id: "run-other", agent_id: "data67", thread_id: "thread-c", status: "completed" },
+      { run_id: "run-unassigned", agent_id: "research", status: "completed" },
+    ],
+  })
+  expect(runs.map((run) => run.runID)).toEqual(["run-task", "run-message"])
+  // The task index snapshot keeps the later timestamp for a run it shares with the message history.
+  expect(runs[1].at).toBe(Date.parse("2026-11-30T09:00:00Z"))
+  expect(runs[0].chatTitle).toBe("已有研究")
+  expect(runs[0].task?.run_id).toBe("run-task")
+})
+
+test("merges artifact and workspace files without duplicating names", () => {
+  const run = { agentID: "research", runID: "run-1", chatID: "chat-a", chatTitle: "已有研究", at: 10 }
+  const entries = readRunArtifacts({
+    run,
+    detail: {
+      artifacts: [
+        { artifact_id: "artifact-1", name: "研究计划.pdf" },
+        { artifact_id: "artifact-1", name: "研究计划.pdf" },
+        { artifact_id: "artifact-2", name: "manifest.json" },
+      ],
+    },
+    files: {
+      files: [
+        { name: "研究计划.pdf", path: "final/研究计划.pdf", size: 128 },
+        { name: "evidence.md", path: "final/evidence.md", mime_type: "text/markdown", size: 42 },
+        { name: "trace.json", path: "work/trace.json", size: 9 },
+      ],
+    },
+  })
+  expect(entries).toHaveLength(4)
+  const plan = entries.find((entry) => entry.name === "研究计划.pdf")!
+  expect(plan.source).toBe("artifact")
+  expect(plan.artifactID).toBe("artifact-1")
+  // Workspace metadata fills gaps the artifact record did not provide.
+  expect(plan.path).toBe("final/研究计划.pdf")
+  expect(plan.size).toBe(128)
+  expect(entries.find((entry) => entry.name === "evidence.md")?.source).toBe("file")
+})
+
+test("tolerates missing lists and empty identifiers", () => {
+  const run = { agentID: "research", runID: "run-1", chatID: "chat-a", chatTitle: "已有研究", at: 10 }
+  expect(readRunArtifacts({ run, detail: {}, files: { files: [] } })).toEqual([])
+  const entries = readRunArtifacts({
+    run,
+    detail: { artifacts: [{ name: "无编号成果.pdf" }, { artifact_id: "artifact-3" }] },
+    files: undefined,
+  })
+  expect(entries.map((entry) => entry.name)).toEqual(["artifact-3"])
+  expect(entries[0].artifactID).toBe("artifact-3")
+})
+
+test("hides virtualenv and dependency internals from workspace listings", () => {
+  const run = { agentID: "data67", runID: "run-1", chatID: "chat-a", chatTitle: "图表任务", at: 10 }
+  const entries = readRunArtifacts({
+    run,
+    detail: { artifacts: [{ artifact_id: "artifact-1", name: "bar.png" }] },
+    files: {
+      files: [
+        { name: "bar.png", path: "outputs/bar.png" },
+        { name: "sales.csv", path: "workspace/sales.csv" },
+        { name: "__init__.py", path: ".venv/Lib/site-packages/numpy/__init__.py" },
+        { name: "matplotlib", path: "venv/lib/python3.12/site-packages/matplotlib" },
+        { name: "module.pyc", path: "workspace/__pycache__/module.pyc" },
+        { name: "state.json", path: "workspace/.ipynb_checkpoints/state.json" },
+      ],
+    },
+  })
+  expect(entries.map((entry) => entry.name).sort()).toEqual(["bar.png", "sales.csv"])
+})
+
+test("classifies and filters artifacts by type and search text", () => {
+  expect(artifactCategory({ name: "report.md" })).toBe("document")
+  expect(artifactCategory({ name: "report.html" })).toBe("document")
+  expect(artifactCategory({ name: "figure.png" })).toBe("image")
+  expect(artifactCategory({ name: "trace.json" })).toBe("data")
+  expect(artifactCategory({ name: "dataset.csv" })).toBe("data")
+  expect(artifactCategory({ name: "analyze.py" })).toBe("code")
+  expect(artifactCategory({ name: "run.sh" })).toBe("code")
+  expect(artifactCategory({ name: "archive.zip" })).toBe("other")
+
+  const run = { agentID: "research", runID: "run-1", chatID: "chat-a", chatTitle: "已有研究", at: 10 }
+  const entries = readRunArtifacts({
+    run,
+    detail: { artifacts: [] },
+    files: {
+      files: [
+        { name: "report.md", path: "final/report.md" },
+        { name: "figure.png", path: "final/figure.png" },
+        { name: "trace.json", path: "work/trace.json" },
+      ],
+    },
+  })
+  expect(filterArtifacts(entries, { query: "", category: "image" }).map((entry) => entry.name)).toEqual(["figure.png"])
+  expect(filterArtifacts(entries, { query: "已有研究", category: "all" })).toHaveLength(3)
+  expect(filterArtifacts(entries, { query: "report", category: "all" }).map((entry) => entry.name)).toEqual([
+    "report.md",
+  ])
+})

+ 214 - 0
packages/app/src/pages/paas/artifact-library.ts

@@ -0,0 +1,214 @@
+import { paasRecord, paasStatus, paasText } from "@/paas"
+import { paasFileCategory, type PaasFileCategory } from "./file-groups"
+
+export type ArtifactChat = {
+  id: string
+  agentID?: string
+  projectID?: string
+  title: string
+  threadID: string
+  archived?: boolean
+  messages: {
+    role?: string
+    status?: string
+    runID?: string
+    started?: number
+    updated?: number
+  }[]
+}
+
+export type ArtifactRun = {
+  agentID: string
+  runID: string
+  chatID: string
+  chatTitle: string
+  at: number
+  task?: Record<string, unknown>
+}
+
+export type ArtifactEntry = {
+  id: string
+  name: string
+  mime?: string
+  size?: number
+  path?: string
+  artifactID?: string
+  agentID: string
+  runID: string
+  chatID: string
+  chatTitle: string
+  at: number
+  source: "artifact" | "file"
+}
+
+export type ArtifactCategory = PaasFileCategory
+
+// Only runs that ended can be archived; active runs keep changing their workspace.
+const archivedStatuses = new Set(["completed", "partial", "failed", "cancelled"])
+
+export function artifactRuns(input: {
+  chats: ArtifactChat[]
+  tasks: Record<string, unknown>[]
+  projectID: string
+}): ArtifactRun[] {
+  const chats = input.chats.filter((chat) => chat.projectID === input.projectID && !chat.archived)
+  const threads = new Map<string, ArtifactChat>()
+  for (const chat of chats) if (chat.threadID && !threads.has(chat.threadID)) threads.set(chat.threadID, chat)
+  const runs = new Map<string, ArtifactRun>()
+  const add = (run: ArtifactRun) => {
+    const key = `${run.agentID}:${run.runID}`
+    const previous = runs.get(key)
+    if (!previous) {
+      runs.set(key, run)
+      return
+    }
+    runs.set(key, { ...run, at: Math.max(previous.at, run.at), task: run.task || previous.task })
+  }
+
+  for (const task of input.tasks) {
+    const runID = paasText(task.run_id) || paasText(task.id)
+    const threadID = paasText(task.thread_id) || paasText(task.session_id)
+    const chat = threadID ? threads.get(threadID) : undefined
+    if (!runID || !chat || !archivedStatuses.has(paasStatus(task))) continue
+    const agentID = paasText(task.agent_id) || chat.agentID
+    if (!agentID) continue
+    add({
+      agentID,
+      runID,
+      chatID: chat.id,
+      chatTitle: chat.title,
+      at: time(task.updated_at) || time(task.completed_at) || time(task.created_at),
+      task,
+    })
+  }
+
+  for (const chat of chats) {
+    const agentID = chat.agentID
+    if (!agentID) continue
+    for (const message of chat.messages) {
+      if (message.role !== "assistant" || !message.runID || !archivedStatuses.has(message.status || "")) continue
+      add({
+        agentID,
+        runID: message.runID,
+        chatID: chat.id,
+        chatTitle: chat.title,
+        at: message.updated || message.started || 0,
+      })
+    }
+  }
+
+  return [...runs.values()].sort((a, b) => b.at - a.at)
+}
+
+export function readRunArtifacts(input: { run: ArtifactRun; detail: unknown; files: unknown }): ArtifactEntry[] {
+  const entries = new Map<string, ArtifactEntry>()
+  const add = (entry: ArtifactEntry) => {
+    const key = entry.name.trim().toLocaleLowerCase()
+    if (key) entries.set(key, entry)
+  }
+  // Artifacts win over workspace copies of the same name because they keep the
+  // platform download identity; workspace-only files fill in the rest.
+  for (const file of rows(input.detail, "artifacts")) {
+    const name = paasText(file.name) || paasText(file.artifact_id)
+    const artifactID = paasText(file.artifact_id) || paasText(file.id)
+    if (!name || !artifactID) continue
+    add({
+      ...envelope(input.run, "artifact"),
+      id: `${input.run.agentID}:${input.run.runID}:artifact:${artifactID}`,
+      name,
+      artifactID,
+      mime: paasText(file.mime_type) || undefined,
+      size: typeof file.size === "number" ? file.size : undefined,
+    })
+  }
+  for (const file of rows(input.files, "files")) {
+    const path = paasText(file.path)
+    const name = paasText(file.name) || path.split("/").at(-1) || ""
+    const key = name.trim().toLocaleLowerCase()
+    if (!key || dependencyFile(path, name)) continue
+    const previous = entries.get(key)
+    if (previous) {
+      entries.set(key, {
+        ...previous,
+        mime: previous.mime || paasText(file.mime_type) || undefined,
+        size: previous.size ?? (typeof file.size === "number" ? file.size : undefined),
+        path: previous.path || path || undefined,
+      })
+      continue
+    }
+    add({
+      ...envelope(input.run, "file"),
+      id: `${input.run.agentID}:${input.run.runID}:file:${path || name}`,
+      name,
+      path: path || undefined,
+      mime: paasText(file.mime_type) || undefined,
+      size: typeof file.size === "number" ? file.size : undefined,
+    })
+  }
+  return [...entries.values()]
+}
+
+function envelope(run: ArtifactRun, source: ArtifactEntry["source"]) {
+  return {
+    agentID: run.agentID,
+    runID: run.runID,
+    chatID: run.chatID,
+    chatTitle: run.chatTitle,
+    at: run.at,
+    source,
+  }
+}
+
+function rows(value: unknown, key: string): Record<string, unknown>[] {
+  const list = paasRecord(value)?.[key]
+  if (!Array.isArray(list)) return []
+  return list.flatMap((row) => {
+    const item = paasRecord(row)
+    return item ? [item] : []
+  })
+}
+
+// Workspace listing can include the whole virtualenv; environment internals are
+// not research outputs, so the library hides them instead of flooding the page.
+const dependencySegments = new Set([
+  "node_modules",
+  "site-packages",
+  "dist-packages",
+  ".venv",
+  "venv",
+  "env",
+  "__pycache__",
+  ".git",
+  ".tox",
+  ".mypy_cache",
+  ".pytest_cache",
+  ".ipynb_checkpoints",
+])
+
+function dependencyFile(path: string, name: string) {
+  if (/\.pyc$/i.test(name) || /\.egg-info([\\/]|$)/i.test(path)) return true
+  const segments = `${path}/${name}`.split(/[\\/]+/)
+  return segments.some((segment) => dependencySegments.has(segment.toLocaleLowerCase()))
+}
+
+export function artifactCategory(file: { name: string; mime?: string }): ArtifactCategory {
+  return paasFileCategory(file)
+}
+
+export function filterArtifacts(
+  entries: ArtifactEntry[],
+  input: { query: string; category: ArtifactCategory | "all" },
+): ArtifactEntry[] {
+  const query = input.query.trim().toLocaleLowerCase()
+  return entries.filter(
+    (entry) =>
+      (input.category === "all" || artifactCategory(entry) === input.category) &&
+      (!query ||
+        `${entry.name} ${entry.chatTitle} ${entry.mime || ""}`.toLocaleLowerCase().includes(query)),
+  )
+}
+
+function time(value: unknown) {
+  const result = typeof value === "number" ? value : Date.parse(paasText(value))
+  return Number.isFinite(result) ? result : 0
+}

+ 411 - 0
packages/app/src/pages/paas/artifacts.tsx

@@ -0,0 +1,411 @@
+import { For, Show, createEffect, createMemo, on, onCleanup } from "solid-js"
+import { createStore } from "solid-js/store"
+import { ResearchIcon } from "./research-icon"
+import { paasRecord, paasRunDetail, paasText, type PaasPlatform } from "@/paas"
+import {
+  artifactCategory,
+  artifactRuns,
+  filterArtifacts,
+  readRunArtifacts,
+  type ArtifactCategory,
+  type ArtifactChat,
+  type ArtifactEntry,
+  type ArtifactRun,
+} from "./artifact-library"
+import type { PaasPreviewFile } from "./preview"
+
+const categories: { id: ArtifactCategory | "all"; label: string }[] = [
+  { id: "all", label: "全部" },
+  { id: "document", label: "文档" },
+  { id: "image", label: "图片" },
+  { id: "data", label: "数据" },
+  { id: "code", label: "代码" },
+  { id: "other", label: "其他" },
+]
+
+const categoryLabels: Record<ArtifactCategory, string> = {
+  document: "文档",
+  image: "图片",
+  data: "数据",
+  code: "代码",
+  other: "文件",
+}
+
+const maxRuns = 40
+const cache = new Map<string, ArtifactEntry[]>()
+
+function formatSize(value?: number) {
+  if (!value || value < 0) return ""
+  if (value < 1024) return `${value} B`
+  if (value < 1024 * 1024) return `${Math.round(value / 1024)} KB`
+  return `${(value / 1024 / 1024).toFixed(1)} MB`
+}
+
+function formatTime(value: number) {
+  if (!value) return ""
+  return new Date(value).toLocaleString("zh-CN", {
+    month: "numeric",
+    day: "numeric",
+    hour: "2-digit",
+    minute: "2-digit",
+  })
+}
+
+export function PaasArtifacts(props: {
+  api?: PaasPlatform
+  connected: boolean
+  scope?: string
+  projectID: string
+  projectName: string
+  chats: () => ArtifactChat[]
+  tasks: () => Record<string, unknown>[]
+  agents: Record<string, unknown>[]
+  onOpenRun: (run: ArtifactRun) => void
+  onPreview: (file: PaasPreviewFile) => void
+  onNewResearch?: () => void
+}) {
+  const [state, setState] = createStore({
+    entries: [] as ArtifactEntry[],
+    loading: false,
+    loaded: false,
+    failed: [] as string[],
+    updated: "",
+    notice: "",
+    saving: "",
+  })
+  const [filters, setFilters] = createStore({
+    query: "",
+    category: "all" as ArtifactCategory | "all",
+  })
+  const runs = createMemo(() =>
+    artifactRuns({ chats: props.chats(), tasks: props.tasks(), projectID: props.projectID }),
+  )
+  const targets = createMemo(() => runs().slice(0, maxRuns))
+  const signature = createMemo(() => targets().map((run) => `${run.agentID}:${run.runID}`).join("|"))
+  // Re-running a chat often republishes the same workspace files; keep the newest copy per chat.
+  const library = createMemo(() => {
+    const seen = new Map<string, ArtifactEntry>()
+    for (const entry of state.entries) {
+      const key = `${entry.agentID}:${entry.chatID || entry.runID}:${entry.name.toLocaleLowerCase()}`
+      if (!seen.has(key)) seen.set(key, entry)
+    }
+    return [...seen.values()]
+  })
+  const entries = createMemo(() => filterArtifacts(library(), { query: filters.query, category: filters.category }))
+  const groups = createMemo(() => {
+    const runsByKey = new Map(targets().map((run) => [`${run.agentID}:${run.runID}`, run]))
+    const result = new Map<string, { run: ArtifactRun; entries: ArtifactEntry[]; runs: Set<string> }>()
+    for (const entry of entries()) {
+      const key = entry.chatID ? `${entry.agentID}:${entry.chatID}` : `${entry.agentID}:${entry.runID}`
+      const run =
+        runsByKey.get(`${entry.agentID}:${entry.runID}`) ||
+        ({
+          agentID: entry.agentID,
+          runID: entry.runID,
+          chatID: entry.chatID,
+          chatTitle: entry.chatTitle,
+          at: entry.at,
+        } satisfies ArtifactRun)
+      const group = result.get(key) || { run, entries: [], runs: new Set<string>() }
+      group.entries.push(entry)
+      group.runs.add(entry.runID)
+      if (run.at > group.run.at) group.run = run
+      result.set(key, group)
+    }
+    for (const group of result.values()) group.entries.sort(byRelevance)
+    return [...result.values()].sort((a, b) => b.run.at - a.run.at)
+  })
+  const counts = createMemo(() => {
+    const result: Record<string, number> = { all: library().length }
+    for (const entry of library()) {
+      const category = artifactCategory(entry)
+      result[category] = (result[category] || 0) + 1
+    }
+    return result
+  })
+  const agentName = (agentID: string) =>
+    paasText(props.agents.find((agent) => paasText(agent.id) === agentID)?.name) || agentID
+  const narrowed = () => !!filters.query.trim() || filters.category !== "all"
+  const cacheKey = (run: ArtifactRun) => `${props.scope || ""}:${run.agentID}:${run.runID}`
+  let epoch = 0
+  onCleanup(() => {
+    epoch++
+  })
+
+  const load = async (force = false) => {
+    const current = ++epoch
+    setState({ notice: "" })
+    if (!props.connected || !props.api) {
+      setState({ entries: [], loading: false, loaded: false, failed: [] })
+      return
+    }
+    const list = targets()
+    setState({ loading: true, failed: [] })
+    const collected: ArtifactEntry[] = []
+    const failed: string[] = []
+    await pool(list, 4, async (run) => {
+      const key = cacheKey(run)
+      const cached = !force ? cache.get(key) : undefined
+      if (cached) {
+        collected.push(...cached)
+        return
+      }
+      const [detail, files] = await Promise.all([
+        paasRunDetail(props.api!, run.agentID, run.runID).catch(() => undefined),
+        props.api!.request({ action: "run-files", agentID: run.agentID, runID: run.runID }).catch(() => undefined),
+      ])
+      if (!detail && !files) {
+        failed.push(run.chatTitle)
+        return
+      }
+      const items = readRunArtifacts({ run, detail, files })
+      cache.set(key, items)
+      collected.push(...items)
+    })
+    if (current !== epoch) return
+    setState({
+      entries: collected.sort((a, b) => b.at - a.at || a.name.localeCompare(b.name, "zh-CN")),
+      loading: false,
+      loaded: true,
+      failed,
+      updated: new Date().toLocaleTimeString(),
+    })
+  }
+  createEffect(
+    on(
+      [() => props.connected, () => props.scope, () => props.projectID, signature],
+      () => void load(),
+    ),
+  )
+
+  const save = async (entry: ArtifactEntry) => {
+    if (!props.api || state.saving) return
+    setState({ saving: entry.id, notice: "" })
+    try {
+      const result = paasRecord(
+        await props.api.request({
+          action: "download",
+          agentID: entry.agentID,
+          runID: entry.runID,
+          name: entry.name,
+          path: entry.path,
+          artifactID: entry.artifactID,
+        }),
+      )
+      setState(
+        "notice",
+        result?.saved ? `已保存 ${entry.name}` : `${entry.name} 未保存,文件仍保留在平台。`,
+      )
+    } catch (error) {
+      setState("notice", error instanceof Error ? error.message : "保存失败,请重试。")
+    } finally {
+      setState("saving", "")
+    }
+  }
+
+  const card = (entry: ArtifactEntry) => {
+    const category = artifactCategory(entry)
+    return (
+      <li class="paas-artifact-row">
+        <span class="paas-artifact-kind" data-category={category}>
+          {categoryLabels[category]}
+        </span>
+        <div class="paas-artifact-name">
+          <strong title={entry.name}>{entry.name}</strong>
+          <small>
+            {[entry.mime, formatSize(entry.size)].filter(Boolean).join(" · ") || entry.name.split(".").pop()?.toUpperCase()}
+          </small>
+        </div>
+        <div class="paas-artifact-actions">
+          <button
+            type="button"
+            aria-label={`预览 ${entry.name}`}
+            onClick={() =>
+              props.onPreview({
+                agentID: entry.agentID,
+                runID: entry.runID,
+                name: entry.name,
+                path: entry.path,
+                artifactID: entry.artifactID,
+                mime: entry.mime,
+                size: entry.size,
+              })
+            }
+          >
+            预览
+          </button>
+          <button
+            type="button"
+            aria-label={`保存 ${entry.name}`}
+            disabled={!!state.saving}
+            onClick={() => void save(entry)}
+          >
+            {state.saving === entry.id ? "保存中…" : "保存"}
+          </button>
+        </div>
+      </li>
+    )
+  }
+
+  return (
+    <section class="paas-artifact-page" aria-label="项目成果">
+      <div class="paas-section-title">
+        <div>
+          <h1>成果</h1>
+          <p>{props.projectName} · 聚合项目内已结束任务生成的文件,可预览或保存。</p>
+        </div>
+        <button type="button" disabled={!props.connected || state.loading} onClick={() => void load(true)}>
+          {state.loading ? "正在同步…" : "刷新成果"}
+        </button>
+      </div>
+      <div class="paas-artifact-counts">
+        <span>{library().length} 个文件</span>
+        <span>{groups().length} 个会话</span>
+        <small>{state.updated ? `更新于 ${state.updated}` : "正在读取项目成果…"}</small>
+      </div>
+      <div class="paas-artifact-toolbar">
+        <label>
+          搜索成果
+          <input
+            type="search"
+            placeholder="文件名或来源会话"
+            value={filters.query}
+            onInput={(event) => setFilters("query", event.currentTarget.value)}
+          />
+        </label>
+        <div class="paas-artifact-filter" role="group" aria-label="成果类型">
+          <For each={categories}>
+            {(category) => (
+              <button
+                type="button"
+                aria-pressed={filters.category === category.id}
+                onClick={() => setFilters("category", category.id)}
+              >
+                {category.label}
+                <Show when={(counts()[category.id] || 0) > 0}> · {counts()[category.id]}</Show>
+              </button>
+            )}
+          </For>
+        </div>
+      </div>
+      <Show when={state.notice}>
+        <p class="paas-notice" role="status">
+          {state.notice}
+        </p>
+      </Show>
+      <Show when={state.failed.length}>
+        <div class="paas-notice" role="status">
+          <p>部分任务的成果暂未同步,已展示其余内容;可稍后刷新重试。</p>
+          <details>
+            <summary>查看未同步任务 · {state.failed.length}</summary>
+            <p>{state.failed.join("、")}</p>
+          </details>
+        </div>
+      </Show>
+      <Show when={runs().length > maxRuns}>
+        <p class="paas-muted">仅聚合最近 {maxRuns} 个已结束任务;更早任务可在平台任务中查看。</p>
+      </Show>
+      <Show
+        when={props.connected && (state.loading || groups().length)}
+        fallback={
+          <div class="paas-task-empty">
+            <ResearchIcon kind="evidence" />
+            <strong>
+              {!props.connected
+                ? "连接平台后加载成果"
+                : !state.loaded
+                  ? "正在读取项目成果…"
+                  : runs().length && narrowed()
+                    ? "没有匹配的成果"
+                    : "还没有可归档的成果"}
+            </strong>
+            <p>
+              {!props.connected
+                ? "连接后会自动同步当前项目已结束任务的成果。"
+                : !state.loaded
+                  ? "请稍候。"
+                  : runs().length && narrowed()
+                    ? "调整搜索或类型筛选,或清除筛选条件。"
+                    : runs().length
+                      ? "已结束的任务没有返回可归档文件;可打开任务查看运行详情。"
+                      : "完成一项研究任务后,生成的文件会汇总到这里。"}
+            </p>
+            <Show when={props.connected && state.loaded && runs().length && narrowed()}>
+              <button type="button" onClick={() => setFilters({ query: "", category: "all" })}>
+                清除筛选
+              </button>
+            </Show>
+            <Show when={props.connected && state.loaded && !runs().length && props.onNewResearch}>
+              <button type="button" class="paas-primary" onClick={props.onNewResearch}>
+                开始新研究
+              </button>
+            </Show>
+          </div>
+        }
+      >
+        <Show when={state.loading && !state.loaded}>
+          <p class="paas-muted" role="status">
+            正在读取项目成果…
+          </p>
+        </Show>
+        <div class="paas-artifact-groups">
+          <For each={groups()}>
+            {(group) => (
+              <section class="paas-artifact-group" aria-label={`${group.run.chatTitle} 的成果`}>
+                <header>
+                  <div>
+                    <strong>{group.run.chatTitle}</strong>
+                    <span>
+                      {agentName(group.run.agentID)}
+                      <Show when={formatTime(group.run.at)}> · {formatTime(group.run.at)}</Show>
+                      <Show when={group.runs.size > 1}> · {group.runs.size} 个任务</Show>
+                      {" · "}
+                      {group.entries.length} 个文件
+                    </span>
+                  </div>
+                  <button type="button" onClick={() => props.onOpenRun(group.run)}>
+                    打开任务
+                  </button>
+                </header>
+                <ul>
+                  <For each={group.entries.slice(0, 8)}>{card}</For>
+                </ul>
+                <Show when={group.entries.length > 8}>
+                  <details class="paas-artifact-more">
+                    <summary>展开其余 {group.entries.length - 8} 个文件</summary>
+                    <ul>
+                      <For each={group.entries.slice(8, 200)}>{card}</For>
+                    </ul>
+                    <Show when={group.entries.length > 200}>
+                      <p class="paas-muted">
+                        此处最多展开 200 个文件;该任务工作区共 {group.entries.length} 个文件,其余请在任务中查看。
+                      </p>
+                    </Show>
+                  </details>
+                </Show>
+              </section>
+            )}
+          </For>
+        </div>
+      </Show>
+    </section>
+  )
+}
+
+async function pool<T>(items: T[], limit: number, task: (item: T) => Promise<void>) {
+  let index = 0
+  const workers = Array.from({ length: Math.min(limit, items.length) }, async () => {
+    while (index < items.length) await task(items[index++])
+  })
+  await Promise.all(workers)
+}
+
+const categoryRank: Record<ArtifactCategory, number> = { document: 0, image: 1, data: 2, code: 3, other: 4 }
+
+function byRelevance(a: ArtifactEntry, b: ArtifactEntry) {
+  return (
+    categoryRank[artifactCategory(a)] - categoryRank[artifactCategory(b)] ||
+    Number(a.source !== "artifact") - Number(b.source !== "artifact") ||
+    a.name.localeCompare(b.name, "zh-CN")
+  )
+}

+ 4 - 0
packages/app/src/pages/paas/chat.tsx

@@ -30,6 +30,7 @@ import {
   hasConversationHistory,
   hasResearchContent,
   working,
+  type ResearchChat,
   type ResearchMessage,
 } from "./chat-state"
 import { createMaterials } from "./materials"
@@ -68,6 +69,7 @@ export function PaasChat(props: {
   inboxMount?: HTMLElement
   registerNewSession?: (create: (() => void) | undefined) => void
   registerRename?: (rename: ((title: string) => void) | undefined) => void
+  registerChats?: (get: (() => ResearchChat[]) | undefined) => void
   onTitle?: (title: string) => void
   onPreviewFile?: (file: PaasPreviewFile) => void
   previewFile?: PaasPreviewFile
@@ -325,9 +327,11 @@ export function PaasChat(props: {
     }
     props.registerNewSession?.(create)
     props.registerRename?.((title) => model.rename(title))
+    props.registerChats?.(() => state.chats)
     onCleanup(() => {
       props.registerNewSession?.(undefined)
       props.registerRename?.(undefined)
+      props.registerChats?.(undefined)
     })
   })
   onCleanup(() => {

+ 41 - 0
packages/app/src/pages/paas/file-groups.test.ts

@@ -0,0 +1,41 @@
+import { expect, test } from "bun:test"
+import { groupPaasFiles, paasFileCategory } from "./file-groups"
+
+test("folds scripts, configs and logs but keeps research documents visible", () => {
+  const groups = groupPaasFiles([
+    { name: "report.md" },
+    { name: "figure.png" },
+    { name: "dataset.csv" },
+    { name: "analyze.py" },
+    { name: "run.sh" },
+    { name: "train.ipynb" },
+    { name: "config.yml" },
+    { name: "trace.json" },
+    { name: "trace.json" },
+  ])
+  expect(groups.files.map((file) => file.name)).toEqual([
+    "report.md",
+    "figure.png",
+    "dataset.csv",
+    "analyze.py",
+    "run.sh",
+    "train.ipynb",
+    "config.yml",
+    "trace.json",
+  ])
+  expect(groups.previewable.map((file) => file.name)).toEqual(["report.md", "figure.png", "dataset.csv"])
+  expect(groups.technical.map((file) => file.name)).toEqual([
+    "analyze.py",
+    "run.sh",
+    "train.ipynb",
+    "config.yml",
+    "trace.json",
+  ])
+})
+
+test("exposes code as its own artifact category", () => {
+  expect(paasFileCategory({ name: "analyze.py" })).toBe("code")
+  expect(paasFileCategory({ name: "run.sh" })).toBe("code")
+  expect(paasFileCategory({ name: "dataset.csv" })).toBe("data")
+  expect(paasFileCategory({ name: "report.md" })).toBe("document")
+})

+ 56 - 2
packages/app/src/pages/paas/file-groups.ts

@@ -8,8 +8,51 @@ export type PaasGeneratedFile = {
   size?: number
 }
 
+export type PaasFileCategory = "document" | "image" | "data" | "code" | "other"
+
 const technicalExtensions = new Set(["json", "jsonl", "yaml", "yml", "toml", "ini", "cfg", "log", "lock"])
 
+const codeExtensions = new Set([
+  "py",
+  "pyw",
+  "ipynb",
+  "sh",
+  "bash",
+  "zsh",
+  "ps1",
+  "bat",
+  "cmd",
+  "js",
+  "jsx",
+  "mjs",
+  "cjs",
+  "ts",
+  "tsx",
+  "r",
+  "rb",
+  "go",
+  "rs",
+  "c",
+  "h",
+  "cc",
+  "cpp",
+  "cxx",
+  "hpp",
+  "java",
+  "kt",
+  "swift",
+  "php",
+  "lua",
+  "pl",
+  "sql",
+  "css",
+  "scss",
+])
+
+const dataCategoryExtensions = new Set([...technicalExtensions, "csv", "tsv"])
+
+const extension = (name: string) => name.split(".").pop()?.toLocaleLowerCase()
+
 export function groupPaasFiles<T extends { name: string; mime?: string }>(files: T[]) {
   const unique = Array.from(new Map(files.map((file) => [file.name.trim().toLocaleLowerCase(), file])).values())
   const technical = unique.filter((file) => isTechnicalFile(file))
@@ -20,10 +63,21 @@ export function groupPaasFiles<T extends { name: string; mime?: string }>(files:
   }
 }
 
+export function paasFileCategory(file: { name: string; mime?: string }): PaasFileCategory {
+  const kind = paasPreviewKind(file.name, file.mime || "")
+  if (kind === "image") return "image"
+  const value = extension(file.name)
+  if (value && codeExtensions.has(value)) return "code"
+  if (value && dataCategoryExtensions.has(value)) return "data"
+  if (kind === "markdown" || kind === "pdf" || kind === "text") return "document"
+  return "other"
+}
+
 function isTechnicalFile(file: { name: string; mime?: string }) {
-  const extension = file.name.split(".").pop()?.toLocaleLowerCase()
+  const value = extension(file.name)
   return (
-    (!!extension && technicalExtensions.has(extension)) ||
+    (!!value && technicalExtensions.has(value)) ||
+    (!!value && codeExtensions.has(value)) ||
     paasPreviewKind(file.name, file.mime || "") === "unsupported"
   )
 }

+ 1 - 1
packages/app/src/pages/paas/generated-files.tsx

@@ -119,7 +119,7 @@ export function PaasGeneratedFiles(props: {
         <Show when={groups().technical.length}>
           <details class="paas-file-technical">
             <summary>技术文件 · {groups().technical.length}</summary>
-            <p class="paas-muted">JSON、YAML、日志与中间产物;展开后仍可预览或保存。</p>
+            <p class="paas-muted">JSON、YAML、日志、代码脚本与中间产物;展开后仍可预览或保存。</p>
             <For each={groups().technical}>{card}</For>
           </details>
         </Show>

+ 1 - 1
packages/app/src/pages/paas/illustration.css

@@ -83,7 +83,7 @@
   margin-top: 12px;
 }
 .paas-conversation-empty > :is(.paas-composer, .paas-suggestions) {
-  max-width: 860px;
+  max-width: 830px;
 }
 .paas-conversation > .paas-suggestions {
   margin-top: 20px;

+ 26 - 2
packages/app/src/pages/paas/index.tsx

@@ -29,6 +29,8 @@ import {
 } from "./layout"
 import { PaasPreview, clearPreviewCache, type PaasPreviewFile } from "./preview"
 import { PaasChat } from "./chat"
+import type { ResearchChat } from "./chat-state"
+import { PaasArtifacts } from "./artifacts"
 import { groupAgents, resolveAgentProfile } from "./agent-profiles"
 import { ProjectSwitcher } from "./project-switcher"
 import { bindProjectWorkspace, newProject, readProjectState, writeProjectState } from "./projects"
@@ -51,6 +53,7 @@ const pages = [
   { id: "applications", icon: "knowledge", name: "应用与插件" },
   { id: "agents", icon: "agent", name: "智能体" },
   { id: "tasks", icon: "tasks", name: "平台任务" },
+  { id: "artifacts", icon: "evidence", name: "成果" },
   { id: "connection", icon: "settings", name: "平台设置" },
 ] as const
 
@@ -134,6 +137,7 @@ export default function PaasWorkspace(
   const [actionsMount, setActionsMount] = createSignal<HTMLDivElement>()
   const [inboxMount, setInboxMount] = createSignal<HTMLElement>()
   const actions: { newSession?: () => void; rename?: (title: string) => void } = {}
+  let chatsAccessor: (() => ResearchChat[]) | undefined
   let navToggle: HTMLButtonElement | undefined
   let navElement: HTMLElement | undefined
   const saveNavLayout = () => {
@@ -398,7 +402,7 @@ export default function PaasWorkspace(
     props.onCloseDeveloper?.()
     setUI("navOpen", false)
     workspace.setState("page", page)
-    if (page === "tasks") void tasks.refresh()
+    if (page === "tasks" || page === "artifacts") void tasks.refresh()
   }
   props.registerMenuCommand?.((id) => {
     if (id === "settings.open") {
@@ -1019,6 +1023,7 @@ export default function PaasWorkspace(
               inboxTasks={() => tasks.state.rows}
               registerNewSession={(create) => (actions.newSession = create)}
               registerRename={(rename) => (actions.rename = rename)}
+              registerChats={(get) => (chatsAccessor = get)}
               onTitle={(title) => setUI("chatTitle", title)}
               onPreviewFile={openPreview}
               previewFile={previewFile()}
@@ -1358,6 +1363,25 @@ export default function PaasWorkspace(
                 onNewResearch={() => actions.newSession?.()}
               />
             </Match>
+
+            <Match when={state.page === "artifacts"}>
+              <PaasArtifacts
+                api={platform.paas}
+                connected={state.connected}
+                scope={state.scope}
+                projectID={projects.activeID}
+                projectName={activeProject()?.name || "我的研究"}
+                chats={() => chatsAccessor?.() ?? []}
+                tasks={() => tasks.state.rows}
+                agents={state.agents}
+                onOpenRun={(run) => {
+                  setUI("chatTask", run.task || { run_id: run.runID, agent_id: run.agentID })
+                  workspace.setState("page", "chat")
+                }}
+                onPreview={openPreview}
+                onNewResearch={() => actions.newSession?.()}
+              />
+            </Match>
             <Match when={state.page === "resources"}>
               {settingsTabs()}
               <div
@@ -1536,7 +1560,7 @@ export default function PaasWorkspace(
           </Switch>
         </div>
       </main>
-      <Show when={!props.developerActive && state.page === "chat" && previewOpen()}>
+      <Show when={!props.developerActive && (state.page === "chat" || state.page === "artifacts") && previewOpen()}>
         <div
           class="paas-splitter paas-splitter-preview"
           role="separator"

+ 72 - 0
packages/app/src/pages/paas/run-inspector-data.test.ts

@@ -0,0 +1,72 @@
+import { expect, test } from "bun:test"
+import { readRunInspector } from "./run-inspector-data"
+
+test("normalizes stages and events with honest missing values", () => {
+  const data = readRunInspector({
+    events: [
+      { sequence: 2, event_type: "tool_call", stage_id: "collect", data: { tool: "Bash", content: "pwd" }, created_at: "2026-11-30T10:00:02Z" },
+      { sequence: 1, event_type: "started", stage_id: "", data: {}, created_at: "2026-11-30T10:00:00Z" },
+      { sequence: 3, event_type: "tool_result", stage_id: "collect", data: { content: "done" }, created_at: "2026-11-30T10:00:03Z" },
+      null,
+    ],
+    stages: [
+      {
+        stage_id: "collect",
+        status: "completed",
+        details: { round: 1 },
+        started_at: "2026-11-30T10:00:00Z",
+        completed_at: "2026-11-30T10:00:05Z",
+      },
+      { stage_id: "", status: "running" },
+    ],
+  })
+  expect(data.stages).toEqual([
+    {
+      id: "collect",
+      status: "completed",
+      startedAt: "2026-11-30T10:00:00Z",
+      completedAt: "2026-11-30T10:00:05Z",
+      durationMs: 5000,
+      details: { round: 1 },
+    },
+    {
+      id: "",
+      status: "running",
+      startedAt: "",
+      completedAt: "",
+      durationMs: undefined,
+      details: {},
+    },
+  ])
+  expect(data.events).toEqual([
+    {
+      sequence: 1,
+      type: "started",
+      stageID: "",
+      at: "2026-11-30T10:00:00Z",
+      detail: "",
+      data: {},
+    },
+    {
+      sequence: 2,
+      type: "tool_call",
+      stageID: "collect",
+      at: "2026-11-30T10:00:02Z",
+      detail: "pwd",
+      data: { tool: "Bash", content: "pwd" },
+    },
+    {
+      sequence: 3,
+      type: "tool_result",
+      stageID: "collect",
+      at: "2026-11-30T10:00:03Z",
+      detail: "done",
+      data: { content: "done" },
+    },
+  ])
+})
+
+test("bad payloads become empty inspector data", () => {
+  expect(readRunInspector(undefined)).toEqual({ stages: [], events: [] })
+  expect(readRunInspector({ stages: "bad", events: {} })).toEqual({ stages: [], events: [] })
+})

+ 68 - 0
packages/app/src/pages/paas/run-inspector-data.ts

@@ -0,0 +1,68 @@
+import { paasRecord, paasText } from "@/paas"
+
+export type InspectorStage = {
+  id: string
+  status: string
+  startedAt: string
+  completedAt: string
+  durationMs?: number
+  details: Record<string, unknown>
+}
+
+export type InspectorEvent = {
+  sequence: number
+  type: string
+  stageID: string
+  at: string
+  detail: string
+  data: Record<string, unknown>
+}
+
+function duration(startedAt: string, completedAt: string) {
+  const start = Date.parse(startedAt)
+  const end = Date.parse(completedAt)
+  if (!Number.isFinite(start) || !Number.isFinite(end) || end < start) return undefined
+  return end - start
+}
+
+export function readRunInspector(input: unknown) {
+  const record = paasRecord(input)
+  const rawStages = Array.isArray(record?.stages) ? record.stages : []
+  const rawEvents = Array.isArray(record?.events) ? record.events : []
+  const stages = rawStages.flatMap((value): InspectorStage[] => {
+    const stage = paasRecord(value)
+    if (!stage) return []
+    const startedAt = paasText(stage.started_at)
+    const completedAt = paasText(stage.completed_at)
+    return [
+      {
+        id: paasText(stage.stage_id),
+        status: paasText(stage.status) || "unknown",
+        startedAt,
+        completedAt,
+        durationMs: duration(startedAt, completedAt),
+        details: paasRecord(stage.details) || {},
+      },
+    ]
+  })
+  const events = rawEvents
+    .flatMap((value): InspectorEvent[] => {
+      const event = paasRecord(value)
+      if (!event) return []
+      const sequence = typeof event.sequence === "number" ? event.sequence : Number(event.sequence)
+      if (!Number.isFinite(sequence)) return []
+      const data = paasRecord(event.data) || {}
+      return [
+        {
+          sequence,
+          type: paasText(event.event_type) || "unknown",
+          stageID: paasText(event.stage_id),
+          at: paasText(event.created_at),
+          detail: paasText(data.content) || paasText(data.message) || paasText(data.summary),
+          data,
+        },
+      ]
+    })
+    .sort((a, b) => a.sequence - b.sequence)
+  return { stages, events }
+}

+ 216 - 0
packages/app/src/pages/paas/run-inspector.tsx

@@ -0,0 +1,216 @@
+import { For, Show, createEffect, createMemo, createSignal, on, onCleanup } from "solid-js"
+import { paasRecord, paasText, type PaasPlatform } from "@/paas"
+import { readRunInspector, type InspectorEvent } from "./run-inspector-data"
+
+const eventLabels: Record<string, string> = {
+  started: "开始",
+  done: "完成",
+  error: "错误",
+  tool_call: "工具调用",
+  tool_result: "工具结果",
+  progress: "进度",
+  approval_required: "等待确认",
+}
+
+const stageLabels: Record<string, string> = {
+  completed: "已完成",
+  running: "进行中",
+  failed: "失败",
+  cancelled: "已取消",
+  pending: "等待中",
+}
+
+const duration = (value?: number) => {
+  if (value === undefined) return ""
+  if (value < 1000) return `${value} ms`
+  return `${(value / 1000).toFixed(value < 10000 ? 1 : 0)} 秒`
+}
+
+const usage = (run: Record<string, unknown>) => paasRecord(run.usage) || {}
+
+function eventLabel(event: InspectorEvent) {
+  return eventLabels[event.type] || event.type
+}
+
+export function RunInspector(props: {
+  api: PaasPlatform
+  agentID: string
+  runID: string
+  run: Record<string, unknown>
+}) {
+  const [state, setState] = createSignal({
+    source: "projection" as "projection" | "service",
+    loading: false,
+    loaded: false,
+    error: "",
+    data: { stages: [], events: [] } as ReturnType<typeof readRunInspector>,
+  })
+  let request = 0
+  let root: HTMLDetailsElement | undefined
+  onCleanup(() => request++)
+
+  const metrics = createMemo(() => {
+    const value = usage(props.run)
+    const data = state().data
+    return {
+      stages: data.stages.length,
+      events: data.events.length,
+      duration: typeof value.duration_ms === "number" ? value.duration_ms : undefined,
+      cost: typeof value.cost_usd === "number" ? value.cost_usd : undefined,
+    }
+  })
+
+  createEffect(
+    on(
+      () => props.runID,
+      () => {
+        request++
+        setState({
+          source: "projection",
+          loading: false,
+          loaded: false,
+          error: "",
+          data: { stages: [], events: [] },
+        })
+        if (root?.open) void load()
+      },
+      { defer: true },
+    ),
+  )
+
+  const load = async (source: "projection" | "service" = "projection") => {
+    const current = ++request
+    setState((value) => ({ ...value, source, loading: true, loaded: false, error: "" }))
+    try {
+      const result = await props.api.request({
+        action: "run-events",
+        agentID: props.agentID,
+        runID: props.runID,
+        source,
+      })
+      if (current !== request) return
+      setState((value) => ({ ...value, loading: false, loaded: true, data: readRunInspector(result) }))
+    } catch (error) {
+      if (current !== request) return
+      setState((value) => ({
+        ...value,
+        loading: false,
+        loaded: false,
+        error: error instanceof Error ? error.message : "执行事件读取失败。",
+      }))
+    }
+  }
+
+  return (
+    <details
+      ref={root}
+      class="paas-run-inspector"
+      onToggle={(event) => {
+        if (event.currentTarget.open && !state().loaded && !state().loading) void load()
+      }}
+    >
+      <summary>
+        执行检查器
+        <span>
+          {metrics().stages ? `${metrics().stages} 阶段` : "阶段"} · {metrics().events || 0} 事件
+        </span>
+      </summary>
+      <div class="paas-inspector-body">
+        <div class="paas-inspector-metrics">
+          <span>
+            阶段<strong>{metrics().stages}</strong>
+          </span>
+          <span>
+            事件<strong>{metrics().events}</strong>
+          </span>
+          <Show when={metrics().duration !== undefined}>
+            <span>
+              时长<strong>{duration(metrics().duration)}</strong>
+            </span>
+          </Show>
+          <Show when={metrics().cost !== undefined}>
+            <span>
+              成本<strong>${metrics().cost!.toFixed(4)}</strong>
+            </span>
+          </Show>
+          <span>
+            来源<strong>{state().source === "service" ? "执行服务" : "平台投影"}</strong>
+          </span>
+        </div>
+        <Show when={state().loading}>
+          <p class="paas-muted" role="status">
+            正在读取执行事件…
+          </p>
+        </Show>
+        <Show when={state().error}>
+          <div class="paas-notice" role="alert">
+            <strong>执行事件读取失败</strong>
+            <p>{state().error}</p>
+            <button type="button" onClick={() => void load(state().source)}>
+              重试读取
+            </button>
+          </div>
+        </Show>
+        <Show when={state().loaded && !state().error}>
+          <Show when={state().data.stages.length}>
+            <section class="paas-inspector-section" aria-label="执行阶段">
+              <h3>阶段</h3>
+              <ol class="paas-inspector-stages">
+                <For each={state().data.stages}>
+                  {(stage) => (
+                    <li data-status={stage.status}>
+                      <div>
+                        <strong>{stage.id || "未命名阶段"}</strong>
+                        <span>{stageLabels[stage.status] || stage.status}</span>
+                        <small>{duration(stage.durationMs)}</small>
+                      </div>
+                      <Show when={Object.keys(stage.details).length}>
+                        <details>
+                          <summary>技术详情</summary>
+                          <pre>{JSON.stringify(stage.details, null, 2)}</pre>
+                        </details>
+                      </Show>
+                    </li>
+                  )}
+                </For>
+              </ol>
+            </section>
+          </Show>
+          <Show when={state().data.events.length}>
+            <section class="paas-inspector-section" aria-label="执行事件">
+              <h3>事件</h3>
+              <ol class="paas-inspector-events">
+                <For each={state().data.events.slice(-100)}>
+                  {(event) => (
+                    <li data-type={event.type}>
+                      <span>{eventLabel(event)}</span>
+                      <strong>{event.stageID || event.detail || `#${event.sequence}`}</strong>
+                      <Show when={event.detail && event.stageID}>
+                        <small>{event.detail}</small>
+                      </Show>
+                      <time>{event.at}</time>
+                    </li>
+                  )}
+                </For>
+              </ol>
+            </section>
+          </Show>
+          <Show when={!state().data.stages.length && !state().data.events.length}>
+            <p class="paas-muted">平台未返回阶段或事件记录;这不表示任务没有执行。</p>
+          </Show>
+        </Show>
+        <div class="paas-inspector-actions">
+          <button type="button" disabled={state().loading} onClick={() => void load("projection")}>
+            刷新平台投影
+          </button>
+          <button type="button" disabled={state().loading} onClick={() => void load("service")}>
+            回放执行服务日志
+          </button>
+        </div>
+        <Show when={paasText(props.run.checkpoint_id)}>
+          <p class="paas-muted">最近恢复点:{paasText(props.run.checkpoint_id)}</p>
+        </Show>
+      </div>
+    </details>
+  )
+}

+ 4 - 2
packages/app/src/pages/paas/run-panel.tsx

@@ -1,6 +1,7 @@
 import { For, Show, createEffect, createMemo, on, onCleanup } from "solid-js"
 import { ResearchReport } from "./report"
 import { ResearchProgress } from "./progress"
+import { RunInspector } from "./run-inspector"
 import { ResearchIssue } from "./issue"
 import { usePlatform } from "@/context/platform"
 import { createStore, reconcile } from "solid-js/store"
@@ -334,6 +335,7 @@ export function PaasRunPanel(props: {
         </p>
       </Show>
       <ResearchProgress run={state.run} />
+      <RunInspector api={props.api} agentID={props.agentID} runID={props.runID} run={state.run} />
       <Show when={state.busy}>
         <p role="status">{state.busy}…</p>
       </Show>
@@ -425,7 +427,7 @@ export function PaasRunPanel(props: {
           <Show when={artifactGroups().technical.length}>
             <details class="paas-run-technical">
               <summary>技术文件 · {artifactGroups().technical.length}</summary>
-              <p class="paas-muted">JSON、YAML、日志与中间产物;展开后仍可预览或保存。</p>
+              <p class="paas-muted">JSON、YAML、日志、代码脚本与中间产物;展开后仍可预览或保存。</p>
               <For each={artifactGroups().technical}>{artifactRow}</For>
             </details>
           </Show>
@@ -460,7 +462,7 @@ export function PaasRunPanel(props: {
         <Show when={workFileGroups().technical.length}>
           <details class="paas-run-technical">
             <summary>技术文件 · {workFileGroups().technical.length}</summary>
-            <p class="paas-muted">JSON、YAML、日志与中间产物;展开后仍可预览或保存。</p>
+            <p class="paas-muted">JSON、YAML、日志、代码脚本与中间产物;展开后仍可预览或保存。</p>
             <For each={workFileGroups().technical}>{workFileRow}</For>
           </details>
         </Show>

+ 310 - 0
packages/app/src/pages/paas/studio.css

@@ -352,6 +352,200 @@
 .paas-task-page tbody tr:hover {
   background: var(--background-weak);
 }
+.paas-artifact-counts {
+  display: flex;
+  flex-wrap: wrap;
+  align-items: center;
+  gap: 10px;
+  padding: 0 0 8px;
+}
+.paas-artifact-counts > span {
+  background: var(--background-weak);
+  border-radius: 20px;
+  padding: 5px 12px;
+  font-size: var(--paas-type-caption);
+}
+.paas-artifact-counts > small {
+  margin-left: auto;
+  color: var(--text-weak);
+  font-variant-numeric: tabular-nums;
+}
+.paas-artifact-toolbar {
+  display: grid;
+  grid-template-columns: minmax(0, 1fr) auto;
+  gap: 16px;
+  align-items: end;
+  margin: 16px 0 20px;
+}
+.paas-artifact-toolbar > label {
+  display: flex;
+  flex-direction: column;
+  gap: 6px;
+  min-width: 0;
+  color: var(--text-weak);
+  font-size: var(--paas-type-caption);
+}
+.paas-artifact-toolbar input {
+  width: 100%;
+  padding: 9px 12px;
+  border: 1px solid var(--border-weak-base);
+  border-radius: 10px;
+  background: var(--background-base);
+  color: var(--text-base);
+  font: inherit;
+  font-size: var(--paas-type-body);
+}
+.paas-artifact-filter {
+  display: flex;
+  flex-wrap: wrap;
+  gap: 6px;
+}
+.paas-artifact-filter button {
+  border-radius: 999px;
+  padding: 6px 12px;
+  font-size: var(--paas-type-caption);
+  background: var(--background-base);
+}
+.paas-artifact-filter button[aria-pressed="true"] {
+  background: var(--paas-accent);
+  border-color: var(--paas-accent);
+  color: var(--paas-accent-contrast);
+}
+.paas-artifact-page > .paas-muted {
+  margin: 0 0 12px;
+  font-size: var(--paas-type-meta);
+}
+.paas-artifact-groups {
+  display: flex;
+  flex-direction: column;
+  gap: 18px;
+}
+.paas-artifact-group {
+  border: 1px solid var(--border-weak-base);
+  border-radius: 14px;
+  background: var(--paas-surface);
+  overflow: hidden;
+}
+.paas-artifact-group > header {
+  display: flex;
+  align-items: center;
+  justify-content: space-between;
+  gap: 12px;
+  padding: 13px 16px;
+  border-bottom: 1px solid var(--border-weak-base);
+  background: var(--background-weak);
+}
+.paas-artifact-group > header > div {
+  display: flex;
+  flex-direction: column;
+  gap: 2px;
+  min-width: 0;
+}
+.paas-artifact-group > header strong {
+  font-size: var(--paas-type-body);
+  overflow: hidden;
+  text-overflow: ellipsis;
+  white-space: nowrap;
+}
+.paas-artifact-group > header span {
+  color: var(--text-weak);
+  font-size: var(--paas-type-meta);
+}
+.paas-artifact-group > header > button {
+  flex-shrink: 0;
+  padding: 5px 11px;
+  font-size: var(--paas-type-meta);
+}
+.paas-artifact-group > ul {
+  display: flex;
+  flex-direction: column;
+  margin: 0;
+  padding: 0;
+  list-style: none;
+}
+.paas-artifact-row {
+  display: grid;
+  grid-template-columns: auto minmax(0, 1fr) auto;
+  align-items: center;
+  gap: 12px;
+  padding: 10px 16px;
+  border-top: 1px solid var(--border-weak-base);
+}
+.paas-artifact-row:first-child {
+  border-top: 0;
+}
+.paas-artifact-kind {
+  min-width: 42px;
+  padding: 3px 7px;
+  border-radius: 6px;
+  background: var(--background-weak);
+  color: var(--text-weak);
+  font-size: 11px;
+  text-align: center;
+}
+.paas-artifact-kind[data-category="document"] {
+  background: color-mix(in srgb, var(--paas-accent) 10%, transparent);
+  color: var(--paas-accent);
+}
+.paas-artifact-kind[data-category="image"] {
+  background: color-mix(in srgb, #88d8bc 24%, transparent);
+  color: light-dark(#1f6b55, #9fe5cc);
+}
+.paas-artifact-kind[data-category="data"] {
+  background: color-mix(in srgb, #ffd06c 28%, transparent);
+  color: light-dark(#8a6212, #f2cf86);
+}
+.paas-artifact-kind[data-category="code"] {
+  background: color-mix(in srgb, #b9a7f2 26%, transparent);
+  color: light-dark(#5b3f9b, #cdbdf5);
+}
+.paas-artifact-name {
+  display: flex;
+  flex-direction: column;
+  gap: 2px;
+  min-width: 0;
+}
+.paas-artifact-name strong {
+  font-size: var(--paas-type-caption);
+  font-weight: 600;
+  overflow: hidden;
+  text-overflow: ellipsis;
+  white-space: nowrap;
+}
+.paas-artifact-name small {
+  color: var(--text-weak);
+  font-size: var(--paas-type-meta);
+  overflow: hidden;
+  text-overflow: ellipsis;
+  white-space: nowrap;
+}
+.paas-artifact-actions {
+  display: flex;
+  gap: 6px;
+}
+.paas-artifact-actions button {
+  padding: 5px 10px;
+  font-size: var(--paas-type-meta);
+  white-space: nowrap;
+}
+.paas-artifact-more {
+  border-top: 1px solid var(--border-weak-base);
+}
+.paas-artifact-more > summary {
+  padding: 10px 16px;
+  color: var(--text-weak);
+  font-size: var(--paas-type-meta);
+  cursor: pointer;
+}
+.paas-artifact-more > .paas-muted {
+  margin: 0;
+  padding: 0 16px 12px;
+  font-size: var(--paas-type-meta);
+}
+.paas-artifact-page > .paas-task-empty {
+  display: flex;
+  flex-direction: column;
+}
 .paas-edit-footer {
   padding-block: 16px;
 }
@@ -607,6 +801,21 @@
   .paas-task-page > .paas-toolbar > label:first-child {
     grid-column: 1 / -1;
   }
+  .paas-artifact-toolbar {
+    grid-template-columns: minmax(0, 1fr);
+    gap: 12px;
+  }
+  .paas-artifact-counts > small {
+    flex-basis: 100%;
+    margin-left: 0;
+  }
+  .paas-artifact-row {
+    grid-template-columns: auto minmax(0, 1fr);
+    row-gap: 8px;
+  }
+  .paas-artifact-actions {
+    grid-column: 2;
+  }
   .paas-task-counts > small {
     flex-basis: 100%;
     margin-left: 0;
@@ -1046,4 +1255,105 @@
   border-color: light-dark(#bc665a, #df8e7f);
 }
 
+/* Run Inspector: real stages/events only, with advanced replay kept secondary. */
+.paas-run-inspector {
+  margin-top: 18px;
+  border-top: 1px solid var(--border-weak-base);
+  padding-top: 14px;
+}
+.paas-run-inspector > summary {
+  display: flex;
+  align-items: baseline;
+  justify-content: space-between;
+  gap: 12px;
+  width: 100%;
+  color: var(--text-base);
+  font-size: var(--paas-type-caption);
+}
+.paas-run-inspector > summary span {
+  color: var(--text-weak);
+  font-size: var(--paas-type-meta);
+}
+.paas-inspector-body {
+  display: grid;
+  gap: 14px;
+  margin-top: 14px;
+}
+.paas-inspector-metrics {
+  display: flex;
+  flex-wrap: wrap;
+  gap: 8px 18px;
+  color: var(--text-weak);
+  font-size: var(--paas-type-meta);
+}
+.paas-inspector-metrics span {
+  display: inline-flex;
+  align-items: baseline;
+  gap: 5px;
+}
+.paas-inspector-metrics strong {
+  color: var(--text-base);
+  font-size: var(--paas-type-caption);
+}
+.paas-inspector-section h3 {
+  margin: 0 0 8px;
+  font-size: var(--paas-type-caption);
+}
+.paas-inspector-stages,
+.paas-inspector-events {
+  display: grid;
+  gap: 6px;
+  margin: 0;
+  padding: 0;
+  list-style: none;
+}
+.paas-inspector-stages > li,
+.paas-inspector-events > li {
+  min-width: 0;
+  padding: 8px 10px;
+  border: 1px solid var(--border-weak-base);
+  border-radius: 8px;
+  background: var(--background-base);
+}
+.paas-inspector-stages > li > div {
+  display: flex;
+  align-items: baseline;
+  gap: 8px;
+}
+.paas-inspector-stages > li span,
+.paas-inspector-stages > li small,
+.paas-inspector-events > li > span,
+.paas-inspector-events > li > time {
+  color: var(--text-weak);
+  font-size: var(--paas-type-meta);
+}
+.paas-inspector-stages > li small,
+.paas-inspector-events > li > time {
+  margin-left: auto;
+}
+.paas-inspector-events > li {
+  display: grid;
+  grid-template-columns: auto minmax(0, 1fr) auto;
+  gap: 4px 10px;
+  align-items: baseline;
+}
+.paas-inspector-events > li > strong,
+.paas-inspector-events > li > small {
+  min-width: 0;
+  overflow-wrap: anywhere;
+}
+.paas-inspector-events > li > small {
+  grid-column: 2;
+  color: var(--text-weak);
+  font-size: var(--paas-type-meta);
+}
+.paas-inspector-stages > li pre {
+  max-height: 220px;
+}
+.paas-inspector-actions {
+  display: flex;
+  flex-wrap: wrap;
+  gap: 8px;
+}
+
 }

+ 33 - 0
packages/desktop/src/main/paas.test.ts

@@ -375,6 +375,39 @@ test("task controls, input files and downloads use the authenticated platform ro
   }
 })
 
+test("run inspector events use the authenticated event route", async () => {
+  const requests: string[] = []
+  const server = Bun.serve({
+    port: 0,
+    hostname: "127.0.0.1",
+    fetch(request) {
+      const url = new URL(request.url)
+      if (url.pathname.endsWith("/auth/me")) return new Response("missing", { status: 404 })
+      expect(request.headers.get("Authorization")).toBe("Bearer test-only")
+      requests.push(`${url.pathname}${url.search}`)
+      if (url.pathname.endsWith("/agents")) return Response.json({ agents: [] })
+      return Response.json({ run_id: "r", events: [], stages: [] })
+    },
+  })
+  const connections = createPaasConnections()
+  try {
+    await connections.connect(1, { url: server.url.origin, apiKey: "test-only" })
+    await connections.request(1, {
+      action: "run-events",
+      agentID: "a",
+      runID: "r",
+      after: 4,
+      source: "service",
+    })
+    expect(requests.at(-1)).toBe("/api/v1/agents/a/runs/r/events?after=4&source=service")
+    await expect(
+      connections.request(1, { action: "run-events", agentID: "a", runID: "r", after: -1 }),
+    ).rejects.toThrow("事件游标无效")
+  } finally {
+    await server.stop(true)
+  }
+})
+
 test("detaching closes only the subscription and keeps the backend job alive", async () => {
   const started = Promise.withResolvers<void>()
   const requests: string[] = []

+ 13 - 1
packages/desktop/src/main/paas.ts

@@ -312,10 +312,22 @@ export function createPaasConnections(fetcher: typeof fetch = fetch) {
             : undefined,
         )
       }
-      if (["run-files", "download", "preview-file", "cancel", "pause", "resume", "confirm"].includes(input?.action)) {
+      if (
+        ["run-files", "run-events", "download", "preview-file", "cancel", "pause", "resume", "confirm"].includes(
+          input?.action,
+        )
+      ) {
         if (!("agentID" in input) || !("runID" in input)) throw new Error("缺少任务编号。")
         const path = `/agents/${identifier(input.agentID)}/runs/${identifier(input.runID)}`
         if (input.action === "run-files") return request(connection, `${path}/workspace`)
+        if (input.action === "run-events") {
+          if (input.after !== undefined && (!Number.isSafeInteger(input.after) || input.after < 0))
+            throw new Error("事件游标无效。")
+          const query = new URLSearchParams()
+          if (input.after !== undefined) query.set("after", String(input.after))
+          if (input.source) query.set("source", input.source)
+          return request(connection, `${path}/events${query.size ? `?${query}` : ""}`)
+        }
         if (input.action === "preview-file") {
           if (!input.path && !input.artifactID) throw new Error("缺少文件路径。")
           const resource = input.artifactID