@deepseek-ai/dsh-client-ui-chat 0.2.2-rc.5 → 0.2.3-alpha.2
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 +13 -10
- package/README.md +19 -5
- package/README.zh.md +19 -5
- package/lib/client.js +7 -6
- package/lib/client.js.map +1 -1
- package/lib/types/client/apply.d.ts.map +1 -1
- package/lib/types/client/apply.js.map +1 -1
- package/lib/types/client/chat/AssistantMarkdown.js.map +1 -1
- package/lib/types/client/chat/ChatAside.d.ts +10 -0
- package/lib/types/client/chat/ChatAside.d.ts.map +1 -0
- package/lib/types/client/chat/ChatAside.js.map +1 -0
- 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 +3 -2
- package/lib/types/client/chat/CommandNodeView.d.ts.map +1 -1
- package/lib/types/client/chat/CommandNodeView.js.map +1 -1
- package/lib/types/client/chat/CommandStatusRow.d.ts +16 -0
- package/lib/types/client/chat/CommandStatusRow.d.ts.map +1 -0
- package/lib/types/client/chat/CommandStatusRow.js.map +1 -0
- package/lib/types/client/chat/CompactionCommandCard.d.ts +3 -1
- package/lib/types/client/chat/CompactionCommandCard.d.ts.map +1 -1
- package/lib/types/client/chat/CompactionCommandCard.js.map +1 -1
- package/lib/types/client/chat/CompactionItem.d.ts +12 -3
- package/lib/types/client/chat/CompactionItem.d.ts.map +1 -1
- package/lib/types/client/chat/CompactionItem.js.map +1 -1
- package/lib/types/client/chat/GenericCommandCard.d.ts.map +1 -1
- package/lib/types/client/chat/GenericCommandCard.js.map +1 -1
- package/lib/types/client/chat/MessageItem.d.ts +5 -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/compaction-preview.d.ts +10 -0
- package/lib/types/client/chat/compaction-preview.d.ts.map +1 -0
- package/lib/types/client/chat/compaction-preview.js.map +1 -0
- 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/contract/slots.d.ts +19 -2
- package/lib/types/client/contract/slots.d.ts.map +1 -1
- package/lib/types/client/conversation-nodes/chat-snapshot-builder.d.ts.map +1 -1
- package/lib/types/client/conversation-nodes/chat-snapshot-builder.js.map +1 -1
- package/lib/types/client/conversation-nodes/command.d.ts.map +1 -1
- package/lib/types/client/conversation-nodes/command.js.map +1 -1
- package/lib/types/client/conversation-nodes/compaction.d.ts +14 -2
- package/lib/types/client/conversation-nodes/compaction.d.ts.map +1 -1
- package/lib/types/client/conversation-nodes/compaction.js.map +1 -1
- package/lib/types/client/conversation-nodes/inherited-history.d.ts +20 -0
- package/lib/types/client/conversation-nodes/inherited-history.d.ts.map +1 -0
- package/lib/types/client/conversation-nodes/inherited-history.js.map +1 -0
- package/lib/types/client/conversation-nodes/process-activity.js.map +1 -1
- package/lib/types/client/conversation-nodes/register.d.ts.map +1 -1
- package/lib/types/client/conversation-nodes/register.js.map +1 -1
- package/lib/types/client/file-path.d.ts.map +1 -1
- package/lib/types/client/file-path.js.map +1 -1
- package/lib/types/client/index.d.ts +1 -0
- package/lib/types/client/index.d.ts.map +1 -1
- package/lib/types/client/index.js.map +1 -1
- package/lib/types/client/locale.d.ts +40 -16
- package/lib/types/client/locale.d.ts.map +1 -1
- package/lib/types/client/locale.js.map +1 -1
- package/package.json +44 -43
- package/src/client/apply.ts +39 -22
- package/src/client/chat/AssistantMarkdown.module.css +7 -4
- package/src/client/chat/AssistantMarkdown.tsx +1 -1
- package/src/client/chat/ChatAside.tsx +15 -0
- package/src/client/chat/ChatGroupSeat.module.css +3 -3
- package/src/client/chat/ChatView.module.css +34 -0
- package/src/client/chat/ChatView.tsx +9 -4
- package/src/client/chat/CommandNodeView.tsx +6 -3
- package/src/client/chat/CommandStatusRow.tsx +60 -0
- package/src/client/chat/CompactionCommandCard.tsx +4 -2
- package/src/client/chat/CompactionItem.tsx +67 -37
- package/src/client/chat/GenericCommandCard.tsx +4 -51
- package/src/client/chat/MessageIconActions.module.css +4 -4
- package/src/client/chat/MessageItem.module.css +53 -55
- package/src/client/chat/MessageItem.tsx +31 -5
- package/src/client/chat/TurnNavigator.module.css +8 -7
- package/src/client/chat/compaction-preview.ts +76 -0
- package/src/client/chat/register-node-renderers.ts +7 -3
- package/src/client/contract/slots.ts +16 -2
- package/src/client/conversation-nodes/README.i18n.yaml +4 -4
- package/src/client/conversation-nodes/README.md +2 -2
- package/src/client/conversation-nodes/README.zh.md +2 -2
- package/src/client/conversation-nodes/chat-snapshot-builder.ts +3 -1
- package/src/client/conversation-nodes/command.ts +0 -8
- package/src/client/conversation-nodes/compaction.ts +29 -5
- package/src/client/conversation-nodes/inherited-history.ts +41 -0
- package/src/client/conversation-nodes/process-activity.ts +1 -1
- package/src/client/conversation-nodes/register.ts +2 -0
- package/src/client/file-path.ts +2 -6
- package/src/client/index.ts +1 -0
- package/src/client/locale.ts +40 -16
- /package/src/client/chat/{GenericCommandCard.module.css → CommandStatusRow.module.css} +0 -0
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { memo, useEffect, useMemo, useState } from 'react'
|
|
2
2
|
import type { ReactNode } from 'react'
|
|
3
3
|
import type { PendingSubmission } from '@deepseek-ai/dsh-api-session-controller/client'
|
|
4
|
-
import type { PropsRenderFactories, PropsRenderSlots } from '@deepseek-ai/dsh-client-ui-slots'
|
|
4
|
+
import type { InjectFace, PropsRenderFactories, PropsRenderSlots } from '@deepseek-ai/dsh-client-ui-slots'
|
|
5
5
|
import type { UserTextFacts } from '@deepseek-ai/dsh-client-ui-conversation/client'
|
|
6
|
-
import { JsonBlock, StateDot, TextShimmer } from '@deepseek-ai/dsh-client-ui-primitives'
|
|
6
|
+
import { IconBranchOutlineRegular, JsonBlock, StateDot, TextShimmer } from '@deepseek-ai/dsh-client-ui-primitives'
|
|
7
7
|
import type {
|
|
8
8
|
ChatNodeOwnerProps, ChatNodeViewProps, ChatViewSlotProps, UserContentAttachment, UserContentData, UserContentInput,
|
|
9
9
|
} from '../contract/slots.ts'
|
|
10
10
|
import type { ModelRetryNode, TurnErrorNode, UserMessageNode } from '../contract/snapshot.ts'
|
|
11
|
-
import {
|
|
11
|
+
import { CommandStatusRow } from './CommandStatusRow.tsx'
|
|
12
|
+
import { CompactionItem, type CompactionRowInjected } from './CompactionItem.tsx'
|
|
12
13
|
import { ContextInjectionRow } from './ContextInjectionRow.tsx'
|
|
13
14
|
import { MessageIconActions } from './MessageIconActions.tsx'
|
|
14
15
|
import css from './MessageItem.module.css'
|
|
@@ -375,8 +376,33 @@ export const ContextMessageNodeView = memo(function ContextMessageNodeView({ nod
|
|
|
375
376
|
})
|
|
376
377
|
|
|
377
378
|
/** Automatic compaction keyed Chat renderer. */
|
|
378
|
-
export const CompactionNodeView = memo(function CompactionNodeView({
|
|
379
|
-
|
|
379
|
+
export const CompactionNodeView = memo(function CompactionNodeView({
|
|
380
|
+
node, openCompaction, useCompactionPreview, t,
|
|
381
|
+
}: ChatNodeViewProps<'compaction'> & InjectFace<CompactionRowInjected>) {
|
|
382
|
+
const available = useCompactionPreview(value => value)
|
|
383
|
+
const data = node.data
|
|
384
|
+
if (data.kind === 'compaction-progress') {
|
|
385
|
+
const title = t('message.compaction.commandTitle')
|
|
386
|
+
if (data.status === 'running') return <CommandStatusRow title={title} state="running" summary={t('message.compaction.running')} body={null} t={t} />
|
|
387
|
+
const error = data.status === 'interrupted' ? t('message.taskStopped') : data.error
|
|
388
|
+
return <CommandStatusRow title={title} state={error === undefined ? 'ok' : 'error'} summary={error ?? t('command.done')}
|
|
389
|
+
body={error?.includes('\n') ? error : null} t={t} />
|
|
390
|
+
}
|
|
391
|
+
return <CompactionItem node={data} openCompaction={available ? openCompaction : undefined} t={t} />
|
|
392
|
+
})
|
|
393
|
+
|
|
394
|
+
/** Divider between a forked Session's inherited history and its own messages. */
|
|
395
|
+
export const InheritedHistoryNodeView = memo(function InheritedHistoryNodeView({ t }: ChatNodeViewProps<'inherited-history'>) {
|
|
396
|
+
return (
|
|
397
|
+
<div className={css.inheritedHistoryRow} role="separator" aria-label={t('message.inheritedHistory')}>
|
|
398
|
+
<span className={css.inheritedHistoryLine} aria-hidden />
|
|
399
|
+
<span className={css.inheritedHistoryCaption} aria-hidden>
|
|
400
|
+
<IconBranchOutlineRegular className={css.inheritedHistoryIcon} />
|
|
401
|
+
<span className={css.inheritedHistoryLabel}>{t('message.inheritedHistory')}</span>
|
|
402
|
+
</span>
|
|
403
|
+
<span className={css.inheritedHistoryLine} aria-hidden />
|
|
404
|
+
</div>
|
|
405
|
+
)
|
|
380
406
|
})
|
|
381
407
|
|
|
382
408
|
/** Correlated retry-chain keyed Chat renderer. */
|
|
@@ -30,7 +30,8 @@
|
|
|
30
30
|
|
|
31
31
|
position: absolute;
|
|
32
32
|
top: calc(var(--turn-rail-band) / 2);
|
|
33
|
-
|
|
33
|
+
/* The start edge: the end gutter belongs to the Session panel. */
|
|
34
|
+
left: 12px;
|
|
34
35
|
width: 28px;
|
|
35
36
|
/* Fixed-pitch marks never compress: a ladder taller than the band scrolls
|
|
36
37
|
inside this frame instead of pushing marks under the composer or above
|
|
@@ -97,14 +98,14 @@
|
|
|
97
98
|
.mark::before {
|
|
98
99
|
position: absolute;
|
|
99
100
|
top: 50%;
|
|
100
|
-
|
|
101
|
+
left: 0;
|
|
101
102
|
width: 20px;
|
|
102
103
|
height: 2px;
|
|
103
104
|
border-radius: 2px;
|
|
104
105
|
background: var(--dsw-alias-border-l4);
|
|
105
106
|
content: '';
|
|
106
107
|
transform: translateY(-50%) scaleX(0.6);
|
|
107
|
-
transform-origin:
|
|
108
|
+
transform-origin: left center;
|
|
108
109
|
transition: transform 140ms ease, background-color 140ms ease;
|
|
109
110
|
}
|
|
110
111
|
|
|
@@ -142,11 +143,11 @@
|
|
|
142
143
|
|
|
143
144
|
.mark:focus-visible::after {
|
|
144
145
|
position: absolute;
|
|
145
|
-
inset: 0 0 0
|
|
146
|
+
inset: 0 auto 0 0;
|
|
146
147
|
width: 20px;
|
|
147
148
|
border-radius: inherit;
|
|
148
149
|
outline: 1px solid var(--dsw-focus-ring-color, var(--dsw-alias-state-business-primary));
|
|
149
|
-
/* The scroller clips the
|
|
150
|
+
/* The scroller clips the left edge; keep the marker's ring inside it. */
|
|
150
151
|
outline-offset: -1px;
|
|
151
152
|
content: '';
|
|
152
153
|
}
|
|
@@ -158,7 +159,7 @@
|
|
|
158
159
|
calc(var(--turn-preview-center) - var(--turn-preview-height) / 2),
|
|
159
160
|
calc(100% - var(--turn-preview-height))
|
|
160
161
|
);
|
|
161
|
-
|
|
162
|
+
left: calc(100% + 10px);
|
|
162
163
|
box-sizing: border-box;
|
|
163
164
|
width: min(300px, calc(100cqw - 120px));
|
|
164
165
|
max-height: var(--turn-preview-height);
|
|
@@ -194,7 +195,7 @@
|
|
|
194
195
|
}
|
|
195
196
|
|
|
196
197
|
@keyframes dsh-turn-preview-enter {
|
|
197
|
-
from { opacity: 0; transform: translateX(4px); }
|
|
198
|
+
from { opacity: 0; transform: translateX(-4px); }
|
|
198
199
|
to { opacity: 1; transform: translateX(0); }
|
|
199
200
|
}
|
|
200
201
|
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/** Session-bound Markdown previews for manual and automatic compaction rows. */
|
|
2
|
+
import type { Context } from '@deepseek-ai/cordis'
|
|
3
|
+
import type { SessionAddress } from '@deepseek-ai/dsh-api-session-controller/types'
|
|
4
|
+
import type {} from '@deepseek-ai/dsh-client-ui-sidebar-documentpreview/client'
|
|
5
|
+
import { createSnapshotStore } from '@deepseek-ai/dsh-client-store'
|
|
6
|
+
import type { SessionId } from '@deepseek-ai/dsh-session/types'
|
|
7
|
+
import { NS } from '../locale.ts'
|
|
8
|
+
import type { CompactionRowInjected } from './CompactionItem.tsx'
|
|
9
|
+
|
|
10
|
+
/** Bind summary reads to the requesting row and the document viewer lifetime.
|
|
11
|
+
* @param ctx - Chat plugin context.
|
|
12
|
+
* @returns the preview action and availability hook for a Session.
|
|
13
|
+
*/
|
|
14
|
+
export function compactionRows(ctx: Context): (sessionId: SessionId) => CompactionRowInjected {
|
|
15
|
+
const compactionPreview = createSnapshotStore(false)
|
|
16
|
+
const t = ctx.locale.bind(NS)
|
|
17
|
+
let lifetime: AbortController | undefined
|
|
18
|
+
ctx.inject(['documentPreviews'], scope => scope.effect(() => {
|
|
19
|
+
const controller = new AbortController()
|
|
20
|
+
lifetime = controller
|
|
21
|
+
compactionPreview.set(true)
|
|
22
|
+
return () => {
|
|
23
|
+
controller.abort()
|
|
24
|
+
lifetime = undefined
|
|
25
|
+
compactionPreview.set(false)
|
|
26
|
+
}
|
|
27
|
+
}))
|
|
28
|
+
return sessionId => ({
|
|
29
|
+
hooks: { compactionPreview },
|
|
30
|
+
async openCompaction(summarySeq, signal) {
|
|
31
|
+
if (lifetime === undefined) return null
|
|
32
|
+
const child = ctx.sessions.subagentAddress(sessionId)
|
|
33
|
+
const address: SessionAddress = child === undefined ? { kind: 'session', sessionId } : { kind: 'subagent', ...child }
|
|
34
|
+
const active = AbortSignal.any([signal, lifetime.signal])
|
|
35
|
+
const cancelled = (): boolean => active.aborted
|
|
36
|
+
if (cancelled()) return null
|
|
37
|
+
let result
|
|
38
|
+
try {
|
|
39
|
+
result = await ctx.remote.session.events({ address, throughSeq: summarySeq, maxMessages: 1 }, active)
|
|
40
|
+
} catch (_error) {
|
|
41
|
+
// A cancelled row has no read failure to display.
|
|
42
|
+
return cancelled() ? null : t('message.compaction.readFailed')
|
|
43
|
+
}
|
|
44
|
+
if (cancelled()) return null
|
|
45
|
+
if (!result.ok) return t('message.compaction.readFailed')
|
|
46
|
+
const event = result.value.records.find(entry => entry.event.seq === summarySeq)?.event
|
|
47
|
+
const text = event && summaryText(event)
|
|
48
|
+
if (text === undefined) return t('message.compaction.notFound')
|
|
49
|
+
const identity = address.kind === 'session' ? [address.sessionId] : [address.parentSessionId, address.childSessionId, address.mode]
|
|
50
|
+
ctx.sidebarRight.openContent('compaction-summary', { summaryMarkdown: text }, {
|
|
51
|
+
key: JSON.stringify([...identity, summarySeq]),
|
|
52
|
+
})
|
|
53
|
+
return null
|
|
54
|
+
},
|
|
55
|
+
})
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/** Extract text only from a valid summary event returned by the history API.
|
|
59
|
+
* @param event - Wire event with untrusted JSON data.
|
|
60
|
+
* @returns Markdown, or undefined for unrelated, empty or malformed content.
|
|
61
|
+
*/
|
|
62
|
+
function summaryText(event: { readonly type: string; readonly data: unknown }): string | undefined {
|
|
63
|
+
if (event.type !== 'compaction/summary') return undefined
|
|
64
|
+
const data = event.data
|
|
65
|
+
if (typeof data !== 'object' || data === null || !('summary' in data) || !Array.isArray(data.summary)) return undefined
|
|
66
|
+
const text: string[] = []
|
|
67
|
+
const blocks: readonly unknown[] = data.summary
|
|
68
|
+
for (const block of blocks) {
|
|
69
|
+
if (typeof block !== 'object' || block === null || !('type' in block)) return undefined
|
|
70
|
+
if (block.type !== 'text') continue
|
|
71
|
+
if (!('text' in block) || typeof block.text !== 'string') return undefined
|
|
72
|
+
text.push(block.text)
|
|
73
|
+
}
|
|
74
|
+
const markdown = text.join('')
|
|
75
|
+
return markdown.trim() === '' ? undefined : markdown
|
|
76
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Context } from '@deepseek-ai/cordis'
|
|
2
|
+
import { compactionRows } from './compaction-preview.ts'
|
|
2
3
|
import type { ObservableSnapshot } from '@deepseek-ai/dsh-client-store'
|
|
3
4
|
import type { PerformanceUsageMode } from '../../chat-settings.ts'
|
|
4
5
|
import type { ChatPresentationPolicy } from '../presentation-policy.ts'
|
|
@@ -7,7 +8,7 @@ import { AssistantNodeView, type AssistantNodeInjected } from './AssistantNodeVi
|
|
|
7
8
|
import { sessionFilePath } from '../file-path.ts'
|
|
8
9
|
import { CommandNodeView, ManualCompactionNodeView } from './CommandNodeView.tsx'
|
|
9
10
|
import {
|
|
10
|
-
CompactionNodeView, ContextMessageNodeView, RetryNodeView, TurnErrorNodeView,
|
|
11
|
+
CompactionNodeView, ContextMessageNodeView, InheritedHistoryNodeView, RetryNodeView, TurnErrorNodeView,
|
|
11
12
|
TurnMaxTokensNodeView, UnknownNodeView, UserMessageNodeView,
|
|
12
13
|
} from './MessageItem.tsx'
|
|
13
14
|
import { DefaultReasoningBody, ReasoningContent } from './ReasoningContent.tsx'
|
|
@@ -29,6 +30,7 @@ export function registerChatNodeRenderers(
|
|
|
29
30
|
performanceUsage: ObservableSnapshot<PerformanceUsageMode>,
|
|
30
31
|
presentation: ObservableSnapshot<ChatPresentationPolicy>,
|
|
31
32
|
): void {
|
|
33
|
+
const injectCompaction = compactionRows(ctx)
|
|
32
34
|
ctx.effect(() => ctx.slots.registerFactory({
|
|
33
35
|
name: 'conversation.chat.reasoning.content',
|
|
34
36
|
scope: 'root',
|
|
@@ -74,9 +76,11 @@ export function registerChatNodeRenderers(
|
|
|
74
76
|
children: { 'conversation.chat.commandview': { kind: 'keyed', scope: 'session' } },
|
|
75
77
|
}, CommandNodeView))
|
|
76
78
|
ctx.slots.inject('conversation.chat.node', () => ctx.slots.register(
|
|
77
|
-
{ name: 'conversation.chat.node', key: 'manual-compaction', locale: NS }, ManualCompactionNodeView))
|
|
79
|
+
{ name: 'conversation.chat.node', key: 'manual-compaction', locale: NS, inject: injectCompaction }, ManualCompactionNodeView))
|
|
78
80
|
ctx.slots.inject('conversation.chat.node', () => ctx.slots.register(
|
|
79
|
-
{ name: 'conversation.chat.node', key: 'compaction', locale: NS }, CompactionNodeView))
|
|
81
|
+
{ name: 'conversation.chat.node', key: 'compaction', locale: NS, inject: injectCompaction }, CompactionNodeView))
|
|
82
|
+
ctx.slots.inject('conversation.chat.node', () => ctx.slots.register(
|
|
83
|
+
{ name: 'conversation.chat.node', key: 'inherited-history', locale: NS }, InheritedHistoryNodeView))
|
|
80
84
|
ctx.slots.inject('conversation.chat.node', () => ctx.slots.register(
|
|
81
85
|
{ name: 'conversation.chat.node', key: 'model-retry', locale: NS }, RetryNodeView))
|
|
82
86
|
ctx.slots.inject('conversation.chat.node', () => ctx.slots.register(
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** Chat-owned Slot declarations and composed component props. */
|
|
2
2
|
import type { RefObject } from 'react'
|
|
3
|
-
import type { MessageId } from '@deepseek-ai/dsh-llm/
|
|
3
|
+
import type { MessageId } from '@deepseek-ai/dsh-llm/types'
|
|
4
4
|
import type { SessionId, SessionSeq } from '@deepseek-ai/dsh-session/types'
|
|
5
5
|
import type { PendingSubmission } from '@deepseek-ai/dsh-api-session-controller/client'
|
|
6
6
|
import type { FileAttachmentRef } from '@deepseek-ai/dsh-attachment'
|
|
@@ -390,7 +390,7 @@ export type ChatFlowSlotProps =
|
|
|
390
390
|
/** Full Chat view props. */
|
|
391
391
|
export type ChatViewSlotProps =
|
|
392
392
|
PropsRuntime<'conversation.view'>
|
|
393
|
-
& PropsRenderSlots<'conversation.chat.flow' | 'conversation.chat.text-interaction' | 'conversation.chat.markdown.fence'>
|
|
393
|
+
& PropsRenderSlots<'conversation.chat.flow' | 'conversation.chat.text-interaction' | 'conversation.chat.markdown.fence' | 'conversation.chat.aside'>
|
|
394
394
|
& PropsStore<ChatStore>
|
|
395
395
|
& InjectFace<ChatViewInjected>
|
|
396
396
|
& PropsLocale<'chat'>
|
|
@@ -431,6 +431,20 @@ declare module '@deepseek-ai/dsh-client-ui-slots' {
|
|
|
431
431
|
'conversation.chat.text-interaction': { kind: 'keyed'; scope: 'session'; owner: TextInteractionSurface }
|
|
432
432
|
/** Language-keyed layers around one Markdown fence in the Chat flow; the content is the plain code block. */
|
|
433
433
|
'conversation.chat.markdown.fence': { kind: 'hoc'; scope: 'session'; owner: MarkdownDelegateFenceInfo }
|
|
434
|
+
/**
|
|
435
|
+
* One Session-level occupant beside the transcript, such as a summary
|
|
436
|
+
* panel. Every Chat View occurrence renders it in a zero-height layer at
|
|
437
|
+
* the top of the Chat frame, which stays in place while the transcript
|
|
438
|
+
* scrolls and inherits the shared scrollport's composer and viewport
|
|
439
|
+
* heights. The layer passes pointer events through; the occupant
|
|
440
|
+
* positions itself in it, enables its own pointer events, and keeps
|
|
441
|
+
* within the end gutter to stay clear of the transcript column. The
|
|
442
|
+
* layer publishes that gutter, the inline space between the transcript
|
|
443
|
+
* column and the frame's end edge, as the `--dsh-chat-aside-gutter`
|
|
444
|
+
* custom property; its percentage resolves in the inline sizes of an
|
|
445
|
+
* element whose containing block is the layer.
|
|
446
|
+
*/
|
|
447
|
+
'conversation.chat.aside': { kind: 'single'; scope: 'session' }
|
|
434
448
|
|
|
435
449
|
/** Ordered Chat rows and local echoes with viewport-bound visibility hooks. */
|
|
436
450
|
'conversation.chat.flow': {
|
|
@@ -54,11 +54,11 @@
|
|
|
54
54
|
en: 131811a8a12c9d81
|
|
55
55
|
zh: f8a8c1e02a5787f8
|
|
56
56
|
/chat-conversation-node-rules/activity-summaries/tool-name-classification:
|
|
57
|
-
en:
|
|
58
|
-
zh:
|
|
57
|
+
en: 28760f1caab0763b
|
|
58
|
+
zh: 2d0eb175509096e7
|
|
59
59
|
/chat-conversation-node-rules/activity-summaries/subagents-background-jobs-and-nested-calls:
|
|
60
|
-
en:
|
|
61
|
-
zh:
|
|
60
|
+
en: da0c896564c0d78e
|
|
61
|
+
zh: 6ff7b8a3b2f2de8c
|
|
62
62
|
/chat-conversation-node-rules/activity-summaries/live-activity-and-detail:
|
|
63
63
|
en: e0ca09c305690be7
|
|
64
64
|
zh: fb35d0238b1a827b
|
|
@@ -269,7 +269,7 @@ Classification uses the recorded tool name exactly: no case folding, namespace s
|
|
|
269
269
|
| `write` | `write` |
|
|
270
270
|
| `edit` | `edit`, `apply_patch` |
|
|
271
271
|
| `commands` | `bash`, `pwsh`, `exec_command`, `write_stdin`, or prefix `terminal_` |
|
|
272
|
-
| `code` | `run_code` |
|
|
272
|
+
| `code` | `run_code`, `cua_run_code` |
|
|
273
273
|
| `webSearch` | `web_search` |
|
|
274
274
|
| `webFetch` | `web_fetch` |
|
|
275
275
|
| `subagents` | `subagent` or prefix `subagent_` |
|
|
@@ -290,7 +290,7 @@ A subagent tool follows ordinary group boundaries: it does not create a group me
|
|
|
290
290
|
| Background subagent startup has returned its tool result, while the child is still running | Keep its category count, but remove that call from running-activity candidates. The child does not keep the parent's group in the subagent activity state. |
|
|
291
291
|
| Tool calls recorded only in a child Session | Do not include them in the parent group's counts or live detail. Only calls actually attached to a member's `subCalls` participate recursively. |
|
|
292
292
|
|
|
293
|
-
A `run_code` root counts once as `code`; its recorded PTC subcalls each count in their own categories. The wrapper is not replaced by leaf-call counts, and children are not all classified as `code`. With distinct call ids, `run_code → [read, bash, subagent_codex]` produces `code=1, read=1, commands=1, subagents=1`, in that tie order. A subcall can supply the live category while the outer `run_code` remains running.
|
|
293
|
+
A `run_code` or `cua_run_code` root counts once as `code`; its recorded PTC subcalls each count in their own categories. The wrapper is not replaced by leaf-call counts, and children are not all classified as `code`. With distinct call ids, `run_code → [read, bash, subagent_codex]` produces `code=1, read=1, commands=1, subagents=1`, in that tie order. A subcall can supply the live category while the outer `run_code` remains running.
|
|
294
294
|
|
|
295
295
|
Exact-name rules also mean that a recorded name such as `functions.read`, `mcp.read`, or `Read` falls into `tools`, while `browser_inspect` falls into `search`. A `terminal_*` name follows the command rule even when its operation only inspects or closes a terminal, unless the earlier `_inspect` rule matches.
|
|
296
296
|
|
|
@@ -269,7 +269,7 @@ description: "Chat 过程分组与活动摘要的明细业务规则。"
|
|
|
269
269
|
| `write` | `write` |
|
|
270
270
|
| `edit` | `edit`、`apply_patch` |
|
|
271
271
|
| `commands` | `bash`、`pwsh`、`exec_command`、`write_stdin`,或以 `terminal_` 开头 |
|
|
272
|
-
| `code` | `run_code` |
|
|
272
|
+
| `code` | `run_code`、`cua_run_code` |
|
|
273
273
|
| `webSearch` | `web_search` |
|
|
274
274
|
| `webFetch` | `web_fetch` |
|
|
275
275
|
| `subagents` | `subagent`,或以 `subagent_` 开头 |
|
|
@@ -290,7 +290,7 @@ Subagent 工具遵循普通分组边界,不会仅因委派任务就单独成
|
|
|
290
290
|
| 后台 subagent 的启动调用已返回工具结果,但子代理仍在运行 | 保留类别次数,但该调用不再参与运行中活动选择;子代理的执行不会维持父组的 subagent 活动状态。 |
|
|
291
291
|
| 工具调用只记录在子 Session 中 | 不纳入父组计数或实时详情;只有实际附在本组成员 `subCalls` 中的调用才递归参与。 |
|
|
292
292
|
|
|
293
|
-
`run_code` 根调用自身计一次 `code`,已记录的每个 PTC 子调用另按自己的类别计数。不会用叶子调用替代包装调用,也不会把子调用统一归为 `code`。各调用 id 不同时,`run_code → [read, bash, subagent_codex]` 得到 `code=1, read=1, commands=1, subagents=1`,同次数时按此顺序排列。外层 `run_code` 仍在运行时,组的实时类别可以由子调用决定。
|
|
293
|
+
`run_code` 或 `cua_run_code` 根调用自身计一次 `code`,已记录的每个 PTC 子调用另按自己的类别计数。不会用叶子调用替代包装调用,也不会把子调用统一归为 `code`。各调用 id 不同时,`run_code → [read, bash, subagent_codex]` 得到 `code=1, read=1, commands=1, subagents=1`,同次数时按此顺序排列。外层 `run_code` 仍在运行时,组的实时类别可以由子调用决定。
|
|
294
294
|
|
|
295
295
|
精确名称规则也意味着:记录为 `functions.read`、`mcp.read` 或 `Read` 的名称归 `tools`,`browser_inspect` 归 `search`。`terminal_*` 即使只检查或关闭终端,也按命令规则分类,除非先命中 `_inspect` 规则。
|
|
296
296
|
|
|
@@ -860,11 +860,13 @@ function legacyContribution(raw: ChatConversationViewNode): LegacyContribution {
|
|
|
860
860
|
case 'steering':
|
|
861
861
|
case 'context':
|
|
862
862
|
case 'command':
|
|
863
|
-
case 'compaction':
|
|
864
863
|
case 'turn-error':
|
|
865
864
|
case 'turn-max-tokens':
|
|
866
865
|
case 'unknown':
|
|
867
866
|
return { anchorSeq: node.anchorSeq, nodes: [node.data], partial: null, running: null }
|
|
867
|
+
case 'compaction':
|
|
868
|
+
return node.data.kind === 'compaction-progress' ? EMPTY_CONTRIBUTION
|
|
869
|
+
: { anchorSeq: node.anchorSeq, nodes: [node.data], partial: null, running: null }
|
|
868
870
|
case 'assistant-step': {
|
|
869
871
|
const data = node.data
|
|
870
872
|
if (data.status === 'running') {
|
|
@@ -99,17 +99,10 @@ function compactSource(event: Parameters<ConversationNodeDefinition['match']>[0]
|
|
|
99
99
|
* @returns final compaction summary Node data.
|
|
100
100
|
*/
|
|
101
101
|
function compactSummary(match: ConversationMatch | undefined, checkpoint: ConversationMatch): CompactionSummaryNode {
|
|
102
|
-
let summary: string | null = null
|
|
103
102
|
let shadowedItemCount: number | null = null
|
|
104
103
|
let shadowedTokenCount: number | null = null
|
|
105
104
|
if (match?.event.type === 'compaction/summary') {
|
|
106
105
|
const data = match.event.data
|
|
107
|
-
if (Array.isArray(data.summary)) {
|
|
108
|
-
const text = data.summary
|
|
109
|
-
.map(block => block.type === 'text' ? block.text : '')
|
|
110
|
-
.join('')
|
|
111
|
-
summary = text.trim() === '' ? null : text
|
|
112
|
-
}
|
|
113
106
|
shadowedItemCount = Array.isArray(data.shadowedSeqs)
|
|
114
107
|
&& data.shadowedSeqs.every(seq => Number.isSafeInteger(seq) && seq >= 0)
|
|
115
108
|
? data.shadowedSeqs.length
|
|
@@ -123,7 +116,6 @@ function compactSummary(match: ConversationMatch | undefined, checkpoint: Conver
|
|
|
123
116
|
kind: 'compaction',
|
|
124
117
|
seq: checkpoint.event.seq,
|
|
125
118
|
time: checkpoint.event.time,
|
|
126
|
-
summary,
|
|
127
119
|
summaryEventSeq: match?.event.seq ?? null,
|
|
128
120
|
shadowedItemCount,
|
|
129
121
|
shadowedTokenCount,
|
|
@@ -3,25 +3,37 @@ import type {
|
|
|
3
3
|
CompactionSummaryNode, ConversationMatch, ConversationNodeContext, ConversationNodeDefinition,
|
|
4
4
|
} from '@deepseek-ai/dsh-client-ui-conversation/client'
|
|
5
5
|
import type {} from '@deepseek-ai/dsh-compaction/types'
|
|
6
|
-
import { chatNode } from './common.ts'
|
|
6
|
+
import { chatNode, contextLocation } from './common.ts'
|
|
7
7
|
import { compactSource, compactSummary, updateCompactionState } from './command.ts'
|
|
8
8
|
|
|
9
9
|
declare module '../contract/chat-nodes.ts' {
|
|
10
10
|
interface ChatNodeDataMap {
|
|
11
|
-
/** Automatic compaction checkpoint
|
|
12
|
-
compaction: CompactionSummaryNode
|
|
11
|
+
/** Automatic compaction progress or committed checkpoint. */
|
|
12
|
+
compaction: CompactionSummaryNode | CompactionProgress
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
+
/** Progress without a committed summary; terminal states never animate. */
|
|
17
|
+
export type CompactionProgress = {
|
|
18
|
+
readonly kind: 'compaction-progress'
|
|
19
|
+
} & (
|
|
20
|
+
| { readonly status: 'running' }
|
|
21
|
+
| { readonly status: 'interrupted' }
|
|
22
|
+
| { readonly status: 'ended'; readonly error?: string }
|
|
23
|
+
)
|
|
24
|
+
|
|
16
25
|
interface CompactionState {
|
|
26
|
+
readonly ended?: ConversationMatch
|
|
17
27
|
readonly summary?: ConversationMatch
|
|
18
28
|
readonly checkpoint?: ConversationMatch
|
|
19
29
|
}
|
|
20
30
|
|
|
21
31
|
function fallbackState(context: ConversationNodeContext<CompactionState>): CompactionState {
|
|
32
|
+
const ended = context.matches.find(match => match.event.type === 'compaction/end')
|
|
22
33
|
const summary = context.matches.find(match => match.event.type === 'compaction/summary')
|
|
23
34
|
const checkpoint = context.matches.find(match => compactSource(match.event) !== undefined)
|
|
24
35
|
return {
|
|
36
|
+
...ended === undefined ? {} : { ended },
|
|
25
37
|
...summary === undefined ? {} : { summary },
|
|
26
38
|
...checkpoint === undefined ? {} : { checkpoint },
|
|
27
39
|
}
|
|
@@ -47,10 +59,22 @@ export const compactionDefinition: ConversationNodeDefinition<CompactionState> =
|
|
|
47
59
|
return null
|
|
48
60
|
},
|
|
49
61
|
start: () => ({}),
|
|
50
|
-
update: (context, match) =>
|
|
62
|
+
update: (context, match) => match.event.type === 'compaction/end'
|
|
63
|
+
? { ...context.state, ended: match }
|
|
64
|
+
: updateCompactionState(context.state, match),
|
|
51
65
|
buildViewNode: (context) => {
|
|
52
66
|
const state = context.state ?? fallbackState(context)
|
|
53
|
-
if (state.checkpoint === undefined)
|
|
67
|
+
if (state.checkpoint === undefined) {
|
|
68
|
+
const anchor = context.start ?? state.ended
|
|
69
|
+
if (anchor === undefined) return null
|
|
70
|
+
const location = contextLocation(context)
|
|
71
|
+
const closed = (location.kind === 'turn' || location.kind === 'step') && location.turn.status === 'closed'
|
|
72
|
+
const ended = state.ended?.event
|
|
73
|
+
const progress: CompactionProgress = ended?.type === 'compaction/end'
|
|
74
|
+
? { kind: 'compaction-progress', status: 'ended', ...ended.data.error === undefined ? {} : { error: ended.data.error } }
|
|
75
|
+
: { kind: 'compaction-progress', status: closed ? 'interrupted' : 'running' }
|
|
76
|
+
return chatNode(context, 'compaction', anchor.event.seq, progress)
|
|
77
|
+
}
|
|
54
78
|
const marker = compactSummary(state.summary, state.checkpoint)
|
|
55
79
|
return chatNode(context, 'compaction', marker.seq, marker)
|
|
56
80
|
},
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { Context } from '@deepseek-ai/cordis'
|
|
2
|
+
import type { ConversationNodeDefinition } from '@deepseek-ai/dsh-client-ui-conversation/client'
|
|
3
|
+
import { chatNode } from './common.ts'
|
|
4
|
+
|
|
5
|
+
declare module '../contract/chat-nodes.ts' {
|
|
6
|
+
interface ChatNodeDataMap {
|
|
7
|
+
/** Divider after the history a seeded Session inherited; the Node's anchor is the marker seq. */
|
|
8
|
+
'inherited-history': Record<never, never>
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* One divider at the latest inherited `session/end-seed` marker in the loaded
|
|
14
|
+
* window. Ordered Context matches supply its position, including after older
|
|
15
|
+
* pages load. A cut inside a Turn stays outside that Turn's process disclosure.
|
|
16
|
+
*/
|
|
17
|
+
export const inheritedHistoryDefinition: ConversationNodeDefinition<null> = {
|
|
18
|
+
kind: 'inherited-history',
|
|
19
|
+
target: 'chat',
|
|
20
|
+
match: event => event.type === 'session/end-seed' && event.data.inherited === true
|
|
21
|
+
? { id: 'inherited-history', role: 'start' }
|
|
22
|
+
: null,
|
|
23
|
+
start: () => null,
|
|
24
|
+
update: () => null,
|
|
25
|
+
buildViewNode: (context) => {
|
|
26
|
+
const latest = context.matches.at(-1)
|
|
27
|
+
/* v8 ignore next -- this Context exists only after matching a durable inherited marker. */
|
|
28
|
+
if (latest === undefined) return null
|
|
29
|
+
return chatNode(context, 'inherited-history', latest.event.seq, {}, {
|
|
30
|
+
location: latest.location, groupTree: 'turn',
|
|
31
|
+
})
|
|
32
|
+
},
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Register the inherited-history divider contribution.
|
|
37
|
+
* @param ctx - owning UI Conversation context.
|
|
38
|
+
*/
|
|
39
|
+
export function registerInheritedHistoryConversationNode(ctx: Context): void {
|
|
40
|
+
ctx.uiConversation.events.register(inheritedHistoryDefinition)
|
|
41
|
+
}
|
|
@@ -13,7 +13,7 @@ function activity(name: string): RunningProcessActivity {
|
|
|
13
13
|
if (name === 'write') return 'write'
|
|
14
14
|
if (name === 'edit' || name === 'apply_patch') return 'edit'
|
|
15
15
|
if (['bash', 'pwsh', 'exec_command', 'write_stdin'].includes(name) || name.startsWith('terminal_')) return 'commands'
|
|
16
|
-
if (name === 'run_code') return 'code'
|
|
16
|
+
if (name === 'run_code' || name === 'cua_run_code') return 'code'
|
|
17
17
|
if (name === 'web_search') return 'webSearch'
|
|
18
18
|
if (name === 'web_fetch') return 'webFetch'
|
|
19
19
|
if (name === 'subagent' || name.startsWith('subagent_')) return 'subagents'
|
|
@@ -5,6 +5,7 @@ import { registerCommandConversationNode } from './command.ts'
|
|
|
5
5
|
import { registerCompactionConversationNode } from './compaction.ts'
|
|
6
6
|
import { registerUnknownConversationFallback } from './fallback.ts'
|
|
7
7
|
import { registerInboxConversationNodes } from './inbox.ts'
|
|
8
|
+
import { registerInheritedHistoryConversationNode } from './inherited-history.ts'
|
|
8
9
|
import { registerMessageConversationNode } from './message.ts'
|
|
9
10
|
import { registerRequestPromptConversationNode } from './request-prompt.ts'
|
|
10
11
|
import { registerRetryConversationNode } from './retry.ts'
|
|
@@ -28,6 +29,7 @@ export function registerConversationNodes(ctx: Context): void {
|
|
|
28
29
|
registerToolConversationNode(ctx)
|
|
29
30
|
registerCommandConversationNode(ctx)
|
|
30
31
|
registerCompactionConversationNode(ctx)
|
|
32
|
+
registerInheritedHistoryConversationNode(ctx)
|
|
31
33
|
registerRetryConversationNode(ctx)
|
|
32
34
|
registerTurnErrorConversationNode(ctx)
|
|
33
35
|
registerTurnMaxTokensConversationNode(ctx)
|
package/src/client/file-path.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import type { Context } from '@deepseek-ai/cordis'
|
|
3
3
|
import type { SessionId } from '@deepseek-ai/dsh-session/types'
|
|
4
4
|
import { resolveWorkspacePath } from '@deepseek-ai/dsh-util-workspace-path'
|
|
5
|
-
import
|
|
5
|
+
import { sessionDirectory } from '@deepseek-ai/dsh-api-session-controller/client/directories'
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Bind path resolution to the originating Session without capturing its current directory.
|
|
@@ -11,9 +11,5 @@ import type {} from '@deepseek-ai/dsh-api-session-controller/client'
|
|
|
11
11
|
* @returns Resolver using the live working directory, falling back to the workspace root.
|
|
12
12
|
*/
|
|
13
13
|
export function sessionFilePath(ctx: Context, sessionId: SessionId): (path: string) => string {
|
|
14
|
-
return
|
|
15
|
-
const cwd = ctx.sessions.list.getSnapshot().byId[sessionId]?.cwd
|
|
16
|
-
const current = ctx.sessions.binding(sessionId)?.session.projections.faceOf('workingDirectory').getSnapshot() as string | null | undefined
|
|
17
|
-
return resolveWorkspacePath(current ?? cwd, path)
|
|
18
|
-
}
|
|
14
|
+
return path => resolveWorkspacePath(sessionDirectory(ctx.sessions, sessionId), path)
|
|
19
15
|
}
|
package/src/client/index.ts
CHANGED
|
@@ -5,6 +5,7 @@ export type {} from './conversation-nodes/assistant.ts'
|
|
|
5
5
|
export type {} from './conversation-nodes/command.ts'
|
|
6
6
|
export type {} from './conversation-nodes/compaction.ts'
|
|
7
7
|
export type {} from './conversation-nodes/fallback.ts'
|
|
8
|
+
export type {} from './conversation-nodes/inherited-history.ts'
|
|
8
9
|
export type {} from './conversation-nodes/message.ts'
|
|
9
10
|
export type {} from './conversation-nodes/request-prompt.ts'
|
|
10
11
|
export type {} from './conversation-nodes/retry.ts'
|