Skip to content
Open
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
13 changes: 12 additions & 1 deletion apps/web/src/components/chat/V2LifecycleRow.logic.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as DateTime from "effect/DateTime";
import { describe, expect, it } from "vite-plus/test";

import { subagentResumedSince } from "./V2LifecycleRow.logic";
import { plainDetail, subagentResumedSince } from "./V2LifecycleRow.logic";

const failedAt = "2026-10-09T12:21:00.000Z";
const beforeFailure = DateTime.makeUnsafe("2026-10-09T12:05:00.000Z");
Expand Down Expand Up @@ -30,3 +30,14 @@ describe("subagentResumedSince", () => {
);
});
});

describe("plainDetail", () => {
it.each([
["![screenshot](screenshots/shot.png) Verified", "screenshot Verified"],
["[docs](https://en.wikipedia.org/wiki/T3_(protocol))", "docs"],
["[report](outputs/report%20(final).md)", "report"],
["[report](outputs/report\\(final.md)", "report"],
])("strips image and link markup from %s", (detail, expected) => {
expect(plainDetail(detail)).toBe(expected);
});
});
9 changes: 9 additions & 0 deletions apps/web/src/components/chat/V2LifecycleRow.logic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,12 @@ export function subagentResumedSince(
!Number.isNaN(notifiedAtMillis) && DateTime.toEpochMillis(agent.startedAt) > notifiedAtMillis
);
}

export function plainDetail(text: string): string {
return text
.replace(/!?\[([^\]]+)\]\((?:\\.|[^\\()]|\((?:\\.|[^\\()])*\))*\)/g, "$1")
Comment thread
saphid marked this conversation as resolved.
Resolved
.replace(/`/g, "")
.replace(/^[ \t]*[-*][ \t]+/gm, "")
.replace(/\s+/g, " ")
.trim();
}
11 changes: 1 addition & 10 deletions apps/web/src/components/chat/V2LifecycleRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ import { getTriggerDisplayModelName } from "./providerIconUtils";
import { ProviderInstanceIcon, providerTextColor } from "./ProviderInstanceIcon";
import { cn } from "~/lib/utils";
import { TimelineSystemDivider } from "./TimelineSystemDivider";
import { subagentResumedSince } from "./V2LifecycleRow.logic";
import { plainDetail, subagentResumedSince } from "./V2LifecycleRow.logic";
import { Button, InlineButton } from "../ui/button";
import { T3Wordmark } from "../T3Wordmark";

Expand Down Expand Up @@ -194,15 +194,6 @@ const SETTLED_SUBAGENT_STATUSES = new Set<OrchestrationV2TurnItem["status"]>([

const GENERIC_CHILD_END = /^Child task ended with status\b/i;

function plainDetail(text: string): string {
return text
.replace(/\[([^\]]+)\]\([^)]*\)/g, "$1")
.replace(/`/g, "")
.replace(/^[ \t]*[-*][ \t]+/gm, "")
.replace(/\s+/g, " ")
.trim();
}

function isoOrNull(value: DateTime.Utc | null | undefined): string | null {
return value ? DateTime.formatIso(value) : null;
}
Expand Down
Loading