feat(tui): personal TUI rework, integrating upstream model reasoning-effort selection

Consolidates the personal dsh-tui customizations (module split into
components/session/extension, prompt template + running-glyph indicator,
copyable transcript, tool-card headers, timing placement, XML tool output,
status/footer rework) and ports upstream's model reasoning-effort selector
(Shift+Tab effort cycling, effort-aware /model, footer, and /status) onto
the personal module layout.
This commit is contained in:
Turtle
2026-07-27 17:53:40 +08:00
parent 5d2329e207
commit 4c5f92e0fd
139 changed files with 7491 additions and 3792 deletions
@@ -1,7 +1,7 @@
import { mkdir, writeFile } from 'node:fs/promises'
import { dirname, join } from 'node:path'
import { fileURLToPath } from 'node:url'
import { describe, expect, it } from 'vitest'
import { describe, expect, it, vi } from 'vitest'
import { Context } from 'cordis'
import LlmService, { LlmAdapter, type GenerateOptions, type StreamChunk } from '@deepseek-ai/dsh-llm'
import SessionStore, { SessionId } from '@deepseek-ai/dsh-session'
@@ -12,7 +12,7 @@ import AgentLoop from '@deepseek-ai/dsh-agent-loop'
import CommandService from '@deepseek-ai/dsh-commands'
import UserInteractionService from '@deepseek-ai/dsh-user-interaction'
import SessionReferenceService, { formatSessionReferenceMention } from '@deepseek-ai/dsh-session-reference'
import { createTuiChat } from '../src/index.ts'
import { createTuiChat, TuiPromptService } from '../src/index.ts'
import { HeadlessTerminal } from './headless-terminal.ts'
import { TestSessionQueryService } from './session-query.ts'
@@ -48,6 +48,7 @@ function nextIdle(ctx: Context, agent: Agent): Promise<void> {
describe('TUI session-reference snapshot', () => {
it('snapshots compacted current-surface context on send and displays only its reference card', async () => {
const clock = vi.spyOn(Date, 'now').mockReturnValue(new Date(2026, 6, 21, 12, 30, 0).getTime())
const ctx = new Context()
await ctx.plugin(LlmService)
await ctx.plugin(SessionStore)
@@ -56,6 +57,7 @@ describe('TUI session-reference snapshot', () => {
await ctx.plugin(AgentRegistry)
await ctx.plugin(CommandService)
await ctx.plugin(UserInteractionService)
await ctx.plugin(TuiPromptService)
await ctx.plugin(AgentLoop, { agents: [] })
await ctx.plugin(TestSessionQueryService)
await ctx.plugin(SessionReferenceService)
@@ -94,7 +96,7 @@ describe('TUI session-reference snapshot', () => {
const controller = createTuiChat(ctx, {
sessionId: target.id,
welcome: 'Session reference snapshot.',
color: true,
theme: { color: true },
title: 'DSH session reference',
}, { terminal, exit: () => {} })
await terminal.waitForFrame(0)
@@ -140,5 +142,6 @@ describe('TUI session-reference snapshot', () => {
await controller.dispose()
await ctx.fiber.dispose()
await terminal.dispose()
clock.mockRestore()
})
})