docs(tasks): 工作图打磨的设计文档与真机验证证据;卡片细节两处修正

- 新增 docs/plans/2026-09-27-tasks-graph-polish.md:本轮问答结论、架构与文件、
  关键设计(卡片两段 / 合并活动 / 扫光 / 折叠聚合 / ctx.jobs / 布局与窄栏)、
  移植与丢弃清单、实施偏差记录、验证证据(含 3080 真机逐项目击记录与截图路径)、
  未在真机复现的两项与已知取舍。
- 2026-09-14 图分支设计文档加「本轮打磨」小节指向新文档;README 任务页条目
  与 AGENTS §1/§3.1#4 同步(后台任务改读宿主客户端 ctx.jobs,不再自建回放路由)。
- 卡片两处修正(真机截图暴露):
  ① 小条的钩子从 `data-state` 改为 `data-card-bar` —— 宿主自己的 primitive 也在
     发 `data-state`(菜单分隔、编辑器等),同名属性让「卡片内恰好一条小条」的
     断言与用户 CSS 都不可靠;
  ② 上段的 mono 行改由新的 `agentIdentity()` 产出(只讲「是谁」),根节点返回空
     —— 原先复用 `agentMeta()` 会把状态词印两遍(徽章下方 + 小条),正是用户
     反馈的「节点内信息太密」。可访问名继续用含状态的 `agentMeta()`。

验证:typecheck / lint 通过;pnpm test 1240 passed / 9 skipped;
挂载 lane 7/7(真实 DSH 0.1.7-rc.2);3080 真机自测通过(见文档表格)。

(cherry picked from commit 338a54820799c26ab91141e8d98c673b8d474610)
This commit is contained in:
Menghuan1918
2026-09-27 22:18:49 +08:00
parent 48294d336e
commit 5ea2f2d6ec
7 changed files with 210 additions and 11 deletions
+4 -4
View File
@@ -597,7 +597,7 @@ describe('Tasks page: the shared task window', () => {
expect(child.getAttribute('data-depth')).toBe('1')
expect(child.textContent).toContain('子代理')
// Both segments are present: the identity block and the state bar.
const bar = child.querySelector('[data-state]') as HTMLElement
const bar = child.querySelector('[data-card-bar]') as HTMLElement
expect(bar).not.toBeNull()
expect(bar.textContent).toContain('已完成')
unmount()
@@ -620,13 +620,13 @@ describe('Tasks page: the shared task window', () => {
const foldToggle = container.querySelector('button[aria-label="展开已完成的节点"]') as HTMLButtonElement
await act(async () => { foldToggle.click() })
const child = container.querySelector('[data-graph-node="child-0"]') as HTMLElement
const bar = child.querySelector('[data-state]') as HTMLElement
const bar = child.querySelector('[data-card-bar]') as HTMLElement
expect(bar.getAttribute('data-running')).toBe('true')
// The merged activity wording comes from the plugin's own copy when the
// host's chat namespace is absent (this harness attaches no locale).
expect(bar.textContent).toBeTruthy()
const settled = container.querySelector('[data-graph-node="child-1"]') as HTMLElement
expect(settled.querySelector('[data-state]')?.getAttribute('data-running')).toBeNull()
expect(settled.querySelector('[data-card-bar]')?.getAttribute('data-running')).toBeNull()
unmount()
})
@@ -702,7 +702,7 @@ describe('Tasks page: the shared task window', () => {
const runNode = container.querySelector('[data-graph-node="run:run-1"]') as HTMLElement
expect(runNode).not.toBeNull()
expect(runNode.textContent).toContain('工作流')
expect(runNode.querySelector('[data-state]')).not.toBeNull()
expect(runNode.querySelector('[data-card-bar]')).not.toBeNull()
// Each member card carries ITS phase badge (the second grouping axis).
const first = container.querySelector('[data-graph-node="m1"]') as HTMLElement
const second = container.querySelector('[data-graph-node="m2"]') as HTMLElement