@@ -298,7 +242,11 @@ export function ThreadDetailsPanel(props: ThreadDetailsPanelProps) {
);
if (props.mode === "popover") {
- return
{card}
;
+ return (
+
+ {card}
+
+ );
}
return (
diff --git a/apps/web/src/components/chat/ThreadRelationshipsControl.tsx b/apps/web/src/components/chat/ThreadRelationshipsControl.tsx
index 90c45715c1..537d817595 100644
--- a/apps/web/src/components/chat/ThreadRelationshipsControl.tsx
+++ b/apps/web/src/components/chat/ThreadRelationshipsControl.tsx
@@ -4,7 +4,6 @@ import { useNavigate } from "@tanstack/react-router";
import {
ArrowRightIcon,
BotIcon,
- GitBranchIcon,
GitForkIcon,
GitMergeIcon,
LoaderCircleIcon,
@@ -20,7 +19,6 @@ import {
resolveMergeBackTargetThreadId,
type ThreadRelationshipEdge,
} from "../../lib/threadRelationships";
-import { newThreadId } from "../../lib/utils";
import { buildThreadRouteParams } from "../../threadRoutes";
import { useThreadProjection, useThreadShells } from "../../state/entities";
import { threadEnvironment } from "../../state/threads";
@@ -29,6 +27,15 @@ import { cn } from "../../lib/utils";
import { Button } from "../ui/button";
import { Menu, MenuItem, MenuPopup, MenuTrigger } from "../ui/menu";
import { Tooltip, TooltipPopup, TooltipTrigger } from "../ui/tooltip";
+import {
+ THREAD_DETAILS_PANEL_ICON_CLASS,
+ THREAD_DETAILS_PANEL_ICON_ACTION_CLASS,
+ THREAD_DETAILS_PANEL_LINK_ROW_CLASS,
+ THREAD_DETAILS_PANEL_LINK_SPLIT_GROUP_CLASS,
+ THREAD_DETAILS_PANEL_LINK_SPLIT_PRIMARY_CLASS,
+ THREAD_DETAILS_PANEL_LINK_SPLIT_SECONDARY_CLASS,
+ THREAD_DETAILS_PANEL_SPLIT_SEPARATOR_CLASS,
+} from "./threadDetailsPanelStyles";
function relationshipLabel(edge: ThreadRelationshipEdge, currentThreadId: ThreadId) {
if (edge.kind === "transfer") return "Context transfer";
@@ -45,7 +52,13 @@ function statusDotClass(status: string | null): string {
return "bg-muted-foreground/45";
}
-const MAX_VISIBLE_RELATIONSHIPS = 5;
+function relationshipThreadTitle(input: {
+ readonly title: string;
+ readonly isSubagent: boolean;
+}): string {
+ if (!input.isSubagent) return input.title;
+ return input.title.replace(/^Subagent:\s*/i, "");
+}
export function ThreadRelationshipsPanel(props: {
readonly environmentId: EnvironmentId;
@@ -67,30 +80,10 @@ export function ThreadRelationshipsPanel(props: {
];
const graph = deriveThreadRelationshipGraph({ threads: shells, projection });
const navigate = useNavigate();
- const forkFromRun = useAtomCommand(threadEnvironment.forkFromRun);
const mergeBack = useAtomCommand(threadEnvironment.mergeBack);
const stopSession = useAtomCommand(threadEnvironment.stopSession);
- const [busyAction, setBusyAction] = useState<"fork" | "merge" | "detach" | null>(null);
+ const [busyAction, setBusyAction] = useState<"merge" | "detach" | null>(null);
const latestCompletedRun = projection?.runs.findLast((run) => run.status === "completed") ?? null;
- const sourceProviderThread =
- latestCompletedRun?.providerThreadId == null
- ? null
- : (projection?.providerThreads.find(
- (thread) => thread.id === latestCompletedRun.providerThreadId,
- ) ?? null);
- const capabilities =
- (sourceProviderThread === null
- ? null
- : projection?.providerSessions.find(
- (session) => session.id === sourceProviderThread.providerSessionId,
- )?.capabilities) ?? null;
- const canForkNatively =
- capabilities?.threads.canForkThread === true &&
- capabilities.threads.canForkFromTurn === true &&
- capabilities.identity.nativeThreadIds === "strong";
- const canFork =
- latestCompletedRun !== null &&
- (canForkNatively || capabilities?.context.supportsFullThreadHandoff === true);
const mergeTargetThreadId = resolveMergeBackTargetThreadId(projection);
const relationshipRows = immediateThreadRelationships(graph, props.threadId).toSorted(
(left, right) =>
@@ -103,7 +96,7 @@ export function ThreadRelationshipsPanel(props: {
(session) => session.status !== "stopped" && session.status !== "error",
) ?? false;
- if (relationshipRows.length === 0 && !canFork && mergeTargetThreadId === null && !canDetach) {
+ if (relationshipRows.length === 0) {
return null;
}
@@ -114,23 +107,6 @@ export function ThreadRelationshipsPanel(props: {
});
};
- const fork = async () => {
- if (!latestCompletedRun || busyAction !== null) return;
- setBusyAction("fork");
- const targetThreadId = newThreadId();
- const result = await forkFromRun({
- environmentId: props.environmentId,
- input: {
- sourceThreadId: props.threadId,
- targetThreadId,
- runId: latestCompletedRun.id,
- title: `${projection?.thread.title ?? "Thread"} fork`,
- },
- });
- setBusyAction(null);
- if (result._tag === "Success") openThread(targetThreadId);
- };
-
const merge = async () => {
if (!latestCompletedRun || mergeTargetThreadId === null || busyAction !== null) return;
setBusyAction("merge");
@@ -156,8 +132,6 @@ export function ThreadRelationshipsPanel(props: {
setBusyAction(null);
};
- const visibleRows = relationshipRows.slice(0, MAX_VISIBLE_RELATIONSHIPS);
- const hiddenRelationshipCount = relationshipRows.length - visibleRows.length;
const parentTitle =
mergeTargetThreadId === null
? null
@@ -177,17 +151,6 @@ export function ThreadRelationshipsPanel(props: {
Lineage
- {canFork ? (
-
- ) : null}
{canDetach ? (
- {visibleRows.length > 0 ? (
-