From 10029b995fc0236c8880e836c2853094ad36ce79 Mon Sep 17 00:00:00 2001 From: _Kerman Date: Thu, 10 Sep 2026 17:18:38 +0800 Subject: [PATCH 01/75] feat(web): add compact details to recorded tool rows --- ...client-derived-tool-presentation.i18n.yaml | 4 +- ...-08-23-client-derived-tool-presentation.md | 4 +- ...-23-client-derived-tool-presentation.zh.md | 4 +- .../2026-09-10-compact-tool-details.i18n.yaml | 6 + .../2026-09-10-compact-tool-details.md | 27 + .../2026-09-10-compact-tool-details.zh.md | 27 + apps/web/tests/tool-details.e2e.ts | 83 ++ apps/web/tsconfig.json | 1 + .../ui-conversation/src/client/locales.ts | 372 +++++++++ packages/client/ui-tool/README.i18n.yaml | 4 +- packages/client/ui-tool/README.md | 2 + packages/client/ui-tool/README.zh.md | 2 + packages/client/ui-tool/src/client/apply.ts | 2 + .../tool/components/ToolDetails.module.css | 257 ++++++ .../client/tool/components/ToolDetails.tsx | 134 +++ .../client/tool/components/ToolRow.module.css | 11 + .../src/client/tool/components/ToolRow.tsx | 71 +- .../tool/models/control-details-model.ts | 182 ++++ .../client/tool/models/detail-model-shared.ts | 151 ++++ .../client/tool/models/details-card-model.ts | 145 ++++ .../tool/models/inspection-details-model.ts | 173 ++++ .../src/client/tool/models/todo-diff-model.ts | 76 ++ .../src/client/tool/models/todo-history.ts | 89 ++ .../src/client/tool/toolviews/details-row.tsx | 117 +++ .../src/client/tool/toolviews/todo-row.tsx | 28 +- .../tests/assembly-surfaces.client.spec.tsx | 2 +- .../ui-tool/tests/details-row.client.spec.tsx | 98 +++ .../ui-tool/tests/todo-history.client.spec.ts | 76 ++ .../ui-tool/tests/todo-row.client.spec.tsx | 18 +- .../ui-trajectory/tests/views.client.spec.tsx | 1 + .../src/client/slot-catalog.ts | 1 + snapshots/web/tool-details/session.v3.jsonl | 98 +++ snapshots/web/tool-details/snapshot.yml | 7 + snapshots/web/tool-details/ui.expected.md | 780 ++++++++++++++++++ tsconfig.host.json | 1 + 35 files changed, 3001 insertions(+), 53 deletions(-) create mode 100644 .agents/notes/implemented/architecture/2026-09-10-compact-tool-details.i18n.yaml create mode 100644 .agents/notes/implemented/architecture/2026-09-10-compact-tool-details.md create mode 100644 .agents/notes/implemented/architecture/2026-09-10-compact-tool-details.zh.md create mode 100644 apps/web/tests/tool-details.e2e.ts create mode 100644 packages/client/ui-tool/src/client/tool/components/ToolDetails.module.css create mode 100644 packages/client/ui-tool/src/client/tool/components/ToolDetails.tsx create mode 100644 packages/client/ui-tool/src/client/tool/models/control-details-model.ts create mode 100644 packages/client/ui-tool/src/client/tool/models/detail-model-shared.ts create mode 100644 packages/client/ui-tool/src/client/tool/models/details-card-model.ts create mode 100644 packages/client/ui-tool/src/client/tool/models/inspection-details-model.ts create mode 100644 packages/client/ui-tool/src/client/tool/models/todo-diff-model.ts create mode 100644 packages/client/ui-tool/src/client/tool/models/todo-history.ts create mode 100644 packages/client/ui-tool/src/client/tool/toolviews/details-row.tsx create mode 100644 packages/client/ui-tool/tests/details-row.client.spec.tsx create mode 100644 packages/client/ui-tool/tests/todo-history.client.spec.ts create mode 100644 snapshots/web/tool-details/session.v3.jsonl create mode 100644 snapshots/web/tool-details/snapshot.yml create mode 100644 snapshots/web/tool-details/ui.expected.md diff --git a/.agents/notes/implemented/architecture/2026-08-23-client-derived-tool-presentation.i18n.yaml b/.agents/notes/implemented/architecture/2026-08-23-client-derived-tool-presentation.i18n.yaml index 6f20df4af6..a586d48851 100644 --- a/.agents/notes/implemented/architecture/2026-08-23-client-derived-tool-presentation.i18n.yaml +++ b/.agents/notes/implemented/architecture/2026-08-23-client-derived-tool-presentation.i18n.yaml @@ -2,5 +2,5 @@ # side as of the last confirmed-consistent state. Both languages carry equal authority; # after editing either side, bring the other along and re-record with: # pnpm run verify-translation-pairing --write .agents/notes/implemented/architecture/2026-08-23-client-derived-tool-presentation.md -2026-08-23-client-derived-tool-presentation.md: 6b19dc881d572bfece345cbbd5eca688b2e05aab -2026-08-23-client-derived-tool-presentation.zh.md: 98ada31627398f317e4c41336af56e8c6cf0837e +2026-08-23-client-derived-tool-presentation.md: d41ec5ea8ad3707f98eab3803e0d172c05f58041 +2026-08-23-client-derived-tool-presentation.zh.md: 5dd53cdefda4a5e0efcc047bc81edbbd5f199509 diff --git a/.agents/notes/implemented/architecture/2026-08-23-client-derived-tool-presentation.md b/.agents/notes/implemented/architecture/2026-08-23-client-derived-tool-presentation.md index 6b19dc881d..d41ec5ea8a 100644 --- a/.agents/notes/implemented/architecture/2026-08-23-client-derived-tool-presentation.md +++ b/.agents/notes/implemented/architecture/2026-08-23-client-derived-tool-presentation.md @@ -22,7 +22,7 @@ The required result is one raw Session journal and one Client presentation owner ## Decision -The visual-equivalence requirements below exclude the separately approved [nested terminal-card fix](../bug-fix/2026-09-05-nested-terminal-cards.md); all other presentation and ownership constraints remain. +The visual-equivalence requirements below exclude the separately approved [nested terminal-card fix](../bug-fix/2026-09-05-nested-terminal-cards.md) and [compact tool details](2026-09-10-compact-tool-details.md); all other presentation and ownership constraints remain. The Session Remote journal sends only raw, validated, persistable Session events. `session.page` and `session.follow` do not parse tool arguments, query the Tools registry, restore a presenter scope, execute `presentCall` or `presentResult`, or construct or clone any tool view. @@ -51,7 +51,7 @@ The Host `ToolDefinition.presentCall`, `ToolDefinition.presentResult`, `ToolCall | Retained | the Session log format, Remote journal lifecycle, and Conversation identity/topology | | Retained | the existing keyed slot, Generic fallback, and Chat, Details, and Trajectory structure | | Forbidden | a new Client presenter service, parallel registry, or wire renderer id | -| Forbidden | new cards, visual redesign, interaction redesign, or Code Dispatch rich-card enhancements except the [nested terminal-card exception](../bug-fix/2026-09-05-nested-terminal-cards.md) | +| Forbidden | new cards, visual redesign, interaction redesign, or Code Dispatch rich-card enhancements except the [nested terminal-card exception](../bug-fix/2026-09-05-nested-terminal-cards.md) and [compact tool details](2026-09-10-compact-tool-details.md) | | Forbidden | compatibility dual-writing, version negotiation, or retention of the old `view` field | ## Terminology diff --git a/.agents/notes/implemented/architecture/2026-08-23-client-derived-tool-presentation.zh.md b/.agents/notes/implemented/architecture/2026-08-23-client-derived-tool-presentation.zh.md index 98ada31627..5dd53cdefd 100644 --- a/.agents/notes/implemented/architecture/2026-08-23-client-derived-tool-presentation.zh.md +++ b/.agents/notes/implemented/architecture/2026-08-23-client-derived-tool-presentation.zh.md @@ -22,7 +22,7 @@ Host presenter 与 Client keyed renderer 分担展示会形成对同一事件的 ## Decision -下述展示对等要求不包含已独立批准的[嵌套 terminal 卡片修复](../bug-fix/2026-09-05-nested-terminal-cards.zh.md);其他展示与所有权约束全部保留。 +下述展示对等要求不包含已独立批准的[嵌套 terminal 卡片修复](../bug-fix/2026-09-05-nested-terminal-cards.zh.md)和[紧凑工具详情](2026-09-10-compact-tool-details.zh.md);其他展示与所有权约束全部保留。 Session Remote journal 只下发原始、已验证、可持久化的 Session event。`session.page` 和 `session.follow` 不解析工具参数,不查询 Tools registry,不恢复 presenter scope,不执行 `presentCall`/`presentResult`,也不构造或克隆任何 tool view。 @@ -51,7 +51,7 @@ Host 的 `ToolDefinition.presentCall`、`ToolDefinition.presentResult`、`ToolCa | 保留 | Session 日志格式、Remote journal 生命周期与 Conversation identity/topology | | 保留 | 现有 keyed slot、Generic fallback、Chat、Details 与 Trajectory 结构 | | 禁止 | 新 Client presenter service、平行 registry 或 wire renderer id | -| 禁止 | 新卡片、视觉改版、交互改版或 Code Dispatch rich-card 增强,[嵌套 terminal 卡片例外](../bug-fix/2026-09-05-nested-terminal-cards.zh.md)除外 | +| 禁止 | 新卡片、视觉改版、交互改版或 Code Dispatch rich-card 增强,[嵌套 terminal 卡片例外](../bug-fix/2026-09-05-nested-terminal-cards.zh.md)和[紧凑工具详情](2026-09-10-compact-tool-details.zh.md)除外 | | 禁止 | 为兼容保留双写、版本协商或旧 `view` 字段 | ## 术语 diff --git a/.agents/notes/implemented/architecture/2026-09-10-compact-tool-details.i18n.yaml b/.agents/notes/implemented/architecture/2026-09-10-compact-tool-details.i18n.yaml new file mode 100644 index 0000000000..74691e5932 --- /dev/null +++ b/.agents/notes/implemented/architecture/2026-09-10-compact-tool-details.i18n.yaml @@ -0,0 +1,6 @@ +# Bilingual-pair consistency record (docs/i18n/README.md): the git blob hash of each +# side as of the last confirmed-consistent state. Both languages carry equal authority; +# after editing either side, bring the other along and re-record with: +# pnpm run verify-translation-pairing --write .agents/notes/implemented/architecture/2026-09-10-compact-tool-details.md +2026-09-10-compact-tool-details.md: ca8f4721f4a5f121c98265c304ba6a30bb42596f +2026-09-10-compact-tool-details.zh.md: e62ed43f66af7d06898808733f556b9b42abb0e8 diff --git a/.agents/notes/implemented/architecture/2026-09-10-compact-tool-details.md b/.agents/notes/implemented/architecture/2026-09-10-compact-tool-details.md new file mode 100644 index 0000000000..ca8f4721f4 --- /dev/null +++ b/.agents/notes/implemented/architecture/2026-09-10-compact-tool-details.md @@ -0,0 +1,27 @@ +# Agent Note: Compact Tool Details from Recorded Results + +Status: implemented + +English | [中文](2026-09-10-compact-tool-details.zh.md) + +## Problem + +Goal, todo, and schedule results contain a small set of user-facing facts that take more effort to read as JSON. Dedicated expanded bodies need to fit the existing conversation rows without adding a second presentation registry or live state to historical calls. + +## Decision + +The `ui-tool` package registers goal and schedule toolviews through the existing keyed slot and shares one package-internal fields/list component with the todo view. Successful, recognized results display recorded values; incomplete calls, errors, malformed values, and unsupported result formats retain generic input/output. Schedule domain errors, including uncertain persistence and an unknown deletion target, retain their original result. + +Tool rows keep their disclosure and Inspect interaction. Checklist marks are static and have accessible status labels. Schedule times use absolute dates with the viewer's time zone; states come from the recorded result. Goal details distinguish an active goal awaiting continuation from an armed goal. These display values do not subscribe to the current goal, todo, or schedule projection. + +This scoped visual change is an exception to the visual-equivalence requirement in [Client-derived tool presentation](2026-08-23-client-derived-tool-presentation.md). Its raw-event ownership, generic fallback, and single keyed registry remain authoritative. + +## Alternatives considered + +**A shared presenter framework:** the existing keyed slot already dispatches tools. Reusing only the detail body keeps the abstraction local until another package needs it. + +**A dashboard inside each card:** interactive controls, progress graphics, and live states add visual weight and can misrepresent what a historical call returned. Compact read-only fields and lists preserve the conversation's hierarchy. + +## Consequences + +Seven tool names gain readable details without changing Host tools, Session events, or public Client exports. The adapters own recognition of their recorded result formats; unsupported data remains inspectable as raw text. The authored tool-details Session replay covers their assembled rendering. diff --git a/.agents/notes/implemented/architecture/2026-09-10-compact-tool-details.zh.md b/.agents/notes/implemented/architecture/2026-09-10-compact-tool-details.zh.md new file mode 100644 index 0000000000..e62ed43f66 --- /dev/null +++ b/.agents/notes/implemented/architecture/2026-09-10-compact-tool-details.zh.md @@ -0,0 +1,27 @@ +# Agent Note: Compact Tool Details from Recorded Results + +Status: implemented + +[English](2026-09-10-compact-tool-details.md) | 中文 + +## 问题 + +目标、任务清单和定时任务的结果包含少量面向用户的事实,以 JSON 阅读时较费力。专用展开内容需要融入现有对话行,不能为历史调用新增一套呈现注册表或实时状态。 + +## 决策 + +`ui-tool` 包通过现有按键分发的插槽注册目标和定时任务视图,并与任务清单视图共用一个包内字段/列表组件。成功且可识别的结果显示记录值;未完成调用、错误、格式异常和不支持的结果格式保留通用输入/输出。定时任务领域错误(包括持久化不确定和删除目标不存在)保留原始结果。 + +工具行保留展开和 Inspect 交互。任务清单标记是静态的,并带有可访问的状态标签。定时任务使用查看者时区的绝对日期,状态取自记录的结果。目标详情区分等待继续的活动目标和已启动的目标。这些显示值不订阅当前目标、任务清单或定时任务投影。 + +这项有限的视觉调整是[客户端派生工具呈现](2026-08-23-client-derived-tool-presentation.zh.md)中视觉等价要求的例外。该决策中的原始事件所有权、通用回退和唯一按键注册表仍然有效。 + +## 考虑过的替代方案 + +**共享呈现框架:**现有按键插槽已负责工具分发。仅复用详情内容,可以在其他包出现需求前将抽象限制在包内。 + +**在每张卡片中嵌入仪表盘:**交互控件、进度图形和实时状态会增加视觉负担,也可能歪曲历史调用返回的事实。紧凑的只读字段和列表保留了对话的层级。 + +## 影响 + +七个工具名称获得可读详情,无需修改 Host 工具、Session 事件或公共 Client 导出。适配器负责识别各自记录的结果格式;不支持的数据仍可作为原始文本查看。手工编写的 tool-details Session 回放覆盖它们在完整页面中的呈现。 diff --git a/apps/web/tests/tool-details.e2e.ts b/apps/web/tests/tool-details.e2e.ts new file mode 100644 index 0000000000..a5919daeed --- /dev/null +++ b/apps/web/tests/tool-details.e2e.ts @@ -0,0 +1,83 @@ +/** Authored Session rendering of compact recorded Tool results. */ +import { readFile } from 'node:fs/promises' +import { fileURLToPath } from 'node:url' +import type { Browser, Page } from 'playwright' +import { chromium } from 'playwright' +import { afterAll, beforeAll, describe, expect, it, onTestFailed } from 'vitest' +import { + assertFixtureInventory, captureStableAria, compareOrRefreshGolden, fixtureUserPrompts, + launchWebScaffold, seedSession, watchConsole, webSnapshotMode, type WebScaffold, +} from './scaffold.ts' +import { expandOwningTurnProcess, newEnglishPage, saveFailureShot } from './support.ts' + +const SNAPSHOT_DIR = fileURLToPath(new URL('../../../snapshots/web/tool-details', import.meta.url)) +const FIXTURE = fileURLToPath(new URL('../../../snapshots/web/tool-details/session.v3.jsonl', import.meta.url)) +const UI_EXPECTED = fileURLToPath(new URL('../../../snapshots/web/tool-details/ui.expected.md', import.meta.url)) +const MODE = webSnapshotMode() +const SEED_ID = 'tool-details-web-e2e' +const PROMPT = 'Show a goal, a to-do list, and reminders.' + +describe.skipIf(MODE === 'record')('web e2e: compact Tool details', () => { + let scaffold: WebScaffold + let browser: Browser + let page: Page + let tripwire: ReturnType + + beforeAll(async () => { + const fixture = await readFile(FIXTURE, 'utf8') + expect(fixtureUserPrompts(fixture)).toEqual([PROMPT]) + scaffold = await launchWebScaffold({}) + await seedSession(scaffold, fixture, SEED_ID) + browser = await chromium.launch() + page = await newEnglishPage(browser) + tripwire = watchConsole(page) + await page.goto(scaffold.authenticatedUrl, { waitUntil: 'load' }) + await page.waitForSelector('[class*="frame"]', { timeout: 30_000 }) + + const groupRow = page.locator('[role="treeitem"]').first() + await groupRow.waitFor({ timeout: 15_000 }) + await groupRow.click() + const sessionRow = page.locator('[role="treeitem"]').nth(1) + await sessionRow.waitFor({ timeout: 10_000 }) + await sessionRow.click() + const skillRow = page.locator('[data-tool="create_goal"]') + await expandOwningTurnProcess(page, skillRow) + await skillRow.waitFor({ timeout: 15_000 }) + }, 120_000) + + afterAll(async () => { + try { await browser?.close() } finally { await scaffold?.close() } + }) + + it('expands every recorded tool through its keyed renderer', async () => { + onTestFailed(() => saveFailureShot(page, 'web-e2e-tool-details')) + const rows = page.locator('[data-tool]') + expect(await rows.count()).toBe(44) + for (const row of await rows.all()) { + await row.getByRole('button', { expanded: false }).first().click() + expect(await row.getByRole('listitem').count()).toBeGreaterThan(0) + expect(await row.getByText('Output', { exact: true }).count()).toBe(0) + expect(await row.getByRole('button', { name: 'Inspect', exact: true }).count()).toBe(1) + } + const changedTodos = page.locator('[data-tool="todo_write"]').nth(1) + await changedTodos.getByText('1 added · 1 updated · 1 removed', { exact: true }).waitFor() + for (const summary of await page.locator('[data-tool] details > summary').all()) await summary.click() + await page.locator('[data-tool="create_goal"]').getByText('Awaiting continuation', { exact: true }).waitFor() + const schema = page.locator('[data-tool="cordis_inspect_list"] pre').first() + await expect.poll(() => schema.textContent()).toContain('"properties"') + const snapshots = await Promise.all(Array.from({ length: 44 }, (_, index) => + captureStableAria(page, `[data-chat-call-id="details-call-${index + 1}"] [data-tool]`, scaffold.workspaceCwd))) + const snapshot = snapshots.join('\n') + await compareOrRefreshGolden(UI_EXPECTED, snapshot, MODE) + await page.setViewportSize({ width: 360, height: 800 }) + const card = page.locator('[data-tool="schedule_create"]') + expect(await card.evaluate(element => element.scrollWidth <= element.clientWidth)).toBe(true) + expect(tripwire.pageErrors).toEqual([]) + expect(tripwire.warnings).toEqual([]) + }, 60_000) + + it('keeps the snapshot inventory closed', async () => { + await assertFixtureInventory(SNAPSHOT_DIR, ['session.v3.jsonl', 'ui.expected.md']) + }) + +}) diff --git a/apps/web/tsconfig.json b/apps/web/tsconfig.json index 3b01e3990c..0ed6e455fb 100644 --- a/apps/web/tsconfig.json +++ b/apps/web/tsconfig.json @@ -106,6 +106,7 @@ "tests/background-job-list.e2e.ts", "tests/bash-abort-row.e2e.ts", "tests/skill-tool-row.e2e.ts", + "tests/tool-details.e2e.ts", "tests/turn-tail-actions.e2e.ts", "tests/goal-multi-turn-actions.e2e.ts", "tests/chat-scroll-fixture.ts", diff --git a/packages/client/ui-conversation/src/client/locales.ts b/packages/client/ui-conversation/src/client/locales.ts index 56da231c15..5deb21f04b 100644 --- a/packages/client/ui-conversation/src/client/locales.ts +++ b/packages/client/ui-conversation/src/client/locales.ts @@ -85,6 +85,192 @@ export const zh = { 'todo.progress.active': '{active} 进行中', 'todo.progress.pending': '{pending} 待处理', 'todo.rowTitle': '更新任务清单', + 'tool.title.createGoal': '创建目标', + 'tool.title.getGoal': '查看目标', + 'tool.title.updateGoal': '更新目标', + 'tool.title.createSchedule': '创建定时任务', + 'tool.title.listSchedules': '查看定时任务', + 'tool.title.deleteSchedule': '删除定时任务', + 'detail.state': '状态', + 'detail.todo.completed': '已完成', + 'detail.todo.in_progress': '进行中', + 'detail.todo.pending': '待处理', + 'detail.todo.empty': '任务清单为空', + 'todo.diff.initial': '首次记录', + 'todo.diff.compare': '与上次清单相比', + 'todo.diff.unavailable': '旧清单不可用', + 'todo.diff.noChanges': '清单没有变化', + 'todo.diff.added': '新增 {count}', + 'todo.diff.updated': '更新 {count}', + 'todo.diff.removed': '移除 {count}', + 'todo.diff.unchanged': '{count} 项未变化', + 'todo.diff.addedItem': '新增', + 'todo.diff.updatedItem': '状态变化', + 'todo.diff.movedItem': '顺序调整', + 'todo.diff.removedItem': '移除', + 'detail.goal.empty': '没有目标', + 'detail.goal.active': '进行中', + 'detail.goal.disarmed': '等待继续', + 'detail.goal.paused': '已暂停', + 'detail.goal.blocked': '受阻', + 'detail.goal.complete': '已完成', + 'detail.goal.rounds': '执行轮次', + 'detail.goal.reason': '受阻原因', + 'detail.days': '{count} 天', + 'detail.hours': '{count} 小时', + 'detail.minutes': '{count} 分钟', + 'detail.seconds': '{count} 秒', + 'detail.schedule.once': '单次', + 'detail.schedule.every': '每 {interval}', + 'detail.schedule.when': '计划时间', + 'detail.schedule.frequency': '重复', + 'detail.schedule.scheduled': '等待触发', + 'detail.schedule.overdue': '已到期,等待会话恢复', + 'detail.schedule.empty': '没有定时任务', + 'detail.schedule.deleted': '已删除', + 'detail.schedule.count': '{count} 个定时任务', + 'tool.title.inspectProviders': '检查提供方', + 'tool.title.queryRuntime': '查询运行时', + 'tool.title.inspectPlugins': '检查动态插件', + 'tool.title.workflow': '运行工作流', + 'tool.title.ralph': '运行 Ralph', + 'tool.title.readEvent': '读取事件', + 'tool.title.searchEvents': '搜索事件', + 'tool.title.traceEvent': '追踪事件', + 'tool.title.searchSessions': '搜索会话', + 'tool.title.traceSession': '追踪会话', + 'tool.title.listModels': '查看可用模型', + 'tool.title.subagent': '委派任务', + 'tool.title.listAgents': '查看代理', + 'tool.title.sendMessage': '发送消息', + 'tool.title.interruptAgent': '中断代理', + 'tool.title.listJobs': '查看后台任务', + 'tool.title.readJob': '读取任务输出', + 'tool.title.killJob': '取消后台任务', + 'tool.title.openTerminal': '创建终端', + 'tool.title.readTerminal': '读取终端', + 'tool.title.listTerminals': '查看终端', + 'tool.title.signalTerminal': '发送终端信号', + 'tool.title.closeTerminal': '关闭终端', + 'tool.title.lsp': '查询代码符号', + 'tool.title.findDefinition': '查找定义', + 'tool.title.findReferences': '查找引用', + 'tool.title.findImplementation': '查找实现', + 'tool.title.hoverSymbol': '查看符号信息', + 'tool.title.spawnTeammate': '创建队友', + 'tool.title.createTeamTask': '创建团队任务', + 'tool.title.getTeamTask': '读取团队任务', + 'tool.title.updateTeamTask': '更新团队任务', + 'tool.title.listTeamTasks': '查看团队任务', + 'tool.title.waitAgent': '等待队友', + 'detail.recordedResult': '调用结果', + 'detail.empty': '暂无结果', + 'detail.none': '无', + 'detail.yes': '是', + 'detail.no': '否', + 'detail.moreInInspect': '另有 {count} 项,可在「查看」中读取', + 'detail.status.running': '运行中', + 'detail.status.idle': '空闲', + 'detail.status.ready': '就绪', + 'detail.status.inactive': '未运行', + 'detail.status.provisioning': '准备中', + 'detail.status.failed': '失败', + 'detail.status.completed': '已完成', + 'detail.status.deleted': '已删除', + 'detail.status.killed': '已取消', + 'detail.status.accepted': '已接收', + 'detail.status.queued': '已入队', + 'detail.status.exited': '已退出', + 'detail.field.id': 'ID', + 'detail.field.revision': '版本', + 'detail.field.platform': '平台', + 'detail.field.provider': '提供方', + 'detail.field.model': '模型', + 'detail.field.role': '角色', + 'detail.field.context': '上下文', + 'detail.field.owner': '负责人', + 'detail.field.ready': '可开始', + 'detail.field.dependencies': '前置任务', + 'detail.field.writeScopes': '文件范围', + 'detail.field.warnings': '提示', + 'detail.field.diagnostics': '诊断', + 'detail.field.methods': '方法', + 'detail.field.inputSchema': '输入 Schema', + 'detail.field.outputSchema': '输出 Schema', + 'detail.field.currentPackage': '当前包', + 'detail.field.nextPackage': '待运行的包', + 'detail.field.latestRun': '最近运行', + 'detail.field.packages': '版本包', + 'detail.field.registrations': '注册项', + 'detail.field.props': '属性', + 'detail.field.data': '数据', + 'detail.field.source': '来源', + 'detail.field.content': '内容', + 'detail.field.message': '消息', + 'detail.field.messageId': '消息 ID', + 'detail.field.root': '根节点', + 'detail.field.pid': '进程 ID', + 'detail.field.type': '类型', + 'detail.field.time': '时间', + 'detail.field.seq': '事件序号', + 'detail.field.turn': '轮次', + 'detail.field.step': '步骤', + 'detail.field.callId': '调用 ID', + 'detail.field.agents': '启动代理数', + 'detail.field.result': '结果', + 'detail.field.parent': '父级', + 'detail.field.depth': '层级', + 'detail.field.exitCode': '退出码', + 'detail.field.signal': '信号', + 'detail.field.previousStatus': '中断前状态', + 'detail.field.agent': '代理 ID', + 'detail.field.job': '任务 ID', + 'detail.field.task': '任务内容', + 'detail.field.processGroup': '进程组', + 'detail.field.availability': '可用状态', + 'detail.field.bestMatch': '最相关事件', + 'detail.field.target': '目标事件', + 'detail.field.surface': '记录状态', + 'detail.agents.count': '{count} 个代理', + 'detail.jobs.count': '{count} 个后台任务', + 'detail.terminals.count': '{count} 个终端', + 'detail.tasks.count': '{count} 个团队任务', + 'detail.tasks.nextPage': '后面还有任务;下一页位置为 {cursor}', + 'detail.locations.count': '{count} 个位置', + 'detail.location': '第 {line} 行,第 {column} 列', + 'detail.receipt.delivered': '消息已送达', + 'detail.receipt.interrupt': '已请求中断', + 'detail.receipt.started': '已启动', + 'detail.receipt.cancel': '已请求取消', + 'detail.receipt.alreadyFinished': '任务已结束', + 'detail.receipt.signal': '信号已发送', + 'detail.receipt.closed': '已关闭', + 'detail.receipt.closing': '关闭中', + 'detail.wait.noProgress': '没有正在运行的队友', + 'detail.wait.title': '队友状态', + 'detail.wait.timeout': '等待超时', + 'detail.wait.changed': '检测到变化', + 'detail.agent.reply': '代理回复', + 'detail.models.title': '可用模型', + 'detail.output.lines': '第 {begin}–{end} 行,共 {total} 行', + 'detail.output.truncated': '输出已截断', + 'detail.providers.count': '{count} 个检查提供方', + 'detail.plugins.count': '{count} 个动态插件', + 'detail.workflow.script': '工作流脚本', + 'detail.ralph.reportedComplete': '代理报告完成', + 'detail.ralph.reportedBlocker': '代理报告受阻', + 'detail.ralph.limit': '已达到轮次上限', + 'detail.report.nextSteps': '待完成事项', + 'detail.trace.replacedBy': '被替换为', + 'detail.trace.replacementChain': '替换链', + 'detail.trace.replaces': '替换的事件', + 'detail.trace.sources': '引用来源', + 'detail.trace.derived': '派生事件', + 'detail.trace.ancestors': '祖先会话', + 'detail.trace.descendants': '后代会话', + 'detail.matches.count': '{count} 条匹配', + 'detail.matches.capped': '已达到结果上限,可缩小搜索范围', + 'detail.event.neighbors': '前后事件', 'todo.completed': '{done}/{total} 已完成', 'command.attachmentsUnsupported': '/{command} 不接受附件,请先移除附件', 'ask.rowTitle': '提问', @@ -251,6 +437,192 @@ export const en = { 'todo.progress.active': '{active} in progress', 'todo.progress.pending': '{pending} pending', 'todo.rowTitle': 'Update to-do list', + 'tool.title.createGoal': 'Create goal', + 'tool.title.getGoal': 'View goal', + 'tool.title.updateGoal': 'Update goal', + 'tool.title.createSchedule': 'Create reminder', + 'tool.title.listSchedules': 'List reminders', + 'tool.title.deleteSchedule': 'Delete reminder', + 'detail.state': 'Status', + 'detail.todo.completed': 'Completed', + 'detail.todo.in_progress': 'In progress', + 'detail.todo.pending': 'Pending', + 'detail.todo.empty': 'The to-do list is empty', + 'todo.diff.initial': 'Initial list', + 'todo.diff.compare': 'Changes since the previous list', + 'todo.diff.unavailable': 'Previous list unavailable', + 'todo.diff.noChanges': 'No changes to the list', + 'todo.diff.added': '{count} added', + 'todo.diff.updated': '{count} updated', + 'todo.diff.removed': '{count} removed', + 'todo.diff.unchanged': '{count} unchanged', + 'todo.diff.addedItem': 'Added', + 'todo.diff.updatedItem': 'Status changed', + 'todo.diff.movedItem': 'Reordered', + 'todo.diff.removedItem': 'Removed', + 'detail.goal.empty': 'No goal', + 'detail.goal.active': 'Active', + 'detail.goal.disarmed': 'Awaiting continuation', + 'detail.goal.paused': 'Paused', + 'detail.goal.blocked': 'Blocked', + 'detail.goal.complete': 'Completed', + 'detail.goal.rounds': 'Rounds', + 'detail.goal.reason': 'Blocker', + 'detail.days': '{count} d', + 'detail.hours': '{count} h', + 'detail.minutes': '{count} min', + 'detail.seconds': '{count} s', + 'detail.schedule.once': 'Once', + 'detail.schedule.every': 'Every {interval}', + 'detail.schedule.when': 'Scheduled for', + 'detail.schedule.frequency': 'Repeat', + 'detail.schedule.scheduled': 'Scheduled', + 'detail.schedule.overdue': 'Overdue, awaiting session resume', + 'detail.schedule.empty': 'No reminders', + 'detail.schedule.deleted': 'Deleted', + 'detail.schedule.count': '{count} reminders', + 'tool.title.inspectProviders': 'Inspect providers', + 'tool.title.queryRuntime': 'Query runtime', + 'tool.title.inspectPlugins': 'Inspect plugins', + 'tool.title.workflow': 'Run workflow', + 'tool.title.ralph': 'Run Ralph', + 'tool.title.readEvent': 'Read event', + 'tool.title.searchEvents': 'Search events', + 'tool.title.traceEvent': 'Trace event', + 'tool.title.searchSessions': 'Search sessions', + 'tool.title.traceSession': 'Trace session', + 'tool.title.listModels': 'List models', + 'tool.title.subagent': 'Delegate task', + 'tool.title.listAgents': 'List agents', + 'tool.title.sendMessage': 'Send message', + 'tool.title.interruptAgent': 'Interrupt agent', + 'tool.title.listJobs': 'List background jobs', + 'tool.title.readJob': 'Read job output', + 'tool.title.killJob': 'Cancel background job', + 'tool.title.openTerminal': 'Open terminal', + 'tool.title.readTerminal': 'Read terminal', + 'tool.title.listTerminals': 'List terminals', + 'tool.title.signalTerminal': 'Signal terminal', + 'tool.title.closeTerminal': 'Close terminal', + 'tool.title.lsp': 'Query code symbols', + 'tool.title.findDefinition': 'Find definition', + 'tool.title.findReferences': 'Find references', + 'tool.title.findImplementation': 'Find implementation', + 'tool.title.hoverSymbol': 'Inspect symbol', + 'tool.title.spawnTeammate': 'Create teammate', + 'tool.title.createTeamTask': 'Create team task', + 'tool.title.getTeamTask': 'Read team task', + 'tool.title.updateTeamTask': 'Update team task', + 'tool.title.listTeamTasks': 'List team tasks', + 'tool.title.waitAgent': 'Wait for teammates', + 'detail.recordedResult': 'Recorded result', + 'detail.empty': 'No results', + 'detail.none': 'None', + 'detail.yes': 'Yes', + 'detail.no': 'No', + 'detail.moreInInspect': '{count} more items available in Inspect', + 'detail.status.running': 'Running', + 'detail.status.idle': 'Idle', + 'detail.status.ready': 'Ready', + 'detail.status.inactive': 'Inactive', + 'detail.status.provisioning': 'Provisioning', + 'detail.status.failed': 'Failed', + 'detail.status.completed': 'Completed', + 'detail.status.deleted': 'Deleted', + 'detail.status.killed': 'Cancelled', + 'detail.status.accepted': 'Accepted', + 'detail.status.queued': 'Queued', + 'detail.status.exited': 'Exited', + 'detail.field.id': 'ID', + 'detail.field.revision': 'Revision', + 'detail.field.platform': 'Platform', + 'detail.field.provider': 'Provider', + 'detail.field.model': 'Model', + 'detail.field.role': 'Role', + 'detail.field.context': 'Context', + 'detail.field.owner': 'Owner', + 'detail.field.ready': 'Ready', + 'detail.field.dependencies': 'Dependencies', + 'detail.field.writeScopes': 'Write scopes', + 'detail.field.warnings': 'Warnings', + 'detail.field.diagnostics': 'Diagnostics', + 'detail.field.methods': 'Methods', + 'detail.field.inputSchema': 'Input schema', + 'detail.field.outputSchema': 'Output schema', + 'detail.field.currentPackage': 'Current package', + 'detail.field.nextPackage': 'Next package', + 'detail.field.latestRun': 'Latest run', + 'detail.field.packages': 'Packages', + 'detail.field.registrations': 'Registrations', + 'detail.field.props': 'Props', + 'detail.field.data': 'Data', + 'detail.field.source': 'Source', + 'detail.field.content': 'Content', + 'detail.field.message': 'Message', + 'detail.field.messageId': 'Message ID', + 'detail.field.root': 'Root', + 'detail.field.pid': 'Process ID', + 'detail.field.type': 'Type', + 'detail.field.time': 'Time', + 'detail.field.seq': 'Event sequence', + 'detail.field.turn': 'Turn', + 'detail.field.step': 'Step', + 'detail.field.callId': 'Call ID', + 'detail.field.agents': 'Agents started', + 'detail.field.result': 'Result', + 'detail.field.parent': 'Parent', + 'detail.field.depth': 'Depth', + 'detail.field.exitCode': 'Exit code', + 'detail.field.signal': 'Signal', + 'detail.field.previousStatus': 'Previous status', + 'detail.field.agent': 'Agent ID', + 'detail.field.job': 'Job ID', + 'detail.field.task': 'Task', + 'detail.field.processGroup': 'Process group', + 'detail.field.availability': 'Availability', + 'detail.field.bestMatch': 'Best match', + 'detail.field.target': 'Target event', + 'detail.field.surface': 'Record status', + 'detail.agents.count': '{count} agents', + 'detail.jobs.count': '{count} background jobs', + 'detail.terminals.count': '{count} terminals', + 'detail.tasks.count': '{count} team tasks', + 'detail.tasks.nextPage': 'More tasks available; next cursor is {cursor}', + 'detail.locations.count': '{count} locations', + 'detail.location': 'Line {line}, column {column}', + 'detail.receipt.delivered': 'Message delivered', + 'detail.receipt.interrupt': 'Interrupt requested', + 'detail.receipt.started': 'Started', + 'detail.receipt.cancel': 'Cancellation requested', + 'detail.receipt.alreadyFinished': 'Already finished', + 'detail.receipt.signal': 'Signal delivered', + 'detail.receipt.closed': 'Closed', + 'detail.receipt.closing': 'Closing', + 'detail.wait.noProgress': 'No active teammates', + 'detail.wait.title': 'Teammate activity', + 'detail.wait.timeout': 'Wait timed out', + 'detail.wait.changed': 'Change detected', + 'detail.agent.reply': 'Agent response', + 'detail.models.title': 'Available models', + 'detail.output.lines': 'Lines {begin}–{end} of {total}', + 'detail.output.truncated': 'Output truncated', + 'detail.providers.count': '{count} inspect providers', + 'detail.plugins.count': '{count} dynamic plugins', + 'detail.workflow.script': 'Workflow script', + 'detail.ralph.reportedComplete': 'Worker reported completion', + 'detail.ralph.reportedBlocker': 'Worker reported a blocker', + 'detail.ralph.limit': 'Round limit reached', + 'detail.report.nextSteps': 'Remaining work', + 'detail.trace.replacedBy': 'Replaced by', + 'detail.trace.replacementChain': 'Replacement chain', + 'detail.trace.replaces': 'Replaced events', + 'detail.trace.sources': 'Source events', + 'detail.trace.derived': 'Derived events', + 'detail.trace.ancestors': 'Ancestor sessions', + 'detail.trace.descendants': 'Descendant sessions', + 'detail.matches.count': '{count} matches', + 'detail.matches.capped': 'Result limit reached; narrow the search for more', + 'detail.event.neighbors': 'Surrounding events', 'todo.completed': '{done}/{total} completed', 'command.attachmentsUnsupported': '/{command} does not accept attachments; remove them first', 'ask.rowTitle': 'Ask question', diff --git a/packages/client/ui-tool/README.i18n.yaml b/packages/client/ui-tool/README.i18n.yaml index ad0a426ba6..af11843422 100644 --- a/packages/client/ui-tool/README.i18n.yaml +++ b/packages/client/ui-tool/README.i18n.yaml @@ -2,5 +2,5 @@ # side as of the last confirmed-consistent state. Both languages carry equal authority; # after editing either side, bring the other along and re-record with: # pnpm run verify-translation-pairing --write packages/client/ui-tool/README.md -README.md: b8dd2a5e3c6743e496d585a2de238714f00e9f6b -README.zh.md: 0f777981ff6ccc6945e516d3c9853a236cde82d7 +README.md: 011935cefc41542917eeb434e2bfed5ce00b0a44 +README.zh.md: a8270ed214b209162faabb3d9f16da1e7281d139 diff --git a/packages/client/ui-tool/README.md b/packages/client/ui-tool/README.md index b8dd2a5e3c..011935cefc 100644 --- a/packages/client/ui-tool/README.md +++ b/packages/client/ui-tool/README.md @@ -64,6 +64,8 @@ The package realizes one dispatch rule: atomic Tool views are keyed by wire Tool Every card is read in place in the call tree; there is no second, full-height presentation of a selected call. Row renderers share one pure card model for each terminal, read, diff, search, and web card, and the image card's gallery renders through the tool-owned `tool.call.images` slot. These models validate raw call arguments, result content, failure state, persisted metadata, Code Dispatch `parentCallId`, and Session path facts. Unsupported or malformed inputs use flattened Tool result text. A file-path summary opens the file through the owner's `openFile`, which the chat view routes to the right Sidebar's text preview; `inspect` opens the trajectory view. Card-specific limits and fallback rules for the terminal, diff, read, search, and web cards remain in [the ui-primitives README](../ui-primitives/README.md); the image card's model in this package carries its own fallback rules. +Goal and schedule tools use compact fields and lists; `todo_write` uses a static checklist. These expanded bodies read successful logged results, preserve generic input/output for failures or unsupported data, and keep Inspect available. Dates include the viewer's time zone, and statuses reflect the call result rather than current session state. [Compact tool details](../../../.agents/notes/implemented/architecture/2026-09-10-compact-tool-details.md) records the scope and presentation trade-offs. + The terminal model uses `hasSpillNotice` from the browser-safe `@deepseek-ai/dsh-spill-policy/notice` entry, not an independent UI pattern. The [spill-policy README](../../spill/spill-policy/README.md#shared-notice-ownership) owns notice formatting and recognition. This check conservatively selects generic output; matching text cannot authenticate its source, and replay leaves recorded result bytes untouched. diff --git a/packages/client/ui-tool/README.zh.md b/packages/client/ui-tool/README.zh.md index 0f777981ff..a8270ed214 100644 --- a/packages/client/ui-tool/README.zh.md +++ b/packages/client/ui-tool/README.zh.md @@ -64,6 +64,8 @@ owner 载荷为 `ToolCallOwnerProps`:`callId`、`toolName`、冻结的 `block` 每张卡片都直接在调用树中查看;选中调用后不会再显示第二个全高视图。行 renderer 为 terminal、read、diff、search 和 web 卡片各复用同一个纯 card model,image 卡片的图库经由工具自有 `tool.call.images` slot 渲染。这些 model 校验原始调用参数、结果内容、失败状态、持久 metadata、Code Dispatch 的 `parentCallId` 与会话路径信息。不受支持或格式错误的输入使用压平的工具结果文本。文件路径摘要经属主的 `openFile` 打开文件,chat 视图把它路由到右侧 Sidebar 的文本预览;`inspect` 打开轨迹视图。terminal、diff、read、search 与 web 卡片的上限与 fallback 规则仍由 [ui-primitives README](../ui-primitives/README.zh.md) 负责;image 卡片的 fallback 规则由本包内的 card model 自行承载。 +目标与定时任务工具使用紧凑的字段和列表;`todo_write` 使用静态任务清单。展开内容读取成功的记录结果,为失败或不支持的数据保留通用输入/输出,并保留 Inspect。日期包含查看者的时区,状态反映调用结果而非当前会话状态。[紧凑工具详情](../../../.agents/notes/implemented/architecture/2026-09-10-compact-tool-details.zh.md)记录了范围与呈现取舍。 + terminal model 使用浏览器安全入口 `@deepseek-ai/dsh-spill-policy/notice` 的 `hasSpillNotice`,而非独立的 UI 匹配规则。[spill-policy README](../../spill/spill-policy/README.zh.md#shared-notice-ownership) 负责提示文本的格式化与识别。该检查保守地选择通用输出;匹配的文本无法证明其来源,回放也不改变已记录的结果字节。 diff --git a/packages/client/ui-tool/src/client/apply.ts b/packages/client/ui-tool/src/client/apply.ts index 28bc6e51fe..e6a866d1b2 100644 --- a/packages/client/ui-tool/src/client/apply.ts +++ b/packages/client/ui-tool/src/client/apply.ts @@ -14,6 +14,7 @@ import { fileMutationToolview } from './tool/toolviews/file-mutation-row.tsx' import { readToolview } from './tool/toolviews/read-row.tsx' import { readImageToolview } from './tool/toolviews/read-image-row.tsx' import { searchToolview } from './tool/toolviews/search-row.tsx' +import { detailsToolview } from './tool/toolviews/details-row.tsx' import { todoToolview } from './tool/toolviews/todo-row.tsx' import { webToolview } from './tool/toolviews/web-row.tsx' @@ -47,5 +48,6 @@ export function apply(ctx: ClientContext): void { ctx.plugin(searchToolview) ctx.plugin(webToolview) ctx.plugin(todoToolview) + ctx.plugin(detailsToolview) ctx.plugin(askQuestionToolview) } diff --git a/packages/client/ui-tool/src/client/tool/components/ToolDetails.module.css b/packages/client/ui-tool/src/client/tool/components/ToolDetails.module.css new file mode 100644 index 0000000000..e600b8a36c --- /dev/null +++ b/packages/client/ui-tool/src/client/tool/components/ToolDetails.module.css @@ -0,0 +1,257 @@ +.root { + margin: 4px 0 4px 4px; + border: 0.5px solid var(--dsw-alias-border-l1); + border-radius: 12px; + background: var(--dsw-alias-markdown-code-block); + color: var(--dsw-alias-label-secondary); + font: var(--dsw-font-xs-13); + overflow: hidden; +} + +.list { + list-style: none; + margin: 0; + padding: 0; + max-height: 320px; + overflow-y: auto; +} + +.item, +.empty { + margin: 0; + padding: 10px 14px; +} + +.item + .item { + border-top: 0.5px solid var(--dsw-alias-border-l2); +} + +.root[data-inspect]:not([data-caption]) > .list > .item:first-child, +.root[data-inspect]:not([data-caption]) .empty, +.root[data-inspect] .caption { + padding-inline-end: 88px; +} + +.caption { + padding: 10px 14px 6px; + color: var(--dsw-alias-label-caption); + font-size: 12px; +} + +.heading { + display: flex; + align-items: baseline; + gap: 8px; + flex-wrap: wrap; +} + +.text { + flex: 1; + min-width: 0; + white-space: pre-wrap; + overflow-wrap: anywhere; +} + +.status { + flex: none; + align-self: flex-start; + display: inline-flex; + align-items: center; + justify-content: center; + width: 14px; + height: 18px; + font-size: 16px; + line-height: 18px; +} + +.pending { + box-sizing: border-box; + width: 10px; + height: 10px; + border: 1px solid var(--dsw-alias-label-tertiary); + border-radius: 2px; +} + +.heading:has(.statusText) .text { + flex-basis: 12em; +} + +.statusText { + margin-inline-start: auto; + color: var(--dsw-alias-label-caption); + font-size: 12px; + white-space: nowrap; +} + +.previous, +.unchanged { + color: var(--dsw-alias-label-tertiary); +} + +.item[data-change='added'] .status { + color: var(--dsw-alias-state-success-primary); +} + +.item[data-change='removed'] .status { + color: var(--dsw-alias-state-error-primary); +} + +.item[data-change='removed'] .text { + color: var(--dsw-alias-label-tertiary); + text-decoration: line-through; +} + +.unchanged { + border-top: 0.5px solid var(--dsw-alias-border-l2); +} + +.unchanged summary { + display: flex; + align-items: center; + gap: 6px; + padding: 9px 14px; + list-style: none; + cursor: pointer; +} + +.unchanged summary::-webkit-details-marker { + display: none; +} + +.unchanged[open] summary svg { + transform: rotate(90deg); +} + +.fields { + margin: 0; +} + +.heading + .fields { + margin-top: 6px; +} + +.field { + display: grid; + grid-template-columns: 5.5em minmax(0, 1fr); + gap: 12px; +} + +.field + .field { + margin-top: 4px; +} + +.field dt { + color: var(--dsw-alias-label-caption); +} + +.field dd { + margin: 0; + white-space: pre-wrap; + overflow-wrap: anywhere; +} + +.badge { + flex: none; + display: inline-flex; + align-items: center; + gap: 5px; + color: var(--dsw-alias-label-caption); + font-size: 12px; +} + +.badge::before { + content: ''; + width: 5px; + height: 5px; + border-radius: 50%; + corner-shape: round; + background: currentColor; +} + +.badge[data-tone='success'] { color: var(--dsw-alias-state-success-primary); } +.badge[data-tone='warning'] { color: var(--dsw-alias-state-warn-primary); } +.badge[data-tone='error'] { color: var(--dsw-alias-state-error-primary); } + +.subtitle { + margin-top: 3px; + color: var(--dsw-alias-label-tertiary); + font-size: 12px; + overflow-wrap: anywhere; +} + +.description { + margin: 6px 0; + color: var(--dsw-alias-label-caption); + white-space: pre-wrap; + overflow-wrap: anywhere; +} + +.lines { + margin: 6px 0 0; + padding-inline-start: 18px; + white-space: pre-wrap; + overflow-wrap: anywhere; +} + +.lines li + li { margin-top: 4px; } + +.group { + margin-top: 8px; + border-top: 0.5px solid var(--dsw-alias-border-l2); +} + +.group > summary { + display: flex; + align-items: center; + gap: 6px; + padding: 8px 0 0; + color: var(--dsw-alias-label-caption); + list-style: none; + cursor: pointer; + overflow-wrap: anywhere; +} + +.group > summary::-webkit-details-marker { display: none; } +.group[open] > summary svg { transform: rotate(90deg); } +.group > summary svg { flex: none; } +.group .list { max-height: none; overflow: visible; } +.group .item { padding: 9px 0 2px 20px; } + +.prose, +.code { + max-width: 100%; + font-size: 13px; +} + +.prose { margin-top: 8px; } + +.root .item > .code { + margin: 8px 0 0; + max-height: 240px; + overflow: auto; +} + +.root .group .item:has(> .code:only-child) { + padding: 4px 0 0 20px; +} + +.root .group .item > .code:only-child { margin: 0; } + +.root .code [data-code-block-banner] { padding: 4px 10px; } +.root .code pre { padding: 6px 10px 8px; } + +.path { + flex: 1; + min-width: 0; + padding: 0; + border: none; + background: none; + color: inherit; + font: inherit; + text-align: start; + overflow-wrap: anywhere; + cursor: pointer; +} + +.path:hover { text-decoration: underline; } +.path:focus-visible { outline: 2px solid var(--dsw-alias-state-business-primary); outline-offset: 3px; } diff --git a/packages/client/ui-tool/src/client/tool/components/ToolDetails.tsx b/packages/client/ui-tool/src/client/tool/components/ToolDetails.tsx new file mode 100644 index 0000000000..3612d85a98 --- /dev/null +++ b/packages/client/ui-tool/src/client/tool/components/ToolDetails.tsx @@ -0,0 +1,134 @@ +/** Compact, read-only fields and lists for recorded Tool results. */ +import { CodeBlock, MarkdownText, IconCheckOutline14, IconChevronRightOutline14, IconPlayOutline16 } from '@deepseek-ai/dsh-client-ui-primitives' +import type { TranslateNS } from '@deepseek-ai/dsh-client-ui-slots' +import type { OpenFileOptions } from '@deepseek-ai/dsh-client-ui-chat/client' +import { markdownLabels } from '../models/primitive-labels.ts' +import css from './ToolDetails.module.css' + +/** One recorded entity, receipt, or collapsible group of related values. */ +export interface ToolDetailItem { + title?: string + subtitle?: string + description?: string + badge?: { label: string; tone: 'neutral' | 'success' | 'warning' | 'error' } + status?: { value: 'completed' | 'in_progress' | 'pending'; label: string } + previousStatus?: string + change?: { value: 'added' | 'removed' | 'updated'; label: string } + fields: readonly { label: string; value: string }[] + lines?: readonly string[] + markdown?: string + code?: { text: string; language?: string } + location?: { path: string; line?: number } + groups?: readonly { label: string; items: readonly ToolDetailItem[] }[] +} + +/** Localized display data shared by the built-in detail cards. */ +export interface ToolDetailsModel { + items: readonly ToolDetailItem[] + summary?: string + empty?: string + caption?: string + unchanged?: { label: string; items: ToolDetailsModel['items'] } +} + +interface DetailContentProps { + t: TranslateNS<'conversation'> + onOpenFile?: ((path: string, options?: OpenFileOptions) => void) | undefined +} + +function DetailItem({ item, t, onOpenFile }: { item: ToolDetailItem } & DetailContentProps) { + const status = item.status + return ( +
  • + {item.title !== undefined && ( +
    + {status !== undefined && ( + + {item.change?.value === 'added' ? '+' + : item.change?.value === 'removed' ? '−' + : status.value === 'completed' ? + : status.value === 'in_progress' ? + : } + + )} + {item.location !== undefined && onOpenFile !== undefined ? ( + + ) : {item.title}} + {item.badge !== undefined && {item.badge.label}} + {status !== undefined && ( + + {item.previousStatus !== undefined && ( + <>{item.previousStatus} → + )} + {status.label} + {item.change?.value === 'updated' && item.previousStatus === undefined && · {item.change.label}} + + )} +
    + )} + {item.subtitle !== undefined &&
    {item.subtitle}
    } + {item.description !== undefined &&

    {item.description}

    } + {item.fields.length > 0 && ( +
    + {item.fields.map(field => ( +
    +
    {field.label}
    +
    {field.value}
    +
    + ))} +
    + )} + {item.lines !== undefined &&
      {item.lines.map((line, index) =>
    • {line}
    • )}
    } + {item.markdown !== undefined &&
    } + {item.code !== undefined && ( + + )} + {item.groups?.map((group, index) => ( +
    + {group.label} +
      + {group.items.map((child, childIndex) => )} +
    +
    + ))} +
  • + ) +} + +/** + * Render recorded values with local disclosures, copy controls, and file navigation. + * @param props.model - Localized fields or list items; an empty list uses its empty label. + * @param props.hasInspect - Reserve space for the row's upper-right Inspect button. + * @param props.t - Conversation dictionary for shared Markdown and code controls. + * @param props.onOpenFile - Open a recorded file location in the session workspace. + * @returns The expanded detail body. + */ +export function ToolDetails({ model, hasInspect = false, t, onOpenFile }: { + model: ToolDetailsModel + hasInspect?: boolean +} & DetailContentProps) { + return ( +
    + {model.caption !== undefined &&
    {model.caption}
    } + {model.items.length === 0 ?

    {model.empty}

    : ( +
      + {model.items.map((item, index) => )} +
    + )} + {model.unchanged !== undefined && ( +
    + {model.unchanged.label} +
      + {model.unchanged.items.map((item, index) => )} +
    +
    + )} +
    + ) +} diff --git a/packages/client/ui-tool/src/client/tool/components/ToolRow.module.css b/packages/client/ui-tool/src/client/tool/components/ToolRow.module.css index f1933dc068..ef1a9f6bbf 100644 --- a/packages/client/ui-tool/src/client/tool/components/ToolRow.module.css +++ b/packages/client/ui-tool/src/client/tool/components/ToolRow.module.css @@ -191,6 +191,17 @@ opacity: 1; } +.detailsBodyWrap { + position: relative; +} + +.detailsBodyWrap .inspectButton { + position: absolute; + top: 12px; + right: 12px; + margin: 0; +} + /* Solid hover fill (a translucent token would let content bleed through). */ .inspectButton:hover { background: var(--dsw-alias-interactive-bg-hover-solid); diff --git a/packages/client/ui-tool/src/client/tool/components/ToolRow.tsx b/packages/client/ui-tool/src/client/tool/components/ToolRow.tsx index ca5becec3b..9a67b36ff6 100644 --- a/packages/client/ui-tool/src/client/tool/components/ToolRow.tsx +++ b/packages/client/ui-tool/src/client/tool/components/ToolRow.tsx @@ -23,6 +23,7 @@ import { } from '../models/tool-call-model.ts' import type { WebCardModelProps } from '../models/web-card-model.ts' import { AskQuestionCard } from './AskQuestionCard.tsx' +import { ToolDetails, type ToolDetailsModel } from './ToolDetails.tsx' import css from './ToolRow.module.css' export interface ToolRowProps { @@ -70,6 +71,8 @@ export interface ToolRowProps { loadImage?: MessageImageLoader | undefined search?: SearchCardModel | null | undefined web?: WebCardModelProps | null | undefined + /** Read-only fields/list card derived from a successful recorded result. */ + details?: ToolDetailsModel | null | undefined state: ToolRowState /** * Filesystem path from tool args; when set with onOpenFile, the summary @@ -128,6 +131,7 @@ export function ToolRow({ loadImage, search, web, + details, state, filePath, filePathLine, @@ -151,8 +155,9 @@ export function ToolRow({ const searchBody = search ?? null const webBody = web ?? null const askQuestionBody = askQuestion ?? null + const detailsBody = details ?? null const outputText = output ?? null - const card = askQuestionBody ?? terminalBody ?? diffBody ?? readBody ?? imageBody ?? searchBody ?? webBody + const card = askQuestionBody ?? terminalBody ?? diffBody ?? readBody ?? imageBody ?? searchBody ?? webBody ?? detailsBody const expandable = bodyRaw != null || outputText !== null || card !== null const open = expanded && expandable const bodyText = useMemo( @@ -234,7 +239,7 @@ export function ToolRow({ )} > -
    +
    {askQuestionBody !== null ? : terminalBody !== null @@ -288,36 +293,38 @@ export function ToolRow({ ) : webBody !== null ? - : ( - <> - {variant === 'code' && bodyText !== null && ( -
    - -
    - )} - {(cardBody !== null || outputText !== null) && ( -
    - {cardBody !== null && ( -
    - {t('row.input')} - {cardBody} -
    - )} - {cardBody !== null && outputText !== null && ( - - )} - {outputText !== null && ( -
    - {t('row.output')} - - {outputText} - -
    - )} -
    - )} - - )} + : detailsBody !== null + ? + : ( + <> + {variant === 'code' && bodyText !== null && ( +
    + +
    + )} + {(cardBody !== null || outputText !== null) && ( +
    + {cardBody !== null && ( +
    + {t('row.input')} + {cardBody} +
    + )} + {cardBody !== null && outputText !== null && ( + + )} + {outputText !== null && ( +
    + {t('row.output')} + + {outputText} + +
    + )} +
    + )} + + )} {inspect !== undefined && ( + + +
    + )} + /> + {toast} + + ) +} diff --git a/packages/client/ui-open-in-app/src/client/OpenPathEmptyAction.module.css b/packages/client/ui-open-in-app/src/client/OpenPathEmptyAction.module.css new file mode 100644 index 0000000000..252c870293 --- /dev/null +++ b/packages/client/ui-open-in-app/src/client/OpenPathEmptyAction.module.css @@ -0,0 +1,27 @@ +/* The empty state's capsule, sized like the preview's own Retry + (ui-sidebar-documentpreview TextPreview `.retry`) so the two recourses read + as one family. */ +.open { + display: inline-flex; + flex: none; + gap: 6px; + align-items: center; + height: 32px; + padding: 0 12px 0 14px; + color: var(--dsw-alias-label-primary); + font-size: var(--dsh-content-font-size-secondary, 13px); + font-family: inherit; + background: transparent; + border: 0.5px solid var(--dsw-alias-border-l2); + border-radius: 16px; + cursor: pointer; +} + +.open:hover:not(:disabled) { + background: var(--dsw-alias-interactive-bg-hover); +} + +/* Pending disables clicks without a restyle; only hover feedback pauses. */ +.open:disabled { + cursor: default; +} diff --git a/packages/client/ui-open-in-app/src/client/OpenPathEmptyAction.tsx b/packages/client/ui-open-in-app/src/client/OpenPathEmptyAction.tsx new file mode 100644 index 0000000000..0f2b752139 --- /dev/null +++ b/packages/client/ui-open-in-app/src/client/OpenPathEmptyAction.tsx @@ -0,0 +1,40 @@ +/** Empty-state contribution: open a file the document preview cannot render in its default application. */ +import type { ReactNode } from 'react' +import { IconRightUpOutline16 } from '@deepseek-ai/dsh-client-ui-primitives' +import type { InjectFace, PropsLocale, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots' +import type {} from '@deepseek-ai/dsh-client-ui-sidebar-documentpreview/client' +import type { NS } from './locales.ts' +import { usePathGesture, type OpenPathInjected } from './OpenPathAction.tsx' +import css from './OpenPathEmptyAction.module.css' + +/** Full props of the unpreviewable empty-state contribution. */ +export type OpenPathEmptyActionProps = + PropsRuntime<'sidebar.right.tab.document.unpreviewable'> + & PropsLocale + & InjectFace + +/** + * Render the default-application open button, or nothing until the Host reports a desktop. + * @param props - the unpreviewable file, the injected face, and copy. + * @returns the open button and its toast, or null. + */ +export function OpenPathEmptyAction(props: OpenPathEmptyActionProps): ReactNode { + const { t } = props + const { available, pending, toast, act } = usePathGesture(props) + if (!available) return null + return ( + <> + + {toast} + + ) +} diff --git a/packages/client/ui-open-in-app/src/client/index.ts b/packages/client/ui-open-in-app/src/client/index.ts index c3e4d88f98..05aae1e925 100644 --- a/packages/client/ui-open-in-app/src/client/index.ts +++ b/packages/client/ui-open-in-app/src/client/index.ts @@ -1,18 +1,28 @@ /** * Browser half of open-in-app: one Session-header split button opening the * session's workspace directory (the summary's `cwd`) in the remembered - * installed application. Availability arrives once per page from the host - * apps route; the last choice persists in the browser through the controller's - * persisted snapshot store. + * installed application, and the document preview's default-application + * controls opening one previewed file. Application availability arrives once + * per page from the host apps route and the last choice persists in the + * browser through the controller's persisted snapshot store; desktop + * availability for file paths arrives once per page from the Session Remote, + * which also runs the open and reveal gestures. */ import type { Context as ClientContext } from '@deepseek-ai/cordis' import type {} from '@deepseek-ai/dsh-client-locale/client' import type {} from '@deepseek-ai/dsh-client-ui-renderer/client' import type {} from '@deepseek-ai/dsh-client-ui-session/client' +import type {} from '@deepseek-ai/dsh-client-ui-sidebar-documentpreview/client' +import type {} from '@deepseek-ai/dsh-api-gateway/client' +import type {} from '@deepseek-ai/dsh-api-remotes/client' +import type {} from '@deepseek-ai/dsh-api-session-controller/remote' import { OPEN_IN_APP_ICON_PREFIX } from '@deepseek-ai/dsh-host-open-in-app/shared' import { OpenInAppController } from './controller.ts' import { OpenInAppAction, type OpenInAppActionInjected } from './OpenInAppAction.tsx' +import { OpenInAppPathController } from './open-path.ts' +import { OpenPathAction, type OpenPathInjected } from './OpenPathAction.tsx' +import { OpenPathEmptyAction } from './OpenPathEmptyAction.tsx' import { en, NS, zh, type OpenInAppKey } from './locales.ts' declare module '@deepseek-ai/dsh-client-ui-slots' { @@ -23,17 +33,22 @@ declare module '@deepseek-ai/dsh-client-ui-slots' { } export type { OpenInAppActionInjected, OpenInAppActionProps } from './OpenInAppAction.tsx' +export type { OpenInAppPathAction, OpenInAppPathFailure, OpenInAppPathRemote } from './open-path.ts' +export type { OpenPathActionProps, OpenPathInjected } from './OpenPathAction.tsx' +export type { OpenPathEmptyActionProps } from './OpenPathEmptyAction.tsx' -/** Required services for locale registration and the header-slot contribution. */ -export const inject = ['sessions', 'slots', 'locale'] +/** Required services: sessions, the slot registry, copy, and the Remote carrier with its `session` namespace. */ +export const inject = ['sessions', 'slots', 'locale', 'remote', 'remote.session'] /** - * Client plugin body: register the dictionaries and the header split button. + * Client plugin body: register the dictionaries, the header split button, and + * the document preview's path controls. * @param ctx - client root context. */ export function apply(ctx: ClientContext): void { const controller = new OpenInAppController() void controller.load() + const paths = new OpenInAppPathController(ctx.remote) ctx.effect(() => ctx.locale.register(NS, { zh, en }), 'open-in-app: dictionaries') ctx.slots.inject('conversation.session.header.utilities', () => ctx.slots.register({ name: 'conversation.session.header.utilities', @@ -50,4 +65,21 @@ export function apply(ctx: ClientContext): void { iconUrl: appId => `${OPEN_IN_APP_ICON_PREFIX}/${appId}`, }), }, OpenInAppAction)) + const pathInjected = (): OpenPathInjected => ({ + hooks: { openInAppDesktop: paths.desktop }, + loadDesktop: () => paths.load(), + openPath: (path, action) => paths.openPath(path, action), + }) + ctx.slots.inject('sidebar.right.tab.document.actions', () => ctx.slots.register({ + name: 'sidebar.right.tab.document.actions', + id: 'open-in-app', + locale: NS, + inject: pathInjected, + }, OpenPathAction)) + ctx.slots.inject('sidebar.right.tab.document.unpreviewable', () => ctx.slots.register({ + name: 'sidebar.right.tab.document.unpreviewable', + id: 'open-in-app', + locale: NS, + inject: pathInjected, + }, OpenPathEmptyAction)) } diff --git a/packages/client/ui-open-in-app/src/client/locales.ts b/packages/client/ui-open-in-app/src/client/locales.ts index a5cadacd05..3142716615 100644 --- a/packages/client/ui-open-in-app/src/client/locales.ts +++ b/packages/client/ui-open-in-app/src/client/locales.ts @@ -1,4 +1,4 @@ -/** `open-in-app` namespace dictionaries. */ +/** `open-in-app` namespace dictionaries: the workspace split button and the document-preview path controls. */ /** Dictionary namespace owned by this plugin. */ export const NS = 'open-in-app' @@ -44,6 +44,14 @@ export const zh = { 'open.error': '打开失败', 'menu.toggle': '选择打开方式', 'menu.aria': '打开方式', + 'path.open': '打开', + 'path.open.tooltip': '用默认应用打开', + 'path.more': '更多打开方式', + 'path.defaultApp': '用默认应用打开', + 'path.reveal': '显示文件位置', + 'path.unpreviewable': '使用默认应用打开', + 'path.openError': '打开失败,请重试', + 'path.revealError': '无法显示文件位置,请重试', ...PRODUCT_NAMES, 'app.finder': '访达', 'app.explorer': '文件资源管理器', @@ -58,6 +66,14 @@ export const en: Record = { 'open.error': 'Failed to open', 'menu.toggle': 'Choose an app to open in', 'menu.aria': 'Open in', + 'path.open': 'Open', + 'path.open.tooltip': 'Open in the default app', + 'path.more': 'More ways to open', + 'path.defaultApp': 'Open in default app', + 'path.reveal': 'Show file location', + 'path.unpreviewable': 'Open in default app', + 'path.openError': 'Could not open. Try again.', + 'path.revealError': 'Could not show the file location. Try again.', ...PRODUCT_NAMES, 'app.finder': 'Finder', 'app.explorer': 'File Explorer', diff --git a/packages/client/ui-open-in-app/src/client/open-failure-toast.tsx b/packages/client/ui-open-in-app/src/client/open-failure-toast.tsx new file mode 100644 index 0000000000..721e2b9f6f --- /dev/null +++ b/packages/client/ui-open-in-app/src/client/open-failure-toast.tsx @@ -0,0 +1,25 @@ +/** Per-control failure banner for path gestures. */ +import { useRef, useState } from 'react' +import type { ReactNode } from 'react' +import { IconWarningOutline16, Toast } from '@deepseek-ai/dsh-client-ui-primitives' + +/** + * Transient failure banner owned by the control that initiated the gesture, + * so one failed request announces once, from the control the user pressed. + * @returns `toast` to render inside the control and `show` to announce one + * failure with resolved copy; announcing again replays the banner. + */ +export function useOpenFailureToast(): { toast: ReactNode; show: (text: string) => void } { + // The seq keys the banner so the same failure text replays instead of staying silently in place. + const seq = useRef(0) + const [banner, setBanner] = useState<{ seq: number; text: string } | null>(null) + return { + toast: banner === null + ? null + : } onDone={() => { setBanner(null) }} />, + show: (text) => { + seq.current += 1 + setBanner({ seq: seq.current, text }) + }, + } +} diff --git a/packages/client/ui-open-in-app/src/client/open-path.ts b/packages/client/ui-open-in-app/src/client/open-path.ts new file mode 100644 index 0000000000..161fcf104f --- /dev/null +++ b/packages/client/ui-open-in-app/src/client/open-path.ts @@ -0,0 +1,75 @@ +/** + * Default-application actions on one Host file path, over the Session Remote: + * whether this Host can hand a path to a desktop, and the open or reveal call. + * The desktop answer is read once per page; a failed read renders no control. + */ +import { createSnapshotStore, type SnapshotStore } from '@deepseek-ai/dsh-client-store' +import type { RemoteResult } from '@deepseek-ai/dsh-api-remotes/client' +import type { SessionOpenWorkspacePathRequest } from '@deepseek-ai/dsh-api-session-controller/types' + +/** What a path gesture asks of the Host desktop: the default application, or the file manager showing the file. */ +export type OpenInAppPathAction = 'open' | 'reveal' + +/** Failure kind of one settled path gesture, for the initiating control to announce. */ +export type OpenInAppPathFailure = 'openError' | 'revealError' + +/** The slice of the Client Remote the path actions call. */ +export interface OpenInAppPathRemote { + readonly session: { + /** Whether the Host can hand a workspace path to a native desktop. */ + canOpenWorkspacePath(): Promise> + /** Open one Host path in its default application, or reveal it in the file manager. */ + openWorkspacePath(request: SessionOpenWorkspacePathRequest, signal?: AbortSignal): Promise> + } +} + +/** Page-lifetime desktop availability and the open/reveal carrier shared by every path control. */ +export class OpenInAppPathController { + /** Whether the Host desktop can open paths; null until the Host answered, false also after a failed read. */ + readonly desktop: SnapshotStore = createSnapshotStore(null) + private loading: Promise | undefined + + /** + * @param remote - the Session Remote namespace answering availability and running gestures. + */ + constructor(private readonly remote: OpenInAppPathRemote) {} + + /** + * Read desktop availability once per controller life; concurrent calls share the read. + * @returns after availability is published. + */ + load(): Promise { + this.loading ??= this.run() + return this.loading + } + + /** + * Open one Host path in its default application, or reveal it in the file manager. + * @param path - absolute path on the Host, as the file's metadata reports it. + * @param action - default application open, or file-manager reveal. + * @returns the failure kind to announce, or `null` once the Host acknowledged. + */ + async openPath(path: string, action: OpenInAppPathAction): Promise { + const request: SessionOpenWorkspacePathRequest = action === 'reveal' ? { path, action } : { path } + let ok = false + try { + ok = (await this.remote.session.openWorkspacePath(request)).ok + } catch { + // Swallows carrier rejections: a Host that cannot be reached failed the + // gesture like a Host that refused it, and the control announces that. + } + return ok ? null : action === 'open' ? 'openError' : 'revealError' + } + + private async run(): Promise { + let available = false + try { + const result = await this.remote.session.canOpenWorkspacePath() + available = result.ok && result.value + } catch { + // Swallows carrier rejections: an unreachable Host reads as no desktop, + // so the preview shows no path control rather than a broken one. + } + this.desktop.set(available) + } +} diff --git a/packages/client/ui-open-in-app/tests/browser-plugin.client.spec.ts b/packages/client/ui-open-in-app/tests/browser-plugin.client.spec.ts index eefdae245d..9b289c7b64 100644 --- a/packages/client/ui-open-in-app/tests/browser-plugin.client.spec.ts +++ b/packages/client/ui-open-in-app/tests/browser-plugin.client.spec.ts @@ -1,7 +1,7 @@ /** - * Browser-half lifecycle over the real SlotRegistry: the dictionary and - * header-slot registrations with fiber teardown proving removal (HMR safety) - * and the injected controller face. + * Browser-half lifecycle over the real SlotRegistry: the dictionary, + * header-slot, and document-preview path registrations with fiber teardown + * proving removal (HMR safety) and the injected controller faces. */ import { Context } from '@deepseek-ai/cordis' @@ -9,16 +9,26 @@ import { afterEach, describe, expect, it, vi } from 'vitest' import { SlotRegistry } from '@deepseek-ai/dsh-client-ui-renderer/client' import { LocaleRuntime } from '@deepseek-ai/dsh-client-locale/client' import type {} from '@deepseek-ai/dsh-client-ui-conversation/client' -import { apply, inject, type OpenInAppActionInjected } from '../src/client/index.ts' +import { apply, inject, type OpenInAppActionInjected, type OpenPathInjected } from '../src/client/index.ts' import { apply as nodeApply } from '../src/index.ts' import { OpenInAppAction } from '../src/client/OpenInAppAction.tsx' +import { OpenPathAction } from '../src/client/OpenPathAction.tsx' +import { OpenPathEmptyAction } from '../src/client/OpenPathEmptyAction.tsx' import { en, NS, zh } from '../src/client/locales.ts' afterEach(() => { vi.unstubAllGlobals() }) -/** Boot the browser half over a real slot tree that declares the header list. */ +/** The Session Remote slice the path controls call; answers a desktop and acknowledges every gesture. */ +const remote = { + session: { + canOpenWorkspacePath: vi.fn(async () => ({ ok: true as const, value: true })), + openWorkspacePath: vi.fn(async () => ({ ok: true as const, value: { opened: true as const } })), + }, +} + +/** Boot the browser half over a real slot tree that declares the header list and the document-preview seats. */ async function bench(): Promise<{ ctx: Context; fiber: ReturnType }> { const ctx = new Context() await ctx.plugin(SlotRegistry).await() @@ -26,10 +36,14 @@ async function bench(): Promise<{ ctx: Context; fiber: ReturnType null) ctx.provide('sessions', {}) ctx.provide('locale', new LocaleRuntime(ctx)) + ctx.provide('remote', remote as never) + ctx.provide('remote.session', remote.session as never) const fiber = ctx.plugin({ inject: [...inject], apply }) await fiber.await() return { ctx, fiber } @@ -41,7 +55,29 @@ function headerEntryIds(ctx: Context): (string | undefined)[] { describe('open-in-app browser half', () => { it('declares the services it binds', () => { - expect(inject).toEqual(['sessions', 'slots', 'locale']) + expect(inject).toEqual(['sessions', 'slots', 'locale', 'remote', 'remote.session']) + }) + + it('registers both document-preview path controls behind one desktop answer, and fiber teardown removes them', async () => { + vi.stubGlobal('fetch', vi.fn(async () => new Response(JSON.stringify({ apps: [] }), { status: 200 }))) + const { ctx, fiber } = await bench() + const header = ctx.slots.entries('sidebar.right.tab.document.actions')[0] + const empty = ctx.slots.entries('sidebar.right.tab.document.unpreviewable')[0] + expect(header?.component).toBe(OpenPathAction) + expect(empty?.component).toBe(OpenPathEmptyAction) + expect(header?.options).toMatchObject({ id: 'open-in-app' }) + const face = (header?.inject as unknown as () => OpenPathInjected)() + const emptyFace = (empty?.inject as unknown as () => OpenPathInjected)() + expect(emptyFace.hooks.openInAppDesktop).toBe(face.hooks.openInAppDesktop) + expect(face.hooks.openInAppDesktop.getSnapshot()).toBeNull() + await Promise.all([face.loadDesktop(), emptyFace.loadDesktop()]) + expect(remote.session.canOpenWorkspacePath).toHaveBeenCalledOnce() + expect(face.hooks.openInAppDesktop.getSnapshot()).toBe(true) + expect(await face.openPath('/w/clip.mp4', 'reveal')).toBeNull() + expect(remote.session.openWorkspacePath).toHaveBeenLastCalledWith({ path: '/w/clip.mp4', action: 'reveal' }) + await fiber.dispose() + expect(ctx.slots.entries('sidebar.right.tab.document.actions').map(entry => entry.options.id)).not.toContain('open-in-app') + expect(ctx.slots.entries('sidebar.right.tab.document.unpreviewable').map(entry => entry.options.id)).not.toContain('open-in-app') }) it('registers the header split button, and fiber teardown removes it (HMR safety)', async () => { diff --git a/packages/client/ui-open-in-app/tests/open-path-action.client.spec.tsx b/packages/client/ui-open-in-app/tests/open-path-action.client.spec.tsx new file mode 100644 index 0000000000..819b6473e2 --- /dev/null +++ b/packages/client/ui-open-in-app/tests/open-path-action.client.spec.tsx @@ -0,0 +1,132 @@ +// @vitest-environment jsdom +/** + * The two document-preview path controls: hidden until the Host reports a + * desktop, busy only for their own gesture, and announcing a failure once + * through their own toast. + */ +import { afterEach, describe, expect, it, vi } from 'vitest' +import { act, cleanup, fireEvent, render, screen } from '@testing-library/react' +import { makeTranslate } from '@deepseek-ai/dsh-client-test-runtime' +import { createSnapshotStore } from '@deepseek-ai/dsh-client-store' +import type { SessionId } from '@deepseek-ai/dsh-session/types' +import { OpenPathAction, type OpenPathActionProps } from '../src/client/OpenPathAction.tsx' +import { OpenPathEmptyAction, type OpenPathEmptyActionProps } from '../src/client/OpenPathEmptyAction.tsx' +import type { OpenInAppPathAction, OpenInAppPathFailure } from '../src/client/open-path.ts' +import { zh } from '../src/client/locales.ts' + +afterEach(() => { + cleanup() + vi.restoreAllMocks() + vi.useRealTimers() +}) + +const t = makeTranslate(zh) +const FILE = { sessionId: 's-1' as SessionId, path: 'work/clip.mp4' } +const ABSOLUTE_PATH = '/host/project/work/clip.mp4' + +interface Bench { + props: OpenPathActionProps & OpenPathEmptyActionProps + desktop: ReturnType> + loadDesktop: ReturnType + openPath: ReturnType Promise>> +} + +function bench(over: { desktop?: boolean | null; openPath?: Bench['openPath'] } = {}): Bench { + const desktop = createSnapshotStore(over.desktop === undefined ? true : over.desktop) + const loadDesktop = vi.fn(async () => {}) + const openPath = over.openPath ?? vi.fn(async () => null) + function useSelector(source: { getSnapshot(): T }): (select: (value: T) => R) => R { + return select => select(source.getSnapshot()) + } + const props = { + file: FILE, + absolutePath: ABSOLUTE_PATH, + useOpenInAppDesktop: useSelector(desktop), + loadDesktop, + openPath, + t, + } as unknown as Bench['props'] + return { props, desktop, loadDesktop, openPath } +} + +describe('OpenPathAction visibility', () => { + it('renders nothing and asks for the desktop answer while it is unknown, and nothing without a desktop', () => { + const unknown = bench({ desktop: null }) + const { container } = render() + expect(container.innerHTML).toBe('') + expect(unknown.loadDesktop).toHaveBeenCalledOnce() + cleanup() + const absent = bench({ desktop: false }) + expect(render().container.innerHTML).toBe('') + expect(absent.loadDesktop).not.toHaveBeenCalled() + }) +}) + +describe('OpenPathAction gestures', () => { + it('opens the file in its default application from the main button and reveals it from the menu', async () => { + const b = bench() + render() + const main = screen.getByRole('button', { name: zh['path.open'] }) + await act(async () => { fireEvent.click(main) }) + expect(b.openPath).toHaveBeenLastCalledWith(ABSOLUTE_PATH, 'open') + fireEvent.click(screen.getByRole('button', { name: zh['path.more'] })) + await act(async () => { fireEvent.click(screen.getByRole('menuitem', { name: zh['path.reveal'] })) }) + expect(b.openPath).toHaveBeenLastCalledWith(ABSOLUTE_PATH, 'reveal') + expect(screen.queryByRole('menu')).toBeNull() + }) + + it('offers the default application from the menu too, and Escape closes the menu without a gesture', async () => { + const b = bench() + render() + const more = screen.getByRole('button', { name: zh['path.more'] }) + fireEvent.click(more) + expect(more.getAttribute('aria-expanded')).toBe('true') + fireEvent.keyDown(screen.getByRole('menu'), { key: 'Escape' }) + expect(screen.queryByRole('menu')).toBeNull() + expect(b.openPath).not.toHaveBeenCalled() + fireEvent.click(more) + await act(async () => { fireEvent.click(screen.getByRole('menuitem', { name: zh['path.defaultApp'] })) }) + expect(b.openPath).toHaveBeenLastCalledWith(ABSOLUTE_PATH, 'open') + }) + + it('disables both halves while its own gesture settles and leaves no failure on the control', async () => { + const settled = Promise.withResolvers() + const b = bench({ openPath: vi.fn(() => settled.promise) }) + const { container } = render() + const main = screen.getByRole('button', { name: zh['path.open'] }) + fireEvent.click(main) + expect(main).toHaveProperty('disabled', true) + expect(screen.getByRole('button', { name: zh['path.more'] })).toHaveProperty('disabled', true) + expect(container.querySelector('[data-open-path]')?.getAttribute('data-state')).toBe('busy') + fireEvent.click(main) + expect(b.openPath).toHaveBeenCalledOnce() + await act(async () => { settled.resolve('openError'); await settled.promise }) + expect(main).toHaveProperty('disabled', false) + expect(container.querySelector('[data-open-path]')?.getAttribute('data-state')).toBe('idle') + expect(screen.getByRole('alert').textContent).toContain(zh['path.openError']) + }) +}) + +describe('OpenPathEmptyAction', () => { + it('renders nothing without a desktop and opens the file in its default application with one', async () => { + const absent = bench({ desktop: false }) + expect(render().container.innerHTML).toBe('') + cleanup() + const b = bench() + render() + await act(async () => { fireEvent.click(screen.getByRole('button', { name: zh['path.unpreviewable'] })) }) + expect(b.openPath).toHaveBeenCalledWith(ABSOLUTE_PATH, 'open') + expect(screen.queryByRole('alert')).toBeNull() + }) + + it('announces a failed open once through its own toast, which leaves after its hold and fade', async () => { + vi.useFakeTimers() + const b = bench({ openPath: vi.fn(async () => 'openError' as const) }) + render() + await act(async () => { fireEvent.click(screen.getByRole('button', { name: zh['path.unpreviewable'] })) }) + expect(screen.getAllByRole('alert')).toHaveLength(1) + expect(screen.getByRole('alert').textContent).toContain(zh['path.openError']) + act(() => { vi.advanceTimersByTime(4_000) }) + expect(screen.queryByRole('alert')).toBeNull() + }) +}) diff --git a/packages/client/ui-open-in-app/tests/open-path.client.spec.ts b/packages/client/ui-open-in-app/tests/open-path.client.spec.ts new file mode 100644 index 0000000000..2e8560f7cf --- /dev/null +++ b/packages/client/ui-open-in-app/tests/open-path.client.spec.ts @@ -0,0 +1,71 @@ +/** Path controller behavior: the once-per-page desktop read and the open/reveal outcomes over the Session Remote. */ + +import { describe, expect, it, vi } from 'vitest' +import { RemoteError } from '@deepseek-ai/dsh-client-test-runtime' +import type { SessionOpenWorkspacePathRequest } from '@deepseek-ai/dsh-api-session-controller/types' +import { OpenInAppPathController, type OpenInAppPathRemote } from '../src/client/open-path.ts' + +type SessionRemote = OpenInAppPathRemote['session'] + +function remoteOf(over: Partial = {}): OpenInAppPathRemote { + return { + session: { + canOpenWorkspacePath: async () => ({ ok: true, value: true }), + openWorkspacePath: async () => ({ ok: true, value: { opened: true } }), + ...over, + }, + } +} + +describe('OpenInAppPathController desktop availability', () => { + it('starts unanswered and shares one read across concurrent loads', async () => { + const canOpenWorkspacePath = vi.fn(async () => ({ ok: true as const, value: true })) + const controller = new OpenInAppPathController(remoteOf({ canOpenWorkspacePath })) + expect(controller.desktop.getSnapshot()).toBeNull() + await Promise.all([controller.load(), controller.load()]) + await controller.load() + expect(canOpenWorkspacePath).toHaveBeenCalledOnce() + expect(controller.desktop.getSnapshot()).toBe(true) + }) + + it('publishes no desktop for a refusing Host, a failed answer, and a rejecting carrier', async () => { + const refusing = new OpenInAppPathController(remoteOf({ canOpenWorkspacePath: async () => ({ ok: true, value: false }) })) + await refusing.load() + expect(refusing.desktop.getSnapshot()).toBe(false) + + const failed = new OpenInAppPathController(remoteOf({ + canOpenWorkspacePath: async () => ({ ok: false, error: new RemoteError('gateway/internal', 'boom', {}) }), + })) + await failed.load() + expect(failed.desktop.getSnapshot()).toBe(false) + + const rejecting = new OpenInAppPathController(remoteOf({ canOpenWorkspacePath: () => Promise.reject(new Error('down')) })) + await rejecting.load() + expect(rejecting.desktop.getSnapshot()).toBe(false) + }) +}) + +describe('OpenInAppPathController gestures', () => { + it('sends the default-application open without an action and the reveal with one', async () => { + const openWorkspacePath = vi.fn(async (_request: SessionOpenWorkspacePathRequest, _signal?: AbortSignal) => + ({ ok: true as const, value: { opened: true as const } })) + const controller = new OpenInAppPathController(remoteOf({ openWorkspacePath })) + expect(await controller.openPath('/w/clip.mp4', 'open')).toBeNull() + expect(await controller.openPath('/w/clip.mp4', 'reveal')).toBeNull() + expect(openWorkspacePath.mock.calls.map(call => call[0])).toEqual([ + { path: '/w/clip.mp4' }, + { path: '/w/clip.mp4', action: 'reveal' }, + ]) + }) + + it('names the failed gesture for a refused answer and for a rejecting carrier', async () => { + const refused = new OpenInAppPathController(remoteOf({ + openWorkspacePath: async () => ({ ok: false, error: new RemoteError('gateway/internal', 'boom', {}) }), + })) + expect(await refused.openPath('/w/clip.mp4', 'open')).toBe('openError') + expect(await refused.openPath('/w/clip.mp4', 'reveal')).toBe('revealError') + + const rejecting = new OpenInAppPathController(remoteOf({ openWorkspacePath: () => Promise.reject(new Error('down')) })) + expect(await rejecting.openPath('/w/clip.mp4', 'open')).toBe('openError') + }) +}) diff --git a/packages/client/ui-open-in-app/tsconfig.json b/packages/client/ui-open-in-app/tsconfig.json index 4264bb7cab..55f2ded3e1 100644 --- a/packages/client/ui-open-in-app/tsconfig.json +++ b/packages/client/ui-open-in-app/tsconfig.json @@ -11,6 +11,12 @@ { "path": "../../../vendor/cordis" }, + { + "path": "../../api/gateway/tsconfig.client.json" + }, + { + "path": "../../api/remotes/tsconfig.client.json" + }, { "path": "../../api/session-controller/tsconfig.client.json" }, @@ -35,6 +41,9 @@ { "path": "../ui-session" }, + { + "path": "../ui-sidebar-documentpreview" + }, { "path": "../ui-slots" } diff --git a/packages/client/ui-sidebar-documentpreview/README.i18n.yaml b/packages/client/ui-sidebar-documentpreview/README.i18n.yaml index 6bf77e5972..07be1c50ac 100644 --- a/packages/client/ui-sidebar-documentpreview/README.i18n.yaml +++ b/packages/client/ui-sidebar-documentpreview/README.i18n.yaml @@ -2,5 +2,5 @@ # side as of the last confirmed-consistent state. Both languages carry equal authority; # after editing either side, bring the other along and re-record with: # pnpm run verify-translation-pairing --write packages/client/ui-sidebar-documentpreview/README.md -README.md: d4e114aa6e12171d61f8a5284fdbe923916fe0d9 -README.zh.md: 32cb704d29fd0009fdf7a51235617c25029295f0 +README.md: c0cb4796036d3ca20e7f3bbd239c9816a177feeb +README.zh.md: 7b47c00b85b6c128946e3070d805b52b2a0781ef diff --git a/packages/client/ui-sidebar-documentpreview/README.md b/packages/client/ui-sidebar-documentpreview/README.md index d4e114aa6e..c0cb479603 100644 --- a/packages/client/ui-sidebar-documentpreview/README.md +++ b/packages/client/ui-sidebar-documentpreview/README.md @@ -1,5 +1,5 @@ --- -description: "Document previews in the right Sidebar: shared file loading and controls, selectable Markdown, code, image, PDF and HTML renderers, and plain-text fallback." +description: "Document previews in the right Sidebar: shared file loading and controls, selectable Markdown, code, image, PDF and HTML renderers, plain-text fallback, and child slots handing a file to the Host desktop." kind: "package-reference" --- @@ -9,7 +9,7 @@ English | [中文](README.zh.md) ## Summary -Preview readable files in the right Sidebar and choose among registered renderers without opening another tab. Markdown and code receive accumulated text pages; PDF, HTML, and common images receive complete bytes; unknown file extensions use plain text. The tab owns loading, file status, renderer selection, wrap, and reload, while document bodies register through the same metadata registry and child slot. The Sidebar tab kind is `text`. +Preview readable files in the right Sidebar and choose among registered renderers without opening another tab. Markdown and code receive accumulated text pages; PDF, HTML, and common images receive complete bytes; unknown file extensions use plain text. The tab owns loading, file status, renderer selection, wrap, and reload, while document bodies register through the same metadata registry and child slot. Two further child slots let another plugin hand the previewed file to the Host desktop from the header and from the empty state of a file the preview cannot render. The Sidebar tab kind is `text`. ## Table of Contents @@ -27,7 +27,7 @@ Preview readable files in the right Sidebar and choose among registered renderer ## What it registers - **The type** — `ctx.sidebarRightTabs.register(...)` with id `@deepseek-ai/dsh-client-ui-sidebar-documentpreview` (this implementation's identity in the tab system, and the key its body registers under), kind `text`, pattern `dsh-resource://file/**`, band `fallback`. `canOpen` accepts only Session addresses, whose paths may be relative or absolute; bare `absolute` addresses are not claimed. A type registered at the `extension` or `builtin` band for a narrower pattern (say `*.png`) takes those addresses; other supported files land here. The whole address is the content identity, so two files with one name in different directories, or one path under two sessions, are two tabs; the decoded basename is the tab title, and the keyed `sidebar.right.pane.tab.title` seat places its extension-specific `FileTypeIcon` before that title. -- **The body** — the keyed `sidebar.right.pane.tab` seat under the type's id. Its fixed header shows the Host's absolute path when available, otherwise the requested path; directories use tertiary label colour, the name uses primary label colour, and a clipped path retains and fades toward its final segment while its tooltip exposes the full value. A dropdown selects among matching renderers and plain text; a suffix declared binary (bitmap images, PDF) drops the plain-text fallback, and a single remaining candidate renders no viewer control at all. A known binary container suffix with no registered renderer (audio, video, archives, office documents) shows an unsupported empty state under the path header — the file-type icon and one explanatory line — and never issues a read. A wrap toggle appears only when the selected renderer declares `wrap: true`; its glyph describes the mode the click selects, and the per-tab preference starts on. Reload stays in this header, not the Sidebar's tab strip. The body reaches every pane edge; each renderer owns its content inset and may own an inner scrollport. This intentionally differs from the Files tab's 2px right-side scrollbar offset: previews keep the full pane width so edge-to-edge HTML and code scrollports end at the pane edge. +- **The body** — the keyed `sidebar.right.pane.tab` seat under the type's id. Its fixed header shows the Host's absolute path when available, otherwise the requested path; directories use tertiary label colour, the name uses primary label colour, and a clipped path retains and fades toward its final segment while its tooltip exposes the full value. A dropdown selects among matching renderers and plain text; a suffix declared binary (bitmap images, PDF) drops the plain-text fallback, and a single remaining candidate renders no viewer control at all. A known binary container suffix with no registered renderer (audio, video, archives, office documents) shows an unsupported empty state under the path header — the file-type icon and one explanatory line — and never issues a read. Two Session-scoped list child slots hand the previewed file to other plugins once its metadata reports a Host path, both with `file` and `absolutePath` as owner props: `sidebar.right.tab.document.actions` renders after the header's own controls in every state that shows the header, and `sidebar.right.tab.document.unpreviewable` renders in the unsupported empty state and in the empty state of a readable file the preview cannot render (`not-text`, `too-large`), where Retry would otherwise stand; a carrier or unclassified read failure keeps Retry, and a missing or non-regular path offers only its explanation. The shipped occupant of both is [`ui-open-in-app`](../ui-open-in-app/README.md). A wrap toggle appears only when the selected renderer declares `wrap: true`; its glyph describes the mode the click selects, and the per-tab preference starts on. Reload stays in this header, not the Sidebar's tab strip. The body reaches every pane edge; each renderer owns its content inset and may own an inner scrollport. This intentionally differs from the Files tab's 2px right-side scrollbar offset: previews keep the full pane width so edge-to-edge HTML and code scrollports end at the pane edge. - **Shared loading and view state**, session-scoped and bucketed by tab id. The store holds accumulated pages or complete bytes, read and observed versions, loading/failure state, renderer choice, scroll offset, wrap, and the answered navigation revision. The ordinary inject face calls Remote readers and writes through declared store actions. Reloads and loading-mode changes retire older requests; the tab's abort signal forgets its state. Document implementations register metadata with `ctx.documentPreviews.register({ id, extensions, binaryExtensions?, priority, title, loading, wrap? })` and a body under the same `id` in the keyed, Session-scoped `sidebar.right.tab.document` child slot. `binaryExtensions` names the suffixes among `extensions` whose bytes are not readable text; a file matching one loses the plain-text fallback among its viewer choices. Own both registrations with effects and wait for the child slot through `ctx.slots.inject`. Bodies receive `resourceAddress`, prepared `content`, `wrap`, `scrollportRef`, and the standard `useTabInfo`/`useResource` hooks; they do not receive a custom resource loader. A renderer that owns an inner scrolling element attaches `scrollportRef` to it, and the owner returns to the shared body when that element unmounts. Metadata declares `loading: 'text-pages'` or `'bytes-complete'`. The registry retains all matching alternatives: `extension` (the default) ranks above `builtin`, then longer suffixes rank first, then registration order. The dropdown preserves a selected implementation while it remains available; removing it selects the next candidate. Builtin bodies use these same registrations. @@ -43,7 +43,7 @@ A tab uses the Session address built by `fileAddressFor`, carrying a relative or The body reads its record, navigation and lifetime through `useTabInfo().tab`. `useResource<'file'>(tab.contentId)` supplies metadata; ordinary inject callbacks supply content reads: - The resource snapshot contains only `status`, `value`, and `failure`; `value` is `WorkspaceFileStat` metadata. Content reads do not wait for the first metadata frame once the provider is available. Observation failures take precedence over Preview's change notice; neither automatically replaces loaded content. -- **Text pages** — plain text, Markdown, and code read through an inject callback to `remote.workspaceFiles.read(sessionId, path, { offset }, signal)`. The first mount reads page one; scrolling to the body end or **Load more** requests the next page until `eof`. The owner delivers the accumulated prefix as `{ kind: 'text', text, pages, eof }`, including source offsets and line counts. Markdown and code render that prefix incrementally; they do not render each page as a separate document. A newer-version page past page one restarts from the beginning rather than mixing versions. A failure before any content fills the body with the file-type icon, explanation, and retry; a later failure retains loaded content and adds the retry below it. +- **Text pages** — plain text, Markdown, and code read through an inject callback to `remote.workspaceFiles.read(sessionId, path, { offset }, signal)`. The first mount reads page one; scrolling to the body end or **Load more** requests the next page until `eof`. The owner delivers the accumulated prefix as `{ kind: 'text', text, pages, eof }`, including source offsets and line counts. Markdown and code render that prefix incrementally; they do not render each page as a separate document. A newer-version page past page one restarts from the beginning rather than mixing versions. A failure before any content fills the body with the file-type icon, the explanation, and the recourse the failure names (Retry, the unpreviewable child slot, or nothing); a later failure retains loaded content and adds the retry below it. - **Complete bytes** — PDF, HTML, and common images use an inject callback to `remote.workspaceFiles.readAll(sessionId, path, signal)`. `rpc.ts` decodes the wire base64 into `data: Uint8Array` for `{ kind: 'bytes', data }`. The Host's `maxFileBytes` cap rejects oversized files rather than truncating them. PDF copies retained bytes before worker transfer, keeping the Preview buffer usable. Bytes stay in transient view state, never persisted layouts or Session JSONL. Loading-mode changes retire previous results. - **Reload** — only the current Preview tab rereads through its Remote callbacks, preserving its scroll preference and retiring older requests. Its change notice compares the read version and the observation captured at read start with later `resource.value.version`; an already observed version does not become a new change after refresh. Reads neither refresh shared metadata nor clear another tab's notice. diff --git a/packages/client/ui-sidebar-documentpreview/README.zh.md b/packages/client/ui-sidebar-documentpreview/README.zh.md index 32cb704d29..7b47c00b85 100644 --- a/packages/client/ui-sidebar-documentpreview/README.zh.md +++ b/packages/client/ui-sidebar-documentpreview/README.zh.md @@ -1,5 +1,5 @@ --- -description: "右侧 Sidebar 的文档预览:共享文件加载与控件,可选 Markdown、代码、图片、PDF 和 HTML 渲染器,并以纯文本兜底。" +description: "右侧 Sidebar 的文档预览:共享文件加载与控件,可选 Markdown、代码、图片、PDF 和 HTML 渲染器,以纯文本兜底,并提供把文件交给 Host 桌面的子 slot。" kind: "package-reference" --- @@ -9,7 +9,7 @@ kind: "package-reference" ## 概述 -在右侧 Sidebar 预览可读文件,无需另开 tab 即可切换已注册的渲染器。Markdown 和代码接收累计文本页;PDF、HTML 和常见图片接收完整字节;未知文件扩展名使用纯文本。tab 负责加载、文件状态、渲染器选择、换行和重新载入,文档正文通过同一元数据注册表与子 slot 注册。Sidebar tab 的 kind 为 `text`。 +在右侧 Sidebar 预览可读文件,无需另开 tab 即可切换已注册的渲染器。Markdown 和代码接收累计文本页;PDF、HTML 和常见图片接收完整字节;未知文件扩展名使用纯文本。tab 负责加载、文件状态、渲染器选择、换行和重新载入,文档正文通过同一元数据注册表与子 slot 注册。另有两个子 slot 让别的插件从头部和从无法渲染文件的空态把当前文件交给 Host 桌面。Sidebar tab 的 kind 为 `text`。 ## 目录 @@ -27,7 +27,7 @@ kind: "package-reference" ## 注册了什么 - **类型** —— `ctx.sidebarRightTabs.register(...)`,id 为 `@deepseek-ai/dsh-client-ui-sidebar-documentpreview`(这个实现在 tab 系统中的身份,也是其正文注册所用的键),kind `text`,pattern `dsh-resource://file/**`,档位 `fallback`。`canOpen` 只接受 Session 地址,其中路径可为相对或绝对路径;不认领裸 `absolute` 地址。在 `extension` 或 `builtin` 档以更窄 pattern(比如 `*.png`)注册的类型接走那些地址;其他受支持文件落到这里。整个地址就是内容身份,所以不同目录下同名的两个文件、或同一路径在两个会话之下,是两个 tab;解码后的 basename 是 tab 标题,keyed slot `sidebar.right.pane.tab.title` 会在标题前放置按扩展名选择的 `FileTypeIcon`。 -- **正文** —— keyed slot `sidebar.right.pane.tab`,键为类型的 id。固定头部在可用时显示 Host 的绝对路径,否则显示请求路径;目录使用三级标签色,文件名使用一级标签色,路径过长时保留末段并向开头淡出,提示中仍提供完整值。下拉菜单可在匹配的渲染器与纯文本间切换;声明为二进制的后缀(位图图片、PDF)不提供纯文本兜底,只剩一个候选时完全不渲染查看器控件。已知的二进制容器后缀(音频、视频、压缩包、office 文档)没有注册渲染器时,在路径头部下方显示不支持预览的空态——文件类型图标加一行说明——并且不会发起读取。仅当所选渲染器声明 `wrap: true` 时显示换行开关;图标表示点击后切换到的模式,该偏好按 tab 保存,初始开启。重新载入仍在此头部,不放入 Sidebar 的 tab 条。正文贴合格的每条边,各渲染器自行提供内容留白,并可拥有内部滚动区。这与 Files tab 右侧预留 2px 滚动条间距的布局有意不同:Preview 使用格的完整宽度,使贴边 HTML 与代码滚动区终止于格的边缘。 +- **正文** —— keyed slot `sidebar.right.pane.tab`,键为类型的 id。固定头部在可用时显示 Host 的绝对路径,否则显示请求路径;目录使用三级标签色,文件名使用一级标签色,路径过长时保留末段并向开头淡出,提示中仍提供完整值。下拉菜单可在匹配的渲染器与纯文本间切换;声明为二进制的后缀(位图图片、PDF)不提供纯文本兜底,只剩一个候选时完全不渲染查看器控件。已知的二进制容器后缀(音频、视频、压缩包、office 文档)没有注册渲染器时,在路径头部下方显示不支持预览的空态——文件类型图标加一行说明——并且不会发起读取。两个 Session 作用域的 list 子 slot 在文件元数据报出 Host 路径后把当前文件交给其他插件,owner props 都是 `file` 与 `absolutePath`:`sidebar.right.tab.document.actions` 在每个显示头部的状态里渲染在头部自有控件之后;`sidebar.right.tab.document.unpreviewable` 渲染在不支持预览的空态里,以及可读但本预览无法渲染的文件(`not-text`、`too-large`)的空态里,占据原本放重试的位置;载体或未分类的读取失败仍保留重试,不存在或非普通文件的路径只给说明。两者已发布的占位者都是 [`ui-open-in-app`](../ui-open-in-app/README.zh.md)。仅当所选渲染器声明 `wrap: true` 时显示换行开关;图标表示点击后切换到的模式,该偏好按 tab 保存,初始开启。重新载入仍在此头部,不放入 Sidebar 的 tab 条。正文贴合格的每条边,各渲染器自行提供内容留白,并可拥有内部滚动区。这与 Files tab 右侧预留 2px 滚动条间距的布局有意不同:Preview 使用格的完整宽度,使贴边 HTML 与代码滚动区终止于格的边缘。 - **共享加载与视图状态**,会话作用域、按 tab id 分桶。store 持有累计页或完整字节、读取与观察版本、加载/失败状态、渲染器选择、滚动位置、换行和已响应的导航 revision。普通 inject face 调用 Remote 读取,并经声明的 store action 写入。重新载入和加载模式变化会淘汰旧请求;tab 的中止信号清理其状态。 文档实现在 `ctx.documentPreviews.register({ id, extensions, binaryExtensions?, priority, title, loading, wrap? })` 注册元数据,并以相同 `id` 向 keyed、Session 作用域的子 slot `sidebar.right.tab.document` 注册正文。`binaryExtensions` 列出 `extensions` 中字节不可按文本阅读的后缀;匹配这类后缀的文件在其查看器选项中不再提供纯文本兜底。两处注册都由 effect 持有,通过 `ctx.slots.inject` 等待子 slot。正文接收 `resourceAddress`、准备好的 `content`、`wrap`、`scrollportRef` 和标准 `useTabInfo`/`useResource` 钩子,不接收自定义资源加载器。拥有内部滚动元素的渲染器把 `scrollportRef` 挂到该元素上;该元素卸载后,owner 恢复使用共享正文。元数据声明 `loading: 'text-pages'` 或 `'bytes-complete'`。注册表保留所有匹配备选:`extension`(默认)优先于 `builtin`,随后按更长的后缀、再按注册顺序排列。所选实现仍可用时,下拉选择保持不变;移除后选择下一个候选。内置正文也使用相同注册方式。 @@ -43,7 +43,7 @@ tab 使用 `fileAddressFor` 构造的 Session 地址,携带相对或绝对路 正文通过 `useTabInfo().tab` 读取记录、导航和生命周期。`useResource<'file'>(tab.contentId)` 提供元数据,普通 inject 回调提供内容读取: - 资源快照仅包含 `status`、`value` 和 `failure`;`value` 是 `WorkspaceFileStat` 元数据。提供方可用后,内容读取无需等待首个元数据帧。观察失败优先于 Preview 的变更提示显示;两者都不会自动替换已加载内容。 -- **文本页** —— 纯文本、Markdown 和代码通过 inject 回调调用 `remote.workspaceFiles.read(sessionId, path, { offset }, signal)`。首次挂载读取第一页;滚动到正文末尾或点击 **加载更多** 会读取下一页,直到 `eof`。owner 以 `{ kind: 'text', text, pages, eof }` 提供累计前缀,包含源码偏移和行数。Markdown 和代码增量渲染此前缀,不把每页当成独立文档。第一页之后到达的更新版本页会使读取从头开始,避免混合版本。尚无内容时,失败会以文件类型图标、说明与重试按钮填满正文;较晚的失败保留已有内容并在其下提供重试。 +- **文本页** —— 纯文本、Markdown 和代码通过 inject 回调调用 `remote.workspaceFiles.read(sessionId, path, { offset }, signal)`。首次挂载读取第一页;滚动到正文末尾或点击 **加载更多** 会读取下一页,直到 `eof`。owner 以 `{ kind: 'text', text, pages, eof }` 提供累计前缀,包含源码偏移和行数。Markdown 和代码增量渲染此前缀,不把每页当成独立文档。第一页之后到达的更新版本页会使读取从头开始,避免混合版本。尚无内容时,失败会以文件类型图标、说明和该失败对应的出路(重试、unpreviewable 子 slot,或什么都不给)填满正文;较晚的失败保留已有内容并在其下提供重试。 - **完整字节** —— PDF、HTML 和常见图片通过 inject 回调调用 `remote.workspaceFiles.readAll(sessionId, path, signal)`。`rpc.ts` 将线路上的 base64 解码为 `data: Uint8Array`,供 `{ kind: 'bytes', data }` 使用。Host 的 `maxFileBytes` 上限拒绝超大文件,不截断。PDF 在传给 worker 前复制保留的字节,使 Preview 缓冲区仍可使用。字节仅保存在临时视图状态中,绝不进入持久布局或 Session JSONL。加载模式变化会淘汰先前结果。 - **重新载入** —— 仅当前 Preview tab 通过自己的 Remote 回调重读,保留滚动偏好并淘汰旧请求。变更提示将读取版本及起读时的观察版本与后续 `resource.value.version` 比较;刷新前已观察到的版本不会被当成新变化。读取既不刷新共享元数据,也不清除其它 tab 的提示。 diff --git a/packages/client/ui-sidebar-documentpreview/src/client/TextPreview.tsx b/packages/client/ui-sidebar-documentpreview/src/client/TextPreview.tsx index 9430ec53a8..e98863b09c 100644 --- a/packages/client/ui-sidebar-documentpreview/src/client/TextPreview.tsx +++ b/packages/client/ui-sidebar-documentpreview/src/client/TextPreview.tsx @@ -18,7 +18,7 @@ import type { InjectFace, PropsLocale, PropsRenderSlots, PropsRuntime, PropsStor import { FileTypeIcon, IconRefreshOutline16, Menu, Tooltip, classifyFileType } from '@deepseek-ai/dsh-client-ui-primitives' import { pathPartsOf } from '@deepseek-ai/dsh-util-workspace-path' import type { TextInjected } from './face.ts' -import { failureLine } from './failure-line.ts' +import { emptyFailureRecourse, failureLine } from './failure-line.ts' import { IconNowrapFill16, IconWrapFill16 } from './icons.tsx' import { LoadingIndicator } from './LoadingIndicator.tsx' import { hostFileOf } from './rpc.ts' @@ -82,7 +82,7 @@ export interface TextPreviewInjected extends TextInjected { /** The body's composed props: the tab, its navigation, the shared store and face, and copy. */ export type TextPreviewProps = & PropsRuntime<'sidebar.right.pane.tab'> - & PropsRenderSlots<'sidebar.right.tab.document'> + & PropsRenderSlots<'sidebar.right.tab.document' | 'sidebar.right.tab.document.actions' | 'sidebar.right.tab.document.unpreviewable'> & PropsStore & InjectFace & PropsLocale<'sidebarDocumentPreview'> @@ -120,7 +120,10 @@ export function TextPreview({ const pathRef = useRef(null) const pathTextRef = useRef(null) const [menuOpen, setMenuOpen] = useState(false) - const displayPath = meta.value?.absolutePath ?? current?.complete?.absolutePath ?? file.path + const absolutePath = meta.value?.absolutePath ?? current?.complete?.absolutePath + const displayPath = absolutePath ?? file.path + // Contributions that hand the file to the Host wait for its Host path. + const fileOwner = absolutePath === undefined ? undefined : { file, absolutePath } usePathClipped(pathRef, pathTextRef, displayPath, state !== undefined) // Every tab of this type is a `file` resource address, so its params are the // `file` type's; the union is narrowed on the one field read, not validated. @@ -195,18 +198,21 @@ export function TextPreview({ }, [mode, loaded, current?.complete, current?.eof]) // A known binary suffix with no matching renderer never reads: no plain-text - // fallback, no viewer control, only the path and the unsupported line. + // fallback, no viewer control, only the path, the unsupported line, and the + // contributions that hand the file to the Host. if (selected === undefined && unviewable) { const { name: unsupportedName } = pathPartsOf(displayPath) return (
    + {fileOwner !== undefined && renderSlot('sidebar.right.tab.document.actions', fileOwner)}

    {t('unsupportedFile')}

    + {fileOwner !== undefined && renderSlot('sidebar.right.tab.document.unpreviewable', fileOwner)}
    @@ -315,6 +321,7 @@ export function TextPreview({ + {fileOwner !== undefined && renderSlot('sidebar.right.tab.document.actions', fileOwner)}
    ) : ( - // With no content, retry the selected renderer's read; metadata - // observation remains owned by the resource provider. + // With no content, the failure names its recourse: retry the + // selected renderer's read when a second read may resolve it, hand + // a file this preview cannot render to the unpreviewable + // contributions, and offer nothing for a path with nothing to show. + // Metadata observation remains owned by the resource provider.

    {failureLine(t, current.failure)}

    - + {emptyFailureRecourse(current.failure) === 'open' && fileOwner !== undefined + && renderSlot('sidebar.right.tab.document.unpreviewable', fileOwner)} + {emptyFailureRecourse(current.failure) === 'retry' && ( + + )}
    ))} {mode === 'text-pages' && current !== undefined && loaded.length > 0 && !current.eof && current.failure === undefined && ( diff --git a/packages/client/ui-sidebar-documentpreview/src/client/document/contract.ts b/packages/client/ui-sidebar-documentpreview/src/client/document/contract.ts index 11f7cd1c24..2f76b49bf4 100644 --- a/packages/client/ui-sidebar-documentpreview/src/client/document/contract.ts +++ b/packages/client/ui-sidebar-documentpreview/src/client/document/contract.ts @@ -2,6 +2,7 @@ import type { PropsRuntime, SlotHookFactory } from '@deepseek-ai/dsh-client-ui-slots' import type { UseSidebarRightTabInfo } from '@deepseek-ai/dsh-client-ui-sidebar-right/client' import type { RefCallback } from 'react' +import type { SessionFile } from '../rpc.ts' /** One loaded text window, retaining source line positions. */ export interface DocumentTextPage { @@ -41,6 +42,34 @@ declare module '@deepseek-ai/dsh-client-ui-slots' { } } } + /** + * Header toolbar contributions acting on the previewed file, rendered + * after the preview's own controls once the file's Host path is known. + */ + 'sidebar.right.tab.document.actions': { + kind: 'list' + scope: 'session' + owner: { + /** The previewed file: the Session the read runs under and the path handed to the Host. */ + readonly file: SessionFile + /** The file's absolute path on the Host, from its metadata. */ + readonly absolutePath: string + } + } + /** + * Empty-state contributions for a file this preview cannot render, + * offered where Retry would stand once the file's Host path is known. + */ + 'sidebar.right.tab.document.unpreviewable': { + kind: 'list' + scope: 'session' + owner: { + /** The previewed file: the Session the read runs under and the path handed to the Host. */ + readonly file: SessionFile + /** The file's absolute path on the Host, from its metadata. */ + readonly absolutePath: string + } + } } } diff --git a/packages/client/ui-sidebar-documentpreview/src/client/failure-line.ts b/packages/client/ui-sidebar-documentpreview/src/client/failure-line.ts index edf82ae9c6..625e3843cf 100644 --- a/packages/client/ui-sidebar-documentpreview/src/client/failure-line.ts +++ b/packages/client/ui-sidebar-documentpreview/src/client/failure-line.ts @@ -33,3 +33,25 @@ export function failureLine(t: TranslateNS<'sidebarDocumentPreview'>, failure: R default: return t('error.unavailable', { message: failure.message }) } } + +/** The action an empty preview offers beside its failure line. */ +export type EmptyFailureRecourse = 'open' | 'retry' | 'none' + +/** + * Choose the empty state's action for one settled read failure. + * @param failure - the settled Remote failure. + * @returns `open` for a readable file this preview cannot render, `none` for a + * path with nothing to show or open, `retry` for the rest: carrier and + * unclassified failures a second read may resolve. + */ +export function emptyFailureRecourse(failure: RemoteFailure): EmptyFailureRecourse { + switch (failure.code) { + case 'workspace-file/not-text': + case 'workspace-file/too-large': + return 'open' + case 'workspace-file/not-found': + case 'workspace-file/not-regular-file': + return 'none' + default: return 'retry' + } +} diff --git a/packages/client/ui-sidebar-documentpreview/src/client/index.ts b/packages/client/ui-sidebar-documentpreview/src/client/index.ts index ef76084e07..e677e0e0b5 100644 --- a/packages/client/ui-sidebar-documentpreview/src/client/index.ts +++ b/packages/client/ui-sidebar-documentpreview/src/client/index.ts @@ -100,6 +100,8 @@ export function apply(ctx: ClientContext): void { name: 'sidebar.right.pane.tab', key: TEXTPREVIEW_ID, locale: NS, store, children: { 'sidebar.right.tab.document': { kind: 'keyed', scope: 'session', inject: { hooks: { tabInfo: documentTabInfoFactory } } }, + 'sidebar.right.tab.document.actions': { kind: 'list', scope: 'session' }, + 'sidebar.right.tab.document.unpreviewable': { kind: 'list', scope: 'session' }, }, inject: (sessionId, actions): TextPreviewInjected => ({ ...face(sessionId, actions), hooks: { documentPreviews: source } }), }, diff --git a/packages/client/ui-sidebar-documentpreview/tests/document-toolbar.client.spec.tsx b/packages/client/ui-sidebar-documentpreview/tests/document-toolbar.client.spec.tsx index 0fa5189b44..8b31dce6ac 100644 --- a/packages/client/ui-sidebar-documentpreview/tests/document-toolbar.client.spec.tsx +++ b/packages/client/ui-sidebar-documentpreview/tests/document-toolbar.client.spec.tsx @@ -25,7 +25,9 @@ function codeProps(h: ReturnType): TextPreviewProps { ...props, useDocumentPreviews: selector => selector([definition]), // This adapter only receives the concrete document slot, not an arbitrary generic key. - renderSlot: (_key, owner) => } t={key => key} />, + renderSlot: (key: string, owner: unknown) => key === 'sidebar.right.tab.document' + ? } t={key => key} /> + : null, } } @@ -104,18 +106,19 @@ describe('document toolbar', () => { await pending.promise }) h.bytes.mockReturnValueOnce(pending.promise) - const renderSlot = vi.fn(() => null) + const renderSlot = vi.fn((_key: string) => null) + const documentRenders = (): number => renderSlot.mock.calls.filter(call => call[0] === 'sidebar.right.tab.document').length const props: TextPreviewProps = { ...h.props(), useDocumentPreviews: selector => selector([binary]), renderSlot } const view = render() expect(view.getByRole('status').hasAttribute('data-document-loading')).toBe(true) expect(view.getByRole('status').getAttribute('aria-label')).toBe('loading') expect(view.container.querySelector('[data-textpreview-body]')?.firstElementChild).toBe(view.getByRole('status')) - expect(renderSlot).not.toHaveBeenCalled() + expect(documentRenders()).toBe(0) await act(async () => { pending.resolve(result) await pending.promise }) - expect(renderSlot).toHaveBeenCalled() + expect(documentRenders()).toBeGreaterThan(0) expect(view.queryByRole('status')).toBeNull() }) @@ -123,7 +126,7 @@ describe('document toolbar', () => { const h = harness() const result = { ok: true as const, value: { absolutePath: ABSOLUTE_PATH, version: 'v1', offset: 0, data: btoa('all'), bytes: 3, eof: true } } const read = h.bytes.mockResolvedValueOnce({ - ok: false, error: new RemoteError('workspace-file/not-found', 'Missing file', { path: ABSOLUTE_PATH }), + ok: false, error: new RemoteError('gateway/internal', 'socket closed', {}), }).mockResolvedValue(result) h.useResource.mockReturnValue({ status: 'loading', value: undefined, failure: undefined }) const props: TextPreviewProps = { @@ -245,6 +248,11 @@ describe('document toolbar', () => { expect(view.container.querySelector('[data-textpreview-path]')).not.toBeNull() expect(view.container.querySelector('[data-document-viewer-menu]')).toBeNull() expect(view.container.querySelector('[data-textpreview-tool="reload"]')).toBeNull() + // Both handoff seats receive the file once its Host path is known. + const header = view.container.querySelector('[data-textpreview-path]')?.parentElement + expect(header?.querySelector('[data-slot="sidebar.right.tab.document.actions"]')?.getAttribute('data-slot-path')).toBe(ABSOLUTE_PATH) + const empty = view.container.querySelector('[data-textpreview-unsupported]') + expect(empty?.querySelector('[data-slot="sidebar.right.tab.document.unpreviewable"]')?.getAttribute('data-slot-file')).toBe('work/clip.mp4') expect(h.read).not.toHaveBeenCalled() expect(h.bytes).not.toHaveBeenCalled() h.controller.abort() diff --git a/packages/client/ui-sidebar-documentpreview/tests/failure-line.client.spec.ts b/packages/client/ui-sidebar-documentpreview/tests/failure-line.client.spec.ts index c43804d8ef..134cf3e822 100644 --- a/packages/client/ui-sidebar-documentpreview/tests/failure-line.client.spec.ts +++ b/packages/client/ui-sidebar-documentpreview/tests/failure-line.client.spec.ts @@ -6,7 +6,7 @@ import type { RemoteFailure } from '@deepseek-ai/dsh-api-remotes/client' import type { TranslateNS } from '@deepseek-ai/dsh-client-ui-slots' // The namespace declaration `TranslateNS<'sidebarDocumentPreview'>` resolves against. import type {} from '../src/client/index.ts' -import { failureLine } from '../src/client/failure-line.ts' +import { emptyFailureRecourse, failureLine } from '../src/client/failure-line.ts' /** Key-echoing translate that also shows its parameters, so a formatted value is visible. */ const t: TranslateNS<'sidebarDocumentPreview'> = (key, params) => @@ -33,3 +33,20 @@ describe('failureLine', () => { expect(failureLine(t, failure('gateway/internal', {}, 'socket closed'))).toBe('error.unavailable(message=socket closed)') }) }) + +describe('emptyFailureRecourse', () => { + it('hands a readable file the preview cannot render to the Host', () => { + expect(emptyFailureRecourse(failure('workspace-file/not-text'))).toBe('open') + expect(emptyFailureRecourse(failure('workspace-file/too-large', { limit: 512 }))).toBe('open') + }) + + it('offers nothing for a path with nothing to show or open', () => { + expect(emptyFailureRecourse(failure('workspace-file/not-found'))).toBe('none') + expect(emptyFailureRecourse(failure('workspace-file/not-regular-file'))).toBe('none') + }) + + it('retries carrier and unclassified failures', () => { + expect(emptyFailureRecourse(failure('gateway/internal'))).toBe('retry') + expect(emptyFailureRecourse(failure('someday/a-new-code'))).toBe('retry') + }) +}) diff --git a/packages/client/ui-sidebar-documentpreview/tests/fixtures.client.ts b/packages/client/ui-sidebar-documentpreview/tests/fixtures.client.ts index 200626232c..a240fa7c9a 100644 --- a/packages/client/ui-sidebar-documentpreview/tests/fixtures.client.ts +++ b/packages/client/ui-sidebar-documentpreview/tests/fixtures.client.ts @@ -122,9 +122,18 @@ export function harness(script: Record> onTestFinished(() => { controller.abort() }) const tabActions = { openResource: vi.fn(), openTab: vi.fn(), close: vi.fn(), replace: vi.fn() } const definitions = [textBodyDefinition(() => t('viewer.text'))] - const renderSlot: TextPreviewProps['renderSlot'] = (_key, owner, opts) => createElement(TextBody, { - ...owner, useTabInfo: opts.hookContext, sessionId: SESSION, useResource, - } as unknown as DocumentPreviewProps) + // The document seat renders the plain body; the file-handoff seats render a + // marker carrying what the owner handed them. + const renderSlot: TextPreviewProps['renderSlot'] = (key: string, owner: unknown, opts?: { hookContext?: unknown }) => + key === 'sidebar.right.tab.document' + ? createElement(TextBody, { + ...owner as object, useTabInfo: opts?.hookContext, sessionId: SESSION, useResource, + } as unknown as DocumentPreviewProps) + : createElement('div', { + 'data-slot': key, + 'data-slot-file': (owner as { file: SessionFile }).file.path, + 'data-slot-path': (owner as { absolutePath: string }).absolutePath, + }) const props = (navigation: { params?: unknown; revision: number } = { revision: 1 }) => ({ useTabInfo: () => ({ sidebar: { expanded: true, fullscreen: false }, diff --git a/packages/client/ui-sidebar-documentpreview/tests/text-preview.client.spec.tsx b/packages/client/ui-sidebar-documentpreview/tests/text-preview.client.spec.tsx index 733bc6decc..b29d663a27 100644 --- a/packages/client/ui-sidebar-documentpreview/tests/text-preview.client.spec.tsx +++ b/packages/client/ui-sidebar-documentpreview/tests/text-preview.client.spec.tsx @@ -88,7 +88,9 @@ function codeProps(h: ReturnType, navigation: { params?: unknown return { ...props, useDocumentPreviews: selector => selector([definition]), - renderSlot: (_key, owner) => } t={key => key} />, + renderSlot: (key: string, owner: unknown) => key === 'sidebar.right.tab.document' + ? } t={key => key} /> + : null, } } @@ -253,15 +255,16 @@ describe('TextPreview — pages', () => { }) it('says why a page failed and retries the same page', async () => { - const h = harness({ 1: failure('workspace-file/not-text', { path: PATH }) }) + const h = harness({ 1: failure('gateway/internal', { path: PATH }) }) const view = render() await settle() const failed = view.container.querySelector('[data-textpreview-failed]') - expect(failed?.getAttribute('data-textpreview-failed')).toBe('workspace-file/not-text') - expect(view.container.textContent).toContain('error.notText') + expect(failed?.getAttribute('data-textpreview-failed')).toBe('gateway/internal') + expect(view.container.textContent).toContain('error.unavailable(message=boom)') // Nothing read yet: the failure stands as the body, under the file's type sheet. expect(failed?.querySelector('svg')).not.toBeNull() expect(view.container.querySelector('[data-textpreview-more]')).toBeNull() + expect(view.container.querySelector('[data-slot="sidebar.right.tab.document.unpreviewable"]')).toBeNull() h.script(1, page(1, ['one'], true)) click(view.container, '[data-textpreview-retry]') await settle() @@ -270,6 +273,40 @@ describe('TextPreview — pages', () => { expect(view.container.querySelector('[data-textpreview-failed]')).toBeNull() }) + it('hands a readable file it cannot render to the unpreviewable seat instead of Retry', async () => { + const h = harness({ 1: failure('workspace-file/not-text', { path: PATH }) }) + const view = render() + await settle() + const failed = view.container.querySelector('[data-textpreview-failed]') + expect(failed?.getAttribute('data-textpreview-failed')).toBe('workspace-file/not-text') + expect(view.container.textContent).toContain('error.notText') + expect(view.container.querySelector('[data-textpreview-retry]')).toBeNull() + const seat = failed?.querySelector('[data-slot="sidebar.right.tab.document.unpreviewable"]') + expect(seat?.getAttribute('data-slot-file')).toBe(PATH) + expect(seat?.getAttribute('data-slot-path')).toBe(ABSOLUTE_PATH) + // The header's own handoff seat receives the same file. + const actions = view.container.querySelector('[data-slot="sidebar.right.tab.document.actions"]') + expect(actions?.getAttribute('data-slot-path')).toBe(ABSOLUTE_PATH) + }) + + it('offers neither Retry nor a handoff for a path with nothing to show', async () => { + const h = harness({ 1: failure('workspace-file/not-found', { path: PATH }) }) + const view = render() + await settle() + expect(view.container.querySelector('[data-textpreview-failed]')?.getAttribute('data-textpreview-failed')).toBe('workspace-file/not-found') + expect(view.container.querySelector('[data-textpreview-retry]')).toBeNull() + expect(view.container.querySelector('[data-slot="sidebar.right.tab.document.unpreviewable"]')).toBeNull() + }) + + it('withholds the handoff seats until the file reports a Host path', async () => { + const h = harness({ 1: failure('workspace-file/not-text', { path: PATH }) }) + h.setVersion(undefined) + const view = render() + await settle() + expect(view.container.querySelector('[data-textpreview-failed]')).not.toBeNull() + expect(view.container.querySelector('[data-slot]')).toBeNull() + }) + it('says why a later page failed on a line under the pages already read', async () => { const h = harness({ 1: page(1, ['a'], false), 2: failure('workspace-file/too-large', { path: PATH, limit: 1024 }) }) const view = render() @@ -429,7 +466,7 @@ describe('TextPreview — navigation and view', () => { it('rebinds scrolling when the selected Slot body is replaced without changing the renderer id', async () => { const h = harness({ 1: page(1, ['a', 'b', 'c'], true) }) const code = codeProps(h, { revision: 1 }) - const fallback: TextPreviewProps = { ...code, renderSlot: () =>
    } + const fallback: TextPreviewProps = { ...code, renderSlot: (key: string) => key === 'sidebar.right.tab.document' ?
    : null } const view = render() await settle() const outer = body(view.container) @@ -465,10 +502,11 @@ describe('TextPreview — navigation and view', () => { const props: TextPreviewProps = { ...base, useDocumentPreviews: selector => selector(definitions), - renderSlot: (_key, owner, opts) => { - const documentOwner = owner as unknown as OwnerOf<'sidebar.right.tab.document'> - if (opts.entryKey === 'code') return key} /> - if (opts.entryKey === PLAIN_BODY_ID) return + renderSlot: (key: string, owner: unknown, opts?: { entryKey?: string }) => { + if (key !== 'sidebar.right.tab.document') return null + const documentOwner = owner as OwnerOf<'sidebar.right.tab.document'> + if (opts?.entryKey === 'code') return key} /> + if (opts?.entryKey === PLAIN_BODY_ID) return return
    }, } diff --git a/packages/extensions/cordis-client-runner/src/client/slot-catalog.ts b/packages/extensions/cordis-client-runner/src/client/slot-catalog.ts index 8752a7de89..8600979078 100644 --- a/packages/extensions/cordis-client-runner/src/client/slot-catalog.ts +++ b/packages/extensions/cordis-client-runner/src/client/slot-catalog.ts @@ -2449,7 +2449,125 @@ export const CLIENT_SLOT_API: readonly ClientSlotEntry[] = [ ], replaceRisk: 'none', example: 'return {\n inject: [\'slots\'],\n apply(ctx) {\n ctx.slots.inject(\'sidebar.right.tab.document\', () => ctx.slots.register(\n { name: \'sidebar.right.tab.document\', key: \'\' },\n () => React.createElement(\'div\', null, \'hello\'),\n ))\n },\n}', - source: 'packages/client/ui-sidebar-documentpreview/src/client/document/contract.ts:24', + source: 'packages/client/ui-sidebar-documentpreview/src/client/document/contract.ts:25', + }, + { + key: 'sidebar.right.tab.document.actions', + kind: 'list', + scope: 'session', + summary: 'Header toolbar contributions acting on the previewed file, rendered after the preview\'s own controls once the file\'s Host path is known.', + doc: 'Header toolbar contributions acting on the previewed file, rendered after the preview\'s own controls once the file\'s Host path is known.', + registerOptions: [ + { + name: 'id', + requirement: 'required', + type: 'string', + doc: 'Your cell key. Use an id of your own: a fresh id is added beside the shipped entries, while reusing a shipped id puts you in THAT cell and replaces it. Owners that filter by id address you by it.', + }, + { + name: 'order', + requirement: 'optional', + type: 'number', + doc: 'Position among the entries, ascending (default 0).', + }, + { + name: 'label', + requirement: 'optional', + type: 'string | (() => string)', + doc: 'Display text where the owner projects one (nav rows, tabs). A thunk is re-read on every projection, so localized text follows the active locale without re-registering.', + }, + ], + ownerProps: [ + '/** The file one tab reads: the session the read runs under and the path handed to the Host. */\nexport interface SessionFile {\n /** The Session whose workspace resolves relative paths. */\n readonly sessionId: SessionId\n /** The path the Host receives, absolute or relative to the addressed Session\'s workspace. */\n readonly path: string\n}', + ], + ownerPropsReferences: [ + 'SessionId', + ], + standardProps: [ + 'useResource: UseResource', + 'useWorkspaces: SnapshotSelectorHook', + 'usePanelInfo: UsePanelInfo', + 'useSessions: UseSessions', + 'useSessionPendingInteraction: UseSessionPendingInteraction', + 'useWorkspaces: SnapshotSelectorHook', + 'useChat: UseChat', + 'useConversation: UseConversation', + 'useInput: SnapshotSelectorHook', + 'inputActions: InputActions', + 'useSession: SessionSnapshotSelector', + 'sessionId: SessionId', + 'useProjection: UseProjection', + 'useTrajectory: UseTrajectory', + ], + keyDomain: '', + hookContext: '', + slotInject: '', + declaredBy: 'an entry in \'sidebar.right.pane.tab\' (client-ui-sidebar-documentpreview), so it exists while that entry is mounted', + occupants: [ + 'client-ui-open-in-app OpenPathAction id \'open-in-app\'', + ], + replaceRisk: 'none', + example: 'return {\n inject: [\'slots\'],\n apply(ctx) {\n ctx.slots.inject(\'sidebar.right.tab.document.actions\', () => ctx.slots.register(\n { name: \'sidebar.right.tab.document.actions\', id: \'my-entry\', order: 100, label: \'My entry\' },\n () => React.createElement(\'div\', null, \'hello\'),\n ))\n },\n}', + source: 'packages/client/ui-sidebar-documentpreview/src/client/document/contract.ts:46', + }, + { + key: 'sidebar.right.tab.document.unpreviewable', + kind: 'list', + scope: 'session', + summary: 'Empty-state contributions for a file this preview cannot render, offered where Retry would stand once the file\'s Host path is known.', + doc: 'Empty-state contributions for a file this preview cannot render, offered where Retry would stand once the file\'s Host path is known.', + registerOptions: [ + { + name: 'id', + requirement: 'required', + type: 'string', + doc: 'Your cell key. Use an id of your own: a fresh id is added beside the shipped entries, while reusing a shipped id puts you in THAT cell and replaces it. Owners that filter by id address you by it.', + }, + { + name: 'order', + requirement: 'optional', + type: 'number', + doc: 'Position among the entries, ascending (default 0).', + }, + { + name: 'label', + requirement: 'optional', + type: 'string | (() => string)', + doc: 'Display text where the owner projects one (nav rows, tabs). A thunk is re-read on every projection, so localized text follows the active locale without re-registering.', + }, + ], + ownerProps: [ + '/** The file one tab reads: the session the read runs under and the path handed to the Host. */\nexport interface SessionFile {\n /** The Session whose workspace resolves relative paths. */\n readonly sessionId: SessionId\n /** The path the Host receives, absolute or relative to the addressed Session\'s workspace. */\n readonly path: string\n}', + ], + ownerPropsReferences: [ + 'SessionId', + ], + standardProps: [ + 'useResource: UseResource', + 'useWorkspaces: SnapshotSelectorHook', + 'usePanelInfo: UsePanelInfo', + 'useSessions: UseSessions', + 'useSessionPendingInteraction: UseSessionPendingInteraction', + 'useWorkspaces: SnapshotSelectorHook', + 'useChat: UseChat', + 'useConversation: UseConversation', + 'useInput: SnapshotSelectorHook', + 'inputActions: InputActions', + 'useSession: SessionSnapshotSelector', + 'sessionId: SessionId', + 'useProjection: UseProjection', + 'useTrajectory: UseTrajectory', + ], + keyDomain: '', + hookContext: '', + slotInject: '', + declaredBy: 'an entry in \'sidebar.right.pane.tab\' (client-ui-sidebar-documentpreview), so it exists while that entry is mounted', + occupants: [ + 'client-ui-open-in-app OpenPathEmptyAction id \'open-in-app\'', + ], + replaceRisk: 'none', + example: 'return {\n inject: [\'slots\'],\n apply(ctx) {\n ctx.slots.inject(\'sidebar.right.tab.document.unpreviewable\', () => ctx.slots.register(\n { name: \'sidebar.right.tab.document.unpreviewable\', id: \'my-entry\', order: 100, label: \'My entry\' },\n () => React.createElement(\'div\', null, \'hello\'),\n ))\n },\n}', + source: 'packages/client/ui-sidebar-documentpreview/src/client/document/contract.ts:57', }, { key: 'sidebar.right.tab.guide', diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index e6e695e59b..6e4598a6db 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -3488,6 +3488,12 @@ importers: '@deepseek-ai/cordis': specifier: workspace:^ version: link:../../../vendor/cordis + '@deepseek-ai/dsh-api-gateway': + specifier: workspace:^ + version: link:../../api/gateway + '@deepseek-ai/dsh-api-remotes': + specifier: workspace:^ + version: link:../../api/remotes '@deepseek-ai/dsh-api-session-controller': specifier: workspace:^ version: link:../../api/session-controller @@ -3512,6 +3518,9 @@ importers: '@deepseek-ai/dsh-client-ui-session': specifier: workspace:^ version: link:../ui-session + '@deepseek-ai/dsh-client-ui-sidebar-documentpreview': + specifier: workspace:^ + version: link:../ui-sidebar-documentpreview '@deepseek-ai/dsh-client-ui-slots': specifier: workspace:^ version: link:../ui-slots diff --git a/snapshots/web/document-preview/document.expected.md b/snapshots/web/document-preview/document.expected.md index 03286e76b8..203b6d2ff4 100644 --- a/snapshots/web/document-preview/document.expected.md +++ b/snapshots/web/document-preview/document.expected.md @@ -51,3 +51,5 @@ - State: unsupported - Line: Preview is not available for this file type yet. +- Header control: Open +- Empty-state control: Open in default app diff --git a/snapshots/web/document-preview/paging.patch.yml b/snapshots/web/document-preview/paging.patch.yml index b75ea4838d..96788cc5aa 100644 --- a/snapshots/web/document-preview/paging.patch.yml +++ b/snapshots/web/document-preview/paging.patch.yml @@ -3,3 +3,7 @@ name: '@deepseek-ai/dsh-api-workspace-files' config: maxLines: 64 +# Pin desktop availability so the default-application controls render identically in headless CI. +- id: session-controller + config: + nativeOpen: true diff --git a/snapshots/web/seeded-history/file-preview.expected.md b/snapshots/web/seeded-history/file-preview.expected.md index d11b2479b2..44d3d39044 100644 --- a/snapshots/web/seeded-history/file-preview.expected.md +++ b/snapshots/web/seeded-history/file-preview.expected.md @@ -3,4 +3,7 @@ - img - button "Read the file again": - img +- button "Open" +- button "More ways to open": + - img - text: alpha From cba87e84d5b53f3f353fb1007e534f429214a2a7 Mon Sep 17 00:00:00 2001 From: _Kerman Date: Thu, 17 Sep 2026 11:21:11 +0800 Subject: [PATCH 12/75] fix(client): distinguish recorded tool status colors --- packages/client/ui-tool/README.i18n.yaml | 4 +-- packages/client/ui-tool/README.md | 2 ++ packages/client/ui-tool/README.zh.md | 2 ++ .../tool/components/ToolDetails.module.css | 1 + .../client/tool/components/ToolDetails.tsx | 2 +- .../tool/models/control-details-model.ts | 30 ++++++++++--------- .../client/tool/models/detail-model-shared.ts | 3 +- 7 files changed, 26 insertions(+), 18 deletions(-) diff --git a/packages/client/ui-tool/README.i18n.yaml b/packages/client/ui-tool/README.i18n.yaml index 0f7443d1ca..bd11e79708 100644 --- a/packages/client/ui-tool/README.i18n.yaml +++ b/packages/client/ui-tool/README.i18n.yaml @@ -2,5 +2,5 @@ # side as of the last confirmed-consistent state. Both languages carry equal authority; # after editing either side, bring the other along and re-record with: # pnpm run verify-translation-pairing --write packages/client/ui-tool/README.md -README.md: b76ab3d19568bbad043a0dd005130eaa378c1fff -README.zh.md: de6e12ca0d073ccc6ec113c91d163e01afaebdca +README.md: 4964828126d426fe6f8491a2526de09aa1fbef5d +README.zh.md: 5c8f9b0ac53ec1e1180010a1f63333001b2a0d39 diff --git a/packages/client/ui-tool/README.md b/packages/client/ui-tool/README.md index b76ab3d195..4964828126 100644 --- a/packages/client/ui-tool/README.md +++ b/packages/client/ui-tool/README.md @@ -66,6 +66,8 @@ Every card is read in place in the call tree; there is no second, full-height pr The Details view covers the 36 registered tools: goal and schedule tools, Cordis inspection, workflow and Ralph reports, Session event/search/trace queries, agent and teammate controls, background jobs, persistent terminals, and LSP navigation. These expanded bodies read successful logged results, preserve generic input/output for failures or unsupported data, and keep Inspect available. Dates include the viewer's time zone, and statuses reflect the call result rather than current session state. The browser adapter consumes recorded producer text and JSON; Host service objects and presenter callbacks do not cross into the Client. [Compact tool details](../../../.agents/notes/implemented/architecture/2026-09-10-compact-tool-details.md) records the presentation trade-offs. +Expanded status dots and labels use static semantic colors. An interruption receipt confirms only that interruption was requested. + The terminal model uses `hasSpillNotice` from the browser-safe `@deepseek-ai/dsh-spill-policy/notice` entry, not an independent UI pattern. The [spill-policy README](../../spill/spill-policy/README.md#shared-notice-ownership) owns notice formatting and recognition. This check conservatively selects generic output; matching text cannot authenticate its source, and replay leaves recorded result bytes untouched. diff --git a/packages/client/ui-tool/README.zh.md b/packages/client/ui-tool/README.zh.md index de6e12ca0d..5c8f9b0ac5 100644 --- a/packages/client/ui-tool/README.zh.md +++ b/packages/client/ui-tool/README.zh.md @@ -66,6 +66,8 @@ owner 载荷为 `ToolCallOwnerProps`:`callId`、`toolName`、冻结的 `block` Details 视图覆盖已注册的 36 个工具:目标和定时任务工具、Cordis 检查、workflow 与 Ralph 报告、Session 事件/搜索/轨迹查询、Agent 与 teammate 控制、后台作业、持久终端以及 LSP 导航。展开内容读取成功的记录结果,为失败或不支持的数据保留通用输入/输出,并保留 Inspect。日期包含查看者的时区,状态反映调用结果而非当前会话状态。浏览器适配器消费已记录的 producer 文本与 JSON;Host service 对象和 presenter 回调不会进入 Client。[紧凑工具详情](../../../.agents/notes/implemented/architecture/2026-09-10-compact-tool-details.zh.md)记录了呈现取舍。 +展开后的状态圆点和文字使用静态语义色。中断回执仅确认已发出中断请求。 + terminal model 使用浏览器安全入口 `@deepseek-ai/dsh-spill-policy/notice` 的 `hasSpillNotice`,而非独立的 UI 匹配规则。[spill-policy README](../../spill/spill-policy/README.zh.md#shared-notice-ownership) 负责提示文本的格式化与识别。该检查保守地选择通用输出;匹配的文本无法证明其来源,回放也不改变已记录的结果字节。 diff --git a/packages/client/ui-tool/src/client/tool/components/ToolDetails.module.css b/packages/client/ui-tool/src/client/tool/components/ToolDetails.module.css index e600b8a36c..2348cf2f11 100644 --- a/packages/client/ui-tool/src/client/tool/components/ToolDetails.module.css +++ b/packages/client/ui-tool/src/client/tool/components/ToolDetails.module.css @@ -168,6 +168,7 @@ background: currentColor; } +.badge[data-tone='info'] { color: var(--dsw-alias-state-business-primary); } .badge[data-tone='success'] { color: var(--dsw-alias-state-success-primary); } .badge[data-tone='warning'] { color: var(--dsw-alias-state-warn-primary); } .badge[data-tone='error'] { color: var(--dsw-alias-state-error-primary); } diff --git a/packages/client/ui-tool/src/client/tool/components/ToolDetails.tsx b/packages/client/ui-tool/src/client/tool/components/ToolDetails.tsx index 6510677541..64b593a9b6 100644 --- a/packages/client/ui-tool/src/client/tool/components/ToolDetails.tsx +++ b/packages/client/ui-tool/src/client/tool/components/ToolDetails.tsx @@ -10,7 +10,7 @@ export interface ToolDetailItem { title?: string subtitle?: string description?: string - badge?: { label: string; tone: 'neutral' | 'success' | 'warning' | 'error' } + badge?: { label: string; tone: 'neutral' | 'info' | 'success' | 'warning' | 'error' } status?: { value: 'completed' | 'in_progress' | 'pending'; label: string } previousStatus?: string change?: { value: 'added' | 'removed' | 'updated'; label: string } diff --git a/packages/client/ui-tool/src/client/tool/models/control-details-model.ts b/packages/client/ui-tool/src/client/tool/models/control-details-model.ts index 31fb25b2c1..d869070431 100644 --- a/packages/client/ui-tool/src/client/tool/models/control-details-model.ts +++ b/packages/client/ui-tool/src/client/tool/models/control-details-model.ts @@ -12,8 +12,8 @@ function arg(args: Record, key: string): string { return typeof value === 'string' ? value : '' } -function receipt(title: string, label: string, t: DetailTranslate, fields: DetailItem['fields'] = [], description?: string): ToolDetailsModel { - return detailList([{ title, badge: { label, tone: 'neutral' }, fields, ...(description === undefined ? {} : { description }) }], `${title} · ${label}`, t) +function receipt(title: string, badge: NonNullable, t: DetailTranslate, fields: DetailItem['fields'] = [], description?: string): ToolDetailsModel { + return detailList([{ title, badge, fields, ...(description === undefined ? {} : { description }) }], `${title} · ${badge.label}`, t) } function agentList(text: string, t: DetailTranslate): ToolDetailsModel | null { @@ -127,19 +127,21 @@ export function controlDetails(name: string, args: Record, text } case 'send_message': { const status = detailRecord(json) ? json.status : undefined - if (status === 'accepted' || status === 'queued') return receipt(target, t(status === 'queued' ? 'detail.status.queued' : 'detail.receipt.delivered'), t, [], arg(args, 'message')) - return text === `message delivered to agent ${target}` ? receipt(target, t('detail.receipt.delivered'), t, [], arg(args, 'message')) : null + if (status === 'accepted' || status === 'queued') return receipt(target, { + label: t(status === 'queued' ? 'detail.status.queued' : 'detail.receipt.delivered'), tone: status === 'queued' ? 'warning' : 'success', + }, t, [], arg(args, 'message')) + return text === `message delivered to agent ${target}` ? receipt(target, { label: t('detail.receipt.delivered'), tone: 'success' }, t, [], arg(args, 'message')) : null } case 'interrupt_agent': - if (detailRecord(json) && typeof json.previousStatus === 'string') return receipt(target, t('detail.receipt.interrupt'), t, [{ label: t('detail.field.previousStatus'), value: detailBadge(json.previousStatus, t).label }]) - return text === `interrupt requested for agent ${target}` ? receipt(target, t('detail.receipt.interrupt'), t) : null + if (detailRecord(json) && typeof json.previousStatus === 'string') return receipt(target, { label: t('detail.receipt.interrupt'), tone: 'warning' }, t, [{ label: t('detail.field.previousStatus'), value: detailBadge(json.previousStatus, t).label }]) + return text === `interrupt requested for agent ${target}` ? receipt(target, { label: t('detail.receipt.interrupt'), tone: 'warning' }, t) : null case 'wait_agent': if (!detailRecord(json) || typeof json.timedOut !== 'boolean') return null if (detailRecord(json.noProgress) && typeof json.noProgress.message === 'string') return detailList([{ title: t('detail.wait.noProgress'), description: json.noProgress.message, fields: [] }], t('detail.wait.noProgress'), t) - return receipt(t('detail.wait.title'), t(json.timedOut ? 'detail.wait.timeout' : 'detail.wait.changed'), t) + return receipt(t('detail.wait.title'), { label: t(json.timedOut ? 'detail.wait.timeout' : 'detail.wait.changed'), tone: 'neutral' }, t) case 'subagent': { const started = /^started (background subagent job|subagent) (\S+)$/u.exec(text) - if (started !== null) return receipt(arg(args, 'prompt'), t('detail.receipt.started'), t, [{ label: t(started[1] === 'subagent' ? 'detail.field.agent' : 'detail.field.job'), value: started[2] ?? '' }]) + if (started !== null) return receipt(arg(args, 'prompt'), { label: t('detail.receipt.started'), tone: 'info' }, t, [{ label: t(started[1] === 'subagent' ? 'detail.field.agent' : 'detail.field.job'), value: started[2] ?? '' }]) return detailList([{ title: t('detail.agent.reply'), markdown: text, fields: [], groups: [{ label: t('detail.field.task'), items: [{ description: arg(args, 'prompt'), fields: [] }] }] }], t('detail.agent.reply'), t) } case 'list_subagent_models': { @@ -162,13 +164,13 @@ export function controlDetails(name: string, args: Record, text return detailList([{ title: target, badge: detailBadge(match[1], t), fields: [], ...(description === '' ? {} : { description }), code: { text: code } }], `${target} · ${detailBadge(match[1], t).label}`, t) } case 'job_kill': - if (text === `requested cancellation of job ${target}`) return receipt(target, t('detail.receipt.cancel'), t, [], arg(args, 'reason')) - if (text.startsWith(`job ${target} had already finished `)) return receipt(target, t('detail.receipt.alreadyFinished'), t) + if (text === `requested cancellation of job ${target}`) return receipt(target, { label: t('detail.receipt.cancel'), tone: 'warning' }, t, [], arg(args, 'reason')) + if (text.startsWith(`job ${target} had already finished `)) return receipt(target, { label: t('detail.receipt.alreadyFinished'), tone: 'neutral' }, t) return null case 'terminal_open': { const match = /^started terminal session (\S+)(?: \((.*?)\))? \[type: ([^\]]+)\]\n([\s\S]*)$/u.exec(text) if (match === null || match[1] === undefined || match[3] === undefined || match[4] === undefined) return null - return detailList([{ title: match[2] ?? match[1], ...(match[2] === undefined ? {} : { subtitle: match[1] }), badge: { label: t('detail.receipt.started'), tone: 'neutral' }, fields: [{ label: t('detail.field.type'), value: match[3] }], code: { text: match[4] } }], match[2] ?? match[1], t) + return detailList([{ title: match[2] ?? match[1], ...(match[2] === undefined ? {} : { subtitle: match[1] }), badge: { label: t('detail.receipt.started'), tone: 'info' }, fields: [{ label: t('detail.field.type'), value: match[3] }], code: { text: match[4] } }], match[2] ?? match[1], t) } case 'terminal_read': { const match = /\n\[lines: (\d+)-(\d+) of (\d+)\](\n\[output truncated\])?$/u.exec(text) @@ -178,11 +180,11 @@ export function controlDetails(name: string, args: Record, text case 'terminal_signal': { const match = /^delivered (\S+) to foreground process group (\d+)$/u.exec(text) if (match === null || match[1] === undefined || match[2] === undefined) return null - return receipt(target, t('detail.receipt.signal'), t, [{ label: t('detail.field.signal'), value: match[1] }, { label: t('detail.field.processGroup'), value: match[2] }]) + return receipt(target, { label: t('detail.receipt.signal'), tone: 'success' }, t, [{ label: t('detail.field.signal'), value: match[1] }, { label: t('detail.field.processGroup'), value: match[2] }]) } case 'terminal_close': - if (text === `closed terminal session ${target}`) return receipt(target, t('detail.receipt.closed'), t) - if (text === `terminal session ${target} was already closing`) return receipt(target, t('detail.receipt.closing'), t) + if (text === `closed terminal session ${target}`) return receipt(target, { label: t('detail.receipt.closed'), tone: 'neutral' }, t) + if (text === `terminal session ${target} was already closing`) return receipt(target, { label: t('detail.receipt.closing'), tone: 'neutral' }, t) return null default: return null } diff --git a/packages/client/ui-tool/src/client/tool/models/detail-model-shared.ts b/packages/client/ui-tool/src/client/tool/models/detail-model-shared.ts index faca9a2190..46c6b6b886 100644 --- a/packages/client/ui-tool/src/client/tool/models/detail-model-shared.ts +++ b/packages/client/ui-tool/src/client/tool/models/detail-model-shared.ts @@ -58,7 +58,8 @@ export function detailBadge(status: string, t: DetailTranslate): NonNullable Date: Thu, 17 Sep 2026 11:21:33 +0800 Subject: [PATCH 13/75] fix(client): avoid duplicate expanded tool receipt statuses --- packages/client/ui-tool/README.i18n.yaml | 4 +- packages/client/ui-tool/README.md | 2 +- packages/client/ui-tool/README.zh.md | 2 +- .../client/tool/components/ToolDetails.tsx | 2 + .../src/client/tool/components/ToolRow.tsx | 2 +- .../tool/models/control-details-model.ts | 10 ++++- snapshots/web/tool-details/ui.expected.md | 40 +++++++++---------- 7 files changed, 35 insertions(+), 27 deletions(-) diff --git a/packages/client/ui-tool/README.i18n.yaml b/packages/client/ui-tool/README.i18n.yaml index bd11e79708..433db2d7b9 100644 --- a/packages/client/ui-tool/README.i18n.yaml +++ b/packages/client/ui-tool/README.i18n.yaml @@ -2,5 +2,5 @@ # side as of the last confirmed-consistent state. Both languages carry equal authority; # after editing either side, bring the other along and re-record with: # pnpm run verify-translation-pairing --write packages/client/ui-tool/README.md -README.md: 4964828126d426fe6f8491a2526de09aa1fbef5d -README.zh.md: 5c8f9b0ac53ec1e1180010a1f63333001b2a0d39 +README.md: 38cee0071c41178199604819608e32c0e846cc41 +README.zh.md: f2ef384b8fe5e5948a74dd9796fcae3077ac2094 diff --git a/packages/client/ui-tool/README.md b/packages/client/ui-tool/README.md index 4964828126..38cee0071c 100644 --- a/packages/client/ui-tool/README.md +++ b/packages/client/ui-tool/README.md @@ -66,7 +66,7 @@ Every card is read in place in the call tree; there is no second, full-height pr The Details view covers the 36 registered tools: goal and schedule tools, Cordis inspection, workflow and Ralph reports, Session event/search/trace queries, agent and teammate controls, background jobs, persistent terminals, and LSP navigation. These expanded bodies read successful logged results, preserve generic input/output for failures or unsupported data, and keep Inspect available. Dates include the viewer's time zone, and statuses reflect the call result rather than current session state. The browser adapter consumes recorded producer text and JSON; Host service objects and presenter callbacks do not cross into the Client. [Compact tool details](../../../.agents/notes/implemented/architecture/2026-09-10-compact-tool-details.md) records the presentation trade-offs. -Expanded status dots and labels use static semantic colors. An interruption receipt confirms only that interruption was requested. +Expanded status dots and labels use static semantic colors. Receipt and job-output headers keep neutral text and omit the status while expanded. An interruption receipt confirms only that interruption was requested. The terminal model uses `hasSpillNotice` from the browser-safe `@deepseek-ai/dsh-spill-policy/notice` entry, not an independent UI pattern. The [spill-policy README](../../spill/spill-policy/README.md#shared-notice-ownership) owns notice formatting and recognition. This check conservatively selects generic output; matching text cannot authenticate its source, and replay leaves recorded result bytes untouched. diff --git a/packages/client/ui-tool/README.zh.md b/packages/client/ui-tool/README.zh.md index 5c8f9b0ac5..f2ef384b8f 100644 --- a/packages/client/ui-tool/README.zh.md +++ b/packages/client/ui-tool/README.zh.md @@ -66,7 +66,7 @@ owner 载荷为 `ToolCallOwnerProps`:`callId`、`toolName`、冻结的 `block` Details 视图覆盖已注册的 36 个工具:目标和定时任务工具、Cordis 检查、workflow 与 Ralph 报告、Session 事件/搜索/轨迹查询、Agent 与 teammate 控制、后台作业、持久终端以及 LSP 导航。展开内容读取成功的记录结果,为失败或不支持的数据保留通用输入/输出,并保留 Inspect。日期包含查看者的时区,状态反映调用结果而非当前会话状态。浏览器适配器消费已记录的 producer 文本与 JSON;Host service 对象和 presenter 回调不会进入 Client。[紧凑工具详情](../../../.agents/notes/implemented/architecture/2026-09-10-compact-tool-details.zh.md)记录了呈现取舍。 -展开后的状态圆点和文字使用静态语义色。中断回执仅确认已发出中断请求。 +展开后的状态圆点和文字使用静态语义色。操作回执和任务输出的标题保持中性色,展开时省略标题中的状态。中断回执仅确认已发出中断请求。 terminal model 使用浏览器安全入口 `@deepseek-ai/dsh-spill-policy/notice` 的 `hasSpillNotice`,而非独立的 UI 匹配规则。[spill-policy README](../../spill/spill-policy/README.zh.md#shared-notice-ownership) 负责提示文本的格式化与识别。该检查保守地选择通用输出;匹配的文本无法证明其来源,回放也不改变已记录的结果字节。 diff --git a/packages/client/ui-tool/src/client/tool/components/ToolDetails.tsx b/packages/client/ui-tool/src/client/tool/components/ToolDetails.tsx index 64b593a9b6..b6bac6af4a 100644 --- a/packages/client/ui-tool/src/client/tool/components/ToolDetails.tsx +++ b/packages/client/ui-tool/src/client/tool/components/ToolDetails.tsx @@ -26,6 +26,8 @@ export interface ToolDetailItem { export interface ToolDetailsModel { items: readonly ToolDetailItem[] summary?: string + /** Header text while expanded, omitting a receipt status shown in the body. */ + expandedSummary?: string empty?: string caption?: string unchanged?: { label: string; items: ToolDetailsModel['items'] } diff --git a/packages/client/ui-tool/src/client/tool/components/ToolRow.tsx b/packages/client/ui-tool/src/client/tool/components/ToolRow.tsx index 9a67b36ff6..d86f730e0f 100644 --- a/packages/client/ui-tool/src/client/tool/components/ToolRow.tsx +++ b/packages/client/ui-tool/src/client/tool/components/ToolRow.tsx @@ -167,7 +167,7 @@ export function ToolRow({ const status = stateStatus(state, t) // A failure must replace, not supplement, the normal summary. const failureLine = state === 'error' ? errorSummary ?? null : null - const summaryText = failureLine ?? terminalBody?.description ?? summary + const summaryText = failureLine ?? terminalBody?.description ?? (open ? detailsBody?.expandedSummary ?? summary : summary) // A diff row's collapsed line carries the card's +/- totals (the same // numbers the expanded footer prints) so the change size reads without // expanding; an explicit summarySuffix (none today on diff rows) wins. diff --git a/packages/client/ui-tool/src/client/tool/models/control-details-model.ts b/packages/client/ui-tool/src/client/tool/models/control-details-model.ts index d869070431..830d16be36 100644 --- a/packages/client/ui-tool/src/client/tool/models/control-details-model.ts +++ b/packages/client/ui-tool/src/client/tool/models/control-details-model.ts @@ -13,7 +13,10 @@ function arg(args: Record, key: string): string { } function receipt(title: string, badge: NonNullable, t: DetailTranslate, fields: DetailItem['fields'] = [], description?: string): ToolDetailsModel { - return detailList([{ title, badge, fields, ...(description === undefined ? {} : { description }) }], `${title} · ${badge.label}`, t) + return { + ...detailList([{ title, badge, fields, ...(description === undefined ? {} : { description }) }], `${title} · ${badge.label}`, t), + expandedSummary: title, + } } function agentList(text: string, t: DetailTranslate): ToolDetailsModel | null { @@ -161,7 +164,10 @@ export function controlDetails(name: string, args: Record, text const code = truncated ? output.slice(0, -OUTPUT_TRUNCATED.length) : output const description = [match[2], truncated ? t('detail.output.truncated') : undefined] .filter((value): value is string => value !== undefined).join(' · ') - return detailList([{ title: target, badge: detailBadge(match[1], t), fields: [], ...(description === '' ? {} : { description }), code: { text: code } }], `${target} · ${detailBadge(match[1], t).label}`, t) + return { + ...detailList([{ title: target, badge: detailBadge(match[1], t), fields: [], ...(description === '' ? {} : { description }), code: { text: code } }], `${target} · ${detailBadge(match[1], t).label}`, t), + expandedSummary: target, + } } case 'job_kill': if (text === `requested cancellation of job ${target}`) return receipt(target, { label: t('detail.receipt.cancel'), tone: 'warning' }, t, [], arg(args, 'reason')) diff --git a/snapshots/web/tool-details/ui.expected.md b/snapshots/web/tool-details/ui.expected.md index e1cb9d408e..c65a66730e 100644 --- a/snapshots/web/tool-details/ui.expected.md +++ b/snapshots/web/tool-details/ui.expected.md @@ -408,9 +408,9 @@ - text: deepseek/deepseek-reasoner - paragraph: DeepSeek Reasoner - button "Inspect" -- button "Delegate task 检查工具卡片布局,并列出三个最值得改进的地方。 · Started" [expanded]: +- button "Delegate task 检查工具卡片布局,并列出三个最值得改进的地方。" [expanded]: - img - - text: Delegate task 检查工具卡片布局,并列出三个最值得改进的地方。 · Started + - text: Delegate task 检查工具卡片布局,并列出三个最值得改进的地方。 - text: Recorded result - list: - listitem: @@ -442,18 +442,18 @@ - term: Depth - definition: "2" - button "Inspect" -- button "Send message agent-demo-review · Message delivered" [expanded]: +- button "Send message agent-demo-review" [expanded]: - img - - text: Send message agent-demo-review · Message delivered + - text: Send message agent-demo-review - text: Recorded result - list: - listitem: - text: agent-demo-review Message delivered - paragraph: 请优先检查窄屏下的任务差异列表。 - button "Inspect" -- button "Interrupt agent agent-demo-review · Interrupt requested" [expanded]: +- button "Interrupt agent agent-demo-review" [expanded]: - img - - text: Interrupt agent agent-demo-review · Interrupt requested + - text: Interrupt agent agent-demo-review - text: Recorded result - list: - listitem: agent-demo-review Interrupt requested @@ -476,9 +476,9 @@ - term: Type - definition: terminal - button "Inspect" -- button "Read job output job-demo-build · Running" [expanded]: +- button "Read job output job-demo-build" [expanded]: - img - - text: Read job output job-demo-build · Running + - text: Read job output job-demo-build - text: Recorded result - list: - listitem: @@ -486,9 +486,9 @@ - button "Copy" - code: Building client assets… ✓ 184 modules transformed. dist/index.js 92.4 kB - button "Inspect" -- button "Cancel background job job-demo-preview · Cancellation requested" [expanded]: +- button "Cancel background job job-demo-preview" [expanded]: - img - - text: Cancel background job job-demo-preview · Cancellation requested + - text: Cancel background job job-demo-preview - text: Recorded result - list: - listitem: @@ -543,9 +543,9 @@ - term: Exit code - definition: "0" - button "Inspect" -- button "Signal terminal terminal-demo-1 · Signal delivered" [expanded]: +- button "Signal terminal terminal-demo-1" [expanded]: - img - - text: Signal terminal terminal-demo-1 · Signal delivered + - text: Signal terminal terminal-demo-1 - text: Recorded result - list: - listitem: @@ -555,9 +555,9 @@ - term: Process group - definition: "43120" - button "Inspect" -- button "Close terminal terminal-demo-1 · Closed" [expanded]: +- button "Close terminal terminal-demo-1" [expanded]: - img - - text: Close terminal terminal-demo-1 · Closed + - text: Close terminal terminal-demo-1 - text: Recorded result - list: - listitem: terminal-demo-1 Closed @@ -661,9 +661,9 @@ - term: Context - definition: fresh - button "Inspect" -- button "Send message ui-review · Message delivered" [expanded]: +- button "Send message ui-review" [expanded]: - img - - text: Send message ui-review · Message delivered + - text: Send message ui-review - text: Recorded result - list: - listitem: @@ -773,16 +773,16 @@ - listitem: - paragraph: task-demo-1 - button "Inspect" -- button "Wait for teammates Teammate activity · Change detected" [expanded]: +- button "Wait for teammates Teammate activity" [expanded]: - img - - text: Wait for teammates Teammate activity · Change detected + - text: Wait for teammates Teammate activity - text: Recorded result - list: - listitem: Teammate activity Change detected - button "Inspect" -- button "Interrupt agent ui-review · Interrupt requested" [expanded]: +- button "Interrupt agent ui-review" [expanded]: - img - - text: Interrupt agent ui-review · Interrupt requested + - text: Interrupt agent ui-review - text: Recorded result - list: - listitem: From f32c0cc3d9a3827ddb22f11f4f1494139fd8d2a9 Mon Sep 17 00:00:00 2001 From: _Kerman Date: Thu, 17 Sep 2026 12:03:41 +0800 Subject: [PATCH 14/75] refactor(client): simplify recorded tool detail models --- .../2026-09-10-compact-tool-details.i18n.yaml | 4 ++-- .../2026-09-10-compact-tool-details.md | 4 +++- .../2026-09-10-compact-tool-details.zh.md | 4 +++- .../tool/models/control-details-model.ts | 13 ++++++----- .../client/tool/models/details-card-model.ts | 7 +++--- .../tool/models/inspection-details-model.ts | 5 +++-- .../src/client/tool/models/todo-diff-model.ts | 17 +++++--------- .../src/client/tool/models/todo-history.ts | 22 +++++++------------ .../src/client/tool/toolviews/details-row.tsx | 4 +--- .../tests/details-models.client.spec.ts | 2 -- .../ui-tool/tests/details-row.client.spec.tsx | 17 +++++++------- 11 files changed, 44 insertions(+), 55 deletions(-) diff --git a/.agents/notes/implemented/architecture/2026-09-10-compact-tool-details.i18n.yaml b/.agents/notes/implemented/architecture/2026-09-10-compact-tool-details.i18n.yaml index acc370a074..484c0c2a3b 100644 --- a/.agents/notes/implemented/architecture/2026-09-10-compact-tool-details.i18n.yaml +++ b/.agents/notes/implemented/architecture/2026-09-10-compact-tool-details.i18n.yaml @@ -2,5 +2,5 @@ # side as of the last confirmed-consistent state. Both languages carry equal authority; # after editing either side, bring the other along and re-record with: # pnpm run verify-translation-pairing --write .agents/notes/implemented/architecture/2026-09-10-compact-tool-details.md -2026-09-10-compact-tool-details.md: 7460af5bb3b480416e777fa864d80e95e25d302c -2026-09-10-compact-tool-details.zh.md: e104ac1293f8b02d67bdba0d5987e693af58d97a +2026-09-10-compact-tool-details.md: 6c1f29c5554c74b01fc2a86c2dee3750a529a6b5 +2026-09-10-compact-tool-details.zh.md: d0822a48f100f9f21ef4706204087fcd1e627da4 diff --git a/.agents/notes/implemented/architecture/2026-09-10-compact-tool-details.md b/.agents/notes/implemented/architecture/2026-09-10-compact-tool-details.md index 7460af5bb3..6c1f29c555 100644 --- a/.agents/notes/implemented/architecture/2026-09-10-compact-tool-details.md +++ b/.agents/notes/implemented/architecture/2026-09-10-compact-tool-details.md @@ -14,6 +14,8 @@ The `ui-tool` package registers goal and schedule toolviews through the existing Tool rows keep their disclosure and Inspect interaction. Checklist marks are static and have accessible status labels. Schedule times use absolute dates with the viewer's time zone; states come from the recorded result. Goal details distinguish an active goal awaiting continuation from an armed goal. These display values do not subscribe to the current goal, todo, or schedule projection. +Todo changes compare each root or nested call with its preceding durable `todo/write`, so later writes cannot alter an earlier card. The conversation assembler repairs predecessors when older history loads. Until the predecessor is known, the card shows the submitted list without inferred additions or removals. + This scoped visual change is an exception to the visual-equivalence requirement in [Client-derived tool presentation](2026-08-23-client-derived-tool-presentation.md). Its raw-event ownership, generic fallback, and single keyed registry remain authoritative. ## Alternatives considered @@ -24,4 +26,4 @@ This scoped visual change is an exception to the visual-equivalence requirement ## Consequences -The 36 registered tool names gain readable details without changing Host tools, Session events, or public Client exports. `detailsCardModel` recognizes goal and schedule JSON, `controlDetails` recognizes agent, teammate, job, terminal, and LSP receipts, and `inspectionDetails` recognizes Cordis, workflow, Ralph, and Session query reports; any other result remains inspectable as raw text. The authored tool-details Session replay covers their assembled rendering. +Registered tools gain readable details without changing Host tools, Session events, or public Client exports. Tool-specific adapters interpret recorded JSON and text; unrecognized formats retain generic output. The authored tool-details Session replay covers their assembled rendering. diff --git a/.agents/notes/implemented/architecture/2026-09-10-compact-tool-details.zh.md b/.agents/notes/implemented/architecture/2026-09-10-compact-tool-details.zh.md index e104ac1293..d0822a48f1 100644 --- a/.agents/notes/implemented/architecture/2026-09-10-compact-tool-details.zh.md +++ b/.agents/notes/implemented/architecture/2026-09-10-compact-tool-details.zh.md @@ -14,6 +14,8 @@ Status: implemented 工具行保留展开和 Inspect 交互。任务清单标记是静态的,并带有可访问的状态标签。定时任务使用查看者时区的绝对日期,状态取自记录的结果。目标详情区分等待继续的活动目标和已启动的目标。这些显示值不订阅当前目标、任务清单或定时任务投影。 +任务清单的变化将每个根调用或嵌套调用与之前的持久化 `todo/write` 比较,因此后续写入不会改变较早的卡片。对话组装器在加载更早的历史时修复前序记录。前序记录尚不明确时,卡片展示提交的列表,不推断新增或删除。 + 这项有限的视觉调整是[客户端派生工具呈现](2026-08-23-client-derived-tool-presentation.zh.md)中视觉等价要求的例外。该决策中的原始事件所有权、通用回退和唯一按键注册表仍然有效。 ## 考虑过的替代方案 @@ -24,4 +26,4 @@ Status: implemented ## 影响 -已注册的 36 个工具名称获得可读详情,无需修改 Host 工具、Session 事件或公共 Client 导出。`detailsCardModel` 识别目标和定时任务 JSON,`controlDetails` 识别 Agent、teammate、作业、终端和 LSP 回执,`inspectionDetails` 识别 Cordis、workflow、Ralph 和 Session 查询报告;其他结果仍可作为原始文本查看。手工编写的 tool-details Session 回放覆盖它们在完整页面中的呈现。 +已注册的工具获得可读详情,无需改变 Host 工具、Session 事件或公开的 Client 导出。工具专用适配器解读记录中的 JSON 和文本;未识别的格式保留通用输出。手写的 tool-details Session 回放覆盖这些工具组装后的渲染。 diff --git a/packages/client/ui-tool/src/client/tool/models/control-details-model.ts b/packages/client/ui-tool/src/client/tool/models/control-details-model.ts index 830d16be36..19e90042bd 100644 --- a/packages/client/ui-tool/src/client/tool/models/control-details-model.ts +++ b/packages/client/ui-tool/src/client/tool/models/control-details-model.ts @@ -1,7 +1,7 @@ /** Entity lists and receipts for agent, job, terminal, and language-server tools. */ import type { ToolDetailsModel } from '../components/ToolDetails.tsx' import { - detailBadge, detailJson, detailList, detailRecord, inspectionItems, + detailBadge, detailList, detailRecord, inspectionItems, type DetailItem, type DetailTranslate, } from './detail-model-shared.ts' @@ -19,8 +19,7 @@ function receipt(title: string, badge: NonNullable, t: Deta } } -function agentList(text: string, t: DetailTranslate): ToolDetailsModel | null { - const json = detailJson(text) +function agentList(text: string, json: unknown, t: DetailTranslate): ToolDetailsModel | null { if (Array.isArray(json)) return detailList(inspectionItems(json, t), t('detail.agents.count', { count: json.length }), t) if (text === '(no subagents)') return detailList([], t('detail.agents.count', { count: 0 }), t) const items: DetailItem[] = [] @@ -102,14 +101,16 @@ function lspDetails(args: Record, text: string, t: DetailTransl * @param name - Wire tool name, including Team-scoped aliases. * @param args - Parsed recorded arguments. * @param text - Successful recorded result text. + * @param json - Parsed whole-result JSON, or undefined for non-JSON text. * @param t - Conversation translator. * @returns Compact details, or null when the output format is not recognized. */ -export function controlDetails(name: string, args: Record, text: string, t: DetailTranslate): ToolDetailsModel | null { - const json = detailJson(text) +export function controlDetails( + name: string, args: Record, text: string, json: unknown, t: DetailTranslate, +): ToolDetailsModel | null { const target = arg(args, 'target') || arg(args, 'agent_id') || arg(args, 'sessionId') || arg(args, 'job_id') switch (name) { - case 'list_agents': return agentList(text, t) + case 'list_agents': return agentList(text, json, t) case 'job_list': return jobList(text, t) case 'terminal_list': return terminalList(text, t) case 'lsp': return lspDetails(args, text, t) diff --git a/packages/client/ui-tool/src/client/tool/models/details-card-model.ts b/packages/client/ui-tool/src/client/tool/models/details-card-model.ts index eb5176c9fe..cb38149518 100644 --- a/packages/client/ui-tool/src/client/tool/models/details-card-model.ts +++ b/packages/client/ui-tool/src/client/tool/models/details-card-model.ts @@ -114,12 +114,11 @@ export function detailsCardModel(block: ToolCallBlock, t: Translate, locale: str if (!('kind' in block) || block.isError) return null const call = parsedToolCall(block) if (call === null) return null - if (call.name === 'todo_write') return todosDetail(call.args, t) const text = singleResultText(block) if (text === undefined) return null - const details = controlDetails(call.name, call.args, text, t) ?? inspectionDetails(call.name, call.args, text, t, locale) - if (details !== null) return details const value = detailJson(text) + const details = controlDetails(call.name, call.args, text, value, t) ?? inspectionDetails(call.name, call.args, text, value, t, locale) + if (details !== null) return details if (value === undefined) return null switch (call.name) { case 'create_goal': @@ -137,7 +136,7 @@ export function detailsCardModel(block: ToolCallBlock, t: Translate, locale: str if (item === null) return null items.push(item) } - return { items, empty: t('detail.schedule.empty') } + return { items, summary: t('detail.schedule.count', { count: items.length }), empty: t('detail.schedule.empty') } } case 'schedule_delete': if (!detailRecord(value) || !nonempty(value.id) || value.deleted !== true) return null diff --git a/packages/client/ui-tool/src/client/tool/models/inspection-details-model.ts b/packages/client/ui-tool/src/client/tool/models/inspection-details-model.ts index 8e5e751671..b5ecff3521 100644 --- a/packages/client/ui-tool/src/client/tool/models/inspection-details-model.ts +++ b/packages/client/ui-tool/src/client/tool/models/inspection-details-model.ts @@ -154,18 +154,19 @@ function traceDetails(name: string, text: string, t: DetailTranslate, locale: st * @param name - Wire tool name. * @param args - Recorded argument object. * @param text - Recorded result text. + * @param json - Parsed whole-result JSON, or undefined for non-JSON text. * @param t - Conversation translator. * @param locale - Date display locale. * @returns Structured details, or null when an output format is unknown. */ export function inspectionDetails( - name: string, args: Record, text: string, t: DetailTranslate, locale: string, + name: string, args: Record, text: string, json: unknown, t: DetailTranslate, locale: string, ): ToolDetailsModel | null { if (hasSpillNotice(text)) return null switch (name) { case 'cordis_inspect_list': case 'cordis_inspect_query': - case 'cordis_inspect_self': return cordisDetails(name, args, detailJson(text), t) + case 'cordis_inspect_self': return cordisDetails(name, args, json, t) case 'workflow': case 'ralph': return workflowDetails(name, args, text, t) case 'session_search': diff --git a/packages/client/ui-tool/src/client/tool/models/todo-diff-model.ts b/packages/client/ui-tool/src/client/tool/models/todo-diff-model.ts index 1b620597f1..ac4f9213fb 100644 --- a/packages/client/ui-tool/src/client/tool/models/todo-diff-model.ts +++ b/packages/client/ui-tool/src/client/tool/models/todo-diff-model.ts @@ -1,10 +1,10 @@ -/** Todo changes relative to the preceding successful recorded write. */ +/** Todo changes relative to the preceding recorded write. */ import type { ToolCallBlock } from '@deepseek-ai/dsh-client-ui-chat/client' import type { TranslateNS } from '@deepseek-ai/dsh-client-ui-slots' import type { ToolDetailsModel } from '../components/ToolDetails.tsx' import type { TodoBaseline } from './todo-history.ts' -import { detailsCardModel, todosDetail } from './details-card-model.ts' -import { detailRecord } from './detail-model-shared.ts' +import { todosDetail } from './details-card-model.ts' +import { parsedToolCall } from './raw-tool-call.ts' /** * Compare this write with its predecessor in the loaded call history. @@ -21,15 +21,8 @@ export function todoDiffModel( t: TranslateNS<'conversation'>, ): { details: ToolDetailsModel; summary: string | null } | null { if (!('kind' in block) || block.isError) return null - let current: ToolDetailsModel | null - if ('kind' in block && block.call?.name === 'todo_write') { - let args: unknown - try { args = JSON.parse(block.call.argsRaw) } - catch { return null } - current = detailRecord(args) ? todosDetail(args, t) : null - } else { - current = detailsCardModel(block, t, 'en') - } + const call = parsedToolCall(block) + const current = call?.name === 'todo_write' ? todosDetail(call.args, t) : null if (current === null) return null const previous: ToolDetailsModel | null = baseline?.todos === undefined ? null : { items: baseline.todos.map(todo => ({ title: todo.content, status: { value: todo.status, label: t(`detail.todo.${todo.status}`) }, fields: [], diff --git a/packages/client/ui-tool/src/client/tool/models/todo-history.ts b/packages/client/ui-tool/src/client/tool/models/todo-history.ts index 564755e4b8..591bc05ca5 100644 --- a/packages/client/ui-tool/src/client/tool/models/todo-history.ts +++ b/packages/client/ui-tool/src/client/tool/models/todo-history.ts @@ -59,26 +59,20 @@ interface TodoHistoryNode extends ConversationViewNode { readonly data: TodoBaseline } -/** Incremental target whose publication invalidates keyed reads without copying older calls. */ +/** Incremental lookup snapshots preserve earlier call baselines across later writes. */ export const todoHistoryView: ConversationViewDefinition = { target: 'tool-todo-history', create: () => { let calls = new Map() - const snapshot = (source: ReadonlyMap): TodoHistory => ({ get: callId => source.get(callId) }) - let current: TodoHistory = snapshot(calls) - const publish = (next: Map): TodoHistory => { - calls = next - current = snapshot(next) - return current - } return { - empty: current, - replace: ({ nodes }) => publish(new Map(nodes.map(node => [node.id, node.data]))), + empty: calls, + replace: ({ nodes }) => calls = new Map(nodes.map(node => [node.id, node.data])), apply: ({ upserts }) => { - if (upserts.length === 0) return current - const next = new Map(calls) - for (const node of upserts) next.set(node.id, node.data) - return publish(next) + if (upserts.length > 0) { + calls = new Map(calls) + for (const node of upserts) calls.set(node.id, node.data) + } + return calls }, } }, diff --git a/packages/client/ui-tool/src/client/tool/toolviews/details-row.tsx b/packages/client/ui-tool/src/client/tool/toolviews/details-row.tsx index 746ddbaf2c..2a98ab68ed 100644 --- a/packages/client/ui-tool/src/client/tool/toolviews/details-row.tsx +++ b/packages/client/ui-tool/src/client/tool/toolviews/details-row.tsx @@ -90,9 +90,7 @@ export function DetailsRow({ toolName, block, cwd, home, openFile, inspect, t }: toolName={toolName} icon={detailIcon(toolName)} title={t(titleKey)} - summary={details?.summary ?? (toolName === 'schedule_list' && details !== null - ? t('detail.schedule.count', { count: details.items.length }) - : details?.items[0]?.title ?? details?.empty ?? model.summary)} + summary={details?.summary ?? details?.items[0]?.title ?? details?.empty ?? model.summary} details={details} bodyRaw={model.bodyRaw} output={model.output} diff --git a/packages/client/ui-tool/tests/details-models.client.spec.ts b/packages/client/ui-tool/tests/details-models.client.spec.ts index bb259fc56d..d11547bf51 100644 --- a/packages/client/ui-tool/tests/details-models.client.spec.ts +++ b/packages/client/ui-tool/tests/details-models.client.spec.ts @@ -178,8 +178,6 @@ describe('inspection detail adapters', () => { describe('detailsCardModel fallback contract', () => { it('keeps malformed successful domain results generic', () => { expect(detailsCardModel(output('create_goal', 'not-json'), t, 'en')).toBeNull() - expect(detailsCardModel(output('todo_write', 'x', { todos: [{ content: 'x', status: 'pending' }] }), t, 'en')).not.toBeNull() - expect(detailsCardModel(output('todo_write', 'x', { todos: [{ content: 'x', status: 'unknown' }] }), t, 'en')).toBeNull() expect(detailsCardModel(output('schedule_create', '{"id":"s","prompt":"x","kind":"at","scheduledAt":"invalid","state":"scheduled","deliveryMode":"session-local"}'), t, 'en')).toBeNull() }) diff --git a/packages/client/ui-tool/tests/details-row.client.spec.tsx b/packages/client/ui-tool/tests/details-row.client.spec.tsx index ab98aeab2c..1d3ed9100b 100644 --- a/packages/client/ui-tool/tests/details-row.client.spec.tsx +++ b/packages/client/ui-tool/tests/details-row.client.spec.tsx @@ -6,7 +6,7 @@ import type { ToolResultNode } from '@deepseek-ai/dsh-client-ui-chat/client' import { makeTranslate } from '@deepseek-ai/dsh-client-test-runtime' import { en } from '@deepseek-ai/dsh-client-ui-conversation/src/client/locales.ts' import { en as commonEn } from '@deepseek-ai/dsh-client-locale/src/locales/en.ts' -import { detailsCardModel } from '../src/client/tool/models/details-card-model.ts' +import { detailsCardModel, todosDetail } from '../src/client/tool/models/details-card-model.ts' import { DetailsRow, detailsToolview } from '../src/client/tool/toolviews/details-row.tsx' const t = makeTranslate(en, commonEn) @@ -30,10 +30,11 @@ describe('detailsCardModel', () => { it('keeps all reminders and their recorded state, including one-shot and empty lists', () => { const model = detailsCardModel(result('schedule_list', [schedule, { ...schedule, id: 'schedule-2', kind: 'at', state: 'overdue' }, { ...schedule, id: 'schedule-3', kind: 'after', afterSeconds: 30 }]), t, 'en') expect(model?.items).toHaveLength(3) + expect(model?.summary).toBe('3 reminders') expect(model?.items[0]?.fields).toContainEqual({ label: 'Repeat', value: 'Every 1 h' }) expect(model?.items[1]?.fields).toContainEqual({ label: 'Status', value: 'Overdue, awaiting session resume' }) expect(model?.items[2]?.fields).toContainEqual({ label: 'Repeat', value: 'Once' }) - expect(detailsCardModel(result('schedule_list', []), t, 'en')?.empty).toBe('No reminders') + expect(detailsCardModel(result('schedule_list', []), t, 'en')).toMatchObject({ summary: '0 reminders', empty: 'No reminders' }) expect(detailsCardModel(result('schedule_delete', { id: 'schedule-1', deleted: true }), t, 'en')?.items[0]?.fields).toContainEqual({ label: 'Status', value: 'Deleted' }) }) @@ -63,15 +64,15 @@ describe('detailsCardModel', () => { expect(detailsCardModel({ callId: 'c1', name: 'create_goal', argsRaw: '{}', turn: 1, step: 1, time: 1000, subCalls: [] }, t, 'en')).toBeNull() expect(detailsCardModel({ ...block, parentCallId: 'parent' }, t, 'en')?.items[0]?.title).toBe(goal.objective) }) +}) - it('shows only successful valid to-do lists and uses the tool’s trimmed text', () => { - const block = result('todo_write', 'Updated todo list', JSON.stringify({ todos: [{ content: ' Build the page ', status: 'in_progress' }] })) - expect(detailsCardModel(block, t, 'en')?.items[0]).toEqual({ title: 'Build the page', status: { value: 'in_progress', label: 'In progress' }, fields: [] }) - expect(detailsCardModel({ ...block, isError: true }, t, 'en')).toBeNull() +describe('todosDetail', () => { + it('accepts valid to-do lists and uses the tool’s trimmed text', () => { + expect(todosDetail({ todos: [{ content: ' Build the page ', status: 'in_progress' }] }, t)?.items[0]).toEqual({ title: 'Build the page', status: { value: 'in_progress', label: 'In progress' }, fields: [] }) for (const todos of [[{ content: 'x', status: 'unknown' }], [{ content: '', status: 'pending' }], [null], [{ content: 'x', status: 'pending' }, { content: ' x ', status: 'completed' }]]) { - expect(detailsCardModel(result('todo_write', '', JSON.stringify({ todos })), t, 'en')).toBeNull() + expect(todosDetail({ todos }, t)).toBeNull() } - expect(detailsCardModel(result('todo_write', '', '{"todos":[]}'), t, 'en')?.empty).toBe('The to-do list is empty') + expect(todosDetail({ todos: [] }, t)?.empty).toBe('The to-do list is empty') }) }) From 83b2ff7aa171e486d1ca742bf7ab658674f23b71 Mon Sep 17 00:00:00 2001 From: _Kerman Date: Thu, 17 Sep 2026 12:04:19 +0800 Subject: [PATCH 15/75] fix(client): preserve tool detail navigation and layout --- apps/web/tests/tool-details.e2e.ts | 18 +++++++++ packages/client/ui-tool/README.i18n.yaml | 4 +- packages/client/ui-tool/README.md | 2 +- packages/client/ui-tool/README.zh.md | 2 +- .../tool/components/ToolDetails.module.css | 2 +- .../tool/models/control-details-model.ts | 3 +- .../tool/models/inspection-details-model.ts | 2 +- .../tests/details-models.client.spec.ts | 28 ++++++++++---- snapshots/web/tool-details/session.v3.jsonl | 6 +-- snapshots/web/tool-details/ui.expected.md | 37 ++++++++++++++++--- 10 files changed, 81 insertions(+), 23 deletions(-) diff --git a/apps/web/tests/tool-details.e2e.ts b/apps/web/tests/tool-details.e2e.ts index 336ed7901e..a1a84780e9 100644 --- a/apps/web/tests/tool-details.e2e.ts +++ b/apps/web/tests/tool-details.e2e.ts @@ -72,6 +72,24 @@ describe.skipIf(MODE === 'record')('web e2e: compact Tool details', () => { await page.setViewportSize({ width: 360, height: 800 }) const card = page.locator('[data-tool="schedule_create"]') expect(await card.evaluate(element => element.scrollWidth <= element.clientWidth)).toBe(true) + const reminders = page.locator('[data-tool="schedule_list"]') + await reminders.scrollIntoViewIfNeeded() + const list = reminders.getByRole('list').first() + await list.evaluate((element) => { + const second = element.children[1]! + element.scrollTop += second.getBoundingClientRect().top - element.getBoundingClientRect().top + }) + expect(await list.evaluate(element => element.scrollTop)).toBeGreaterThan(0) + const geometry = await reminders.evaluate((element) => { + const title = element.querySelector('ul')!.children[1]!.querySelector('[class*="heading"] > span')!.getBoundingClientRect() + const inspect = element.querySelector('[class*="inspectButton"]')!.getBoundingClientRect() + return { + verticalOverlap: Math.min(title.bottom, inspect.bottom) - Math.max(title.top, inspect.top), + horizontalGap: inspect.left - title.right, + } + }) + expect(geometry.verticalOverlap).toBeGreaterThan(0) + expect(geometry.horizontalGap).toBeGreaterThanOrEqual(0) expect(tripwire.pageErrors).toEqual([]) expect(tripwire.warnings).toEqual([]) }, 60_000) diff --git a/packages/client/ui-tool/README.i18n.yaml b/packages/client/ui-tool/README.i18n.yaml index 231310074b..94a2b9f6c4 100644 --- a/packages/client/ui-tool/README.i18n.yaml +++ b/packages/client/ui-tool/README.i18n.yaml @@ -2,5 +2,5 @@ # side as of the last confirmed-consistent state. Both languages carry equal authority; # after editing either side, bring the other along and re-record with: # pnpm run verify-translation-pairing --write packages/client/ui-tool/README.md -README.md: 0e41c1f1e0d8e0fb06f83cf7f7d2798b3cf8c1a0 -README.zh.md: 6a71cbd11a003b794e5ce79bc2fc63294b6c3f42 +README.md: cb01789c11e430a36081fd6e3f8629250038053a +README.zh.md: d648a93e294d6ef7830ecdf895493d44d292c2c6 diff --git a/packages/client/ui-tool/README.md b/packages/client/ui-tool/README.md index 0e41c1f1e0..cb01789c11 100644 --- a/packages/client/ui-tool/README.md +++ b/packages/client/ui-tool/README.md @@ -68,7 +68,7 @@ Chat diff cards keep nine rows before folding, enough for a file header, one rem An Auto denial takes precedence over keyed specialized views. Its generic row preserves the call identity, omits raw arguments, and normalizes the stored reason only for display: trim surrounding whitespace and collapse line separators to spaces, with localized fallback for an empty result. Session and SDK error details keep the original reason. -The Details view covers the 36 registered tools: goal and schedule tools, Cordis inspection, workflow and Ralph reports, Session event/search/trace queries, agent and teammate controls, background jobs, persistent terminals, and LSP navigation. These expanded bodies read successful logged results, preserve generic input/output for failures or unsupported data, and keep Inspect available. Dates include the viewer's time zone, and statuses reflect the call result rather than current session state. The browser adapter consumes recorded producer text and JSON; Host service objects and presenter callbacks do not cross into the Client. [Compact tool details](../../../.agents/notes/implemented/architecture/2026-09-10-compact-tool-details.md) records the presentation trade-offs. +Recorded tool details cover goal and schedule tools, Cordis inspection, workflow and Ralph reports, Session event/search/trace queries, agent and teammate controls, background jobs, persistent terminals, and LSP navigation. These expanded bodies read successful logged results, preserve generic input/output for failures or unsupported data, and keep Inspect available. Dates include the viewer's time zone, and statuses reflect the call result rather than current session state. Session traces preserve descendant indentation. LSP results open filesystem paths through the Host callback and display other URIs as text. The browser adapter consumes recorded producer text and JSON; Host service objects and presenter callbacks do not cross into the Client. [Compact tool details](../../../.agents/notes/implemented/architecture/2026-09-10-compact-tool-details.md) records the presentation trade-offs. Expanded status dots and labels use static semantic colors. Receipt and job-output headers keep neutral text and omit the status while expanded. An interruption receipt confirms only that interruption was requested. diff --git a/packages/client/ui-tool/README.zh.md b/packages/client/ui-tool/README.zh.md index 6a71cbd11a..d648a93e29 100644 --- a/packages/client/ui-tool/README.zh.md +++ b/packages/client/ui-tool/README.zh.md @@ -68,7 +68,7 @@ Chat diff 卡片在折叠前保留九行,足以容纳文件标题、一对删 Auto 拒绝优先于按工具名选择的专门视图。其通用行保留调用身份、省略原始参数,并且只在显示时归一化存储的理由:去除首尾空白,把行分隔符折叠为空格,结果为空时使用本地化通用理由。Session 与 SDK 错误详情保留原始理由。 -Details 视图覆盖已注册的 36 个工具:目标和定时任务工具、Cordis 检查、workflow 与 Ralph 报告、Session 事件/搜索/轨迹查询、Agent 与 teammate 控制、后台作业、持久终端以及 LSP 导航。展开内容读取成功的记录结果,为失败或不支持的数据保留通用输入/输出,并保留 Inspect。日期包含查看者的时区,状态反映调用结果而非当前会话状态。浏览器适配器消费已记录的 producer 文本与 JSON;Host service 对象和 presenter 回调不会进入 Client。[紧凑工具详情](../../../.agents/notes/implemented/architecture/2026-09-10-compact-tool-details.zh.md)记录了呈现取舍。 +记录结果的工具详情覆盖目标和定时任务工具、Cordis 检查、workflow 与 Ralph 报告、Session 事件/搜索/轨迹查询、Agent 与 teammate 控制、后台作业、持久终端以及 LSP 导航。展开内容读取成功的记录结果,为失败或不支持的数据保留通用输入/输出,并保留 Inspect。日期包含查看者的时区,状态反映调用结果而非当前会话状态。Session 轨迹保留后代的缩进。LSP 结果通过 Host 回调打开文件系统路径,其他 URI 则显示为文本。浏览器适配器消费已记录的 producer 文本与 JSON;Host service 对象和 presenter 回调不会进入 Client。[紧凑工具详情](../../../.agents/notes/implemented/architecture/2026-09-10-compact-tool-details.zh.md)记录了呈现取舍。 展开后的状态圆点和文字使用静态语义色。操作回执和任务输出的标题保持中性色,展开时省略标题中的状态。中断回执仅确认已发出中断请求。 diff --git a/packages/client/ui-tool/src/client/tool/components/ToolDetails.module.css b/packages/client/ui-tool/src/client/tool/components/ToolDetails.module.css index 2348cf2f11..824bd18fde 100644 --- a/packages/client/ui-tool/src/client/tool/components/ToolDetails.module.css +++ b/packages/client/ui-tool/src/client/tool/components/ToolDetails.module.css @@ -26,7 +26,7 @@ border-top: 0.5px solid var(--dsw-alias-border-l2); } -.root[data-inspect]:not([data-caption]) > .list > .item:first-child, +.root[data-inspect]:not([data-caption]) > .list > .item, .root[data-inspect]:not([data-caption]) .empty, .root[data-inspect] .caption { padding-inline-end: 88px; diff --git a/packages/client/ui-tool/src/client/tool/models/control-details-model.ts b/packages/client/ui-tool/src/client/tool/models/control-details-model.ts index 19e90042bd..47d6edceb8 100644 --- a/packages/client/ui-tool/src/client/tool/models/control-details-model.ts +++ b/packages/client/ui-tool/src/client/tool/models/control-details-model.ts @@ -87,9 +87,10 @@ function lspDetails(args: Record, text: string, t: DetailTransl if (match === null) return null const [, path, row, column] = match if (path === undefined || row === undefined || column === undefined) return null + const isUri = /^[a-z][a-z\d+.-]*:/iu.test(path) && !/^[a-z]:[\\/]/iu.test(path) items.push({ title: path, subtitle: t('detail.location', { line: row, column }), fields: [], - .../^[a-z][a-z\d+.-]*:\/\//iu.test(path) ? {} : { location: { path, line: Number(row) } }, + ...isUri ? {} : { location: { path, line: Number(row) } }, }) } const count = items.filter(item => item.title !== undefined).length diff --git a/packages/client/ui-tool/src/client/tool/models/inspection-details-model.ts b/packages/client/ui-tool/src/client/tool/models/inspection-details-model.ts index b5ecff3521..652ee09333 100644 --- a/packages/client/ui-tool/src/client/tool/models/inspection-details-model.ts +++ b/packages/client/ui-tool/src/client/tool/models/inspection-details-model.ts @@ -144,7 +144,7 @@ function traceDetails(name: string, text: string, t: DetailTranslate, locale: st const label = section.startsWith('Ancestors (nearest first):') ? t('detail.trace.ancestors') : section.startsWith('Descendants:') ? t('detail.trace.descendants') : undefined if (label === undefined || firstBreak < 0) return null const body = section.slice(firstBreak + 1) - items.push({ title: label, fields: [], ...(body === '- none' || body === '- none (target is a root session)' ? { description: t('detail.none') } : { lines: body.split('\n').map(line => line.replace(/^\s*- /u, '')) }) }) + items.push({ title: label, fields: [], ...(body === '- none' || body === '- none (target is a root session)' ? { description: t('detail.none') } : { lines: body.split('\n').map(line => line.replace(/^(\s*)- /u, '$1')) }) }) } return detailList(items, match[2], t) } diff --git a/packages/client/ui-tool/tests/details-models.client.spec.ts b/packages/client/ui-tool/tests/details-models.client.spec.ts index d11547bf51..34c355b211 100644 --- a/packages/client/ui-tool/tests/details-models.client.spec.ts +++ b/packages/client/ui-tool/tests/details-models.client.spec.ts @@ -63,7 +63,10 @@ describe('control detail adapters', () => { { sessionId: 'pty-2' as never, name: 'done', type: 'shell', pid: 4, status: { kind: 'exited' as const, exitCode: 2, signal: null } }, ] expect(details('terminal_list', renderList(terminals, 1000))?.items).toHaveLength(2) - expect(details('lsp', 'src/a.ts:2:3\nhttps://example.test/a.ts:4:5', { file_path: 'src/main.ts', line: 2, character: 3, operation: 'findReferences' })?.items).toHaveLength(2) + const locations = details('lsp', 'src/a.ts:2:3\nhttps://example.test/a.ts:4:5\nuntitled:Untitled-1:6:7\nC:\\src\\a.ts:8:9\nD:/lib/a.ts:10:11', { file_path: 'src/main.ts', line: 2, character: 3, operation: 'findReferences' })?.items + expect(locations?.map(item => item.location)).toEqual([ + { path: 'src/a.ts', line: 2 }, undefined, undefined, { path: 'C:\\src\\a.ts', line: 8 }, { path: 'D:/lib/a.ts', line: 10 }, + ]) expect(details('lsp', 'No results.', { file_path: 'src/main.ts', line: 2, character: 3, operation: 'findReferences' })?.empty).toBe('No results') expect(details('lsp', 'hover text', { file_path: 'src/main.ts', line: 2, character: 3, operation: 'hover' })?.items[0]?.markdown).toBe('hover text') }) @@ -122,21 +125,30 @@ describe('inspection detail adapters', () => { it('uses the session-query producer presentation for searches, reads, and traces', () => { const session = sessionRecord('s1', true, true) const hit = { ...session, bestMatch: { sessionId: 's1' as never, seq: 2, type: 'user/message', time: 2_000, surface: 'current', snippet: 'needle' } } - const titles = new Map([['s1' as never, { title: 'Session one' } as never]]) as never + const title = { text: 'Session one' } + const titles = new Map([ + ['s1' as never, title], ['s2' as never, { text: 'Child' }], ['s3' as never, { text: 'Grandchild' }], + ]) as Parameters[1] const sessionSearch = presentation.formatSessionSearch({ items: [hit as never], capped: true }, titles, new Set()) - expect(details('session_search', sessionSearch)?.items[0]?.description).toBe('needle') + expect(details('session_search', sessionSearch)?.items[0]).toMatchObject({ title: 'Session one', subtitle: 's1', description: 'needle' }) const eventSearch = presentation.formatEventSearch( - 's1' as never, { title: 'Session one' } as never, + 's1' as never, title, { items: [{ sessionId: 's1' as never, seq: 2 as never, type: 'tool/call', time: 2_000, surface: 'current', snippet: 'needle' }], capped: false }, ) expect(details('session_event_search', eventSearch)?.items[0]?.title).toBe('needle') const trace = presentation.formatSessionTrace( { target: session as never, ancestors: [], descendants: [], complete: true, root: session as never } as never, - [], false, [], titles, + [], false, [{ record: sessionRecord('s2', true, true) as never, descendants: [{ record: sessionRecord('s3', true, true) as never, descendants: [] }] }], titles, ) - expect(details('session_trace', trace)?.items).toHaveLength(3) + const traceItems = details('session_trace', trace)?.items + expect(traceItems).toHaveLength(3) + expect(traceItems?.[0]).toMatchObject({ title: 'Session one', subtitle: 's1' }) + expect(traceItems?.[2]?.lines).toEqual([ + 's2 — Child | 1970-01-01T00:00:01.000Z | live, persisted', + ' s3 — Grandchild | 1970-01-01T00:00:01.000Z | live, persisted', + ]) const eventTrace = presentation.formatEventTrace( - 's1' as never, { title: 'Session one' } as never, + 's1' as never, title, { session: { id: 's1' as never, createdAt: 1_000 } as never, target: { sessionId: 's1' as never, seq: 2 as never, type: 'tool/call', time: 2_000, surface: 'current' }, @@ -146,7 +158,7 @@ describe('inspection detail adapters', () => { expect(details('session_event_trace', eventTrace)?.items[0]?.fields).toContainEqual({ label: 'Target event', value: 'seq 2 | tool/call | current | 1970-01-01T00:00:02.000Z' }) const event = { seq: 2, time: 2_000, type: 'tool/call', data: { name: 'x' } } const eventRead = presentation.formatEventRead( - 's1' as never, { title: 'Session one' } as never, + 's1' as never, title, { session: {} as never, inheritedEventCount: 0 as never, target: event as never, events: [event as never], startSeq: 2 as never, endSeq: 2 as never, diff --git a/snapshots/web/tool-details/session.v3.jsonl b/snapshots/web/tool-details/session.v3.jsonl index 3c28a1083b..58825a781d 100644 --- a/snapshots/web/tool-details/session.v3.jsonl +++ b/snapshots/web/tool-details/session.v3.jsonl @@ -16,7 +16,7 @@ {"type":"tool/call","data":{"turn":1,"step":1,"callId":"details-call-5","name":"update_goal","arguments":"{\"goal_id\":\"{{id:1}}\",\"action\":\"complete\"}"}} {"type":"tool/result","surfaceOp":"append","data":{"turn":1,"step":1,"message":{"role":"user","content":[{"type":"tool-result","toolCallId":"details-call-5","content":[{"type":"text","text":"{\"goal\":{\"id\":\"{{id:1}}\",\"revision\":2,\"objective\":\"Ship compact tool cards\",\"phase\":\"complete\",\"roundsStarted\":0,\"maxGoalRounds\":8},\"activation\":\"disarmed\"}"}],"isError":false}],"source":{"kind":"tool","callId":"details-call-5"},"id":"{{message:7}}"}}} {"type":"tool/call","data":{"turn":1,"step":1,"callId":"details-call-6","name":"schedule_list","arguments":"{}"}} -{"type":"tool/result","surfaceOp":"append","data":{"turn":1,"step":1,"message":{"role":"user","content":[{"type":"tool-result","toolCallId":"details-call-6","content":[{"type":"text","text":"[{\"id\":\"details-reminder\",\"prompt\":\"Review the build and open the demo\",\"kind\":\"every\",\"everySeconds\":3600,\"scheduledAt\":\"2099-09-10T09:00:00.000Z\",\"state\":\"scheduled\",\"deliveryMode\":\"session-local\"}]"}],"isError":false}],"source":{"kind":"tool","callId":"details-call-6"},"id":"{{message:8}}"}}} +{"type":"tool/result","surfaceOp":"append","data":{"turn":1,"step":1,"message":{"role":"user","content":[{"type":"tool-result","toolCallId":"details-call-6","content":[{"type":"text","text":"[{\"id\":\"details-reminder\",\"prompt\":\"Review the build and open the demo\",\"kind\":\"every\",\"everySeconds\":3600,\"scheduledAt\":\"2099-09-10T09:00:00.000Z\",\"state\":\"scheduled\",\"deliveryMode\":\"session-local\"},{\"id\":\"details-reminder-2\",\"prompt\":\"Review the narrow reminder layout before sharing the updated demo with the team\",\"kind\":\"every\",\"everySeconds\":3600,\"scheduledAt\":\"2099-09-10T09:00:00.000Z\",\"state\":\"scheduled\",\"deliveryMode\":\"session-local\"},{\"id\":\"details-reminder-3\",\"prompt\":\"Check the recorded tool results and finish the remaining review comments\",\"kind\":\"every\",\"everySeconds\":3600,\"scheduledAt\":\"2099-09-10T09:00:00.000Z\",\"state\":\"scheduled\",\"deliveryMode\":\"session-local\"},{\"id\":\"details-reminder-4\",\"prompt\":\"Publish the reviewed demo and verify the deployment status\",\"kind\":\"every\",\"everySeconds\":3600,\"scheduledAt\":\"2099-09-10T09:00:00.000Z\",\"state\":\"scheduled\",\"deliveryMode\":\"session-local\"}]"}],"isError":false}],"source":{"kind":"tool","callId":"details-call-6"},"id":"{{message:8}}"}}} {"type":"tool/call","data":{"turn":1,"step":1,"callId":"details-call-7","name":"schedule_delete","arguments":"{\"id\":\"details-reminder\"}"}} {"type":"tool/result","surfaceOp":"append","data":{"turn":1,"step":1,"message":{"role":"user","content":[{"type":"tool-result","toolCallId":"details-call-7","content":[{"type":"text","text":"{\"id\":\"details-reminder\",\"deleted\":true}"}],"isError":false}],"source":{"kind":"tool","callId":"details-call-7"},"id":"{{message:9}}"}}} {"type":"tool/call","data":{"turn":1,"step":1,"callId":"details-call-8","name":"todo_write","arguments":"{\"todos\":[{\"content\":\"Keep the existing row and expansion controls\",\"status\":\"completed\"},{\"content\":\"Render compact fields and lists\",\"status\":\"completed\"},{\"content\":\"Publish the reviewed cards\",\"status\":\"pending\"}]}"}} @@ -41,7 +41,7 @@ {"type":"tool/call","data":{"turn":1,"step":1,"callId":"details-call-17","name":"session_search","arguments":"{\"query\":\"工具卡片\",\"limit\":5}"}} {"type":"tool/result","surfaceOp":"append","data":{"turn":1,"step":1,"message":{"role":"user","content":[{"type":"tool-result","toolCallId":"details-call-17","content":[{"type":"text","text":"Session search results (2):\n\n1. Session todo-diff-demo — 任务清单变化示例\n Created: 2026-09-10T08:00:00.000Z\n Parent: root\n Availability: persisted\n Best match: seq 1 | user/message | current | 2026-09-10T08:00:00.000Z\n Snippet: 重新设计任务清单工具卡片。\n\n2. Session tool-details-demo — Tool card details demo\n Created: 2026-09-10T07:00:00.000Z\n Parent: root\n Availability: persisted\n Best match: seq 1 | user/message | current | 2026-09-10T07:00:00.000Z\n Snippet: Show a goal, a to-do list, and reminders."}],"isError":false}],"source":{"kind":"tool","callId":"details-call-17"},"id":"{{message:19}}"}}} {"type":"tool/call","data":{"turn":1,"step":1,"callId":"details-call-18","name":"session_trace","arguments":"{\"session_id\":\"todo-diff-demo\"}"}} -{"type":"tool/result","surfaceOp":"append","data":{"turn":1,"step":1,"message":{"role":"user","content":[{"type":"tool-result","toolCallId":"details-call-18","content":[{"type":"text","text":"Session todo-diff-demo — 任务清单变化示例\nCreated: 2026-09-10T08:00:00.000Z\nAvailability: persisted\n\nAncestors (nearest first):\n- none (target is a root session)\n\nDescendants:\n- none"}],"isError":false}],"source":{"kind":"tool","callId":"details-call-18"},"id":"{{message:20}}"}}} +{"type":"tool/result","surfaceOp":"append","data":{"turn":1,"step":1,"message":{"role":"user","content":[{"type":"tool-result","toolCallId":"details-call-18","content":[{"type":"text","text":"Session todo-diff-demo — 任务清单变化示例\nCreated: 2026-09-10T08:00:00.000Z\nAvailability: persisted\n\nAncestors (nearest first):\n- none (target is a root session)\n\nDescendants:\n- review-child — Layout review | 2026-09-10T08:05:00.000Z | persisted\n - review-grandchild — Narrow layout | 2026-09-10T08:10:00.000Z | persisted"}],"isError":false}],"source":{"kind":"tool","callId":"details-call-18"},"id":"{{message:20}}"}}} {"type":"tool/call","data":{"turn":1,"step":1,"callId":"details-call-19","name":"list_subagent_models","arguments":"{\"provider\":\"deepseek\"}"}} {"type":"tool/result","surfaceOp":"append","data":{"turn":1,"step":1,"message":{"role":"user","content":[{"type":"tool-result","toolCallId":"details-call-19","content":[{"type":"text","text":"deepseek/deepseek-chat — DeepSeek Chat\ndeepseek/deepseek-reasoner — DeepSeek Reasoner"}],"isError":false}],"source":{"kind":"tool","callId":"details-call-19"},"id":"{{message:21}}"}}} {"type":"tool/call","data":{"turn":1,"step":1,"callId":"details-call-20","name":"subagent","arguments":"{\"prompt\":\"检查工具卡片布局,并列出三个最值得改进的地方。\"}"}} @@ -71,7 +71,7 @@ {"type":"tool/call","data":{"turn":1,"step":1,"callId":"details-call-32","name":"lsp","arguments":"{\"operation\":\"goToDefinition\",\"file_path\":\"src/app.ts\",\"line\":18,\"character\":5}"}} {"type":"tool/result","surfaceOp":"append","data":{"turn":1,"step":1,"message":{"role":"user","content":[{"type":"tool-result","toolCallId":"details-call-32","content":[{"type":"text","text":"src/tool-details.ts:24:1"}],"isError":false}],"source":{"kind":"tool","callId":"details-call-32"},"id":"{{message:34}}"}}} {"type":"tool/call","data":{"turn":1,"step":1,"callId":"details-call-33","name":"lsp","arguments":"{\"operation\":\"findReferences\",\"file_path\":\"src/tool-details.ts\",\"line\":24,\"character\":1}"}} -{"type":"tool/result","surfaceOp":"append","data":{"turn":1,"step":1,"message":{"role":"user","content":[{"type":"tool-result","toolCallId":"details-call-33","content":[{"type":"text","text":"src/app.ts:18:5\nsrc/tool-row.tsx:42:9\nsrc/todo-row.tsx:67:12"}],"isError":false}],"source":{"kind":"tool","callId":"details-call-33"},"id":"{{message:35}}"}}} +{"type":"tool/result","surfaceOp":"append","data":{"turn":1,"step":1,"message":{"role":"user","content":[{"type":"tool-result","toolCallId":"details-call-33","content":[{"type":"text","text":"src/app.ts:18:5\nsrc/tool-row.tsx:42:9\nsrc/todo-row.tsx:67:12\nuntitled:Untitled-1:6:7"}],"isError":false}],"source":{"kind":"tool","callId":"details-call-33"},"id":"{{message:35}}"}}} {"type":"tool/call","data":{"turn":1,"step":1,"callId":"details-call-34","name":"lsp","arguments":"{\"operation\":\"goToImplementation\",\"file_path\":\"src/types.ts\",\"line\":12,\"character\":18}"}} {"type":"tool/result","surfaceOp":"append","data":{"turn":1,"step":1,"message":{"role":"user","content":[{"type":"tool-result","toolCallId":"details-call-34","content":[{"type":"text","text":"src/tool-details.ts:24:1\nsrc/fallback-details.ts:8:1"}],"isError":false}],"source":{"kind":"tool","callId":"details-call-34"},"id":"{{message:36}}"}}} {"type":"tool/call","data":{"turn":1,"step":1,"callId":"details-call-35","name":"lsp","arguments":"{\"operation\":\"hover\",\"file_path\":\"src/tool-details.ts\",\"line\":24,\"character\":1}"}} diff --git a/snapshots/web/tool-details/ui.expected.md b/snapshots/web/tool-details/ui.expected.md index c65a66730e..e415ad9913 100644 --- a/snapshots/web/tool-details/ui.expected.md +++ b/snapshots/web/tool-details/ui.expected.md @@ -59,9 +59,9 @@ - term: Rounds - definition: 0 / 8 - button "Inspect" -- button "List reminders 1 reminders" [expanded]: +- button "List reminders 4 reminders" [expanded]: - img - - text: List reminders 1 reminders + - text: List reminders 4 reminders - list: - listitem: - text: Review the build and open the demo @@ -71,6 +71,30 @@ - definition: Every 1 h - term: Status - definition: Scheduled + - listitem: + - text: Review the narrow reminder layout before sharing the updated demo with the team + - term: Scheduled for + - definition: Sep 10, 2099, {{clock}} GMT+8 + - term: Repeat + - definition: Every 1 h + - term: Status + - definition: Scheduled + - listitem: + - text: Check the recorded tool results and finish the remaining review comments + - term: Scheduled for + - definition: Sep 10, 2099, {{clock}} GMT+8 + - term: Repeat + - definition: Every 1 h + - term: Status + - definition: Scheduled + - listitem: + - text: Publish the reviewed demo and verify the deployment status + - term: Scheduled for + - definition: Sep 10, 2099, {{clock}} GMT+8 + - term: Repeat + - definition: Every 1 h + - term: Status + - definition: Scheduled - button "Inspect" - button "Delete reminder details-reminder" [expanded]: - img @@ -394,7 +418,9 @@ - paragraph: None - listitem: - text: Descendant sessions - - paragraph: None + - list: + - listitem: review-child — Layout review | {{timestamp}} | persisted + - listitem: review-grandchild — Narrow layout | {{timestamp}} | persisted - button "Inspect" - button "List models deepseek" [expanded]: - img @@ -571,9 +597,9 @@ - button "src/tool-details.ts" - text: Line 24, column 1 - button "Inspect" -- button "Find references src/tool-details.ts · 3 locations" [expanded]: +- button "Find references src/tool-details.ts · 4 locations" [expanded]: - img - - text: Find references src/tool-details.ts · 3 locations + - text: Find references src/tool-details.ts · 4 locations - text: Recorded result - list: - listitem: @@ -585,6 +611,7 @@ - listitem: - button "src/todo-row.tsx" - text: Line 67, column 12 + - listitem: untitled:Untitled-1 Line 6, column 7 - button "Inspect" - button "Find implementation src/types.ts · 2 locations" [expanded]: - img From 0495ad9846a52e7e694e7e1b827c74e02e930e9d Mon Sep 17 00:00:00 2001 From: Yichen Jiang Date: Thu, 17 Sep 2026 17:50:32 +0800 Subject: [PATCH 16/75] fix(web): use the plain text file icon for plan tabs --- packages/client/ui-plan/README.i18n.yaml | 4 ++-- packages/client/ui-plan/README.md | 2 +- packages/client/ui-plan/README.zh.md | 2 +- packages/client/ui-plan/src/client/PlanPreview.module.css | 2 +- packages/client/ui-plan/src/client/PlanPreview.tsx | 8 ++++---- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/packages/client/ui-plan/README.i18n.yaml b/packages/client/ui-plan/README.i18n.yaml index 0023f8b06c..17181b1dde 100644 --- a/packages/client/ui-plan/README.i18n.yaml +++ b/packages/client/ui-plan/README.i18n.yaml @@ -2,5 +2,5 @@ # side as of the last confirmed-consistent state. Both languages carry equal authority; # after editing either side, bring the other along and re-record with: # pnpm run verify-translation-pairing --write packages/client/ui-plan/README.md -README.md: f7e7aede2c76717228d101153e4d3d2f8d3f88c4 -README.zh.md: 9ab37a25dd7cb406b42bf5c531445357d6725e2e +README.md: e269ad270ed6a0d72e4cb7424a86328d3eb6cfb3 +README.zh.md: 202a6737986630f18ffdf7d010174c98be732ba5 diff --git a/packages/client/ui-plan/README.md b/packages/client/ui-plan/README.md index f7e7aede2c..e269ad270e 100644 --- a/packages/client/ui-plan/README.md +++ b/packages/client/ui-plan/README.md @@ -33,7 +33,7 @@ While the effective target is plan mode, the seat renders the warn-colored "Plan ### Reading submitted plans -When a Turn ends, each submitted plan appears in its final artifact area, using the file-delivery card treatment with a Markdown icon, title, and Open action. A pending plan opens automatically once per submission in the current browser session. Closing it stays effective across review remounts; a new submission opens its own plan. Historical cards open only when clicked. Use the card or review strip’s View full plan link to read and copy the complete Markdown. Plan tabs show a document-and-pen icon. Different submissions retain separate tabs; the review buttons alone decide whether implementation may begin. +When a Turn ends, each submitted plan appears in its final artifact area, using the file-delivery card treatment with a Markdown icon, title, and Open action. A pending plan opens automatically once per submission in the current browser session. Closing it stays effective across review remounts; a new submission opens its own plan. Historical cards open only when clicked. Use the card or review strip’s View full plan link to read and copy the complete Markdown. Plan tabs show a plain text file icon. Different submissions retain separate tabs; the review buttons alone decide whether implementation may begin. A review without a logged invocation also opens automatically. Its complete text lives only in the tab’s navigation memory, and the pending review card can reopen it. Reloading the page loses that text; an expired preview directs the user back to a pending review. diff --git a/packages/client/ui-plan/README.zh.md b/packages/client/ui-plan/README.zh.md index 9ab37a25dd..202a673798 100644 --- a/packages/client/ui-plan/README.zh.md +++ b/packages/client/ui-plan/README.zh.md @@ -33,7 +33,7 @@ kind: "package-reference" ### 查看已提交的计划 -回合结束后,每次提交的计划都会显示在该回合末尾的产物区域,并采用文件产物卡片的样式,包含 Markdown 图标、标题和“打开”操作。在当前浏览器会话中,每份待审计划自动打开一次;关闭后,重新挂载审批组件不会再次展开,新提交会打开其对应计划。历史卡片仅在点击后打开。通过卡片或审批条带上的“查看全文”链接可阅读和复制完整 Markdown。计划标签页显示文档加笔的图标。不同提交保留独立标签页;是否开始实施仍由审批按钮决定。 +回合结束后,每次提交的计划都会显示在该回合末尾的产物区域,并采用文件产物卡片的样式,包含 Markdown 图标、标题和“打开”操作。在当前浏览器会话中,每份待审计划自动打开一次;关闭后,重新挂载审批组件不会再次展开,新提交会打开其对应计划。历史卡片仅在点击后打开。通过卡片或审批条带上的“查看全文”链接可阅读和复制完整 Markdown。计划标签页显示纯文本文件图标。不同提交保留独立标签页;是否开始实施仍由审批按钮决定。 没有已记录调用标识的审批也会自动打开。完整正文只保存在标签页的导航内存中,待处理审批卡片可以重新打开它。刷新页面会丢失该正文;失效的预览会提示用户返回待处理审批。 diff --git a/packages/client/ui-plan/src/client/PlanPreview.module.css b/packages/client/ui-plan/src/client/PlanPreview.module.css index 0fcac5cd7b..c0f2761be0 100644 --- a/packages/client/ui-plan/src/client/PlanPreview.module.css +++ b/packages/client/ui-plan/src/client/PlanPreview.module.css @@ -37,5 +37,5 @@ .toolbar { display: flex; justify-content: flex-end; margin-bottom: 8px; } .document { color: var(--dsw-alias-label-primary); font-size: 14px; line-height: 1.75; overflow-wrap: anywhere; } .message { padding: 24px; color: var(--dsw-alias-label-secondary); font-size: 14px; } -.titleIcon { display: inline-flex; flex: none; } +.titleIcon { flex: none; } @media (max-width: 767px) { .preview { padding: 16px 18px 32px; } } diff --git a/packages/client/ui-plan/src/client/PlanPreview.tsx b/packages/client/ui-plan/src/client/PlanPreview.tsx index b417507c77..2f0c05508a 100644 --- a/packages/client/ui-plan/src/client/PlanPreview.tsx +++ b/packages/client/ui-plan/src/client/PlanPreview.tsx @@ -1,6 +1,6 @@ /** Read-only Markdown viewer for logged plans and temporary review documents. */ import { useMemo } from 'react' -import { IconCopyOutline16, IconPlanOutline14, MarkdownText, writeClipboard } from '@deepseek-ai/dsh-client-ui-primitives' +import { FileTypeIcon, IconCopyOutline16, MarkdownText, writeClipboard } from '@deepseek-ai/dsh-client-ui-primitives' import type { PropsLocale, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots' import type {} from '@deepseek-ai/dsh-client-ui-sidebar-right/client' import type {} from './plan-resource.ts' @@ -42,9 +42,9 @@ export function PlanPreview({ useTabInfo, useResource, t }: PlanPreviewProps) { } /** - * Display a plan icon and the heading in its tab after resource recovery. + * Display a plain file icon and the heading in its tab after resource recovery. * @param props - Framework-bound tab identity and resource reader. - * @returns a decorative plan icon followed by the recovered title or initial localized label. + * @returns a decorative file icon followed by the recovered title or initial localized label. */ export function PlanTitle({ useTabInfo, useResource }: PropsRuntime<'sidebar.right.pane.tab.title'>) { const tab = useTabInfo() @@ -52,5 +52,5 @@ export function PlanTitle({ useTabInfo, useResource }: PropsRuntime<'sidebar.rig const params = tab.tab.navigation.params const plan = isReviewPreviewAddress(tab.tab.navigation.address) ? (params !== undefined && 'planReview' in params ? params.planReview : undefined) : resource.value - return <>{plan?.title ?? tab.tab.title} + return <>{plan?.title ?? tab.tab.title} } From 1628e911c884e31e63711752aec92ead77717f39 Mon Sep 17 00:00:00 2001 From: 07akioni <07akioni2@gmail.com> Date: Thu, 17 Sep 2026 19:38:57 +0800 Subject: [PATCH 17/75] fix(client): keep sidebar navigation available without a session --- ...3-macos-hidden-titlebar-vibrancy.i18n.yaml | 4 +- ...26-09-13-macos-hidden-titlebar-vibrancy.md | 6 +- ...09-13-macos-hidden-titlebar-vibrancy.zh.md | 6 +- .../tests/details-session-lifecycle.e2e.ts | 20 +++ docs/subsystems/slots.i18n.yaml | 4 +- docs/subsystems/slots.md | 13 +- docs/subsystems/slots.zh.md | 13 +- .../client/ui-conversation/README.i18n.yaml | 4 +- packages/client/ui-conversation/README.md | 2 +- packages/client/ui-conversation/README.zh.md | 2 +- .../ui-conversation/src/client/apply.ts | 13 +- .../src/client/contract/slots.ts | 24 +-- .../client/skeleton/ConversationHeader.tsx | 27 ++++ .../client/skeleton/ConversationMainPanel.tsx | 2 +- .../skeleton/ConversationRoot.module.css | 6 + .../client/skeleton/ConversationSession.tsx | 7 +- .../tests/apply-wiring.client.spec.tsx | 2 + .../tests/skeleton.client.spec.tsx | 23 ++- packages/client/ui-sidebar/README.i18n.yaml | 4 +- packages/client/ui-sidebar/README.md | 2 +- packages/client/ui-sidebar/README.zh.md | 2 +- .../src/client/HeaderLeadingControls.tsx | 8 +- .../client/ui-sidebar/src/client/index.ts | 4 +- .../ui-sidebar/tests/apply.client.spec.tsx | 6 +- .../src/client/slot-catalog.ts | 147 +++++++++++------- 25 files changed, 230 insertions(+), 121 deletions(-) create mode 100644 packages/client/ui-conversation/src/client/skeleton/ConversationHeader.tsx diff --git a/.agents/notes/implemented/feature/2026-09-13-macos-hidden-titlebar-vibrancy.i18n.yaml b/.agents/notes/implemented/feature/2026-09-13-macos-hidden-titlebar-vibrancy.i18n.yaml index 46cf21a20b..f24e9aa057 100644 --- a/.agents/notes/implemented/feature/2026-09-13-macos-hidden-titlebar-vibrancy.i18n.yaml +++ b/.agents/notes/implemented/feature/2026-09-13-macos-hidden-titlebar-vibrancy.i18n.yaml @@ -2,5 +2,5 @@ # side as of the last confirmed-consistent state. Both languages carry equal authority; # after editing either side, bring the other along and re-record with: # pnpm run verify-translation-pairing --write .agents/notes/implemented/feature/2026-09-13-macos-hidden-titlebar-vibrancy.md -2026-09-13-macos-hidden-titlebar-vibrancy.md: 1bc531953cedac8633c4baa6da45aa9bcd77a728 -2026-09-13-macos-hidden-titlebar-vibrancy.zh.md: bbc593badbabdccaa037cca836a9554929d614bc +2026-09-13-macos-hidden-titlebar-vibrancy.md: 99ac240698fb229f9a0d66a8000251058b52491e +2026-09-13-macos-hidden-titlebar-vibrancy.zh.md: 26bbb616485e49de2f70a3d142ea84dfd5bd7cb9 diff --git a/.agents/notes/implemented/feature/2026-09-13-macos-hidden-titlebar-vibrancy.md b/.agents/notes/implemented/feature/2026-09-13-macos-hidden-titlebar-vibrancy.md index 1bc531953c..99ac240698 100644 --- a/.agents/notes/implemented/feature/2026-09-13-macos-hidden-titlebar-vibrancy.md +++ b/.agents/notes/implemented/feature/2026-09-13-macos-hidden-titlebar-vibrancy.md @@ -18,7 +18,7 @@ Every macOS web-side adjustment keys off `html[data-platform='darwin']`, which o **Native theme sync.** The vibrancy material follows `nativeTheme.themeSource`, which otherwise tracks the OS appearance and diverges from the app's own theme preference. The ui-theme boot script and ui-layout `ThemePresenter` publish `html[data-ds-theme-source]` (`light`, `dark`, or `system`; a fixed preference, including registered theme ids, publishes its resolved scheme). The app preload observes the attribute and forwards it over `dsh-desktop:native-theme-set`; main validates the value and the sender (the main window's WebContents, including its local static Web document) and assigns `nativeTheme.themeSource`. Publishing the preference rather than the resolved scheme preserves OS-follow while the preference is `system`. -**Sidebar top strip and full hide.** On darwin the sidebar opens with a 52px top strip that clears the traffic lights, carries the collapse toggle, and is a window drag region (`-webkit-app-region: drag`; the toggle opts out). Collapsing the sidebar hides the column entirely — `computeColumns` takes an explicit `collapsedWidth` and the AppFrame passes 0 on darwin desktop — instead of the 56px rail the other platforms keep. The reopen affordances move into the conversation header: a new single, session-scoped slot `conversation.session.header.leading` sits before the breadcrumbs, and ui-sidebar registers `HeaderLeadingControls` (open sidebar + New Session, reusing the shell's inject face and locale) into it. Visibility is pure CSS against the AppFrame-published `data-sidebar-collapsed` attribute; no collapse-state pipe is added. The blank-session header keeps the leading seat mounted on darwin so a hidden sidebar always has a reopen control on screen. +**Sidebar top strip and full hide.** On darwin the sidebar opens with a 52px top strip that clears the traffic lights, carries the collapse toggle, and is a window drag region (`-webkit-app-region: drag`; the toggle opts out). Collapsing the sidebar hides the column entirely — `computeColumns` takes an explicit `collapsedWidth` and the AppFrame passes 0 on darwin desktop — instead of the 56px rail the other platforms keep. The reopen affordances move into the conversation header: a single, root-scoped slot `conversation.header.leading` sits before the breadcrumbs, and ui-sidebar registers `HeaderLeadingControls` (open sidebar + New Session, reusing the shell's inject face and locale) into it. Visibility is pure CSS against the AppFrame-published `data-sidebar-collapsed` attribute; no collapse-state pipe is added. The resident header keeps the leading seat mounted on darwin with or without a selected Session so a hidden sidebar always has a reopen control on screen. **Drag regions.** The conversation title row is a drag region on darwin with every interactive descendant opted out. Electron computes drag regions from window geometry in DOM order, not stacking: an overlay covering the title band must subtract itself or the band underneath keeps taking the pointer. The right sidebar's fullscreen panel therefore sets `-webkit-app-region: no-drag` on its whole box and restores drag on its tab strips' blank runs. @@ -40,10 +40,10 @@ Every macOS web-side adjustment keys off `html[data-platform='darwin']`, which o - The macOS window gains a translucent sidebar and hidden titlebar at zero cost to other platforms: every rule is scoped to `[data-platform='darwin']`, which only the Electron preload sets. - The vibrancy material follows the app theme, including third-party registered themes (their resolved scheme). Screenshots and screen recordings differ from the flat web rendering. -- `conversation.session.header.leading` is a public slot in the client catalog; any package can occupy the seat, and ui-sidebar's occupant assumes it may render into it whenever the platform matches. +- `conversation.header.leading` is a public slot in the client catalog; any package can occupy the seat, and ui-sidebar's occupant assumes it may render into it whenever the platform matches. - Drag-region geometry is a window-global invariant: any future overlay that covers the title band on darwin must subtract itself with `-webkit-app-region: no-drag` or its controls become unclickable. - The transparent window plus vibrancy is accepted to look different in screen sharing and may flash on startup; the transparent `backgroundColor` mitigates the flash. ## Testing -ui-theme boot and ui-layout presenter specs pin the `data-ds-theme-source` publication and disposal. The ui-sidebar apply spec pins the leading-seat registration (component, locale, shared inject face) and its removal on teardown. The ui-conversation skeleton spec pins the leading slot's render call in the active-phase header. The ui-theme corner-shape and full-round style gates cover the new stylesheet. +ui-theme boot and ui-layout presenter specs pin the `data-ds-theme-source` publication and disposal. The ui-sidebar apply spec pins the leading-seat registration (component, locale, shared inject face) and its removal on teardown. The ui-conversation skeleton spec pins the leading slot's render call with and without a selected Session. The ui-theme corner-shape and full-round style gates cover the new stylesheet. diff --git a/.agents/notes/implemented/feature/2026-09-13-macos-hidden-titlebar-vibrancy.zh.md b/.agents/notes/implemented/feature/2026-09-13-macos-hidden-titlebar-vibrancy.zh.md index bbc593badb..26bbb61648 100644 --- a/.agents/notes/implemented/feature/2026-09-13-macos-hidden-titlebar-vibrancy.zh.md +++ b/.agents/notes/implemented/feature/2026-09-13-macos-hidden-titlebar-vibrancy.zh.md @@ -18,7 +18,7 @@ Electron 主进程在 darwin 上以 `titleBarStyle: 'hiddenInset'`、`trafficLig **原生主题同步。** 毛玻璃材质跟随 `nativeTheme.themeSource`,后者默认跟踪系统外观,会与应用自身的主题偏好背离。ui-theme 引导脚本与 ui-layout 的 `ThemePresenter` 发布 `html[data-ds-theme-source]`(`light`、`dark` 或 `system`;固定偏好——包括注册主题 id——发布其解析后的配色)。应用 preload 观察该属性并经 `dsh-desktop:native-theme-set` 转发;主进程校验取值与发送者(主窗口的 WebContents,包括其本地静态 Web 文档)后赋给 `nativeTheme.themeSource`。发布偏好而非解析值,可在偏好为 `system` 时保留跟随系统。 -**侧边栏顶部条与完全隐藏。** darwin 上侧边栏展开时有一条 52px 的顶部条,避开红绿灯、承载收起按钮,并作为窗口拖拽区(`-webkit-app-region: drag`;按钮退出拖拽)。收起侧边栏时整列隐藏——`computeColumns` 接受显式 `collapsedWidth`,AppFrame 在 darwin 桌面传 0——而非其他平台保留的 56px rail。重新打开的入口移入会话头部:新增 single、session 作用域的 slot `conversation.session.header.leading` 位于面包屑之前,ui-sidebar 向其注册 `HeaderLeadingControls`(打开侧边栏 + 新会话,复用 shell 的 inject face 与 locale)。显隐纯由 CSS 依据 AppFrame 发布的 `data-sidebar-collapsed` 属性控制;不新增收起状态管道。darwin 上空白会话的头部保持 leading 座挂载,确保侧边栏隐藏时屏幕上始终有重新打开的控件。 +**侧边栏顶部条与完全隐藏。** darwin 上侧边栏展开时有一条 52px 的顶部条,避开红绿灯、承载收起按钮,并作为窗口拖拽区(`-webkit-app-region: drag`;按钮退出拖拽)。收起侧边栏时整列隐藏——`computeColumns` 接受显式 `collapsedWidth`,AppFrame 在 darwin 桌面传 0——而非其他平台保留的 56px rail。重新打开的入口移入会话头部:single、root 作用域的 slot `conversation.header.leading` 位于面包屑之前,ui-sidebar 向其注册 `HeaderLeadingControls`(打开侧边栏 + 新会话,复用 shell 的 inject face 与 locale)。显隐纯由 CSS 依据 AppFrame 发布的 `data-sidebar-collapsed` 属性控制;不新增收起状态管道。darwin 上常驻头部在选中或未选中 Session 时均保持 leading 座挂载,确保侧边栏隐藏时屏幕上始终有重新打开的控件。 **拖拽区。** darwin 上会话标题行是拖拽区,所有可交互后代退出。Electron 按 DOM 顺序以窗口几何计算拖拽区,不看层叠:覆盖标题带的浮层必须自行减除,否则下层区域仍会截获指针。因此右侧边栏的全屏面板对整个盒子设 `-webkit-app-region: no-drag`,再在其 tab 条空白处恢复拖拽。 @@ -40,10 +40,10 @@ Electron 主进程在 darwin 上以 `titleBarStyle: 'hiddenInset'`、`trafficLig - macOS 窗口获得半透明侧边栏与隐藏标题栏,对其他平台零成本:所有规则限定在 `[data-platform='darwin']` 下,该属性仅由 Electron preload 设置。 - 毛玻璃材质跟随应用主题,含第三方注册主题(取其解析配色)。截图与录屏与纯 Web 的平面渲染不同。 -- `conversation.session.header.leading` 是客户端 catalog 中的公开 slot;任何包都可占用该座位,ui-sidebar 的占用者假定平台匹配时随时可能渲染。 +- `conversation.header.leading` 是客户端 catalog 中的公开 slot;任何包都可占用该座位,ui-sidebar 的占用者假定平台匹配时随时可能渲染。 - 拖拽区几何是窗口级全局不变量:今后任何在 darwin 上覆盖标题带的浮层必须用 `-webkit-app-region: no-drag` 自行减除,否则其控件不可点击。 - 接受透明窗口 + 毛玻璃在屏幕共享中呈现不同、启动可能闪烁;透明 `backgroundColor` 缓解闪烁。 ## Testing -ui-theme 引导与 ui-layout presenter 测试钉住 `data-ds-theme-source` 的发布与清除。ui-sidebar apply 测试钉住 leading 座注册(组件、locale、共享 inject face)及 teardown 移除。ui-conversation skeleton 测试钉住 active 阶段头部对 leading slot 的渲染调用。ui-theme 的 corner-shape 与 full-round 样式门覆盖新样式表。 +ui-theme 引导与 ui-layout presenter 测试钉住 `data-ds-theme-source` 的发布与清除。ui-sidebar apply 测试钉住 leading 座注册(组件、locale、共享 inject face)及 teardown 移除。ui-conversation skeleton 测试钉住 选中或未选中 Session 时对 leading slot 的渲染调用。ui-theme 的 corner-shape 与 full-round 样式门覆盖新样式表。 diff --git a/apps/web/tests/details-session-lifecycle.e2e.ts b/apps/web/tests/details-session-lifecycle.e2e.ts index 0f807e3b91..efc5e653d5 100644 --- a/apps/web/tests/details-session-lifecycle.e2e.ts +++ b/apps/web/tests/details-session-lifecycle.e2e.ts @@ -139,9 +139,29 @@ describe.skipIf(MODE === 'record')('web e2e: details panel follows the current S browser = await chromium.launch() page = await newEnglishPage(browser) tripwire = watchConsole(page) + // The Desktop preload marks the platform before client plugins render. + await page.addInitScript(() => { + document.addEventListener('DOMContentLoaded', () => { + document.documentElement.setAttribute('data-platform', 'darwin') + }, { once: true }) + }) await page.goto(scaffold.authenticatedUrl, { waitUntil: 'load' }) await appFrame(page).waitFor({ timeout: 30_000 }) expect(await page.locator('[data-sidebar-right-expand]').count()).toBe(0) + await page.getByRole('button', { name: 'Collapse sidebar', exact: true }).click() + const leading = page.locator('[data-conversation-header-leading]') + await leading.getByRole('button', { name: 'Open sidebar', exact: true }).waitFor({ state: 'visible' }) + expect(await leading.getByRole('button', { name: 'New session', exact: true }).isVisible()).toBe(true) + expect(await page.getByRole('tablist').count()).toBe(0) + await leading.getByRole('button', { name: 'Open sidebar', exact: true }).click() + await page.getByRole('button', { name: 'Collapse sidebar', exact: true }).waitFor({ state: 'visible' }) + expect(tripwire.pageErrors).toEqual([]) + expect(tripwire.warnings).toEqual([]) + await page.close() + page = await newEnglishPage(browser) + tripwire = watchConsole(page) + await page.goto(scaffold.authenticatedUrl, { waitUntil: 'load' }) + await appFrame(page).waitFor({ timeout: 30_000 }) await connectFreshWorkspace(page, scaffold.workspaceCwd) }, 120_000) diff --git a/docs/subsystems/slots.i18n.yaml b/docs/subsystems/slots.i18n.yaml index 3851d2aeea..1fbdfc10d4 100644 --- a/docs/subsystems/slots.i18n.yaml +++ b/docs/subsystems/slots.i18n.yaml @@ -2,5 +2,5 @@ # side as of the last confirmed-consistent state. Both languages carry equal authority; # after editing either side, bring the other along and re-record with: # pnpm run verify-translation-pairing --write docs/subsystems/slots.md -slots.md: a9f0ee6ab2ef37065ab965a7989f5989350bca8b -slots.zh.md: da6a38eab6aac1c2670b131fa49a832ce41f711e +slots.md: 80894c0d6e5bcd8aae1e5db319849076aae38fde +slots.zh.md: a6e1c85747efacc5ea14ec2dbe8e114efc47ea47 diff --git a/docs/subsystems/slots.md b/docs/subsystems/slots.md index a9f0ee6ab2..80894c0d6e 100644 --- a/docs/subsystems/slots.md +++ b/docs/subsystems/slots.md @@ -144,12 +144,13 @@ root │ │ │ └─ tool.view.cordis │ │ ├─ conversation.message.images │ │ └─ conversation.trajectory.images -│ ├─ conversation.session.header -│ │ ├─ conversation.session.header.lineage -│ │ ├─ conversation.session.header.leading -│ │ ├─ conversation.session.header.actions -│ │ ├─ conversation.session.header.utilities -│ │ └─ conversation.session.header.corner +│ ├─ conversation.header +│ │ ├─ conversation.header.leading (root) +│ │ └─ conversation.session.header +│ │ ├─ conversation.session.header.lineage +│ │ ├─ conversation.session.header.actions +│ │ ├─ conversation.session.header.utilities +│ │ └─ conversation.session.header.corner │ ├─ conversation.composer │ │ ├─ conversation.approval.detail │ │ └─ conversation.plan-review.actions diff --git a/docs/subsystems/slots.zh.md b/docs/subsystems/slots.zh.md index da6a38eab6..a6e1c85747 100644 --- a/docs/subsystems/slots.zh.md +++ b/docs/subsystems/slots.zh.md @@ -144,12 +144,13 @@ root │ │ │ └─ tool.view.cordis │ │ ├─ conversation.message.images │ │ └─ conversation.trajectory.images -│ ├─ conversation.session.header -│ │ ├─ conversation.session.header.lineage -│ │ ├─ conversation.session.header.leading -│ │ ├─ conversation.session.header.actions -│ │ ├─ conversation.session.header.utilities -│ │ └─ conversation.session.header.corner +│ ├─ conversation.header +│ │ ├─ conversation.header.leading (root) +│ │ └─ conversation.session.header +│ │ ├─ conversation.session.header.lineage +│ │ ├─ conversation.session.header.actions +│ │ ├─ conversation.session.header.utilities +│ │ └─ conversation.session.header.corner │ ├─ conversation.composer │ │ ├─ conversation.approval.detail │ │ └─ conversation.plan-review.actions diff --git a/packages/client/ui-conversation/README.i18n.yaml b/packages/client/ui-conversation/README.i18n.yaml index 0bf28301d0..45b33a78b3 100644 --- a/packages/client/ui-conversation/README.i18n.yaml +++ b/packages/client/ui-conversation/README.i18n.yaml @@ -2,5 +2,5 @@ # side as of the last confirmed-consistent state. Both languages carry equal authority; # after editing either side, bring the other along and re-record with: # pnpm run verify-translation-pairing --write packages/client/ui-conversation/README.md -README.md: bc3b582f9d80e97c29e27dcaa680dc064ec30deb -README.zh.md: 21881e7933cdf46cf9e27a66f076fc40c48e4b1a +README.md: e86daa8c41afcac67611cbdc5f772f355ec63c9f +README.zh.md: 2b6ab1c5c5dc9f7217f0899acb162a2f14379768 diff --git a/packages/client/ui-conversation/README.md b/packages/client/ui-conversation/README.md index bc3b582f9d..e86daa8c41 100644 --- a/packages/client/ui-conversation/README.md +++ b/packages/client/ui-conversation/README.md @@ -48,7 +48,7 @@ Claimed commands retain their identity and highlight when only their arguments a Workspace selection uses `uiWorkspace.openWorkspace` to prepare the target and commit navigation. Draft text and attachments move in its synchronous preparation callback only while that request is current; later navigation or owner disposal leaves the original draft intact. -The package occupies the root-scoped `main` key `conversation`. Its `main.conversation` shell keeps the strict Session Header outside the optional-Session `conversation.content` Component Factory. The Factory owns the shared body and Composer, reads the current Session through its standard Hook, and exposes strict-Session `views` plus root-scoped `widthControls` local positions. Its default adapter renders the existing `conversation.session` entry, while the main occurrence selects the width handles; an embedded occurrence can replace `views` and omit those handles without rendering the main Header. `ctx.uiSession.provide()` materializes the Conversation and input sources from the same Session binding and supplies `inputActions` as a stable standard prop. +The package occupies the root-scoped `main` key `conversation`. Its `main.conversation` shell keeps the resident `conversation.header` outside the optional-Session `conversation.content` Component Factory. The header hosts root-scoped navigation without a selected Session; titles, actions, and View tabs remain in its strict Session child. The Factory owns the shared body and Composer, reads the current Session through its standard Hook, and exposes strict-Session `views` plus root-scoped `widthControls` local positions. Its default adapter renders the existing `conversation.session` entry, while the main occurrence selects the width handles; an embedded occurrence can replace `views` and omit those handles without rendering the main Header. `ctx.uiSession.provide()` materializes the Conversation and input sources from the same Session binding and supplies `inputActions` as a stable standard prop. A blank Session retains the header's leading and corner controls, including the right-sidebar opener, while hiding its title, actions, utilities, and View tabs. Selecting a Workspace creates the Session needed by these controls; the first message is not required. Without a selected Session, the strict header is absent. Sidebar entries retain their own data and execution prerequisites. diff --git a/packages/client/ui-conversation/README.zh.md b/packages/client/ui-conversation/README.zh.md index 21881e7933..2b6ab1c5c5 100644 --- a/packages/client/ui-conversation/README.zh.md +++ b/packages/client/ui-conversation/README.zh.md @@ -48,7 +48,7 @@ target package 通过 declaration merge 扩展 snapshot 与 Location data map, 工作区选择使用 `uiWorkspace.openWorkspace` 准备目标并提交导航。草稿文字和附件仅在该请求仍为当前请求时,通过它的同步准备回调搬移;后续导航或所有者释放会保留原草稿。 -本包占据 root 作用域 `main` 中的 `conversation` key。其 `main.conversation` shell 将 strict Session Header 保留在 optional-Session `conversation.content` Component Factory 外。Factory 拥有共享正文与 Composer,通过其标准 Hook 读取当前 Session,并公开 strict-Session `views` 与 root-scoped `widthControls` 两个局部位置。默认 adapter 渲染现有 `conversation.session` entry,主 occurrence 选择宽度拖拽条;嵌入式 occurrence 可以替换 `views`、省略拖拽条,且不渲染主 Header。`ctx.uiSession.provide()` 从同一个 Session binding 物化 Conversation 与 input source,并将 `inputActions` 作为稳定标准 prop 提供。 +本包占据 root 作用域 `main` 中的 `conversation` key。其 `main.conversation` 外壳将常驻的 `conversation.header` 放在可选 Session 的 `conversation.content` Component Factory 外。未选中 Session 时,头部仍承载根作用域导航;标题、操作和 View 标签保留在严格 Session 子组件中。Factory 拥有共享正文与 Composer,通过其标准 Hook 读取当前 Session,并公开 strict-Session `views` 与 root-scoped `widthControls` 两个局部位置。默认 adapter 渲染现有 `conversation.session` entry,主 occurrence 选择宽度拖拽条;嵌入式 occurrence 可以替换 `views`、省略拖拽条,且不渲染主 Header。`ctx.uiSession.provide()` 从同一个 Session binding 物化 Conversation 与 input source,并将 `inputActions` 作为稳定标准 prop 提供。 blank Session 保留 header 的 leading 与 corner 控件,包括右侧栏展开入口,同时隐藏标题、actions、utilities 和 View tabs。选择 Workspace 会创建这些控件所需的 Session,无需先发送消息。没有选中 Session 时,strict header 不挂载。侧栏各入口仍遵循自身的数据与执行环境要求。 diff --git a/packages/client/ui-conversation/src/client/apply.ts b/packages/client/ui-conversation/src/client/apply.ts index 79ffd97359..d7155c9182 100644 --- a/packages/client/ui-conversation/src/client/apply.ts +++ b/packages/client/ui-conversation/src/client/apply.ts @@ -31,6 +31,7 @@ import type { EnterBehaviorRowInjected } from './settings/EnterBehaviorRow.tsx' import { ConversationRoot } from './skeleton/ConversationRoot.tsx' import { ConversationContent } from './skeleton/ConversationContent.tsx' import { ConversationPanel } from './skeleton/ConversationPanel.tsx' +import { ConversationHeader } from './skeleton/ConversationHeader.tsx' import { ConversationSession, ConversationSessionHeader } from './skeleton/ConversationSession.tsx' import { InputBar } from './skeleton/InputBar.tsx' import { todoDockEntry } from './skeleton/TodoPanel.tsx' @@ -238,7 +239,7 @@ export function apply(ctx: Context, config: Config = Config({})): void { const registerConversationRoot = () => slots.register({ name: 'main.conversation', children: { - 'conversation.session.header': { kind: 'single', scope: 'session' }, + 'conversation.header': { kind: 'single', scope: 'session-maybe' }, }, }, ConversationRoot) @@ -303,12 +304,19 @@ export function apply(ctx: Context, config: Config = Config({})): void { }), }, ConversationSession) + const registerHeader = () => slots.register({ + name: 'conversation.header', + children: { + 'conversation.header.leading': { kind: 'single', scope: 'root' }, + 'conversation.session.header': { kind: 'single', scope: 'session' }, + }, + }, ConversationHeader) + const registerConversationHeader = () => slots.register({ name: 'conversation.session.header', locale: NS, children: { 'conversation.session.header.lineage': { kind: 'single', scope: 'session' }, - 'conversation.session.header.leading': { kind: 'single', scope: 'session' }, 'conversation.session.header.actions': { kind: 'list', scope: 'session' }, 'conversation.session.header.utilities': { kind: 'list', scope: 'session' }, 'conversation.session.header.corner': { kind: 'single', scope: 'session' }, @@ -419,6 +427,7 @@ export function apply(ctx: Context, config: Config = Config({})): void { yield registerConversationRoot() yield registerConversationContent() yield registerConversationSession() + yield registerHeader() yield registerConversationHeader() yield registerComposerBar() }) diff --git a/packages/client/ui-conversation/src/client/contract/slots.ts b/packages/client/ui-conversation/src/client/contract/slots.ts index d37387ec4d..da99c80f6c 100644 --- a/packages/client/ui-conversation/src/client/contract/slots.ts +++ b/packages/client/ui-conversation/src/client/contract/slots.ts @@ -131,6 +131,8 @@ declare module '@deepseek-ai/dsh-client-ui-slots' { scope: 'session' owner: { view?: string } } + /** Resident navigation container, including when no Session is selected. */ + 'conversation.header': { kind: 'single'; scope: 'session-maybe' } /** Strict per-Session title, actions, and View navigation. */ 'conversation.session.header': { kind: 'single'; scope: 'session' } /** Optional replacement for one Session breadcrumb title. */ @@ -151,16 +153,10 @@ declare module '@deepseek-ai/dsh-client-ui-slots' { scope: 'session' owner: ConversationHeaderActionOwnerProps } - /** - * Leading seat before the Session breadcrumbs, for window-chrome-adjacent - * controls (macOS desktop sidebar reopen and New Session while the sidebar - * is hidden). The seat is laid out only while its occupant renders - * something, and it stays mounted through the blank-session state so a - * hidden sidebar always keeps a reopen control on screen. - */ - 'conversation.session.header.leading': { + /** Global navigation before the Session title, available without a Session. */ + 'conversation.header.leading': { kind: 'single' - scope: 'session' + scope: 'root' owner: ConversationHeaderLeadingOwnerProps } /** @@ -275,7 +271,7 @@ export interface ConversationHeaderCornerOwnerProps { children?: never } -/** The leading seat's occupant derives its state from standard Session props. */ +/** The leading seat exposes global navigation independently of a Session. */ export interface ConversationHeaderLeadingOwnerProps { /** Marker field: the occupant receives no owner-specific values. */ children?: never @@ -419,7 +415,7 @@ export interface HeroBrandMarkOwnerProps { /** Full props of the resident optional-Session Conversation shell. */ export type ConversationSlotProps = PropsRuntime<'main.conversation'> - & PropsRenderSlots<'conversation.session.header'> + & PropsRenderSlots<'conversation.header'> & PropsRenderFactories /** Inputs shared by main and embedded Conversation content occurrences. */ @@ -457,12 +453,16 @@ export type ConversationSessionSlotProps = & PropsStore & InjectFace +/** Full props of the resident navigation header. */ +export type ConversationHeaderProps = + PropsRuntime<'conversation.header'> + & PropsRenderSlots<'conversation.header.leading' | 'conversation.session.header'> + /** Full props of the strict Session header. */ export type ConversationSessionHeaderSlotProps = PropsRuntime<'conversation.session.header'> & PropsRenderSlots< 'conversation.session.header.lineage' - | 'conversation.session.header.leading' | 'conversation.session.header.actions' | 'conversation.session.header.utilities' | 'conversation.session.header.corner' diff --git a/packages/client/ui-conversation/src/client/skeleton/ConversationHeader.tsx b/packages/client/ui-conversation/src/client/skeleton/ConversationHeader.tsx new file mode 100644 index 0000000000..ada2491e66 --- /dev/null +++ b/packages/client/ui-conversation/src/client/skeleton/ConversationHeader.tsx @@ -0,0 +1,27 @@ +/** Resident conversation navigation and Session-specific header content. */ +import clsx from 'clsx' +import type { ConversationHeaderProps } from '../contract/slots.ts' +import { conversationPhase } from '../contract/snapshot.ts' +import css from './ConversationRoot.module.css' + +/** + * Keeps global navigation available before a Session exists. + * @param props - Optional Session sources and authorized header slots. + * @returns The persistent header with any selected Session's title and views. + */ +export function ConversationHeader({ sessionId, useSession, useConversation, renderSlot }: ConversationHeaderProps) { + const session = useSession(s => s) + const conversation = useConversation(s => s) + const blank = session === undefined || conversation === undefined + || (session.blank && conversationPhase(session, conversation) === 'blank') + return ( +
    +
    + {renderSlot('conversation.header.leading', {})} +
    + {sessionId === undefined + ?
    + : renderSlot('conversation.session.header', {})} +
    + ) +} diff --git a/packages/client/ui-conversation/src/client/skeleton/ConversationMainPanel.tsx b/packages/client/ui-conversation/src/client/skeleton/ConversationMainPanel.tsx index a46d1b28c1..d156480507 100644 --- a/packages/client/ui-conversation/src/client/skeleton/ConversationMainPanel.tsx +++ b/packages/client/ui-conversation/src/client/skeleton/ConversationMainPanel.tsx @@ -42,7 +42,7 @@ export function ConversationMainPanel(props: ConversationSlotProps) { return (
    - {sessionId === undefined ? null : renderSlot('conversation.session.header', {})} + {renderSlot('conversation.header', {})} {renderFactorySlot('conversation.content', { variant: 'main', phase, diff --git a/packages/client/ui-conversation/src/client/skeleton/ConversationRoot.module.css b/packages/client/ui-conversation/src/client/skeleton/ConversationRoot.module.css index 62a1991e57..74765d8920 100644 --- a/packages/client/ui-conversation/src/client/skeleton/ConversationRoot.module.css +++ b/packages/client/ui-conversation/src/client/skeleton/ConversationRoot.module.css @@ -13,6 +13,8 @@ title row, the tab strip's 10px margin, a 16px tab line, and its 9px bottom inset — so no row below may grow past its figure. */ .header { + display: grid; + grid-template-columns: auto minmax(0, 1fr); flex: none; box-sizing: border-box; min-height: 76px; @@ -46,6 +48,7 @@ } .titleRow { + grid-column: 2; display: flex; align-items: center; gap: 0; @@ -65,6 +68,8 @@ occupant keeps the seat non-empty, so a seat-owned margin would push the breadcrumbs while nothing shows). */ .headerLeading { + grid-column: 1; + grid-row: 1; display: flex; flex: none; align-items: center; @@ -166,6 +171,7 @@ /* figma Tab_Group 34:11441: 35px strip, gap 36, pad-left 8, tabs bottom-aligned. Positioned above the header's own paint, so the active bar covers the rule. */ .tabs { + grid-column: 1 / -1; position: relative; z-index: 1; display: flex; diff --git a/packages/client/ui-conversation/src/client/skeleton/ConversationSession.tsx b/packages/client/ui-conversation/src/client/skeleton/ConversationSession.tsx index 8f025cf548..b7b8726210 100644 --- a/packages/client/ui-conversation/src/client/skeleton/ConversationSession.tsx +++ b/packages/client/ui-conversation/src/client/skeleton/ConversationSession.tsx @@ -68,11 +68,8 @@ export function ConversationSessionHeader({ const conversation = useConversation(s => s) const hideChrome = session.blank && conversationPhase(session, conversation) === 'blank' return ( -
    + <>
    -
    - {renderSlot('conversation.session.header.leading', {})} -
    {!hideChrome && ( <>
    @@ -154,7 +151,7 @@ export function ConversationSessionHeader({ ))}
    )} -
    + ) } diff --git a/packages/client/ui-conversation/tests/apply-wiring.client.spec.tsx b/packages/client/ui-conversation/tests/apply-wiring.client.spec.tsx index 4915c8b417..722ff81568 100644 --- a/packages/client/ui-conversation/tests/apply-wiring.client.spec.tsx +++ b/packages/client/ui-conversation/tests/apply-wiring.client.spec.tsx @@ -61,6 +61,8 @@ describe('target-neutral Conversation apply wiring', () => { .toMatchObject({ views: { scope: 'session' } }) expect(b.runtime.slots.entries('conversation.session')).toHaveLength(1) expect(b.runtime.slots.entries('conversation.session.header')).toHaveLength(1) + expect(b.runtime.slots.spec('conversation.header')).toEqual({ kind: 'single', scope: 'session-maybe' }) + expect(b.runtime.slots.spec('conversation.header.leading')).toEqual({ kind: 'single', scope: 'root' }) expect(b.runtime.slots.entries('conversation.composer.bar')).toHaveLength(1) await b.runtime.dispose() }) diff --git a/packages/client/ui-conversation/tests/skeleton.client.spec.tsx b/packages/client/ui-conversation/tests/skeleton.client.spec.tsx index e95808c1bc..7873546d15 100644 --- a/packages/client/ui-conversation/tests/skeleton.client.spec.tsx +++ b/packages/client/ui-conversation/tests/skeleton.client.spec.tsx @@ -21,6 +21,7 @@ import { createConversationStore } from '../src/client/stores.ts' import { SessionInputShell } from '../src/client/input/facade.ts' import { en, zh } from '../src/client/locales.ts' import { ConversationContent } from '../src/client/skeleton/ConversationContent.tsx' +import { ConversationHeader } from '../src/client/skeleton/ConversationHeader.tsx' import { ConversationMainPanel } from '../src/client/skeleton/ConversationMainPanel.tsx' import { ConversationSession, ConversationSessionHeader } from '../src/client/skeleton/ConversationSession.tsx' import { conversationPhase } from '../src/client/contract/snapshot.ts' @@ -197,6 +198,9 @@ function mount( lineageOwners.push(owner as ConversationHeaderLineageOwnerProps) return opts?.fallback ?? null } + if (key === 'conversation.header') { + return + } if (key === 'conversation.session.header') { return ( ) return { - view, store, wiring, sink, retargetWorkspace, session, conversation, slotCalls, lineageOwners, seatOwners, open, + view, props, store, wiring, sink, retargetWorkspace, session, conversation, slotCalls, lineageOwners, seatOwners, open, pickerOwner: () => pickerOwner, rerender: () => { view.rerender() }, } @@ -388,6 +392,21 @@ describe('Hero chrome', () => { }) describe('ConversationRoot resident composer', () => { + it('keeps global header navigation without selecting a Session', () => { + const b = mount(sessionSnapshotOf()) + b.slotCalls.length = 0 + b.props.sessionId = undefined + b.props.useSession = () => undefined + b.props.useConversation = () => undefined + b.view.unmount() + const view = render() + expect(view.container.querySelector('header')).not.toBeNull() + expect(view.getByTestId('view-conversation.header.leading')).toBeTruthy() + expect(b.slotCalls).not.toContain('conversation.session.header') + expect(view.queryByRole('tablist')).toBeNull() + expect(view.queryByTestId('view-conversation.session.header.corner')).toBeNull() + }) + it('does not redispatch composer child slots for an unrelated Session publication', () => { const b = mount(sessionSnapshotOf()) const childKeys = new Set([ @@ -493,7 +512,7 @@ describe('ConversationRoot resident composer', () => { expect(host?.contains(seat)).toBe(true) expect(seat?.contains(textarea)).toBe(true) expect(b.slotCalls).toContain('conversation.session.header.lineage') - expect(b.slotCalls).toContain('conversation.session.header.leading') + expect(b.slotCalls).toContain('conversation.header.leading') expect(b.slotCalls).toContain('conversation.session.header.actions') expect(b.slotCalls).toContain('conversation.session.header.utilities') expect(b.slotCalls).toContain('conversation.session.header.corner') diff --git a/packages/client/ui-sidebar/README.i18n.yaml b/packages/client/ui-sidebar/README.i18n.yaml index b9e04d95cb..74a544bbbe 100644 --- a/packages/client/ui-sidebar/README.i18n.yaml +++ b/packages/client/ui-sidebar/README.i18n.yaml @@ -2,5 +2,5 @@ # side as of the last confirmed-consistent state. Both languages carry equal authority; # after editing either side, bring the other along and re-record with: # pnpm run verify-translation-pairing --write packages/client/ui-sidebar/README.md -README.md: a0b9ffe8ca601fade50ff86fc1921d6b41b84748 -README.zh.md: 44b08c8ef76ec266c813c8199db8291f47db3d53 +README.md: 513e9d3151aba64b640475c3cd8c2f993df077db +README.zh.md: 69050dc8c530bf4c794d42113f2679fe41891e5f diff --git a/packages/client/ui-sidebar/README.md b/packages/client/ui-sidebar/README.md index a0b9ffe8ca..513e9d3151 100644 --- a/packages/client/ui-sidebar/README.md +++ b/packages/client/ui-sidebar/README.md @@ -45,7 +45,7 @@ On Windows Electron, `html[data-windows-titlebar]` fixes the sidebar toggle in t ### macOS desktop -Under `html[data-platform='darwin']` (set only by the desktop preload) the expanded column opens with a 52px top strip that clears the hiddenInset traffic lights, carries the collapse toggle, and acts as the window drag region; collapsing hides the column entirely instead of leaving the rail. The package registers `HeaderLeadingControls` into the conversation header's `conversation.session.header.leading` seat — the open-sidebar and New Session controls shown, purely via CSS against the AppFrame-published `data-sidebar-collapsed` attribute, only while the column is hidden. Rationale and the window-integration contract: the [macOS hidden-titlebar Agent Note](../../../.agents/notes/implemented/feature/2026-09-13-macos-hidden-titlebar-vibrancy.md). +Under `html[data-platform='darwin']` (set only by the desktop preload) the expanded column opens with a 52px top strip that clears the hiddenInset traffic lights, carries the collapse toggle, and acts as the window drag region; collapsing hides the column entirely instead of leaving the rail. The resident header remains mounted without a selected Session. The package registers `HeaderLeadingControls` into the conversation header's root-scoped `conversation.header.leading` seat — the open-sidebar and New Session controls shown, purely via CSS against the AppFrame-published `data-sidebar-collapsed` attribute, only while the column is hidden. Rationale and the window-integration contract: the [macOS hidden-titlebar Agent Note](../../../.agents/notes/implemented/feature/2026-09-13-macos-hidden-titlebar-vibrancy.md). ### Scrollbars diff --git a/packages/client/ui-sidebar/README.zh.md b/packages/client/ui-sidebar/README.zh.md index 44b08c8ef7..69050dc8c5 100644 --- a/packages/client/ui-sidebar/README.zh.md +++ b/packages/client/ui-sidebar/README.zh.md @@ -45,7 +45,7 @@ dsh Web 客户端的侧边栏让用户识别当前构建、启动新会话、将 ### macOS 桌面 -在 `html[data-platform='darwin']`(仅由桌面 preload 设置)下,展开的侧边栏列顶部有一条 52px 的顶部条:避开 hiddenInset 红绿灯、承载收起按钮,并作为窗口拖拽区;收起时整列隐藏而非保留轨道。本包向会话头部的 `conversation.session.header.leading` 座注册 `HeaderLeadingControls`——打开侧边栏与 New Session 两个控件,纯由 CSS 依据 AppFrame 发布的 `data-sidebar-collapsed` 属性仅在列隐藏时显示。设计依据与窗口集成约定见 [macOS 隐藏标题栏 Agent Note](../../../.agents/notes/implemented/feature/2026-09-13-macos-hidden-titlebar-vibrancy.zh.md)。 +在 `html[data-platform='darwin']`(仅由桌面 preload 设置)下,展开的侧边栏列顶部有一条 52px 的顶部条:避开 hiddenInset 红绿灯、承载收起按钮,并作为窗口拖拽区;收起时整列隐藏而非保留轨道。未选中会话时,常驻头部仍保持挂载。本包向会话头部的根作用域 `conversation.header.leading` 座注册 `HeaderLeadingControls`——打开侧边栏与 New Session 两个控件,纯由 CSS 依据 AppFrame 发布的 `data-sidebar-collapsed` 属性仅在列隐藏时显示。设计依据与窗口集成约定见 [macOS 隐藏标题栏 Agent Note](../../../.agents/notes/implemented/feature/2026-09-13-macos-hidden-titlebar-vibrancy.zh.md)。 ### 滚动条 diff --git a/packages/client/ui-sidebar/src/client/HeaderLeadingControls.tsx b/packages/client/ui-sidebar/src/client/HeaderLeadingControls.tsx index 77a98caa63..f5e6469493 100644 --- a/packages/client/ui-sidebar/src/client/HeaderLeadingControls.tsx +++ b/packages/client/ui-sidebar/src/client/HeaderLeadingControls.tsx @@ -1,4 +1,4 @@ -/** macOS-desktop conversation-header controls for the fully hidden sidebar. */ +/** macOS-desktop resident-header controls for the fully hidden sidebar. */ import { IconNewChatOutline16, IconPanelLeftOutline16, isDarwinDesktop, Tooltip, } from '@deepseek-ai/dsh-client-ui-primitives' @@ -8,14 +8,14 @@ import type {} from '@deepseek-ai/dsh-client-ui-conversation/client' import type { SidebarRootInjected } from './contract/slots.ts' import css from './HeaderLeadingControls.module.css' -/** Full props of the conversation-header leading occupant. */ +/** Full props of the resident-header leading occupant. */ export type HeaderLeadingControlsProps = - PropsRuntime<'conversation.session.header.leading'> + PropsRuntime<'conversation.header.leading'> & InjectFace & PropsLocale<'sidebar'> /** - * Sidebar-open and New Session controls in the conversation header's leading + * Sidebar-open and New Session controls in the resident header's leading * seat. On macOS desktop a collapsed sidebar hides entirely (no rail), taking * both controls off screen; this occupant puts them back beside the traffic * lights. Mounted whenever the platform matches; visibility rides the diff --git a/packages/client/ui-sidebar/src/client/index.ts b/packages/client/ui-sidebar/src/client/index.ts index 573ed2cb61..f1e3a38ce1 100644 --- a/packages/client/ui-sidebar/src/client/index.ts +++ b/packages/client/ui-sidebar/src/client/index.ts @@ -89,8 +89,8 @@ export function apply(ctx: ClientContext): void { // Session controls move into the conversation header's leading seat; the // occupant reuses the shell's injected actions and shows itself purely // through CSS against the AppFrame's data-sidebar-collapsed attribute. - ctx.slots.inject('conversation.session.header.leading', () => ctx.slots.register({ - name: 'conversation.session.header.leading', + ctx.slots.inject('conversation.header.leading', () => ctx.slots.register({ + name: 'conversation.header.leading', locale: NS, inject: injectProps, }, HeaderLeadingControls)) diff --git a/packages/client/ui-sidebar/tests/apply.client.spec.tsx b/packages/client/ui-sidebar/tests/apply.client.spec.tsx index 16e1f37112..fbe1bfd57a 100644 --- a/packages/client/ui-sidebar/tests/apply.client.spec.tsx +++ b/packages/client/ui-sidebar/tests/apply.client.spec.tsx @@ -42,7 +42,7 @@ async function bench(declare = true) { { name: 'root', children: { 'sidebar': { kind: 'single', scope: 'root' }, 'main': { kind: 'keyed', scope: 'root' }, - 'conversation.session.header.leading': { kind: 'single', scope: 'session' }, + 'conversation.header.leading': { kind: 'single', scope: 'root' }, } }, SidebarFrame, ) @@ -72,7 +72,7 @@ describe('ui-sidebar apply', () => { // Copy rides the standard locale seat, not the inject face. expect(b.slots.entries('sidebar')[0]!.locale).toBe('sidebar') // The header leading occupant reuses the shell's inject face and locale. - const leading = b.slots.entries('conversation.session.header.leading') + const leading = b.slots.entries('conversation.header.leading') expect(leading).toHaveLength(1) expect(leading[0]!.component).toBe(HeaderLeadingControls) expect(leading[0]!.locale).toBe('sidebar') @@ -145,7 +145,7 @@ describe('ui-sidebar apply', () => { await fiber.await() await fiber.dispose() expect(b.slots.entries('sidebar')).toHaveLength(0) - expect(b.slots.entries('conversation.session.header.leading')).toHaveLength(0) + expect(b.slots.entries('conversation.header.leading')).toHaveLength(0) expect(b.slots.spec('sidebar.brand.mark')).toBeUndefined() expect(b.slots.spec('sidebar.brand.name')).toBeUndefined() expect(b.slots.spec('sidebar.workspaces')).toBeUndefined() diff --git a/packages/extensions/cordis-client-runner/src/client/slot-catalog.ts b/packages/extensions/cordis-client-runner/src/client/slot-catalog.ts index 0caa5b38bf..80f900fab8 100644 --- a/packages/extensions/cordis-client-runner/src/client/slot-catalog.ts +++ b/packages/extensions/cordis-client-runner/src/client/slot-catalog.ts @@ -406,7 +406,7 @@ export const CLIENT_SLOT_API: readonly ClientSlotEntry[] = [ ], replaceRisk: 'none', example: 'return {\n inject: [\'slots\'],\n apply(ctx) {\n ctx.slots.inject(\'conversation.composer\', () => ctx.slots.register(\n { name: \'conversation.composer\', select: owner => null },\n () => React.createElement(\'div\', null, \'hello\'),\n ))\n },\n}', - source: 'packages/client/ui-conversation/src/client/contract/slots.ts:180', + source: 'packages/client/ui-conversation/src/client/contract/slots.ts:176', }, { key: 'conversation.composer.bar', @@ -445,7 +445,7 @@ export const CLIENT_SLOT_API: readonly ClientSlotEntry[] = [ ], replaceRisk: 'shadows-shipped-ui', example: 'return {\n inject: [\'slots\'],\n apply(ctx) {\n ctx.slots.inject(\'conversation.composer.bar\', () => ctx.slots.register(\n { name: \'conversation.composer.bar\' },\n () => React.createElement(\'div\', null, \'hello\'),\n ))\n },\n}', - source: 'packages/client/ui-conversation/src/client/contract/slots.ts:198', + source: 'packages/client/ui-conversation/src/client/contract/slots.ts:194', }, { key: 'conversation.composer.dock', @@ -501,7 +501,73 @@ export const CLIENT_SLOT_API: readonly ClientSlotEntry[] = [ ], replaceRisk: 'none', example: 'return {\n inject: [\'slots\'],\n apply(ctx) {\n ctx.slots.inject(\'conversation.composer.dock\', () => ctx.slots.register(\n { name: \'conversation.composer.dock\', id: \'my-entry\', order: 100, label: \'My entry\' },\n () => React.createElement(\'div\', null, \'hello\'),\n ))\n },\n}', - source: 'packages/client/ui-conversation/src/client/contract/slots.ts:192', + source: 'packages/client/ui-conversation/src/client/contract/slots.ts:188', + }, + { + key: 'conversation.header', + kind: 'single', + scope: 'session-maybe', + summary: 'Resident navigation container, including when no Session is selected.', + doc: 'Resident navigation container, including when no Session is selected.', + registerOptions: [], + ownerProps: [], + ownerPropsReferences: [], + standardProps: [ + 'useResource: UseResource', + 'useWorkspaces: SnapshotSelectorHook', + 'usePanelInfo: UsePanelInfo', + 'useSessions: UseSessions', + 'useSessionStatus: UseSessionStatus', + 'useSessionRetainInfo: UseSessionRetainInfo', + 'useWorkspaces: SnapshotSelectorHook', + 'useConversation: MaybeSnapshotSelectorHook', + 'useInput: MaybeSnapshotSelectorHook', + 'inputActions: InputActions | undefined', + 'useSession: MaybeSnapshotSelectorHook', + 'sessionId: SessionId | undefined', + 'useProjection: UseProjection', + ], + keyDomain: '', + hookContext: '', + slotInject: '', + declaredBy: 'an entry in \'main.conversation\' (client-ui-conversation), so it exists while that entry is mounted', + occupants: [ + 'client-ui-conversation ConversationHeader', + ], + replaceRisk: 'shadows-shipped-ui', + example: 'return {\n inject: [\'slots\'],\n apply(ctx) {\n ctx.slots.inject(\'conversation.header\', () => ctx.slots.register(\n { name: \'conversation.header\' },\n () => React.createElement(\'div\', null, \'hello\'),\n ))\n },\n}', + source: 'packages/client/ui-conversation/src/client/contract/slots.ts:135', + }, + { + key: 'conversation.header.leading', + kind: 'single', + scope: 'root', + summary: 'Global navigation before the Session title, available without a Session.', + doc: 'Global navigation before the Session title, available without a Session.', + registerOptions: [], + ownerProps: [ + '/** The leading seat exposes global navigation independently of a Session. */\nexport interface ConversationHeaderLeadingOwnerProps {\n /** Marker field: the occupant receives no owner-specific values. */\n children?: never\n}', + ], + ownerPropsReferences: [], + standardProps: [ + 'useResource: UseResource', + 'useWorkspaces: SnapshotSelectorHook', + 'usePanelInfo: UsePanelInfo', + 'useSessions: UseSessions', + 'useSessionStatus: UseSessionStatus', + 'useSessionRetainInfo: UseSessionRetainInfo', + 'useWorkspaces: SnapshotSelectorHook', + ], + keyDomain: '', + hookContext: '', + slotInject: '', + declaredBy: 'an entry in \'conversation.header\' (client-ui-conversation), so it exists while that entry is mounted', + occupants: [ + 'client-ui-sidebar HeaderLeadingControls', + ], + replaceRisk: 'shadows-shipped-ui', + example: 'return {\n inject: [\'slots\'],\n apply(ctx) {\n ctx.slots.inject(\'conversation.header.leading\', () => ctx.slots.register(\n { name: \'conversation.header.leading\' },\n () => React.createElement(\'div\', null, \'hello\'),\n ))\n },\n}', + source: 'packages/client/ui-conversation/src/client/contract/slots.ts:157', }, { key: 'conversation.hero.agentPreset', @@ -538,7 +604,7 @@ export const CLIENT_SLOT_API: readonly ClientSlotEntry[] = [ ], replaceRisk: 'shadows-shipped-ui', example: 'return {\n inject: [\'slots\'],\n apply(ctx) {\n ctx.slots.inject(\'conversation.hero.agentPreset\', () => ctx.slots.register(\n { name: \'conversation.hero.agentPreset\' },\n () => React.createElement(\'div\', null, \'hello\'),\n ))\n },\n}', - source: 'packages/client/ui-conversation/src/client/contract/slots.ts:186', + source: 'packages/client/ui-conversation/src/client/contract/slots.ts:182', }, { key: 'conversation.hero.brand.mark', @@ -567,7 +633,7 @@ export const CLIENT_SLOT_API: readonly ClientSlotEntry[] = [ occupants: [], replaceRisk: 'none', example: 'return {\n inject: [\'slots\'],\n apply(ctx) {\n ctx.slots.inject(\'conversation.hero.brand.mark\', () => ctx.slots.register(\n { name: \'conversation.hero.brand.mark\' },\n () => React.createElement(\'div\', null, \'hello\'),\n ))\n },\n}', - source: 'packages/client/ui-conversation/src/client/contract/slots.ts:184', + source: 'packages/client/ui-conversation/src/client/contract/slots.ts:180', }, { key: 'conversation.hero.workspace', @@ -600,7 +666,7 @@ export const CLIENT_SLOT_API: readonly ClientSlotEntry[] = [ ], replaceRisk: 'shadows-shipped-ui', example: 'return {\n inject: [\'slots\'],\n apply(ctx) {\n ctx.slots.inject(\'conversation.hero.workspace\', () => ctx.slots.register(\n { name: \'conversation.hero.workspace\' },\n () => React.createElement(\'div\', null, \'hello\'),\n ))\n },\n}', - source: 'packages/client/ui-conversation/src/client/contract/slots.ts:182', + source: 'packages/client/ui-conversation/src/client/contract/slots.ts:178', }, { key: 'conversation.hero.workspace.directoryFlow', @@ -673,7 +739,7 @@ export const CLIENT_SLOT_API: readonly ClientSlotEntry[] = [ ], replaceRisk: 'shadows-shipped-ui', example: 'return {\n inject: [\'slots\'],\n apply(ctx) {\n ctx.slots.inject(\'conversation.input.attachments\', () => ctx.slots.register(\n { name: \'conversation.input.attachments\' },\n () => React.createElement(\'div\', null, \'hello\'),\n ))\n },\n}', - source: 'packages/client/ui-conversation/src/client/contract/slots.ts:200', + source: 'packages/client/ui-conversation/src/client/contract/slots.ts:196', }, { key: 'conversation.input.dock', @@ -736,7 +802,7 @@ export const CLIENT_SLOT_API: readonly ClientSlotEntry[] = [ ], replaceRisk: 'none', example: 'return {\n inject: [\'slots\'],\n apply(ctx) {\n ctx.slots.inject(\'conversation.input.dock\', () => ctx.slots.register(\n { name: \'conversation.input.dock\', id: \'my-entry\', order: 100, label: \'My entry\' },\n () => React.createElement(\'div\', null, \'hello\'),\n ))\n },\n}', - source: 'packages/client/ui-conversation/src/client/contract/slots.ts:188', + source: 'packages/client/ui-conversation/src/client/contract/slots.ts:184', }, { key: 'conversation.input.left', @@ -790,7 +856,7 @@ export const CLIENT_SLOT_API: readonly ClientSlotEntry[] = [ occupants: [], replaceRisk: 'none', example: 'return {\n inject: [\'slots\'],\n apply(ctx) {\n ctx.slots.inject(\'conversation.input.left\', () => ctx.slots.register(\n { name: \'conversation.input.left\', id: \'my-entry\', order: 100, label: \'My entry\' },\n () => React.createElement(\'div\', null, \'hello\'),\n ))\n },\n}', - source: 'packages/client/ui-conversation/src/client/contract/slots.ts:194', + source: 'packages/client/ui-conversation/src/client/contract/slots.ts:190', }, { key: 'conversation.input.model', @@ -829,7 +895,7 @@ export const CLIENT_SLOT_API: readonly ClientSlotEntry[] = [ ], replaceRisk: 'shadows-shipped-ui', example: 'return {\n inject: [\'slots\'],\n apply(ctx) {\n ctx.slots.inject(\'conversation.input.model\', () => ctx.slots.register(\n { name: \'conversation.input.model\' },\n () => React.createElement(\'div\', null, \'hello\'),\n ))\n },\n}', - source: 'packages/client/ui-conversation/src/client/contract/slots.ts:210', + source: 'packages/client/ui-conversation/src/client/contract/slots.ts:206', }, { key: 'conversation.input.overlay', @@ -887,7 +953,7 @@ export const CLIENT_SLOT_API: readonly ClientSlotEntry[] = [ ], replaceRisk: 'none', example: 'return {\n inject: [\'slots\'],\n apply(ctx) {\n ctx.slots.inject(\'conversation.input.overlay\', () => ctx.slots.register(\n { name: \'conversation.input.overlay\', id: \'my-entry\', order: 100, label: \'My entry\' },\n () => React.createElement(\'div\', null, \'hello\'),\n ))\n },\n}', - source: 'packages/client/ui-conversation/src/client/contract/slots.ts:190', + source: 'packages/client/ui-conversation/src/client/contract/slots.ts:186', }, { key: 'conversation.input.permission', @@ -926,7 +992,7 @@ export const CLIENT_SLOT_API: readonly ClientSlotEntry[] = [ ], replaceRisk: 'shadows-shipped-ui', example: 'return {\n inject: [\'slots\'],\n apply(ctx) {\n ctx.slots.inject(\'conversation.input.permission\', () => ctx.slots.register(\n { name: \'conversation.input.permission\' },\n () => React.createElement(\'div\', null, \'hello\'),\n ))\n },\n}', - source: 'packages/client/ui-conversation/src/client/contract/slots.ts:208', + source: 'packages/client/ui-conversation/src/client/contract/slots.ts:204', }, { key: 'conversation.input.plan', @@ -965,7 +1031,7 @@ export const CLIENT_SLOT_API: readonly ClientSlotEntry[] = [ ], replaceRisk: 'shadows-shipped-ui', example: 'return {\n inject: [\'slots\'],\n apply(ctx) {\n ctx.slots.inject(\'conversation.input.plan\', () => ctx.slots.register(\n { name: \'conversation.input.plan\' },\n () => React.createElement(\'div\', null, \'hello\'),\n ))\n },\n}', - source: 'packages/client/ui-conversation/src/client/contract/slots.ts:206', + source: 'packages/client/ui-conversation/src/client/contract/slots.ts:202', }, { key: 'conversation.input.right', @@ -1019,7 +1085,7 @@ export const CLIENT_SLOT_API: readonly ClientSlotEntry[] = [ occupants: [], replaceRisk: 'none', example: 'return {\n inject: [\'slots\'],\n apply(ctx) {\n ctx.slots.inject(\'conversation.input.right\', () => ctx.slots.register(\n { name: \'conversation.input.right\', id: \'my-entry\', order: 100, label: \'My entry\' },\n () => React.createElement(\'div\', null, \'hello\'),\n ))\n },\n}', - source: 'packages/client/ui-conversation/src/client/contract/slots.ts:196', + source: 'packages/client/ui-conversation/src/client/contract/slots.ts:192', }, { key: 'conversation.message.images', @@ -1188,13 +1254,13 @@ export const CLIENT_SLOT_API: readonly ClientSlotEntry[] = [ keyDomain: '', hookContext: '', slotInject: '', - declaredBy: 'an entry in \'main.conversation\' (client-ui-conversation), so it exists while that entry is mounted', + declaredBy: 'an entry in \'conversation.header\' (client-ui-conversation), so it exists while that entry is mounted', occupants: [ 'client-ui-conversation ConversationSessionHeader', ], replaceRisk: 'shadows-shipped-ui', example: 'return {\n inject: [\'slots\'],\n apply(ctx) {\n ctx.slots.inject(\'conversation.session.header\', () => ctx.slots.register(\n { name: \'conversation.session.header\' },\n () => React.createElement(\'div\', null, \'hello\'),\n ))\n },\n}', - source: 'packages/client/ui-conversation/src/client/contract/slots.ts:135', + source: 'packages/client/ui-conversation/src/client/contract/slots.ts:137', }, { key: 'conversation.session.header.actions', @@ -1256,7 +1322,7 @@ export const CLIENT_SLOT_API: readonly ClientSlotEntry[] = [ ], replaceRisk: 'none', example: 'return {\n inject: [\'slots\'],\n apply(ctx) {\n ctx.slots.inject(\'conversation.session.header.actions\', () => ctx.slots.register(\n { name: \'conversation.session.header.actions\', id: \'my-entry\', order: 100, label: \'My entry\' },\n () => React.createElement(\'div\', null, \'hello\'),\n ))\n },\n}', - source: 'packages/client/ui-conversation/src/client/contract/slots.ts:143', + source: 'packages/client/ui-conversation/src/client/contract/slots.ts:145', }, { key: 'conversation.session.header.corner', @@ -1295,46 +1361,7 @@ export const CLIENT_SLOT_API: readonly ClientSlotEntry[] = [ ], replaceRisk: 'shadows-shipped-ui', example: 'return {\n inject: [\'slots\'],\n apply(ctx) {\n ctx.slots.inject(\'conversation.session.header.corner\', () => ctx.slots.register(\n { name: \'conversation.session.header.corner\' },\n () => React.createElement(\'div\', null, \'hello\'),\n ))\n },\n}', - source: 'packages/client/ui-conversation/src/client/contract/slots.ts:172', - }, - { - key: 'conversation.session.header.leading', - kind: 'single', - scope: 'session', - summary: 'Leading seat before the Session breadcrumbs, for window-chrome-adjacent controls (macOS desktop sidebar reopen and New Session while the sidebar is hidden).', - doc: 'Leading seat before the Session breadcrumbs, for window-chrome-adjacent\ncontrols (macOS desktop sidebar reopen and New Session while the sidebar\nis hidden). The seat is laid out only while its occupant renders\nsomething, and it stays mounted through the blank-session state so a\nhidden sidebar always keeps a reopen control on screen.', - registerOptions: [], - ownerProps: [ - '/** The leading seat\'s occupant derives its state from standard Session props. */\nexport interface ConversationHeaderLeadingOwnerProps {\n /** Marker field: the occupant receives no owner-specific values. */\n children?: never\n}', - ], - ownerPropsReferences: [], - standardProps: [ - 'useResource: UseResource', - 'useWorkspaces: SnapshotSelectorHook', - 'usePanelInfo: UsePanelInfo', - 'useSessions: UseSessions', - 'useSessionStatus: UseSessionStatus', - 'useSessionRetainInfo: UseSessionRetainInfo', - 'useWorkspaces: SnapshotSelectorHook', - 'useChat: UseChat', - 'useConversation: UseConversation', - 'useInput: SnapshotSelectorHook', - 'inputActions: InputActions', - 'useSession: SessionSnapshotSelector', - 'sessionId: SessionId', - 'useProjection: UseProjection', - 'useTrajectory: UseTrajectory', - ], - keyDomain: '', - hookContext: '', - slotInject: '', - declaredBy: 'an entry in \'conversation.session.header\' (client-ui-conversation), so it exists while that entry is mounted', - occupants: [ - 'client-ui-sidebar HeaderLeadingControls', - ], - replaceRisk: 'shadows-shipped-ui', - example: 'return {\n inject: [\'slots\'],\n apply(ctx) {\n ctx.slots.inject(\'conversation.session.header.leading\', () => ctx.slots.register(\n { name: \'conversation.session.header.leading\' },\n () => React.createElement(\'div\', null, \'hello\'),\n ))\n },\n}', - source: 'packages/client/ui-conversation/src/client/contract/slots.ts:161', + source: 'packages/client/ui-conversation/src/client/contract/slots.ts:168', }, { key: 'conversation.session.header.lineage', @@ -1375,7 +1402,7 @@ export const CLIENT_SLOT_API: readonly ClientSlotEntry[] = [ ], replaceRisk: 'shadows-shipped-ui', example: 'return {\n inject: [\'slots\'],\n apply(ctx) {\n ctx.slots.inject(\'conversation.session.header.lineage\', () => ctx.slots.register(\n { name: \'conversation.session.header.lineage\' },\n () => React.createElement(\'div\', null, \'hello\'),\n ))\n },\n}', - source: 'packages/client/ui-conversation/src/client/contract/slots.ts:137', + source: 'packages/client/ui-conversation/src/client/contract/slots.ts:139', }, { key: 'conversation.session.header.utilities', @@ -1434,7 +1461,7 @@ export const CLIENT_SLOT_API: readonly ClientSlotEntry[] = [ ], replaceRisk: 'none', example: 'return {\n inject: [\'slots\'],\n apply(ctx) {\n ctx.slots.inject(\'conversation.session.header.utilities\', () => ctx.slots.register(\n { name: \'conversation.session.header.utilities\', id: \'my-entry\', order: 100, label: \'My entry\' },\n () => React.createElement(\'div\', null, \'hello\'),\n ))\n },\n}', - source: 'packages/client/ui-conversation/src/client/contract/slots.ts:149', + source: 'packages/client/ui-conversation/src/client/contract/slots.ts:151', }, { key: 'conversation.trajectory.images', @@ -1538,7 +1565,7 @@ export const CLIENT_SLOT_API: readonly ClientSlotEntry[] = [ ], replaceRisk: 'none', example: 'return {\n inject: [\'slots\'],\n apply(ctx) {\n ctx.slots.inject(\'conversation.view\', () => ctx.slots.register(\n { name: \'conversation.view\', id: \'my-entry\', order: 100, label: \'My entry\' },\n () => React.createElement(\'div\', null, \'hello\'),\n ))\n },\n}', - source: 'packages/client/ui-conversation/src/client/contract/slots.ts:178', + source: 'packages/client/ui-conversation/src/client/contract/slots.ts:174', }, { key: 'main', From 29126c0a32001dae24abadd419eaf7d5178887df Mon Sep 17 00:00:00 2001 From: Yichen Jiang Date: Thu, 17 Sep 2026 19:57:18 +0800 Subject: [PATCH 18/75] fix(web): align plan preview copy controls with Markdown files --- packages/client/ui-plan/README.i18n.yaml | 4 ++-- packages/client/ui-plan/README.md | 2 +- packages/client/ui-plan/README.zh.md | 2 +- .../ui-plan/src/client/PlanPreview.module.css | 5 +---- .../client/ui-plan/src/client/PlanPreview.tsx | 6 ++---- .../tests/plan-preview.client.spec.tsx | 20 ++++--------------- 6 files changed, 11 insertions(+), 28 deletions(-) diff --git a/packages/client/ui-plan/README.i18n.yaml b/packages/client/ui-plan/README.i18n.yaml index 17181b1dde..20e6f1952e 100644 --- a/packages/client/ui-plan/README.i18n.yaml +++ b/packages/client/ui-plan/README.i18n.yaml @@ -2,5 +2,5 @@ # side as of the last confirmed-consistent state. Both languages carry equal authority; # after editing either side, bring the other along and re-record with: # pnpm run verify-translation-pairing --write packages/client/ui-plan/README.md -README.md: e269ad270ed6a0d72e4cb7424a86328d3eb6cfb3 -README.zh.md: 202a6737986630f18ffdf7d010174c98be732ba5 +README.md: f5cec26aff9ec7fc478915c20bca86c06474f9f7 +README.zh.md: 4bd416b757b7ff6bae2947b84db9f8d50101aa00 diff --git a/packages/client/ui-plan/README.md b/packages/client/ui-plan/README.md index e269ad270e..f5cec26aff 100644 --- a/packages/client/ui-plan/README.md +++ b/packages/client/ui-plan/README.md @@ -33,7 +33,7 @@ While the effective target is plan mode, the seat renders the warn-colored "Plan ### Reading submitted plans -When a Turn ends, each submitted plan appears in its final artifact area, using the file-delivery card treatment with a Markdown icon, title, and Open action. A pending plan opens automatically once per submission in the current browser session. Closing it stays effective across review remounts; a new submission opens its own plan. Historical cards open only when clicked. Use the card or review strip’s View full plan link to read and copy the complete Markdown. Plan tabs show a plain text file icon. Different submissions retain separate tabs; the review buttons alone decide whether implementation may begin. +When a Turn ends, each submitted plan appears in its final artifact area, using the file-delivery card treatment with a Markdown icon, title, and Open action. A pending plan opens automatically once per submission in the current browser session. Closing it stays effective across review remounts; a new submission opens its own plan. Historical cards open only when clicked. Use the card or review strip’s View full plan link to read the complete Markdown. Plan tabs show a plain text file icon. Different submissions retain separate tabs; the review buttons alone decide whether implementation may begin. A review without a logged invocation also opens automatically. Its complete text lives only in the tab’s navigation memory, and the pending review card can reopen it. Reloading the page loses that text; an expired preview directs the user back to a pending review. diff --git a/packages/client/ui-plan/README.zh.md b/packages/client/ui-plan/README.zh.md index 202a673798..4bd416b757 100644 --- a/packages/client/ui-plan/README.zh.md +++ b/packages/client/ui-plan/README.zh.md @@ -33,7 +33,7 @@ kind: "package-reference" ### 查看已提交的计划 -回合结束后,每次提交的计划都会显示在该回合末尾的产物区域,并采用文件产物卡片的样式,包含 Markdown 图标、标题和“打开”操作。在当前浏览器会话中,每份待审计划自动打开一次;关闭后,重新挂载审批组件不会再次展开,新提交会打开其对应计划。历史卡片仅在点击后打开。通过卡片或审批条带上的“查看全文”链接可阅读和复制完整 Markdown。计划标签页显示纯文本文件图标。不同提交保留独立标签页;是否开始实施仍由审批按钮决定。 +回合结束后,每次提交的计划都会显示在该回合末尾的产物区域,并采用文件产物卡片的样式,包含 Markdown 图标、标题和“打开”操作。在当前浏览器会话中,每份待审计划自动打开一次;关闭后,重新挂载审批组件不会再次展开,新提交会打开其对应计划。历史卡片仅在点击后打开。通过卡片或审批条带上的“查看全文”链接可阅读完整 Markdown。计划标签页显示纯文本文件图标。不同提交保留独立标签页;是否开始实施仍由审批按钮决定。 没有已记录调用标识的审批也会自动打开。完整正文只保存在标签页的导航内存中,待处理审批卡片可以重新打开它。刷新页面会丢失该正文;失效的预览会提示用户返回待处理审批。 diff --git a/packages/client/ui-plan/src/client/PlanPreview.module.css b/packages/client/ui-plan/src/client/PlanPreview.module.css index c0f2761be0..d63529070b 100644 --- a/packages/client/ui-plan/src/client/PlanPreview.module.css +++ b/packages/client/ui-plan/src/client/PlanPreview.module.css @@ -22,7 +22,7 @@ } :global(body[data-ds-dark-theme]) .card { --plan-card-fill: var(--dsw-static-neutral-850); --plan-card-hover: var(--dsw-static-neutral-800); } .card:hover { background: var(--plan-card-hover); } -.card:focus-visible, .iconButton:focus-visible { outline: 2px solid var(--dsw-alias-label-primary); outline-offset: 3px; } +.card:focus-visible { outline: 2px solid var(--dsw-alias-label-primary); outline-offset: 3px; } .cardIcon { box-sizing: border-box; flex: none; display: grid; place-items: center; width: 40px; height: 40px; border: 0.5px solid var(--dsw-alias-border-l1); border-radius: 10px; background: var(--plan-card-fill); } .cardDetails { display: flex; flex: 1; flex-direction: column; gap: 2px; min-width: 0; } .cardTitle { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 500; line-height: 20px; } @@ -31,10 +31,7 @@ .reviewLink { display: inline-flex; align-items: center; gap: 4px; padding: 0; border: 0; background: transparent; color: var(--dsw-alias-label-secondary); font: inherit; cursor: pointer; } .reviewLink:hover { color: var(--dsw-alias-label-primary); } .reviewLink:focus-visible { outline: 2px solid var(--dsw-alias-label-primary); outline-offset: 3px; } -.iconButton { display: flex; align-items: center; justify-content: center; width: 28px; height: 28px; border: 0; border-radius: 6px; background: transparent; color: inherit; cursor: pointer; } -.iconButton:hover { background: var(--dsw-alias-interactive-bg-hover); } .preview { position: relative; height: 100%; overflow: auto; padding: 20px 24px 40px; box-sizing: border-box; } -.toolbar { display: flex; justify-content: flex-end; margin-bottom: 8px; } .document { color: var(--dsw-alias-label-primary); font-size: 14px; line-height: 1.75; overflow-wrap: anywhere; } .message { padding: 24px; color: var(--dsw-alias-label-secondary); font-size: 14px; } .titleIcon { flex: none; } diff --git a/packages/client/ui-plan/src/client/PlanPreview.tsx b/packages/client/ui-plan/src/client/PlanPreview.tsx index 2f0c05508a..b1e1689fe8 100644 --- a/packages/client/ui-plan/src/client/PlanPreview.tsx +++ b/packages/client/ui-plan/src/client/PlanPreview.tsx @@ -1,6 +1,6 @@ /** Read-only Markdown viewer for logged plans and temporary review documents. */ import { useMemo } from 'react' -import { FileTypeIcon, IconCopyOutline16, MarkdownText, writeClipboard } from '@deepseek-ai/dsh-client-ui-primitives' +import { FileTypeIcon, MarkdownText } from '@deepseek-ai/dsh-client-ui-primitives' import type { PropsLocale, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots' import type {} from '@deepseek-ai/dsh-client-ui-sidebar-right/client' import type {} from './plan-resource.ts' @@ -11,7 +11,7 @@ import css from './PlanPreview.module.css' type PlanPreviewProps = PropsRuntime<'sidebar.right.pane.tab'> & PropsLocale<'plan'> /** - * Render the submitted plan with its complete Markdown and a copy action. + * Render the submitted plan with its complete Markdown. * @param props - Framework-bound tab identity, resource, and copy. * @returns the plan document or a localized loading/failure state. */ @@ -34,8 +34,6 @@ export function PlanPreview({ useTabInfo, useResource, t }: PlanPreviewProps) { ) return (
    -
    ) diff --git a/packages/client/ui-plan/tests/plan-preview.client.spec.tsx b/packages/client/ui-plan/tests/plan-preview.client.spec.tsx index 22b2fb006e..05208d847e 100644 --- a/packages/client/ui-plan/tests/plan-preview.client.spec.tsx +++ b/packages/client/ui-plan/tests/plan-preview.client.spec.tsx @@ -223,22 +223,10 @@ describe('plan entry points and document', () => { render([0]} />) expect(screen.getByText(plan.title)).toBeTruthy() }) - it('copies the complete Markdown and keeps a tab label while history loads', async () => { - const writeText = vi.fn().mockResolvedValue(undefined) - const clipboard = Object.getOwnPropertyDescriptor(navigator, 'clipboard') - Object.defineProperty(navigator, 'clipboard', { configurable: true, value: { writeText } }) - try { - const props = { t, useTabInfo: () => ({ tab: { title: 'Plan', navigation: { address: planAddress(target) } } }), useResource: () => ({ status: 'live', value: plan }) } - const view = render([0]} />) - fireEvent.click(screen.getByRole('button', { name: 'Copy' })) - await Promise.resolve() - expect(writeText).toHaveBeenCalledWith(markdown) - view.rerender( ({ status: 'loading' }) } as unknown as Parameters[0]} />) - expect(screen.getByText('Plan')).toBeTruthy() - } finally { - if (clipboard === undefined) Reflect.deleteProperty(navigator, 'clipboard') - else Object.defineProperty(navigator, 'clipboard', clipboard) - } + it('keeps a tab label while history loads', () => { + const props = { useTabInfo: () => ({ tab: { title: 'Plan', navigation: { address: planAddress(target) } } }), useResource: () => ({ status: 'loading' }) } + render([0]} />) + expect(screen.getByText('Plan')).toBeTruthy() }) it.each([en, zh])('localizes plan failures and unavailable providers', (dictionary) => { const props = { t: makeTranslate(dictionary, commonEn), From fd01a407b24b7a04befa4a87e484aeb5d14c1b5d Mon Sep 17 00:00:00 2001 From: Yichen Jiang Date: Thu, 17 Sep 2026 20:12:42 +0800 Subject: [PATCH 19/75] test(web): update plan preview snapshots after removing copy button --- apps/web/tests/expected/plan-review/temporary.expected.md | 2 -- snapshots/web/plan-review/preview.expected.md | 2 -- 2 files changed, 4 deletions(-) diff --git a/apps/web/tests/expected/plan-review/temporary.expected.md b/apps/web/tests/expected/plan-review/temporary.expected.md index 246480407c..7b214d1c16 100644 --- a/apps/web/tests/expected/plan-review/temporary.expected.md +++ b/apps/web/tests/expected/plan-review/temporary.expected.md @@ -1,6 +1,4 @@ - region "Temporary review": - - button "Copy": - - img - heading "Temporary review" [level=1] - paragraph: Review without a tool invocation. - heading "Implementation" [level=2] diff --git a/snapshots/web/plan-review/preview.expected.md b/snapshots/web/plan-review/preview.expected.md index 8b9c5daeb5..1bddbaa901 100644 --- a/snapshots/web/plan-review/preview.expected.md +++ b/snapshots/web/plan-review/preview.expected.md @@ -1,6 +1,4 @@ - 'region "Add `--greeting` flag to CLI"': - - button "Copy": - - img - heading "Add --greeting flag to CLI" [level=1]: - text: Add - code: "--greeting" From 9f21d7842a3f54a8a1c7ac8fac6b488cba211dd0 Mon Sep 17 00:00:00 2001 From: Yichen Jiang Date: Thu, 17 Sep 2026 20:41:39 +0800 Subject: [PATCH 20/75] fix(agent-team): enable tools and Web UI with one bundle --- ...xperimental-agent-teams-packages.i18n.yaml | 4 +- ...08-18-experimental-agent-teams-packages.md | 10 +- ...18-experimental-agent-teams-packages.zh.md | 10 +- ...6-09-15-shipped-optional-bundles.i18n.yaml | 4 +- .../2026-09-15-shipped-optional-bundles.md | 4 +- .../2026-09-15-shipped-optional-bundles.zh.md | 4 +- apps/cli/package.json | 1 - apps/web/tests/agent-team-panel.e2e.ts | 13 +-- apps/web/tests/agent-team-panel.overlay.yml | 4 +- .../plugin-config/official.expected.md | 8 +- .../plugin-manager/live-enabled.expected.md | 8 +- .../plugin-manager/manager.expected.md | 8 +- apps/web/tests/plugin-config.e2e.ts | 4 +- apps/web/tests/plugin-manager.e2e.ts | 46 +++++++-- docs/config-catalog.i18n.yaml | 4 +- docs/config-catalog.md | 1 - docs/config-catalog.zh.md | 1 - docs/module-graph.i18n.yaml | 4 +- docs/module-graph.md | 2 - docs/module-graph.zh.md | 2 - packages/boot/app-boot/src/profile.ts | 1 - .../client/ui-plugin-manager/README.i18n.yaml | 4 +- packages/client/ui-plugin-manager/README.md | 2 +- .../client/ui-plugin-manager/README.zh.md | 2 +- .../ui-plugin-manager/src/client/locales.ts | 8 +- .../src/client/presentation.ts | 3 - .../tests/components.client.spec.tsx | 1 - packages/experimental/README.i18n.yaml | 4 +- packages/experimental/README.md | 3 +- packages/experimental/README.zh.md | 3 +- .../agent-team-profile/README.i18n.yaml | 4 +- .../experimental/agent-team-profile/README.md | 16 ++- .../agent-team-profile/README.zh.md | 16 ++- .../agent-team-profile/cordis.patch.yml | 3 + .../agent-team-profile/package.json | 3 +- .../agent-team-profile/tests/profile.spec.ts | 4 + .../agent-team-web-profile/README.i18n.yaml | 6 -- .../agent-team-web-profile/README.md | 98 ------------------- .../agent-team-web-profile/README.zh.md | 98 ------------------- .../agent-team-web-profile/cordis.patch.yml | 6 -- .../agent-team-web-profile/package.json | 47 --------- .../agent-team-web-profile/src/index.ts | 3 - .../tests/profile.spec.ts | 34 ------- .../agent-team-web-profile/tsconfig.json | 11 --- .../client-ui-agent-team/README.i18n.yaml | 4 +- .../client-ui-agent-team/README.md | 6 +- .../client-ui-agent-team/README.zh.md | 6 +- pnpm-lock.yaml | 22 +---- scripts/release/families.spec.ts | 1 - .../verify-package-readme-model-experience.ts | 1 - tsconfig.base.json | 1 - tsconfig.host.json | 1 - 52 files changed, 130 insertions(+), 434 deletions(-) delete mode 100644 packages/experimental/agent-team-web-profile/README.i18n.yaml delete mode 100644 packages/experimental/agent-team-web-profile/README.md delete mode 100644 packages/experimental/agent-team-web-profile/README.zh.md delete mode 100644 packages/experimental/agent-team-web-profile/cordis.patch.yml delete mode 100644 packages/experimental/agent-team-web-profile/package.json delete mode 100644 packages/experimental/agent-team-web-profile/src/index.ts delete mode 100644 packages/experimental/agent-team-web-profile/tests/profile.spec.ts delete mode 100644 packages/experimental/agent-team-web-profile/tsconfig.json diff --git a/.agents/notes/implemented/architecture/2026-08-18-experimental-agent-teams-packages.i18n.yaml b/.agents/notes/implemented/architecture/2026-08-18-experimental-agent-teams-packages.i18n.yaml index 0ac7d7109d..fb8587decb 100644 --- a/.agents/notes/implemented/architecture/2026-08-18-experimental-agent-teams-packages.i18n.yaml +++ b/.agents/notes/implemented/architecture/2026-08-18-experimental-agent-teams-packages.i18n.yaml @@ -2,5 +2,5 @@ # side as of the last confirmed-consistent state. Both languages carry equal authority; # after editing either side, bring the other along and re-record with: # pnpm run verify-translation-pairing --write .agents/notes/implemented/architecture/2026-08-18-experimental-agent-teams-packages.md -2026-08-18-experimental-agent-teams-packages.md: 4a78a60c2ad7463c06b670e6ec664579ffd767b9 -2026-08-18-experimental-agent-teams-packages.zh.md: 8056cd8194695e8ce41acb359e51c040d4ed3aec +2026-08-18-experimental-agent-teams-packages.md: a59e7c209c4c1c1f36260dddedf14b00f66f1e80 +2026-08-18-experimental-agent-teams-packages.zh.md: ab36e8eeae1725f8541373087981a2f917297a1f diff --git a/.agents/notes/implemented/architecture/2026-08-18-experimental-agent-teams-packages.md b/.agents/notes/implemented/architecture/2026-08-18-experimental-agent-teams-packages.md index 4a78a60c2a..a59e7c209c 100644 --- a/.agents/notes/implemented/architecture/2026-08-18-experimental-agent-teams-packages.md +++ b/.agents/notes/implemented/architecture/2026-08-18-experimental-agent-teams-packages.md @@ -12,17 +12,17 @@ Moving the packages into product-role groups would remove their experimental nam ## Decision -`packages/experimental/agent-team`, `packages/experimental/tool-agent-team`, `packages/experimental/agent-team-profile`, `packages/experimental/client-ui-agent-team`, and `packages/experimental/agent-team-web-profile` are public workspace packages. They retain their existing `@deepseek-ai/dsh-experimental-*` names and join the dsh release family. The [publication denylist decision](../process/2026-09-12-experimental-publication-denylist.md) owns the public default and private exceptions; the [experimental package rules](../../../../packages/experimental/AGENTS.md) own dependency isolation and later promotion. +`packages/experimental/agent-team`, `packages/experimental/tool-agent-team`, `packages/experimental/agent-team-profile`, and `packages/experimental/client-ui-agent-team` are public workspace packages. They retain their existing `@deepseek-ai/dsh-experimental-*` names and join the dsh release family. The [publication denylist decision](../process/2026-09-12-experimental-publication-denylist.md) owns the public default and private exceptions; the [experimental package rules](../../../../packages/experimental/AGENTS.md) own dependency isolation and later promotion. -The dsh pack and publish set and the local baseline publisher include these five Agent Teams directories and the [Cua Driver providers](2026-09-12-computer-use-provider-registration.md). Workspace constraints require them to omit `private`, set `publishConfig.access` to `public`, and keep the experimental npm prefix. Release packages and apps outside the experimental group, plus the Python runtime, cannot name experimental packages in `dependencies`, `optionalDependencies`, or `peerDependencies`; experimental packages may depend on release packages and each other. +The dsh pack and publish set and the local baseline publisher include these four Agent Teams directories and the [Cua Driver providers](2026-09-12-computer-use-provider-registration.md). Workspace constraints require them to omit `private`, set `publishConfig.access` to `public`, and keep the experimental npm prefix. Release packages and apps outside the experimental group, plus the Python runtime, cannot name experimental packages in `dependencies`, `optionalDependencies`, or `peerDependencies`; experimental packages may depend on release packages and each other. The generic caller-reserved continuable child identity and selective direct-child drain remain in the stable Subagent service. They own Subagent identity and Activation lifecycle without importing or naming Agent Teams; the experimental Team service consumes them in the permitted direction. -The published Host-side Agent Teams profile bundle depends on the Team packages and applies after `dsh-base`. It inserts the Team rows and disables the global continuable-child controls whose model-visible names overlap the Team tools. The separate published Web profile applies after `dsh-web-app` and the Host profile; it inserts the Team UI, which mounts the Remote contribution generated by the Team package. Both layers remain opt-in and leave the shipped base, CLI, Web, and Python runtime dependency graphs unchanged. +The published Agent Teams profile bundle depends on the Team service, tools, and UI packages and applies after `dsh-base`. It inserts the Team rows and disables the global continuable-child controls whose model-visible names overlap the Team tools. The Web Client loader loads the UI and Remote contribution generated by the Team package; headless runs only Host plugins. The complete bundle ships as one [optional bundle](../process/2026-09-15-shipped-optional-bundles.md), inactive in default compositions. Profile startup resolves selected bundles before computing the [immutable profile resolution generation](2026-09-09-profile-resolution-generations.md). The generation retains installation-first precedence, traverses each explicit bundle root completely in profile order, and keeps pnpm-managed profile packages authoritative. Runtime mode enforces the result in memory; retained link and dual modes materialize the same result as shared and profile-owned projections. A private profile layer can therefore carry experimental plugin rows without adding those plugins to a release app, requiring profile users to install transitive packages directly, weakening packaged-runtime module identity, or changing another profile's resolution. -Experimental status changes compatibility and support expectations, not publication for these five packages. They retain the repository's ordinary documentation, invariant, lifecycle, security, unit, real-composition, and snapshot requirements. Promotion still requires review of the public contracts, limitations, test evidence, runtime dependents, and a named owner accepting stable-package obligations. +Experimental status changes compatibility and support expectations, not publication for these four packages. They retain the repository's ordinary documentation, invariant, lifecycle, security, unit, real-composition, and snapshot requirements. Promotion still requires review of the public contracts, limitations, test evidence, runtime dependents, and a named owner accepting stable-package obligations. ## Alternatives considered @@ -36,6 +36,6 @@ Experimental status changes compatibility and support expectations, not publicat ## Consequences -Agent Teams publishes as five installable tarballs in the dsh release family without changing package names or enabling Team in a shipped profile. Public availability does not make the packages stable or supported by default, and stable release packages cannot take runtime dependencies on them. +Agent Teams publishes as four installable tarballs in the dsh release family without changing package names or enabling Team in a shipped profile. Public availability does not make the packages stable or supported by default, and stable release packages cannot take runtime dependencies on them. The release family carries the experimental npm names. Promotion still creates path and npm-name churn as specified by the experimental package rules. diff --git a/.agents/notes/implemented/architecture/2026-08-18-experimental-agent-teams-packages.zh.md b/.agents/notes/implemented/architecture/2026-08-18-experimental-agent-teams-packages.zh.md index 8056cd8194..ab36e8eeae 100644 --- a/.agents/notes/implemented/architecture/2026-08-18-experimental-agent-teams-packages.zh.md +++ b/.agents/notes/implemented/architecture/2026-08-18-experimental-agent-teams-packages.zh.md @@ -12,17 +12,17 @@ Agent Teams 的服务与工具约定仍在变化,但它需要使用真实 Sess ## 决策 -`packages/experimental/agent-team`、`packages/experimental/tool-agent-team`、`packages/experimental/agent-team-profile`、`packages/experimental/client-ui-agent-team` 与 `packages/experimental/agent-team-web-profile` 是公开 workspace 包。它们保留现有 `@deepseek-ai/dsh-experimental-*` 名称并加入 dsh 发布系列。[发布拒绝列表决策](../process/2026-09-12-experimental-publication-denylist.zh.md)负责默认公开与私有例外;[实验性包规则](../../../../packages/experimental/AGENTS.md)负责依赖隔离与后续 promotion。 +`packages/experimental/agent-team`、`packages/experimental/tool-agent-team`、`packages/experimental/agent-team-profile` 与 `packages/experimental/client-ui-agent-team` 是公开 workspace 包。它们保留现有 `@deepseek-ai/dsh-experimental-*` 名称并加入 dsh 发布系列。[发布拒绝列表决策](../process/2026-09-12-experimental-publication-denylist.zh.md)负责默认公开与私有例外;[实验性包规则](../../../../packages/experimental/AGENTS.md)负责依赖隔离与后续 promotion。 -dsh 打包与发布集合以及本地基线发布器包含这五个 Agent Teams 目录和 [Cua Driver 提供方](2026-09-12-computer-use-provider-registration.zh.md)。workspace 约束要求它们省略 `private`、将 `publishConfig.access` 设为 `public`,并保留实验性 npm 前缀。实验组之外的发布包、应用和 Python 运行时不能在 `dependencies`、`optionalDependencies` 或 `peerDependencies` 中引用实验包;实验包可以依赖发布包和彼此。 +dsh 打包与发布集合以及本地基线发布器包含这四个 Agent Teams 目录和 [Cua Driver 提供方](2026-09-12-computer-use-provider-registration.zh.md)。workspace 约束要求它们省略 `private`、将 `publishConfig.access` 设为 `public`,并保留实验性 npm 前缀。实验组之外的发布包、应用和 Python 运行时不能在 `dependencies`、`optionalDependencies` 或 `peerDependencies` 中引用实验包;实验包可以依赖发布包和彼此。 通用的调用方预留 continuable child 身份和精确 direct-child drain 仍属于稳定 Subagent 服务。它们负责 Subagent 身份与 Activation 生命周期,不 import 或命名 Agent Teams;实验性 Team 服务沿允许的方向消费这些能力。 -公开发布的 Host 侧 Agent Teams profile bundle 依赖 Team 包,并在 `dsh-base` 之后应用。它会插入 Team 配置行,并禁用模型可见名称与 Team 工具重叠的全局 continuable-child control。独立公开发布的 Web profile 在 `dsh-web-app` 与 Host profile 之后应用;它会插入 Team UI,后者挂载 Team package 生成的 Remote contribution。两个层都保持显式启用,不改变随附 base、CLI、Web 与 Python runtime 的依赖图。 +公开发布的 Agent Teams profile bundle 依赖 Team 服务、工具和 UI 包,并在 `dsh-base` 之后应用。它会插入 Team 配置行,并禁用模型可见名称与 Team 工具重叠的全局 continuable-child control。Web Client loader 加载 UI 及 Team package 生成的 Remote contribution;headless 仅运行 Host 插件。整个组合包作为一个[随附可选组合包](../process/2026-09-15-shipped-optional-bundles.zh.md)交付,默认组合不启用它。 profile 启动会先解析所选 bundle,再计算[不可变 profile resolution generation](2026-09-09-profile-resolution-generations.zh.md)。generation 保留安装优先顺序,按 profile 顺序完整遍历每个显式 bundle 根,并让 pnpm 管理的 profile 包保持优先。runtime 模式在内存中强制该结果;保留的 link 与 dual 模式把同一结果物化为共享和 profile 自有投影。因此,私有 profile 层可以携带实验性 plugin 配置行,而无需把这些 plugin 加入发布 app、要求 profile 用户直接安装传递依赖、破坏 packaged-runtime 的模块身份,或改变其他 profile 的解析结果。 -对这五个包而言,实验性状态改变兼容性与支持预期,而不阻止发布。这些包仍须满足仓库的一般文档、不变式、生命周期、安全、单元测试、真实组合测试和快照要求。promotion 前仍须评审公开约定、限制、测试证据、运行时依赖方,并由一名具名 owner 接受稳定包义务。 +对这四个包而言,实验性状态改变兼容性与支持预期,而不阻止发布。这些包仍须满足仓库的一般文档、不变式、生命周期、安全、单元测试、真实组合测试和快照要求。promotion 前仍须评审公开约定、限制、测试证据、运行时依赖方,并由一名具名 owner 接受稳定包义务。 ## 曾考虑的替代方案 @@ -36,6 +36,6 @@ profile 启动会先解析所选 bundle,再计算[不可变 profile resolution ## 后果 -Agent Teams 会作为 dsh 发布系列中的五个可安装 tarball 发布,同时保持包名不变,也不会在随附 profile 中启用 Team。公开可用不代表这些包稳定或默认受支持,稳定发布包也不能对其建立运行时依赖。 +Agent Teams 会作为 dsh 发布系列中的四个可安装 tarball 发布,同时保持包名不变,也不会在随附 profile 中启用 Team。公开可用不代表这些包稳定或默认受支持,稳定发布包也不能对其建立运行时依赖。 发布系列保留实验性 npm 名称。promotion 仍会按照实验性包规则产生路径和 npm 名改动。 diff --git a/.agents/notes/implemented/process/2026-09-15-shipped-optional-bundles.i18n.yaml b/.agents/notes/implemented/process/2026-09-15-shipped-optional-bundles.i18n.yaml index 2b32ebfee1..cf7cd8111c 100644 --- a/.agents/notes/implemented/process/2026-09-15-shipped-optional-bundles.i18n.yaml +++ b/.agents/notes/implemented/process/2026-09-15-shipped-optional-bundles.i18n.yaml @@ -2,5 +2,5 @@ # side as of the last confirmed-consistent state. Both languages carry equal authority; # after editing either side, bring the other along and re-record with: # pnpm run verify-translation-pairing --write .agents/notes/implemented/process/2026-09-15-shipped-optional-bundles.md -2026-09-15-shipped-optional-bundles.md: 40ef69d3880f8d1c925c1e3c423e59a628f22e09 -2026-09-15-shipped-optional-bundles.zh.md: adf2b979b9d23b7510c077f3633e2d030732a7b4 +2026-09-15-shipped-optional-bundles.md: ec16c333c49551fc53a278c57f2c3d9bf6c2cceb +2026-09-15-shipped-optional-bundles.zh.md: a856c5eb1960c3b033019fab22a6867784659efd diff --git a/.agents/notes/implemented/process/2026-09-15-shipped-optional-bundles.md b/.agents/notes/implemented/process/2026-09-15-shipped-optional-bundles.md index 40ef69d388..ec16c333c4 100644 --- a/.agents/notes/implemented/process/2026-09-15-shipped-optional-bundles.md +++ b/.agents/notes/implemented/process/2026-09-15-shipped-optional-bundles.md @@ -14,7 +14,7 @@ The launcher names in `OPTIONAL_BUNDLES` (`packages/boot/app-boot/src/profile.ts Default-product isolation keeps its rules with one declared exception: an optional bundle's dependency graph is outside the default product. The static gate skips the `dependencies` edge from `@deepseek-ai/dsh` to a listed bundle and still rejects a runtime import, a shipped composition, a preset, or a default template that names it, an experimental dependency the list does not name, and a listed name that is not a runtime dependency or not a bundle. The workspace-constraints check accepts the same `dependencies` edges and no other runtime section, and the packed-install release check skips them from the installed entry package while requiring each listed bundle to be installed. -Agent Teams ships this way, as `@deepseek-ai/dsh-experimental-agent-team-profile` and `@deepseek-ai/dsh-experimental-agent-team-web-profile`. Auto review is a published experimental package the page's install guide names as its example, not an optional bundle. +Agent Teams ships this way, as one `@deepseek-ai/dsh-experimental-agent-team-profile` bundle containing its service, tools, and browser UI. Auto review is a published experimental package the page's install guide names as its example, not an optional bundle. ## Alternatives considered @@ -26,4 +26,4 @@ Agent Teams ships this way, as `@deepseek-ai/dsh-experimental-agent-team-profile ## Consequences -Optional bundles are downloaded with the product and stay inactive until selected; the runtime isolation smokes still observe no experimental module in a default composition. Switching on an optional Web layer loads its client plugin through the live client module graph. A bundle that needs a companion layer, such as the Agent Teams Web layer over its Host layer, says so in its description; the manager does not select companions automatically. +Optional bundles are downloaded with the product and stay inactive until selected; the runtime isolation smokes still observe no experimental module in a default composition. Switching on an optional Web layer loads its client plugin through the live client module graph. Agent Teams exposes one switch for its complete composition; the manager does not select companion bundles automatically. diff --git a/.agents/notes/implemented/process/2026-09-15-shipped-optional-bundles.zh.md b/.agents/notes/implemented/process/2026-09-15-shipped-optional-bundles.zh.md index adf2b979b9..a856c5eb19 100644 --- a/.agents/notes/implemented/process/2026-09-15-shipped-optional-bundles.zh.md +++ b/.agents/notes/implemented/process/2026-09-15-shipped-optional-bundles.zh.md @@ -14,7 +14,7 @@ Web 插件页只管理用户装进 profile 的组合包。像 Agent Teams 这样 默认产品隔离的规则保持不变,只声明一个例外:可选组合包的依赖图在默认产品之外。静态门禁跳过从 `@deepseek-ai/dsh` 到列表中组合包的 `dependencies` 边,仍然拒绝运行时 import、随附组合、preset 或默认模板对它的引用,拒绝列表没有点名的实验依赖,也拒绝不是运行时依赖或不是组合包的列表项。workspace 约束检查接受同样的 `dependencies` 边而不接受其他运行时依赖段;发布时的 packed-install 检查对已安装入口包跳过这些边,并要求列表中的每个组合包都已安装。 -Agent Teams 以这种方式交付,即 `@deepseek-ai/dsh-experimental-agent-team-profile` 与 `@deepseek-ai/dsh-experimental-agent-team-web-profile`。Auto review 是一个已发布的实验包,插件页的安装引导拿它作示例,它不是可选组合包。 +Agent Teams 以这种方式交付,由一个 `@deepseek-ai/dsh-experimental-agent-team-profile` 组合包包含服务、工具和浏览器 UI。Auto review 是一个已发布的实验包,插件页的安装引导拿它作示例,它不是可选组合包。 ## 考虑过的替代方案 @@ -26,4 +26,4 @@ Agent Teams 以这种方式交付,即 `@deepseek-ai/dsh-experimental-agent-tea ## 影响 -可选组合包随产品一起下载,选中前保持不活动;运行时隔离 smoke 在默认组合中仍观察不到任何实验模块。开启一个可选 Web 层会通过实时客户端模块图加载它的客户端插件。需要配套层的组合包,例如 Agent Teams Web 层依赖其 Host 层,会在描述里说明;管理器不会自动选中配套层。 +可选组合包随产品一起下载,选中前保持不活动;运行时隔离 smoke 在默认组合中仍观察不到任何实验模块。开启一个可选 Web 层会通过实时客户端模块图加载它的客户端插件。Agent Teams 用一个开关管理完整组合;管理器不会自动选中配套组合包。 diff --git a/apps/cli/package.json b/apps/cli/package.json index 5204f55a29..3c1a15fc98 100644 --- a/apps/cli/package.json +++ b/apps/cli/package.json @@ -48,7 +48,6 @@ "@deepseek-ai/dsh-compaction-tool-result-pruner": "workspace:^", "@deepseek-ai/dsh-cordis-client-runner": "workspace:^", "@deepseek-ai/dsh-experimental-agent-team-profile": "workspace:^", - "@deepseek-ai/dsh-experimental-agent-team-web-profile": "workspace:^", "@deepseek-ai/dsh-fs-local": "workspace:^", "@deepseek-ai/dsh-goal": "workspace:^", "@deepseek-ai/dsh-goal-round-driver": "workspace:^", diff --git a/apps/web/tests/agent-team-panel.e2e.ts b/apps/web/tests/agent-team-panel.e2e.ts index b3192c3655..ac4e484db0 100644 --- a/apps/web/tests/agent-team-panel.e2e.ts +++ b/apps/web/tests/agent-team-panel.e2e.ts @@ -1,4 +1,4 @@ -// Keyless assembled-browser coverage for the opt-in Agent Teams Web profiles +// Keyless assembled-browser coverage for the opt-in Agent Teams bundle // over the real Host Typert Remote flow. import { fileURLToPath } from 'node:url' import { join } from 'node:path' @@ -18,11 +18,9 @@ import { connectFreshWorkspace, newEnglishPage, saveFailureShot } from './suppor const SNAPSHOT_DIR = fileURLToPath(new URL('./snapshots/agent-team-panel', import.meta.url)) const PANEL_EXPECTED = join(SNAPSHOT_DIR, 'task.expected.md') const OVERLAY = fileURLToPath(new URL('./agent-team-panel.overlay.yml', import.meta.url)) -const HOST_PATCH = fileURLToPath(new URL('../../../packages/experimental/agent-team-profile/cordis.patch.yml', import.meta.url)) -const WEB_PATCH = fileURLToPath(new URL('../../../packages/experimental/agent-team-web-profile/cordis.patch.yml', import.meta.url)) +const TEAM_PATCH = fileURLToPath(new URL('../../../packages/experimental/agent-team-profile/cordis.patch.yml', import.meta.url)) const INSTALL_ANCHORS = [ fileURLToPath(new URL('../../../packages/experimental/agent-team-profile/package.json', import.meta.url)), - fileURLToPath(new URL('../../../packages/experimental/agent-team-web-profile/package.json', import.meta.url)), ] const MODE = webSnapshotMode() @@ -33,11 +31,8 @@ function profileEntries(path: string): unknown[] { } describe('Agent Teams panel overlay', () => { - it('matches the shipped Host and Web profile layers', () => { - expect(profileEntries(OVERLAY)).toEqual([ - ...profileEntries(HOST_PATCH), - ...profileEntries(WEB_PATCH), - ]) + it('matches the shipped Agent Teams bundle', () => { + expect(profileEntries(OVERLAY)).toEqual(profileEntries(TEAM_PATCH)) }) }) diff --git a/apps/web/tests/agent-team-panel.overlay.yml b/apps/web/tests/agent-team-panel.overlay.yml index cb6dd2decd..20c49c23a1 100644 --- a/apps/web/tests/agent-team-panel.overlay.yml +++ b/apps/web/tests/agent-team-panel.overlay.yml @@ -1,5 +1,4 @@ -# Equivalent to the two explicit Agent Teams profile layers over the scaffold's -# stable base and Web bundles. +# Equivalent to the Agent Teams bundle over the stable base and Web bundles. - id: tool-subagent-control disabled: true @@ -28,6 +27,5 @@ freshProvider: spawn forkProvider: fork -- insert: - id: ui-agent-team name: '@deepseek-ai/dsh-experimental-client-ui-agent-team' diff --git a/apps/web/tests/expected/plugin-config/official.expected.md b/apps/web/tests/expected/plugin-config/official.expected.md index 7f69fe8231..43778ec668 100644 --- a/apps/web/tests/expected/plugin-config/official.expected.md +++ b/apps/web/tests/expected/plugin-config/official.expected.md @@ -5,16 +5,12 @@ - img - text: 添加插件 - heading "官方" [level=3] -- text: "6" +- text: "5" - list: - listitem: - button "查看 智能体团队": 智能体团队 - - text: Beta 启用智能体团队协作与团队工具。 + - text: Beta 启用团队协作、团队工具及成员与任务看板。 - switch "启用 智能体团队" - - listitem: - - button "查看 智能体团队 Web 界面": 智能体团队 Web 界面 - - text: Beta 在浏览器中查看团队成员、任务看板和成员会话。 - - switch "启用 智能体团队 Web 界面" - listitem: - button "查看 终端": 终端 - text: 限制 agent 运行的每一条命令。 diff --git a/apps/web/tests/expected/plugin-manager/live-enabled.expected.md b/apps/web/tests/expected/plugin-manager/live-enabled.expected.md index 7302e8cc31..51dcbd91ef 100644 --- a/apps/web/tests/expected/plugin-manager/live-enabled.expected.md +++ b/apps/web/tests/expected/plugin-manager/live-enabled.expected.md @@ -5,16 +5,12 @@ - img - text: 添加插件 - heading "官方" [level=3] -- text: "6" +- text: "5" - list: - listitem: - button "查看 智能体团队": 智能体团队 - - text: Beta 启用智能体团队协作与团队工具。 + - text: Beta 启用团队协作、团队工具及成员与任务看板。 - switch "启用 智能体团队" - - listitem: - - button "查看 智能体团队 Web 界面": 智能体团队 Web 界面 - - text: Beta 在浏览器中查看团队成员、任务看板和成员会话。 - - switch "启用 智能体团队 Web 界面" - listitem: - button "查看 终端": 终端 - text: 限制 agent 运行的每一条命令。 diff --git a/apps/web/tests/expected/plugin-manager/manager.expected.md b/apps/web/tests/expected/plugin-manager/manager.expected.md index 023bd3b8bd..ed8a8aa530 100644 --- a/apps/web/tests/expected/plugin-manager/manager.expected.md +++ b/apps/web/tests/expected/plugin-manager/manager.expected.md @@ -5,16 +5,12 @@ - img - text: 添加插件 - heading "官方" [level=3] -- text: "6" +- text: "5" - list: - listitem: - button "查看 智能体团队": 智能体团队 - - text: Beta 启用智能体团队协作与团队工具。 + - text: Beta 启用团队协作、团队工具及成员与任务看板。 - switch "启用 智能体团队" - - listitem: - - button "查看 智能体团队 Web 界面": 智能体团队 Web 界面 - - text: Beta 在浏览器中查看团队成员、任务看板和成员会话。 - - switch "启用 智能体团队 Web 界面" - listitem: - button "查看 终端": 终端 - text: 限制 agent 运行的每一条命令。 diff --git a/apps/web/tests/plugin-config.e2e.ts b/apps/web/tests/plugin-config.e2e.ts index db20eed409..475084a550 100644 --- a/apps/web/tests/plugin-config.e2e.ts +++ b/apps/web/tests/plugin-config.e2e.ts @@ -86,10 +86,10 @@ describe('web e2e: plugin configuration pages', () => { // Every page the shipped web composition exposes: the shell executor, the // agent loop, subagent selection, and the DeepSeek search provider, after - // the two official bundles the installation ships switched off. + // the official Team bundle the installation ships switched off. await panel.getByRole('button', { name: '查看 网页搜索', exact: true }).waitFor({ timeout: 20_000 }) const official = panel.locator('[data-plugin-group="official"]') - expect(await official.locator('[data-plugin-package]').count()).toBe(2) + expect(await official.locator('[data-plugin-package]').count()).toBe(1) expect(await official.locator('[data-plugin-item]').count()).toBe(4) for (const title of ['终端', 'Agent 循环', 'Subagent', '网页搜索']) { expect(await official.getByRole('button', { name: `查看 ${title}`, exact: true }).count()).toBe(1) diff --git a/apps/web/tests/plugin-manager.e2e.ts b/apps/web/tests/plugin-manager.e2e.ts index c8a07c1d79..ebe90edae4 100644 --- a/apps/web/tests/plugin-manager.e2e.ts +++ b/apps/web/tests/plugin-manager.e2e.ts @@ -6,6 +6,7 @@ import { readFile } from 'node:fs/promises' import { fileURLToPath } from 'node:url' import type { Browser, Page } from 'playwright' import { chromium } from 'playwright' +import { FiberState } from '@deepseek-ai/cordis' import { afterAll, beforeAll, describe, expect, it, onTestFailed } from 'vitest' import { join } from 'node:path' import { @@ -75,9 +76,9 @@ describe('web e2e: plugin manager', () => { // group, followed by the official plugins that registered their configuration, and its other bundles // stay off the page. expect(await panel.locator('[data-plugin-group="bundles"] [data-plugin-package]').count()).toBe(1) - expect(await panel.locator('[data-plugin-group="official"] [data-plugin-package]').count()).toBe(2) + expect(await panel.locator('[data-plugin-group="official"] [data-plugin-package]').count()).toBe(1) expect(await panel.locator('[data-plugin-group="official"] [data-plugin-item]').count()).toBe(4) - expect(await panel.getByText('Beta', { exact: true }).count()).toBe(2) + expect(await panel.getByText('Beta', { exact: true }).count()).toBe(1) // A bundle that is off still shows the rows its patch declares, without switches. await panel.getByRole('button', { name: '查看 bundle' }).click() await panel.locator('[data-plugin-row]', { hasText: 'fixture-row' }).waitFor({ timeout: 10_000 }) @@ -97,7 +98,7 @@ describe('web e2e: plugin manager', () => { await panel.getByRole('button', { name: '查看 智能体团队', exact: true }).click() const packageName = panel.locator('[data-plugin-name]') expect(await packageName.textContent()).toBe('@deepseek-ai/dsh-experimental-agent-team-profile') - expect(await panel.getByText('启用智能体团队协作与团队工具。').count()).toBe(1) + expect(await panel.getByText('启用团队协作、团队工具及成员与任务看板。').count()).toBe(1) try { await page.getByRole('button', { name: '设置', exact: true }).click() await page.getByRole('dialog', { name: '设置' }).getByRole('button', { name: '中文' }).click() @@ -106,13 +107,10 @@ describe('web e2e: plugin manager', () => { await page.keyboard.press('Escape') await panel.getByRole('heading', { name: 'Agent Teams', exact: true }).waitFor() expect(await packageName.textContent()).toBe('@deepseek-ai/dsh-experimental-agent-team-profile') - expect(await panel.getByText('Enable agent team collaboration and team tools.').count()).toBe(1) + expect(await panel.getByText('Enable team collaboration, team tools, and the members and task board.').count()).toBe(1) await panel.getByRole('button', { name: 'Back to plugins' }).click() - for (const title of ['Agent Teams', 'Agent Teams Web UI']) { - await panel.getByRole('button', { name: `View ${title}`, exact: true }).waitFor() - expect(await panel.getByRole('switch', { name: `Enable ${title}`, exact: true }).count()).toBe(1) - } - expect(await panel.getByText('View team members, the task board, and teammate sessions in the browser.').count()).toBe(1) + await panel.getByRole('button', { name: 'View Agent Teams', exact: true }).waitFor() + expect(await panel.getByRole('switch', { name: 'Enable Agent Teams', exact: true }).count()).toBe(1) // The official configuration pages follow the language too, from their own dictionary. for (const title of ['Shell', 'Agent loop', 'Subagent', 'Web search']) { await panel.getByRole('button', { name: `View ${title}`, exact: true }).waitFor() @@ -132,6 +130,36 @@ describe('web e2e: plugin manager', () => { expect(tripwire.pageErrors).toEqual([]) }, 60_000) + it('enables the Team tools and browser plugin with one bundle switch', async () => { + onTestFailed(() => saveFailureShot(page, 'web-e2e-plugin-manager-team')) + const panel = await openPluginsPanel() + const toggle = panel.getByRole('switch', { name: '启用 智能体团队', exact: true }) + const teamRows = () => [...scaffold.ctx.loader.entries()] + .filter(entry => ['agent-team', 'tool-agent-team', 'ui-agent-team'].includes(entry.options.id)) + await toggle.click() + try { + await expect.poll(() => teamRows().filter(entry => entry.fiber?.state === FiberState.ACTIVE).length, { timeout: 20_000 }).toBe(3) + await expect.poll(() => toggle.getAttribute('aria-checked')).toBe('true') + const manifest = JSON.parse(await homeFile('profiles', 'scaffold', 'package.json')) as { + dsh: { profile: { bundles: string[] } } + } + expect(manifest.dsh.profile.bundles).toEqual([ + '@deepseek-ai/dsh-base', '@deepseek-ai/dsh-web-app', '@deepseek-ai/dsh-experimental-agent-team-profile', + ]) + await panel.getByRole('button', { name: '查看 智能体团队', exact: true }).click() + for (const id of ['agent-team', 'tool-agent-team', 'ui-agent-team']) { + await panel.locator('[data-plugin-row]', { hasText: id }).first().waitFor() + } + await panel.getByRole('button', { name: '返回插件列表' }).click() + } finally { + const back = panel.getByRole('button', { name: '返回插件列表' }) + if (await back.count() > 0) await back.click() + await toggle.click() + await expect.poll(() => teamRows().filter(entry => entry.fiber?.state === FiberState.ACTIVE).length, { timeout: 20_000 }).toBe(0) + } + expect(tripwire.pageErrors).toEqual([]) + }, 60_000) + it('checks a spec before installing it and words what the check refused', async () => { onTestFailed(() => saveFailureShot(page, 'web-e2e-plugin-manager-install')) const panel = await openPluginsPanel() diff --git a/docs/config-catalog.i18n.yaml b/docs/config-catalog.i18n.yaml index 7da9acd525..9abb7e2f19 100644 --- a/docs/config-catalog.i18n.yaml +++ b/docs/config-catalog.i18n.yaml @@ -2,5 +2,5 @@ # side as of the last confirmed-consistent state. Both languages carry equal authority; # after editing either side, bring the other along and re-record with: # pnpm run verify-translation-pairing --write docs/config-catalog.md -config-catalog.md: 631ce6a34b120f44534a7935ff976662287fa879 -config-catalog.zh.md: 8d72786a79ceff85e35aff72fa6622af7373a3b4 +config-catalog.md: fd7ddf0b0ea3eef331283531a860a2079d02cf81 +config-catalog.zh.md: 7f58a328ec0650ee3032950d7afadd8a7fdd6a5b diff --git a/docs/config-catalog.md b/docs/config-catalog.md index 631ce6a34b..fd7ddf0b0e 100644 --- a/docs/config-catalog.md +++ b/docs/config-catalog.md @@ -3905,7 +3905,6 @@ Imported as libraries by other packages; a `cordis.yml` cannot load them. - `@deepseek-ai/dsh-cmdline` ([`packages/boot/cmdline/src/index.ts`](../packages/boot/cmdline/src/index.ts)) - `@deepseek-ai/dsh-deque` ([`packages/util/deque/src/index.ts`](../packages/util/deque/src/index.ts)) - `@deepseek-ai/dsh-experimental-agent-team-profile` ([`packages/experimental/agent-team-profile/src/index.ts`](../packages/experimental/agent-team-profile/src/index.ts)) -- `@deepseek-ai/dsh-experimental-agent-team-web-profile` ([`packages/experimental/agent-team-web-profile/src/index.ts`](../packages/experimental/agent-team-web-profile/src/index.ts)) - `@deepseek-ai/dsh-experimental-browser-use-runtime` ([`packages/experimental/browser-use-runtime/src/index.ts`](../packages/experimental/browser-use-runtime/src/index.ts)) - `@deepseek-ai/dsh-experimental-webworker-packer` ([`packages/experimental/webworker-packer/src/index.ts`](../packages/experimental/webworker-packer/src/index.ts)) - `@deepseek-ai/dsh-experimental-webworker-runtime` ([`packages/experimental/webworker-runtime/src/index.ts`](../packages/experimental/webworker-runtime/src/index.ts)) diff --git a/docs/config-catalog.zh.md b/docs/config-catalog.zh.md index 8d72786a79..7f58a328ec 100644 --- a/docs/config-catalog.zh.md +++ b/docs/config-catalog.zh.md @@ -3906,7 +3906,6 @@ export interface Config { - `@deepseek-ai/dsh-cmdline`([`packages/boot/cmdline/src/index.ts`](../packages/boot/cmdline/src/index.ts)) - `@deepseek-ai/dsh-deque`([`packages/util/deque/src/index.ts`](../packages/util/deque/src/index.ts)) - `@deepseek-ai/dsh-experimental-agent-team-profile`([`packages/experimental/agent-team-profile/src/index.ts`](../packages/experimental/agent-team-profile/src/index.ts)) -- `@deepseek-ai/dsh-experimental-agent-team-web-profile`([`packages/experimental/agent-team-web-profile/src/index.ts`](../packages/experimental/agent-team-web-profile/src/index.ts)) - `@deepseek-ai/dsh-experimental-browser-use-runtime` ([`packages/experimental/browser-use-runtime/src/index.ts`](../packages/experimental/browser-use-runtime/src/index.ts)) - `@deepseek-ai/dsh-experimental-webworker-packer`([`packages/experimental/webworker-packer/src/index.ts`](../packages/experimental/webworker-packer/src/index.ts)) - `@deepseek-ai/dsh-experimental-webworker-runtime`([`packages/experimental/webworker-runtime/src/index.ts`](../packages/experimental/webworker-runtime/src/index.ts)) diff --git a/docs/module-graph.i18n.yaml b/docs/module-graph.i18n.yaml index ff54d13bd5..78f2897d67 100644 --- a/docs/module-graph.i18n.yaml +++ b/docs/module-graph.i18n.yaml @@ -2,5 +2,5 @@ # side as of the last confirmed-consistent state. Both languages carry equal authority; # after editing either side, bring the other along and re-record with: # pnpm run verify-translation-pairing --write docs/module-graph.md -module-graph.md: a886619fa5cba78b2c243c525b8f2a173c1e8038 -module-graph.zh.md: 9c40a086df916cd638599176a95c649d6a2adc0d +module-graph.md: 2e2899c3a74e1d2c5fe50ab137408e7ed3beca82 +module-graph.zh.md: 49291ba55842462e5d532cce1de4f3803610d908 diff --git a/docs/module-graph.md b/docs/module-graph.md index a886619fa5..2e2899c3a7 100644 --- a/docs/module-graph.md +++ b/docs/module-graph.md @@ -231,7 +231,6 @@ flowchart TD subgraph group_experimental["packages/experimental"] pkg_experimental_agent_team["experimental-agent-team"] pkg_experimental_agent_team_profile["experimental-agent-team-profile"] - pkg_experimental_agent_team_web_profile["experimental-agent-team-web-profile"] pkg_experimental_auto_review["experimental-auto-review"] pkg_experimental_browser_use_chrome_devtools_mcp["experimental-browser-use-chrome-devtools-mcp"] pkg_experimental_browser_use_playwright_mcp["experimental-browser-use-playwright-mcp"] @@ -1382,7 +1381,6 @@ flowchart TD | [`client-web`](../packages/client/web) | `client` | — | | [`office-to-pdf`](../packages/document/office-to-pdf) | `document` | — | | [`experimental-agent-team-profile`](../packages/experimental/agent-team-profile) | `experimental` | — | -| [`experimental-agent-team-web-profile`](../packages/experimental/agent-team-web-profile) | `experimental` | — | | [`experimental-webworker-packer`](../packages/experimental/webworker-packer) | `experimental` | — | | [`client-ui-cordis`](../packages/extensions/ui-cordis) | `extensions` | — | | [`cordis-client-runner`](../packages/extensions/cordis-client-runner) | `extensions` | — | diff --git a/docs/module-graph.zh.md b/docs/module-graph.zh.md index 9c40a086df..49291ba558 100644 --- a/docs/module-graph.zh.md +++ b/docs/module-graph.zh.md @@ -233,7 +233,6 @@ flowchart TD subgraph group_experimental["packages/experimental"] pkg_experimental_agent_team["experimental-agent-team"] pkg_experimental_agent_team_profile["experimental-agent-team-profile"] - pkg_experimental_agent_team_web_profile["experimental-agent-team-web-profile"] pkg_experimental_auto_review["experimental-auto-review"] pkg_experimental_browser_use_chrome_devtools_mcp["experimental-browser-use-chrome-devtools-mcp"] pkg_experimental_browser_use_playwright_mcp["experimental-browser-use-playwright-mcp"] @@ -1384,7 +1383,6 @@ flowchart TD | [`client-web`](../packages/client/web) | `client` | — | | [`office-to-pdf`](../packages/document/office-to-pdf) | `document` | — | | [`experimental-agent-team-profile`](../packages/experimental/agent-team-profile) | `experimental` | — | -| [`experimental-agent-team-web-profile`](../packages/experimental/agent-team-web-profile) | `experimental` | — | | [`experimental-webworker-packer`](../packages/experimental/webworker-packer) | `experimental` | — | | [`client-ui-cordis`](../packages/extensions/ui-cordis) | `extensions` | — | | [`cordis-client-runner`](../packages/extensions/cordis-client-runner) | `extensions` | — | diff --git a/packages/boot/app-boot/src/profile.ts b/packages/boot/app-boot/src/profile.ts index d187f3c10a..d5c0a32ff7 100644 --- a/packages/boot/app-boot/src/profile.ts +++ b/packages/boot/app-boot/src/profile.ts @@ -166,7 +166,6 @@ export const DEFAULT_PROFILE_BUNDLES: readonly string[] = ['@deepseek-ai/dsh-bas */ export const OPTIONAL_BUNDLES: readonly string[] = [ '@deepseek-ai/dsh-experimental-agent-team-profile', - '@deepseek-ai/dsh-experimental-agent-team-web-profile', ] const PROFILE_PATCH_TEMPLATE = `# Your patch layer for this dsh profile, applied after every bundle layer: diff --git a/packages/client/ui-plugin-manager/README.i18n.yaml b/packages/client/ui-plugin-manager/README.i18n.yaml index e50cdb00de..6fe4900da4 100644 --- a/packages/client/ui-plugin-manager/README.i18n.yaml +++ b/packages/client/ui-plugin-manager/README.i18n.yaml @@ -2,5 +2,5 @@ # side as of the last confirmed-consistent state. Both languages carry equal authority; # after editing either side, bring the other along and re-record with: # pnpm run verify-translation-pairing --write packages/client/ui-plugin-manager/README.md -README.md: e7128dd2146cc0553ab36fdef5c31470be7877f2 -README.zh.md: ff7706f1d9747f553bf91f45a76fa5f50472330d +README.md: bd99187b7cc9ad6abfcba22c6f6b9296b486e367 +README.zh.md: 996c6e35d057b7909c764e504cdfe3d19c2f6f72 diff --git a/packages/client/ui-plugin-manager/README.md b/packages/client/ui-plugin-manager/README.md index e7128dd214..bd99187b7c 100644 --- a/packages/client/ui-plugin-manager/README.md +++ b/packages/client/ui-plugin-manager/README.md @@ -27,7 +27,7 @@ Use the **Plugins** entry in the Web sidebar to manage the profile's installed b Select **Plugins** in the sidebar. The page reads the inventory and the bundles through `api-remotes` when first opened; a Host without a managed profile shows the page as unavailable. **Official** comes first and lists the bundles the installation ships for switching on — off until switched on, without an uninstall, and tagged **Beta** where the feature is one — followed by the official plugins that registered a configuration page; **Installed** lists the bundles the profile holds. Cards are listed by name, so switching a bundle on or off does not move its card. A dependency without a bundle patch is not a plugin and is not listed unless the profile selects it, in which case it carries a problem tag. Global configuration remains in the Settings **Plugins** section. -The Agent Teams, Agent Teams Web UI, and Auto Authorization Review packages have localized names and descriptions that follow the UI language. Their detail pages retain the full npm package name; other packages display their short package name and original description. +The Agent Teams and Auto Authorization Review packages have localized names and descriptions that follow the UI language. Their detail pages retain the full npm package name; other packages display their short package name and original description. ### Installing a bundle diff --git a/packages/client/ui-plugin-manager/README.zh.md b/packages/client/ui-plugin-manager/README.zh.md index ff7706f1d9..996c6e35d0 100644 --- a/packages/client/ui-plugin-manager/README.zh.md +++ b/packages/client/ui-plugin-manager/README.zh.md @@ -27,7 +27,7 @@ kind: "package-reference" 在侧栏选择**插件**。页面首次打开时通过 `api-remotes` 读取清单与组合包;没有受管 profile 的 Host 上页面显示为不可用。**官方**排在前面,列出安装随附、供开启的组合包——开启前保持关闭、没有卸载、属于 beta 功能的带 **Beta** 标签——其后是注册了配置页的官方插件;**已安装**列出 profile 持有的组合包。卡片按名称排序,启停组合包不会挪动它的卡片。没有组合包 patch 的依赖不是插件,除非 profile 选中了它才会带异常标签列出。全局配置仍在设置的**插件**分区中编辑。 -Agent Teams、Agent Teams Web UI 和 Auto Authorization Review 三个包使用随界面语言切换的本地化名称和描述。详情页保留完整 npm 包名;其他包显示简写包名和原始描述。 +Agent Teams 和 Auto Authorization Review 两个包使用随界面语言切换的本地化名称和描述。详情页保留完整 npm 包名;其他包显示简写包名和原始描述。 ### 安装一个组合包 diff --git a/packages/client/ui-plugin-manager/src/client/locales.ts b/packages/client/ui-plugin-manager/src/client/locales.ts index 63071a5cb7..58576ca278 100644 --- a/packages/client/ui-plugin-manager/src/client/locales.ts +++ b/packages/client/ui-plugin-manager/src/client/locales.ts @@ -17,9 +17,7 @@ export const zh = { bundlesTitle: '已安装', officialTitle: '官方', builtinAgentTeamTitle: '智能体团队', - builtinAgentTeamDescription: '启用智能体团队协作与团队工具。', - builtinAgentTeamWebTitle: '智能体团队 Web 界面', - builtinAgentTeamWebDescription: '在浏览器中查看团队成员、任务看板和成员会话。', + builtinAgentTeamDescription: '启用团队协作、团队工具及成员与任务看板。', builtinAutoReviewTitle: '自动授权审查', builtinAutoReviewDescription: '提供自动审查权限模式,由模型在每次工具调用前判断是否授权。', statusProblem: '异常', @@ -179,9 +177,7 @@ export const en = { bundlesTitle: 'Installed', officialTitle: 'Official', builtinAgentTeamTitle: 'Agent Teams', - builtinAgentTeamDescription: 'Enable agent team collaboration and team tools.', - builtinAgentTeamWebTitle: 'Agent Teams Web UI', - builtinAgentTeamWebDescription: 'View team members, the task board, and teammate sessions in the browser.', + builtinAgentTeamDescription: 'Enable team collaboration, team tools, and the members and task board.', builtinAutoReviewTitle: 'Auto Authorization Review', builtinAutoReviewDescription: 'Add an Auto review permission mode that uses the model to assess authorization before each tool call.', statusProblem: 'Problem', diff --git a/packages/client/ui-plugin-manager/src/client/presentation.ts b/packages/client/ui-plugin-manager/src/client/presentation.ts index b2a50a5d72..5641e71138 100644 --- a/packages/client/ui-plugin-manager/src/client/presentation.ts +++ b/packages/client/ui-plugin-manager/src/client/presentation.ts @@ -13,9 +13,6 @@ const BUILTIN_COPY = new Map { it.each([ ['agent-team-profile', 'builtinAgentTeamTitle', 'builtinAgentTeamDescription'], - ['agent-team-web-profile', 'builtinAgentTeamWebTitle', 'builtinAgentTeamWebDescription'], ['auto-review', 'builtinAutoReviewTitle', 'builtinAutoReviewDescription'], ] as const)('localizes %s across cards, details, switches, and uninstall confirmation', (suffix, titleKey, descriptionKey) => { const name = `@deepseek-ai/dsh-experimental-${suffix}` diff --git a/packages/experimental/README.i18n.yaml b/packages/experimental/README.i18n.yaml index fba483caa6..af98f96967 100644 --- a/packages/experimental/README.i18n.yaml +++ b/packages/experimental/README.i18n.yaml @@ -2,5 +2,5 @@ # side as of the last confirmed-consistent state. Both languages carry equal authority; # after editing either side, bring the other along and re-record with: # pnpm run verify-translation-pairing --write packages/experimental/README.md -README.md: 6bb562cf21703fb153c04d9fc839610563bba6cf -README.zh.md: c586a3a89611bfc78587c2b9a48245d79e67515f +README.md: f9fa7be744ff84993373b0cb15451e1a5d5641a9 +README.zh.md: 58e7d1614f8ab200e0dad8ebb53122b371b5430d diff --git a/packages/experimental/README.md b/packages/experimental/README.md index 6bb562cf21..f9fa7be744 100644 --- a/packages/experimental/README.md +++ b/packages/experimental/README.md @@ -24,9 +24,8 @@ The experimental group contains prototype capabilities whose contracts can chang | Package | Role | ctx key | |---|---|---| -| [`agent-team-profile`](agent-team-profile/README.md) | Published opt-in profile layer for Agent Teams | — | +| [`agent-team-profile`](agent-team-profile/README.md) | Agent Teams collaboration, tools, and Web UI bundle | — | | [`agent-team`](agent-team/README.md) | Named teammates with durable messages and a shared task board | `ctx.agentTeams` | -| [`agent-team-web-profile`](agent-team-web-profile/README.md) | Published opt-in Web layer for Agent Teams | — | | [`client-ui-agent-team`](client-ui-agent-team/README.md) | Team roster, task board, and teammate navigation for Web | — | | [`auto-review`](auto-review/README.md) | Explicit Web layer for same-model review before each native or PTC inner tool call | — | | [`ptc-runtime-python`](ptc-runtime-python/README.md) | CPython subprocess backend for the PTC execution seam | `ctx.ptcRuntime` | diff --git a/packages/experimental/README.zh.md b/packages/experimental/README.zh.md index c586a3a896..58e7d1614f 100644 --- a/packages/experimental/README.zh.md +++ b/packages/experimental/README.zh.md @@ -24,9 +24,8 @@ kind: "package-group" | 包 | 职责 | ctx 键 | |---|---|---| -| [`agent-team-profile`](agent-team-profile/README.zh.md) | Agent Teams 的公开 opt-in profile 层 | — | +| [`agent-team-profile`](agent-team-profile/README.zh.md) | Agent Teams 协作、工具与 Web UI 组合包 | — | | [`agent-team`](agent-team/README.zh.md) | 具名 teammate,成员之间持久消息与共享任务板 | `ctx.agentTeams` | -| [`agent-team-web-profile`](agent-team-web-profile/README.zh.md) | Agent Teams 的公开 opt-in Web 层 | — | | [`client-ui-agent-team`](client-ui-agent-team/README.zh.md) | Web Team roster、任务板与 teammate 导航 | — | | [`auto-review`](auto-review/README.zh.md) | 显式 Web 层,在每个原生或 PTC inner 工具调用前使用同一模型审查 | — | | [`ptc-runtime-python`](ptc-runtime-python/README.zh.md) | PTC 执行 seam 的 CPython 子进程后端 | `ctx.ptcRuntime` | diff --git a/packages/experimental/agent-team-profile/README.i18n.yaml b/packages/experimental/agent-team-profile/README.i18n.yaml index 362d87d9f8..92c5c140a4 100644 --- a/packages/experimental/agent-team-profile/README.i18n.yaml +++ b/packages/experimental/agent-team-profile/README.i18n.yaml @@ -2,5 +2,5 @@ # side as of the last confirmed-consistent state. Both languages carry equal authority; # after editing either side, bring the other along and re-record with: # pnpm run verify-translation-pairing --write packages/experimental/agent-team-profile/README.md -README.md: 9aa294991d76d63a596c1d9afed2f9991f424f20 -README.zh.md: 98db275bbf583b02d1f370008345fa68882dbba1 +README.md: a966d8b0075dba352f7988f6ac19a2bf9d04f0b1 +README.zh.md: 7a5a2a3c2ece254ee5e130c143139d57785c4e00 diff --git a/packages/experimental/agent-team-profile/README.md b/packages/experimental/agent-team-profile/README.md index 9aa294991d..a966d8b007 100644 --- a/packages/experimental/agent-team-profile/README.md +++ b/packages/experimental/agent-team-profile/README.md @@ -1,5 +1,5 @@ --- -description: "Published experimental Agent Teams profile layer over dsh-base with teammate delegation and fresh workflow children." +description: "Enable team collaboration, tools, and the Web roster and task board with one experimental bundle." kind: "package-bundle" --- @@ -9,7 +9,7 @@ English | [中文](README.zh.md) ## Summary -`dsh-experimental-agent-team-profile` is a published experimental profile layer that enables [Agent Teams](../agent-team/README.md) over `@deepseek-ai/dsh-base`. Its patch inserts the Team domain and Team-scoped tools and disables ordinary subagent delegation and the overlapping global continuable-child controls. Workflow remains available with fresh children. The dsh installation ships it as an optional bundle that no shipped profile enables; switch it on from the Web sidebar's Plugins page, or add it explicitly to an initialized profile. +`dsh-experimental-agent-team-profile` enables [Agent Teams](../agent-team/README.md) collaboration, tools, and Web UI with one bundle. Delegate work to teammates and view members, shared tasks, and teammate sessions in Web. Ordinary subagent delegation and overlapping global child controls are disabled; Workflow can still create fresh children. The bundle ships with dsh switched off. Enable it from the Plugins page or add it to an initialized profile. ## Table of Contents @@ -36,6 +36,14 @@ dsh --profile headless "Use Agent Teams to split this task between two teammates The profile must already contain `@deepseek-ai/dsh-base`, whose Subagent services and provider rows this layer consumes. Removing the package with `dsh plugin --profile remove @deepseek-ai/dsh-experimental-agent-team-profile` removes the bundle from the profile's ordered layer list. +Enable Agent Teams on the Web or Desktop Plugins page to activate both tools and UI. For a CLI Web profile, use: + +```sh +dsh plugin --profile web add @deepseek-ai/dsh-experimental-agent-team-profile +``` + +In an existing profile’s `package.json`, keep `@deepseek-ai/dsh-experimental-agent-team-profile` in `dsh.profile.bundles` and remove the separate `@deepseek-ai/dsh-experimental-agent-team-web-profile` entry. User patches targeting `ui-agent-team` still apply. + ### What you get The layer adds the Agent Teams domain and its scoped creation, roster, messaging, interruption, waiting, and task-board tools. Direct delegation uses `spawn_teammate`, which supports fresh and fork context. The `subagent` and `subagent_fork` tools and overlapping global child controls are disabled. Workflow retains the base profile’s `spawn` provider, while the underlying Subagent services and both providers remain available to teammates and workflow. @@ -48,7 +56,7 @@ The layer adds the Agent Teams domain and its scoped creation, roster, messaging
    Implementation internals — click to expand -The package's runtime content is [`cordis.patch.yml`](cordis.patch.yml). Applied after `dsh-base`, the patch disables `tool-subagent-control`, `tool-subagent-list-agents`, `tool-subagent`, and `tool-subagent-fork`, and inserts the Team service and tool rows with explicit providers and limits. +The package's runtime content is [`cordis.patch.yml`](cordis.patch.yml). Applied after `dsh-base`, the patch disables `tool-subagent-control`, `tool-subagent-list-agents`, `tool-subagent`, and `tool-subagent-fork`, and inserts the Team service, tools, and UI with explicit providers and limits. The UI plugin has an inert Host entry; only the Web Client loader mounts its browser entry, so headless needs no Web server. | File | Role | |---|---| @@ -66,6 +74,7 @@ The package's runtime content is [`cordis.patch.yml`](cordis.patch.yml). Applied - [Experimental packages](../README.md) — incubation status and publication policy. - [Agent Teams service](../agent-team/README.md) — durable roster, messaging, and task-board behavior. - [Agent Teams tools](../tool-agent-team/README.md) — the Team-scoped model tool surface. +- [Agent Teams browser UI](../client-ui-agent-team/README.md) — roster, task board, and teammate session navigation. - [Base bundle](../../bundle/base/README.md) — the profile layer this patch extends. ----- @@ -94,6 +103,7 @@ The bundle's composition is prefix-stable while its patch, Team identity, and co - **Opt-in only** — the package ships with the installation switched off; no shipped CLI, Web, SDK, ACP, or Python profile enables it. - **Workflow child tools** — the [Team tool visibility limitation](../tool-agent-team/README.md#known-limitations-and-deferred-work) also applies to workflow children. - **Shared checkout** — every teammate observes the same working directory; this bundle adds no worktree isolation or filesystem locking. +- **Preset-scoped child controls** — Web presets can still mount continuable Subagent controls in their own scope; this top-level bundle does not replace those registrations. - **Base profile required** — the patch depends on row ids and Subagent providers supplied by `dsh-base`; it is not a standalone profile. diff --git a/packages/experimental/agent-team-profile/README.zh.md b/packages/experimental/agent-team-profile/README.zh.md index 98db275bbf..7a5a2a3c2e 100644 --- a/packages/experimental/agent-team-profile/README.zh.md +++ b/packages/experimental/agent-team-profile/README.zh.md @@ -1,5 +1,5 @@ --- -description: "叠加在 dsh-base 上公开发布的实验性 Agent Teams profile 层,提供 teammate 委派与 fresh workflow 子代理。" +description: "在一个实验性组合包中启用团队协作、工具与 Web 成员和任务看板。" kind: "package-bundle" --- @@ -9,7 +9,7 @@ kind: "package-bundle" ## 概述 -`dsh-experimental-agent-team-profile` 是在 `@deepseek-ai/dsh-base` 之上启用 [Agent Teams](../agent-team/README.zh.md) 的公开实验性 profile 层。它的 patch 会插入 Team domain 与 Team-scoped 工具,并禁用普通 subagent 委派和名称重叠的全局 continuable-child control。Workflow 仍可创建 fresh 子代理。dsh 安装随附本包作为可选组合包,随附 profile 都不会启用它;可在 Web 侧栏的插件页开启,或显式添加到已初始化的 profile。 +`dsh-experimental-agent-team-profile` 让 [Agent Teams](../agent-team/README.zh.md) 的团队协作、工具和 Web 界面通过一个组合包启用。开启后可委派 teammate,并在 Web 中查看成员、任务看板和成员会话。普通 subagent 委派及名称重叠的全局 child control 会被禁用;Workflow 仍可创建 fresh 子代理。本包随 dsh 安装提供,默认关闭,可在插件页开启或添加到已初始化的 profile。 ## 目录 @@ -36,6 +36,14 @@ dsh --profile headless "Use Agent Teams to split this task between two teammates profile 必须已经包含 `@deepseek-ai/dsh-base`,本层会使用其中的 Subagent 服务与提供方配置行。执行 `dsh plugin --profile remove @deepseek-ai/dsh-experimental-agent-team-profile` 移除本包时,bundle 也会从 profile 的有序层列表中移除。 +在 Web 或 Desktop 的插件页开启「智能体团队」,即可同时启用工具与界面。CLI 的 Web profile 也可使用以下命令: + +```sh +dsh plugin --profile web add @deepseek-ai/dsh-experimental-agent-team-profile +``` + +已有 profile 的 `package.json` 中,`dsh.profile.bundles` 应只保留 `@deepseek-ai/dsh-experimental-agent-team-profile`,删除独立的 `@deepseek-ai/dsh-experimental-agent-team-web-profile` 条目。用户 patch 中的 `ui-agent-team` 配置仍然有效。 + ### 获得的功能 本层会添加 Agent Teams domain,以及 Team-scoped 创建、roster、消息、interrupt、等待与任务板工具。直接委派使用支持 fresh 和 fork 上下文的 `spawn_teammate`。`subagent`、`subagent_fork` 工具和名称重叠的全局 child control 均被禁用。Workflow 保留 base profile 的 `spawn` 提供方,底层 Subagent 服务和两个提供方仍供 teammate 与 workflow 使用。 @@ -48,7 +56,7 @@ profile 必须已经包含 `@deepseek-ai/dsh-base`,本层会使用其中的 Su
    实现细节——点击展开 -本包的运行时内容是 [`cordis.patch.yml`](cordis.patch.yml)。在 `dsh-base` 之后应用时,patch 会禁用 `tool-subagent-control`、`tool-subagent-list-agents`、`tool-subagent` 和 `tool-subagent-fork`,并以显式 provider 和限制插入 Team 服务与工具行。 +本包的运行时内容是 [`cordis.patch.yml`](cordis.patch.yml)。在 `dsh-base` 之后应用时,patch 会禁用 `tool-subagent-control`、`tool-subagent-list-agents`、`tool-subagent` 和 `tool-subagent-fork`,并以显式 provider 和限制插入 Team 服务、工具和 UI 行。UI 插件的 Host 入口不执行逻辑;只有 Web 客户端加载器会挂载其浏览器入口,因此 headless 无需启动 Web 服务。 | 文件 | 职责 | |---|---| @@ -66,6 +74,7 @@ profile 必须已经包含 `@deepseek-ai/dsh-base`,本层会使用其中的 Su - [实验性包](../README.zh.md)——孵化状态与发布规则。 - [Agent Teams service](../agent-team/README.zh.md)——持久 roster、消息与任务板行为。 - [Agent Teams 工具](../tool-agent-team/README.zh.md)——Team-scoped 模型工具表层。 +- [Agent Teams 浏览器 UI](../client-ui-agent-team/README.zh.md)——成员列表、任务看板与成员会话导航。 - [Base bundle](../../bundle/base/README.zh.md)——本 patch 扩展的 profile 层。 ----- @@ -94,6 +103,7 @@ Team 策略与 schema 由 [`@deepseek-ai/dsh-experimental-tool-agent-team`](../t - **仅显式启用**——本包随安装提供但默认关闭;随附 CLI、Web、SDK、ACP 与 Python profile 都不会启用它。 - **Workflow 子代理工具**——[Team 工具可见性限制](../tool-agent-team/README.zh.md#known-limitations-and-deferred-work)也适用于 workflow 子代理。 - **共享 checkout**——所有 teammate 都观察同一个工作目录;本 bundle 不提供 worktree 隔离或文件系统锁。 +- **预设内的子代理控件**——Web 预设仍可在预设作用域挂载 continuable Subagent 控件;顶层组合包不会替换这些注册。 - **需要 base profile**——本 patch 依赖 `dsh-base` 提供的配置行 id 与 Subagent 提供方;它不是独立 profile。 diff --git a/packages/experimental/agent-team-profile/cordis.patch.yml b/packages/experimental/agent-team-profile/cordis.patch.yml index f1eee0e9ba..5543297c91 100644 --- a/packages/experimental/agent-team-profile/cordis.patch.yml +++ b/packages/experimental/agent-team-profile/cordis.patch.yml @@ -28,3 +28,6 @@ config: freshProvider: spawn forkProvider: fork + + - id: ui-agent-team + name: '@deepseek-ai/dsh-experimental-client-ui-agent-team' diff --git a/packages/experimental/agent-team-profile/package.json b/packages/experimental/agent-team-profile/package.json index 400b82db62..0f110c985b 100644 --- a/packages/experimental/agent-team-profile/package.json +++ b/packages/experimental/agent-team-profile/package.json @@ -1,6 +1,6 @@ { "name": "@deepseek-ai/dsh-experimental-agent-team-profile", - "description": "Experimental profile bundle enabling Agent Teams over dsh-base", + "description": "Agent Teams collaboration, tools, and Web UI in one experimental bundle", "version": "0.1.6-alpha.1", "publishConfig": { "access": "public" @@ -35,6 +35,7 @@ }, "dependencies": { "@deepseek-ai/dsh-experimental-agent-team": "workspace:^", + "@deepseek-ai/dsh-experimental-client-ui-agent-team": "workspace:^", "@deepseek-ai/dsh-experimental-tool-agent-team": "workspace:^" }, "peerDependencies": { diff --git a/packages/experimental/agent-team-profile/tests/profile.spec.ts b/packages/experimental/agent-team-profile/tests/profile.spec.ts index fdebc49182..dd65a021ec 100644 --- a/packages/experimental/agent-team-profile/tests/profile.spec.ts +++ b/packages/experimental/agent-team-profile/tests/profile.spec.ts @@ -21,6 +21,7 @@ describe('Agent Teams profile bundle', () => { expect(manifest.dsh?.bundle?.patch).toBe('./cordis.patch.yml') expect(manifest.dependencies).toMatchObject({ '@deepseek-ai/dsh-experimental-agent-team': 'workspace:^', + '@deepseek-ai/dsh-experimental-client-ui-agent-team': 'workspace:^', '@deepseek-ai/dsh-experimental-tool-agent-team': 'workspace:^', }) @@ -48,5 +49,8 @@ describe('Agent Teams profile bundle', () => { name: '@deepseek-ai/dsh-experimental-tool-agent-team', config: { freshProvider: 'spawn', forkProvider: 'fork' }, }) + expect(inserted.find(entry => entry.id === 'ui-agent-team')).toMatchObject({ + name: '@deepseek-ai/dsh-experimental-client-ui-agent-team', + }) }) }) diff --git a/packages/experimental/agent-team-web-profile/README.i18n.yaml b/packages/experimental/agent-team-web-profile/README.i18n.yaml deleted file mode 100644 index 9febb49882..0000000000 --- a/packages/experimental/agent-team-web-profile/README.i18n.yaml +++ /dev/null @@ -1,6 +0,0 @@ -# Bilingual-pair consistency record (docs/i18n/README.md): the git blob hash of each -# side as of the last confirmed-consistent state. Both languages carry equal authority; -# after editing either side, bring the other along and re-record with: -# pnpm run verify-translation-pairing --write packages/experimental/agent-team-web-profile/README.md -README.md: e21a7eeebc83a97d3e4630c95a9aeaa4213bc227 -README.zh.md: 9966697cb7225083a6fff515675b9dd9ecc51c82 diff --git a/packages/experimental/agent-team-web-profile/README.md b/packages/experimental/agent-team-web-profile/README.md deleted file mode 100644 index e21a7eeebc..0000000000 --- a/packages/experimental/agent-team-web-profile/README.md +++ /dev/null @@ -1,98 +0,0 @@ ---- -description: "Add the published experimental Agent Teams panel to a Web profile after the Host Team layer." -kind: "package-bundle" ---- - -# @deepseek-ai/dsh-experimental-agent-team-web-profile - -English | [中文](README.zh.md) - -## Summary - -`dsh-experimental-agent-team-web-profile` is the published experimental Web layer for [Agent Teams](../agent-team/README.md). Add it after `@deepseek-ai/dsh-web-app` and [`@deepseek-ai/dsh-experimental-agent-team-profile`](../agent-team-profile/README.md) to show the Team roster, task board, and teammate navigation in the browser. Removing either experimental layer leaves the stable base and Web composition unchanged. The dsh installation ships it as an optional bundle that no shipped Web profile enables; switch it on from the Web sidebar's Plugins page after the Host layer. - -## Table of Contents - -- [Use this package](#use-this-package) -- [Understand the implementation](#understand-the-implementation) -- [Further Exploration](#further-exploration) -- [Model Experience](#model-experience) -- [Known Limitations and Deferred Work](#known-limitations-and-deferred-work) -- [Dev Note](#dev-note) - ------ - - -## Use this package - -### Install into a profile - -Add the Host and Web Agent Teams layers to an initialized `web` profile in this order: - -```sh -dsh plugin --profile web add @deepseek-ai/dsh-experimental-agent-team-profile -dsh plugin --profile web add @deepseek-ai/dsh-experimental-agent-team-web-profile -``` - -The first command supplies the Team domain, generated Remote methods, and model tools. The second command activates this package's declared patch and its browser presentation. Removing the package with `dsh plugin --profile web remove @deepseek-ai/dsh-experimental-agent-team-web-profile` removes the Web layer from the profile's ordered bundle list. - -### What you get - -The conversation header gains the Team roster, shared task board, and teammate navigation. [`@deepseek-ai/dsh-experimental-client-ui-agent-team`](../client-ui-agent-team/README.md) owns those browser interactions and mounts the generated Client Remote namespace used to reach the Host Team service. - ------ - - -## Understand the implementation - -
    -Implementation internals — click to expand - -The package's runtime content is [`cordis.patch.yml`](cordis.patch.yml). Applied after `dsh-web-app` and the Host Agent Teams layer, its single `insert` entry adds the `ui-agent-team` row for `@deepseek-ai/dsh-experimental-client-ui-agent-team`. The inserted Client plugin owns the generated Remote assembly and Team UI; this static bundle holds no mutable state and installs no runtime invariant. - -| File | Role | -|---|---| -| [`cordis.patch.yml`](cordis.patch.yml) | Ordered Web patch containing the `ui-agent-team` row | -| [`src/index.ts`](src/index.ts) | Empty module entry; the patch is the runtime content | -| — | No runtime invariant companion is published; the package carries only a static profile patch. The Remote assembly and Team UI own their activation requirements. | - -
    - ------ - - -## Further Exploration - -- [Experimental packages](../README.md) — incubation status and publication policy. -- [Agent Teams Host profile](../agent-team-profile/README.md) — the required domain, Remote, and model-tool layer. -- [Agent Teams browser UI](../client-ui-agent-team/README.md) — roster, task-board, and teammate-navigation behavior. -- [Web bundle](../../bundle/web-app/README.md) — the stable browser layer this patch extends. - ------ - - -## Model Experience - -Indirectly, through the Host-side Agent Teams profile selected alongside this Web layer. - -#### KV Cache effect - -This Web bundle adds no model request content; the Host-side Team tools own prompt, schema, and cache effects. - -## Known Limitations and Deferred Work - - - -- **Ordered composition** — `dsh-base`, `dsh-web-app`, `dsh-experimental-agent-team-profile`, and this package must remain in that order. -- **Preset-scoped legacy controls** — stable Web presets still mount continuable Subagent controls inside the preset scope. Top-level Host profile overrides do not replace those scoped registrations, so the Team roster and legacy child controls can both appear until Web has a Team-aware preset. The [Web Agent Teams decision](../../../.agents/notes/archived/feature/2026-08-06-agent-teams-web.md) records this deferred composition work. -- **Opt-in only** — the package ships with the installation switched off; no shipped Web profile enables either Agent Teams layer. - - -### Dev Note - -
    -Working context for maintainers — click to expand - -None. - -
    diff --git a/packages/experimental/agent-team-web-profile/README.zh.md b/packages/experimental/agent-team-web-profile/README.zh.md deleted file mode 100644 index 9966697cb7..0000000000 --- a/packages/experimental/agent-team-web-profile/README.zh.md +++ /dev/null @@ -1,98 +0,0 @@ ---- -description: "在 Host Team 层之后,为 Web profile 添加公开发布的实验性 Agent Teams 面板。" -kind: "package-bundle" ---- - -# @deepseek-ai/dsh-experimental-agent-team-web-profile - -[English](README.md) | 中文 - -## 概述 - -`dsh-experimental-agent-team-web-profile` 是 [Agent Teams](../agent-team/README.zh.md) 公开发布的实验性 Web 层。把它放在 `@deepseek-ai/dsh-web-app` 与 [`@deepseek-ai/dsh-experimental-agent-team-profile`](../agent-team-profile/README.zh.md) 之后,即可在浏览器中显示 Team roster、任务板与 teammate 导航。移除任一实验层都会让稳定的 base 与 Web composition 保持不变。dsh 安装随附本包作为可选组合包,随附 Web profile 不会启用它;在开启 Host 层后可在 Web 侧栏的插件页开启。 - -## 目录 - -- [使用本包](#use-this-package) -- [理解实现](#understand-the-implementation) -- [进一步探索](#further-exploration) -- [模型体验](#model-experience) -- [已知限制与延期工作](#known-limitations-and-deferred-work) -- [开发备注](#dev-note) - ------ - - -## 使用本包 - -### 安装到 profile - -按以下顺序把 Host 与 Web Agent Teams 层添加到已初始化的 `web` profile: - -```sh -dsh plugin --profile web add @deepseek-ai/dsh-experimental-agent-team-profile -dsh plugin --profile web add @deepseek-ai/dsh-experimental-agent-team-web-profile -``` - -第一条命令提供 Team domain、生成的 Remote 方法与模型工具。第二条命令激活本包声明的 patch 及其浏览器 presentation。执行 `dsh plugin --profile web remove @deepseek-ai/dsh-experimental-agent-team-web-profile` 移除本包时,Web 层也会从 profile 的有序 bundle 列表中移除。 - -### 获得的功能 - -对话标题栏会获得 Team roster、共享任务板与 teammate 导航。[`@deepseek-ai/dsh-experimental-client-ui-agent-team`](../client-ui-agent-team/README.zh.md) 负责这些浏览器交互,并挂载用于访问 Host Team service 的生成 Client Remote namespace。 - ------ - - -## 理解实现 - -
    -实现细节——点击展开 - -本包的运行时内容是 [`cordis.patch.yml`](cordis.patch.yml)。在 `dsh-web-app` 与 Host Agent Teams 层之后应用时,它唯一的 `insert` 条目会为 `@deepseek-ai/dsh-experimental-client-ui-agent-team` 添加 `ui-agent-team` 行。插入的 Client 插件负责生成的 Remote assembly 与 Team UI;这个静态 bundle 不持有可变状态,也不安装运行时不变式。 - -| 文件 | 职责 | -|---|---| -| [`cordis.patch.yml`](cordis.patch.yml) | 包含 `ui-agent-team` 行的有序 Web patch | -| [`src/index.ts`](src/index.ts) | 空模块入口;patch 是运行时内容 | -| — | 不发布运行时不变式伴生入口;本包只携带静态 profile patch,Remote assembly 与 Team UI 负责各自的激活要求。 | - -
    - ------ - - -## 进一步探索 - -- [实验性包](../README.zh.md)——孵化状态与发布规则。 -- [Agent Teams Host profile](../agent-team-profile/README.zh.md)——所需的 domain、Remote 与模型工具层。 -- [Agent Teams 浏览器 UI](../client-ui-agent-team/README.zh.md)——roster、任务板与 teammate 导航行为。 -- [Web bundle](../../bundle/web-app/README.zh.md)——本 patch 扩展的稳定浏览器层。 - ------ - - -## 模型体验 - -通过与本 Web 层同时选择的 Host-side Agent Teams profile 间接产生影响。 - -#### KV Cache 影响 - -本 Web bundle 不添加任何模型请求内容;Host-side Team 工具负责提示词、schema 与缓存影响。 - -## 已知限制与延期工作 - - - -- **有序组合**——`dsh-base`、`dsh-web-app`、`dsh-experimental-agent-team-profile` 与本包必须保持这个顺序。 -- **Preset-scoped 旧控制项**——稳定 Web preset 仍会在 preset scope 内挂载 continuable Subagent 控制项。顶层 Host profile override 不会替换这些 scoped registration,因此在 Web 获得 Team-aware preset 前,Team roster 与旧 child 控制项可能同时出现。[Web Agent Teams 决策](../../../.agents/notes/archived/feature/2026-08-06-agent-teams-web.md)记录了这项暂缓的 composition 工作。 -- **仅显式启用**——本包随安装提供但默认关闭;随附 Web profile 不会启用任何 Agent Teams 层。 - - -### 开发备注 - -
    -维护者的工作上下文——点击展开 - -无。 - -
    diff --git a/packages/experimental/agent-team-web-profile/cordis.patch.yml b/packages/experimental/agent-team-web-profile/cordis.patch.yml deleted file mode 100644 index e9cffef438..0000000000 --- a/packages/experimental/agent-team-web-profile/cordis.patch.yml +++ /dev/null @@ -1,6 +0,0 @@ -# Experimental Agent Teams Web layer. Apply after dsh-web-app and the host-side -# dsh-agent-team-profile so the browser mounts only when the Team service is present. - -- insert: - - id: ui-agent-team - name: '@deepseek-ai/dsh-experimental-client-ui-agent-team' diff --git a/packages/experimental/agent-team-web-profile/package.json b/packages/experimental/agent-team-web-profile/package.json deleted file mode 100644 index ad91bced8d..0000000000 --- a/packages/experimental/agent-team-web-profile/package.json +++ /dev/null @@ -1,47 +0,0 @@ -{ - "name": "@deepseek-ai/dsh-experimental-agent-team-web-profile", - "description": "Experimental Web profile layer for Agent Teams Remote and UI plugins", - "version": "0.1.6-alpha.1", - "publishConfig": { - "access": "public" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/deepseek-ai/deepseek-harness.git", - "directory": "packages/experimental/agent-team-web-profile" - }, - "type": "module", - "main": "lib/index.js", - "types": "lib/types/index.d.ts", - "exports": { - ".": { - "types": "./lib/types/index.d.ts", - "default": "./lib/index.js" - }, - "./cordis.patch.yml": "./cordis.patch.yml", - "./src/*": "./src/*", - "./package.json": "./package.json" - }, - "files": [ - "lib/index.js", - "cordis.patch.yml", - "lib/types/**/*.d.ts" - ], - "license": "MIT", - "dsh": { - "bundle": { - "patch": "./cordis.patch.yml" - } - }, - "dependencies": { - "@deepseek-ai/dsh-experimental-client-ui-agent-team": "workspace:^" - }, - "peerDependencies": { - "@deepseek-ai/cordis": "workspace:^" - }, - "devDependencies": { - "@deepseek-ai/cordis-plugin-include": "workspace:^", - "@deepseek-ai/cordis": "workspace:^", - "js-yaml": "^4.2.0" - } -} diff --git a/packages/experimental/agent-team-web-profile/src/index.ts b/packages/experimental/agent-team-web-profile/src/index.ts deleted file mode 100644 index 726f066041..0000000000 --- a/packages/experimental/agent-team-web-profile/src/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -/** Experimental Web profile layer for the Agent Teams Client plugins. */ - -export {} diff --git a/packages/experimental/agent-team-web-profile/tests/profile.spec.ts b/packages/experimental/agent-team-web-profile/tests/profile.spec.ts deleted file mode 100644 index 21fde2cab5..0000000000 --- a/packages/experimental/agent-team-web-profile/tests/profile.spec.ts +++ /dev/null @@ -1,34 +0,0 @@ -/** The experimental Web bundle must carry one parseable Team Client layer. */ - -import { readFileSync } from 'node:fs' -import { fileURLToPath } from 'node:url' -import { resolve } from 'node:path' -import { describe, expect, it } from 'vitest' -import * as yaml from 'js-yaml' -import { entryListSchema } from '@deepseek-ai/cordis-plugin-include' - -describe('Agent Teams Web profile bundle', () => { - it('declares a public parseable layer containing the Team UI', () => { - const root = fileURLToPath(new URL('..', import.meta.url)) - const manifest = JSON.parse(readFileSync(resolve(root, 'package.json'), 'utf8')) as { - private?: boolean - publishConfig?: { access?: string } - dependencies?: Record - dsh?: { bundle?: { patch?: string } } - } - expect(manifest.private).toBeUndefined() - expect(manifest.publishConfig?.access).toBe('public') - expect(manifest.dsh?.bundle?.patch).toBe('./cordis.patch.yml') - expect(manifest.dependencies).toEqual({ - '@deepseek-ai/dsh-experimental-client-ui-agent-team': 'workspace:^', - }) - - const parsed = yaml.load( - readFileSync(resolve(root, manifest.dsh!.bundle!.patch!), 'utf8'), - { schema: entryListSchema }, - ) as { insert?: { id?: string; name?: string }[] }[] - expect(parsed.flatMap(patch => patch.insert ?? [])).toEqual([ - { id: 'ui-agent-team', name: '@deepseek-ai/dsh-experimental-client-ui-agent-team' }, - ]) - }) -}) diff --git a/packages/experimental/agent-team-web-profile/tsconfig.json b/packages/experimental/agent-team-web-profile/tsconfig.json deleted file mode 100644 index d4186340bf..0000000000 --- a/packages/experimental/agent-team-web-profile/tsconfig.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "extends": "../../../tsconfig.base.json", - "compilerOptions": { - "rootDir": "src", - "outDir": "lib/types" - }, - "include": ["src"], - "references": [ - { "path": "../../../vendor/cordis" } - ] -} diff --git a/packages/experimental/client-ui-agent-team/README.i18n.yaml b/packages/experimental/client-ui-agent-team/README.i18n.yaml index d4a0ae340d..cd2160bf66 100644 --- a/packages/experimental/client-ui-agent-team/README.i18n.yaml +++ b/packages/experimental/client-ui-agent-team/README.i18n.yaml @@ -2,5 +2,5 @@ # side as of the last confirmed-consistent state. Both languages carry equal authority; # after editing either side, bring the other along and re-record with: # pnpm run verify-translation-pairing --write packages/experimental/client-ui-agent-team/README.md -README.md: ab40e2de09406991c55160005f2f16cf6931e195 -README.zh.md: 2913ff65930f260d53a0bee3b3ed6cb9634fcd5a +README.md: 01e3c0e94ba0258f042ed405cd4e7e9be0dc91da +README.zh.md: 04adada51e3b1c106e27e80d2b1f40a7d15c2a26 diff --git a/packages/experimental/client-ui-agent-team/README.md b/packages/experimental/client-ui-agent-team/README.md index ab40e2de09..01e3c0e94b 100644 --- a/packages/experimental/client-ui-agent-team/README.md +++ b/packages/experimental/client-ui-agent-team/README.md @@ -9,7 +9,7 @@ English | [中文](README.zh.md) ## Summary -This package adds an Agent Teams action to the Web conversation header, where a user can inspect the current roster, manage the shared task board, and navigate into a teammate's conversation. It reads authoritative Team state through the generated `ctx.remote.agentTeams` contribution and keeps ordinary child-history navigation on the stable addressed-subagent path. Choose it through the published experimental Agent Teams Web profile. The browser projection does not extend the stable API Proxy, store Team state, or register model-facing input. +This package adds an Agent Teams action to the Web conversation header, where a user can inspect the current roster, manage the shared task board, and navigate into a teammate's conversation. It reads authoritative Team state through the generated `ctx.remote.agentTeams` contribution and keeps ordinary child-history navigation on the stable addressed-subagent path. Choose it through the published experimental Agent Teams bundle. The browser projection does not extend the stable API Proxy, store Team state, or register model-facing input. ## Table of Contents @@ -25,7 +25,7 @@ This package adds an Agent Teams action to the Web conversation header, where a ## Use this package -Install the package through [`@deepseek-ai/dsh-experimental-agent-team-web-profile`](../agent-team-web-profile/README.md) after the stable Web bundle and the Host-side Agent Teams profile. The Web Client loader mounts the `/client` export; the root Host export is inert, and the package has no user configuration fields. +Enable this package through [`@deepseek-ai/dsh-experimental-agent-team-profile`](../agent-team-profile/README.md), which supplies the Team service, tools, and Web UI together. The Web Client loader mounts the `/client` export; the root Host export is inert, and the package has no user configuration fields. ### Inspect and navigate the roster @@ -61,7 +61,7 @@ Starting a create or update invalidates older refreshes. Success reloads the com ## Further Exploration -- [Agent Teams Web profile](../agent-team-web-profile/README.md) — the published opt-in bundle that mounts this Client plugin. +- [Agent Teams bundle](../agent-team-profile/README.md) — the published opt-in bundle that mounts this Client plugin. - [Agent Teams service](../agent-team/README.md) — authoritative roster, task, and Remote behavior. - [Conversation UI](../../client/ui-conversation/README.md) — the stable header slot and addressed-subagent navigation surface. - [Experimental packages](../README.md) — incubation status and publication policy. diff --git a/packages/experimental/client-ui-agent-team/README.zh.md b/packages/experimental/client-ui-agent-team/README.zh.md index 2913ff6593..04adada51e 100644 --- a/packages/experimental/client-ui-agent-team/README.zh.md +++ b/packages/experimental/client-ui-agent-team/README.zh.md @@ -9,7 +9,7 @@ kind: "package-reference" ## 概述 -本包向 Web 会话页头添加 Agent Teams action,让用户检查当前 roster、管理共享任务板并导航到 teammate 会话。它通过生成的 `ctx.remote.agentTeams` contribution 读取权威 Team 状态,并让普通 child history 导航继续使用稳定的 addressed-subagent 路径。通过公开发布的实验性 Agent Teams Web profile 选择本包。这个浏览器 projection 不扩展稳定 API Proxy、不存储 Team 状态,也不注册面向模型的输入。 +本包向 Web 会话页头添加 Agent Teams action,让用户检查当前 roster、管理共享任务板并导航到 teammate 会话。它通过生成的 `ctx.remote.agentTeams` contribution 读取权威 Team 状态,并让普通 child history 导航继续使用稳定的 addressed-subagent 路径。通过公开发布的实验性 Agent Teams bundle 选择本包。这个浏览器 projection 不扩展稳定 API Proxy、不存储 Team 状态,也不注册面向模型的输入。 ## 目录 @@ -25,7 +25,7 @@ kind: "package-reference" ## 使用本包 -在稳定 Web bundle 与 Host-side Agent Teams profile 之后,通过 [`@deepseek-ai/dsh-experimental-agent-team-web-profile`](../agent-team-web-profile/README.zh.md) 安装本包。Web Client loader 挂载 `/client` export;root Host export 不执行行为,本包也没有用户配置字段。 +通过 [`@deepseek-ai/dsh-experimental-agent-team-profile`](../agent-team-profile/README.zh.md) 启用本包。这个组合包同时提供团队服务、工具与 Web 界面。Web Client loader 挂载 `/client` export;root Host export 不执行行为,本包也没有用户配置字段。 ### 检查并导航 roster @@ -61,7 +61,7 @@ Client export 挂载来自 [`@deepseek-ai/dsh-experimental-agent-team/remote`](. ## 进一步探索 -- [Agent Teams Web profile](../agent-team-web-profile/README.zh.md)——挂载本 Client plugin 的公开 opt-in bundle。 +- [Agent Teams bundle](../agent-team-profile/README.zh.md)——挂载本 Client plugin 的公开 opt-in bundle。 - [Agent Teams service](../agent-team/README.zh.md)——权威 roster、task 与 Remote 行为。 - [会话 UI](../../client/ui-conversation/README.zh.md)——稳定 header slot 与 addressed-subagent 导航表层。 - [实验性包](../README.zh.md)——孵化状态与发布规则。 diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 13ab4ef874..530592e245 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -219,9 +219,6 @@ importers: '@deepseek-ai/dsh-experimental-agent-team-profile': specifier: workspace:^ version: link:../../packages/experimental/agent-team-profile - '@deepseek-ai/dsh-experimental-agent-team-web-profile': - specifier: workspace:^ - version: link:../../packages/experimental/agent-team-web-profile '@deepseek-ai/dsh-fs-local': specifier: workspace:^ version: link:../../packages/fs/fs-local @@ -6202,25 +6199,12 @@ importers: '@deepseek-ai/dsh-experimental-agent-team': specifier: workspace:^ version: link:../agent-team - '@deepseek-ai/dsh-experimental-tool-agent-team': - specifier: workspace:^ - version: link:../tool-agent-team - devDependencies: - '@deepseek-ai/cordis': - specifier: workspace:^ - version: link:../../../vendor/cordis - '@deepseek-ai/cordis-plugin-include': - specifier: workspace:^ - version: link:../../../vendor/include - js-yaml: - specifier: ^4.2.0 - version: 4.3.1 - - packages/experimental/agent-team-web-profile: - dependencies: '@deepseek-ai/dsh-experimental-client-ui-agent-team': specifier: workspace:^ version: link:../client-ui-agent-team + '@deepseek-ai/dsh-experimental-tool-agent-team': + specifier: workspace:^ + version: link:../tool-agent-team devDependencies: '@deepseek-ai/cordis': specifier: workspace:^ diff --git a/scripts/release/families.spec.ts b/scripts/release/families.spec.ts index 2353f6a81e..6ae3d23702 100644 --- a/scripts/release/families.spec.ts +++ b/scripts/release/families.spec.ts @@ -49,7 +49,6 @@ describe('release families', () => { .filter(member => member.directory.startsWith('packages/experimental/')) .map(member => member.name)).toEqual([ '@deepseek-ai/dsh-experimental-agent-team-profile', - '@deepseek-ai/dsh-experimental-agent-team-web-profile', '@deepseek-ai/dsh-experimental-agent-team', '@deepseek-ai/dsh-experimental-auto-review', '@deepseek-ai/dsh-experimental-browser-use-chrome-devtools-mcp', diff --git a/scripts/verify-package-readme-model-experience.ts b/scripts/verify-package-readme-model-experience.ts index a3c030bc0b..33363b380e 100644 --- a/scripts/verify-package-readme-model-experience.ts +++ b/scripts/verify-package-readme-model-experience.ts @@ -93,7 +93,6 @@ const SENTENCE_MODEL_EXPERIENCE: Readonly> = { 'packages/client/connection': { kind: 'none', reason: 'Browser-side UI plugin layer; registers nothing model-facing.' }, 'packages/client/file-upload': { kind: 'none', reason: 'Browser-side request-body transport; registers nothing model-facing.' }, 'packages/api/remotes': { kind: 'none', reason: 'The Remote BFF selects business methods and forwarded events; selected services own any model-visible effect.' }, - 'packages/experimental/agent-team-web-profile': { kind: 'indirect', reason: 'The Web layer delegates model composition to the Host-side Agent Teams profile.' }, 'packages/experimental/client-ui-agent-team': { kind: 'none', reason: 'The browser projection and task controls register no model-facing input.' }, 'packages/client/ui-layout': { kind: 'none', reason: 'Browser-side UI plugin layer; registers nothing model-facing.' }, 'packages/client/ui-dockkit': { kind: 'none', reason: 'Browser-side docking layout engine and components; registers nothing model-facing.' }, diff --git a/tsconfig.base.json b/tsconfig.base.json index 6ec529b39d..3cace3bae1 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -272,7 +272,6 @@ "@deepseek-ai/dsh-experimental-agent-team": ["./packages/experimental/agent-team/src"], "@deepseek-ai/dsh-experimental-auto-review": ["./packages/experimental/auto-review/src"], "@deepseek-ai/dsh-experimental-agent-team-profile": ["./packages/experimental/agent-team-profile/src"], - "@deepseek-ai/dsh-experimental-agent-team-web-profile": ["./packages/experimental/agent-team-web-profile/src"], "@deepseek-ai/dsh-experimental-tool-agent-team": ["./packages/experimental/tool-agent-team/src"], "@deepseek-ai/dsh-experimental-webworker-runtime": ["./packages/experimental/webworker-runtime/src"], "@deepseek-ai/dsh-experimental-webworker-packer": ["./packages/experimental/webworker-packer/src"], diff --git a/tsconfig.host.json b/tsconfig.host.json index 2b98af6f58..95eae65e56 100644 --- a/tsconfig.host.json +++ b/tsconfig.host.json @@ -369,7 +369,6 @@ { "path": "./packages/experimental/agent-team" }, { "path": "./packages/experimental/agent-team-profile" }, { "path": "./packages/experimental/tool-agent-team" }, - { "path": "./packages/experimental/agent-team-web-profile" }, { "path": "./packages/workflow/workflow" }, { "path": "./packages/workflow/workflow-ptc" }, { "path": "./packages/workflow/tool-workflow" }, From 9b27cc0587ccbdd79019483b7db72abc95fe4159 Mon Sep 17 00:00:00 2001 From: yudshj Date: Fri, 18 Sep 2026 11:05:13 +0800 Subject: [PATCH 21/75] fix(web): move Office font warnings into the document toolbar --- .../2026-09-11-node-office-kit.i18n.yaml | 4 +- .../2026-09-11-node-office-kit.md | 2 +- .../2026-09-11-node-office-kit.zh.md | 2 +- apps/web/tests/document-preview.e2e.ts | 40 +++++---- apps/web/tests/expected/office-font-notice.md | 11 +-- .../README.i18n.yaml | 4 +- .../ui-sidebar-documentpreview/README.md | 4 +- .../ui-sidebar-documentpreview/README.zh.md | 4 +- .../src/client/TextPreview.tsx | 3 +- .../src/client/document/contract.ts | 8 ++ .../src/client/icons.tsx | 9 ++ .../src/client/index.ts | 1 + .../src/client/office/FontNotice.module.css | 88 +++---------------- .../src/client/office/FontNotice.tsx | 70 +++++---------- .../src/client/office/OfficeBody.tsx | 6 +- .../src/client/office/OfficeFontAction.tsx | 21 +++++ .../src/client/office/index.ts | 4 + .../src/client/office/locales.ts | 8 +- .../tests/apply.client.spec.ts | 2 + .../tests/fixtures.client.ts | 6 +- .../tests/office-font-notice.client.spec.tsx | 31 ++++--- .../tests/office-registration.client.spec.ts | 2 +- .../tests/renderer-loading.client.spec.tsx | 37 +++++++- .../src/client/slot-catalog.ts | 50 ++++++++++- 24 files changed, 229 insertions(+), 188 deletions(-) create mode 100644 packages/client/ui-sidebar-documentpreview/src/client/office/OfficeFontAction.tsx diff --git a/.agents/notes/implemented/architecture/2026-09-11-node-office-kit.i18n.yaml b/.agents/notes/implemented/architecture/2026-09-11-node-office-kit.i18n.yaml index 5ab066c127..c27ef04676 100644 --- a/.agents/notes/implemented/architecture/2026-09-11-node-office-kit.i18n.yaml +++ b/.agents/notes/implemented/architecture/2026-09-11-node-office-kit.i18n.yaml @@ -2,5 +2,5 @@ # side as of the last confirmed-consistent state. Both languages carry equal authority; # after editing either side, bring the other along and re-record with: # pnpm run verify-translation-pairing --write .agents/notes/implemented/architecture/2026-09-11-node-office-kit.md -2026-09-11-node-office-kit.md: d77d6c5392532f39a9993af60faad6474bc8f36c -2026-09-11-node-office-kit.zh.md: a0cbd22e4f06bd4f2878adf27852f9d2378b8b33 +2026-09-11-node-office-kit.md: 6cab947d7cb8d4c2c416a83f0b765813c7f98ea9 +2026-09-11-node-office-kit.zh.md: 8ed1a81922249cf0b9c1a74b06e5ce9d44696e0a diff --git a/.agents/notes/implemented/architecture/2026-09-11-node-office-kit.md b/.agents/notes/implemented/architecture/2026-09-11-node-office-kit.md index d77d6c5392..6cab947d7c 100644 --- a/.agents/notes/implemented/architecture/2026-09-11-node-office-kit.md +++ b/.agents/notes/implemented/architecture/2026-09-11-node-office-kit.md @@ -22,7 +22,7 @@ The kit owns default serif, sans-serif, and monospace preference groups, includi DSH exports raster images at configurable resolution, defaulting to 192 DPI for the shared PDF canvas's 96 CSS DPI at device-pixel ratio 2. Text and vectors remain scalable; explicit bookmark export preserves the engine default when JSON filter options replace it. Node WASM downscales images with LibreOffice's CPU filter. Native conversion uses its separate platform engine. -The [Office viewer](../../../../packages/client/ui-sidebar-documentpreview/README.md#office-preview) lives under Document Preview’s `client/office/` directory, alongside the loading lifecycle, PDF body, and reader types it uses. Keeping these components in one package removes an independent UI boot entry without creating cross-plugin runtime imports. Its bounded cache validates authorized source metadata, shares pending conversions between readers, cancels only when the final reader leaves, excludes failures, and clears on connection reset. Conversion starts when a user opens a preview. Missing declared font families accompany the PDF and appear in a dismissible notice above the Office scrollport; font-table inventories and unrelated engine defaults are not warnings. The shared preview entry’s `office` cache settings use the existing page-global injection channel because the module boot graph carries package identities, not Loader configuration. Reloading the page adopts updated YAML values. +The [Office viewer](../../../../packages/client/ui-sidebar-documentpreview/README.md#office-preview) lives under Document Preview’s `client/office/` directory, alongside the loading lifecycle, PDF body, and reader types it uses. Keeping these components in one package removes an independent UI boot entry without creating cross-plugin runtime imports. Its bounded cache validates authorized source metadata, shares pending conversions between readers, cancels only when the final reader leaves, excludes failures, and clears on connection reset. Conversion starts when a user opens a preview. Missing declared font families accompany the PDF and are available from the document toolbar’s warning icon; font-table inventories and unrelated engine defaults are not warnings. The shared preview entry’s `office` cache settings use the existing page-global injection channel because the module boot graph carries package identities, not Loader configuration. Reloading the page adopts updated YAML values. Ordinary file reads and Office responses share `documentFileBytes()`, which decodes into one typed byte buffer rather than materializing a JavaScript element array from the binary string. Element-array expansion can exhaust the browser heap for a PDF that the configured Host limits permit. A child-process regression checks byte equality within a fixed heap, while the built browser scenario verifies the transport and PDF Worker together. Cache byte limits do not bound transient transport or viewer memory. diff --git a/.agents/notes/implemented/architecture/2026-09-11-node-office-kit.zh.md b/.agents/notes/implemented/architecture/2026-09-11-node-office-kit.zh.md index a0cbd22e4f..8ed1a81922 100644 --- a/.agents/notes/implemented/architecture/2026-09-11-node-office-kit.zh.md +++ b/.agents/notes/implemented/architecture/2026-09-11-node-office-kit.zh.md @@ -22,7 +22,7 @@ kit 维护 serif、sans-serif 和 monospace 的默认优先组,其中包含中 DSH 按可配置分辨率导出栅格图片,默认 192 DPI,对应共享 PDF 画布在设备像素比 2 时的 96 CSS DPI。文本与矢量仍可缩放;JSON 过滤选项替代隐式选项时,显式书签导出保留引擎默认行为。Node WASM 使用 LibreOffice 的 CPU 过滤器降采样图片。原生转换使用独立的平台引擎。 -[Office 查看器](../../../../packages/client/ui-sidebar-documentpreview/README.zh.md#office-preview)位于文档预览的 `client/office/` 目录,与其使用的加载生命周期、PDF 正文和读取器类型同属一个包。这些组件放在同一包中,既减少一个独立 UI 启动入口,也无需跨插件运行时导入。其有界缓存校验已授权的源元数据,在读取方之间共享待完成转换,仅在最后一个读取方离开时取消,不缓存失败,并在连接重置时清空。用户打开预览时才开始转换。缺失的已声明字体族随 PDF 返回,在 Office 滚动区上方显示可关闭的提示;字体表清单与无关的引擎默认字体不构成警告。共享预览入口的 `office` 缓存设置复用页面全局注入通道,因为模块启动图携带包标识而不传递 Loader 配置。重新加载页面后采用更新的 YAML 值。 +[Office 查看器](../../../../packages/client/ui-sidebar-documentpreview/README.zh.md#office-preview)位于文档预览的 `client/office/` 目录,与其使用的加载生命周期、PDF 正文和读取器类型同属一个包。这些组件放在同一包中,既减少一个独立 UI 启动入口,也无需跨插件运行时导入。其有界缓存校验已授权的源元数据,在读取方之间共享待完成转换,仅在最后一个读取方离开时取消,不缓存失败,并在连接重置时清空。用户打开预览时才开始转换。缺失的已声明字体族随 PDF 返回,可通过文档工具栏的警告图标查看;字体表清单与无关的引擎默认字体不构成警告。共享预览入口的 `office` 缓存设置复用页面全局注入通道,因为模块启动图携带包标识而不传递 Loader 配置。重新加载页面后采用更新的 YAML 值。 普通文件读取与 Office 响应共享 `documentFileBytes()`,解码使用一个类型化字节缓冲区,不将二进制字符串物化为 JavaScript 元素数组。即使 PDF 符合 Host 配置的大小限制,元素数组展开也可能耗尽浏览器堆内存。子进程回归测试在固定堆容量内检查字节一致性,构建后的浏览器场景则一起验证传输和 PDF Worker。缓存字节限制不约束临时传输或查看器内存。 diff --git a/apps/web/tests/document-preview.e2e.ts b/apps/web/tests/document-preview.e2e.ts index 24137b06ad..2d36397c57 100644 --- a/apps/web/tests/document-preview.e2e.ts +++ b/apps/web/tests/document-preview.e2e.ts @@ -675,44 +675,52 @@ describe.skipIf(MODE === 'record')('web e2e: Host Office preview', () => { await preview.getByRole('button', { name: 'Read the file again', exact: true }).click() await canvas.waitFor({ state: 'visible' }) expect(convert).toHaveBeenCalledTimes(1) - const notice = preview.locator('[data-office-font-notice]') - const more = notice.getByRole('button', { name: 'Show more', exact: true }) - await more.waitFor({ state: 'visible' }) + const warning = preview.locator('[data-office-font-warning]').getByRole('button') + await warning.waitFor({ state: 'visible' }) + expect(await warning.getAttribute('aria-expanded')).toBe('false') + expect(await page.getByRole('dialog', { name: 'Missing fonts', exact: true }).count()).toBe(0) + const warningBox = (await warning.boundingBox())! + const reloadBox = (await preview.getByRole('button', { name: 'Read the file again', exact: true }).boundingBox())! + expect(warningBox.x + warningBox.width).toBeLessThanOrEqual(reloadBox.x) + expect(Math.abs(warningBox.y + warningBox.height / 2 - reloadBox.y - reloadBox.height / 2)).toBeLessThan(1) + await warning.hover() + await page.getByRole('tooltip', { name: /Missing fonts:/ }).waitFor({ state: 'visible' }) const before = await canvas.evaluate(node => node.getBoundingClientRect().top) - await more.click() + await successShot(page, 'office-font-warning') + await warning.click() const details = page.getByRole('dialog', { name: 'Missing fonts', exact: true }) await details.getByText('DSH Missing Preview Font', { exact: true }).waitFor({ state: 'visible' }) + expect(await page.getByRole('tooltip', { name: /Missing fonts:/ }).count()).toBe(0) await successShot(page, 'office-font-details') await page.keyboard.press('Escape') await expect.poll(() => details.count()).toBe(0) - expect(await more.evaluate(node => node === document.activeElement)).toBe(true) - await more.click() + expect(await warning.evaluate(node => node === document.activeElement)).toBe(true) + await warning.click() await page.getByRole('button', { name: 'Close font details', exact: true }).click() - expect(await more.isVisible()).toBe(true) - await notice.getByRole('button', { name: 'Dismiss font notice', exact: true }).click() - await expect.poll(() => notice.evaluate(node => node.getBoundingClientRect().height)).toBe(0) + expect(await warning.isVisible()).toBe(true) const after = await canvas.evaluate(node => node.getBoundingClientRect().top) - expect(before - after).toBeGreaterThan(40) + expect(after).toBe(before) const topInset = await preview.evaluate((node) => { const body = node.querySelector('[data-textpreview-body]')!.getBoundingClientRect() const canvas = node.querySelector('canvas')!.getBoundingClientRect() return canvas.top - body.top }) expect(topInset).toBe(0) - await successShot(page, 'office-font-dismissed') await compareOrRefreshGolden(fileURLToPath(new URL('./expected/office-font-notice.md', import.meta.url)), [ - '# Office font notice', '', + '# Office font warning', '', + '- Warning precedes reload in the same toolbar: true', + '- Details open only on request: true', '- Requested absent family is listed: true', - '- Escape restores focus to Show more: true', - '- Closing details preserves the notice: true', - '- Dismissing the notice collapses its occupied height: 0', - `- Document top inset after dismissal: ${topInset}px`, + '- Escape restores focus to the warning: true', + '- Closing details preserves the warning and document position: true', + `- Document top inset: ${topInset}px`, ].join('\n'), MODE) await successShot(page, 'office-docx') for (const extension of ['doc', 'xls', 'xlsx', 'ppt', 'pptx']) { await openPreviewFile(column, filesTab, preview, `chinese.${extension}`) await preview.getByRole('img', { name: 'PDF page 1', exact: true }).waitFor({ state: 'visible', timeout: 60_000 }) await expect.poll(async () => (await preview.locator('[data-pdf-text]').allTextContents()).join(''), { timeout: 30_000 }).toContain('中文文档') + if (['doc', 'xls', 'ppt'].includes(extension)) expect(await warning.count()).toBe(0) await successShot(page, `office-${extension}`) } expect(convert).toHaveBeenCalledTimes(6) diff --git a/apps/web/tests/expected/office-font-notice.md b/apps/web/tests/expected/office-font-notice.md index 4de2908510..635bb2dd34 100644 --- a/apps/web/tests/expected/office-font-notice.md +++ b/apps/web/tests/expected/office-font-notice.md @@ -1,7 +1,8 @@ -# Office font notice +# Office font warning +- Warning precedes reload in the same toolbar: true +- Details open only on request: true - Requested absent family is listed: true -- Escape restores focus to Show more: true -- Closing details preserves the notice: true -- Dismissing the notice collapses its occupied height: 0 -- Document top inset after dismissal: 0px +- Escape restores focus to the warning: true +- Closing details preserves the warning and document position: true +- Document top inset: 0px diff --git a/packages/client/ui-sidebar-documentpreview/README.i18n.yaml b/packages/client/ui-sidebar-documentpreview/README.i18n.yaml index c9c5f48b0a..edd91f5dff 100644 --- a/packages/client/ui-sidebar-documentpreview/README.i18n.yaml +++ b/packages/client/ui-sidebar-documentpreview/README.i18n.yaml @@ -2,5 +2,5 @@ # side as of the last confirmed-consistent state. Both languages carry equal authority; # after editing either side, bring the other along and re-record with: # pnpm run verify-translation-pairing --write packages/client/ui-sidebar-documentpreview/README.md -README.md: f1d187cf4adc3b0e0400fa02babca1d28bffad15 -README.zh.md: cbdd915fb5e7a307c3c44717d472f63c5b4766b9 +README.md: 5725368ecc02e4d278c6e031d9ef1c8942a5e09d +README.zh.md: d62fc71d6fef2798bd3b7d104f7002415ac779b0 diff --git a/packages/client/ui-sidebar-documentpreview/README.md b/packages/client/ui-sidebar-documentpreview/README.md index f1d187cf4a..5725368ecc 100644 --- a/packages/client/ui-sidebar-documentpreview/README.md +++ b/packages/client/ui-sidebar-documentpreview/README.md @@ -75,12 +75,12 @@ Opening an Office file requests conversion on demand. Each read checks renderer Background requests leave the final pending-request and reader slots available for foreground work; setting either limit to one rejects background reads. Renderer replacement restarts generation discovery and authorization once. Another replacement during that retry reports the localized busy message. -A yellow notice identifies fonts unavailable during conversion. Show more opens an anchored list; closing the list preserves the notice. Dismissing the notice collapses its space and moves the PDF upward. Dismissal applies to the same source version while the preview remains mounted; switching away from the tab and back shows the notice again. Long notice text fades before the action, and reduced-motion preferences disable the collapse animation. +A yellow rounded-triangle warning appears before Reload in the document toolbar when the current Office preview has missing fonts. Hover or keyboard focus shows the missing-font count; clicking opens an anchored list. Escape, Close, or clicking outside closes the list without hiding the warning or moving the document. Reloading closes the old details; previews with no missing fonts show no warning. Viewed and dismissed states are not retained.
    Office implementation — click to expand -Office registration, loading, caching, and font notices live in `src/client/office/`. The Office body owns converted PDF bytes and font metadata, and declares a nested PDF slot that reuses the lazy PDF body and its tab viewing state. The notice sits above the Office scrollport. Registration remains available without the Host renderer; optional `remote.officeToPdf` and `remote.workspaceFiles` injections supply conversion and freshness callbacks, and their removal restores unavailable guidance. Registrations and tab retention follow effect lifetimes. The [conversion service](../../document/office-to-pdf/README.md) owns the Host Remote methods, mounted by `api/remotes`. +Office registration, loading, caching, and font notices live in `src/client/office/`. The Office body owns converted PDF bytes and font metadata, and declares a nested PDF slot that reuses the lazy PDF body and its tab viewing state. The keyed `sidebar.right.tab.document.action` slot places renderer controls before Reload. The Office action shares the body’s store and reads only the current revision’s font metadata. Registration remains available without the Host renderer; optional `remote.officeToPdf` and `remote.workspaceFiles` injections supply conversion and freshness callbacks, and their removal restores unavailable guidance. Registrations and tab retention follow effect lifetimes. The [conversion service](../../document/office-to-pdf/README.md) owns the Host Remote methods, mounted by `api/remotes`. The shared `documentFileBytes()` helper decodes ordinary file and converted PDF responses into one owned byte buffer without expanding bytes into JavaScript array elements. Renderers borrow retained bytes read-only and copy them before Worker transfer. diff --git a/packages/client/ui-sidebar-documentpreview/README.zh.md b/packages/client/ui-sidebar-documentpreview/README.zh.md index cbdd915fb5..d62fc71d6f 100644 --- a/packages/client/ui-sidebar-documentpreview/README.zh.md +++ b/packages/client/ui-sidebar-documentpreview/README.zh.md @@ -75,12 +75,12 @@ PNG、JPEG、GIF、WebP、BMP、ICO 和 SVG 通过 Blob URL 在 `` 静态 后台请求为前台工作保留最后一个在途请求槽和读者槽;将任一限额设为一会拒绝后台读取。渲染器替换后会重新执行一次代次查询与授权检查。重试期间再次替换会显示本地化的繁忙提示。 -黄色提示条说明转换时不可用的字体。“显示更多”打开锚定字体列表;关闭列表保留提示条。关闭提示条会收起其占位并使 PDF 上移,关闭状态仅在预览持续挂载且源文件版本相同时保留;切换到其他标签再切回会重新显示提示条。过长提示文字在操作按钮前渐隐,减少动态效果偏好会禁用收起动画。 +当前 Office 预览缺失字体时,文档工具栏的刷新按钮前显示黄色圆角三角形警告。悬停或键盘聚焦时显示缺失字体数量;点击后打开锚定字体列表。按 Escape、点击关闭或点击外部会关闭列表,警告图标和文档位置保持不变。重新加载会关闭旧详情;没有缺失字体的预览不显示警告。不保留已读或关闭提示的状态。
    Office 实现——点击展开 -Office 注册、加载、缓存和字体提示位于 `src/client/office/`。Office 正文持有转换后的 PDF 字节和字体元数据,并声明嵌套 PDF slot,复用惰性 PDF 正文及其 tab 阅读状态。字体提示位于 Office 滚动区上方。Host 渲染器缺失时,注册仍然可用;可选的 `remote.officeToPdf` 和 `remote.workspaceFiles` 注入提供转换与版本检查回调,移除后恢复不可用提示。注册和 tab 状态保留都遵循 effect 生命周期。[转换服务](../../document/office-to-pdf/README.zh.md)拥有 Host Remote 方法,由 `api/remotes` 挂载。 +Office 注册、加载、缓存和字体提示位于 `src/client/office/`。Office 正文持有转换后的 PDF 字节和字体元数据,并声明嵌套 PDF slot,复用惰性 PDF 正文及其 tab 阅读状态。keyed slot `sidebar.right.tab.document.action` 将渲染器操作放在刷新按钮前。Office 操作与正文共享 store,仅读取当前 revision 的字体元数据。Host 渲染器缺失时,注册仍然可用;可选的 `remote.officeToPdf` 和 `remote.workspaceFiles` 注入提供转换与版本检查回调,移除后恢复不可用提示。注册和 tab 状态保留都遵循 effect 生命周期。[转换服务](../../document/office-to-pdf/README.zh.md)拥有 Host Remote 方法,由 `api/remotes` 挂载。 共享 `documentFileBytes()` 辅助函数将普通文件与转换后 PDF 的响应解码到一个独立持有的字节缓冲区,不会将字节展开为 JavaScript 数组元素。渲染器以只读方式借用保留的字节,并在传给 Worker 前复制。 diff --git a/packages/client/ui-sidebar-documentpreview/src/client/TextPreview.tsx b/packages/client/ui-sidebar-documentpreview/src/client/TextPreview.tsx index cad86a1a41..ac9227a624 100644 --- a/packages/client/ui-sidebar-documentpreview/src/client/TextPreview.tsx +++ b/packages/client/ui-sidebar-documentpreview/src/client/TextPreview.tsx @@ -82,7 +82,7 @@ export interface TextPreviewInjected extends TextInjected { /** The body's composed props: the tab, its navigation, the shared store and face, and copy. */ export type TextPreviewProps = & PropsRuntime<'sidebar.right.pane.tab'> - & PropsRenderSlots<'sidebar.right.tab.document'> + & PropsRenderSlots<'sidebar.right.tab.document' | 'sidebar.right.tab.document.action'> & PropsStore & InjectFace & PropsLocale<'sidebarDocumentPreview'> @@ -318,6 +318,7 @@ export function TextPreview({ )} + {content !== undefined && renderSlot('sidebar.right.tab.document.action', { content }, { entryKey: selected.id, hookContext: useTabInfo })} - -
    -
    -
    + + + + + {open && createPortal(