@deepseek-ai/dsh-client-ui-chat 0.2.3-alpha.3 → 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 +6 -6
- package/README.md +4 -4
- package/README.zh.md +4 -4
- package/lib/client.js +6 -6
- 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/AssistantMarkdown.d.ts.map +1 -1
- package/lib/types/client/chat/AssistantMarkdown.js.map +1 -1
- package/lib/types/client/chat/AssistantNodeView.d.ts +2 -2
- package/lib/types/client/chat/AssistantNodeView.d.ts.map +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.map +1 -1
- package/lib/types/client/chat/ChatView.js.map +1 -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/MessageItem.d.ts +3 -1
- 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/SystemPromptRow.d.ts.map +1 -1
- package/lib/types/client/chat/SystemPromptRow.js.map +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/UserContent.js.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/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/contract/slots.d.ts +18 -7
- 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/tool.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/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 +0 -1
- 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.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.map +1 -1
- package/lib/types/client/settings/TranscriptViewRow.js.map +1 -1
- package/package.json +44 -44
- package/src/client/apply.ts +2 -1
- package/src/client/chat/AssistantMarkdown.tsx +3 -2
- package/src/client/chat/AssistantNodeView.tsx +2 -2
- package/src/client/chat/ChatGroupSeat.module.css +4 -2
- package/src/client/chat/ChatNodeSeat.tsx +4 -2
- package/src/client/chat/ChatView.module.css +37 -5
- package/src/client/chat/ChatView.tsx +13 -6
- package/src/client/chat/ContextBody.tsx +5 -2
- package/src/client/chat/ContextInjectionRow.tsx +3 -2
- package/src/client/chat/MessageItem.tsx +39 -28
- package/src/client/chat/SystemPromptRow.tsx +3 -2
- package/src/client/chat/TurnNavigator.module.css +9 -0
- package/src/client/chat/TurnTailNodeView.tsx +3 -2
- package/src/client/chat/UserContent.tsx +2 -2
- package/src/client/chat/register-node-renderers.ts +5 -8
- package/src/client/chat/text-interaction.ts +1 -2
- package/src/client/chat/text-selection.ts +20 -4
- package/src/client/contract/slots.ts +15 -8
- package/src/client/conversation-nodes/README.i18n.yaml +4 -4
- package/src/client/conversation-nodes/README.md +2 -1
- package/src/client/conversation-nodes/README.zh.md +2 -1
- 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/tool.ts +1 -1
- package/src/client/index.ts +2 -2
- package/src/client/presentation-policy.ts +6 -0
- package/src/client/settings/LinkOpeningRow.tsx +3 -1
- package/src/client/settings/PerformanceUsageRow.tsx +4 -1
- package/src/client/settings/PreferenceRow.tsx +4 -4
- package/src/client/settings/TranscriptViewRow.tsx +10 -3
|
@@ -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
|
}),
|
|
@@ -198,8 +198,7 @@ export function useTextInteraction(
|
|
|
198
198
|
const insideSurface = (event: Event): boolean => event.composedPath().includes(surface)
|
|
199
199
|
const pointerDown = (event: PointerEvent): void => {
|
|
200
200
|
if (insideSurface(event)) return
|
|
201
|
-
|
|
202
|
-
previousRange = selection?.rangeCount === 1 ? selection.getRangeAt(0).cloneRange() : null
|
|
201
|
+
previousRange = readTextSelection(root, document.getSelection())?.range.cloneRange() ?? null
|
|
203
202
|
dismiss()
|
|
204
203
|
selectionChangedDuringGesture = false
|
|
205
204
|
pointerSelecting = event.button === 0 && root.contains(event.target as Node)
|
|
@@ -149,22 +149,38 @@ export interface TextSelection {
|
|
|
149
149
|
readonly range: Range
|
|
150
150
|
}
|
|
151
151
|
|
|
152
|
+
/**
|
|
153
|
+
* End a range at its source when only whitespace text lies between the source end and the range end.
|
|
154
|
+
* Paragraph (triple-click) selection of a source's last block ends at the next element.
|
|
155
|
+
*/
|
|
156
|
+
function endInSource(range: Range, source: HTMLElement): Range | null {
|
|
157
|
+
if (source.contains(range.endContainer)) return range
|
|
158
|
+
const tail = range.cloneRange()
|
|
159
|
+
tail.setStart(source, source.childNodes.length)
|
|
160
|
+
if (tail.toString().trim() !== '') return null
|
|
161
|
+
const clamped = range.cloneRange()
|
|
162
|
+
clamped.setEnd(source, source.childNodes.length)
|
|
163
|
+
return clamped.collapsed ? null : clamped
|
|
164
|
+
}
|
|
165
|
+
|
|
152
166
|
/**
|
|
153
167
|
* Find a single noncollapsed selection inside one enabled source.
|
|
168
|
+
* A range that ends after its source with only whitespace text beyond it ends at the source instead.
|
|
154
169
|
* @param root - mounted interaction area.
|
|
155
170
|
* @param selection - browser selection in that area's document.
|
|
156
171
|
* @returns the selected source and range, or null across sources and excluded content.
|
|
157
172
|
*/
|
|
158
173
|
export function readTextSelection(root: HTMLElement, selection: Selection | null): TextSelection | null {
|
|
159
174
|
if (selection === null || selection.rangeCount !== 1 || selection.isCollapsed) return null
|
|
160
|
-
const range = selection.getRangeAt(0)
|
|
161
175
|
// A text container has no `closest`, so its parent element answers.
|
|
162
176
|
const sourceOf = (node: Node): HTMLElement | null => (node as Partial<Element>).closest?.<HTMLElement>('[data-text-interaction-source]')
|
|
163
177
|
?? node.parentElement?.closest<HTMLElement>('[data-text-interaction-source]') ?? null
|
|
164
|
-
const
|
|
165
|
-
|
|
178
|
+
const selected = selection.getRangeAt(0)
|
|
179
|
+
const source = sourceOf(selected.startContainer)
|
|
180
|
+
if (source === null || !root.contains(source)
|
|
166
181
|
|| source.closest('[hidden], [inert], [data-text-interaction-exclude]') !== null) return null
|
|
167
|
-
|
|
182
|
+
const range = endInSource(selected, source)
|
|
183
|
+
return range === null || sourceOf(range.endContainer) !== source ? null : { source, range }
|
|
168
184
|
}
|
|
169
185
|
|
|
170
186
|
/**
|
|
@@ -68,6 +68,12 @@ export interface AssistantActionOwnerProps {
|
|
|
68
68
|
messageId: MessageId
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
+
/** Owner currency of durable user-message actions. */
|
|
72
|
+
export interface UserActionOwnerProps {
|
|
73
|
+
/** Durable identity of the message; a synthetic projection without one offers no actions. */
|
|
74
|
+
messageId: MessageId
|
|
75
|
+
}
|
|
76
|
+
|
|
71
77
|
/** Stable quota failure codes retained in the Session log; both raise the frame-wide notice. */
|
|
72
78
|
export type QuotaNoticeCode = 'QUOTA' | 'ACCOUNT_QUOTA'
|
|
73
79
|
|
|
@@ -209,6 +215,7 @@ export interface ChatNodeHookContext {
|
|
|
209
215
|
readonly turnData: ConversationLocationDataStore<ConversationTurnDataMap> | undefined
|
|
210
216
|
readonly disclosureReset: ObservableSnapshot<number>
|
|
211
217
|
readonly useGroupAction: UseGroupAction
|
|
218
|
+
readonly usePresentation: UsePresentation
|
|
212
219
|
}
|
|
213
220
|
|
|
214
221
|
/** Slot-level Hook factories for keyed Chat renderers. */
|
|
@@ -217,6 +224,8 @@ export interface ChatNodeInjected {
|
|
|
217
224
|
turnData: SlotHookFactory<'conversation.chat.node', UseChatNodeTurnData>
|
|
218
225
|
disclosure: SlotHookFactory<'conversation.chat.node', UseDisclosure>
|
|
219
226
|
groupAction: SlotHookFactory<'conversation.chat.node', UseGroupAction>
|
|
227
|
+
/** Live work-details policy, for renderers whose presentation depends on the mode. */
|
|
228
|
+
presentation: SlotHookFactory<'conversation.chat.node', UsePresentation>
|
|
220
229
|
}
|
|
221
230
|
}
|
|
222
231
|
|
|
@@ -289,14 +298,6 @@ export interface TurnProcessOwnerProps {
|
|
|
289
298
|
setOpen(open: boolean): void
|
|
290
299
|
}
|
|
291
300
|
|
|
292
|
-
/** Shared presentation policy source for renderers that depend on the work-details mode. */
|
|
293
|
-
export interface PresentationInjected {
|
|
294
|
-
hooks: {
|
|
295
|
-
/** Live presentation policy derived from the accepted work-details mode. */
|
|
296
|
-
presentation: ObservableSnapshot<ChatPresentationPolicy>
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
|
|
300
301
|
/** Full props of one keyed Chat renderer. */
|
|
301
302
|
export type ChatNodeViewProps<Kind extends ChatNodeKind = ChatNodeKind> =
|
|
302
303
|
PropsRuntime<'conversation.chat.node', Kind> & PropsLocale<'chat'> & PropsRenderFactories
|
|
@@ -520,6 +521,12 @@ declare module '@deepseek-ai/dsh-client-ui-slots/client' {
|
|
|
520
521
|
* shown only on hover or focus visible while its action runs.
|
|
521
522
|
*/
|
|
522
523
|
'conversation.chat.assistant-actions': { kind: 'list'; scope: 'session'; owner: AssistantActionOwnerProps }
|
|
524
|
+
/**
|
|
525
|
+
* Ordered actions for one durable user message. Each entry receives the
|
|
526
|
+
* message id; a fresh `id` adds an action and reusing one replaces that
|
|
527
|
+
* entry. With no entries, the standard action row remains unchanged.
|
|
528
|
+
*/
|
|
529
|
+
'conversation.chat.user-actions': { kind: 'list'; scope: 'session'; owner: UserActionOwnerProps }
|
|
523
530
|
/**
|
|
524
531
|
* Frame-wide quota notice chain. The Chat-owned host in `shell.overlay`
|
|
525
532
|
* offers the one live notice; the first entry whose selector claims its
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
en: d5eac08a4bc94c10
|
|
28
28
|
zh: ee2167d1fc823f21
|
|
29
29
|
/chat-conversation-node-rules/display-modes:
|
|
30
|
-
en:
|
|
31
|
-
zh:
|
|
30
|
+
en: d7e52142079ebb1d
|
|
31
|
+
zh: 56011c3e344a4226
|
|
32
32
|
/chat-conversation-node-rules/display-modes/defaults-and-saving-preferences:
|
|
33
33
|
en: b25bf00ce3a6a119
|
|
34
34
|
zh: 0ab47a4014ea5e1e
|
|
@@ -39,8 +39,8 @@
|
|
|
39
39
|
en: 8e775c43878ae31a
|
|
40
40
|
zh: 4c1063c0071ebdbd
|
|
41
41
|
/chat-conversation-node-rules/display-modes/group-title-rules:
|
|
42
|
-
en:
|
|
43
|
-
zh:
|
|
42
|
+
en: fe6089e7227dc534
|
|
43
|
+
zh: 0ed81f8f82985c0b
|
|
44
44
|
/chat-conversation-node-rules/process-grouping:
|
|
45
45
|
en: 4c581ba07e633619
|
|
46
46
|
zh: d3ea678ba42a496a
|
|
@@ -122,6 +122,7 @@ Settings → General → Work details offers four modes for choosing how much to
|
|
|
122
122
|
| Process-group body | Initially collapsed | Initially collapsed | Directly visible without a group-level height cap in running Turns; manual disclosure in historical Turns | Directly visible without a group-level height cap in running and historical Turns |
|
|
123
123
|
| Settled reasoning preview | Hidden | First line | First line | First line |
|
|
124
124
|
| Individual reasoning and tool bodies | Manual expansion | Manual expansion | Manual expansion | Manual expansion |
|
|
125
|
+
| Program call rows (`run_code`, `cua_run_code`) | Initially collapsed | Initially collapsed | Initially collapsed | Always open; the row cannot collapse |
|
|
125
126
|
| Eligible completed Turn | Initially collapsed | Initially collapsed | Initially collapsed | Always open; duration/status header cannot collapse it |
|
|
126
127
|
|
|
127
128
|
### Defaults and saving preferences
|
|
@@ -194,7 +195,7 @@ An open capped group follows content growth only while its own scroll position i
|
|
|
194
195
|
|
|
195
196
|
Only reasoning blocks with non-whitespace text produce individual rows; each retains its original text and expands independently. A blank streaming tail produces no row and does not transfer its running state to an earlier block. Individual reasoning starts collapsed, including while streaming. All modes preview the latest paragraph whose first line ends with a newline; an unfinished single line has no preview. Later text in that paragraph does not change the preview. After settlement, the mode table applies. Expanded reasoning uses compact Markdown typography.
|
|
196
197
|
|
|
197
|
-
Switching modes retains manually opened groups and inner disclosures. It changes visibility and sizing without recreating the message rows. Detailed and Verbose do not open every individual disclosure. Only Verbose keeps the whole Turn open.
|
|
198
|
+
Switching modes retains manually opened groups and inner disclosures. It changes visibility and sizing without recreating the message rows. Detailed and Verbose do not open every individual disclosure. Only Verbose keeps the whole Turn open. Program call rows are the exception: Verbose shows them open without a collapse action, like the whole-Turn header, and leaving Verbose closes the program rows the user did not open. A program row mounts its sub-call rows only while open, because one program can dispatch more than a thousand tool calls; closing it, by the user or by a mode switch, discards their state, and reopening it shows every sub-call row in its default display.
|
|
198
199
|
|
|
199
200
|
-----
|
|
200
201
|
|
|
@@ -122,6 +122,7 @@ description: "Chat 过程分组与活动摘要的明细业务规则。"
|
|
|
122
122
|
| 过程组正文 | 初始收起 | 初始收起 | 运行中轮次直接显示、不设组级限高;历史轮次按手动开合显示 | 运行中与历史轮次都直接显示,不设组级限高 |
|
|
123
123
|
| 已结算推理预览 | 隐藏 | 首行 | 首行 | 首行 |
|
|
124
124
|
| 单个推理与工具正文 | 手动展开 | 手动展开 | 手动展开 | 手动展开 |
|
|
125
|
+
| 程序调用行(`run_code`、`cua_run_code`) | 初始收起 | 初始收起 | 初始收起 | 始终展开;该行不能收起 |
|
|
125
126
|
| 符合条件的已完成轮次 | 初始收起 | 初始收起 | 初始收起 | 始终展开;时长或状态抬头不能收起它 |
|
|
126
127
|
|
|
127
128
|
### 默认值与配置保存
|
|
@@ -194,7 +195,7 @@ description: "Chat 过程分组与活动摘要的明细业务规则。"
|
|
|
194
195
|
|
|
195
196
|
只有含非空白文本的推理块生成独立行,各自保留原文并独立展开。空白流式尾块不生成行,也不将运行状态转移给前面的块。单个推理初始收起,包括流式输出期间。四档都预览最近一个首行以换行结束的段落;未完成的单行没有预览,该段落后续文本不改变预览。结算后按上表展示。展开的推理使用紧凑 Markdown 排版。
|
|
196
197
|
|
|
197
|
-
|
|
198
|
+
切换模式保留手动展开的组和内部开合状态,只改变显隐与尺寸,不重建消息行。详细和完全展开都不表示自动打开每个内部控件;只有完全展开模式始终展开整轮。程序调用行是例外:完全展开模式下程序调用行始终展开、没有收起操作,与整轮的抬头相同;离开完全展开时,用户未手动展开的程序调用行随之收起。由于一个程序可能发起上千次工具调用,程序调用行只在展开时挂载子调用行;无论由用户还是模式切换收起,子调用行的状态都会丢弃,再次展开时每个子调用行都以默认样式显示。
|
|
198
199
|
|
|
199
200
|
-----
|
|
200
201
|
|
|
@@ -5,7 +5,7 @@ import type {
|
|
|
5
5
|
import type { CompactionCheckpointSource } from '@deepseek-ai/dsh-compaction/checkpoint'
|
|
6
6
|
import type {} from '@deepseek-ai/dsh-compaction/types'
|
|
7
7
|
import type {} from '@deepseek-ai/dsh-commands/types'
|
|
8
|
-
import { isReplacementSurfaceEvent } from '@deepseek-ai/dsh-session/
|
|
8
|
+
import { isReplacementSurfaceEvent } from '@deepseek-ai/dsh-session/types'
|
|
9
9
|
import type { ManualCompactionChatData } from '../contract/chat-nodes.ts'
|
|
10
10
|
import { chatNode } from './common.ts'
|
|
11
11
|
|
|
@@ -2,7 +2,7 @@ import type { Context } from '@deepseek-ai/cordis'
|
|
|
2
2
|
import type {
|
|
3
3
|
ConversationNodeDefinition, UnknownSurfaceNode,
|
|
4
4
|
} from '@deepseek-ai/dsh-client-ui-conversation/client'
|
|
5
|
-
import { isAppendSurfaceEvent } from '@deepseek-ai/dsh-session/
|
|
5
|
+
import { isAppendSurfaceEvent } from '@deepseek-ai/dsh-session/types'
|
|
6
6
|
import { chatNode } from './common.ts'
|
|
7
7
|
|
|
8
8
|
declare module '../contract/chat-nodes.ts' {
|
|
@@ -3,7 +3,7 @@ import type {
|
|
|
3
3
|
ContextMessageNode, ConversationContextReader, ConversationLocation, ConversationNodeDefinition,
|
|
4
4
|
SteeringMessageNode, UserMessageNode,
|
|
5
5
|
} from '@deepseek-ai/dsh-client-ui-conversation/client'
|
|
6
|
-
import { isAppendSurfaceEvent, isReplacementSurfaceEvent } from '@deepseek-ai/dsh-session/
|
|
6
|
+
import { isAppendSurfaceEvent, isReplacementSurfaceEvent } from '@deepseek-ai/dsh-session/types'
|
|
7
7
|
import type { InboxState } from './inbox.ts'
|
|
8
8
|
import type { ProcessEvidenceState } from './turn-process.ts'
|
|
9
9
|
import { chatNode, contextLocation } from './common.ts'
|
|
@@ -3,7 +3,7 @@ import type {
|
|
|
3
3
|
ConversationMatch, ConversationNodeContext, ConversationNodeDefinition, PreparingToolCall, StartedToolCall,
|
|
4
4
|
ToolCallBlock, ToolResultNode,
|
|
5
5
|
} from '@deepseek-ai/dsh-client-ui-conversation/client'
|
|
6
|
-
import { isAppendSurfaceEvent } from '@deepseek-ai/dsh-session/
|
|
6
|
+
import { isAppendSurfaceEvent } from '@deepseek-ai/dsh-session/types'
|
|
7
7
|
import type {} from '@deepseek-ai/dsh-tool-registry-ptc/client'
|
|
8
8
|
import { PartialArguments } from '@deepseek-ai/dsh-util-values'
|
|
9
9
|
import type { ChatNode, ToolChatData } from '../contract/chat-nodes.ts'
|
package/src/client/index.ts
CHANGED
|
@@ -35,10 +35,10 @@ export type { TranscriptViewRowInjected, TranscriptViewRowProps } from './settin
|
|
|
35
35
|
export type { TranscriptViewMode } from '../chat-settings.ts'
|
|
36
36
|
export type { ChatPresentationPolicy } from './presentation-policy.ts'
|
|
37
37
|
export type {
|
|
38
|
-
AssistantActionOwnerProps, ChatFileMentions, ChatNodeHookContext, ChatNodeInjected, ChatNodeOwnerProps,
|
|
38
|
+
AssistantActionOwnerProps, UserActionOwnerProps, ChatFileMentions, ChatNodeHookContext, ChatNodeInjected, ChatNodeOwnerProps,
|
|
39
39
|
ChatNodeViewProps, ChatScrollPosition, ChatStore, ChatViewInjected, ChatViewSlotProps,
|
|
40
40
|
ChatFlowDataInjected, ChatFlowHookContext, ChatFlowInjected, ChatFlowOwnerProps, ChatFlowSlotProps, UseGroupHeaderAction,
|
|
41
|
-
CommandRowOwnerProps, CommandRowProps, MessageImagesProps, OpenFileOptions,
|
|
41
|
+
CommandRowOwnerProps, CommandRowProps, MessageImagesProps, OpenFileOptions,
|
|
42
42
|
QuotaNoticeCode, QuotaNoticeHostProps, QuotaNoticeInjected, QuotaNoticeOwnerProps, QuotaNoticeState,
|
|
43
43
|
ReasoningBodyOwnerProps, ReasoningContentInput, UserContentAttachment, UserContentData, UserContentInput,
|
|
44
44
|
UserBeforeOwnerProps,
|
|
@@ -20,6 +20,8 @@ export interface ChatPresentationPolicy {
|
|
|
20
20
|
readonly liveProcessDetail: boolean
|
|
21
21
|
/** Whether a settled reasoning row previews its first line beside the Think title. */
|
|
22
22
|
readonly settledReasoningPreview: boolean
|
|
23
|
+
/** Whether program call rows show their source row and sub-calls open, without a collapse action. */
|
|
24
|
+
readonly programCallsOpen: boolean
|
|
23
25
|
}
|
|
24
26
|
|
|
25
27
|
const POLICIES: Readonly<Record<TranscriptViewMode, Omit<ChatPresentationPolicy, 'collapseTiming' | 'foldedReplies'>>> = {
|
|
@@ -29,6 +31,7 @@ const POLICIES: Readonly<Record<TranscriptViewMode, Omit<ChatPresentationPolicy,
|
|
|
29
31
|
stepGrouping: 'collapsed',
|
|
30
32
|
liveProcessDetail: false,
|
|
31
33
|
settledReasoningPreview: false,
|
|
34
|
+
programCallsOpen: false,
|
|
32
35
|
},
|
|
33
36
|
standard: {
|
|
34
37
|
mode: 'standard',
|
|
@@ -36,6 +39,7 @@ const POLICIES: Readonly<Record<TranscriptViewMode, Omit<ChatPresentationPolicy,
|
|
|
36
39
|
stepGrouping: 'collapsed',
|
|
37
40
|
liveProcessDetail: true,
|
|
38
41
|
settledReasoningPreview: true,
|
|
42
|
+
programCallsOpen: false,
|
|
39
43
|
},
|
|
40
44
|
detailed: {
|
|
41
45
|
mode: 'detailed',
|
|
@@ -43,6 +47,7 @@ const POLICIES: Readonly<Record<TranscriptViewMode, Omit<ChatPresentationPolicy,
|
|
|
43
47
|
stepGrouping: 'history',
|
|
44
48
|
liveProcessDetail: true,
|
|
45
49
|
settledReasoningPreview: true,
|
|
50
|
+
programCallsOpen: false,
|
|
46
51
|
},
|
|
47
52
|
verbose: {
|
|
48
53
|
mode: 'verbose',
|
|
@@ -50,6 +55,7 @@ const POLICIES: Readonly<Record<TranscriptViewMode, Omit<ChatPresentationPolicy,
|
|
|
50
55
|
stepGrouping: 'none',
|
|
51
56
|
liveProcessDetail: false,
|
|
52
57
|
settledReasoningPreview: true,
|
|
58
|
+
programCallsOpen: true,
|
|
53
59
|
},
|
|
54
60
|
}
|
|
55
61
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/** General Settings row for Chat HTTP(S) link destinations. */
|
|
2
|
+
import { useCallback } from 'react'
|
|
2
3
|
import type { ObservableSnapshot } from '@deepseek-ai/dsh-client-store'
|
|
3
4
|
import type { InjectFace, PropsLocale, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots/client'
|
|
4
5
|
import type { LinkOpening } from '../../chat-settings.ts'
|
|
@@ -30,6 +31,7 @@ export type LinkOpeningRowProps =
|
|
|
30
31
|
export function LinkOpeningRow({ useLinkOpening, useBrowserAvailable, setLinkOpening, t }: LinkOpeningRowProps) {
|
|
31
32
|
const destination = useLinkOpening(value => value)
|
|
32
33
|
const browserAvailable = useBrowserAvailable(value => value)
|
|
34
|
+
const selectOpening = useCallback((value: string) => { setLinkOpening(value as LinkOpening) }, [setLinkOpening])
|
|
33
35
|
if (!browserAvailable) return null
|
|
34
36
|
return (
|
|
35
37
|
<PreferenceRow
|
|
@@ -41,7 +43,7 @@ export function LinkOpeningRow({ useLinkOpening, useBrowserAvailable, setLinkOpe
|
|
|
41
43
|
{ id: 'sidebar', label: t('settings.links.sidebar') },
|
|
42
44
|
{ id: 'new-tab', label: t('settings.links.newTab') },
|
|
43
45
|
]}
|
|
44
|
-
onSelect={
|
|
46
|
+
onSelect={selectOpening}
|
|
45
47
|
/>
|
|
46
48
|
)
|
|
47
49
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/** General Settings row for performance and usage detail. */
|
|
2
2
|
|
|
3
|
+
import { useCallback } from 'react'
|
|
3
4
|
import type { InjectFace, PropsLocale, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots/client'
|
|
4
5
|
import type { PerformanceUsageMode } from '../../chat-settings.ts'
|
|
5
6
|
import type { PerformanceUsageInjected } from '../contract/slots.ts'
|
|
@@ -30,6 +31,8 @@ const OPTIONS: readonly { id: PerformanceUsageMode; label: ChatKey }[] = [
|
|
|
30
31
|
*/
|
|
31
32
|
export function PerformanceUsageRow({ usePerformanceUsage, setPerformanceUsage, t }: PerformanceUsageRowProps) {
|
|
32
33
|
const mode = usePerformanceUsage(value => value)
|
|
34
|
+
const selectMode = useCallback((value: string) => { setPerformanceUsage(value as PerformanceUsageMode) },
|
|
35
|
+
[setPerformanceUsage])
|
|
33
36
|
const selectedLabel = mode === 'detailed'
|
|
34
37
|
? 'settings.performance.detailed'
|
|
35
38
|
: 'settings.performance.compact'
|
|
@@ -40,7 +43,7 @@ export function PerformanceUsageRow({ usePerformanceUsage, setPerformanceUsage,
|
|
|
40
43
|
value={mode}
|
|
41
44
|
selectedLabel={t(selectedLabel)}
|
|
42
45
|
options={OPTIONS.map(option => ({ id: option.id, label: t(option.label) }))}
|
|
43
|
-
onSelect={
|
|
46
|
+
onSelect={selectMode}
|
|
44
47
|
/>
|
|
45
48
|
)
|
|
46
49
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** Localized two-column selector shared by Chat preference rows. */
|
|
2
|
-
import { useRef, useState } from 'react'
|
|
2
|
+
import { useCallback, useRef, useState } from 'react'
|
|
3
3
|
import { IconChevronDownOutlineRegular, Menu } from '@deepseek-ai/dsh-client-ui-primitives/client'
|
|
4
4
|
import css from './PreferenceRow.module.css'
|
|
5
5
|
|
|
@@ -18,12 +18,12 @@ export function PreferenceRow({ title, description, value, selectedLabel, option
|
|
|
18
18
|
}) {
|
|
19
19
|
const [open, setOpen] = useState(false)
|
|
20
20
|
const selectorRef = useRef<HTMLButtonElement>(null)
|
|
21
|
-
const closeMenu = () => { setOpen(false) }
|
|
22
|
-
const selectMode = (id: string) => {
|
|
21
|
+
const closeMenu = useCallback(() => { setOpen(false) }, [])
|
|
22
|
+
const selectMode = useCallback((id: string) => {
|
|
23
23
|
selectorRef.current?.focus({ preventScroll: true })
|
|
24
24
|
closeMenu()
|
|
25
25
|
onSelect(id)
|
|
26
|
-
}
|
|
26
|
+
}, [closeMenu, onSelect])
|
|
27
27
|
const selector = (
|
|
28
28
|
<button
|
|
29
29
|
ref={selectorRef}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/** General Settings row for work-details presentation. */
|
|
2
2
|
|
|
3
|
+
import { useCallback } from 'react'
|
|
3
4
|
import type { SnapshotStore } from '@deepseek-ai/dsh-client-store'
|
|
4
5
|
import type { InjectFace, PropsLocale, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots/client'
|
|
5
6
|
import { TRANSCRIPT_VIEW_MODES, type TranscriptViewMode } from '../../chat-settings.ts'
|
|
@@ -60,6 +61,12 @@ export function TranscriptViewRow({
|
|
|
60
61
|
const mode = useTranscriptView(value => value)
|
|
61
62
|
const timing = useCollapseTiming(value => value)
|
|
62
63
|
const replies = useFoldedReplies(value => value)
|
|
64
|
+
const selectMode = useCallback((value: string) => { setTranscriptView(value as TranscriptViewMode) },
|
|
65
|
+
[setTranscriptView])
|
|
66
|
+
const selectTiming = useCallback((value: string) => { setCollapseTiming(value as CollapseTiming) },
|
|
67
|
+
[setCollapseTiming])
|
|
68
|
+
const selectReplies = useCallback((value: string) => { setFoldedReplies(value as FoldedReplies) },
|
|
69
|
+
[setFoldedReplies])
|
|
63
70
|
return (
|
|
64
71
|
<>
|
|
65
72
|
<PreferenceRow
|
|
@@ -68,7 +75,7 @@ export function TranscriptViewRow({
|
|
|
68
75
|
value={mode}
|
|
69
76
|
selectedLabel={t(LABELS[mode])}
|
|
70
77
|
options={TRANSCRIPT_VIEW_MODES.map(id => ({ id, label: t(LABELS[id]) }))}
|
|
71
|
-
onSelect={
|
|
78
|
+
onSelect={selectMode}
|
|
72
79
|
/>
|
|
73
80
|
<PreferenceRow
|
|
74
81
|
title={t('settings.collapse.title')}
|
|
@@ -76,7 +83,7 @@ export function TranscriptViewRow({
|
|
|
76
83
|
value={timing}
|
|
77
84
|
selectedLabel={t(COLLAPSE_LABELS[timing])}
|
|
78
85
|
options={COLLAPSE_TIMINGS.map(id => ({ id, label: t(COLLAPSE_LABELS[id]) }))}
|
|
79
|
-
onSelect={
|
|
86
|
+
onSelect={selectTiming}
|
|
80
87
|
/>
|
|
81
88
|
{mode !== 'verbose' && (
|
|
82
89
|
<PreferenceRow
|
|
@@ -85,7 +92,7 @@ export function TranscriptViewRow({
|
|
|
85
92
|
value={replies}
|
|
86
93
|
selectedLabel={t(FOLDED_REPLY_LABELS[replies])}
|
|
87
94
|
options={FOLDED_REPLIES.map(id => ({ id, label: t(FOLDED_REPLY_LABELS[id]) }))}
|
|
88
|
-
onSelect={
|
|
95
|
+
onSelect={selectReplies}
|
|
89
96
|
/>
|
|
90
97
|
)}
|
|
91
98
|
</>
|