feat(web): merge compact status and summary cards

This commit is contained in:
Yichen Jiang
2026-08-08 14:11:26 +08:00
parent cc407a2672
commit 1db327ea6c
47 files changed
+725 -121

No files matched your search

@@ -21,7 +21,7 @@ import { Session, SessionId } from '@deepseek-ai/dsh-session'
const RESULT: CompactionResult = {
startSeq: 1,
summarySeq: 2,
endSeq: 4,
endSeq: 3,
summary: [{ type: 'text', text: 'loader summary' }],
shadowedRange: { start: 3, end: 8 },
shadowedSeqs: [3, 5, 8],
@@ -42,9 +42,19 @@ class LoaderCompactService extends CompactService {
}
override compactNow(
_agent: ManualCompactAgentContext,
agent: ManualCompactAgentContext,
_signal: AbortSignal,
): Promise<CompactionResult | null> {
agent.session.append('compact/start', { turn: null })
agent.session.append('compact/summary', {
summary: RESULT.summary,
shadowedRange: RESULT.shadowedRange,
shadowedSeqs: RESULT.shadowedSeqs,
shadowedTokenCount: RESULT.shadowedTokenCount,
provider: 'loader-test',
model: 'loader-test',
})
agent.session.append('compact/end', { turn: null })
return Promise.resolve(RESULT)
}
}
@@ -108,6 +118,7 @@ describe('command-compact real Loader composition', () => {
expect(execution.result).toEqual({
kind: 'success',
text: 'Compacted 3 history items (~99 tokens).',
sourceEventSeq: RESULT.summarySeq,
})
expect(session.events.map(event => ({ type: event.type, data: event.data }))).toEqual([
{
@@ -119,12 +130,32 @@ describe('command-compact real Loader composition', () => {
source: { kind: 'user' },
},
},
{
type: 'compact/start',
data: { turn: null },
},
{
type: 'compact/summary',
data: {
summary: RESULT.summary,
shadowedRange: RESULT.shadowedRange,
shadowedSeqs: RESULT.shadowedSeqs,
shadowedTokenCount: RESULT.shadowedTokenCount,
provider: 'loader-test',
model: 'loader-test',
},
},
{
type: 'compact/end',
data: { turn: null },
},
{
type: 'command/done',
data: {
commandId: execution.commandId,
kind: 'success',
text: 'Compacted 3 history items (~99 tokens).',
sourceEventSeq: RESULT.summarySeq,
},
},
])