fix(ui): stabilize workplace chat scrolling

This commit is contained in:
LZH-YS1998
2026-07-13 23:02:39 +08:00
parent 4e7aa75ba5
commit 4bc18dcd27
46 changed files with 5937 additions and 1258 deletions
@@ -1,6 +1,10 @@
import assert from 'node:assert/strict'
import type { Session } from '../types/kanban'
import { composerExecModeForSession } from './ContextPanel'
import {
composerExecModeForSession,
conversationHasOlderHistory,
sessionHasMoreForDetail,
} from './ContextPanel'
function makeSession(overrides: Partial<Session> = {}): Session {
return {
@@ -49,4 +53,44 @@ assert.equal(
'org',
)
const independentlyPaged = makeSession({
hasMore: false,
summaryHasMore: false,
fullHasMore: true,
messageCount: 400,
})
assert.equal(sessionHasMoreForDetail(independentlyPaged, 'summary'), false)
assert.equal(sessionHasMoreForDetail(independentlyPaged, 'full'), true)
assert.equal(
conversationHasOlderHistory([independentlyPaged], 200, 'summary'),
false,
'a full-detail ACK must not reopen summary history',
)
assert.equal(
conversationHasOlderHistory([independentlyPaged], 200, 'full'),
true,
'full history must retain its own cursor state',
)
assert.equal(
conversationHasOlderHistory([independentlyPaged], 200, 'full', false),
true,
'a known scoped cursor remains loadable while a company turn is running',
)
const summaryOnlyState = makeSession({
hasMore: false,
summaryHasMore: true,
messageCount: 400,
})
assert.equal(
sessionHasMoreForDetail(summaryOnlyState, 'full'),
undefined,
'generic hasMore is no longer authoritative after a scoped policy is known',
)
assert.equal(
conversationHasOlderHistory([makeSession({ messageCount: 400 })], 200, 'summary', false),
false,
'only the racy message-count fallback is suppressed during active generation',
)
console.log('ContextPanel composer identity checks passed')