feat(ui): add trajectory inspection ledger

This commit is contained in:
_Kerman
2026-07-27 15:47:44 +08:00
parent 79eb3a9035
commit 628c1bffe0
42 changed files with 4549 additions and 178 deletions

View File

@@ -0,0 +1,42 @@
import { describe, expect, it } from 'vitest'
import { extractMarkdownPlainText } from '@deepseek-ai/dsh-client-ui-primitives'
const MARKDOWN = [
'# Release notes',
'',
'First **paragraph** with [a link](https://example.com) and ![diagram](diagram.png).',
'',
'- shipped',
'- `verified`',
'',
'```ts',
'const ready = true',
'```',
].join('\n')
describe('extractMarkdownPlainText', () => {
it('projects the complete GFM document without presentation syntax', () => {
expect(extractMarkdownPlainText(MARKDOWN)).toBe([
'Release notes',
'',
'First paragraph with a link and diagram.',
'',
'shipped',
'verified',
'',
'const ready = true',
].join('\n'))
})
it('selects the first visible line or first semantic paragraph', () => {
expect(extractMarkdownPlainText(MARKDOWN, { mode: 'first-line' })).toBe('Release notes')
expect(extractMarkdownPlainText(MARKDOWN, { mode: 'first-paragraph' }))
.toBe('First paragraph with a link and diagram.')
})
it('omits raw HTML and returns a useful fallback when no paragraph exists', () => {
const markdown = '<script>alert(1)</script>\n\n## Safe heading'
expect(extractMarkdownPlainText(markdown)).toBe('Safe heading')
expect(extractMarkdownPlainText(markdown, { mode: 'first-paragraph' })).toBe('Safe heading')
})
})