fix(web): show continuation request receipts

This commit is contained in:
Yichen Jiang committed 2026-11-03 10:50:46 +08:00
1 parent 309f438354
commit 9eee00fa7d
18 files changed
+72 -25

No files matched your search

@@ -9,8 +9,8 @@
en: f118844946afdbdc
zh: f1fe37d042f88b24
/agent-note-manual-generation-continuation/decision:
en: b9860cafbc20e453
zh: a274a3c7f33bc056
en: 463db7deb7710e07
zh: cfacb69cb58349a9
/agent-note-manual-generation-continuation/alternatives-considered:
en: 58bb948d210d42ea
zh: 5dc920d222d71218
@@ -10,7 +10,7 @@ Users need another request after a model failure without inserting an artificial
## Decision
The play action submits `content: []` through the existing Session prompt API. The API assigns `source.kind: 'retry'`; unchanged AgentLoop admission records an empty `user/message` and opens a normally balanced new turn. Chat omits the empty retry node while the log retains the input. The original failed turn remains closed.
The play action submits `content: []` through the existing Session prompt API. The API assigns `source.kind: 'retry'`; unchanged AgentLoop admission records an empty `user/message` and opens a normally balanced new turn. Chat presents a compact continuation-request receipt while the log retains the empty input. The original failed turn remains closed.
The Session API owns the fixed-size `conversationContinuation` projection and shares its value with the browser. Admission requires an eligible failure, true idle ownership, and no pending human input. An appended empty retry message admits the new turn, preserving eligibility if its request also fails.
@@ -10,7 +10,7 @@ Status: implemented
## 决策
播放按钮通过现有 Session prompt API 提交 `content: []`。API 指定 `source.kind: 'retry'`;AgentLoop 沿用普通准入,记录空 `user/message` 并开启正常闭合的新轮次。Chat 不生成空重试节点,日志保留该输入。原失败轮次保持闭合。
播放按钮通过现有 Session prompt API 提交 `content: []`。API 指定 `source.kind: 'retry'`;AgentLoop 沿用普通准入,记录空 `user/message` 并开启正常闭合的新轮次。Chat 显示轻量的继续请求记录,日志保留空输入。原失败轮次保持闭合。
Session API 拥有固定大小的 `conversationContinuation` 投影,向浏览器发布相同的值。准入要求失败符合条件、持有真正的空闲状态且没有待消费的用户输入。追加的空重试消息使新轮次获得准入,因此请求再次失败后仍保留继续资格。
+2 -2
View File
@@ -30,8 +30,8 @@
en: 382821ca3ffa60dd
zh: 9840ffa07c13082a
/deepseek-ai-dsh-client-ui-chat/turn-process-folding:
en: 0b1a8109ad0fd9bf
zh: f7274b42510550d0
en: 7cc6692b879aa500
zh: e924733c88b526c9
/deepseek-ai-dsh-client-ui-chat/grouped-rendering:
en: b1630d93a52f483e
zh: 59cb81ca50ecffc4
+1 -1
View File
@@ -98,7 +98,7 @@ The completed-turn action footer follows the recorded Turn end. Its action row s
<a id="turn-process-folding"></a>
## Turn Process Folding
Empty `user/message` records with `source.kind: 'retry'` remain in Session history while Chat omits their view nodes. Ordinary empty user messages and retry messages containing content retain their normal presentation.
Empty `user/message` records with `source.kind: 'retry'` remain in Session history while Chat renders a compact continuation-request receipt instead of a user bubble. Ordinary empty user messages and retry messages containing content retain their normal presentation.
During uninterrupted following, local transcript and steering echoes remain mounted through Inbox acceptance and claim until the durable message arrives, without triggering tail following twice. Pending steering follows Inbox order across clients, using matching local echoes in place. Admitted local steering also suppresses matching stale Inbox rows until the claim projection arrives; steering without a locally tracked submission continues to follow the Inbox projection. After reconnect, Host-owned rows replace receipt-confirmed local echoes; a claim awaiting admission may briefly have no bubble.
+1 -1
View File
@@ -98,7 +98,7 @@ Chat 在 `MarkdownDelegateProvider.getTriggerProps` 接入处适配 Markdown 目
<a id="turn-process-folding"></a>
## 轮次过程折叠
带 `source.kind: 'retry'` 的空 `user/message` 记录保留在 Session 历史中,Chat 不生成对应展示节点。普通空用户消息与包含内容的重试消息保持正常展示。
带 `source.kind: 'retry'` 的空 `user/message` 记录保留在 Session 历史中,Chat 显示轻量的继续请求记录,不生成用户气泡。普通空用户消息与包含内容的重试消息保持正常展示。
正常在线时,本地 transcript 与 steering 回显在 Inbox 接受与领取期间保持挂载,直到持久消息到达,不会重复触发跟随底部。跨客户端的待处理 steering 遵循 Inbox 顺序,在匹配位置使用本地回显。已入档的本地 steering 还会排除匹配的旧 Inbox 行,直到领取投影到达;没有本地提交身份的 steering 仍按 Inbox 投影显示。重连后,Host 消息替代已有接收回执的本地回显;已领取但尚未入档时,气泡可能短暂消失。
@@ -26,6 +26,17 @@
.header:hover { color: var(--dsw-alias-label-secondary); }
}
.icon { display: inline-flex; flex: none; color: inherit; }
.continuation {
display: flex;
align-items: center;
gap: 6px;
min-width: 0;
padding: 2px 0;
color: var(--dsw-alias-label-tertiary);
font-size: var(--dsh-content-font-size-secondary, 13px);
line-height: calc(20px + var(--dsh-content-font-delta-secondary, 0px));
overflow-wrap: anywhere;
}
.title { flex: 1; min-width: 0; overflow-wrap: anywhere; font-size: var(--dsh-content-font-size, 14px); }
.time { flex: none; margin-left: auto; color: inherit; font: var(--dsw-font-xxs-12); }
.chevron, .openChevron { flex: none; color: inherit; }
@@ -1,10 +1,10 @@
/** An independent, expandable notice explaining a non-human Turn trigger. */
/** Recorded Turn triggers and compact manual-continuation receipts. */
import { useId, useState, type ComponentType } from 'react'
import {
IconAgentPresetOutlineRegular, IconClockOutlineRegular, IconBranchOutlineRegular,
IconChevronDownOutlineRegular, IconContextInjectionOutlineRegular, IconCordisPluginOutlineRegular,
IconGoalOutlineRegular, IconGlobeOutlineRegular, IconPaperPlaneOutlineRegular, IconQueueOutlineRegular,
IconUsersOutlineRegular, type IconProps,
IconUsersOutlineRegular, IconPlayOutlineRegular, type IconProps,
} from '@deepseek-ai/dsh-client-ui-primitives'
import type { ChatNodeViewProps } from '../contract/slots.ts'
import { formatMessageClock } from './message-chrome.ts'
@@ -13,6 +13,7 @@ import { turnTriggerDetails, type TurnTriggerIcon } from './turn-trigger.ts'
import css from './TurnTriggerNodeView.module.css'
const TRIGGER_ICONS: Record<TurnTriggerIcon, ComponentType<IconProps>> = {
continue: IconPlayOutlineRegular,
request: IconContextInjectionOutlineRegular,
goal: IconGoalOutlineRegular,
agent: IconPaperPlaneOutlineRegular,
@@ -31,6 +32,12 @@ export function TurnTriggerNodeView({ node, t }: Pick<ChatNodeViewProps<'turn-tr
const bodyId = useId()
const details = turnTriggerDetails(node.data)
const TriggerIcon = TRIGGER_ICONS[details.icon]
if (details.compact) return (
<div className={css.continuation} data-generation-continuation>
<span className={css.icon} aria-hidden><TriggerIcon size={14} /></span>
<span>{t(details.title)}</span>
</div>
)
const date = new Date(node.data.time)
const time = formatMessageClock(node.data.time, t)
return (
@@ -3,7 +3,7 @@ import type { ContextMessageNode } from '../contract/snapshot.ts'
import type { ChatKey } from '../locale.ts'
/** Existing primitive glyph selected for a Turn trigger's source family. */
export type TurnTriggerIcon = 'agent' | 'github' | 'goal' | 'job' | 'plugin' | 'request' | 'schedule' | 'subagent' | 'team' | 'webhook'
export type TurnTriggerIcon = 'agent' | 'continue' | 'github' | 'goal' | 'job' | 'plugin' | 'request' | 'schedule' | 'subagent' | 'team' | 'webhook'
function record(value: unknown): Record<string, unknown> {
return typeof value === 'object' && value !== null && !Array.isArray(value) ? value as Record<string, unknown> : {}
@@ -30,17 +30,21 @@ function subagentTitle(reason: unknown): ChatKey {
/**
* Describe a waking message using its recorded source.
* @param node - durable context, including the original notification body.
* @returns localized title key and source-family icon.
* @returns localized title, source-family icon, and compact presentation for continuation receipts.
*/
export function turnTriggerDetails(node: ContextMessageNode): {
title: ChatKey
icon: TurnTriggerIcon
compact?: true
} {
const source = record(node.source)
const kind = field(source, 'kind')
let title: ChatKey = 'message.trigger.request'
let icon: TurnTriggerIcon = 'request'
switch (kind) {
case 'retry':
if (node.content.length === 0) return { title: 'message.continuation.requested', icon: 'continue', compact: true }
break
case 'goal': {
title = 'message.trigger.goal'
icon = 'goal'
@@ -38,7 +38,7 @@ declare module '../contract/chat-nodes.ts' {
steering: ReferencedSteeringMessageNode
/** Non-user context injected into model history. */
context: ContextMessageNode
/** Non-human input that starts a Turn. */
/** Recorded notification or manual continuation that starts a Turn. */
'turn-trigger': ContextMessageNode
}
}
@@ -136,14 +136,16 @@ export const messageDefinition: ConversationNodeDefinition<MessageNode> = {
update: context => context.state,
buildViewNode: (context) => {
if (context.state === undefined) return null
if (context.start?.event.type === 'user/message'
&& context.start.event.data.source.kind === 'retry' && context.start.event.data.content.length === 0) return null
const location = contextLocation(context)
if (context.state.kind === 'context' && context.start?.event.type === 'user/message'
&& context.start.event.data.source.kind === 'retry' && context.start.event.data.content.length === 0) {
return chatNode(context, 'turn-trigger', context.state.seq, context.state, { location, groupTree: 'input' })
}
const waking = context.state.kind === 'context'
&& context.start?.event.type === 'user/message'
&& context.state.waking === true
// Human input claimed for Step 1 opens an exchange; Notice-woken Turns and
// later steering stay in the current exchange, so they never fold earlier Turns.
const location = contextLocation(context)
const human = context.state.kind === 'user' || context.state.kind === 'steering'
const opensExchange = human && location.kind === 'step' && location.step.step === 1
return chatNode(
@@ -170,6 +170,7 @@ export const zh = {
'message.retry.active': '正在重试模型请求',
'message.retry.cancelled': '模型请求重试已取消',
'message.retry.started': '已重试模型请求',
'message.continuation.requested': '已请求继续生成',
'message.retry.scheduled': '等待重试模型请求',
'message.retry.status': '{label}({retry}/{maximum}) · {seconds}s',
'message.retry.delay': '重试延迟:',
@@ -378,6 +379,7 @@ export const en = {
'message.retry.active': 'Retrying model request',
'message.retry.cancelled': 'Model request retry cancelled',
'message.retry.started': 'Retried model request',
'message.continuation.requested': 'Requested to continue generation',
'message.retry.scheduled': 'Waiting to retry model request',
'message.retry.status': '{label} ({retry}/{maximum}) · {seconds}s',
'message.retry.delay': 'Retry delay: ',
@@ -583,6 +585,7 @@ export const ja = {
'message.retry.active': 'モデルリクエストを再試行中',
'message.retry.cancelled': 'モデルリクエストの再試行をキャンセルしました',
'message.retry.started': 'モデルリクエストを再試行しました',
'message.continuation.requested': '生成の続行をリクエストしました',
'message.retry.scheduled': 'モデルリクエストの再試行待ちです',
'message.retry.status': '{label} ({retry}/{maximum}) · {seconds}秒',
'message.retry.delay': '再試行までの待機時間: ',
@@ -788,6 +791,7 @@ export const es = {
'message.retry.active': 'Reintentando solicitud de modelo',
'message.retry.cancelled': 'Reintento de solicitud de modelo cancelado',
'message.retry.started': 'Solicitud de modelo reintentada',
'message.continuation.requested': 'Se ha solicitado continuar la generación',
'message.retry.scheduled': 'Esperando para volver a intentar la solicitud de modelo',
'message.retry.status': '{label} ({retry}/{maximum}) · {seconds}s',
'message.retry.delay': 'Retraso de reintento: ',
@@ -993,6 +997,7 @@ export const fr = {
'message.retry.active': 'Nouvelle tentative de demande de modèle',
'message.retry.cancelled': 'Nouvelle tentative de demande de modèle annulée',
'message.retry.started': 'Demande de modèle réessayée',
'message.continuation.requested': 'Suite de la génération demandée',
'message.retry.scheduled': 'En attente de réessayer la demande de modèle',
'message.retry.status': '{label} ({retry}/{maximum}) · {seconds}',
'message.retry.delay': 'Délai de nouvelle tentative : ',
@@ -1198,6 +1203,7 @@ export const de = {
'message.retry.active': 'Modellanforderung wird erneut versucht',
'message.retry.cancelled': 'Wiederholungsversuch der Modellanforderung abgebrochen',
'message.retry.started': 'Modellanfrage erneut versucht',
'message.continuation.requested': 'Fortsetzung der Generierung angefordert',
'message.retry.scheduled': 'Warten auf erneuten Versuch der Modellanforderung',
'message.retry.status': '{label} ({retry}/{maximum}) · {seconds}s',
'message.retry.delay': 'Wiederholungsverzögerung: ',
@@ -1403,6 +1409,7 @@ export const ru = {
'message.retry.active': 'Повторный запрос модели',
'message.retry.cancelled': 'Повтор запроса модели отменен.',
'message.retry.started': 'Повторный запрос модели',
'message.continuation.requested': 'Запрошено продолжение генерации',
'message.retry.scheduled': 'Ожидание повторного запроса модели',
'message.retry.status': '{label} ({retry}/{maximum}) · {seconds}s',
'message.retry.delay': 'Задержка повтора: ',
@@ -1608,6 +1615,7 @@ export const pt = {
'message.retry.active': 'Tentando novamente a solicitação de modelo',
'message.retry.cancelled': 'Nova tentativa de solicitação de modelo cancelada',
'message.retry.started': 'Solicitação de modelo repetida',
'message.continuation.requested': 'Continuação da geração solicitada',
'message.retry.scheduled': 'Aguardando para tentar novamente a solicitação de modelo',
'message.retry.status': '{label} ({retry}/{maximum}) · {seconds}s',
'message.retry.delay': 'Atraso na nova tentativa: ',
@@ -626,7 +626,7 @@ describe('built-in conversation node Definitions', () => {
},
)
it.each(['replay', 'live', 'prepend'] as const)('hides empty retry bubbles through %s while retaining other input', (mode) => {
it.each(['replay', 'live', 'prepend'] as const)('presents empty retry receipts through %s while retaining other input', (mode) => {
const retry = { id: 'empty-retry', role: 'user', content: [], source: { kind: 'retry' } }
const before = [
at(1, 'agent/inbox/spliced', { target: 'next-turn', start: 0, inserted: [retry] }),
@@ -640,7 +640,9 @@ describe('built-in conversation node Definitions', () => {
if (mode === 'prepend') value.prepend(before, false)
value.flush()
const current = snapshot(value)
expect(current.nodes.values().filter(candidate => candidate.anchorSeq === 5)).toEqual([])
const receipt = node(current, 'turn-trigger')
expect(receipt).toMatchObject({ anchorSeq: 5, groupTree: 'input', data: { content: [], source: { kind: 'retry' } } })
expect(current.order).toContain(receipt?.key)
expect(node(current, 'unknown')).toBeUndefined()
value.append(at(6, 'user/message', { ...retry, id: 'retry-with-content',
@@ -24,6 +24,20 @@ function trigger(source: unknown): ChatNode<'turn-trigger'> {
}
describe('Turn trigger notices', () => {
it.each([
[en, 'Requested to continue generation'],
[zh, '已请求继续生成'],
])('shows an empty retry as a compact continuation receipt', (locale, title) => {
const node = trigger({ kind: 'retry' })
node.data.content = []
expect(turnTriggerDetails(node.data)).toEqual({ title: 'message.continuation.requested', icon: 'continue', compact: true })
const view = render(<TurnTriggerNodeView node={node} t={makeTranslate(locale)} />)
expect(view.getByText(title)).toBeDefined()
expect(view.queryByRole('button')).toBeNull()
expect(view.container.querySelector('[data-generation-continuation] svg')).not.toBeNull()
expect(view.container.querySelector('time')).toBeNull()
})
it.each([
[{ kind: 'schedule' }, 'schedule', 'Automation task'],
[{ kind: 'tool-jobs' }, 'job', 'Background task updated'],
@@ -35,6 +49,7 @@ describe('Turn trigger notices', () => {
[{ kind: 'webhook', provider: 'github' }, 'github', 'GitHub event received'],
[{ kind: 'webhook', provider: 'custom' }, 'webhook', 'External event received'],
[{ kind: 'custom-extension' }, 'request', 'Execution requested'],
[{ kind: 'retry' }, 'request', 'Execution requested'],
] as const)('presents the recorded %j source', (source, icon, title) => {
const node = trigger(source)
const details = turnTriggerDetails(node.data)
@@ -33,8 +33,8 @@
en: 6a7ae99570c9c007
zh: 26e86063e97d82c7
/deepseek-ai-dsh-client-ui-conversation/model-experience/manual-continuation-request/what-the-model-sees:
en: 6b815b6e27a8750b
zh: 87a08fc5b075e626
en: 017391d7ad0f9eb7
zh: 2693ed29d44b1164
/deepseek-ai-dsh-client-ui-conversation/model-experience/manual-continuation-request/token-effect:
en: 517c56dbd522c929
zh: 55fa3a02d026e36a
+1 -1
View File
@@ -197,7 +197,7 @@ Session title context gestures use the shared [context menu](../ui-context-menu/
#### What the model sees
The play action submits `content: []` through the existing Session prompt API. Ordinary Loop admission records an empty `user/message` with `source.kind: 'retry'`. Chat hides the empty retry bubble. The adapter applies its ordinary message serialization; the action adds no localized or hidden continuation text. Pending injected context follows ordinary admission.
The play action submits `content: []` through the existing Session prompt API. Ordinary Loop admission records an empty `user/message` with `source.kind: 'retry'`. Chat presents the empty retry as a compact continuation-request receipt. The adapter applies its ordinary message serialization; the action adds no localized or hidden continuation text. Pending injected context follows ordinary admission.
#### Token effect
+1 -1
View File
@@ -197,7 +197,7 @@ selector 必须是 owner currency 的纯函数。非 null 返回值作为 `match
#### 模型看到什么
播放按钮通过现有 Session prompt API 提交 `content: []`。普通 Loop 准入记录带 `source.kind: 'retry'` 的空 `user/message`。Chat 隐藏空重试气泡。适配器按普通消息序列化处理;该操作不添加本地化或隐藏的继续文本。待注入上下文遵循普通准入流程。
播放按钮通过现有 Session prompt API 提交 `content: []`。普通 Loop 准入记录带 `source.kind: 'retry'` 的空 `user/message`。Chat 将空重试消息显示为轻量的继续请求记录。适配器按普通消息序列化处理;该操作不添加本地化或隐藏的继续文本。待注入上下文遵循普通准入流程。
#### Token 影响
@@ -24,9 +24,6 @@ export const Config = z.object({
[BUSY_ENTER_FIELD]: ConversationSettingsFields[BUSY_ENTER_FIELD].volatile(),
})
/** Settings integration is optional and does not block activation. */
export const inject = []
/** Register browser conversation preferences.
* @param ctx Plugin context used for optional settings presentation.
*/
@@ -20,6 +20,7 @@
- text: This turn failedupstream 503
- code: SERVER
- text: plan Plan mode on. Use /plan off to leave. plan Plan mode off.
- text: Requested to continue generation
- status: Completed
- button "Completed in {{duration}}"
- paragraph: Event sourcing is a pattern where all changes to an application's state are stored as an immutable, append-only sequence of events, rather than persisting only the current state, enabling full auditability, temporal queries, and event-driven architectures.