Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import { createElement } from 'react'
import type { NativeChatMessage } from '../../../src/shared/native-chat-types'
import type { NativeChatTurnJournal } from '../../../src/shared/native-chat-turn-membership'
import type { NativeChatSettledTurns } from '../../../src/shared/native-chat-turn-status'
import { useMobileNativeChatTurnDisclosure } from './use-mobile-native-chat-turn-disclosure'

export function MobileNativeChatTurnDisclosureHarness({
messages,
enabled,
isWorking = true,
settledTurns,
turnJournal,
workingStartedAt,
thinking,
lineYields,
scopeKey = 'host\0worktree\0tab-a'
}: {
messages: readonly NativeChatMessage[]
enabled: boolean
isWorking?: boolean
settledTurns?: NativeChatSettledTurns
turnJournal?: NativeChatTurnJournal
workingStartedAt?: number | null
thinking?: boolean
lineYields?: boolean
scopeKey?: string
}): React.JSX.Element {
const disclosure = useMobileNativeChatTurnDisclosure({
messages,
enabled,
isWorking,
settledTurns,
turnJournal,
workingStartedAt,
thinking,
lineYields,
scopeKey
})
return createElement('result', { disclosure })
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import type {
import { agentJournalSubmissionKey } from '../../../src/shared/agent-session-journal-item-key'
import type { NativeChatMessage } from '../../../src/shared/native-chat-types'
import type { NativeChatTurnJournal } from '../../../src/shared/native-chat-turn-membership'
import type { NativeChatSettledTurns } from '../../../src/shared/native-chat-turn-status'
import { MobileNativeChatTurnDisclosureHarness as Harness } from './mobile-native-chat-turn-disclosure-test-harness'
import { useMobileNativeChatTurnDisclosure } from './use-mobile-native-chat-turn-disclosure'

function userMessage(id: string): NativeChatMessage {
Expand All @@ -22,41 +22,6 @@ function userMessage(id: string): NativeChatMessage {
}
}

function Harness({
messages,
enabled,
isWorking = true,
settledTurns,
turnJournal,
workingStartedAt,
thinking,
lineYields,
scopeKey = 'host\0worktree\0tab-a'
}: {
messages: readonly NativeChatMessage[]
enabled: boolean
isWorking?: boolean
settledTurns?: NativeChatSettledTurns
turnJournal?: NativeChatTurnJournal
workingStartedAt?: number | null
thinking?: boolean
lineYields?: boolean
scopeKey?: string
}): React.JSX.Element {
const disclosure = useMobileNativeChatTurnDisclosure({
messages,
enabled,
isWorking,
settledTurns,
turnJournal,
workingStartedAt,
thinking,
lineYields,
scopeKey
})
return createElement('result', { disclosure })
}

describe('useMobileNativeChatTurnDisclosure', () => {
let renderer: ReactTestRenderer | null = null

Expand Down
8 changes: 6 additions & 2 deletions src/shared/structured-agent-session-live-turn.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,13 @@ describe('isStructuredAgentSessionThinking', () => {
state,
...(state === 'completed' ? { completedAt: 3 } : {})
})
expect(isStructuredAgentSessionThinking([turnStart, withState('running')])).toBe(true)
expect(isStructuredAgentSessionThinking({ items: [turnStart, withState('running')] })).toBe(
true
)
// Ended reasoning stays the newest row while Claude streams a tool's input after it.
expect(isStructuredAgentSessionThinking([turnStart, withState('completed')])).toBe(false)
expect(isStructuredAgentSessionThinking({ items: [turnStart, withState('completed')] })).toBe(
false
)
})

it('is false once a tool call, a message or a diff lands after the reasoning', () => {
Expand Down
Loading