@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,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 {
|
|
@@ -198,11 +198,10 @@ 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
|
-
pointerSelecting = event.button === 0 &&
|
|
204
|
+
pointerSelecting = event.button === 0 && root.contains(event.target as Node)
|
|
206
205
|
}
|
|
207
206
|
const pointerUp = (event: PointerEvent): void => {
|
|
208
207
|
if (!pointerSelecting) return
|
|
@@ -212,7 +211,7 @@ export function useTextInteraction(
|
|
|
212
211
|
const cancel = (): void => { pointerSelecting = false; keyboardSelecting = false; dismiss() }
|
|
213
212
|
const keyDown = (event: KeyboardEvent): void => {
|
|
214
213
|
if (event.key === 'Escape') { cancel(); return }
|
|
215
|
-
if (insideSurface(event) || !(event.target
|
|
214
|
+
if (insideSurface(event) || !root.contains(event.target as Node)) return
|
|
216
215
|
if (event.key === 'Shift' || event.shiftKey) { keyboardSelecting = true; dismiss() }
|
|
217
216
|
}
|
|
218
217
|
const keyUp = (event: KeyboardEvent): void => {
|
|
@@ -222,10 +221,10 @@ export function useTextInteraction(
|
|
|
222
221
|
}
|
|
223
222
|
const contextMenu = (event: MouseEvent): void => {
|
|
224
223
|
if (insideSurface(event)) return
|
|
225
|
-
const element = event.target
|
|
226
|
-
const source = element
|
|
224
|
+
const element = event.target as Partial<Element>
|
|
225
|
+
const source = element.closest?.<HTMLElement>('[data-text-interaction-source]')
|
|
227
226
|
if (source === undefined || source === null || !root.contains(source)
|
|
228
|
-
|| element?.
|
|
227
|
+
|| element.closest?.('[data-text-interaction-exclude], button, input, textarea, [contenteditable="true"]')) return
|
|
229
228
|
pointerSelecting = false
|
|
230
229
|
dismiss()
|
|
231
230
|
const selected = readTextSelection(root, document.getSelection())
|
|
@@ -14,9 +14,10 @@ function excluded(element: Element): boolean {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
function projectedBoundary(node: Node): '\n' | '\t' | '' {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
// A node other than an element has no tag name, so it marks no boundary.
|
|
18
|
+
const tag = (node as Element).tagName
|
|
19
|
+
if (PROJECTED_CELL_TAGS.has(tag)) return '\t'
|
|
20
|
+
return PROJECTED_BLOCK_TAGS.has(tag) ? '\n' : ''
|
|
20
21
|
}
|
|
21
22
|
|
|
22
23
|
function projectedSeparator(previous: Node, current: Node): '\n' | '\t' | '' {
|
|
@@ -47,8 +48,7 @@ function projectedText(node: Text): ProjectedText {
|
|
|
47
48
|
if (structuralWhitespace) return { text: '', offsets }
|
|
48
49
|
let text = ''
|
|
49
50
|
let cursor = 0
|
|
50
|
-
if (!preservesBreaks && node.previousSibling
|
|
51
|
-
&& node.previousSibling.tagName === 'BR' && source.startsWith('\n')) {
|
|
51
|
+
if (!preservesBreaks && (node.previousSibling as Element | null)?.tagName === 'BR' && source.startsWith('\n')) {
|
|
52
52
|
cursor = 1
|
|
53
53
|
}
|
|
54
54
|
while (cursor < source.length) {
|
|
@@ -92,11 +92,13 @@ function projectedFragment(node: Node): ProjectedFragment {
|
|
|
92
92
|
boundaries: [],
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
|
-
|
|
95
|
+
// Comments and other nodes that are neither text nor elements project nothing and own no offsets.
|
|
96
|
+
if (node.nodeType !== Node.ELEMENT_NODE) {
|
|
96
97
|
return { text: '', spans: [], boundaries: [] }
|
|
97
98
|
}
|
|
98
|
-
|
|
99
|
-
if (
|
|
99
|
+
const element = node as Element
|
|
100
|
+
if (excluded(element)) return { text: '', spans: [], boundaries: [] }
|
|
101
|
+
if (element.tagName === 'BR') return { text: '\n', spans: [], boundaries: [] }
|
|
100
102
|
let text = ''
|
|
101
103
|
let previous: Node | null = null
|
|
102
104
|
const spans: ProjectedTextSpan[] = []
|
|
@@ -147,21 +149,38 @@ export interface TextSelection {
|
|
|
147
149
|
readonly range: Range
|
|
148
150
|
}
|
|
149
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
|
+
|
|
150
166
|
/**
|
|
151
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.
|
|
152
169
|
* @param root - mounted interaction area.
|
|
153
170
|
* @param selection - browser selection in that area's document.
|
|
154
171
|
* @returns the selected source and range, or null across sources and excluded content.
|
|
155
172
|
*/
|
|
156
173
|
export function readTextSelection(root: HTMLElement, selection: Selection | null): TextSelection | null {
|
|
157
174
|
if (selection === null || selection.rangeCount !== 1 || selection.isCollapsed) return null
|
|
158
|
-
|
|
159
|
-
const sourceOf = (node: Node): HTMLElement | null =>
|
|
160
|
-
|
|
161
|
-
const
|
|
162
|
-
|
|
175
|
+
// A text container has no `closest`, so its parent element answers.
|
|
176
|
+
const sourceOf = (node: Node): HTMLElement | null => (node as Partial<Element>).closest?.<HTMLElement>('[data-text-interaction-source]')
|
|
177
|
+
?? node.parentElement?.closest<HTMLElement>('[data-text-interaction-source]') ?? null
|
|
178
|
+
const selected = selection.getRangeAt(0)
|
|
179
|
+
const source = sourceOf(selected.startContainer)
|
|
180
|
+
if (source === null || !root.contains(source)
|
|
163
181
|
|| source.closest('[hidden], [inert], [data-text-interaction-exclude]') !== null) return null
|
|
164
|
-
|
|
182
|
+
const range = endInSource(selected, source)
|
|
183
|
+
return range === null || sourceOf(range.endContainer) !== source ? null : { source, range }
|
|
165
184
|
}
|
|
166
185
|
|
|
167
186
|
/**
|
|
@@ -27,8 +27,8 @@ export interface ChatScrollInput extends ChatNavigationInput {
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
interface ChatScrollState extends ChatReadingState {
|
|
30
|
-
readonly listRef: RefObject<HTMLDivElement>
|
|
31
|
-
readonly columnRef: RefObject<HTMLDivElement>
|
|
30
|
+
readonly listRef: RefObject<HTMLDivElement | null>
|
|
31
|
+
readonly columnRef: RefObject<HTMLDivElement | null>
|
|
32
32
|
readonly busyTurn: number | null
|
|
33
33
|
readonly navigateToTurn: ChatNavigation['navigateToTurn']
|
|
34
34
|
readonly loadEarlier: ChatNavigation['loadEarlier']
|
|
@@ -693,7 +693,7 @@ export class ChatViewport {
|
|
|
693
693
|
const left = Math.max(viewport.left, content.left)
|
|
694
694
|
const right = Math.min(viewport.right, content.right)
|
|
695
695
|
for (const element of document.elementsFromPoint(left + Math.max(0, right - left) / 2, viewport.top + 1)) {
|
|
696
|
-
const row = element
|
|
696
|
+
const row = element.closest<HTMLElement>('[data-chat-anchor-key]')
|
|
697
697
|
if (row !== null && row.dataset.chatFlowKind !== 'turn-process' && list.contains(row)) {
|
|
698
698
|
// An open group's header stays put while older members enter above its body content.
|
|
699
699
|
anchor = row.dataset.chatGroupKey === undefined ? row
|
|
@@ -989,7 +989,7 @@ export class ChatViewport {
|
|
|
989
989
|
|
|
990
990
|
private pruneHistoryScrolling(): void {
|
|
991
991
|
for (const target of this.historyScrolling) {
|
|
992
|
-
if (
|
|
992
|
+
if (this.elements?.scroller.contains(target as Node) !== true) {
|
|
993
993
|
this.historyScrolling.delete(target)
|
|
994
994
|
}
|
|
995
995
|
}
|
|
@@ -1054,9 +1054,10 @@ export class ChatViewport {
|
|
|
1054
1054
|
}
|
|
1055
1055
|
|
|
1056
1056
|
private readonly onHistoryScroll = (event: Event): void => {
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1057
|
+
// A scroll event captured on the scroller targets the scroller or a scrolled descendant element.
|
|
1058
|
+
const target = event.target as Element
|
|
1059
|
+
if (target === this.elements?.scroller || target.hasAttribute('data-step-process-body')) {
|
|
1060
|
+
this.historyScrolling.add(target)
|
|
1060
1061
|
}
|
|
1061
1062
|
}
|
|
1062
1063
|
|
|
@@ -1071,7 +1072,7 @@ export class ChatViewport {
|
|
|
1071
1072
|
private readonly onHistoryRelease = (event: Event): void => {
|
|
1072
1073
|
if (event.type === 'pointerup' || event.type === 'pointercancel') this.historyPointer = false
|
|
1073
1074
|
if (event.type === 'touchend' || event.type === 'touchcancel') {
|
|
1074
|
-
this.historyTouch =
|
|
1075
|
+
this.historyTouch = 'touches' in event && (event as TouchEvent).touches.length > 0
|
|
1075
1076
|
}
|
|
1076
1077
|
this.events?.history?.()
|
|
1077
1078
|
}
|
|
@@ -1094,13 +1095,13 @@ export class ChatViewport {
|
|
|
1094
1095
|
if (event.target === this.elements?.scroller) {
|
|
1095
1096
|
this.events?.scrollEnd(true)
|
|
1096
1097
|
this.reclaimBelow()
|
|
1097
|
-
} else if (event.target
|
|
1098
|
+
} else if ((event.target as Element).hasAttribute('data-step-process-body')) this.events?.scrollEnd(false)
|
|
1098
1099
|
}
|
|
1099
1100
|
|
|
1100
1101
|
private readonly onIntent = (event: Event): void => {
|
|
1101
1102
|
if (event.type === 'keydown' || event.type === 'pointerdown') {
|
|
1102
|
-
if (event.target
|
|
1103
|
-
if (event.type === 'keydown' &&
|
|
1103
|
+
if ((event.target as Partial<Element>).closest?.('[data-composer-seat]') != null) return
|
|
1104
|
+
if (event.type === 'keydown' && !SCROLL_KEYS.has((event as KeyboardEvent).key)) return
|
|
1104
1105
|
}
|
|
1105
1106
|
this.events?.intent?.()
|
|
1106
1107
|
if (this.paging === null) return
|
|
@@ -1115,8 +1116,8 @@ export class ChatViewport {
|
|
|
1115
1116
|
*/
|
|
1116
1117
|
export function useChatViewport(): {
|
|
1117
1118
|
viewport: ChatViewport
|
|
1118
|
-
listRef: RefObject<HTMLDivElement>
|
|
1119
|
-
columnRef: RefObject<HTMLDivElement>
|
|
1119
|
+
listRef: RefObject<HTMLDivElement | null>
|
|
1120
|
+
columnRef: RefObject<HTMLDivElement | null>
|
|
1120
1121
|
} {
|
|
1121
1122
|
const listRef = useRef<HTMLDivElement | null>(null)
|
|
1122
1123
|
const columnRef = useRef<HTMLDivElement | null>(null)
|
|
@@ -17,7 +17,7 @@ const SCROLL_KEYS = new Set(['ArrowUp', 'ArrowDown', 'PageUp', 'PageDown', 'Home
|
|
|
17
17
|
* @returns edge fades, DOM event bindings, and one-shot positioning for manual opening.
|
|
18
18
|
*/
|
|
19
19
|
export function useProcessScroll(
|
|
20
|
-
bodyRef: RefObject<HTMLDivElement>, contentRef: RefObject<HTMLDivElement>, open: boolean, grouped: boolean,
|
|
20
|
+
bodyRef: RefObject<HTMLDivElement | null>, contentRef: RefObject<HTMLDivElement | null>, open: boolean, grouped: boolean,
|
|
21
21
|
): {
|
|
22
22
|
edges: ScrollEdges
|
|
23
23
|
events: Pick<DOMAttributes<HTMLDivElement>, 'onScroll' | 'onWheel' | 'onTouchStart' | 'onPointerDown' | 'onKeyDown'>
|
|
@@ -65,6 +65,10 @@ export interface ManualCompactionChatData {
|
|
|
65
65
|
export interface RetryChatData {
|
|
66
66
|
readonly attempts: readonly ModelRetryNode[]
|
|
67
67
|
readonly current: ModelRetryNode
|
|
68
|
+
/** The latest retry has started and its Step is still open, so its request is in flight. */
|
|
69
|
+
readonly inFlight: boolean
|
|
70
|
+
/** The last retry started in the last Step of a Turn that ended with an error. */
|
|
71
|
+
readonly failed: boolean
|
|
68
72
|
}
|
|
69
73
|
|
|
70
74
|
/** One provider/model route that contributed a billed request attempt. */
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import type { ChatNode } from './chat-nodes.ts'
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* Exclude system prompts, permission commands, and normal Team toggle receipts.
|
|
6
|
-
*
|
|
5
|
+
* Exclude complete system prompts, permission commands, and normal Team toggle receipts.
|
|
6
|
+
* Section-attributed in-history system prompt updates and failed Team toggles remain visible.
|
|
7
7
|
* @param node - projected Chat node.
|
|
8
8
|
* @returns whether the node contributes a visible Chat row.
|
|
9
9
|
*/
|
|
@@ -16,5 +16,5 @@ export function isVisibleChatNode(node: ChatNode): boolean {
|
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
return node.visibility === 'visible'
|
|
19
|
-
&& node.kind !== 'system-prompt'
|
|
19
|
+
&& (node.kind !== 'system-prompt' || node.data.message !== undefined)
|
|
20
20
|
}
|
|
@@ -14,10 +14,10 @@ import type {
|
|
|
14
14
|
import type {
|
|
15
15
|
HostObservable, InjectFace, KeyedSnapshotSelectorHook, PropsLocale, PropsRenderSlots, PropsRuntime,
|
|
16
16
|
PropsRenderFactories, PropsStore, SlotHookFactory, SnapshotSelectorHook,
|
|
17
|
-
} from '@deepseek-ai/dsh-client-ui-slots'
|
|
17
|
+
} from '@deepseek-ai/dsh-client-ui-slots/client'
|
|
18
18
|
import type { ObservableSnapshot } from '@deepseek-ai/dsh-client-store'
|
|
19
19
|
import type { ConnectionStateSource } from '@deepseek-ai/dsh-client-connection/client'
|
|
20
|
-
import type { FileDragActions, MarkdownDelegateFenceInfo, MarkdownFileMentions, MarkdownLabels } from '@deepseek-ai/dsh-client-ui-primitives'
|
|
20
|
+
import type { FileDragActions, MarkdownDelegateFenceInfo, MarkdownFileMentions, MarkdownLabels } from '@deepseek-ai/dsh-client-ui-primitives/client'
|
|
21
21
|
import type { ContextMenuTriggerProps } from '@deepseek-ai/dsh-client-ui-context-menu/client'
|
|
22
22
|
import type { ChatKey } from '../locale.ts'
|
|
23
23
|
import type {} from '@deepseek-ai/dsh-client-ui-layout/client'
|
|
@@ -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
|
|
|
@@ -182,7 +188,7 @@ export type UseDisclosure = () => {
|
|
|
182
188
|
* @param reveal - browser-find and focus-protection callback.
|
|
183
189
|
* @returns the stable process-container ref.
|
|
184
190
|
*/
|
|
185
|
-
export type UseGroupAction = (hidden: boolean, reveal: () => void) => RefObject<HTMLDivElement>
|
|
191
|
+
export type UseGroupAction = (hidden: boolean, reveal: () => void) => RefObject<HTMLDivElement | null>
|
|
186
192
|
|
|
187
193
|
/**
|
|
188
194
|
* Plain header visibility bound to the flow's viewport, including growth on reveal.
|
|
@@ -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
|
|
|
@@ -241,11 +250,19 @@ export interface ChatNodeOwnerProps {
|
|
|
241
250
|
cwd?: string | undefined
|
|
242
251
|
openFile: (path: string, options?: OpenFileOptions) => void
|
|
243
252
|
inspectCall: ((callId: ToolCallId) => void) | undefined
|
|
253
|
+
/** Open one model request's inspector record; absent without an inspection target. */
|
|
254
|
+
inspectRequest: ((turn: number, step: number) => void) | undefined
|
|
244
255
|
forkAt: (seq: number) => void
|
|
245
256
|
/** Session-authorized image loader supplied by the Chat view. */
|
|
246
257
|
loadImage: MessageImageLoader
|
|
247
258
|
/** Turn-process state when this Node belongs to a projected Turn. */
|
|
248
259
|
turnProcess?: TurnProcessOwnerProps | undefined
|
|
260
|
+
/**
|
|
261
|
+
* Whether this Node's Turn shows its step runs behind group headers.
|
|
262
|
+
* Process-level rows beside them match the header type size when true and the step-row size otherwise.
|
|
263
|
+
* The Chat Node seat supplies it; other owners of this type omit it.
|
|
264
|
+
*/
|
|
265
|
+
stepRunsGrouped?: boolean | undefined
|
|
249
266
|
}
|
|
250
267
|
|
|
251
268
|
/** One attachment in the original user-message display order. */
|
|
@@ -281,14 +298,6 @@ export interface TurnProcessOwnerProps {
|
|
|
281
298
|
setOpen(open: boolean): void
|
|
282
299
|
}
|
|
283
300
|
|
|
284
|
-
/** Shared presentation policy source for renderers that depend on the work-details mode. */
|
|
285
|
-
export interface PresentationInjected {
|
|
286
|
-
hooks: {
|
|
287
|
-
/** Live presentation policy derived from the accepted work-details mode. */
|
|
288
|
-
presentation: ObservableSnapshot<ChatPresentationPolicy>
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
|
|
292
301
|
/** Full props of one keyed Chat renderer. */
|
|
293
302
|
export type ChatNodeViewProps<Kind extends ChatNodeKind = ChatNodeKind> =
|
|
294
303
|
PropsRuntime<'conversation.chat.node', Kind> & PropsLocale<'chat'> & PropsRenderFactories
|
|
@@ -371,7 +380,7 @@ export type ChatFlowDataInjected = Pick<ChatViewInjected, 'keyedHooks'> & {
|
|
|
371
380
|
|
|
372
381
|
/** Ordered rows and reconciled local echoes rendered inside one Chat viewport. */
|
|
373
382
|
export interface ChatFlowOwnerProps extends Pick<ChatNodeOwnerProps,
|
|
374
|
-
'cwd' | 'openFile' | 'inspectCall' | 'forkAt' | 'loadImage'> {
|
|
383
|
+
'cwd' | 'openFile' | 'inspectCall' | 'inspectRequest' | 'forkAt' | 'loadImage'> {
|
|
375
384
|
readonly entries: readonly RenderEntry[]
|
|
376
385
|
readonly pendingInputs: readonly (PendingSubmission | InboxState['next-step'][number])[]
|
|
377
386
|
readonly lastInputTurn: number | undefined
|
|
@@ -399,7 +408,7 @@ export type ChatViewSlotProps =
|
|
|
399
408
|
export type MessageImagesProps =
|
|
400
409
|
PropsRuntime<'conversation.chat.user.images' | 'conversation.chat.message.images'> & PropsRenderFactories
|
|
401
410
|
|
|
402
|
-
declare module '@deepseek-ai/dsh-client-ui-slots' {
|
|
411
|
+
declare module '@deepseek-ai/dsh-client-ui-slots/client' {
|
|
403
412
|
interface SessionStandardProps {
|
|
404
413
|
/** Selector hook over the current Conversation binding's Chat target. */
|
|
405
414
|
useChat: UseChat
|
|
@@ -508,8 +517,16 @@ declare module '@deepseek-ai/dsh-client-ui-slots' {
|
|
|
508
517
|
* Ordered actions for one finalized assistant message. Each entry receives
|
|
509
518
|
* the durable message id; a fresh `id` adds an action and reusing one replaces
|
|
510
519
|
* that entry. With no entries, the standard action row remains unchanged.
|
|
520
|
+
* A control carrying `data-action-ongoing` keeps a row that is otherwise
|
|
521
|
+
* shown only on hover or focus visible while its action runs.
|
|
511
522
|
*/
|
|
512
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 }
|
|
513
530
|
/**
|
|
514
531
|
* Frame-wide quota notice chain. The Chat-owned host in `shell.overlay`
|
|
515
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
|
|
@@ -152,7 +153,7 @@ Settings → General → Replies after collapse appears directly below Collapse
|
|
|
152
153
|
|
|
153
154
|
### Group-title rules
|
|
154
155
|
|
|
155
|
-
A closed group's header names the first three categories from its ranked summary, without displaying counts. A group without categories uses the thinking label. A running header names its live tool category
|
|
156
|
+
A closed group's header names the first three categories from its ranked summary, without displaying counts. A group without categories uses the thinking label. A running header names its live tool category; without one it uses the thinking label until a non-Context category is counted, then the completed-work title followed by the next-step phrase. Standard appends live detail. Live titles remain visible for at least 150ms, retaining only the newest pending title.
|
|
156
157
|
|
|
157
158
|
All three stages share the tool-name classification below. A preparing Tool node uses its category's preparation label: read files for `read`, read images for `read_image`, write files for `write`, edit files for `edit` and `apply_patch`, and update the plan for `todo_write` and goal tools. Standard mode appends available argument detail using the same readers as dispatched calls. It contributes one call and renders one non-expandable row. A named live delta can create this node; historical calls start directly from tool/call without replaying preparation.
|
|
158
159
|
|
|
@@ -160,7 +161,7 @@ The labels below describe recorded activity, not successful outcomes. For exampl
|
|
|
160
161
|
|
|
161
162
|
| Category | Running label | Closed label |
|
|
162
163
|
|---|---|---|
|
|
163
|
-
| No live category / no counted categories | Analyzing the request | Analysis completed |
|
|
164
|
+
| No live category / no counted categories | Analyzing the request; after categories are counted, the completed-work title followed by `, thinking about the next step` | Analysis completed |
|
|
164
165
|
| `read` | Reading files | Read files |
|
|
165
166
|
| `readImage` | Reading images | Read images |
|
|
166
167
|
| `search` | Searching code | Searched code |
|
|
@@ -179,7 +180,7 @@ The labels below describe recorded activity, not successful outcomes. For exampl
|
|
|
179
180
|
| Group state | Title composition |
|
|
180
181
|
|---|---|
|
|
181
182
|
| Not closed, with a running tool | Use the live category, not the highest-count category. Standard appends nonempty detail with ` · `; Compact omits detail. |
|
|
182
|
-
| Not closed, without a running tool |
|
|
183
|
+
| Not closed, without a running tool | With zero categories or only `context`, use the analysis label. Otherwise compose the closed-group title from the same counts and append the next-step phrase, for example `Read files and searched code, thinking about the next step`. Standard may append running reasoning detail. |
|
|
183
184
|
| Closed, zero categories | Use the completed-analysis label. |
|
|
184
185
|
| Closed, one category | Use its closed label without a count. |
|
|
185
186
|
| Closed, two categories | Join ranked labels with “and”. Chinese removes the second leading `已` only when both labels start with it. |
|
|
@@ -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
|
### 默认值与配置保存
|
|
@@ -152,7 +153,7 @@ description: "Chat 过程分组与活动摘要的明细业务规则。"
|
|
|
152
153
|
|
|
153
154
|
### 组标题规则
|
|
154
155
|
|
|
155
|
-
|
|
156
|
+
已结束组的组头展示排序摘要的前三类,不显示次数;没有类别时使用思考标题。运行中的组头展示实时工具类别;没有运行工具时,计入非 Context 类别前使用思考标题,之后使用已完成工作的标题并追加下一步文案;标准模式附加实时详情。实时标题至少保留 150ms,只保留最新待显示标题。
|
|
156
157
|
|
|
157
158
|
三个阶段共用下方工具名分类。准备中的 Tool 节点使用对应类别的准备文案;`read` 为「准备读取文件」,`read_image` 为「准备读取图片」,`write` 为「准备写入文件」,`edit` 和 `apply_patch` 为「准备编辑文件」,`todo_write` 及目标工具为「准备更新计划」。标准模式通过与已派发调用相同的读器追加可用参数详情。它计为一次调用,只渲染不可展开的一行。具名实时 delta 可以创建该节点;历史调用直接从 tool/call 开始,不重现准备过程。
|
|
158
159
|
|
|
@@ -160,7 +161,7 @@ description: "Chat 过程分组与活动摘要的明细业务规则。"
|
|
|
160
161
|
|
|
161
162
|
| 类别 | 未结束组的活动文案 | 已结束组的摘要文案 |
|
|
162
163
|
|---|---|---|
|
|
163
|
-
| 无实时类别 / 无计数类别 |
|
|
164
|
+
| 无实时类别 / 无计数类别 | 正在分析请求;计入类别后为已完成工作的标题加「,正在思考下一步」 | 已完成分析 |
|
|
164
165
|
| `read` | 正在读取文件 | 已读取文件 |
|
|
165
166
|
| `readImage` | 正在读取图片 | 已读取图片 |
|
|
166
167
|
| `search` | 正在搜索代码 | 已搜索代码 |
|
|
@@ -179,7 +180,7 @@ description: "Chat 过程分组与活动摘要的明细业务规则。"
|
|
|
179
180
|
| 组状态 | 标题组合规则 |
|
|
180
181
|
|---|---|
|
|
181
182
|
| 未结束,有运行工具 | 取实时类别,不取计数最多的类别。标准模式用 ` · ` 追加非空详情,简洁模式不追加。 |
|
|
182
|
-
| 未结束,没有运行工具 |
|
|
183
|
+
| 未结束,没有运行工具 | 零个类别或只有 `context` 时使用分析文案;否则按相同次数组合已结束组的标题,并追加下一步文案,例如 `已读取文件并搜索代码,正在思考下一步`。标准模式可以追加运行中推理详情。 |
|
|
183
184
|
| 已结束,零个类别 | 使用「已完成分析」。 |
|
|
184
185
|
| 已结束,一个类别 | 使用该类别的已结束文案,不带次数。 |
|
|
185
186
|
| 已结束,两个类别 | 按排名用「并」连接;仅当两项都以 `已` 开头时省略第二项的 `已`,例如 `已读取文件并搜索代码`。 |
|
|
@@ -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'
|
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
import type { Context } from '@deepseek-ai/cordis'
|
|
2
2
|
import type {
|
|
3
3
|
ConversationMatch, ConversationNodeContext, ConversationNodeDefinition, RequestPromptInspector,
|
|
4
|
-
SystemPromptState, SystemPromptInspector,
|
|
4
|
+
SystemMessageSections, SystemPromptState, SystemPromptInspector,
|
|
5
5
|
} from '@deepseek-ai/dsh-client-ui-conversation/client'
|
|
6
6
|
import type { ChatNode } from '../contract/chat-nodes.ts'
|
|
7
7
|
import { chatNode } from './common.ts'
|
|
8
8
|
|
|
9
9
|
declare module '../contract/chat-nodes.ts' {
|
|
10
10
|
interface ChatNodeDataMap {
|
|
11
|
-
/**
|
|
12
|
-
|
|
11
|
+
/**
|
|
12
|
+
* Complete system prompt rendered for one model request, or an in-history prompt update at its own position.
|
|
13
|
+
* `message` splits an update by the sources it names when the event carries section metadata.
|
|
14
|
+
*/
|
|
15
|
+
'system-prompt': { readonly text: string; readonly update?: true; readonly message?: SystemMessageSections }
|
|
13
16
|
}
|
|
14
17
|
}
|
|
15
18
|
|
|
@@ -53,7 +56,8 @@ function stableRequestPromptAnchor(
|
|
|
53
56
|
* `system/message` event on the Chat target so the unknown-surface fallback
|
|
54
57
|
* never renders the prompt as a transcript row. Each nonempty append owns a
|
|
55
58
|
* prompt card, even without a loaded request header. Initial cards precede
|
|
56
|
-
* their step's input; in-history updates stay at their own positions
|
|
59
|
+
* their step's input; in-history updates stay at their own positions, and one
|
|
60
|
+
* carrying section metadata is the only prompt card Chat shows. The
|
|
57
61
|
* request-prompt Definition owns replacement and later-series cards. Positional
|
|
58
62
|
* replacements advance the effective prompt without changing historical cards.
|
|
59
63
|
* A published node becomes `hidden` under the same key while a prepended replacement
|
|
@@ -76,14 +80,20 @@ export function systemMessageDefinition(inspect: SystemPromptInspector): Convers
|
|
|
76
80
|
update: context => context.state,
|
|
77
81
|
buildViewNode: (context) => {
|
|
78
82
|
const state = context.state?.introduced
|
|
79
|
-
|
|
83
|
+
// An update that only retires or clears sources has no text but still presents its section reading.
|
|
84
|
+
const sectioned = state?.update === true && state.message !== undefined
|
|
85
|
+
if (state === undefined || (state.text === '' && !sectioned)
|
|
80
86
|
|| context.start?.event.type !== 'system/message' || context.start.event.surfaceOp !== 'append') {
|
|
81
87
|
const current = context.current.get('chat') as ChatNode | null | undefined
|
|
82
88
|
if (current?.kind !== 'system-prompt') return null
|
|
83
89
|
return chatNode(context, 'system-prompt', current.anchorSeq, current.data, { visibility: 'hidden' })
|
|
84
90
|
}
|
|
85
91
|
const anchor = state.update ? state.seq : requestPromptAnchor(context.start, undefined, true)
|
|
86
|
-
return chatNode(context, 'system-prompt', anchor, {
|
|
92
|
+
return chatNode(context, 'system-prompt', anchor, {
|
|
93
|
+
text: state.text,
|
|
94
|
+
...state.update ? { update: true } : {},
|
|
95
|
+
...state.update && state.message !== undefined ? { message: state.message } : {},
|
|
96
|
+
})
|
|
87
97
|
},
|
|
88
98
|
}
|
|
89
99
|
}
|