@@ -36,7 +36,10 @@ import {
3636import { parseScopedThreadKey , scopeThreadRef } from "@t3tools/client-runtime/environment" ;
3737import { useAtomValue } from "@effect/atom-react" ;
3838import { environmentThreadDetails } from "../../state/threads" ;
39- import { resolveUserMessagePresentation } from "@t3tools/client-runtime/user-message" ;
39+ import {
40+ backgroundActivityTrigger ,
41+ resolveUserMessagePresentation ,
42+ } from "@t3tools/client-runtime/user-message" ;
4043import { Link } from "@tanstack/react-router" ;
4144import { canForkProjectedAssistantItem } from "@t3tools/client-runtime/state/thread-workflows" ;
4245import { notificationChildThreadId } from "@t3tools/client-runtime/state/thread-execution" ;
@@ -186,6 +189,7 @@ import {
186189 timelineContentOverflowsViewport ,
187190} from "./timelineScrollAnchoring" ;
188191import { MessageCopyButton } from "./MessageCopyButton" ;
192+ import { BackgroundActivityDisclosure } from "./BackgroundActivityDisclosure" ;
189193import { promptLinkFor } from "../promptLinks/copyPromptLink" ;
190194import { PierreEntryIcon } from "./PierreEntryIcon" ;
191195import { WorkspaceEntryIcon , WorkspaceEntryTooltip } from "./WorkspaceEntryIcon" ;
@@ -199,6 +203,7 @@ import {
199203import { useAssistantCitationTarget , type CitationHistoryPage } from "./useAssistantCitationTarget" ;
200204import {
201205 computeStableMessagesTimelineRows ,
206+ groupBackgroundActivityRows ,
202207 deriveMessagesTimelineRowsWithState ,
203208 type MessagesTimelineRowsProjection ,
204209 liveWorkEntryLabel ,
@@ -948,7 +953,13 @@ const ConversationTimeline = memo(function ConversationTimeline({
948953 supportsConversationRollback ,
949954 worktreeSetup ,
950955 ] ) ;
951- const rows = useStableRows ( rawRows , listIdentityKey ) ;
956+ // Search uses the original rows so matches inside a folded prompt can be
957+ // revealed and navigated without changing history or message identities.
958+ const backgroundRows = useMemo (
959+ ( ) => ( findActive ? rawRows : groupBackgroundActivityRows ( rawRows ) ) ,
960+ [ findActive , rawRows ] ,
961+ ) ;
962+ const rows = useStableRows ( backgroundRows , listIdentityKey ) ;
952963 // Run status/timestamps churn on every stream event; the shared row context
953964 // must not change with them or every timeline row re-renders per event.
954965 const runs = useStableHandoffRuns ( runsProp ) ;
@@ -2186,6 +2197,7 @@ const TimelineRowContent = memo(function TimelineRowContent({ row }: { row: Time
21862197 { row . kind === "turn-fold" ? < TurnFoldTimelineRow row = { row } /> : null }
21872198 { row . kind === "attempt-fold" ? < AttemptFoldTimelineRow row = { row } /> : null }
21882199 { row . kind === "context-compaction" ? < ContextCompactionTimelineRow row = { row } /> : null }
2200+ { row . kind === "background-activity" ? < BackgroundActivityTimelineRow row = { row } /> : null }
21892201 { row . kind === "message" && row . message . role === "user" ? < UserTimelineRow row = { row } /> : null }
21902202 { row . kind === "message" && row . message . role === "assistant" ? (
21912203 < AssistantTimelineRow row = { row } />
@@ -2309,6 +2321,34 @@ function UserVideoAttachment({ file }: { readonly file: ChatFileAttachment }) {
23092321// from selection so sighted users and copied text are unaffected.
23102322const MESSAGE_HEADING_LEVEL = 3 ;
23112323
2324+ function BackgroundActivityTimelineRow ( {
2325+ row,
2326+ } : {
2327+ row : Extract < TimelineRow , { kind : "background-activity" } > ;
2328+ } ) {
2329+ const ctx = use ( TimelineRowCtx ) ;
2330+ return (
2331+ < BackgroundActivityDisclosure eventCount = { row . messages . length } >
2332+ { row . messages . map ( ( messageRow ) => (
2333+ < div key = { messageRow . id } >
2334+ < div className = "mb-1 flex flex-wrap items-center gap-2 text-xs" >
2335+ < span > { backgroundActivityTrigger ( messageRow . message ) } </ span >
2336+ < TimelineRowTimestamp
2337+ createdAt = { messageRow . createdAt }
2338+ timestampFormat = { ctx . timestampFormat }
2339+ />
2340+ < code className = "break-all" > { messageRow . message . id } </ code >
2341+ { messageRow . message . runId ? (
2342+ < code className = "break-all" > { messageRow . message . runId } </ code >
2343+ ) : null }
2344+ </ div >
2345+ < UserTimelineRow row = { messageRow } />
2346+ </ div >
2347+ ) ) }
2348+ </ BackgroundActivityDisclosure >
2349+ ) ;
2350+ }
2351+
23122352function MessageAuthorHeading ( { children } : { children : string } ) {
23132353 return < h3 className = "sr-only select-none" > { children } </ h3 > ;
23142354}
@@ -2527,7 +2567,15 @@ function UserTimelineRow({ row }: { row: Extract<TimelineRow, { kind: "message"
25272567 < UserMessageIntentMarker intent = { row . message . inputIntent } />
25282568 ) : null }
25292569 < div className = "relative max-w-[80%] rounded-2xl bg-message p-3 text-message-foreground" >
2530- < MessageAuthorHeading > You</ MessageAuthorHeading >
2570+ < MessageAuthorHeading >
2571+ { userMessage . attribution === null
2572+ ? "You"
2573+ : userMessage . attribution === "agent"
2574+ ? "Another agent"
2575+ : userMessage . attribution === "automation"
2576+ ? "Automation"
2577+ : "T3 Code" }
2578+ </ MessageAuthorHeading >
25312579 { ( regularImages . length > 0 || userVideos . length > 0 ) && (
25322580 < div className = "mb-2 grid max-w-[210px] grid-cols-2 gap-2" >
25332581 { regularImages . map ( ( image ) => (
0 commit comments