('[data-native-chat-scroll]')
+ if (!marker || !row || !scroller) {
+ return
+ }
+ const top = nativeChatScrollOffsetWithin(marker, scroller)
+ // Preserve a reader parked above new rows; replies can still be short while paced rendering catches up.
+ if (
+ top === null ||
+ top - (scroller.scrollTop + scroller.clientHeight) > NATIVE_CHAT_BOTTOM_THRESHOLD_PX
+ ) {
+ return
+ }
+ // Reveal the prompt’s row unless it would leave the marker too low in the viewport.
+ const intoRow = top - (nativeChatScrollOffsetWithin(row, scroller) ?? top)
+ onReveal(intoRow < scroller.clientHeight / 2 ? row : marker)
+ }, [arriving, onArrived, onReveal])
+
+ useEffect(() => {
+ const pane = ref.current?.closest('[data-native-chat-root]')
+ // Only conversation input dismisses the marker; Find and other unrelated fields do not.
+ const onInput = (event: Event): void => {
+ if (!(event.target instanceof Element && event.target.closest(NOT_THE_CONVERSATION))) {
+ onDismiss()
+ }
+ }
+ pane?.addEventListener('beforeinput', onInput)
+ return () => pane?.removeEventListener('beforeinput', onInput)
+ }, [onDismiss])
+
+ return (
+
+ {label}
+
+
+ )
+}
+
+/** Keep the live region mounted before inserting text so screen readers announce it. */
+export function NativeChatNewRowsAnnouncement({ marked }: { marked: boolean }): React.JSX.Element {
+ const t = useTranslate()
+ return (
+
+ {marked
+ ? t(
+ 'components.native-chat.newRowsAnnouncement',
+ 'New messages arrived while you were away'
+ )
+ : null}
+
+ )
+}
diff --git a/src/renderer/src/components/native-chat/viewport/new-rows/native-chat-new-rows-marker.test.tsx b/src/renderer/src/components/native-chat/viewport/new-rows/native-chat-new-rows-marker.test.tsx
new file mode 100644
index 00000000000..9616ca78887
--- /dev/null
+++ b/src/renderer/src/components/native-chat/viewport/new-rows/native-chat-new-rows-marker.test.tsx
@@ -0,0 +1,355 @@
+// @vitest-environment happy-dom
+
+import { act, renderHook } from '@testing-library/react'
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
+import type { NativeChatMessage } from '../../../../../../shared/native-chat/native-chat-types'
+import { buildNativeChatTranscriptSlots } from '../../conversation/slots/native-chat-transcript-slots'
+import {
+ nativeChatNewRowsMarkerPlacement,
+ useNativeChatNewRowsMarker
+} from './native-chat-new-rows-marker'
+
+const at = (sequence: number) => ({ sequence, index: 0 })
+
+/** A row the journal placed at `sequence`; null for one it has not (a terminal-backed chat's). */
+function row(
+ id: string,
+ sequence: number | null,
+ role: NativeChatMessage['role'] = 'assistant',
+ text = id
+): NativeChatMessage {
+ return {
+ id,
+ role,
+ blocks: [{ type: 'text', text }],
+ timestamp: 1,
+ source: 'transcript',
+ ...(sequence === null ? {} : { journalPosition: at(sequence) })
+ }
+}
+
+type Turn = { working?: boolean; worked?: number; expanded?: boolean }
+
+function slotsOf(
+ messages: NativeChatMessage[],
+ { working = false, worked, expanded = false }: Turn = {}
+) {
+ const turnKey = working || worked !== undefined ? 'prompt' : undefined
+ return buildNativeChatTranscriptSlots({
+ messages,
+ turnKeys: messages.map(() => turnKey),
+ liveTurnKey: working ? turnKey : undefined,
+ receipts: new Map(),
+ turnStatuses: {
+ active: null,
+ completedByTurn:
+ worked === undefined
+ ? {}
+ : { prompt: { startedAt: null, thinking: false, workedSeconds: worked } }
+ },
+ turnDiffs: new Map(),
+ expandedTurnKeys: new Set(expanded && turnKey ? [turnKey] : []),
+ isWorking: working,
+ lifecycleWorking: working
+ })
+}
+
+const SEEN = [row('prompt', 1, 'user'), row('reply', 2)]
+const LATER = [...SEEN, row('answer', 3), row('more', 4)]
+const ASKED = [row('prompt', 1, 'user')]
+const DONE = [...ASKED, row('step', 2), row('answer', 3)]
+
+const missed = (key: string, after: number, through: number) => ({
+ key,
+ after: at(after),
+ through: at(through)
+})
+
+describe('where the "New" marker draws', () => {
+ it('is above the first row that came while the reader was away', () => {
+ expect(nativeChatNewRowsMarkerPlacement(slotsOf(LATER), missed('answer', 2, 4))).toEqual({
+ key: 'answer',
+ place: 'above-row'
+ })
+ })
+
+ it("is above the turn bar when only that bar parts the row from the reader's prompt", () => {
+ const asked = [row('prompt', 1, 'user'), row('answer', 2)]
+ expect(
+ nativeChatNewRowsMarkerPlacement(slotsOf(asked, { worked: 17 }), missed('answer', 1, 2))
+ ).toEqual({ key: 'prompt', place: 'above-turn-bar' })
+ })
+
+ it('stays under the rows of an opened turn the reader had already seen', () => {
+ expect(
+ nativeChatNewRowsMarkerPlacement(
+ slotsOf(DONE, { worked: 17, expanded: true }),
+ missed('answer', 2, 3)
+ )
+ ).toEqual({ key: 'answer', place: 'above-row' })
+ })
+
+ it('is above the bar of a turn the agent opened, whether the turn is open or shut', () => {
+ const turn = DONE.slice(1)
+ for (const expanded of [false, true]) {
+ expect(
+ nativeChatNewRowsMarkerPlacement(
+ slotsOf(turn, { worked: 17, expanded }),
+ missed('answer', 1, 3)
+ )
+ ).toEqual({ key: 'step', place: 'above-row' })
+ }
+ })
+
+ it('is absent when nothing came, or the row that did is gone', () => {
+ expect(nativeChatNewRowsMarkerPlacement(slotsOf(LATER), null)).toBeUndefined()
+ expect(nativeChatNewRowsMarkerPlacement(slotsOf(SEEN), missed('answer', 2, 4))).toBeUndefined()
+ })
+})
+
+describe('useNativeChatNewRowsMarker', () => {
+ let hasFocus: ReturnType
+ beforeEach(() => {
+ hasFocus = vi.spyOn(document, 'hasFocus').mockReturnValue(true)
+ })
+ afterEach(() => hasFocus.mockRestore())
+
+ type ChatProps = {
+ messages: NativeChatMessage[]
+ showing: boolean
+ waiting?: NativeChatMessage[]
+ turn?: Turn
+ }
+
+ function chat(messages: NativeChatMessage[], turn?: Turn) {
+ const initialProps: ChatProps = { messages, showing: true }
+ return renderHook(
+ (props: ChatProps) =>
+ useNativeChatNewRowsMarker(
+ slotsOf(props.messages, props.turn ?? turn),
+ slotsOf(props.waiting ?? []),
+ props.showing
+ ),
+ { initialProps }
+ )
+ }
+
+ function leaveAndReturn(left: NativeChatMessage[], onReturn: NativeChatMessage[], turn?: Turn) {
+ const view = chat(left, turn)
+ view.rerender({ messages: left, showing: false })
+ view.rerender({ messages: onReturn, showing: true })
+ return view
+ }
+
+ it('marks nothing that arrives while the reader is looking', () => {
+ const view = chat(SEEN)
+ view.rerender({ messages: LATER, showing: true })
+ expect(view.result.current.marker).toBeUndefined()
+ })
+
+ it('marks what a hidden chat is handed when the reader comes back to it', () => {
+ expect(leaveAndReturn(SEEN, LATER).result.current.marker?.key).toBe('answer')
+ })
+
+ it("is never above the reader's own prompt", () => {
+ const sent = [...SEEN, row('next-prompt', 3, 'user'), row('answer', 4)]
+ expect(leaveAndReturn(SEEN, sent).result.current.marker?.key).toBe('answer')
+ })
+
+ it('marks nothing the reader watches arrive after missing nothing', () => {
+ const view = leaveAndReturn(SEEN, SEEN)
+ view.rerender({ messages: LATER, showing: true })
+ expect(view.result.current.marker).toBeUndefined()
+ })
+
+ it('marks what came while the window was in the background', () => {
+ const view = chat(SEEN)
+ hasFocus.mockReturnValue(false)
+ act(() => {
+ window.dispatchEvent(new Event('blur'))
+ })
+ view.rerender({ messages: LATER, showing: true })
+ hasFocus.mockReturnValue(true)
+ act(() => {
+ window.dispatchEvent(new Event('focus'))
+ })
+ expect(view.result.current.marker?.key).toBe('answer')
+ })
+
+ it('goes once the reader answers', () => {
+ const view = leaveAndReturn(SEEN, LATER)
+ act(() => view.result.current.dismiss())
+ expect(view.result.current.marker).toBeUndefined()
+ })
+
+ it('does not appear when the reader answered before the chat had caught up', () => {
+ const view = chat(SEEN)
+ view.rerender({ messages: SEEN, showing: false })
+ act(() => view.result.current.dismiss())
+ view.rerender({ messages: LATER, showing: true })
+ expect(view.result.current.marker).toBeUndefined()
+ })
+
+ it('marks the first reply to a chat that held no row the journal had placed', () => {
+ const sending = [row('prompt', null, 'user')]
+ const view = leaveAndReturn(sending, [row('prompt', 1, 'user'), row('answer', 2)])
+ expect(view.result.current.marker?.key).toBe('answer')
+ })
+
+ it('is arriving on the return, until the row that draws it has brought it into view', () => {
+ const view = leaveAndReturn(SEEN, LATER)
+ expect(view.result.current.marker?.arriving).toBe(true)
+ act(() => view.result.current.marker?.onArrived())
+ expect(view.result.current.marker).toMatchObject({ key: 'answer', arriving: false })
+ })
+
+ it('stays where it is through another look away, until the reader answers', () => {
+ const view = leaveAndReturn(SEEN, LATER)
+ act(() => view.result.current.marker?.onArrived())
+
+ view.rerender({ messages: LATER, showing: false })
+ expect(view.result.current.marker?.key).toBe('answer')
+
+ view.rerender({ messages: [...LATER, row('newer', 5)], showing: true })
+ expect(view.result.current.marker).toMatchObject({ key: 'answer', arriving: false })
+ })
+
+ it('marks the next time away afresh once the reader has answered', () => {
+ const view = leaveAndReturn(SEEN, LATER)
+ act(() => view.result.current.dismiss())
+
+ view.rerender({ messages: LATER, showing: false })
+ view.rerender({ messages: [...LATER, row('newer', 5)], showing: true })
+ expect(view.result.current.marker).toMatchObject({ key: 'newer', arriving: true })
+ })
+
+ it('marks the next time away afresh when the row it marked has gone', () => {
+ const view = leaveAndReturn(SEEN, LATER)
+ view.rerender({ messages: SEEN, showing: true })
+ expect(view.result.current.marker).toBeUndefined()
+
+ view.rerender({ messages: SEEN, showing: false })
+ view.rerender({ messages: [...SEEN, row('newer', 5)], showing: true })
+ expect(view.result.current.marker?.key).toBe('newer')
+ })
+
+ it('marks a message that was held behind the running turn once it joins the transcript', () => {
+ const view = chat(SEEN)
+ view.rerender({ messages: SEEN, showing: false })
+ view.rerender({ messages: SEEN, showing: true, waiting: [row('held', 3)] })
+ expect(view.result.current.marker).toBeUndefined()
+
+ // The turn writes on in front of the reader, then the handover places the message after that.
+ view.rerender({ messages: [...SEEN, row('live', 4)], showing: true, waiting: [row('held', 3)] })
+ expect(view.result.current.marker).toBeUndefined()
+ view.rerender({ messages: [...SEEN, row('live', 4), row('held', 5)], showing: true })
+ expect(view.result.current.marker?.key).toBe('held')
+ })
+
+ it('stays above a queued message while the turn writes on ahead of it', () => {
+ const queued: NativeChatMessage = { ...row('held', 3), queued: true }
+ const view = leaveAndReturn(SEEN, [...SEEN, queued])
+ expect(view.result.current.marker?.key).toBe('held')
+
+ view.rerender({ messages: [...SEEN, row('live', 4), queued], showing: true })
+ expect(view.result.current.marker?.key).toBe('held')
+ })
+
+ it('keeps its place when the reader opens the turn that came while they were away', () => {
+ const view = leaveAndReturn(ASKED, DONE, { worked: 17 })
+ expect(view.result.current.marker).toMatchObject({ key: 'prompt', place: 'above-turn-bar' })
+
+ view.rerender({ messages: DONE, showing: true, turn: { worked: 17, expanded: true } })
+ expect(view.result.current.marker).toMatchObject({ key: 'prompt', place: 'above-turn-bar' })
+ })
+
+ it('stays through another look away after the reader shuts the turn they opened', () => {
+ const shut = { worked: 17 }
+ const view = leaveAndReturn(ASKED, DONE, { worked: 17, expanded: true })
+ view.rerender({ messages: DONE, showing: true, turn: shut })
+ view.rerender({ messages: DONE, showing: false, turn: shut })
+ view.rerender({ messages: DONE, showing: true, turn: shut })
+ expect(view.result.current.marker).toMatchObject({ key: 'prompt', place: 'above-turn-bar' })
+ })
+
+ describe('a reply still being written when the reader left', () => {
+ const begun = [row('prompt', 1, 'user'), row('reply', 2, 'assistant', 'The plan')]
+ const grown = [row('prompt', 1, 'user'), row('reply', 2, 'assistant', 'The plan has parts.')]
+ const marked = (onReturn: NativeChatMessage[]) =>
+ leaveAndReturn(begun, onReturn, { working: true }).result.current.marker?.key
+
+ it('is marked new when it grew while they were away', () => {
+ expect(marked(grown)).toBe('reply')
+ })
+
+ it('is not marked when it is as they left it', () => {
+ expect(marked(begun)).toBeUndefined()
+ })
+
+ it('gives way to the next row when it is as they left it', () => {
+ expect(marked([...begun, row('more', 3)])).toBe('more')
+ })
+
+ it('is marked new when it grew with no row placed before it', () => {
+ const alone = [row('reply', 2, 'assistant', 'The plan')]
+ const grownAlone = [row('reply', 2, 'assistant', 'The plan has parts.')]
+ const view = leaveAndReturn(alone, grownAlone, { working: true })
+ expect(view.result.current.marker?.key).toBe('reply')
+ })
+
+ describe('with a follow-up delivered into the turn after it', () => {
+ const followUp = row('follow-up', 3, 'user')
+ const marked = (onReturn: NativeChatMessage[]) =>
+ leaveAndReturn([...begun, followUp], onReturn, { working: true }).result.current.marker?.key
+
+ it('is still marked new when it grew', () => {
+ expect(marked([...grown, followUp])).toBe('reply')
+ })
+
+ it('gives way to what answers the follow-up when it is as they left it', () => {
+ expect(marked([...begun, followUp, row('answer', 4)])).toBe('answer')
+ })
+
+ it('marks nothing when nothing changed', () => {
+ expect(marked([...begun, followUp])).toBeUndefined()
+ })
+ })
+
+ describe('with a message held behind the turn, placed after it', () => {
+ const markedWith = (held: NativeChatMessage, onReturn: NativeChatMessage[]) => {
+ const view = chat(begun, { working: true })
+ view.rerender({ messages: begun, showing: true, waiting: [held] })
+ view.rerender({ messages: begun, showing: false, waiting: [held] })
+ view.rerender({ messages: onReturn, showing: true, waiting: [held] })
+ return view.result.current.marker?.key
+ }
+
+ it('is still marked new when it grew', () => {
+ expect(markedWith(row('held', 3, 'user'), grown)).toBe('reply')
+ })
+
+ it('marks nothing when neither it nor the held message changed', () => {
+ const fromAgent: NativeChatMessage = {
+ ...row('held', 3, 'user'),
+ from: {
+ kind: 'agent',
+ senders: [
+ {
+ party: { address: 'term_peer', terminalHandle: 'term_peer', orcaSessionId: null },
+ name: 'Claude'
+ }
+ ],
+ orchestration: null
+ }
+ }
+ // Seen while it waited, it is not news once the turn ends and it joins the transcript.
+ expect(markedWith(fromAgent, [...begun, fromAgent])).toBeUndefined()
+ })
+ })
+ })
+
+ it('marks nothing in a chat read from a terminal, whose rows the journal never placed', () => {
+ const view = leaveAndReturn([row('a', null)], [row('a', null), row('b', null)])
+ expect(view.result.current.marker).toBeUndefined()
+ })
+})
diff --git a/src/renderer/src/components/native-chat/viewport/new-rows/native-chat-new-rows-marker.ts b/src/renderer/src/components/native-chat/viewport/new-rows/native-chat-new-rows-marker.ts
new file mode 100644
index 00000000000..e31d5e1d225
--- /dev/null
+++ b/src/renderer/src/components/native-chat/viewport/new-rows/native-chat-new-rows-marker.ts
@@ -0,0 +1,211 @@
+// Mark the first row that arrived or kept growing while the reader was away.
+
+import { useCallback, useMemo, useState } from 'react'
+import { useOrcaWindowForegroundFocused } from '@/hooks/use-orca-window-foreground-focused'
+import { compareAgentJournalPositions } from '../../../../../../shared/agent-session/journal/agent-session-journal-position'
+import type { AgentJournalPosition } from '../../../../../../shared/agent-session/journal/agent-session-journal-types'
+import { useAppStore } from '@/store'
+import { nativeChatMarksNewMessages } from '../../../../../../shared/native-chat/native-chat-appearance-settings'
+import {
+ nativeChatSlotIndexOf,
+ nativeChatSlotKey
+} from '../../conversation/slots/native-chat-transcript-slot-selection'
+import type { NativeChatTranscriptSlot } from '../../conversation/slots/native-chat-transcript-slots'
+
+/** Use journal positions for conversation rows, including folded-turn bars; terminal-backed rows have none and remain unmarked. */
+function rowPosition(slot: NativeChatTranscriptSlot): AgentJournalPosition | undefined {
+ return slot.kind === 'message' && slot.depth === 0 && (slot.drawsMessage || slot.statusAbove)
+ ? slot.message.journalPosition
+ : undefined
+}
+
+/** Before every row the journal places: what the reader has read to when no row precedes. */
+const BEFORE_EVERY_ROW: AgentJournalPosition = { sequence: -1, index: 0 }
+
+/** Where a reader who looks away now has read to, and the reply the agent is still writing. */
+type NativeChatLeftAt = {
+ /** The newest row there was, as a position: that row may have folded away by the return. */
+ position: AgentJournalPosition
+ /** A growing reply counts as missed from the position immediately before it. */
+ writing: { key: string; size: number; before: AgentJournalPosition } | null
+}
+
+function rowSize(slot: NativeChatTranscriptSlot): number {
+ return slot.kind === 'message'
+ ? JSON.stringify((slot.workRun ?? [slot.message]).map((message) => message.blocks)).length
+ : 0
+}
+
+function newestRowPosition(
+ slots: readonly NativeChatTranscriptSlot[],
+ limit?: AgentJournalPosition
+): AgentJournalPosition {
+ let newest = BEFORE_EVERY_ROW
+ for (const slot of slots) {
+ const at = rowPosition(slot)
+ if (
+ at &&
+ (!limit || compareAgentJournalPositions(at, limit) < 0) &&
+ compareAgentJournalPositions(at, newest) > 0
+ ) {
+ newest = at
+ }
+ }
+ return newest
+}
+
+function nativeChatLeftAt(
+ slots: readonly NativeChatTranscriptSlot[],
+ waitingSlots: readonly NativeChatTranscriptSlot[]
+): NativeChatLeftAt {
+ const all = [...slots, ...waitingSlots]
+ // Later user prompts or held sends do not stop the turn’s latest assistant row from growing.
+ const writer = slots.findLast(
+ (slot) =>
+ slot.kind === 'message' &&
+ slot.activeTurnIsWorking &&
+ slot.message.role !== 'user' &&
+ rowPosition(slot) !== undefined
+ )
+ const at = writer && rowPosition(writer)
+ const writing = at
+ ? { key: nativeChatSlotKey(writer), size: rowSize(writer), before: newestRowPosition(all, at) }
+ : null
+ return { position: newestRowPosition(all), writing }
+}
+
+/** The first row that came while the reader was away, and the journal stretch it came in. */
+export type NativeChatMissedRows = {
+ /** The row, not a position: a queued message is placed again when it is handed over. */
+ key: string
+ after: AgentJournalPosition
+ /** The newest row on the return: what is written after it was watched arriving. */
+ through: AgentJournalPosition
+}
+
+function isMissedRow(
+ slot: NativeChatTranscriptSlot,
+ after: AgentJournalPosition,
+ through: AgentJournalPosition
+): boolean {
+ const at = rowPosition(slot)
+ return (
+ at !== undefined &&
+ compareAgentJournalPositions(at, after) > 0 &&
+ compareAgentJournalPositions(at, through) <= 0 &&
+ (slot.kind !== 'message' || slot.message.role !== 'user' || slot.message.from !== undefined)
+ )
+}
+
+function nativeChatMissedRows(
+ slots: readonly NativeChatTranscriptSlot[],
+ { position, writing }: NativeChatLeftAt
+): NativeChatMissedRows | null {
+ const row = writing && slots.find((slot) => nativeChatSlotKey(slot) === writing.key)
+ const after = writing && !(row && rowSize(row) === writing.size) ? writing.before : position
+ const through = newestRowPosition(slots)
+ const first = slots.find((slot) => isMissedRow(slot, after, through))
+ return first ? { key: nativeChatSlotKey(first), after, through } : null
+}
+
+export type NativeChatNewRowsMarkerPlacement = {
+ /** Key of the row the marker draws in. */
+ key: string
+ place: 'above-row' | 'above-turn-bar'
+}
+
+export type NativeChatNewRowsMarkerState = NativeChatNewRowsMarkerPlacement & {
+ /** The reader has just come back: bring the marker into view, once. */
+ arriving: boolean
+ onArrived: () => void
+ onDismiss: () => void
+}
+
+/** Place above the first missed row, or its turn bar when the two lines would otherwise touch. */
+export function nativeChatNewRowsMarkerPlacement(
+ slots: readonly NativeChatTranscriptSlot[],
+ missed: NativeChatMissedRows | null
+): NativeChatNewRowsMarkerPlacement | undefined {
+ if (missed === null) {
+ return undefined
+ }
+ const { key, after, through } = missed
+ // Opening a folded turn draws missed rows above the one marked while it was shut.
+ const index = slots.findIndex(
+ (slot) => nativeChatSlotKey(slot) === key || isMissedRow(slot, after, through)
+ )
+ const first = slots[index]
+ if (!first) {
+ return undefined
+ }
+ const before = slots[index - 1]
+ return before?.kind === 'message' &&
+ before.status &&
+ !before.statusAbove &&
+ !before.turnDiff &&
+ !before.openedPullRequests
+ ? { key: nativeChatSlotKey(before), place: 'above-turn-bar' }
+ : { key: nativeChatSlotKey(first), place: 'above-row' }
+}
+
+export function useNativeChatNewRowsMarker(
+ slots: readonly NativeChatTranscriptSlot[],
+ /** Rows held behind the running turn: seen and missed like any other, drawn outside `slots`. */
+ waitingSlots: readonly NativeChatTranscriptSlot[],
+ /** The pane is the one showing, and shows what the host holds now. */
+ isShowingLatest: boolean
+): {
+ marker: NativeChatNewRowsMarkerState | undefined
+ /** The slot drawing the marker, or -1. */
+ index: number
+ /** The reader answered the conversation, so nothing in it is news to them. */
+ dismiss: () => void
+} {
+ // Off tracks nothing, so nothing is ever marked.
+ const enabled = useAppStore((state) => nativeChatMarksNewMessages(state.settings))
+ const focused = useOrcaWindowForegroundFocused(enabled && isShowingLatest)
+ const watching = !enabled || focused
+ const [seen, setSeen] = useState<{
+ watching: boolean
+ /** While the reader is away: where they had read to. */
+ left: NativeChatLeftAt | null
+ /** Stands until the reader answers. */
+ missed: NativeChatMissedRows | null
+ arriving: boolean
+ }>({ watching, left: null, missed: null, arriving: false })
+ if (!enabled) {
+ if (!seen.watching || seen.left !== null || seen.missed !== null) {
+ setSeen({ watching, left: null, missed: null, arriving: false })
+ }
+ } else if (seen.watching !== watching) {
+ const all = [...slots, ...waitingSlots]
+ if (watching) {
+ const missed = seen.left ? nativeChatMissedRows(all, seen.left) : seen.missed
+ setSeen({ watching, left: null, missed, arriving: seen.left !== null && missed !== null })
+ } else {
+ // An unanswered marker whose row still stands is kept: the reader may be midway through it.
+ const marked = nativeChatNewRowsMarkerPlacement(all, seen.missed) !== undefined
+ setSeen({ ...seen, watching, left: marked ? null : nativeChatLeftAt(slots, waitingSlots) })
+ }
+ }
+ const { missed } = seen
+ const placement = useMemo(() => nativeChatNewRowsMarkerPlacement(slots, missed), [slots, missed])
+ const dismiss = useCallback(() => {
+ // Where they left as well: an answer sent before the chat has caught up settles that too.
+ setSeen((held) =>
+ held.missed === null && held.left === null ? held : { ...held, missed: null, left: null }
+ )
+ }, [])
+ const onArrived = useCallback(() => {
+ setSeen((held) => (held.arriving ? { ...held, arriving: false } : held))
+ }, [])
+ const { key, place } = placement ?? {}
+ const marker = useMemo(
+ () =>
+ key && place
+ ? { key, place, arriving: seen.arriving, onArrived, onDismiss: dismiss }
+ : undefined,
+ [key, place, seen.arriving, onArrived, dismiss]
+ )
+ return { marker, index: nativeChatSlotIndexOf(slots, key), dismiss }
+}
diff --git a/src/renderer/src/components/native-chat/viewport/virtualization/NativeChatTranscriptItems.tsx b/src/renderer/src/components/native-chat/viewport/virtualization/NativeChatTranscriptItems.tsx
index 8682871ce37..1088f039f66 100644
--- a/src/renderer/src/components/native-chat/viewport/virtualization/NativeChatTranscriptItems.tsx
+++ b/src/renderer/src/components/native-chat/viewport/virtualization/NativeChatTranscriptItems.tsx
@@ -8,6 +8,7 @@ import type { NativeChatTranscriptSlot } from '../../conversation/slots/native-c
import type { NativeChatTranscriptWindow } from './use-native-chat-transcript-window'
import type { ReaderGesture } from '../scroll/native-chat-autoscroll'
import { NativeChatForwardedGestureContext } from '../scroll/native-chat-reader-scroll-input'
+import type { NativeChatNewRowsMarkerState } from '../new-rows/native-chat-new-rows-marker'
import {
NativeChatReplyRevealsContext,
useNativeChatReplyReveals
@@ -19,12 +20,14 @@ export function NativeChatTranscriptItems({
loadedMessageIds,
context,
window,
+ newRowsMarker,
forwardGesture
}: {
slots: readonly NativeChatTranscriptSlot[]
loadedMessageIds: ReadonlySet
context: NativeChatTranscriptRowContext
window: NativeChatTranscriptWindow
+ newRowsMarker?: NativeChatNewRowsMarkerState
/** A reader gesture a row's visual frame took before the transcript could see it. */
forwardGesture: (gesture: ReaderGesture) => void
}): React.JSX.Element {
@@ -44,7 +47,13 @@ export function NativeChatTranscriptItems({
-
+
)
diff --git a/src/renderer/src/components/native-chat/viewport/virtualization/native-chat-pinned-rows.ts b/src/renderer/src/components/native-chat/viewport/virtualization/native-chat-pinned-rows.ts
index 72ef98255ae..c845a890232 100644
--- a/src/renderer/src/components/native-chat/viewport/virtualization/native-chat-pinned-rows.ts
+++ b/src/renderer/src/components/native-chat/viewport/virtualization/native-chat-pinned-rows.ts
@@ -9,20 +9,25 @@ export type NativeChatPinnedRowsInput = {
count: number
/** Mount reveal targets before their cards expand and report scroll positions. */
revealIndex?: number | null
+ /** Keep the New marker mounted so it can reveal itself and detect reader replies. */
+ newRowsMarkerIndex?: number | null
}
/** Pin the live tail for aria-live announcements and measured-height accuracy during streaming. */
export function nativeChatPinnedRowIndexes({
count,
- revealIndex
+ revealIndex,
+ newRowsMarkerIndex
}: NativeChatPinnedRowsInput): ReadonlySet {
const pinned = new Set()
if (count <= 0) {
return pinned
}
pinned.add(count - 1)
- if (revealIndex != null && revealIndex >= 0 && revealIndex < count) {
- pinned.add(revealIndex)
+ for (const index of [revealIndex, newRowsMarkerIndex]) {
+ if (index != null && index >= 0 && index < count) {
+ pinned.add(index)
+ }
}
return pinned
}
diff --git a/src/renderer/src/components/native-chat/viewport/virtualization/use-native-chat-transcript-window.ts b/src/renderer/src/components/native-chat/viewport/virtualization/use-native-chat-transcript-window.ts
index cdd7b581f8a..9dbc4d54d8d 100644
--- a/src/renderer/src/components/native-chat/viewport/virtualization/use-native-chat-transcript-window.ts
+++ b/src/renderer/src/components/native-chat/viewport/virtualization/use-native-chat-transcript-window.ts
@@ -54,6 +54,7 @@ export function useNativeChatTranscriptWindow({
slots,
isVisible,
revealIndex,
+ newRowsMarkerIndex,
typography = DEFAULT_ROW_TYPOGRAPHY
}: {
scrollRef: React.RefObject
@@ -61,6 +62,8 @@ export function useNativeChatTranscriptWindow({
isVisible: boolean
/** Slot the transcript was asked to reveal, or -1. */
revealIndex: number
+ /** Slot drawing the "New" marker, or -1. */
+ newRowsMarkerIndex?: number
/** Chat text scale; gap scales with the text size. */
typography?: NativeChatRowTypography
}): NativeChatTranscriptWindow {
@@ -71,8 +74,8 @@ export function useNativeChatTranscriptWindow({
const previousMeasurementKeysRef = useRef | null>(null)
const retiredMeasurementCountRef = useRef(0)
const pinned = useMemo(
- () => nativeChatPinnedRowIndexes({ count: slots.length, revealIndex }),
- [slots.length, revealIndex]
+ () => nativeChatPinnedRowIndexes({ count: slots.length, revealIndex, newRowsMarkerIndex }),
+ [slots.length, revealIndex, newRowsMarkerIndex]
)
// Keep measured offsets through content-only growth to preserve the end anchor; rebuild only on structural changes.
// Encoded only when the slots change: scroll and range renders reuse it.
diff --git a/src/renderer/src/components/settings/chat/ChatBehaviorSetting.tsx b/src/renderer/src/components/settings/chat/ChatBehaviorSetting.tsx
index dbc8c1ccd15..ad33fddde88 100644
--- a/src/renderer/src/components/settings/chat/ChatBehaviorSetting.tsx
+++ b/src/renderer/src/components/settings/chat/ChatBehaviorSetting.tsx
@@ -14,7 +14,10 @@ import { NativeChatShellEnvironmentSetting } from './NativeChatShellEnvironmentS
import { NativeChatIdleStopSetting } from './NativeChatIdleStopSetting'
import { SearchableSetting } from '../section-layout/SearchableSetting'
import { nativeChatQueueFollowUps } from '../../../../../shared/native-chat/input/native-chat-follow-up-behavior'
-import { nativeChatScrollsToLatestOnSend } from '../../../../../shared/native-chat/native-chat-appearance-settings'
+import {
+ nativeChatMarksNewMessages,
+ nativeChatScrollsToLatestOnSend
+} from '../../../../../shared/native-chat/native-chat-appearance-settings'
import { SettingsSubsectionHeader, SettingsSwitchRow } from '../form-controls/SettingsFormControls'
import { getChatBehaviorEntriesByKey, getChatBehaviorTitle } from './chat-behavior-search'
import { getChatPermissionSearchEntry } from './chat-permission-search'
@@ -54,6 +57,7 @@ export function ChatBehaviorSetting({
...(hostContinuesUsageLimits ? [entries.autoContinueAfterUsageLimit] : []),
...(hostQueuesMessages ? [entries.queueFollowUps] : []),
entries.scrollToLatestOnSend,
+ entries.markNewMessages,
entries.linkPreviews,
entries.shellEnvironment
]
@@ -64,6 +68,7 @@ export function ChatBehaviorSetting({
const queueFollowUps = nativeChatQueueFollowUps(settings)
const autoContinueEnabled = settings.nativeChatAutoContinueAfterUsageLimit === true
const scrollToLatestOnSend = nativeChatScrollsToLatestOnSend(settings)
+ const markNewMessages = nativeChatMarksNewMessages(settings)
const linkPreviewsEnabled = settings.nativeChatLinkPreviews !== false
return (
@@ -162,6 +167,20 @@ export function ChatBehaviorSetting({
}
/>
+
+ updateSettings({ nativeChatMarkNewMessages: !markNewMessages })}
+ />
+
({
translate('components.settings.nativeChat.scrollToLatestOnSendSearchPosition', 'position')
]
},
+ markNewMessages: {
+ targetSectionId: 'chat-mark-new-messages',
+ title: translate(
+ 'components.settings.nativeChat.markNewMessagesTitle',
+ 'Mark new messages when returning to a chat'
+ ),
+ description: translate(
+ 'components.settings.nativeChat.markNewMessagesCopy',
+ 'Coming back to a chat draws a New line above what arrived while you were away, and scrolls to it if you were reading the latest.'
+ ),
+ keywords: [translate('components.settings.nativeChat.markNewMessagesSearchUnread', 'unread')]
+ },
linkPreviews: {
targetSectionId: 'chat-link-previews',
title: translate('components.settings.nativeChat.linkPreviewsTitle', 'Link previews'),
diff --git a/src/renderer/src/i18n/locales/de.json b/src/renderer/src/i18n/locales/de.json
index 454f252e06d..bf554a084f3 100644
--- a/src/renderer/src/i18n/locales/de.json
+++ b/src/renderer/src/i18n/locales/de.json
@@ -19771,6 +19771,8 @@
"showAgent": "{{value0}} im Gespräch anzeigen"
},
"jumpToLatest": "Zur neuesten Nachricht springen",
+ "newRowsAnnouncement": "Während der Abwesenheit sind neue Nachrichten eingegangen",
+ "newRowsMarker": "Neu",
"find": {
"label": "Im Chat suchen",
"noResults": "Keine Ergebnisse",
@@ -20640,6 +20642,9 @@
"scrollToLatestOnSendTitle": "Beim Senden zur neuesten Nachricht scrollen",
"scrollToLatestOnSendCopy": "Senden im hochgescrollten Zustand springt zur neuesten Nachricht und folgt der Antwort. Deaktiviere dies, um deine Position zu behalten.",
"scrollToLatestOnSendSearchPosition": "Position",
+ "markNewMessagesTitle": "Neue Nachrichten bei der Rückkehr in einen Chat markieren",
+ "markNewMessagesCopy": "Bei der Rückkehr in einen Chat erscheint eine Neu-Linie über dem, was in deiner Abwesenheit eingegangen ist. Warst du bei der neuesten Nachricht, scrollt der Chat dorthin.",
+ "markNewMessagesSearchUnread": "ungelesen",
"inlineVisualsTitle": "Eingebettete Grafiken",
"inlineVisualsCopy": "Dem Agenten erlauben, Diagramme, Schaubilder und Mockups in seinen Antworten anzuzeigen. Gilt für neu gestartete Chats.",
"inlineVisualsToggleLabel": "Eingebettete Grafiken umschalten",
diff --git a/src/renderer/src/i18n/locales/en.json b/src/renderer/src/i18n/locales/en.json
index fd3e66b2e85..06606a0f090 100644
--- a/src/renderer/src/i18n/locales/en.json
+++ b/src/renderer/src/i18n/locales/en.json
@@ -20355,6 +20355,8 @@
"showAgent": "Show {{value0}} in the conversation"
},
"jumpToLatest": "Jump to latest",
+ "newRowsAnnouncement": "New messages arrived while you were away",
+ "newRowsMarker": "New",
"find": {
"label": "Find in chat",
"noResults": "No results",
@@ -21306,6 +21308,9 @@
"scrollToLatestOnSendTitle": "Scroll to latest when sending",
"scrollToLatestOnSendCopy": "Sending while scrolled up jumps to the latest message and follows the reply. Turn off to keep your place.",
"scrollToLatestOnSendSearchPosition": "position",
+ "markNewMessagesTitle": "Mark new messages when returning to a chat",
+ "markNewMessagesCopy": "Coming back to a chat draws a New line above what arrived while you were away, and scrolls to it if you were reading the latest.",
+ "markNewMessagesSearchUnread": "unread",
"inlineVisualsTitle": "Inline visuals",
"inlineVisualsCopy": "Let the agent show charts, diagrams and mockups inside its replies. Applies to newly started chats.",
"inlineVisualsToggleLabel": "Toggle inline visuals",
diff --git a/src/renderer/src/i18n/locales/es.json b/src/renderer/src/i18n/locales/es.json
index 76d24032fdf..85faa0e840d 100644
--- a/src/renderer/src/i18n/locales/es.json
+++ b/src/renderer/src/i18n/locales/es.json
@@ -19410,6 +19410,8 @@
"toggleDetails": "Alternar detalles del turno"
},
"jumpToLatest": "Saltar a lo último",
+ "newRowsAnnouncement": "Llegaron mensajes nuevos mientras no estabas",
+ "newRowsMarker": "Nuevo",
"find": {
"label": "Buscar en el chat",
"noResults": "Sin resultados",
@@ -20392,6 +20394,9 @@
"scrollToLatestOnSendTitle": "Desplazar a lo último al enviar",
"scrollToLatestOnSendCopy": "Enviar con el chat desplazado hacia arriba salta al último mensaje y sigue la respuesta. Desactívalo para mantener tu posición.",
"scrollToLatestOnSendSearchPosition": "posición",
+ "markNewMessagesTitle": "Marcar los mensajes nuevos al volver a un chat",
+ "markNewMessagesCopy": "Al volver a un chat aparece una línea Nuevo encima de lo que llegó mientras no estabas, y el chat se desplaza hasta ella si estabas leyendo lo más reciente.",
+ "markNewMessagesSearchUnread": "no leído",
"followUpBehaviorCopy": "Los mensajes enviados mientras el agente trabaja esperan como tarjetas hasta que termina el turno, en lugar de entrar en el turno en curso. Cmd/Ctrl+Intro hace lo contrario para un mensaje y, si no hay texto escrito, dirige la primera tarjeta en espera al turno en curso. Los mensajes con imágenes también esperan como tarjetas.",
"inlineVisualsTitle": "Elementos visuales inline",
"inlineVisualsCopy": "Permite que el agente muestre gráficos, diagramas y maquetas dentro de sus respuestas. Se aplica a los chats nuevos.",
diff --git a/src/renderer/src/i18n/locales/fr.json b/src/renderer/src/i18n/locales/fr.json
index 5e54997ebbb..c83d86bd4eb 100644
--- a/src/renderer/src/i18n/locales/fr.json
+++ b/src/renderer/src/i18n/locales/fr.json
@@ -19649,6 +19649,8 @@
"toggleDetails": "Basculer les détails du tour"
},
"jumpToLatest": "Aller au dernier message",
+ "newRowsAnnouncement": "De nouveaux messages sont arrivés en votre absence",
+ "newRowsMarker": "Nouveau",
"find": {
"label": "Rechercher dans le chat",
"noResults": "Aucun résultat",
@@ -20740,6 +20742,9 @@
"scrollToLatestOnSendTitle": "Défiler jusqu’au dernier message à l’envoi",
"scrollToLatestOnSendCopy": "Envoyer après avoir remonté le fil fait défiler jusqu’au dernier message et suit la réponse. Désactivez cette option pour garder votre position.",
"scrollToLatestOnSendSearchPosition": "position",
+ "markNewMessagesTitle": "Signaler les nouveaux messages au retour dans un chat",
+ "markNewMessagesCopy": "En revenant dans un chat, une ligne Nouveau s'affiche au-dessus de ce qui est arrivé pendant votre absence, et le chat y défile si vous lisiez les derniers messages.",
+ "markNewMessagesSearchUnread": "non lu",
"followUpBehaviorCopy": "Les messages envoyés pendant que l’agent travaille attendent sous forme de cartes jusqu’à la fin du tour, au lieu d’entrer dans le tour en cours. Cmd/Ctrl+Entrée fait l’inverse pour un message et, si rien n’est saisi, dirige la première carte en attente vers le tour en cours. Les messages contenant des images attendent aussi sous forme de cartes.",
"inlineVisualsTitle": "Visuels intégrés",
"inlineVisualsCopy": "Laissez l'agent afficher des graphiques, des diagrammes et des maquettes dans ses réponses. S'applique aux nouveaux chats.",
diff --git a/src/renderer/src/i18n/locales/ja.json b/src/renderer/src/i18n/locales/ja.json
index 6f309bdfab3..11747e0c67e 100644
--- a/src/renderer/src/i18n/locales/ja.json
+++ b/src/renderer/src/i18n/locales/ja.json
@@ -18947,6 +18947,8 @@
"toggleDetails": "ターンの詳細を切り替えます"
},
"jumpToLatest": "最新にジャンプ",
+ "newRowsAnnouncement": "離れている間に新しいメッセージが届きました",
+ "newRowsMarker": "新着",
"find": {
"label": "チャット内を検索",
"noResults": "結果はありません",
@@ -19915,6 +19917,9 @@
"scrollToLatestOnSendTitle": "送信時に最新までスクロール",
"scrollToLatestOnSendCopy": "上にスクロールした状態で送信すると、最新のメッセージに移動して返信を追従します。オフにすると現在の位置を維持します。",
"scrollToLatestOnSendSearchPosition": "位置",
+ "markNewMessagesTitle": "チャットに戻ったときに新着メッセージを示す",
+ "markNewMessagesCopy": "チャットに戻ると、離れている間に届いたメッセージの上に「新着」の線を表示します。最新のメッセージを読んでいた場合は、そこまでスクロールします。",
+ "markNewMessagesSearchUnread": "未読",
"followUpBehaviorCopy": "Agent の作業中に送信したメッセージは、実行中のターンに送られず、ターンが終わるまでカードとして待機します。Cmd/Ctrl+Enter では 1 件だけその逆になり、何も入力されていない場合は最初の待機カードを実行中のターンに送ります。画像付きメッセージもカードとして待機します。",
"inlineVisualsTitle": "インライン表示",
"inlineVisualsCopy": "Agent が返信内でグラフ、図、モックアップを表示できるようにします。新しく開始したチャットに適用されます。",
diff --git a/src/renderer/src/i18n/locales/ko.json b/src/renderer/src/i18n/locales/ko.json
index 068db9b1fbd..047a7a8d513 100644
--- a/src/renderer/src/i18n/locales/ko.json
+++ b/src/renderer/src/i18n/locales/ko.json
@@ -18947,6 +18947,8 @@
"toggleDetails": "턴 세부정보 전환"
},
"jumpToLatest": "최신으로 이동",
+ "newRowsAnnouncement": "자리를 비운 동안 새 메시지가 도착했습니다",
+ "newRowsMarker": "새 메시지",
"find": {
"label": "채팅에서 찾기",
"noResults": "결과 없음",
@@ -19915,6 +19917,9 @@
"scrollToLatestOnSendTitle": "보낼 때 최신 메시지로 스크롤",
"scrollToLatestOnSendCopy": "위로 스크롤한 상태에서 보내면 최신 메시지로 이동하고 답장을 따라갑니다. 끄면 현재 위치가 유지됩니다.",
"scrollToLatestOnSendSearchPosition": "위치",
+ "markNewMessagesTitle": "채팅으로 돌아올 때 새 메시지 표시",
+ "markNewMessagesCopy": "채팅으로 돌아오면 자리를 비운 동안 도착한 내용 위에 '새 메시지' 선을 표시합니다. 최신 메시지를 보고 있었다면 그 위치로 스크롤합니다.",
+ "markNewMessagesSearchUnread": "읽지 않음",
"followUpBehaviorCopy": "Agent가 작업하는 동안 보낸 메시지는 진행 중인 턴에 들어가지 않고 턴이 끝날 때까지 카드로 대기합니다. Cmd/Ctrl+Enter를 누르면 메시지 하나에 대해 반대로 동작하며, 입력한 내용이 없으면 첫 대기 카드를 진행 중인 턴으로 보냅니다. 이미지가 포함된 메시지도 카드로 대기합니다.",
"inlineVisualsTitle": "인라인 시각 자료",
"inlineVisualsCopy": "에이전트가 답변 안에 차트, 다이어그램, 목업을 표시하도록 합니다. 새로 시작한 채팅에 적용됩니다.",
diff --git a/src/renderer/src/i18n/locales/pt.json b/src/renderer/src/i18n/locales/pt.json
index 12065876a1f..8ce826242aa 100644
--- a/src/renderer/src/i18n/locales/pt.json
+++ b/src/renderer/src/i18n/locales/pt.json
@@ -20831,6 +20831,8 @@
"pendingWork": "Aguarde a conclusão do trabalho e das mensagens pendentes antes de usar este comando.",
"notDoneGoalChangeIncomplete": "Não foi possível concluir a alteração do objetivo. Verifique o chat."
},
+ "newRowsAnnouncement": "Novas mensagens chegaram enquanto você estava ausente",
+ "newRowsMarker": "Novas",
"find": {
"label": "Localizar no chat",
"noResults": "Nenhum resultado",
@@ -21610,6 +21612,9 @@
"scrollToLatestOnSendTitle": "Rolar até o mais recente ao enviar",
"scrollToLatestOnSendCopy": "Enviar com o chat rolado para cima leva à mensagem mais recente e acompanha a resposta. Desative para manter sua posição.",
"scrollToLatestOnSendSearchPosition": "posição",
+ "markNewMessagesTitle": "Marcar mensagens novas ao voltar para um chat",
+ "markNewMessagesCopy": "Ao voltar para um chat, uma linha Novas aparece acima do que chegou enquanto você estava fora, e o chat rola até ela se você estava lendo as mais recentes.",
+ "markNewMessagesSearchUnread": "não lida",
"inlineVisualsTitle": "Visualizações nas respostas",
"inlineVisualsCopy": "Permitir que o agente mostre gráficos, diagramas e mockups nas respostas. Aplica-se a novos chats.",
"inlineVisualsToggleLabel": "Ativar ou desativar visualizações nas respostas",
diff --git a/src/renderer/src/i18n/locales/ru.json b/src/renderer/src/i18n/locales/ru.json
index 6cc23c88138..ad5712b41d2 100644
--- a/src/renderer/src/i18n/locales/ru.json
+++ b/src/renderer/src/i18n/locales/ru.json
@@ -20421,6 +20421,8 @@
"showAgent": "Показать {{value0}} в разговоре"
},
"jumpToLatest": "К последним сообщениям",
+ "newRowsAnnouncement": "Пока вас не было, появились новые сообщения",
+ "newRowsMarker": "Новое",
"find": {
"label": "Найти в чате",
"noResults": "Ничего не найдено",
@@ -21327,6 +21329,9 @@
"scrollToLatestOnSendTitle": "Прокручивать к последнему сообщению при отправке",
"scrollToLatestOnSendCopy": "Отправка при прокрутке вверх переносит к последнему сообщению и следит за ответом. Отключите, чтобы остаться на месте.",
"scrollToLatestOnSendSearchPosition": "позиция",
+ "markNewMessagesTitle": "Отмечать новые сообщения при возвращении в чат",
+ "markNewMessagesCopy": "При возвращении в чат над тем, что пришло в ваше отсутствие, появляется линия «Новое». Если вы читали последние сообщения, чат прокручивается к ней.",
+ "markNewMessagesSearchUnread": "непрочитанные",
"inlineVisualsTitle": "Визуализации в чате",
"inlineVisualsCopy": "Агент сможет показывать графики, схемы и макеты прямо в ответах. Применяется к новым чатам.",
"inlineVisualsToggleLabel": "Включить визуализации в чате",
diff --git a/src/renderer/src/i18n/locales/tr.json b/src/renderer/src/i18n/locales/tr.json
index 002982551d7..17f212cb070 100644
--- a/src/renderer/src/i18n/locales/tr.json
+++ b/src/renderer/src/i18n/locales/tr.json
@@ -19756,6 +19756,8 @@
"showAgent": "{{value0}} öğesini konuşmada göster"
},
"jumpToLatest": "En son öğeye git",
+ "newRowsAnnouncement": "Siz yokken yeni mesajlar geldi",
+ "newRowsMarker": "Yeni",
"find": {
"label": "Sohbette bul",
"noResults": "Sonuç yok",
@@ -20622,6 +20624,9 @@
"scrollToLatestOnSendTitle": "Gönderirken en son mesaja kaydır",
"scrollToLatestOnSendCopy": "Yukarı kaydırılmışken göndermek en son mesaja atlar ve yanıtı takip eder. Konumunuzu korumak için kapatın.",
"scrollToLatestOnSendSearchPosition": "konum",
+ "markNewMessagesTitle": "Bir sohbete dönünce yeni mesajları işaretle",
+ "markNewMessagesCopy": "Bir sohbete döndüğünüzde, siz yokken gelenlerin üstünde bir Yeni çizgisi gösterilir. En son mesajları okuyorduysanız sohbet oraya kaydırılır.",
+ "markNewMessagesSearchUnread": "okunmamış",
"inlineVisualsTitle": "Yanıtlarda görseller",
"inlineVisualsCopy": "Ajanın yanıtlarında grafikler, diyagramlar ve taslaklar göstermesine izin verin. Yeni başlatılan sohbetlere uygulanır.",
"inlineVisualsToggleLabel": "Yanıtlardaki görselleri aç/kapat",
diff --git a/src/renderer/src/i18n/locales/zh-Hant.json b/src/renderer/src/i18n/locales/zh-Hant.json
index 11bd936a4f6..57243a21dc8 100644
--- a/src/renderer/src/i18n/locales/zh-Hant.json
+++ b/src/renderer/src/i18n/locales/zh-Hant.json
@@ -19472,6 +19472,8 @@
"showAgent": "在對話中顯示 {{value0}}"
},
"jumpToLatest": "跳到最新訊息",
+ "newRowsAnnouncement": "你離開期間有新訊息",
+ "newRowsMarker": "新訊息",
"find": {
"label": "在聊天中查詢",
"noResults": "沒有結果",
@@ -20323,6 +20325,9 @@
"scrollToLatestOnSendTitle": "傳送時捲動到最新訊息",
"scrollToLatestOnSendCopy": "向上捲動時傳送訊息會跳到最新訊息並跟隨回覆。關閉後會保留目前位置。",
"scrollToLatestOnSendSearchPosition": "位置",
+ "markNewMessagesTitle": "返回聊天時標記新訊息",
+ "markNewMessagesCopy": "返回聊天時,在你離開期間收到的內容上方顯示「新訊息」分隔線;如果你之前在看最新訊息,會捲動到該處。",
+ "markNewMessagesSearchUnread": "未讀",
"inlineVisualsTitle": "內嵌視覺化",
"inlineVisualsCopy": "允許代理程式在其回覆中顯示圖表、示意圖和原型圖。適用於新啟動的聊天。",
"inlineVisualsToggleLabel": "切換內嵌視覺化",
diff --git a/src/renderer/src/i18n/locales/zh.json b/src/renderer/src/i18n/locales/zh.json
index 31c5adba076..dafc74e5398 100644
--- a/src/renderer/src/i18n/locales/zh.json
+++ b/src/renderer/src/i18n/locales/zh.json
@@ -18887,6 +18887,8 @@
"toggleDetails": "切换回合详情"
},
"jumpToLatest": "跳到最新消息",
+ "newRowsAnnouncement": "你离开期间有新消息",
+ "newRowsMarker": "新消息",
"find": {
"label": "在聊天中查找",
"noResults": "没有结果",
@@ -19915,6 +19917,9 @@
"scrollToLatestOnSendTitle": "发送时滚动到最新消息",
"scrollToLatestOnSendCopy": "向上滚动时发送消息会跳到最新消息并跟随回复。关闭后将保持当前位置。",
"scrollToLatestOnSendSearchPosition": "位置",
+ "markNewMessagesTitle": "返回聊天时标记新消息",
+ "markNewMessagesCopy": "返回聊天时,在你离开期间收到的内容上方显示“新消息”分隔线;如果你之前在看最新消息,会滚动到该处。",
+ "markNewMessagesSearchUnread": "未读",
"followUpBehaviorCopy": "智能体工作时发送的消息会作为卡片等待,直到本轮结束,而不是进入当前轮次。Cmd/Ctrl+Enter 对单条消息执行相反操作;输入框为空时,该快捷键会将第一张等待中的卡片引入当前轮次。带图片的消息也会作为卡片等待。",
"inlineVisualsTitle": "内联可视化",
"inlineVisualsCopy": "允许智能体在其回复中显示图表、示意图和原型图。适用于新启动的聊天。",
diff --git a/src/shared/native-chat/native-chat-appearance-settings.ts b/src/shared/native-chat/native-chat-appearance-settings.ts
index 6418d14543c..6bfccce2214 100644
--- a/src/shared/native-chat/native-chat-appearance-settings.ts
+++ b/src/shared/native-chat/native-chat-appearance-settings.ts
@@ -31,6 +31,18 @@ export type NativeChatGlobalSettings = {
nativeChatTurnDiffSummary?: boolean
/** Lines saying how CI went on a pull request the chat opened or pushed to. Absent means on. */
nativeChatCiResultLines?: boolean
+ /** A "New" line above what arrived while the reader was away. Absent follows the default below. */
+ nativeChatMarkNewMessages?: boolean
+}
+
+/** Not written into default settings, so flipping this reaches everyone who never chose. */
+const NATIVE_CHAT_MARKS_NEW_MESSAGES_BY_DEFAULT = true
+
+export function nativeChatMarksNewMessages(
+ settings: { readonly nativeChatMarkNewMessages?: unknown } | null | undefined
+): boolean {
+ const value = settings?.nativeChatMarkNewMessages
+ return typeof value === 'boolean' ? value : NATIVE_CHAT_MARKS_NEW_MESSAGES_BY_DEFAULT
}
/** Only explicit OFF keeps a reader's place on send. */