@deepseek-ai/dsh-client-ui-chat 0.2.3-alpha.2 → 0.2.3-alpha.4
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 +12 -12
- package/README.md +11 -9
- package/README.zh.md +11 -9
- package/lib/client.js +9 -9
- package/lib/client.js.map +1 -1
- package/lib/types/client/apply.d.ts.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 +3 -3
- 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.d.ts.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 +5 -3
- 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/TurnTailNodeView.js.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/register-node-renderers.d.ts +1 -5
- package/lib/types/client/chat/register-node-renderers.d.ts.map +1 -1
- package/lib/types/client/chat/register-node-renderers.js.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 +1 -0
- 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 +33 -12
- package/lib/types/client/contract/slots.d.ts.map +1 -1
- package/lib/types/client/conversation-nodes/command.js.map +1 -1
- package/lib/types/client/conversation-nodes/fallback.js.map +1 -1
- package/lib/types/client/conversation-nodes/message.js.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/index.d.ts +1 -1
- package/lib/types/client/index.d.ts.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/presentation-policy.d.ts +2 -0
- package/lib/types/client/presentation-policy.d.ts.map +1 -1
- package/lib/types/client/presentation-policy.js.map +1 -1
- package/lib/types/client/settings/LinkOpeningRow.d.ts +2 -3
- package/lib/types/client/settings/LinkOpeningRow.d.ts.map +1 -1
- package/lib/types/client/settings/LinkOpeningRow.js.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/PerformanceUsageRow.js.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/lib/types/client/settings/TranscriptViewRow.js.map +1 -1
- package/package.json +46 -46
- package/src/client/apply.ts +11 -10
- package/src/client/chat/ApprovalCommand.tsx +1 -1
- package/src/client/chat/AssistantMarkdown.module.css +10 -16
- package/src/client/chat/AssistantMarkdown.tsx +6 -5
- package/src/client/chat/AssistantNodeView.tsx +3 -3
- package/src/client/chat/ChatAside.tsx +1 -1
- package/src/client/chat/ChatFlow.tsx +2 -2
- package/src/client/chat/ChatGroupSeat.module.css +4 -2
- package/src/client/chat/ChatGroupSeat.tsx +10 -6
- package/src/client/chat/ChatNodeSeat.tsx +16 -6
- package/src/client/chat/ChatView.module.css +67 -14
- package/src/client/chat/ChatView.tsx +18 -10
- 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 +37 -4
- package/src/client/chat/ContextInjectionRow.tsx +4 -3
- 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 +97 -54
- 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 +26 -9
- package/src/client/chat/TurnNavigator.module.css +10 -1
- package/src/client/chat/TurnProcessNodeView.tsx +1 -1
- package/src/client/chat/TurnTailNodeView.tsx +4 -3
- package/src/client/chat/TurnTriggerNodeView.tsx +1 -1
- package/src/client/chat/TurnUsagePanel.tsx +1 -1
- package/src/client/chat/UserContent.tsx +4 -4
- package/src/client/chat/flow-motion.ts +3 -1
- package/src/client/chat/message-chrome.ts +1 -1
- package/src/client/chat/register-node-renderers.ts +5 -8
- 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 +7 -8
- package/src/client/chat/text-selection.ts +33 -14
- 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 +30 -13
- package/src/client/conversation-nodes/README.i18n.yaml +4 -4
- package/src/client/conversation-nodes/README.md +5 -4
- package/src/client/conversation-nodes/README.zh.md +5 -4
- package/src/client/conversation-nodes/command.ts +1 -1
- package/src/client/conversation-nodes/fallback.ts +1 -1
- package/src/client/conversation-nodes/message.ts +1 -1
- 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 +50 -29
- package/src/client/conversation-nodes/turn-process.ts +1 -1
- package/src/client/fence/FenceLayers.tsx +2 -2
- package/src/client/index.ts +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/presentation-policy.ts +6 -0
- package/src/client/settings/LinkOpeningRow.tsx +5 -3
- package/src/client/settings/PerformanceUsageRow.tsx +6 -3
- package/src/client/settings/PreferenceRow.tsx +5 -5
- package/src/client/settings/TranscriptViewRow.tsx +12 -5
|
@@ -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
|
|
|
@@ -247,6 +276,14 @@ export function PendingSteeringBubble({ content, loadImage, renderFactorySlot, t
|
|
|
247
276
|
renderFactorySlot: PropsRenderFactories['renderFactorySlot']
|
|
248
277
|
t: ChatViewSlotProps['t']
|
|
249
278
|
} & Pick<ChatNodeOwnerProps, 'loadImage'>): ReactNode {
|
|
279
|
+
const renderActions = useCallback((text: string) => (
|
|
280
|
+
<MessageIconActions
|
|
281
|
+
text={text}
|
|
282
|
+
clock="start"
|
|
283
|
+
className={css.actions}
|
|
284
|
+
t={t}
|
|
285
|
+
/>
|
|
286
|
+
), [t])
|
|
250
287
|
return (
|
|
251
288
|
<UserStyleBubble
|
|
252
289
|
node={UNDECORATED_ROW}
|
|
@@ -255,14 +292,7 @@ export function PendingSteeringBubble({ content, loadImage, renderFactorySlot, t
|
|
|
255
292
|
renderFactorySlot={renderFactorySlot}
|
|
256
293
|
loadImage={loadImage}
|
|
257
294
|
pending
|
|
258
|
-
actions={
|
|
259
|
-
<MessageIconActions
|
|
260
|
-
text={text}
|
|
261
|
-
clock="start"
|
|
262
|
-
className={css.actions}
|
|
263
|
-
t={t}
|
|
264
|
-
/>
|
|
265
|
-
)}
|
|
295
|
+
actions={renderActions}
|
|
266
296
|
/>
|
|
267
297
|
)
|
|
268
298
|
}
|
|
@@ -300,6 +330,15 @@ export function PendingSubmissionBubble({ submission, loadImage, renderFactorySl
|
|
|
300
330
|
: { type: 'file', file: attachment.value }),
|
|
301
331
|
[submission.attachments],
|
|
302
332
|
)
|
|
333
|
+
const renderActions = useCallback((text: string) => (
|
|
334
|
+
<MessageIconActions
|
|
335
|
+
text={text}
|
|
336
|
+
time={submission.time}
|
|
337
|
+
clock="start"
|
|
338
|
+
className={css.actions}
|
|
339
|
+
t={t}
|
|
340
|
+
/>
|
|
341
|
+
), [submission.time, t])
|
|
303
342
|
return (
|
|
304
343
|
<UserStyleBubble
|
|
305
344
|
node={UNDECORATED_ROW}
|
|
@@ -310,15 +349,7 @@ export function PendingSubmissionBubble({ submission, loadImage, renderFactorySl
|
|
|
310
349
|
loadImage={loadImage}
|
|
311
350
|
pending={submission.placement === 'steering'}
|
|
312
351
|
echo
|
|
313
|
-
actions={
|
|
314
|
-
<MessageIconActions
|
|
315
|
-
text={text}
|
|
316
|
-
time={submission.time}
|
|
317
|
-
clock="start"
|
|
318
|
-
className={css.actions}
|
|
319
|
-
t={t}
|
|
320
|
-
/>
|
|
321
|
-
)}
|
|
352
|
+
actions={renderActions}
|
|
322
353
|
/>
|
|
323
354
|
)
|
|
324
355
|
}
|
|
@@ -331,12 +362,28 @@ export function PendingSubmissionBubble({ submission, loadImage, renderFactorySl
|
|
|
331
362
|
* bubble without asking for it.
|
|
332
363
|
*/
|
|
333
364
|
export const UserMessageNodeView = memo(function UserMessageNodeView({
|
|
334
|
-
node, renderFactorySlot, loadImage, renderSlotChain, t,
|
|
365
|
+
node, renderFactorySlot, loadImage, renderSlotChain, renderSlot, t,
|
|
335
366
|
}: ChatNodeViewProps<'user' | 'steering'> & {
|
|
336
367
|
/** Bound by the `user` keyed registration, the only entry that declares the seat. */
|
|
337
368
|
renderSlotChain: PropsRenderSlots<'conversation.chat.user.before'>['renderSlotChain']
|
|
369
|
+
/** Bound by the `user` keyed registration, the only entry that declares the action list. */
|
|
370
|
+
renderSlot: PropsRenderSlots<'conversation.chat.user-actions'>['renderSlot']
|
|
338
371
|
}) {
|
|
339
372
|
const data = node.data
|
|
373
|
+
// A steering row shares the renderer without the action list; a synthetic projection names no durable message.
|
|
374
|
+
const userActions = node.kind === 'user' && data.messageId !== undefined
|
|
375
|
+
? renderSlot('conversation.chat.user-actions', { messageId: data.messageId })
|
|
376
|
+
: null
|
|
377
|
+
const renderActions = useCallback((text: string) => (
|
|
378
|
+
<MessageIconActions
|
|
379
|
+
text={text}
|
|
380
|
+
time={data.time}
|
|
381
|
+
clock="start"
|
|
382
|
+
className={css.actions}
|
|
383
|
+
extraActions={userActions}
|
|
384
|
+
t={t}
|
|
385
|
+
/>
|
|
386
|
+
), [data.time, t, userActions])
|
|
340
387
|
return (
|
|
341
388
|
<UserStyleBubble
|
|
342
389
|
node={node}
|
|
@@ -348,15 +395,7 @@ export const UserMessageNodeView = memo(function UserMessageNodeView({
|
|
|
348
395
|
batchStart={node.kind === 'steering' && node.data.batchStart === true}
|
|
349
396
|
{...data.referenceLabels === undefined ? {} : { referenceLabels: data.referenceLabels }}
|
|
350
397
|
{...data.skillNames === undefined ? {} : { skillNames: data.skillNames }}
|
|
351
|
-
actions={
|
|
352
|
-
<MessageIconActions
|
|
353
|
-
text={text}
|
|
354
|
-
time={data.time}
|
|
355
|
-
clock="start"
|
|
356
|
-
className={css.actions}
|
|
357
|
-
t={t}
|
|
358
|
-
/>
|
|
359
|
-
)}
|
|
398
|
+
actions={renderActions}
|
|
360
399
|
/>
|
|
361
400
|
)
|
|
362
401
|
})
|
|
@@ -406,9 +445,12 @@ export const InheritedHistoryNodeView = memo(function InheritedHistoryNodeView({
|
|
|
406
445
|
})
|
|
407
446
|
|
|
408
447
|
/** Correlated retry-chain keyed Chat renderer. */
|
|
409
|
-
export const RetryNodeView = memo(function RetryNodeView({ node, t }: ChatNodeViewProps<'model-retry'>) {
|
|
410
|
-
const
|
|
411
|
-
|
|
448
|
+
export const RetryNodeView = memo(function RetryNodeView({ node, inspectRequest, stepRunsGrouped, t }: ChatNodeViewProps<'model-retry'>) {
|
|
449
|
+
const { current, failed, inFlight } = node.data
|
|
450
|
+
const inspect = useMemo(() => inspectRequest === undefined
|
|
451
|
+
? undefined
|
|
452
|
+
: () => { inspectRequest(current.turn, current.step) }, [inspectRequest, current.turn, current.step])
|
|
453
|
+
return <ModelRetryItem node={current} active={current.retryState === 'scheduled'} inFlight={inFlight} failed={failed} grouped={stepRunsGrouped === true} inspect={inspect} t={t} />
|
|
412
454
|
})
|
|
413
455
|
|
|
414
456
|
/** Terminal turn-error keyed Chat renderer. */
|
|
@@ -424,12 +466,13 @@ export const TurnMaxTokensNodeView = memo(function TurnMaxTokensNodeView({ t }:
|
|
|
424
466
|
/** Explicit unknown-surface keyed Chat renderer. */
|
|
425
467
|
export const UnknownNodeView = memo(function UnknownNodeView({ node, t }: ChatNodeViewProps<'unknown'>) {
|
|
426
468
|
const data = node.data
|
|
469
|
+
const truncatedLabel = useCallback((total: number) => t('json.truncated', { total }), [t])
|
|
427
470
|
return (
|
|
428
471
|
<div className={css.contextRow}>
|
|
429
472
|
<JsonBlock
|
|
430
473
|
label={t('message.unknownSurface', { type: data.type })}
|
|
431
474
|
payload={data.data}
|
|
432
|
-
truncatedLabel={
|
|
475
|
+
truncatedLabel={truncatedLabel}
|
|
433
476
|
/>
|
|
434
477
|
</div>
|
|
435
478
|
)
|
|
@@ -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
|
-
import { memo, useState } from 'react'
|
|
1
|
+
import { memo, useCallback, 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,39 @@ 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 toggleOpen = useCallback(() => { setOpen(value => !value) }, [])
|
|
32
|
+
const names = message?.changes.map(change => change.name) ?? []
|
|
33
|
+
// Up to two sources are named in the row; more are counted.
|
|
34
|
+
const summary = names.length > 2 ? t('message.systemPromptSections', { count: names.length }) : names.join(', ')
|
|
27
35
|
return (
|
|
28
36
|
<DisclosureRow
|
|
29
37
|
className={css.root}
|
|
30
38
|
icon={<IconBrowseOutlineRegular size={14} />}
|
|
31
39
|
chevronClassName={css.chevron}
|
|
32
40
|
title={t(update ? 'message.systemPromptUpdate' : 'message.systemPrompt')}
|
|
41
|
+
collapsedContent={summary === '' ? undefined : (
|
|
42
|
+
<>
|
|
43
|
+
<span className={css.sep} aria-hidden />
|
|
44
|
+
<span className={css.summary} data-system-sources>{summary}</span>
|
|
45
|
+
</>
|
|
46
|
+
)}
|
|
47
|
+
keepContentWhenOpen
|
|
33
48
|
open={open}
|
|
34
49
|
expandable
|
|
35
50
|
expandOnRowClick
|
|
36
|
-
onToggle={
|
|
51
|
+
onToggle={toggleOpen}
|
|
37
52
|
>
|
|
38
53
|
<div className={css.body} data-system-prompt-body>
|
|
39
|
-
|
|
54
|
+
{message === undefined
|
|
55
|
+
? <OpaqueBody content={[{ type: 'text', text }]} source={null} t={t} />
|
|
56
|
+
: <SystemSectionsBody message={message} t={t} />}
|
|
40
57
|
</div>
|
|
41
58
|
</DisclosureRow>
|
|
42
59
|
)
|
|
@@ -46,5 +63,5 @@ export function SystemPromptRow({ text, update = false, t }: SystemPromptRowProp
|
|
|
46
63
|
export const SystemPromptNodeView = memo(function SystemPromptNodeView({
|
|
47
64
|
node, t,
|
|
48
65
|
}: Pick<ChatNodeViewProps<'system-prompt'>, 'node' | 't'>) {
|
|
49
|
-
return <SystemPromptRow text={node.data.text} update={node.data.update === true} t={t} />
|
|
66
|
+
return <SystemPromptRow text={node.data.text} update={node.data.update === true} message={node.data.message} t={t} />
|
|
50
67
|
})
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
/* The rail is a sibling of the clipped transcript, not its descendant. */
|
|
2
2
|
.slot {
|
|
3
|
+
/* The rail reads the composer and viewport heights below, never the end
|
|
4
|
+
inset, so a docking request stops at this layer. */
|
|
5
|
+
--dsh-chat-end-inset: initial;
|
|
3
6
|
position: absolute;
|
|
4
7
|
top: 0;
|
|
5
8
|
right: 0;
|
|
@@ -14,7 +17,7 @@
|
|
|
14
17
|
pointer-events: none;
|
|
15
18
|
}
|
|
16
19
|
|
|
17
|
-
:global([data-conversation-scroll])
|
|
20
|
+
.slot:is(:global([data-conversation-scroll]) *) {
|
|
18
21
|
position: sticky;
|
|
19
22
|
}
|
|
20
23
|
|
|
@@ -49,6 +52,12 @@
|
|
|
49
52
|
/* The frame's inner scroller: no visible scrollbar, no scroll chaining into
|
|
50
53
|
the transcript, and gradient fades over the ends that can still scroll. */
|
|
51
54
|
.scroller {
|
|
55
|
+
/* The marks read none of the lengths the frame measures its band with, so
|
|
56
|
+
a composer or scrollport height change restyles the frame, not every
|
|
57
|
+
mark. */
|
|
58
|
+
--dsh-composer-height: initial;
|
|
59
|
+
--dsh-conversation-viewport-height: initial;
|
|
60
|
+
--turn-rail-band: initial;
|
|
52
61
|
position: relative;
|
|
53
62
|
max-height: inherit;
|
|
54
63
|
overflow-y: auto;
|
|
@@ -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
|
-
import { memo } from 'react'
|
|
2
|
-
import type { InjectFace, PropsRenderSlots } from '@deepseek-ai/dsh-client-ui-slots'
|
|
1
|
+
import { memo, useCallback } from 'react'
|
|
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'
|
|
@@ -40,6 +40,7 @@ export const TurnTailNodeView = memo(function TurnTailNodeView({
|
|
|
40
40
|
(candidate.kind !== 'text' && candidate.kind !== 'reasoning') || candidate.text.trim() !== '') : undefined
|
|
41
41
|
return block !== undefined && hasAssistantReplyContent([block])
|
|
42
42
|
})
|
|
43
|
+
const branchAction = useCallback(() => { forkAt(data.seq) }, [data.seq, forkAt])
|
|
43
44
|
const turn = node.location.kind === 'turn' || node.location.kind === 'step'
|
|
44
45
|
? node.location.turn
|
|
45
46
|
: undefined
|
|
@@ -67,7 +68,7 @@ export const TurnTailNodeView = memo(function TurnTailNodeView({
|
|
|
67
68
|
clock="end"
|
|
68
69
|
// The branch action owns boundary resolution: it sends the real
|
|
69
70
|
// turn/end seq it already has, and the Host cuts exactly there.
|
|
70
|
-
onBranch={forkAllowed ?
|
|
71
|
+
onBranch={forkAllowed ? branchAction : undefined}
|
|
71
72
|
branchUnavailable={data.branchUnavailable || hasLaterChatNode}
|
|
72
73
|
className={css.actions}
|
|
73
74
|
extraActions={assistantActions}
|
|
@@ -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
|
-
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'
|
|
2
|
+
import { Fragment, useCallback } from 'react'
|
|
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[] = []
|
|
@@ -16,7 +16,7 @@ export function UserContent({ content, loadImage, facts, interactive = false, el
|
|
|
16
16
|
FactoryComponentPropsOf<'conversation.chat.user.content'>) {
|
|
17
17
|
const { text, attachments, extraBlocks, referenceLabels = EMPTY_LABELS } = content
|
|
18
18
|
const compactImages = attachments.length > 1
|
|
19
|
-
const truncated = (total: number): string => t('json.truncated', { total })
|
|
19
|
+
const truncated = useCallback((total: number): string => t('json.truncated', { total }), [t])
|
|
20
20
|
const showBubble = text !== '' || extraBlocks.length > 0
|
|
21
21
|
return (
|
|
22
22
|
<div className={css.userStack}>
|
|
@@ -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'>
|
|
@@ -2,7 +2,6 @@ import type { Context } from '@deepseek-ai/cordis'
|
|
|
2
2
|
import { compactionRows } from './compaction-preview.ts'
|
|
3
3
|
import type { ObservableSnapshot } from '@deepseek-ai/dsh-client-store'
|
|
4
4
|
import type { PerformanceUsageMode } from '../../chat-settings.ts'
|
|
5
|
-
import type { ChatPresentationPolicy } from '../presentation-policy.ts'
|
|
6
5
|
import { NS } from '../locale.ts'
|
|
7
6
|
import { AssistantNodeView, type AssistantNodeInjected } from './AssistantNodeView.tsx'
|
|
8
7
|
import { sessionFilePath } from '../file-path.ts'
|
|
@@ -19,16 +18,12 @@ import { TurnTriggerNodeView } from './TurnTriggerNodeView.tsx'
|
|
|
19
18
|
|
|
20
19
|
/**
|
|
21
20
|
* Register this package's business renderers behind the keyed Chat Node seat.
|
|
22
|
-
* Renderers whose output depends on the work-details mode receive the policy
|
|
23
|
-
* through their own registration; the seat and the other renderers do not.
|
|
24
21
|
* @param ctx - owning UI Conversation context.
|
|
25
22
|
* @param performanceUsage - live statistics detail preference.
|
|
26
|
-
* @param presentation - live presentation policy.
|
|
27
23
|
*/
|
|
28
24
|
export function registerChatNodeRenderers(
|
|
29
25
|
ctx: Context,
|
|
30
26
|
performanceUsage: ObservableSnapshot<PerformanceUsageMode>,
|
|
31
|
-
presentation: ObservableSnapshot<ChatPresentationPolicy>,
|
|
32
27
|
): void {
|
|
33
28
|
const injectCompaction = compactionRows(ctx)
|
|
34
29
|
ctx.effect(() => ctx.slots.registerFactory({
|
|
@@ -42,12 +37,15 @@ export function registerChatNodeRenderers(
|
|
|
42
37
|
}, DefaultReasoningBody))
|
|
43
38
|
ctx.slots.inject('conversation.chat.node', () => ctx.slots.register({
|
|
44
39
|
name: 'conversation.chat.node', key: 'user', locale: NS,
|
|
45
|
-
children: {
|
|
40
|
+
children: {
|
|
41
|
+
'conversation.chat.user.before': { kind: 'chain', scope: 'session' },
|
|
42
|
+
'conversation.chat.user-actions': { kind: 'list', scope: 'session' },
|
|
43
|
+
},
|
|
46
44
|
}, UserMessageNodeView))
|
|
47
45
|
// Steering rows share the renderer without owning the message-source seat.
|
|
48
46
|
ctx.slots.inject('conversation.chat.node', () => ctx.slots.register({
|
|
49
47
|
name: 'conversation.chat.node', key: 'steering', locale: NS,
|
|
50
|
-
inject: () => ({ renderSlotChain: () => null }),
|
|
48
|
+
inject: () => ({ renderSlotChain: () => null, renderSlot: () => null }),
|
|
51
49
|
}, UserMessageNodeView))
|
|
52
50
|
ctx.slots.inject('conversation.chat.node', () => ctx.slots.register(
|
|
53
51
|
{ name: 'conversation.chat.node', key: 'context', locale: NS }, ContextMessageNodeView))
|
|
@@ -64,7 +62,6 @@ export function registerChatNodeRenderers(
|
|
|
64
62
|
'conversation.chat.message.images': { kind: 'single', scope: 'session' },
|
|
65
63
|
},
|
|
66
64
|
inject: (sessionId): AssistantNodeInjected => ({
|
|
67
|
-
hooks: { presentation },
|
|
68
65
|
resolveFilePath: sessionFilePath(ctx, sessionId),
|
|
69
66
|
fileMentions: (owner, getFileTriggerProps) => ctx.get('chatFileMentions')?.forClosing(owner, sessionId, getFileTriggerProps),
|
|
70
67
|
}),
|
|
@@ -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
|