mirror of
https://github.com/stablyai/orca.git
synced 2026-10-30 16:47:34 +00:00
refactor: group native chat text presentation (#34647)
This commit is contained in:
@@ -12509,7 +12509,7 @@
|
||||
"src/shared/native-chat-subagent-summary.test.ts": 45,
|
||||
"src/shared/native-chat/input/native-chat-task-list-history.test.ts": 58,
|
||||
"src/shared/native-chat/input/native-chat-task-list.test.ts": 41,
|
||||
"src/shared/native-chat-text-reveal.test.ts": 27,
|
||||
"src/shared/native-chat/transcript/native-chat-text-reveal.test.ts": 27,
|
||||
"src/shared/native-chat-transcript-contracts.test.ts": 591,
|
||||
"src/shared/native-chat-transcript-projection.test.ts": 134,
|
||||
"src/shared/native-chat-transcript-retention.test.ts": 55,
|
||||
|
||||
+2
-2
@@ -5,8 +5,8 @@ import type { NativeChatMessage } from '../../../../../src/shared/native-chat-ty
|
||||
import {
|
||||
createNativeChatReplyRevealTracker,
|
||||
trackNativeChatReplyRows
|
||||
} from '../../../../../src/shared/native-chat-reply-reveals'
|
||||
import { NATIVE_CHAT_TEXT_REVEAL_DELAY_MS } from '../../../../../src/shared/native-chat-text-reveal'
|
||||
} from '../../../../../src/shared/native-chat/transcript/native-chat-reply-reveals'
|
||||
import { NATIVE_CHAT_TEXT_REVEAL_DELAY_MS } from '../../../../../src/shared/native-chat/transcript/native-chat-text-reveal'
|
||||
import {
|
||||
MobileNativeChatReplyRevealsContext,
|
||||
type MobileNativeChatReplyReveals
|
||||
|
||||
@@ -3,7 +3,7 @@ import { Text } from 'react-native'
|
||||
import {
|
||||
NATIVE_CHAT_MESSAGE_FULL_TIME_FORMAT,
|
||||
NATIVE_CHAT_MESSAGE_TIME_FORMAT
|
||||
} from '../../../../../src/shared/native-chat-message-time'
|
||||
} from '../../../../../src/shared/native-chat/transcript/native-chat-message-time'
|
||||
import { colors, typography } from '../../../theme/mobile-theme'
|
||||
import { themedStyleSheet } from '../../../theme/themed-styles'
|
||||
import { useMobileColorScheme } from '../../../theme/use-mobile-color-scheme'
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useMemo, type ReactNode } from 'react'
|
||||
import { nativeChatProseToMarkdown } from '../../../../../src/shared/native-chat-prose'
|
||||
import { nativeChatProseToMarkdown } from '../../../../../src/shared/native-chat/transcript/native-chat-prose'
|
||||
import { isTextBlock, type NativeChatBlock } from '../../../../../src/shared/native-chat-types'
|
||||
import {
|
||||
useMobileNativeChatPacedText,
|
||||
|
||||
@@ -3,7 +3,7 @@ import { Pressable, Text, View } from 'react-native'
|
||||
import {
|
||||
NATIVE_CHAT_USER_MESSAGE_MAX_UNFOLDED_LINES,
|
||||
nativeChatUserMessageFolds
|
||||
} from '../../../../../src/shared/native-chat-user-message-fold'
|
||||
} from '../../../../../src/shared/native-chat/transcript/native-chat-user-message-fold'
|
||||
import { styles as markdownStyles } from '../../../components/mobile-markdown-styles'
|
||||
import { colors, spacing, typography } from '../../../theme/mobile-theme'
|
||||
import { themedStyleSheet } from '../../../theme/themed-styles'
|
||||
|
||||
@@ -5,7 +5,7 @@ import {
|
||||
createNativeChatReplyRevealTracker,
|
||||
trackNativeChatReplyRows,
|
||||
type NativeChatReplyReveals
|
||||
} from '../../../../../src/shared/native-chat-reply-reveals'
|
||||
} from '../../../../../src/shared/native-chat/transcript/native-chat-reply-reveals'
|
||||
import { useReducedMotionEnabled } from '../../../platform/use-reduced-motion'
|
||||
|
||||
// Retain reveal state above list remounts/view toggles so replies resume instead of replaying.
|
||||
|
||||
@@ -11,7 +11,7 @@ import {
|
||||
receiveNativeChatText,
|
||||
startNativeChatTextReveal,
|
||||
type NativeChatTextRevealFrames
|
||||
} from '../../../../../src/shared/native-chat-text-reveal'
|
||||
} from '../../../../../src/shared/native-chat/transcript/native-chat-text-reveal'
|
||||
import { MobileNativeChatReplyRevealsContext } from './mobile-native-chat-reply-reveals'
|
||||
import { MobileNativeChatGrowthHoldContext } from '../../mobile-native-chat-growth-hold'
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ afterEach(() => {
|
||||
expect(unusedChatLeaves.openSender).not.toHaveBeenCalled()
|
||||
})
|
||||
import type * as NativeChatWorkRunModule from '../../../../shared/native-chat/native-chat-work-run'
|
||||
import type * as NativeChatProseModule from '../../../../shared/native-chat-prose'
|
||||
import type * as NativeChatProseModule from '../../../../shared/native-chat/transcript/native-chat-prose'
|
||||
import type { NativeChatMessage } from '../../../../shared/native-chat-types'
|
||||
import { projectStructuredAgentSessionMessages } from '../../../../shared/structured-agent-session-message-projection'
|
||||
import type { AgentJournalRenderItem } from '../../../../shared/agent-session-journal-types'
|
||||
@@ -35,7 +35,7 @@ import { installNativeChatMessageListTestViewport } from './native-chat-message-
|
||||
|
||||
// Count markdown derivations: low render counts alone can hide repeated settled-row work.
|
||||
const proseCalls = vi.hoisted(() => ({ count: 0 }))
|
||||
vi.mock('../../../../shared/native-chat-prose', async (importOriginal) => {
|
||||
vi.mock('../../../../shared/native-chat/transcript/native-chat-prose', async (importOriginal) => {
|
||||
const actual = await importOriginal<typeof NativeChatProseModule>()
|
||||
return {
|
||||
...actual,
|
||||
|
||||
@@ -4,7 +4,7 @@ import { cn } from '@/lib/utils'
|
||||
import {
|
||||
NATIVE_CHAT_MESSAGE_FULL_TIME_FORMAT,
|
||||
NATIVE_CHAT_MESSAGE_TIME_FORMAT
|
||||
} from '../../../../shared/native-chat-message-time'
|
||||
} from '../../../../shared/native-chat/transcript/native-chat-message-time'
|
||||
|
||||
let cached: {
|
||||
locale: string
|
||||
|
||||
@@ -11,7 +11,7 @@ import {
|
||||
NativeChatReplyRevealsContext,
|
||||
type NativeChatReplyReveals
|
||||
} from './native-chat-reply-reveals'
|
||||
import { NATIVE_CHAT_TEXT_REVEAL_DELAY_MS } from '../../../../shared/native-chat-text-reveal'
|
||||
import { NATIVE_CHAT_TEXT_REVEAL_DELAY_MS } from '../../../../shared/native-chat/transcript/native-chat-text-reveal'
|
||||
|
||||
vi.mock('@/hooks/usePrefersReducedMotion', () => ({ usePrefersReducedMotion: () => false }))
|
||||
vi.mock('./native-chat-visual-markdown-extension', () => ({
|
||||
|
||||
@@ -6,7 +6,7 @@ import {
|
||||
NativeChatReplyRevealsContext,
|
||||
type NativeChatReplyReveals
|
||||
} from './native-chat-reply-reveals'
|
||||
import { NATIVE_CHAT_TEXT_REVEAL_DELAY_MS } from '../../../../shared/native-chat-text-reveal'
|
||||
import { NATIVE_CHAT_TEXT_REVEAL_DELAY_MS } from '../../../../shared/native-chat/transcript/native-chat-text-reveal'
|
||||
|
||||
const reveals: NativeChatReplyReveals = { begun: new Set(['reply']), drawn: new Map() }
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import { Button } from '@/components/ui/button'
|
||||
import { translate } from '@/i18n/i18n'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { useNativeChatDisclosure } from './native-chat-disclosure-store'
|
||||
import { nativeChatUserMessageFolds } from '../../../../shared/native-chat-user-message-fold'
|
||||
import { nativeChatUserMessageFolds } from '../../../../shared/native-chat/transcript/native-chat-user-message-fold'
|
||||
|
||||
export function NativeChatUserMessageFold({
|
||||
messageId,
|
||||
|
||||
@@ -3,7 +3,7 @@ import {
|
||||
createNativeChatReplyRevealTracker,
|
||||
trackNativeChatReplyRows,
|
||||
type NativeChatReplyReveals
|
||||
} from '../../../../shared/native-chat-reply-reveals'
|
||||
} from '../../../../shared/native-chat/transcript/native-chat-reply-reveals'
|
||||
|
||||
export type { NativeChatReplyReveals }
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import { deriveNativeChatRowContent } from '../../../../shared/native-chat-row-c
|
||||
import {
|
||||
NATIVE_CHAT_USER_MESSAGE_FOLDED_PX,
|
||||
nativeChatUserMessageFolds
|
||||
} from '../../../../shared/native-chat-user-message-fold'
|
||||
} from '../../../../shared/native-chat/transcript/native-chat-user-message-fold'
|
||||
|
||||
export type NativeChatRowContentMetrics = {
|
||||
role: NativeChatMessage['role']
|
||||
|
||||
@@ -6,7 +6,7 @@ import {
|
||||
NativeChatReplyRevealsContext,
|
||||
type NativeChatReplyReveals
|
||||
} from './native-chat-reply-reveals'
|
||||
import { NATIVE_CHAT_TEXT_REVEAL_DELAY_MS as D } from '../../../../shared/native-chat-text-reveal'
|
||||
import { NATIVE_CHAT_TEXT_REVEAL_DELAY_MS as D } from '../../../../shared/native-chat/transcript/native-chat-text-reveal'
|
||||
import { useNativeChatPacedText } from './use-native-chat-paced-text'
|
||||
|
||||
const motion = vi.hoisted(() => ({ reduced: false }))
|
||||
|
||||
@@ -8,7 +8,7 @@ import {
|
||||
startNativeChatTextReveal,
|
||||
type NativeChatTextReveal,
|
||||
type NativeChatTextRevealFrames
|
||||
} from '../../../../shared/native-chat-text-reveal'
|
||||
} from '../../../../shared/native-chat/transcript/native-chat-text-reveal'
|
||||
|
||||
const WORD_FADE_MS = 300
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Keep existing word elements stable while streams append so only newly mounted words fade.
|
||||
|
||||
import type { Element, Root } from 'hast'
|
||||
import { SPACELESS_SCRIPT_RANGES } from '../../../../shared/native-chat-text-reveal'
|
||||
import { SPACELESS_SCRIPT_RANGES } from '../../../../shared/native-chat/transcript/native-chat-text-reveal'
|
||||
|
||||
/** Elements whose renderers read their text, or that are faded in as a whole. */
|
||||
const UNSPLIT_TAGS = new Set(['a', 'code', 'pre', 'kbd', 'svg', 'math'])
|
||||
|
||||
@@ -13,7 +13,7 @@ import {
|
||||
type NativeChatBlock
|
||||
} from './native-chat-types'
|
||||
import { splitNativeChatBlocks } from './native-chat/tools/native-chat-tool-fold'
|
||||
import { nativeChatProseToMarkdown } from './native-chat-prose'
|
||||
import { nativeChatProseToMarkdown } from './native-chat/transcript/native-chat-prose'
|
||||
|
||||
/** Inferred from `derive` so the shape cannot drift from what it returns. */
|
||||
export type NativeChatRowContent = ReturnType<typeof derive>
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
import { isTextBlock, type NativeChatBlock } from './native-chat-types'
|
||||
import { isTextBlock, type NativeChatBlock } from '../../native-chat-types'
|
||||
|
||||
export function nativeChatProseToMarkdown(blocks: NativeChatBlock[]): string {
|
||||
return blocks
|
||||
Reference in New Issue
Block a user