Merge ID-only Team base into agent teamwork UI polish

This commit is contained in:
Dudu-0223 committed 2026-10-30 14:32:55 +08:00
commit 5a052d6767
321 files changed
+1771 -4966

No files matched your search

+4 -4
View File
@@ -15,8 +15,8 @@
en: d152484eb41ac6b4
zh: 09388d293f9be9cb
/deepseek-ai-dsh-client-ui-tool/use-this-package:
en: fd961d923feca636
zh: 5925ea0fbdfc207d
en: 2419beff9bcd8139
zh: 5aafe9b168e571a5
/deepseek-ai-dsh-client-ui-tool/use-this-package/registering-a-business-tool-view:
en: e458aff61e634190
zh: 650e417f450b3edf
@@ -30,8 +30,8 @@
en: 672e63b2f92e689b
zh: ba950ecb480325a6
/deepseek-ai-dsh-client-ui-tool/understand-the-implementation/cards:
en: f14a14ec529126b1
zh: 414cad04d6af8e5e
en: d2ac2f855da27aff
zh: 61d257d60971f259
/deepseek-ai-dsh-client-ui-tool/understand-the-implementation/declared-optional-capabilities:
en: c1926deb4e5f3734
zh: c5845f465b94a459
+2 -2
View File
@@ -25,7 +25,7 @@ English | [中文](README.zh.md)
<a id="use-this-package"></a>
## Use this package
Tool calls appear in the conversation as cards: a root call tree with its nested subcalls, each atomic call rendered by its owning view. Every lifecycle state retains the tool's ordinary business glyph; failure and interruption remain explicit through the frozen call/result state, accessible status text, and failure summary. Users can open files or inspect calls through the Host callbacks. A collapsed `web_fetch` row links its http(s) URL, which opens in a new browser tab. Control receipts display agent `name` arguments; historical `agent_id` recordings remain readable. `send_message` receipts omit the leading `lead/` from target labels while preserving nested paths and the original arguments for inspection. Text agent lists show the name or path above a single-line description, with compact spacing and recorded status. Click the description to expand or collapse its full text; its accessible name follows the selected locale.
Tool calls appear in the conversation as cards: a root call tree with its nested subcalls, each atomic call rendered by its owning view. Every lifecycle state retains the tool's ordinary business glyph; failure and interruption remain explicit through the frozen call/result state, accessible status text, and failure summary. Users can open files or inspect calls through the Host callbacks. A collapsed `web_fetch` row links its http(s) URL, which opens in a new browser tab. Control receipts display the agent ID supplied by the recorded call. Text agent lists show the ID above a single-line description, with compact spacing and recorded status. Click the description to expand or collapse its full text; its accessible name follows the selected locale.
Settled foreground commands with a nonzero exit code, a terminating signal, or an explicit missing exit code keep their description in the ordinary gray text and show a neutral capsule with a red dot immediately after it. The capsule displays only the recorded code, signal, or localized missing-code status and stays on the same line; the description truncates with an ellipsis to reserve its space. Running, successful, and background calls omit it. Generic execution errors and stopped summaries retain their error and warning colors, including on hover.
@@ -93,7 +93,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.
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. Agent control receipts display the recorded target name or historical identifier. `wait_agent` shows a single waiting, ended, or timed-out header without a repeated summary; historical `noProgress` results keep their recorded explanation. 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.
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. Agent control receipts display the recorded target Session id. `wait_agent` shows a single waiting, ended, or timed-out header without a repeated summary; historical `noProgress` results keep their recorded explanation. 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.
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.
+2 -2
View File
@@ -25,7 +25,7 @@ kind: "package-reference"
<a id="use-this-package"></a>
## 使用本包
工具调用在对话中显示为卡片:一个根调用树带其嵌套子调用,每个原子调用由所属视图渲染。所有生命周期状态都保留工具的普通业务图标;失败与中断仍通过冻结调用/结果状态、无障碍状态文本和失败摘要明确表达。用户可通过宿主回调打开文件或检查调用。折叠的 `web_fetch` 行把其 http(s) URL 显示为链接,在新浏览器标签页中打开。控制工具回执显示 agent 的 `name` 参数;历史 `agent_id` 记录仍可读取。`send_message` 回执的目标标签省略开头的 `lead/`,保留嵌套路径,检查视图仍显示原始参数。文本形式的智能体列表以紧凑间距展示名称或路径、下方的单行描述及记录中的状态。点击描述可展开或收起全文;其无障碍名称使用当前语言。
工具调用在对话中显示为卡片:一个根调用树带其嵌套子调用,每个原子调用由所属视图渲染。所有生命周期状态都保留工具的普通业务图标;失败与中断仍通过冻结调用/结果状态、无障碍状态文本和失败摘要明确表达。用户可通过宿主回调打开文件或检查调用。折叠的 `web_fetch` 行把其 http(s) URL 显示为链接,在新浏览器标签页中打开。控制工具回执显示记录的调用所提供的智能体 ID。文本形式的智能体列表以紧凑间距展示 ID、下方的单行描述及记录中的状态。点击描述可展开或收起全文;其无障碍名称使用当前语言。
已结束的前台命令若返回非零退出码、终止信号,或明确记录为无退出码,描述保持普通灰色,后面紧接带红点的中性胶囊。胶囊仅显示记录的退出码、信号或本地化的“未正常退出”状态,并保持在同一行;描述超出可用宽度时显示省略号,为胶囊预留空间。运行中、成功和后台调用不显示胶囊。通用执行错误与停止摘要仍保留错误色和警告色,悬停时也不改变。
@@ -93,7 +93,7 @@ Chat diff 卡片在折叠前保留九行,足以容纳文件标题、一对删
Auto 拒绝优先于按工具名选择的专门视图。其通用行保留调用身份、省略原始参数,并且只在显示时归一化存储的理由:去除首尾空白,把行分隔符折叠为空格,结果为空时使用本地化通用理由。Session 与 SDK 错误详情保留原始理由。
记录结果的工具详情覆盖目标和定时任务工具、Cordis 检查、workflow 与 Ralph 报告、Session 事件/搜索/轨迹查询、Agent 与 teammate 控制、后台作业、持久终端以及 LSP 导航。展开内容读取成功的记录结果,为失败或不支持的数据保留通用输入/输出,并保留 Inspect。日期包含查看者的时区,状态反映调用结果而非当前会话状态。Agent 控制回执显示记录的目标名称或历史标识符。`wait_agent` 的行标题仅显示等待中、已结束或已超时,不重复追加摘要;历史 `noProgress` 结果保留记录中的说明。Session 轨迹保留后代的缩进。LSP 结果通过 Host 回调打开文件系统路径,其他 URI 则显示为文本。浏览器适配器消费已记录的 producer 文本与 JSON;Host service 对象和 presenter 回调不会进入 Client。
记录结果的工具详情覆盖目标和定时任务工具、Cordis 检查、workflow 与 Ralph 报告、Session 事件/搜索/轨迹查询、Agent 与 teammate 控制、后台作业、持久终端以及 LSP 导航。展开内容读取成功的记录结果,为失败或不支持的数据保留通用输入/输出,并保留 Inspect。日期包含查看者的时区,状态反映调用结果而非当前会话状态。Agent 控制回执显示记录的目标 Session id。`wait_agent` 的行标题仅显示等待中、已结束或已超时,不重复追加摘要;历史 `noProgress` 结果保留记录中的说明。Session 轨迹保留后代的缩进。LSP 结果通过 Host 回调打开文件系统路径,其他 URI 则显示为文本。浏览器适配器消费已记录的 producer 文本与 JSON;Host service 对象和 presenter 回调不会进入 Client。
展开后的状态圆点和文字使用静态语义色。操作回执和任务输出的标题保持中性色,展开时省略标题中的状态。中断回执仅确认已发出中断请求。
@@ -114,12 +114,12 @@ export function subagentDetails(
} else {
if (text === undefined) return null
// Historical results lack the structured receipt stored by current tools.
const started = /^started (background subagent job|subagent) (\S+)(?:\nname: (\S+))?$/u.exec(text)
const started = /^started (background subagent job|subagent) (\S+)$/u.exec(text)
if (started === null) {
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)
}
if (started[1] === 'background subagent job') fields.push({ label: t('detail.field.job'), value: started[2] ?? '' })
if (started[3] !== undefined) fields.push({ label: t('detail.field.agentName'), value: started[3] })
else fields.push({ label: t('detail.field.id'), value: started[2] ?? '' })
}
return detailList([{
title: t('detail.receipt.started'), fields,
@@ -139,7 +139,7 @@ export function subagentDetails(
export function controlDetails(
name: string, args: Record<string, unknown>, text: string, json: unknown, t: DetailTranslate,
): ToolDetailsModel | null {
const target = arg(args, 'name') || arg(args, 'target') || arg(args, 'agent_id') || arg(args, 'sessionId') || arg(args, 'job_id')
const target = arg(args, 'target') || arg(args, 'agent_id') || arg(args, 'sessionId') || arg(args, 'job_id')
switch (name) {
case 'list_agents': return agentList(text, json, t)
case 'job_list': return jobList(text, t)
@@ -161,12 +161,11 @@ export function controlDetails(
...(json.nextCursor === undefined ? {} : { caption: t('detail.tasks.nextPage', { cursor: String(json.nextCursor) }) }),
}
case 'send_message': {
const title = target.replace(/^lead\//u, '')
const status = detailRecord(json) ? json.status : undefined
if (status === 'accepted' || status === 'queued') return receipt(title, {
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(title, { label: t('detail.receipt.delivered'), tone: 'success' }, t, [], arg(args, 'message')) : null
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, { label: t('detail.receipt.interrupt'), tone: 'warning' }, t, [{ label: t('detail.field.previousStatus'), value: detailBadge(json.previousStatus, t).label }])
@@ -66,7 +66,7 @@ export function detailBadge(status: string, t: DetailTranslate): NonNullable<Det
const FIELD_KEYS = {
id: 'detail.field.id', revision: 'detail.field.revision', platform: 'detail.field.platform',
provider: 'detail.field.provider', model: 'detail.field.model', role: 'detail.field.role',
context: 'detail.field.context', ownerName: 'detail.field.owner', ready: 'detail.field.ready',
context: 'detail.field.context', ownerId: 'detail.field.owner', ready: 'detail.field.ready',
blockedBy: 'detail.field.dependencies', writeScopes: 'detail.field.writeScopes',
writeScopeWarnings: 'detail.field.warnings', diagnostics: 'detail.field.diagnostics',
methods: 'detail.field.methods', inputSchema: 'detail.field.inputSchema', outputSchema: 'detail.field.outputSchema',
@@ -88,35 +88,21 @@ describe('control detail adapters', () => {
expect(details('lsp', 'hover text', { file_path: 'src/main.ts', line: 2, character: 3, operation: 'hover' })?.items[0]?.markdown).toBe('hover text')
})
it('shows named agent targets in recorded messaging and interruption receipts', () => {
expect(details('send_message', 'message delivered to agent lead/reviewer', {
name: 'lead/reviewer', message: 'Review the change.',
})).toMatchObject({
summary: 'reviewer · Message delivered', expandedSummary: 'reviewer',
items: [{ title: 'reviewer', description: 'Review the change.' }],
})
expect(details('interrupt_agent', '{"previousStatus":"running"}', {
name: 'lead/reviewer',
})?.items[0]).toMatchObject({
title: 'lead/reviewer', fields: [{ label: 'Previous status', value: 'Running' }],
})
})
it.each(['subagent', 'subagent_fork'])('%s recognizes named creation receipts and retains the complete task', (name) => {
it.each(['subagent', 'subagent_fork'])('%s recognizes ID creation receipts and retains the complete task', (name) => {
const prompt = 'Research CLI agent products.\nCompare business models and write a report.'
const model = details(name, 'started subagent child-1\nname: lead/researcher', { description: 'Research CLI agent products', prompt })
const model = details(name, 'started subagent child-1', { description: 'Research CLI agent products', prompt })
expect(model?.summary).toBe('Research CLI agent products')
expect(model?.items[0]).toEqual({
title: 'Started',
fields: [{ label: 'Agent task description', value: 'Research CLI agent products' }, { label: 'Agent name', value: 'lead/researcher' }],
fields: [{ label: 'Agent task description', value: 'Research CLI agent products' }, { label: 'ID', value: 'child-1' }],
groups: [{ label: 'Task', items: [{ description: prompt, fields: [] }] }],
})
expect(details(name, 'started subagent child-1', { prompt })?.items[0]?.title).toBe('Started')
expect(details(name, 'started subagent child-1\nname: lead/researcher\nAdditional reply', { prompt })?.items[0]?.title).toBe('Agent response')
expect(details(name, 'started subagent child-1\nAdditional reply', { prompt })?.items[0]?.title).toBe('Agent response')
})
it.each(['subagent', 'subagent_fork'])('%s renders persisted creation metadata independently of result wording', (name) => {
const args = { description: 'Review the changes', prompt: 'Read the diff and report defects.', name: 'requested-name' }
const args = { description: 'Review the changes', prompt: 'Read the diff and report defects.' }
const block = { ...output(name, 'Delegation accepted.', args), meta: { kind: 'activation', subagentId: 'child-1' } }
const model = detailsCardModel(block, t, 'en')
expect(model?.items[0]).toEqual({
@@ -132,7 +118,7 @@ describe('control detail adapters', () => {
it.each([null, [], {}, { kind: 'other', subagentId: 'child-1' }, { kind: 'activation' }, { kind: 'activation', subagentId: 1 }, { kind: 'activation', subagentId: ' ' }])(
'keeps malformed metadata on the generic result path (%j)', (meta) => {
const block = { ...output('subagent', 'started subagent child-1\nname: lead/reviewer'), meta }
const block = { ...output('subagent', 'started subagent child-1'), meta }
expect(detailsCardModel(block, t, 'en')).toBeNull()
},
)
@@ -142,7 +128,7 @@ describe('control detail adapters', () => {
expect(details('team_task_create', '{"id":"task-1","subject":"Review","status":"pending"}')?.summary).toBe('Review')
expect(details('team_task_list', '{"tasks":[{"id":"task-1","subject":"Review"}],"nextCursor":3}')?.caption).toBe('More tasks available; next cursor is 3')
expect(details('send_message', '{"status":"queued"}', { agent_id: 'a1', message: 'hello' })?.items[0]?.badge?.label).toBe('Queued')
expect(details('send_message', 'message delivered to agent reviewer', { name: 'reviewer', message: 'hello' })?.summary).toBe('reviewer · Message delivered')
expect(details('send_message', 'message delivered to agent reviewer', { agent_id: 'reviewer', message: 'hello' })?.summary).toBe('reviewer · Message delivered')
expect(details('interrupt_agent', '{"previousStatus":"running"}', { agent_id: 'a1' })?.items[0]?.fields).toContainEqual({ label: 'Previous status', value: 'Running' })
expect(details('wait_agent', '{"timedOut":true}')?.summary).toBe('Wait timed out')
expect(details('wait_agent', '{"timedOut":false,"noProgress":{"message":"No peer"}}')?.items[0]?.description).toBe('No peer')
@@ -163,7 +149,7 @@ describe('control detail adapters', () => {
expect(details('unknown', 'x')).toBeNull()
expect(details('team_task_list', '{"tasks":[],"nextCursor":"bad"}')).toBeNull()
expect(details('terminal_read', 'bad', { sessionId: 'pty-1' })).toBeNull()
expect(details('interrupt_agent', 'interrupt requested for agent reviewer', { name: 'reviewer' })?.summary).toContain('Interrupt')
expect(details('interrupt_agent', 'interrupt requested for agent reviewer', { agent_id: 'reviewer' })?.summary).toContain('Interrupt')
expect(details('interrupt_agent', 'unexpected', { agent_id: 'a1' })).toBeNull()
expect(details('job_kill', 'unexpected', { job_id: 'j1' })).toBeNull()
expect(details('terminal_close', 'unexpected', { sessionId: 'pty-1' })).toBeNull()
@@ -96,15 +96,15 @@ describe('tool preparation', () => {
const settled: ToolResultNode = {
kind: 'tool-result', seq: 3, time: 3, callId: 'call', callTime: 2, name,
args: started.args, call: { name, argsRaw }, isError: false, subCalls: [],
content: [{ type: 'text', text: 'started subagent child-1\nname: lead/researcher' }],
content: [{ type: 'text', text: 'started subagent child-1' }],
}
view.rerender(<DetailsRow {...props} phase="result" block={settled} />)
expect(view.getByText('Research CLI products')).toBeTruthy()
expect(view.queryByText('Agent response')).toBeNull()
fireEvent.click(view.getByRole('button', { expanded: false }))
expect(view.getByText('Research CLI products')).toBeTruthy()
expect(view.getAllByText('Research CLI products')).toHaveLength(2)
expect(view.getByText('Research products in detail.')).toBeTruthy()
expect(view.getByText('lead/researcher')).toBeTruthy()
expect(view.getByText('child-1')).toBeTruthy()
})
it('retains the file row through streamed arguments, dispatch, and result', () => {