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
@@ -15,6 +15,17 @@ const UNIX_MS_THRESHOLD = 1_000_000_000_000
const WORK_ITEM_EVENT_RE = /^\[Company:([^\]]+)\]\s*(.*)$/
const COMPANY_RUNTIME_EVENT_RE = /^\[Company\]\s*(.*)$/
export function mergeSessionDetailHasMore(
previous: boolean | undefined,
incoming: boolean,
isHistoryPage: boolean,
): boolean {
// A latest-page refresh only describes that 200-row response. It must not
// reopen an older-history cursor that the user already exhausted.
if (!isHistoryPage && previous === false) return false
return incoming
}
function normalizeAgentRuntimeStatus(rawStatus: unknown, rawAgentStatus: unknown): AgentAnimStatus | undefined {
if (rawAgentStatus === 'idle' || rawAgentStatus === 'reflecting' || rawAgentStatus === 'tool_active') {
return rawAgentStatus
@@ -52,6 +63,16 @@ function mapBackendProgressLog(raw: any): ProgressEntry[] {
: typeof entry.streamId === 'string'
? entry.streamId
: undefined,
toolCallId: typeof entry.tool_call_id === 'string'
? entry.tool_call_id
: typeof entry.toolCallId === 'string'
? entry.toolCallId
: undefined,
permissionGroupKey: typeof entry.permission_group_key === 'string'
? entry.permission_group_key
: typeof entry.permissionGroupKey === 'string'
? entry.permissionGroupKey
: undefined,
seq: typeof entry.seq === 'number' && Number.isFinite(entry.seq) ? entry.seq : undefined,
executionMode: typeof entry.execution_mode === 'string'
? entry.execution_mode
@@ -633,6 +654,8 @@ export function mapBackendSession(raw: any): Session {
detailLoaded: raw.detail_loaded ?? raw.detailLoaded,
fullLoaded: raw.full_loaded ?? raw.fullLoaded,
hasMore: raw.has_more ?? raw.hasMore,
summaryHasMore: raw.summary_has_more ?? raw.summaryHasMore,
fullHasMore: raw.full_has_more ?? raw.fullHasMore,
detailLoading: raw.detail_loading ?? raw.detailLoading,
detailError: raw.detail_error ?? raw.detailError,
viewGeneration: raw.view_generation ?? raw.viewGeneration,