refactor: group native chat turn presentation (#34629)

This commit is contained in:
Neil
2026-10-27 17:33:03 -07:00
committed by GitHub
parent 59dbb54dad
commit ea532813b1
33 changed files with 57 additions and 51 deletions
@@ -7,7 +7,7 @@ import type {
AgentJournalTurnScope
} from './agent-session-journal-types'
import { projectNativeChatTranscript } from './native-chat-transcript-projection'
import { nativeChatRowsInDrawOrder } from './native-chat-turn-grouping'
import { nativeChatRowsInDrawOrder } from './native-chat/transcript/native-chat-turn-grouping'
import { nativeChatTurnMembership, structuredAgentTurnAnchors } from './native-chat-turn-membership'
import { DISPATCH_REJECTED_CANCELLED } from './structured-agent-session-dispatch-rejection'
import { projectStructuredAgentSessionMessages } from './structured-agent-session-message-projection'
@@ -3,7 +3,7 @@ import './native-chat-reasoning-order.spec'
import './native-chat/tools/native-chat-tool-activity.spec'
import './native-chat/tools/native-chat-tool-pair-limit.spec'
import './native-chat/tools/native-chat-tool-fold-attribution.spec'
import './native-chat-turn-grouping.spec'
import './native-chat/transcript/native-chat-turn-grouping.spec'
import './native-chat/input/native-chat-ask-row.spec'
import './native-chat/tools/native-chat-tool-pairing.spec'
import './native-chat-live-line.spec'
@@ -6,7 +6,7 @@ import type {
AgentJournalSubmission,
AgentJournalTurnScope
} from './agent-session-journal-types'
import { nativeChatRowsInDrawOrder } from './native-chat-turn-grouping'
import { nativeChatRowsInDrawOrder } from './native-chat/transcript/native-chat-turn-grouping'
import {
nativeChatTurnMembership,
structuredAgentTurnAnchors,
+1 -1
View File
@@ -21,7 +21,7 @@ import {
nativeChatTurnDrawOrder,
nativeChatUserRowOpensTurn,
type NativeChatOpensTurn
} from './native-chat-turn-grouping'
} from './native-chat/transcript/native-chat-turn-grouping'
import type { NativeChatMessage, NativeChatRole } from './native-chat-types'
import { dispatchWasWithdrawn } from './structured-agent-session-dispatch-rejection'
import { inSendOrder } from './native-chat/native-chat-send-order'
@@ -5,7 +5,7 @@ import type {
} from '../../agent-session-journal-types'
import type { AgentJournalTurnScope } from '../../agent-session-journal-turn-scope'
import { foldToolMessages } from './native-chat-tool-fold'
import { nativeChatRowsInDrawOrder } from '../../native-chat-turn-grouping'
import { nativeChatRowsInDrawOrder } from '../transcript/native-chat-turn-grouping'
import { nativeChatTurnMembership } from '../../native-chat-turn-membership'
import type { NativeChatMessage, NativeChatRole } from '../../native-chat-types'
import { projectStructuredItemsToNativeChat } from '../../structured-agent-session-projection'
@@ -1,5 +1,8 @@
import { describe, expect, it } from 'vitest'
import type { AgentJournalItemBody, AgentJournalRenderItem } from './agent-session-journal-types'
import type {
AgentJournalItemBody,
AgentJournalRenderItem
} from '../../agent-session-journal-types'
import { selectStructuredAgentTurnActivity } from './native-chat-turn-activity'
function item(sequence: number, body: AgentJournalItemBody): AgentJournalRenderItem {
@@ -1,12 +1,9 @@
import { readAgentJournalTurn } from './agent-session-turn-record'
import type { AgentJournalRenderItem } from './agent-session-journal-types'
import type { AgentSessionTurnActivity } from './agent-session-wire'
import { isRootAgentJournalItem } from './agent-session-journal-producer'
import { normalizePromptField } from './agent-status-field-normalization'
import {
describeActiveToolCall,
formatActiveToolLabel
} from './native-chat/tools/native-chat-tool-activity'
import { readAgentJournalTurn } from '../../agent-session-turn-record'
import type { AgentJournalRenderItem } from '../../agent-session-journal-types'
import type { AgentSessionTurnActivity } from '../../agent-session-wire'
import { isRootAgentJournalItem } from '../../agent-session-journal-producer'
import { normalizePromptField } from '../../agent-status-field-normalization'
import { describeActiveToolCall, formatActiveToolLabel } from '../tools/native-chat-tool-activity'
export type NativeChatTurnActivity = { kind: 'description'; text: string }
@@ -1,18 +1,18 @@
// Derive settled-turn answers from the last assistant prose or system failure; the journal has no answer marker.
// Earlier work/recovered errors fold behind that answer, while failed turns end visibly on their error.
import { AGENT_SESSION_COMPACTION_SKIPPED_PRESENTATION } from './agent-session-compaction'
import { AGENT_SESSION_ORCA_STOP_PRESENTATION } from './agent-session-orca-stop'
import { AGENT_SESSION_TURN_NOTICE_PRESENTATION } from './agent-session-turn-notice'
import { nativeChatRowRendersContent } from './native-chat-row-content'
import { isStoppedBeforeStartBlock } from './native-chat/native-chat-stopped-before-start'
import { nativeChatRowRendersProse } from './native-chat/native-chat-trailing-run'
import { AGENT_SESSION_COMPACTION_SKIPPED_PRESENTATION } from '../../agent-session-compaction'
import { AGENT_SESSION_ORCA_STOP_PRESENTATION } from '../../agent-session-orca-stop'
import { AGENT_SESSION_TURN_NOTICE_PRESENTATION } from '../../agent-session-turn-notice'
import { nativeChatRowRendersContent } from '../../native-chat-row-content'
import { isStoppedBeforeStartBlock } from '../native-chat-stopped-before-start'
import { nativeChatRowRendersProse } from '../native-chat-trailing-run'
import {
isBackgroundTaskBlock,
isSubagentGroupBlock,
type NativeChatMessage,
type NativeChatRole
} from './native-chat-types'
} from '../../native-chat-types'
/** Each surface supplies its own row-content results so folding sees exactly the prose it renders. */
export type NativeChatTurnFoldRow = {
@@ -1,5 +1,5 @@
import { describe, expect, it } from 'vitest'
import type { NativeChatMessage } from './native-chat-types'
import type { NativeChatMessage } from '../../native-chat-types'
import {
nativeChatRowTurnKeys,
nativeChatTurnBarRows,
@@ -1,8 +1,8 @@
// Share desktop/mobile turn ownership, bar placement and row order.
import type { AgentJournalRenderItem } from './agent-session-journal-types'
import { readAgentJournalTurn } from './agent-session-turn-record'
import type { NativeChatRole } from './native-chat-types'
import type { AgentJournalRenderItem } from '../../agent-session-journal-types'
import { readAgentJournalTurn } from '../../agent-session-turn-record'
import type { NativeChatRole } from '../../native-chat-types'
type NativeChatTurnRow = { id: string; role: NativeChatRole }
@@ -22,7 +22,7 @@ import {
projectNativeChatTranscript,
projectNativeChatTranscriptMessages
} from './native-chat-transcript-projection'
import { nativeChatRowsInDrawOrder } from './native-chat-turn-grouping'
import { nativeChatRowsInDrawOrder } from './native-chat/transcript/native-chat-turn-grouping'
import { nativeChatTurnMembership } from './native-chat-turn-membership'
let sequence = 0