@deepseek-ai/dsh-client-ui-chat 0.2.3-alpha.1 → 0.2.3-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.i18n.yaml +10 -10
- package/README.md +7 -5
- package/README.zh.md +7 -5
- package/lib/client.js +9 -9
- package/lib/client.js.map +1 -1
- package/lib/types/client/apply.js.map +1 -1
- package/lib/types/client/chat/ApprovalCommand.d.ts +1 -1
- package/lib/types/client/chat/ApprovalCommand.d.ts.map +1 -1
- package/lib/types/client/chat/AssistantMarkdown.d.ts +2 -2
- package/lib/types/client/chat/AssistantMarkdown.d.ts.map +1 -1
- package/lib/types/client/chat/AssistantMarkdown.js.map +1 -1
- package/lib/types/client/chat/AssistantNodeView.d.ts +1 -1
- package/lib/types/client/chat/AssistantNodeView.d.ts.map +1 -1
- package/lib/types/client/chat/ChatAside.d.ts +1 -1
- package/lib/types/client/chat/ChatAside.d.ts.map +1 -1
- package/lib/types/client/chat/ChatFlow.d.ts +1 -1
- package/lib/types/client/chat/ChatFlow.d.ts.map +1 -1
- package/lib/types/client/chat/ChatFlow.js.map +1 -1
- package/lib/types/client/chat/ChatGroupSeat.d.ts.map +1 -1
- package/lib/types/client/chat/ChatGroupSeat.js.map +1 -1
- package/lib/types/client/chat/ChatNodeSeat.d.ts +1 -1
- package/lib/types/client/chat/ChatNodeSeat.d.ts.map +1 -1
- package/lib/types/client/chat/ChatNodeSeat.js.map +1 -1
- package/lib/types/client/chat/ChatView.d.ts +1 -1
- package/lib/types/client/chat/ChatView.d.ts.map +1 -1
- package/lib/types/client/chat/ChatView.js.map +1 -1
- package/lib/types/client/chat/CommandNodeView.d.ts +1 -1
- package/lib/types/client/chat/CommandNodeView.d.ts.map +1 -1
- package/lib/types/client/chat/CommandStatusRow.js.map +1 -1
- package/lib/types/client/chat/CompactionItem.js.map +1 -1
- package/lib/types/client/chat/ContextBody.d.ts +11 -1
- package/lib/types/client/chat/ContextBody.d.ts.map +1 -1
- package/lib/types/client/chat/ContextBody.js.map +1 -1
- package/lib/types/client/chat/ContextInjectionRow.js.map +1 -1
- package/lib/types/client/chat/MessageIconActions.js.map +1 -1
- package/lib/types/client/chat/MessageItem.d.ts +2 -2
- package/lib/types/client/chat/MessageItem.d.ts.map +1 -1
- package/lib/types/client/chat/MessageItem.js.map +1 -1
- package/lib/types/client/chat/QuotaNoticeHost.js.map +1 -1
- package/lib/types/client/chat/ReasoningContent.d.ts +1 -1
- package/lib/types/client/chat/ReasoningContent.d.ts.map +1 -1
- package/lib/types/client/chat/ReasoningContent.js.map +1 -1
- package/lib/types/client/chat/ReasoningRow.d.ts +1 -1
- package/lib/types/client/chat/ReasoningRow.d.ts.map +1 -1
- package/lib/types/client/chat/ReasoningRow.js.map +1 -1
- package/lib/types/client/chat/RunningStatus.js.map +1 -1
- package/lib/types/client/chat/StatsPills.d.ts +1 -1
- package/lib/types/client/chat/StatsPills.d.ts.map +1 -1
- package/lib/types/client/chat/StatsPills.js.map +1 -1
- package/lib/types/client/chat/SystemPromptRow.d.ts +7 -3
- package/lib/types/client/chat/SystemPromptRow.d.ts.map +1 -1
- package/lib/types/client/chat/SystemPromptRow.js.map +1 -1
- package/lib/types/client/chat/TurnNavigator.d.ts +1 -1
- package/lib/types/client/chat/TurnNavigator.d.ts.map +1 -1
- package/lib/types/client/chat/TurnProcessNodeView.js.map +1 -1
- package/lib/types/client/chat/TurnTailNodeView.d.ts +1 -1
- package/lib/types/client/chat/TurnTailNodeView.d.ts.map +1 -1
- package/lib/types/client/chat/TurnTriggerNodeView.js.map +1 -1
- package/lib/types/client/chat/TurnUsagePanel.js.map +1 -1
- package/lib/types/client/chat/UserContent.d.ts +1 -1
- package/lib/types/client/chat/UserContent.d.ts.map +1 -1
- package/lib/types/client/chat/UserContent.js.map +1 -1
- package/lib/types/client/chat/flow-motion.d.ts +1 -1
- package/lib/types/client/chat/flow-motion.d.ts.map +1 -1
- package/lib/types/client/chat/flow-motion.js.map +1 -1
- package/lib/types/client/chat/message-chrome.d.ts +1 -1
- package/lib/types/client/chat/message-chrome.d.ts.map +1 -1
- package/lib/types/client/chat/searchable-hidden.d.ts +1 -1
- package/lib/types/client/chat/searchable-hidden.d.ts.map +1 -1
- package/lib/types/client/chat/stat-dialog.d.ts +3 -3
- package/lib/types/client/chat/stat-dialog.d.ts.map +1 -1
- package/lib/types/client/chat/stat-dialog.js.map +1 -1
- package/lib/types/client/chat/step-process.d.ts +18 -1
- package/lib/types/client/chat/step-process.d.ts.map +1 -1
- package/lib/types/client/chat/step-process.js.map +1 -1
- package/lib/types/client/chat/text-interaction.d.ts +1 -1
- package/lib/types/client/chat/text-interaction.d.ts.map +1 -1
- package/lib/types/client/chat/text-interaction.js.map +1 -1
- package/lib/types/client/chat/text-selection.d.ts.map +1 -1
- package/lib/types/client/chat/text-selection.js.map +1 -1
- package/lib/types/client/chat/use-chat-scroll.d.ts +2 -2
- package/lib/types/client/chat/use-chat-scroll.d.ts.map +1 -1
- package/lib/types/client/chat/use-chat-viewport.d.ts +2 -2
- package/lib/types/client/chat/use-chat-viewport.d.ts.map +1 -1
- package/lib/types/client/chat/use-chat-viewport.js.map +1 -1
- package/lib/types/client/chat/use-process-scroll.d.ts +1 -1
- package/lib/types/client/chat/use-process-scroll.d.ts.map +1 -1
- package/lib/types/client/chat/use-process-scroll.js.map +1 -1
- package/lib/types/client/contract/chat-nodes.d.ts +4 -0
- package/lib/types/client/contract/chat-nodes.d.ts.map +1 -1
- package/lib/types/client/contract/chat-nodes.js.map +1 -1
- package/lib/types/client/contract/chat-visibility.d.ts +2 -2
- package/lib/types/client/contract/chat-visibility.js.map +1 -1
- package/lib/types/client/contract/slots.d.ts +15 -5
- package/lib/types/client/contract/slots.d.ts.map +1 -1
- package/lib/types/client/conversation-nodes/request-prompt.d.ts +8 -3
- package/lib/types/client/conversation-nodes/request-prompt.d.ts.map +1 -1
- package/lib/types/client/conversation-nodes/request-prompt.js.map +1 -1
- package/lib/types/client/conversation-nodes/retry.d.ts.map +1 -1
- package/lib/types/client/conversation-nodes/retry.js.map +1 -1
- package/lib/types/client/conversation-nodes/tool.d.ts +18 -3
- package/lib/types/client/conversation-nodes/tool.d.ts.map +1 -1
- package/lib/types/client/conversation-nodes/tool.js.map +1 -1
- package/lib/types/client/fence/FenceLayers.d.ts +1 -1
- package/lib/types/client/fence/FenceLayers.d.ts.map +1 -1
- package/lib/types/client/fence/FenceLayers.js.map +1 -1
- package/lib/types/client/locale.d.ts +96 -0
- package/lib/types/client/locale.d.ts.map +1 -1
- package/lib/types/client/locale.js.map +1 -1
- package/lib/types/client/markdown-labels.d.ts +1 -1
- package/lib/types/client/markdown-labels.d.ts.map +1 -1
- package/lib/types/client/settings/LinkOpeningRow.d.ts +2 -2
- package/lib/types/client/settings/LinkOpeningRow.d.ts.map +1 -1
- package/lib/types/client/settings/PerformanceUsageRow.d.ts +2 -2
- package/lib/types/client/settings/PerformanceUsageRow.d.ts.map +1 -1
- package/lib/types/client/settings/PreferenceRow.js.map +1 -1
- package/lib/types/client/settings/TranscriptViewRow.d.ts +2 -2
- package/lib/types/client/settings/TranscriptViewRow.d.ts.map +1 -1
- package/package.json +46 -46
- package/src/client/apply.ts +9 -9
- package/src/client/chat/ApprovalCommand.tsx +1 -1
- package/src/client/chat/AssistantMarkdown.module.css +10 -16
- package/src/client/chat/AssistantMarkdown.tsx +3 -3
- package/src/client/chat/AssistantNodeView.tsx +1 -1
- package/src/client/chat/ChatAside.tsx +1 -1
- package/src/client/chat/ChatFlow.tsx +2 -2
- package/src/client/chat/ChatGroupSeat.tsx +10 -6
- package/src/client/chat/ChatNodeSeat.tsx +12 -4
- package/src/client/chat/ChatView.module.css +30 -9
- package/src/client/chat/ChatView.tsx +5 -4
- package/src/client/chat/CommandNodeView.tsx +1 -1
- package/src/client/chat/CommandStatusRow.tsx +1 -1
- package/src/client/chat/CompactionItem.tsx +1 -1
- package/src/client/chat/ContextBody.module.css +8 -0
- package/src/client/chat/ContextBody.tsx +32 -2
- package/src/client/chat/ContextInjectionRow.tsx +1 -1
- package/src/client/chat/MessageIconActions.module.css +7 -0
- package/src/client/chat/MessageIconActions.tsx +1 -1
- package/src/client/chat/MessageItem.module.css +40 -48
- package/src/client/chat/MessageItem.tsx +58 -26
- package/src/client/chat/QuotaNoticeHost.tsx +1 -1
- package/src/client/chat/ReasoningContent.tsx +2 -2
- package/src/client/chat/ReasoningRow.tsx +2 -2
- package/src/client/chat/RunningStatus.tsx +1 -1
- package/src/client/chat/StatsPills.tsx +2 -2
- package/src/client/chat/SystemPromptRow.tsx +23 -7
- package/src/client/chat/TurnNavigator.module.css +1 -1
- package/src/client/chat/TurnProcessNodeView.tsx +1 -1
- package/src/client/chat/TurnTailNodeView.tsx +1 -1
- package/src/client/chat/TurnTriggerNodeView.tsx +1 -1
- package/src/client/chat/TurnUsagePanel.tsx +1 -1
- package/src/client/chat/UserContent.tsx +2 -2
- package/src/client/chat/flow-motion.ts +3 -1
- package/src/client/chat/message-chrome.ts +1 -1
- package/src/client/chat/searchable-hidden.ts +1 -1
- package/src/client/chat/stat-dialog.module.css +8 -6
- package/src/client/chat/stat-dialog.ts +5 -5
- package/src/client/chat/step-process.ts +33 -1
- package/src/client/chat/text-interaction.ts +6 -6
- package/src/client/chat/text-selection.ts +13 -10
- package/src/client/chat/use-chat-scroll.ts +2 -2
- package/src/client/chat/use-chat-viewport.ts +12 -11
- package/src/client/chat/use-process-scroll.ts +1 -1
- package/src/client/contract/chat-nodes.ts +4 -0
- package/src/client/contract/chat-visibility.ts +3 -3
- package/src/client/contract/slots.ts +15 -5
- package/src/client/conversation-nodes/README.i18n.yaml +2 -2
- package/src/client/conversation-nodes/README.md +3 -3
- package/src/client/conversation-nodes/README.zh.md +3 -3
- package/src/client/conversation-nodes/request-prompt.ts +16 -6
- package/src/client/conversation-nodes/retry.ts +19 -1
- package/src/client/conversation-nodes/tool.ts +49 -28
- package/src/client/conversation-nodes/turn-process.ts +1 -1
- package/src/client/fence/FenceLayers.tsx +2 -2
- package/src/client/locale.ts +96 -0
- package/src/client/markdown-labels.ts +1 -1
- package/src/client/model/tool-call-tree.ts +1 -1
- package/src/client/settings/LinkOpeningRow.tsx +2 -2
- package/src/client/settings/PerformanceUsageRow.tsx +2 -2
- package/src/client/settings/PreferenceRow.tsx +1 -1
- package/src/client/settings/TranscriptViewRow.tsx +2 -2
|
@@ -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[] = []
|
|
@@ -156,8 +158,9 @@ export interface TextSelection {
|
|
|
156
158
|
export function readTextSelection(root: HTMLElement, selection: Selection | null): TextSelection | null {
|
|
157
159
|
if (selection === null || selection.rangeCount !== 1 || selection.isCollapsed) return null
|
|
158
160
|
const range = selection.getRangeAt(0)
|
|
159
|
-
|
|
160
|
-
|
|
161
|
+
// A text container has no `closest`, so its parent element answers.
|
|
162
|
+
const sourceOf = (node: Node): HTMLElement | null => (node as Partial<Element>).closest?.<HTMLElement>('[data-text-interaction-source]')
|
|
163
|
+
?? node.parentElement?.closest<HTMLElement>('[data-text-interaction-source]') ?? null
|
|
161
164
|
const source = sourceOf(range.startContainer)
|
|
162
165
|
if (source === null || source !== sourceOf(range.endContainer) || !root.contains(source)
|
|
163
166
|
|| source.closest('[hidden], [inert], [data-text-interaction-exclude]') !== null) return null
|
|
@@ -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'
|
|
@@ -182,7 +182,7 @@ export type UseDisclosure = () => {
|
|
|
182
182
|
* @param reveal - browser-find and focus-protection callback.
|
|
183
183
|
* @returns the stable process-container ref.
|
|
184
184
|
*/
|
|
185
|
-
export type UseGroupAction = (hidden: boolean, reveal: () => void) => RefObject<HTMLDivElement>
|
|
185
|
+
export type UseGroupAction = (hidden: boolean, reveal: () => void) => RefObject<HTMLDivElement | null>
|
|
186
186
|
|
|
187
187
|
/**
|
|
188
188
|
* Plain header visibility bound to the flow's viewport, including growth on reveal.
|
|
@@ -241,11 +241,19 @@ export interface ChatNodeOwnerProps {
|
|
|
241
241
|
cwd?: string | undefined
|
|
242
242
|
openFile: (path: string, options?: OpenFileOptions) => void
|
|
243
243
|
inspectCall: ((callId: ToolCallId) => void) | undefined
|
|
244
|
+
/** Open one model request's inspector record; absent without an inspection target. */
|
|
245
|
+
inspectRequest: ((turn: number, step: number) => void) | undefined
|
|
244
246
|
forkAt: (seq: number) => void
|
|
245
247
|
/** Session-authorized image loader supplied by the Chat view. */
|
|
246
248
|
loadImage: MessageImageLoader
|
|
247
249
|
/** Turn-process state when this Node belongs to a projected Turn. */
|
|
248
250
|
turnProcess?: TurnProcessOwnerProps | undefined
|
|
251
|
+
/**
|
|
252
|
+
* Whether this Node's Turn shows its step runs behind group headers.
|
|
253
|
+
* Process-level rows beside them match the header type size when true and the step-row size otherwise.
|
|
254
|
+
* The Chat Node seat supplies it; other owners of this type omit it.
|
|
255
|
+
*/
|
|
256
|
+
stepRunsGrouped?: boolean | undefined
|
|
249
257
|
}
|
|
250
258
|
|
|
251
259
|
/** One attachment in the original user-message display order. */
|
|
@@ -371,7 +379,7 @@ export type ChatFlowDataInjected = Pick<ChatViewInjected, 'keyedHooks'> & {
|
|
|
371
379
|
|
|
372
380
|
/** Ordered rows and reconciled local echoes rendered inside one Chat viewport. */
|
|
373
381
|
export interface ChatFlowOwnerProps extends Pick<ChatNodeOwnerProps,
|
|
374
|
-
'cwd' | 'openFile' | 'inspectCall' | 'forkAt' | 'loadImage'> {
|
|
382
|
+
'cwd' | 'openFile' | 'inspectCall' | 'inspectRequest' | 'forkAt' | 'loadImage'> {
|
|
375
383
|
readonly entries: readonly RenderEntry[]
|
|
376
384
|
readonly pendingInputs: readonly (PendingSubmission | InboxState['next-step'][number])[]
|
|
377
385
|
readonly lastInputTurn: number | undefined
|
|
@@ -399,7 +407,7 @@ export type ChatViewSlotProps =
|
|
|
399
407
|
export type MessageImagesProps =
|
|
400
408
|
PropsRuntime<'conversation.chat.user.images' | 'conversation.chat.message.images'> & PropsRenderFactories
|
|
401
409
|
|
|
402
|
-
declare module '@deepseek-ai/dsh-client-ui-slots' {
|
|
410
|
+
declare module '@deepseek-ai/dsh-client-ui-slots/client' {
|
|
403
411
|
interface SessionStandardProps {
|
|
404
412
|
/** Selector hook over the current Conversation binding's Chat target. */
|
|
405
413
|
useChat: UseChat
|
|
@@ -508,6 +516,8 @@ declare module '@deepseek-ai/dsh-client-ui-slots' {
|
|
|
508
516
|
* Ordered actions for one finalized assistant message. Each entry receives
|
|
509
517
|
* the durable message id; a fresh `id` adds an action and reusing one replaces
|
|
510
518
|
* that entry. With no entries, the standard action row remains unchanged.
|
|
519
|
+
* A control carrying `data-action-ongoing` keeps a row that is otherwise
|
|
520
|
+
* shown only on hover or focus visible while its action runs.
|
|
511
521
|
*/
|
|
512
522
|
'conversation.chat.assistant-actions': { kind: 'list'; scope: 'session'; owner: AssistantActionOwnerProps }
|
|
513
523
|
/**
|
|
@@ -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: c303519aeda55647
|
|
43
|
+
zh: 8f69cd8c781aabe8
|
|
44
44
|
/chat-conversation-node-rules/process-grouping:
|
|
45
45
|
en: 4c581ba07e633619
|
|
46
46
|
zh: d3ea678ba42a496a
|
|
@@ -152,7 +152,7 @@ Settings → General → Replies after collapse appears directly below Collapse
|
|
|
152
152
|
|
|
153
153
|
### Group-title rules
|
|
154
154
|
|
|
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
|
|
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; 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
156
|
|
|
157
157
|
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
158
|
|
|
@@ -160,7 +160,7 @@ The labels below describe recorded activity, not successful outcomes. For exampl
|
|
|
160
160
|
|
|
161
161
|
| Category | Running label | Closed label |
|
|
162
162
|
|---|---|---|
|
|
163
|
-
| No live category / no counted categories | Analyzing the request | Analysis completed |
|
|
163
|
+
| 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
164
|
| `read` | Reading files | Read files |
|
|
165
165
|
| `readImage` | Reading images | Read images |
|
|
166
166
|
| `search` | Searching code | Searched code |
|
|
@@ -179,7 +179,7 @@ The labels below describe recorded activity, not successful outcomes. For exampl
|
|
|
179
179
|
| Group state | Title composition |
|
|
180
180
|
|---|---|
|
|
181
181
|
| 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 |
|
|
182
|
+
| 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
183
|
| Closed, zero categories | Use the completed-analysis label. |
|
|
184
184
|
| Closed, one category | Use its closed label without a count. |
|
|
185
185
|
| Closed, two categories | Join ranked labels with “and”. Chinese removes the second leading `已` only when both labels start with it. |
|
|
@@ -152,7 +152,7 @@ description: "Chat 过程分组与活动摘要的明细业务规则。"
|
|
|
152
152
|
|
|
153
153
|
### 组标题规则
|
|
154
154
|
|
|
155
|
-
|
|
155
|
+
已结束组的组头展示排序摘要的前三类,不显示次数;没有类别时使用思考标题。运行中的组头展示实时工具类别;没有运行工具时,计入非 Context 类别前使用思考标题,之后使用已完成工作的标题并追加下一步文案;标准模式附加实时详情。实时标题至少保留 150ms,只保留最新待显示标题。
|
|
156
156
|
|
|
157
157
|
三个阶段共用下方工具名分类。准备中的 Tool 节点使用对应类别的准备文案;`read` 为「准备读取文件」,`read_image` 为「准备读取图片」,`write` 为「准备写入文件」,`edit` 和 `apply_patch` 为「准备编辑文件」,`todo_write` 及目标工具为「准备更新计划」。标准模式通过与已派发调用相同的读器追加可用参数详情。它计为一次调用,只渲染不可展开的一行。具名实时 delta 可以创建该节点;历史调用直接从 tool/call 开始,不重现准备过程。
|
|
158
158
|
|
|
@@ -160,7 +160,7 @@ description: "Chat 过程分组与活动摘要的明细业务规则。"
|
|
|
160
160
|
|
|
161
161
|
| 类别 | 未结束组的活动文案 | 已结束组的摘要文案 |
|
|
162
162
|
|---|---|---|
|
|
163
|
-
| 无实时类别 / 无计数类别 |
|
|
163
|
+
| 无实时类别 / 无计数类别 | 正在分析请求;计入类别后为已完成工作的标题加「,正在思考下一步」 | 已完成分析 |
|
|
164
164
|
| `read` | 正在读取文件 | 已读取文件 |
|
|
165
165
|
| `readImage` | 正在读取图片 | 已读取图片 |
|
|
166
166
|
| `search` | 正在搜索代码 | 已搜索代码 |
|
|
@@ -179,7 +179,7 @@ description: "Chat 过程分组与活动摘要的明细业务规则。"
|
|
|
179
179
|
| 组状态 | 标题组合规则 |
|
|
180
180
|
|---|---|
|
|
181
181
|
| 未结束,有运行工具 | 取实时类别,不取计数最多的类别。标准模式用 ` · ` 追加非空详情,简洁模式不追加。 |
|
|
182
|
-
| 未结束,没有运行工具 |
|
|
182
|
+
| 未结束,没有运行工具 | 零个类别或只有 `context` 时使用分析文案;否则按相同次数组合已结束组的标题,并追加下一步文案,例如 `已读取文件并搜索代码,正在思考下一步`。标准模式可以追加运行中推理详情。 |
|
|
183
183
|
| 已结束,零个类别 | 使用「已完成分析」。 |
|
|
184
184
|
| 已结束,一个类别 | 使用该类别的已结束文案,不带次数。 |
|
|
185
185
|
| 已结束,两个类别 | 按排名用「并」连接;仅当两项都以 `已` 开头时省略第二项的 `已`,例如 `已读取文件并搜索代码`。 |
|
|
@@ -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
|
}
|
|
@@ -37,6 +37,18 @@ function isClosed(location: ConversationLocation): boolean {
|
|
|
37
37
|
|| ((location.kind === 'step' || location.kind === 'turn') && location.turn.status === 'closed')
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
+
/**
|
|
41
|
+
* The last started retry failed when its Step is the last of a Turn that ended with an error.
|
|
42
|
+
* A retry chain can continue into a later Turn, so the current attempt's own location decides.
|
|
43
|
+
* The rule reads the Turn outcome, not the retried request's own result: a retry that
|
|
44
|
+
* succeeded and whose Step then failed for another reason also reads as failed.
|
|
45
|
+
*/
|
|
46
|
+
function finallyFailed(location: ConversationLocation, current: ModelRetryNode): boolean {
|
|
47
|
+
if (current.retryState !== 'started' || location.kind !== 'step') return false
|
|
48
|
+
const turn = location.turn
|
|
49
|
+
return turn.end?.data.reason.kind === 'error' && turn.steps.at(-1)?.step === current.step
|
|
50
|
+
}
|
|
51
|
+
|
|
40
52
|
/** Producer-correlated model retry chain Definition. */
|
|
41
53
|
export const retryDefinition: ConversationNodeDefinition<RetryState> = {
|
|
42
54
|
kind: 'model-retry',
|
|
@@ -83,7 +95,13 @@ export const retryDefinition: ConversationNodeDefinition<RetryState> = {
|
|
|
83
95
|
: attempt)
|
|
84
96
|
const current = attempts.at(-1)
|
|
85
97
|
if (current === undefined) return null
|
|
86
|
-
const
|
|
98
|
+
const currentLocation = context.matches.findLast(match => match.event.seq === current.seq)?.location ?? location
|
|
99
|
+
const data: RetryChatData = {
|
|
100
|
+
attempts,
|
|
101
|
+
current,
|
|
102
|
+
inFlight: current.retryState === 'started' && !isClosed(currentLocation),
|
|
103
|
+
failed: finallyFailed(currentLocation, current),
|
|
104
|
+
}
|
|
87
105
|
return chatNode(context, 'model-retry', attempts[0]?.seq ?? current.seq, data, { groupTree: 'process' })
|
|
88
106
|
},
|
|
89
107
|
}
|
|
@@ -4,7 +4,7 @@ import type {
|
|
|
4
4
|
ToolCallBlock, ToolResultNode,
|
|
5
5
|
} from '@deepseek-ai/dsh-client-ui-conversation/client'
|
|
6
6
|
import { isAppendSurfaceEvent } from '@deepseek-ai/dsh-session/surface'
|
|
7
|
-
import type {} from '@deepseek-ai/dsh-tool-
|
|
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'
|
|
10
10
|
import { CHAT_SYNTHETIC_SEQ_OFFSETS, chatNode, contextLocation } from './common.ts'
|
|
@@ -18,11 +18,31 @@ declare module '../contract/chat-nodes.ts' {
|
|
|
18
18
|
|
|
19
19
|
const MAX_DEPTH = 256
|
|
20
20
|
|
|
21
|
+
/**
|
|
22
|
+
* Fold State of one root Tool call. Dispatch updates mutate it in place and return the same object, as the
|
|
23
|
+
* [Assembler update rule](../../../../../../.agents/notes/implemented/architecture/2026-08-09-client-conversation-node-assembly.md)
|
|
24
|
+
* permits.
|
|
25
|
+
*/
|
|
21
26
|
interface ToolState {
|
|
22
27
|
/** Absent until a named delta or `tool/call` identifies the call. */
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
28
|
+
root: ToolCallBlock | undefined
|
|
29
|
+
/** Dispatch edges accumulated by incremental updates. */
|
|
30
|
+
calls: DispatchTree
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Nested dispatch edges, keyed by parent then child call id and mutated in place
|
|
35
|
+
* ([rationale](../../../../../../.agents/notes/implemented/bug-fix/2026-11-27-ptc-dispatch-fold-quadratic.md)).
|
|
36
|
+
* Published Tool call blocks carry their own arrays and never alias this tree.
|
|
37
|
+
*/
|
|
38
|
+
interface DispatchTree {
|
|
39
|
+
/** Children of each parent, in dispatch order. */
|
|
40
|
+
children: Map<string, Map<string, ToolCallBlock>>
|
|
41
|
+
parents: Map<string, string>
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function emptyDispatchTree(): DispatchTree {
|
|
45
|
+
return { children: new Map(), parents: new Map() }
|
|
26
46
|
}
|
|
27
47
|
|
|
28
48
|
interface ProjectedBlockCache {
|
|
@@ -171,7 +191,7 @@ function locationStep(match: ConversationMatch): number {
|
|
|
171
191
|
}
|
|
172
192
|
|
|
173
193
|
function acceptsEdge(state: ToolState, parent: string, child: string): boolean {
|
|
174
|
-
if (parent === child || state.parents.has(child)) return false
|
|
194
|
+
if (parent === child || state.calls.parents.has(child)) return false
|
|
175
195
|
let cursor: string | undefined = parent
|
|
176
196
|
let parentDepth = 0
|
|
177
197
|
const ancestors = new Set<string>()
|
|
@@ -179,7 +199,7 @@ function acceptsEdge(state: ToolState, parent: string, child: string): boolean {
|
|
|
179
199
|
if (cursor === child || ancestors.has(cursor)) return false
|
|
180
200
|
ancestors.add(cursor)
|
|
181
201
|
parentDepth++
|
|
182
|
-
cursor = state.parents.get(cursor)
|
|
202
|
+
cursor = state.calls.parents.get(cursor)
|
|
183
203
|
}
|
|
184
204
|
const pending = [{ callId: child, depth: 1 }]
|
|
185
205
|
const descendants = new Set<string>()
|
|
@@ -188,7 +208,7 @@ function acceptsEdge(state: ToolState, parent: string, child: string): boolean {
|
|
|
188
208
|
if (descendants.has(candidate.callId)) return false
|
|
189
209
|
descendants.add(candidate.callId)
|
|
190
210
|
subtreeDepth = Math.max(subtreeDepth, candidate.depth)
|
|
191
|
-
for (const nested of state.children.get(candidate.callId) ?? []) {
|
|
211
|
+
for (const nested of state.calls.children.get(candidate.callId)?.values() ?? []) {
|
|
192
212
|
pending.push({ callId: nested.callId, depth: candidate.depth + 1 })
|
|
193
213
|
}
|
|
194
214
|
}
|
|
@@ -201,26 +221,26 @@ function updateDispatch(state: ToolState, match: ConversationMatch): ToolState {
|
|
|
201
221
|
const data = event.data
|
|
202
222
|
const parentCallId = String(data.parentCallId)
|
|
203
223
|
const subCallId = String(data.subCallId)
|
|
204
|
-
const
|
|
205
|
-
const index = siblings.findIndex(candidate => candidate.callId === subCallId)
|
|
224
|
+
const previous = state.calls.children.get(parentCallId)?.get(subCallId)
|
|
206
225
|
if (event.type === 'tool/ptc-dispatch-start') {
|
|
207
|
-
if (
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
226
|
+
if (previous !== undefined || !acceptsEdge(state, parentCallId, subCallId)) return state
|
|
227
|
+
attachChild(state.calls, parentCallId, childCall(match, data))
|
|
228
|
+
return state
|
|
229
|
+
}
|
|
230
|
+
if (previous === undefined && !acceptsEdge(state, parentCallId, subCallId)) return state
|
|
231
|
+
attachChild(state.calls, parentCallId, childResult(match, data, previous))
|
|
232
|
+
return state
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
/** Record one child under its parent, keeping first-attachment order on replacement. */
|
|
236
|
+
function attachChild(calls: DispatchTree, parentCallId: string, child: ToolCallBlock): void {
|
|
237
|
+
let siblings = calls.children.get(parentCallId)
|
|
238
|
+
if (siblings === undefined) {
|
|
239
|
+
siblings = new Map()
|
|
240
|
+
calls.children.set(parentCallId, siblings)
|
|
213
241
|
}
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
const settled = childResult(match, data, previous)
|
|
217
|
-
const children = new Map(state.children)
|
|
218
|
-
children.set(parentCallId, index < 0
|
|
219
|
-
? [...siblings, settled]
|
|
220
|
-
: siblings.map((child, at) => at === index ? settled : child))
|
|
221
|
-
const parents = new Map(state.parents)
|
|
222
|
-
if (index < 0) parents.set(subCallId, parentCallId)
|
|
223
|
-
return { ...state, children, parents }
|
|
242
|
+
siblings.set(child.callId, child)
|
|
243
|
+
calls.parents.set(child.callId, parentCallId)
|
|
224
244
|
}
|
|
225
245
|
|
|
226
246
|
function projectBlock(
|
|
@@ -234,7 +254,8 @@ function projectBlock(
|
|
|
234
254
|
if (visited.has(block.callId) || depth > MAX_DEPTH) return { ...block, subCalls: [] }
|
|
235
255
|
const nextVisited = new Set(visited)
|
|
236
256
|
nextVisited.add(block.callId)
|
|
237
|
-
const
|
|
257
|
+
const attached = state.calls.children.get(block.callId)
|
|
258
|
+
const children = (attached === undefined ? block.subCalls : [...attached.values()])
|
|
238
259
|
.map(child => projectBlock(child, state, interruptedAt, nextVisited, depth + 1))
|
|
239
260
|
const interruptionSeq = 'kind' in block ? undefined : interruptedAt?.seq
|
|
240
261
|
const interruptionTime = 'kind' in block ? undefined : interruptedAt?.time
|
|
@@ -283,7 +304,7 @@ function fallbackState(context: ConversationNodeContext<ToolState>): ToolState |
|
|
|
283
304
|
const match = context.matches.find(candidate => candidate.event.type === 'tool/result')
|
|
284
305
|
const root = match === undefined ? undefined : rootResult(match)
|
|
285
306
|
if (root === undefined) return undefined
|
|
286
|
-
let state: ToolState = { root,
|
|
307
|
+
let state: ToolState = { root, calls: emptyDispatchTree() }
|
|
287
308
|
for (const candidate of context.matches) state = updateDispatch(state, candidate)
|
|
288
309
|
return state
|
|
289
310
|
}
|
|
@@ -314,7 +335,7 @@ export const toolDefinition: ConversationNodeDefinition<ToolState> = {
|
|
|
314
335
|
return null
|
|
315
336
|
},
|
|
316
337
|
start: (_context, match) => {
|
|
317
|
-
const state: ToolState = { root: undefined,
|
|
338
|
+
const state: ToolState = { root: undefined, calls: emptyDispatchTree() }
|
|
318
339
|
return match.event.type === 'tool/call' ? { ...state, root: rootCall(match) } : applyDelta(state, match)
|
|
319
340
|
},
|
|
320
341
|
update: (context, match) => {
|
|
@@ -4,7 +4,7 @@ import type {
|
|
|
4
4
|
} from '@deepseek-ai/dsh-client-ui-conversation/client'
|
|
5
5
|
import type {} from '@deepseek-ai/dsh-llm-retry/types'
|
|
6
6
|
import type { StreamChunk } from '@deepseek-ai/dsh-llm'
|
|
7
|
-
import type {} from '@deepseek-ai/dsh-tool-
|
|
7
|
+
import type {} from '@deepseek-ai/dsh-tool-registry-ptc/client'
|
|
8
8
|
import { hasAssistantReplyContent } from '../contract/assistant-content.ts'
|
|
9
9
|
import type { AssistantChatData, ChatNode, FinalAssistantChatData } from '../contract/chat-nodes.ts'
|
|
10
10
|
import {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/** Chat's language layers for Markdown fences: display math and unified-diff rows. */
|
|
2
2
|
import { useMemo } from 'react'
|
|
3
3
|
import type { ReactNode } from 'react'
|
|
4
|
-
import { FenceCodeBlock, FenceMathBlock } from '@deepseek-ai/dsh-client-ui-primitives'
|
|
5
|
-
import type { HocShare, PropsLocale, PropsRuntime, SlotMap } from '@deepseek-ai/dsh-client-ui-slots'
|
|
4
|
+
import { FenceCodeBlock, FenceMathBlock } from '@deepseek-ai/dsh-client-ui-primitives/client'
|
|
5
|
+
import type { HocShare, PropsLocale, PropsRuntime, SlotMap } from '@deepseek-ai/dsh-client-ui-slots/client'
|
|
6
6
|
import { markdownLabels } from '../markdown-labels.ts'
|
|
7
7
|
|
|
8
8
|
/** Props of the math layer: the fence and the next inner content. */
|