Merge PR #941 dependency into manual compaction stack

# Conflicts:
#	docs/cordis-catalog/services.md
#	docs/core-data-structures/session.i18n.yaml
#	packages/host/apiproxy/README.i18n.yaml
#	packages/host/apiproxy/src/api-proxy.ts
#	packages/ui/tui/src/index.ts
This commit is contained in:
Hypatia May
2026-07-30 16:42:24 +08:00
50 changed files with 889 additions and 147 deletions

View File

@@ -23,6 +23,7 @@ import {
type AgentLlmTarget,
} from '@deepseek-ai/dsh-agent'
import type { LlmModelInfo, LlmModelReasoningInfo, ReasoningEffortId } from '@deepseek-ai/dsh-llm'
import { lastActivityTime } from '@deepseek-ai/dsh-session'
import type { SessionId } from '@deepseek-ai/dsh-session'
import { foldGoal, type GoalPhase } from '@deepseek-ai/dsh-goal'
import { foldSessionTitle } from '@deepseek-ai/dsh-session-title'
@@ -512,7 +513,8 @@ export function summarizeResumeCandidate(
return {
record,
title,
lastActivityAt: snapshot.events.at(-1)?.time ?? snapshot.session.createdAt,
// Excludes a prior pickup's boundary, or every browsed session floats up.
lastActivityAt: lastActivityTime(snapshot.events) ?? snapshot.session.createdAt,
lastTurn: resumeTurnLabel(snapshot),
currentWorkspace: record.header.cwd === cwd,
workspaceLabel: formatWorkspace(record.header.cwd),

View File

@@ -36,6 +36,7 @@ import type {} from '@deepseek-ai/dsh-llm-retry'
import { renderPrompt } from '@deepseek-ai/dsh-system-prompt'
import {
isReplacementSurfaceEvent,
lastActivityTime,
SessionId,
type SessionEvent,
type UserMessage,
@@ -1008,7 +1009,7 @@ export function createTuiChat(
const systemPrompt = displayText(renderPrompt(assembly)) || '(empty)'
const registeredTools = assembly.tools.map(tool => displayText(tool.name)).join(', ') || '(none)'
const events = agent.session.events
const latestActivity = events.at(-1)?.time ?? agent.session.header.createdAt
const latestActivity = lastActivityTime(events) ?? agent.session.header.createdAt
const usedContext = Math.max(0, Math.round(ctx.tokenMeter.measure(agent.session).totalTokens))
let context = `${formatDiagnosticNumber(usedContext)} used · capacity unknown`
const contextWindow = modelController.contextWindow()

View File

@@ -48,7 +48,7 @@ buffer
17| "│ │"
style 0-0 dim
style 55-55 dim
18| "│ Agent: idle · 7 events · 1 turn · 1 step · 1 │"
18| "│ Agent: idle · 8 events · 1 turn · 1 step · 1 │"
style 0-0 dim
style 3-12 dim
style 55-55 dim

View File

@@ -45,7 +45,7 @@ buffer
16| "│ │"
style 0-0 dim
style 81-81 dim
17| "│ Agent: idle · 7 events · 1 turn · 1 step · 1 tool call │"
17| "│ Agent: idle · 8 events · 1 turn · 1 step · 1 tool call │"
style 0-0 dim
style 3-12 dim
style 81-81 dim

View File

@@ -878,6 +878,9 @@ describe('TUI terminal-state snapshots', () => {
{ type: 'step/end', seq: 5, time: Date.parse(`${day}T00:00:06Z`), data: { turn: 1, step: 1 } },
{ type: 'turn/end', seq: 6, time: Date.parse(`${day}T00:00:07Z`), data: { turn: 1, reason: { kind: 'completed' } } },
{ type: 'session/title', seq: 7, time: Date.parse(`${day}T00:00:08Z`), data: { title, messageSeqs: [1], source: { kind: 'fallback' } } },
// A prior pickup, dated well after the work: the picker must still
// show the work's date, not the pickup's.
{ type: 'session/end-seed', seq: 8, time: Date.parse('2026-07-23T07:59:00.000Z'), data: {} },
],
})
const harness = await setupSnapshot({
@@ -947,6 +950,12 @@ describe('TUI terminal-state snapshots', () => {
messageSeqs: [1],
source: { kind: 'fallback' },
})
// Renders over a boundary-bearing log. It cannot pin the exclusion:
// `/status` appends its own `command/run` first, so the boundary is
// never the tail here. The other two call sites pin it.
dateNow.mockReturnValue(Date.parse('2026-07-22T10:10:11.000Z'))
session.append('session/end-seed', {})
dateNow.mockReturnValue(Date.parse('2026-07-22T09:10:11.000Z'))
},
}, { columns: 92, rows: 32 })
await renderAfter(harness, () => {