@deepseek-ai/dsh-client-ui-chat 0.2.3-alpha.2 → 0.2.3-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.i18n.yaml +10 -10
- package/README.md +7 -5
- package/README.zh.md +7 -5
- package/lib/client.js +9 -9
- package/lib/client.js.map +1 -1
- package/lib/types/client/apply.js.map +1 -1
- package/lib/types/client/chat/ApprovalCommand.d.ts +1 -1
- package/lib/types/client/chat/ApprovalCommand.d.ts.map +1 -1
- package/lib/types/client/chat/AssistantMarkdown.d.ts +2 -2
- package/lib/types/client/chat/AssistantMarkdown.d.ts.map +1 -1
- package/lib/types/client/chat/AssistantMarkdown.js.map +1 -1
- package/lib/types/client/chat/AssistantNodeView.d.ts +1 -1
- package/lib/types/client/chat/AssistantNodeView.d.ts.map +1 -1
- package/lib/types/client/chat/ChatAside.d.ts +1 -1
- package/lib/types/client/chat/ChatAside.d.ts.map +1 -1
- package/lib/types/client/chat/ChatFlow.d.ts +1 -1
- package/lib/types/client/chat/ChatFlow.d.ts.map +1 -1
- package/lib/types/client/chat/ChatFlow.js.map +1 -1
- package/lib/types/client/chat/ChatGroupSeat.d.ts.map +1 -1
- package/lib/types/client/chat/ChatGroupSeat.js.map +1 -1
- package/lib/types/client/chat/ChatNodeSeat.d.ts +1 -1
- package/lib/types/client/chat/ChatNodeSeat.d.ts.map +1 -1
- package/lib/types/client/chat/ChatNodeSeat.js.map +1 -1
- package/lib/types/client/chat/ChatView.d.ts +1 -1
- package/lib/types/client/chat/ChatView.d.ts.map +1 -1
- package/lib/types/client/chat/ChatView.js.map +1 -1
- package/lib/types/client/chat/CommandNodeView.d.ts +1 -1
- package/lib/types/client/chat/CommandNodeView.d.ts.map +1 -1
- package/lib/types/client/chat/CommandStatusRow.js.map +1 -1
- package/lib/types/client/chat/CompactionItem.js.map +1 -1
- package/lib/types/client/chat/ContextBody.d.ts +11 -1
- package/lib/types/client/chat/ContextBody.d.ts.map +1 -1
- package/lib/types/client/chat/ContextBody.js.map +1 -1
- package/lib/types/client/chat/ContextInjectionRow.js.map +1 -1
- package/lib/types/client/chat/MessageIconActions.js.map +1 -1
- package/lib/types/client/chat/MessageItem.d.ts +2 -2
- package/lib/types/client/chat/MessageItem.d.ts.map +1 -1
- package/lib/types/client/chat/MessageItem.js.map +1 -1
- package/lib/types/client/chat/QuotaNoticeHost.js.map +1 -1
- package/lib/types/client/chat/ReasoningContent.d.ts +1 -1
- package/lib/types/client/chat/ReasoningContent.d.ts.map +1 -1
- package/lib/types/client/chat/ReasoningContent.js.map +1 -1
- package/lib/types/client/chat/ReasoningRow.d.ts +1 -1
- package/lib/types/client/chat/ReasoningRow.d.ts.map +1 -1
- package/lib/types/client/chat/ReasoningRow.js.map +1 -1
- package/lib/types/client/chat/RunningStatus.js.map +1 -1
- package/lib/types/client/chat/StatsPills.d.ts +1 -1
- package/lib/types/client/chat/StatsPills.d.ts.map +1 -1
- package/lib/types/client/chat/StatsPills.js.map +1 -1
- package/lib/types/client/chat/SystemPromptRow.d.ts +7 -3
- package/lib/types/client/chat/SystemPromptRow.d.ts.map +1 -1
- package/lib/types/client/chat/SystemPromptRow.js.map +1 -1
- package/lib/types/client/chat/TurnNavigator.d.ts +1 -1
- package/lib/types/client/chat/TurnNavigator.d.ts.map +1 -1
- package/lib/types/client/chat/TurnProcessNodeView.js.map +1 -1
- package/lib/types/client/chat/TurnTailNodeView.d.ts +1 -1
- package/lib/types/client/chat/TurnTailNodeView.d.ts.map +1 -1
- package/lib/types/client/chat/TurnTriggerNodeView.js.map +1 -1
- package/lib/types/client/chat/TurnUsagePanel.js.map +1 -1
- package/lib/types/client/chat/UserContent.d.ts +1 -1
- package/lib/types/client/chat/UserContent.d.ts.map +1 -1
- package/lib/types/client/chat/UserContent.js.map +1 -1
- package/lib/types/client/chat/flow-motion.d.ts +1 -1
- package/lib/types/client/chat/flow-motion.d.ts.map +1 -1
- package/lib/types/client/chat/flow-motion.js.map +1 -1
- package/lib/types/client/chat/message-chrome.d.ts +1 -1
- package/lib/types/client/chat/message-chrome.d.ts.map +1 -1
- package/lib/types/client/chat/searchable-hidden.d.ts +1 -1
- package/lib/types/client/chat/searchable-hidden.d.ts.map +1 -1
- package/lib/types/client/chat/stat-dialog.d.ts +3 -3
- package/lib/types/client/chat/stat-dialog.d.ts.map +1 -1
- package/lib/types/client/chat/stat-dialog.js.map +1 -1
- package/lib/types/client/chat/step-process.d.ts +18 -1
- package/lib/types/client/chat/step-process.d.ts.map +1 -1
- package/lib/types/client/chat/step-process.js.map +1 -1
- package/lib/types/client/chat/text-interaction.d.ts +1 -1
- package/lib/types/client/chat/text-interaction.d.ts.map +1 -1
- package/lib/types/client/chat/text-interaction.js.map +1 -1
- package/lib/types/client/chat/text-selection.d.ts.map +1 -1
- package/lib/types/client/chat/text-selection.js.map +1 -1
- package/lib/types/client/chat/use-chat-scroll.d.ts +2 -2
- package/lib/types/client/chat/use-chat-scroll.d.ts.map +1 -1
- package/lib/types/client/chat/use-chat-viewport.d.ts +2 -2
- package/lib/types/client/chat/use-chat-viewport.d.ts.map +1 -1
- package/lib/types/client/chat/use-chat-viewport.js.map +1 -1
- package/lib/types/client/chat/use-process-scroll.d.ts +1 -1
- package/lib/types/client/chat/use-process-scroll.d.ts.map +1 -1
- package/lib/types/client/chat/use-process-scroll.js.map +1 -1
- package/lib/types/client/contract/chat-nodes.d.ts +4 -0
- package/lib/types/client/contract/chat-nodes.d.ts.map +1 -1
- package/lib/types/client/contract/chat-nodes.js.map +1 -1
- package/lib/types/client/contract/chat-visibility.d.ts +2 -2
- package/lib/types/client/contract/chat-visibility.js.map +1 -1
- package/lib/types/client/contract/slots.d.ts +15 -5
- package/lib/types/client/contract/slots.d.ts.map +1 -1
- package/lib/types/client/conversation-nodes/request-prompt.d.ts +8 -3
- package/lib/types/client/conversation-nodes/request-prompt.d.ts.map +1 -1
- package/lib/types/client/conversation-nodes/request-prompt.js.map +1 -1
- package/lib/types/client/conversation-nodes/retry.d.ts.map +1 -1
- package/lib/types/client/conversation-nodes/retry.js.map +1 -1
- package/lib/types/client/conversation-nodes/tool.d.ts +18 -3
- package/lib/types/client/conversation-nodes/tool.d.ts.map +1 -1
- package/lib/types/client/conversation-nodes/tool.js.map +1 -1
- package/lib/types/client/fence/FenceLayers.d.ts +1 -1
- package/lib/types/client/fence/FenceLayers.d.ts.map +1 -1
- package/lib/types/client/fence/FenceLayers.js.map +1 -1
- package/lib/types/client/locale.d.ts +96 -0
- package/lib/types/client/locale.d.ts.map +1 -1
- package/lib/types/client/locale.js.map +1 -1
- package/lib/types/client/markdown-labels.d.ts +1 -1
- package/lib/types/client/markdown-labels.d.ts.map +1 -1
- package/lib/types/client/settings/LinkOpeningRow.d.ts +2 -2
- package/lib/types/client/settings/LinkOpeningRow.d.ts.map +1 -1
- package/lib/types/client/settings/PerformanceUsageRow.d.ts +2 -2
- package/lib/types/client/settings/PerformanceUsageRow.d.ts.map +1 -1
- package/lib/types/client/settings/PreferenceRow.js.map +1 -1
- package/lib/types/client/settings/TranscriptViewRow.d.ts +2 -2
- package/lib/types/client/settings/TranscriptViewRow.d.ts.map +1 -1
- package/package.json +46 -46
- package/src/client/apply.ts +9 -9
- package/src/client/chat/ApprovalCommand.tsx +1 -1
- package/src/client/chat/AssistantMarkdown.module.css +10 -16
- package/src/client/chat/AssistantMarkdown.tsx +3 -3
- package/src/client/chat/AssistantNodeView.tsx +1 -1
- package/src/client/chat/ChatAside.tsx +1 -1
- package/src/client/chat/ChatFlow.tsx +2 -2
- package/src/client/chat/ChatGroupSeat.tsx +10 -6
- package/src/client/chat/ChatNodeSeat.tsx +12 -4
- package/src/client/chat/ChatView.module.css +30 -9
- package/src/client/chat/ChatView.tsx +5 -4
- package/src/client/chat/CommandNodeView.tsx +1 -1
- package/src/client/chat/CommandStatusRow.tsx +1 -1
- package/src/client/chat/CompactionItem.tsx +1 -1
- package/src/client/chat/ContextBody.module.css +8 -0
- package/src/client/chat/ContextBody.tsx +32 -2
- package/src/client/chat/ContextInjectionRow.tsx +1 -1
- package/src/client/chat/MessageIconActions.module.css +7 -0
- package/src/client/chat/MessageIconActions.tsx +1 -1
- package/src/client/chat/MessageItem.module.css +40 -48
- package/src/client/chat/MessageItem.tsx +58 -26
- package/src/client/chat/QuotaNoticeHost.tsx +1 -1
- package/src/client/chat/ReasoningContent.tsx +2 -2
- package/src/client/chat/ReasoningRow.tsx +2 -2
- package/src/client/chat/RunningStatus.tsx +1 -1
- package/src/client/chat/StatsPills.tsx +2 -2
- package/src/client/chat/SystemPromptRow.tsx +23 -7
- package/src/client/chat/TurnNavigator.module.css +1 -1
- package/src/client/chat/TurnProcessNodeView.tsx +1 -1
- package/src/client/chat/TurnTailNodeView.tsx +1 -1
- package/src/client/chat/TurnTriggerNodeView.tsx +1 -1
- package/src/client/chat/TurnUsagePanel.tsx +1 -1
- package/src/client/chat/UserContent.tsx +2 -2
- package/src/client/chat/flow-motion.ts +3 -1
- package/src/client/chat/message-chrome.ts +1 -1
- package/src/client/chat/searchable-hidden.ts +1 -1
- package/src/client/chat/stat-dialog.module.css +8 -6
- package/src/client/chat/stat-dialog.ts +5 -5
- package/src/client/chat/step-process.ts +33 -1
- package/src/client/chat/text-interaction.ts +6 -6
- package/src/client/chat/text-selection.ts +13 -10
- package/src/client/chat/use-chat-scroll.ts +2 -2
- package/src/client/chat/use-chat-viewport.ts +12 -11
- package/src/client/chat/use-process-scroll.ts +1 -1
- package/src/client/contract/chat-nodes.ts +4 -0
- package/src/client/contract/chat-visibility.ts +3 -3
- package/src/client/contract/slots.ts +15 -5
- package/src/client/conversation-nodes/README.i18n.yaml +2 -2
- package/src/client/conversation-nodes/README.md +3 -3
- package/src/client/conversation-nodes/README.zh.md +3 -3
- package/src/client/conversation-nodes/request-prompt.ts +16 -6
- package/src/client/conversation-nodes/retry.ts +19 -1
- package/src/client/conversation-nodes/tool.ts +49 -28
- package/src/client/conversation-nodes/turn-process.ts +1 -1
- package/src/client/fence/FenceLayers.tsx +2 -2
- package/src/client/locale.ts +96 -0
- package/src/client/markdown-labels.ts +1 -1
- package/src/client/model/tool-call-tree.ts +1 -1
- package/src/client/settings/LinkOpeningRow.tsx +2 -2
- package/src/client/settings/PerformanceUsageRow.tsx +2 -2
- package/src/client/settings/PreferenceRow.tsx +1 -1
- package/src/client/settings/TranscriptViewRow.tsx +2 -2
|
@@ -187,73 +187,65 @@
|
|
|
187
187
|
white-space: nowrap;
|
|
188
188
|
}
|
|
189
189
|
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
.retrySummary {
|
|
197
|
-
display: inline-flex;
|
|
198
|
-
align-items: center;
|
|
199
|
-
width: fit-content;
|
|
200
|
-
max-width: 100%;
|
|
201
|
-
padding: 2px 0;
|
|
202
|
-
gap: 7px;
|
|
203
|
-
border-radius: var(--dsw-radius-sm);
|
|
204
|
-
color: inherit;
|
|
205
|
-
cursor: pointer;
|
|
206
|
-
list-style: none;
|
|
207
|
-
user-select: none;
|
|
190
|
+
@media (prefers-reduced-motion: reduce) {
|
|
191
|
+
.compactionButton {
|
|
192
|
+
transition: none;
|
|
193
|
+
}
|
|
208
194
|
}
|
|
209
195
|
|
|
210
|
-
|
|
211
|
-
|
|
196
|
+
/* The retry row matches its neighbours: step rows (secondary size) when the
|
|
197
|
+
Turn shows its step runs flat, and group headers (body size) when it shows
|
|
198
|
+
them grouped. It keeps the 24px line, but its status wraps in a narrow column
|
|
199
|
+
instead of clipping: the row grows from its single-line height and the glyph
|
|
200
|
+
stays on the first line. */
|
|
201
|
+
[data-disclosure-row].retryRow {
|
|
202
|
+
height: auto;
|
|
203
|
+
min-height: calc(24px + var(--dsh-content-font-delta, 0px));
|
|
204
|
+
align-items: flex-start;
|
|
212
205
|
}
|
|
213
206
|
|
|
214
|
-
.
|
|
215
|
-
|
|
216
|
-
width: 6px;
|
|
217
|
-
height: 6px;
|
|
218
|
-
margin-right: 2px;
|
|
219
|
-
border-right: 1.5px solid currentcolor;
|
|
220
|
-
border-bottom: 1.5px solid currentcolor;
|
|
221
|
-
content: '';
|
|
222
|
-
transform: rotate(-45deg);
|
|
223
|
-
transition: transform 120ms ease;
|
|
207
|
+
[data-disclosure-row] .retryLeading {
|
|
208
|
+
margin-top: 4px;
|
|
224
209
|
}
|
|
225
210
|
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
@media (prefers-reduced-motion: reduce) {
|
|
233
|
-
.compactionButton {
|
|
234
|
-
transition: none;
|
|
235
|
-
}
|
|
211
|
+
[data-disclosure-row] .retryTitle {
|
|
212
|
+
flex: 0 1 auto;
|
|
213
|
+
font-size: var(--dsh-content-font-size-secondary, 13px);
|
|
214
|
+
min-width: 0;
|
|
215
|
+
white-space: normal;
|
|
216
|
+
overflow-wrap: anywhere;
|
|
236
217
|
}
|
|
237
218
|
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
219
|
+
/* Title (attempt/maximum) · countdown, with the tool-row separator dot and summary type. */
|
|
220
|
+
.retrySeparator {
|
|
221
|
+
flex: none;
|
|
222
|
+
align-self: center;
|
|
223
|
+
width: 2px;
|
|
224
|
+
height: 2px;
|
|
225
|
+
margin: 0 8px;
|
|
226
|
+
border-radius: 1px;
|
|
227
|
+
background: var(--dsw-alias-label-caption);
|
|
241
228
|
}
|
|
242
229
|
|
|
243
|
-
.
|
|
230
|
+
.retryProgress {
|
|
244
231
|
min-width: 0;
|
|
245
232
|
overflow-wrap: anywhere;
|
|
233
|
+
font-size: var(--dsh-content-font-size-secondary, 13px);
|
|
234
|
+
line-height: calc(24px + var(--dsh-content-font-delta, 0px));
|
|
246
235
|
}
|
|
247
236
|
|
|
248
|
-
.
|
|
249
|
-
|
|
237
|
+
.retryBesideGroups [data-disclosure-row] .retryTitle,
|
|
238
|
+
.retryBesideGroups .retryProgress {
|
|
239
|
+
font-size: var(--dsh-content-font-size, 14px);
|
|
250
240
|
}
|
|
251
241
|
|
|
242
|
+
/* Retry delay and failure under the expanded retry row, aligned with its title text. */
|
|
252
243
|
.retryDetails {
|
|
253
244
|
display: grid;
|
|
254
245
|
gap: 2px;
|
|
255
|
-
margin-top:
|
|
256
|
-
padding-left:
|
|
246
|
+
margin-top: 2px;
|
|
247
|
+
padding-left: calc(22px + var(--dsh-content-font-delta, 0px));
|
|
248
|
+
color: var(--dsw-alias-label-tertiary);
|
|
257
249
|
overflow-wrap: anywhere;
|
|
258
250
|
font-size: var(--dsh-content-font-size-secondary, 13px);
|
|
259
251
|
line-height: calc(18px + var(--dsh-content-font-delta-secondary, 0px));
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import { memo, useEffect, useMemo, useState } from 'react'
|
|
1
|
+
import { memo, useCallback, useEffect, useMemo, useState } from 'react'
|
|
2
2
|
import type { ReactNode } from 'react'
|
|
3
3
|
import type { PendingSubmission } from '@deepseek-ai/dsh-api-session-controller/client'
|
|
4
|
-
import type { InjectFace, PropsRenderFactories, PropsRenderSlots } from '@deepseek-ai/dsh-client-ui-slots'
|
|
4
|
+
import type { InjectFace, PropsRenderFactories, PropsRenderSlots } from '@deepseek-ai/dsh-client-ui-slots/client'
|
|
5
5
|
import type { UserTextFacts } from '@deepseek-ai/dsh-client-ui-conversation/client'
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
DisclosureRow, IconBranchOutlineRegular, IconWarningOutlineRegular, IconWifiOffOutlineRegular, IconWifiOutlineRegular,
|
|
8
|
+
InspectButton, JsonBlock, StateDot,
|
|
9
|
+
} from '@deepseek-ai/dsh-client-ui-primitives/client'
|
|
7
10
|
import type {
|
|
8
11
|
ChatNodeOwnerProps, ChatNodeViewProps, ChatViewSlotProps, UserContentAttachment, UserContentData, UserContentInput,
|
|
9
12
|
} from '../contract/slots.ts'
|
|
@@ -12,6 +15,7 @@ import { CommandStatusRow } from './CommandStatusRow.tsx'
|
|
|
12
15
|
import { CompactionItem, type CompactionRowInjected } from './CompactionItem.tsx'
|
|
13
16
|
import { ContextInjectionRow } from './ContextInjectionRow.tsx'
|
|
14
17
|
import { MessageIconActions } from './MessageIconActions.tsx'
|
|
18
|
+
import a11yCss from './accessibility.module.css'
|
|
15
19
|
import css from './MessageItem.module.css'
|
|
16
20
|
|
|
17
21
|
const EMPTY_TEXT_FACTS: Readonly<Partial<UserTextFacts>> = {}
|
|
@@ -61,11 +65,26 @@ function failureMessage(
|
|
|
61
65
|
return code === 'AUTH' ? t('message.failure.auth') : message
|
|
62
66
|
}
|
|
63
67
|
|
|
64
|
-
|
|
68
|
+
/** The retry glyph: an empty model answer is a warning; other failures read as connection trouble. */
|
|
69
|
+
function retryIcon(node: ModelRetryNode, failed: boolean): ReactNode {
|
|
70
|
+
if (node.failure.code === 'EMPTY_RESPONSE') return <IconWarningOutlineRegular />
|
|
71
|
+
return failed ? <IconWifiOffOutlineRegular /> : <IconWifiOutlineRegular />
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function ModelRetryItem({ node, active, inFlight, failed, grouped, inspect, t }: {
|
|
65
75
|
node: ModelRetryNode
|
|
76
|
+
/** The retry is waiting out its delay; the countdown runs. */
|
|
66
77
|
active: boolean
|
|
78
|
+
/** The retried request is in flight; the row still reads as retrying, without a countdown. */
|
|
79
|
+
inFlight: boolean
|
|
80
|
+
failed: boolean
|
|
81
|
+
/** Whether the row sits beside step-group headers and uses their type size. */
|
|
82
|
+
grouped: boolean
|
|
83
|
+
inspect: (() => void) | undefined
|
|
67
84
|
t: ChatViewSlotProps['t']
|
|
68
85
|
}) {
|
|
86
|
+
const [open, setOpen] = useState(false)
|
|
87
|
+
const toggle = useCallback(() => { setOpen(value => !value) }, [])
|
|
69
88
|
// Anchor the host-scheduled delay to this browser's first render of the
|
|
70
89
|
// retry node. Host event time and Date.now() may belong to different clocks.
|
|
71
90
|
const deadline = useMemo(() => Date.now() + node.delayMs, [node.delayMs, node.seq])
|
|
@@ -97,7 +116,10 @@ function ModelRetryItem({ node, active, t }: {
|
|
|
97
116
|
return () => { window.clearInterval(timer) }
|
|
98
117
|
}, [active, deadline])
|
|
99
118
|
|
|
100
|
-
|
|
119
|
+
// The row keeps one retrying state from the delay through the in-flight request, so the label and
|
|
120
|
+
// shimmer do not flip to the settled text for the frames between two attempts.
|
|
121
|
+
const retrying = active || inFlight
|
|
122
|
+
const label = retrying
|
|
101
123
|
? t('message.retry.active')
|
|
102
124
|
: node.retryState === 'cancelled'
|
|
103
125
|
? t('message.retry.cancelled')
|
|
@@ -106,26 +128,33 @@ function ModelRetryItem({ node, active, t }: {
|
|
|
106
128
|
: t('message.retry.scheduled')
|
|
107
129
|
const seconds = active ? remainingSeconds : scheduledSeconds
|
|
108
130
|
|
|
131
|
+
const status = t('message.retry.status', { label, retry: node.retry, maximum, seconds })
|
|
132
|
+
const title = t('message.retry.title', { label, retry: node.retry, maximum })
|
|
133
|
+
const remaining = t('message.retry.countdown', { seconds })
|
|
109
134
|
return (
|
|
110
|
-
<
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
135
|
+
<div className={grouped ? css.retryBesideGroups : undefined} data-retry-row data-inspect-scope
|
|
136
|
+
data-active={retrying || undefined} data-failed={failed || undefined}>
|
|
137
|
+
<span className={a11yCss.visuallyHidden} role="status" aria-atomic="true">{status}</span>
|
|
138
|
+
<DisclosureRow icon={retryIcon(node, failed)} title={title}
|
|
139
|
+
rowClassName={css.retryRow} leadingClassName={css.retryLeading} titleClassName={css.retryTitle}
|
|
140
|
+
running={retrying} open={open} expandable expandOnRowClick keepContentWhenOpen onToggle={toggle}
|
|
141
|
+
collapsedContent={<>
|
|
142
|
+
<span className={css.retrySeparator} data-shimmer-decoration aria-hidden />
|
|
143
|
+
<span className={css.retryProgress}>{remaining}</span>
|
|
144
|
+
</>}>
|
|
145
|
+
<div className={css.retryDetails}>
|
|
146
|
+
<div>
|
|
147
|
+
<span className={css.retryDetailLabel}>{t('message.retry.delay')}</span>
|
|
148
|
+
{t('duration.milliseconds', { milliseconds: Math.round(node.delayMs) })}
|
|
149
|
+
</div>
|
|
150
|
+
<div>
|
|
151
|
+
<span className={css.retryDetailLabel}>{t('message.retry.failure')}</span>
|
|
152
|
+
{failureMessage(node.failure.message, node.failure.code, t)}
|
|
153
|
+
</div>
|
|
126
154
|
</div>
|
|
127
|
-
|
|
128
|
-
|
|
155
|
+
{inspect !== undefined && <InspectButton label={t('message.retry.inspect')} onClick={inspect} />}
|
|
156
|
+
</DisclosureRow>
|
|
157
|
+
</div>
|
|
129
158
|
)
|
|
130
159
|
}
|
|
131
160
|
|
|
@@ -406,9 +435,12 @@ export const InheritedHistoryNodeView = memo(function InheritedHistoryNodeView({
|
|
|
406
435
|
})
|
|
407
436
|
|
|
408
437
|
/** Correlated retry-chain keyed Chat renderer. */
|
|
409
|
-
export const RetryNodeView = memo(function RetryNodeView({ node, t }: ChatNodeViewProps<'model-retry'>) {
|
|
410
|
-
const
|
|
411
|
-
|
|
438
|
+
export const RetryNodeView = memo(function RetryNodeView({ node, inspectRequest, stepRunsGrouped, t }: ChatNodeViewProps<'model-retry'>) {
|
|
439
|
+
const { current, failed, inFlight } = node.data
|
|
440
|
+
const inspect = useMemo(() => inspectRequest === undefined
|
|
441
|
+
? undefined
|
|
442
|
+
: () => { inspectRequest(current.turn, current.step) }, [inspectRequest, current.turn, current.step])
|
|
443
|
+
return <ModelRetryItem node={current} active={current.retryState === 'scheduled'} inFlight={inFlight} failed={failed} grouped={stepRunsGrouped === true} inspect={inspect} t={t} />
|
|
412
444
|
})
|
|
413
445
|
|
|
414
446
|
/** Terminal turn-error keyed Chat renderer. */
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* `shell.quota-notice` entry may replace the generic Toast for codes it claims.
|
|
5
5
|
*/
|
|
6
6
|
import { Fragment } from 'react'
|
|
7
|
-
import { IconWarningOutlineRegular, Toast } from '@deepseek-ai/dsh-client-ui-primitives'
|
|
7
|
+
import { IconWarningOutlineRegular, Toast } from '@deepseek-ai/dsh-client-ui-primitives/client'
|
|
8
8
|
import type { QuotaNoticeHostProps, QuotaNoticeOwnerProps } from '../contract/slots.ts'
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** Official reasoning content and its default Body Slot adapter. */
|
|
2
2
|
import { memo, useMemo } from 'react'
|
|
3
|
-
import { MarkdownText } from '@deepseek-ai/dsh-client-ui-primitives'
|
|
4
|
-
import type { FactoryComponentPropsOf, PropsRenderFactories, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots'
|
|
3
|
+
import { MarkdownText } from '@deepseek-ai/dsh-client-ui-primitives/client'
|
|
4
|
+
import type { FactoryComponentPropsOf, PropsRenderFactories, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots/client'
|
|
5
5
|
import { markdownLabels } from '../markdown-labels.ts'
|
|
6
6
|
|
|
7
7
|
type ReasoningBodyProps = PropsRuntime<'conversation.chat.reasoning.body'> & PropsRenderFactories
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** Assistant reasoning disclosure, independent of Tool-call presentation. */
|
|
2
2
|
import { memo, useMemo } from 'react'
|
|
3
|
-
import { DisclosureRow, IconThinkOutlineRegular, TextShimmer } from '@deepseek-ai/dsh-client-ui-primitives'
|
|
4
|
-
import type { PropsRenderSlots } from '@deepseek-ai/dsh-client-ui-slots'
|
|
3
|
+
import { DisclosureRow, IconThinkOutlineRegular, TextShimmer } from '@deepseek-ai/dsh-client-ui-primitives/client'
|
|
4
|
+
import type { PropsRenderSlots } from '@deepseek-ai/dsh-client-ui-slots/client'
|
|
5
5
|
import type { ChatViewSlotProps, UseDisclosure, UsePresentation } from '../contract/slots.ts'
|
|
6
6
|
import { reasoningText } from '../reasoning-text.ts'
|
|
7
7
|
import a11yCss from './accessibility.module.css'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** Running Turn clock isolated from the transcript's render cycle. */
|
|
2
2
|
import { memo, useEffect, useState } from 'react'
|
|
3
|
-
import { TextShimmer } from '@deepseek-ai/dsh-client-ui-primitives'
|
|
3
|
+
import { TextShimmer } from '@deepseek-ai/dsh-client-ui-primitives/client'
|
|
4
4
|
import type { ChatViewSlotProps } from '../contract/slots.ts'
|
|
5
5
|
import { formatRunDuration, LIVE_RUN_CLOCK_INTERVAL_MS } from './message-chrome.ts'
|
|
6
6
|
import { RunningWhaleTail } from './RunningWhaleTail.tsx'
|
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
|
|
7
7
|
import { memo, useMemo, type ReactNode } from 'react'
|
|
8
8
|
import { createPortal } from 'react-dom'
|
|
9
|
-
import { IconDatabaseOutlineRegular, IconGaugeOutlineRegular, Tooltip } from '@deepseek-ai/dsh-client-ui-primitives'
|
|
9
|
+
import { IconDatabaseOutlineRegular, IconGaugeOutlineRegular, Tooltip } from '@deepseek-ai/dsh-client-ui-primitives/client'
|
|
10
10
|
import type { UseProjection } from '@deepseek-ai/dsh-api-session-controller/client'
|
|
11
|
-
import type { InjectFace, SnapshotSelectorHook } from '@deepseek-ai/dsh-client-ui-slots'
|
|
11
|
+
import type { InjectFace, SnapshotSelectorHook } from '@deepseek-ai/dsh-client-ui-slots/client'
|
|
12
12
|
// Type-only: merges the sessionStats key into SessionProjectionMap for useProjection.
|
|
13
13
|
import type {} from '@deepseek-ai/dsh-session-stats/client'
|
|
14
14
|
import type { TokenUsageProjection } from '@deepseek-ai/dsh-token-meter/client'
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { memo, useState } from 'react'
|
|
2
2
|
import type { ChatNodeViewProps, ChatViewSlotProps } from '../contract/slots.ts'
|
|
3
|
-
import { DisclosureRow, IconBrowseOutlineRegular } from '@deepseek-ai/dsh-client-ui-primitives'
|
|
4
|
-
import {
|
|
3
|
+
import { DisclosureRow, IconBrowseOutlineRegular } from '@deepseek-ai/dsh-client-ui-primitives/client'
|
|
4
|
+
import type { SystemMessageSections } from '@deepseek-ai/dsh-client-ui-conversation/client'
|
|
5
|
+
import { OpaqueBody, SystemSectionsBody } from './ContextBody.tsx'
|
|
5
6
|
import css from './ContextInjectionRow.module.css'
|
|
6
7
|
|
|
7
8
|
/** Props for one complete system prompt disclosure. */
|
|
@@ -10,6 +11,8 @@ export interface SystemPromptRowProps {
|
|
|
10
11
|
text: string
|
|
11
12
|
/** True when the prompt replaced an earlier one from this position in the history. */
|
|
12
13
|
update?: boolean
|
|
14
|
+
/** Section-attributed reading of an update; without it the body is the opaque text. */
|
|
15
|
+
message?: SystemMessageSections | undefined
|
|
13
16
|
/** The owning view's locale seat. */
|
|
14
17
|
t: ChatViewSlotProps['t']
|
|
15
18
|
}
|
|
@@ -18,25 +21,38 @@ export interface SystemPromptRowProps {
|
|
|
18
21
|
* Render one complete system prompt as a collapsed disclosure whose expanded
|
|
19
22
|
* body is the same opaque context chrome: 141px code-block scrollport and
|
|
20
23
|
* model-facing text with its real line breaks. An in-history update uses the
|
|
21
|
-
* same row under its own title
|
|
22
|
-
*
|
|
24
|
+
* same row under its own title; one carrying section metadata names its sources
|
|
25
|
+
* beside the title and splits the body by source.
|
|
26
|
+
* @param props - Prompt text, whether it is an update, its section reading, and the locale seat.
|
|
23
27
|
* @returns The system-prompt disclosure row.
|
|
24
28
|
*/
|
|
25
|
-
export function SystemPromptRow({ text, update = false, t }: SystemPromptRowProps) {
|
|
29
|
+
export function SystemPromptRow({ text, update = false, message, t }: SystemPromptRowProps) {
|
|
26
30
|
const [open, setOpen] = useState(false)
|
|
31
|
+
const names = message?.changes.map(change => change.name) ?? []
|
|
32
|
+
// Up to two sources are named in the row; more are counted.
|
|
33
|
+
const summary = names.length > 2 ? t('message.systemPromptSections', { count: names.length }) : names.join(', ')
|
|
27
34
|
return (
|
|
28
35
|
<DisclosureRow
|
|
29
36
|
className={css.root}
|
|
30
37
|
icon={<IconBrowseOutlineRegular size={14} />}
|
|
31
38
|
chevronClassName={css.chevron}
|
|
32
39
|
title={t(update ? 'message.systemPromptUpdate' : 'message.systemPrompt')}
|
|
40
|
+
collapsedContent={summary === '' ? undefined : (
|
|
41
|
+
<>
|
|
42
|
+
<span className={css.sep} aria-hidden />
|
|
43
|
+
<span className={css.summary} data-system-sources>{summary}</span>
|
|
44
|
+
</>
|
|
45
|
+
)}
|
|
46
|
+
keepContentWhenOpen
|
|
33
47
|
open={open}
|
|
34
48
|
expandable
|
|
35
49
|
expandOnRowClick
|
|
36
50
|
onToggle={() => { setOpen(value => !value) }}
|
|
37
51
|
>
|
|
38
52
|
<div className={css.body} data-system-prompt-body>
|
|
39
|
-
|
|
53
|
+
{message === undefined
|
|
54
|
+
? <OpaqueBody content={[{ type: 'text', text }]} source={null} t={t} />
|
|
55
|
+
: <SystemSectionsBody message={message} t={t} />}
|
|
40
56
|
</div>
|
|
41
57
|
</DisclosureRow>
|
|
42
58
|
)
|
|
@@ -46,5 +62,5 @@ export function SystemPromptRow({ text, update = false, t }: SystemPromptRowProp
|
|
|
46
62
|
export const SystemPromptNodeView = memo(function SystemPromptNodeView({
|
|
47
63
|
node, t,
|
|
48
64
|
}: Pick<ChatNodeViewProps<'system-prompt'>, 'node' | 't'>) {
|
|
49
|
-
return <SystemPromptRow text={node.data.text} update={node.data.update === true} t={t} />
|
|
65
|
+
return <SystemPromptRow text={node.data.text} update={node.data.update === true} message={node.data.message} t={t} />
|
|
50
66
|
})
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { memo } from 'react'
|
|
2
|
-
import { IconChevronDownOutlineRegular } from '@deepseek-ai/dsh-client-ui-primitives'
|
|
2
|
+
import { IconChevronDownOutlineRegular } from '@deepseek-ai/dsh-client-ui-primitives/client'
|
|
3
3
|
import type { ChatNodeViewProps } from '../contract/slots.ts'
|
|
4
4
|
import { turnProcessAlwaysOpen } from '../contract/turn-process.ts'
|
|
5
5
|
import { formatRunDuration } from './message-chrome.ts'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { memo } from 'react'
|
|
2
|
-
import type { InjectFace, PropsRenderSlots } from '@deepseek-ai/dsh-client-ui-slots'
|
|
2
|
+
import type { InjectFace, PropsRenderSlots } from '@deepseek-ai/dsh-client-ui-slots/client'
|
|
3
3
|
import type { ChatNodeViewProps, PerformanceUsageInjected, TurnTailOwnerProps } from '../contract/slots.ts'
|
|
4
4
|
import { MessageIconActions } from './MessageIconActions.tsx'
|
|
5
5
|
import { TurnUsagePanel } from './TurnUsagePanel.tsx'
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
IconChevronDownOutlineRegular, IconContextInjectionOutlineRegular, IconCordisPluginOutlineRegular,
|
|
6
6
|
IconGoalOutlineRegular, IconGlobeOutlineRegular, IconPaperPlaneOutlineRegular, IconQueueOutlineRegular,
|
|
7
7
|
IconUsersOutlineRegular, IconPlayOutlineRegular, type IconProps,
|
|
8
|
-
} from '@deepseek-ai/dsh-client-ui-primitives'
|
|
8
|
+
} from '@deepseek-ai/dsh-client-ui-primitives/client'
|
|
9
9
|
import type { ChatNodeViewProps } from '../contract/slots.ts'
|
|
10
10
|
import { formatMessageClock } from './message-chrome.ts'
|
|
11
11
|
import { NoticeBody } from './ContextBody.tsx'
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** Completed-Turn token usage action and its accounting details dialog. */
|
|
2
2
|
|
|
3
3
|
import { createPortal } from 'react-dom'
|
|
4
|
-
import { IconDatabaseOutlineRegular } from '@deepseek-ai/dsh-client-ui-primitives'
|
|
4
|
+
import { IconDatabaseOutlineRegular } from '@deepseek-ai/dsh-client-ui-primitives/client'
|
|
5
5
|
import type { TurnTokenUsage } from '../contract/chat-nodes.ts'
|
|
6
6
|
import type { ChatViewSlotProps } from '../contract/slots.ts'
|
|
7
7
|
import { formatCacheHitPercent, formatExactTokens, formatTokens } from './token-format.ts'
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** Reusable user contents inside a caller-owned message row. */
|
|
2
2
|
import { Fragment } from 'react'
|
|
3
|
-
import type { FactoryComponentPropsOf } from '@deepseek-ai/dsh-client-ui-slots'
|
|
4
|
-
import { fileExtension, FileTypeIcon, fileSizeText, JsonBlock, UserMessageBubble } from '@deepseek-ai/dsh-client-ui-primitives'
|
|
3
|
+
import type { FactoryComponentPropsOf } from '@deepseek-ai/dsh-client-ui-slots/client'
|
|
4
|
+
import { fileExtension, FileTypeIcon, fileSizeText, JsonBlock, UserMessageBubble } from '@deepseek-ai/dsh-client-ui-primitives/client'
|
|
5
5
|
import css from './MessageItem.module.css'
|
|
6
6
|
|
|
7
7
|
const EMPTY_LABELS: readonly string[] = []
|
|
@@ -533,7 +533,9 @@ function useFlowTransition(motion: FlowMotionRows | undefined, grow: boolean): H
|
|
|
533
533
|
* @param motion - owning viewport's row callbacks; undefined applies visibility synchronously.
|
|
534
534
|
* @returns the stable subtree ref.
|
|
535
535
|
*/
|
|
536
|
-
export function useFlowHidden(
|
|
536
|
+
export function useFlowHidden(
|
|
537
|
+
hidden: boolean, reveal: () => void, motion: FlowMotionRows | undefined,
|
|
538
|
+
): RefObject<HTMLDivElement | null> {
|
|
537
539
|
return useSearchableHidden(hidden, reveal, useFlowTransition(motion, false))
|
|
538
540
|
}
|
|
539
541
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Shared time-label helpers for user/assistant IconActions rows.
|
|
2
2
|
|
|
3
|
-
import type { Translate } from '@deepseek-ai/dsh-client-ui-slots'
|
|
3
|
+
import type { Translate } from '@deepseek-ai/dsh-client-ui-slots/client'
|
|
4
4
|
|
|
5
5
|
/** The date-template share of the conversation dictionary the clock consumes. */
|
|
6
6
|
export type ClockTranslate = Translate<'clock.md' | 'clock.ymd'>
|
|
@@ -19,7 +19,7 @@ export function useSearchableHidden(
|
|
|
19
19
|
hidden: boolean,
|
|
20
20
|
reveal: () => void,
|
|
21
21
|
transition?: HiddenTransition,
|
|
22
|
-
): RefObject<HTMLDivElement> {
|
|
22
|
+
): RefObject<HTMLDivElement | null> {
|
|
23
23
|
const ref = useRef<HTMLDivElement>(null)
|
|
24
24
|
useLayoutEffect(() => {
|
|
25
25
|
const element = ref.current
|
|
@@ -27,9 +27,11 @@
|
|
|
27
27
|
--dsh-scrollbar-thumb: var(--dsw-alias-scrollbar-bg-l2);
|
|
28
28
|
--dsh-scrollbar-thumb-hover: var(--dsw-alias-scrollbar-hover-l2);
|
|
29
29
|
position-area: none;
|
|
30
|
+
/* Anchor insets stay linear because scroll compensation runs after layout;
|
|
31
|
+
a clamp would drift from a sticky trigger while the transcript grows. */
|
|
30
32
|
top: max(12px, var(--dsh-frame-overlay-top, 12px));
|
|
31
|
-
bottom:
|
|
32
|
-
left:
|
|
33
|
+
bottom: calc(anchor(top) + 8px);
|
|
34
|
+
left: anchor(left);
|
|
33
35
|
right: 12px;
|
|
34
36
|
position-try-fallbacks: --dsh-stat-window, --dsh-stat-opposite, --dsh-stat-wide-opposite, --dsh-stat-tall, --dsh-stat-viewport;
|
|
35
37
|
align-self: end;
|
|
@@ -106,7 +108,7 @@
|
|
|
106
108
|
@position-try --dsh-stat-window {
|
|
107
109
|
position-area: none;
|
|
108
110
|
top: max(12px, var(--dsh-frame-overlay-top, 12px));
|
|
109
|
-
bottom:
|
|
111
|
+
bottom: calc(anchor(top) + 8px);
|
|
110
112
|
left: 12px;
|
|
111
113
|
right: 12px;
|
|
112
114
|
margin: 0;
|
|
@@ -115,13 +117,13 @@
|
|
|
115
117
|
}
|
|
116
118
|
|
|
117
119
|
@position-try --dsh-stat-opposite {
|
|
118
|
-
top:
|
|
120
|
+
top: calc(anchor(bottom) + 8px);
|
|
119
121
|
bottom: 12px;
|
|
120
122
|
align-self: start;
|
|
121
123
|
}
|
|
122
124
|
|
|
123
125
|
@position-try --dsh-stat-wide-opposite {
|
|
124
|
-
top:
|
|
126
|
+
top: calc(anchor(bottom) + 8px);
|
|
125
127
|
bottom: 12px;
|
|
126
128
|
left: 12px;
|
|
127
129
|
right: 12px;
|
|
@@ -133,7 +135,7 @@
|
|
|
133
135
|
position-area: none;
|
|
134
136
|
top: max(12px, var(--dsh-frame-overlay-top, 12px));
|
|
135
137
|
bottom: 12px;
|
|
136
|
-
left:
|
|
138
|
+
left: anchor(left);
|
|
137
139
|
right: 12px;
|
|
138
140
|
margin: 0;
|
|
139
141
|
align-self: safe start;
|
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
// (TurnUsagePanel) and the composer-dock session stats pills (StatsPills.tsx);
|
|
3
3
|
// the matching dialog surface skin lives in stat-dialog.module.css.
|
|
4
4
|
|
|
5
|
-
import { useEffect, useId, useRef, useState, type
|
|
6
|
-
import { useDismissOnOutsidePointer } from '@deepseek-ai/dsh-client-ui-primitives'
|
|
5
|
+
import { useEffect, useId, useRef, useState, type RefObject } from 'react'
|
|
6
|
+
import { useDismissOnOutsidePointer } from '@deepseek-ai/dsh-client-ui-primitives/client'
|
|
7
7
|
|
|
8
8
|
/** Open state, refs, and CSS anchor identity for one stat dialog. */
|
|
9
9
|
export interface StatDialogSeat {
|
|
10
10
|
open: boolean
|
|
11
11
|
setOpen: (open: boolean) => void
|
|
12
|
-
rootRef:
|
|
13
|
-
panelRef:
|
|
12
|
+
rootRef: RefObject<HTMLSpanElement | null>
|
|
13
|
+
panelRef: RefObject<HTMLDivElement | null>
|
|
14
14
|
anchorName: string
|
|
15
15
|
}
|
|
16
16
|
|
|
@@ -23,7 +23,7 @@ export function useStatDialog(): StatDialogSeat {
|
|
|
23
23
|
const rootRef = useRef<HTMLSpanElement | null>(null)
|
|
24
24
|
const panelRef = useRef<HTMLDivElement | null>(null)
|
|
25
25
|
|
|
26
|
-
const anchorName = `--dsh-stat-${useId().
|
|
26
|
+
const anchorName = `--dsh-stat-${useId().replace(/[^\w-]/g, '')}`
|
|
27
27
|
|
|
28
28
|
// Outside pointerdown closes through the shared primitive; the portaled
|
|
29
29
|
// panel counts as inside. An outside click also closes, because keyboard
|
|
@@ -1,6 +1,23 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/** Step-run grouping and localized titles for projected step-process activity. */
|
|
2
2
|
import type { ChatViewSlotProps } from '../contract/slots.ts'
|
|
3
3
|
import type { ProcessActivitySummary } from '../contract/process-groups.ts'
|
|
4
|
+
import type { ChatPresentationPolicy } from '../presentation-policy.ts'
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Decide whether a Turn shows its step runs behind group headers or flat.
|
|
8
|
+
* Detailed keeps the open Turn, and the latest completed Turn until the next input, flat.
|
|
9
|
+
* @param grouping - the work-details mode's step grouping.
|
|
10
|
+
* @param turnOpen - whether the Turn is still running.
|
|
11
|
+
* @param deferCollapse - whether the latest completed Turn stays flat until the next input.
|
|
12
|
+
* @returns whether the step runs render as group headers.
|
|
13
|
+
*/
|
|
14
|
+
export function stepRunsGrouped(
|
|
15
|
+
grouping: ChatPresentationPolicy['stepGrouping'],
|
|
16
|
+
turnOpen: boolean,
|
|
17
|
+
deferCollapse: boolean,
|
|
18
|
+
): boolean {
|
|
19
|
+
return grouping === 'collapsed' || (grouping === 'history' && !turnOpen && !deferCollapse)
|
|
20
|
+
}
|
|
4
21
|
|
|
5
22
|
/**
|
|
6
23
|
* Compose a closed group's localized title from its top three categories without counts.
|
|
@@ -26,3 +43,18 @@ export function processTitle(
|
|
|
26
43
|
const title = [first, ...labels.slice(1).map(continuation)].join(t('message.stepProcess.comma'))
|
|
27
44
|
return summary.counts.length > 3 ? t('message.stepProcess.more', { title }) : title
|
|
28
45
|
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Title an open group while no tool runs: the request analysis before any non-Context work, then the completed work and the next step.
|
|
49
|
+
* @param summary - ranked work and phase evidence for this range.
|
|
50
|
+
* @param t - Chat namespace translator.
|
|
51
|
+
* @returns the live title without its detail.
|
|
52
|
+
*/
|
|
53
|
+
export function thinkingTitle(
|
|
54
|
+
summary: ProcessActivitySummary,
|
|
55
|
+
t: ChatViewSlotProps['t'],
|
|
56
|
+
): string {
|
|
57
|
+
const first = summary.counts[0]
|
|
58
|
+
if (first === undefined || first.kind === 'context') return t('message.stepProcess.thinking')
|
|
59
|
+
return t('message.stepProcess.thinkingNext', { title: processTitle(summary, t) })
|
|
60
|
+
}
|
|
@@ -87,7 +87,7 @@ function visibleBounds(root: HTMLElement, source: HTMLElement, view: Window): Bo
|
|
|
87
87
|
* @returns current owner and area-local selection actions.
|
|
88
88
|
*/
|
|
89
89
|
export function useTextInteraction(
|
|
90
|
-
rootRef: RefObject<HTMLElement>, surfaceRef: RefObject<HTMLElement>,
|
|
90
|
+
rootRef: RefObject<HTMLElement | null>, surfaceRef: RefObject<HTMLElement | null>,
|
|
91
91
|
dispatchInteraction: (gesture: TextInteractionGesture) => string | null,
|
|
92
92
|
registeredIds: readonly string[],
|
|
93
93
|
): TextInteractionBinding {
|
|
@@ -202,7 +202,7 @@ export function useTextInteraction(
|
|
|
202
202
|
previousRange = selection?.rangeCount === 1 ? selection.getRangeAt(0).cloneRange() : null
|
|
203
203
|
dismiss()
|
|
204
204
|
selectionChangedDuringGesture = false
|
|
205
|
-
pointerSelecting = event.button === 0 &&
|
|
205
|
+
pointerSelecting = event.button === 0 && root.contains(event.target as Node)
|
|
206
206
|
}
|
|
207
207
|
const pointerUp = (event: PointerEvent): void => {
|
|
208
208
|
if (!pointerSelecting) return
|
|
@@ -212,7 +212,7 @@ export function useTextInteraction(
|
|
|
212
212
|
const cancel = (): void => { pointerSelecting = false; keyboardSelecting = false; dismiss() }
|
|
213
213
|
const keyDown = (event: KeyboardEvent): void => {
|
|
214
214
|
if (event.key === 'Escape') { cancel(); return }
|
|
215
|
-
if (insideSurface(event) || !(event.target
|
|
215
|
+
if (insideSurface(event) || !root.contains(event.target as Node)) return
|
|
216
216
|
if (event.key === 'Shift' || event.shiftKey) { keyboardSelecting = true; dismiss() }
|
|
217
217
|
}
|
|
218
218
|
const keyUp = (event: KeyboardEvent): void => {
|
|
@@ -222,10 +222,10 @@ export function useTextInteraction(
|
|
|
222
222
|
}
|
|
223
223
|
const contextMenu = (event: MouseEvent): void => {
|
|
224
224
|
if (insideSurface(event)) return
|
|
225
|
-
const element = event.target
|
|
226
|
-
const source = element
|
|
225
|
+
const element = event.target as Partial<Element>
|
|
226
|
+
const source = element.closest?.<HTMLElement>('[data-text-interaction-source]')
|
|
227
227
|
if (source === undefined || source === null || !root.contains(source)
|
|
228
|
-
|| element?.
|
|
228
|
+
|| element.closest?.('[data-text-interaction-exclude], button, input, textarea, [contenteditable="true"]')) return
|
|
229
229
|
pointerSelecting = false
|
|
230
230
|
dismiss()
|
|
231
231
|
const selected = readTextSelection(root, document.getSelection())
|