From 11a3a1ef622fdbbea6c9a359fc693857686a4b19 Mon Sep 17 00:00:00 2001 From: Matt Pua Date: Wed, 17 Jun 2026 14:45:17 -0400 Subject: [PATCH 1/2] feat(thread): tooltips explaining collapsed tool-call chip icons MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Each icon in a collapsed tool-call group chip now has a tooltip describing what it means (e.g. terminal → "Ran terminal commands", robot → "Spawned a subagent"). Generated-By: PostHog Code Task-Id: 9fd8d7c6-d3d6-4495-a94a-9f24088530fe --- .../new-thread/ToolCallGroupChip.tsx | 12 ++++++++++-- .../new-thread/conversationThreadConfig.ts | 19 +++++++++++++++++++ 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/packages/ui/src/features/sessions/components/new-thread/ToolCallGroupChip.tsx b/packages/ui/src/features/sessions/components/new-thread/ToolCallGroupChip.tsx index a2fc382b7b..94e8a1cd4e 100644 --- a/packages/ui/src/features/sessions/components/new-thread/ToolCallGroupChip.tsx +++ b/packages/ui/src/features/sessions/components/new-thread/ToolCallGroupChip.tsx @@ -1,8 +1,12 @@ import { CaretDownIcon, CaretRightIcon } from "@phosphor-icons/react"; import type { GroupSummary } from "@posthog/ui/features/sessions/components/new-thread/buildThreadGroups"; -import { motion as motionConfig } from "@posthog/ui/features/sessions/components/new-thread/conversationThreadConfig"; +import { + labelForIconKey, + motion as motionConfig, +} from "@posthog/ui/features/sessions/components/new-thread/conversationThreadConfig"; import { ToolRow } from "@posthog/ui/features/sessions/components/session-update/ToolRow"; import { DotsCircleSpinner } from "@posthog/ui/primitives/DotsCircleSpinner"; +import { Tooltip } from "@posthog/ui/primitives/Tooltip"; import { motion, useReducedMotion } from "framer-motion"; import type { ReactNode } from "react"; @@ -69,7 +73,11 @@ export function ToolCallGroupChip({ !expanded && summary.icons.length > 0 ? ( {summary.icons.map(({ Icon, key }) => ( - + + + + + ))} ) : null diff --git a/packages/ui/src/features/sessions/components/new-thread/conversationThreadConfig.ts b/packages/ui/src/features/sessions/components/new-thread/conversationThreadConfig.ts index b9361870e7..b8459e75a1 100644 --- a/packages/ui/src/features/sessions/components/new-thread/conversationThreadConfig.ts +++ b/packages/ui/src/features/sessions/components/new-thread/conversationThreadConfig.ts @@ -141,6 +141,25 @@ export function iconForToolKind(kind: CodeToolKind | null | undefined): Icon { export const SUBAGENT_ICON: Icon = Robot; export const MCP_ICON: Icon = PuzzlePiece; +/** Human-readable label for a chip icon, keyed by its `GroupIconEntry.key`. */ +const ICON_KEY_LABELS: Record = { + subagent: "Spawned a subagent", + mcp: "Called an MCP tool", + "kind:read": "Read files", + "kind:edit": "Edited files", + "kind:delete": "Deleted files", + "kind:move": "Moved files", + "kind:search": "Searched the codebase", + "kind:execute": "Ran terminal commands", + "kind:think": "Thought through the problem", + "kind:fetch": "Fetched a web page", + "kind:question": "Asked a question", +}; + +export function labelForIconKey(key: string): string { + return ICON_KEY_LABELS[key] ?? "Ran other tools"; +} + // ---------- Motion ---------- /** From 06c94f10d6448183b119c39441fba996e8002e0d Mon Sep 17 00:00:00 2001 From: Matt Pua Date: Wed, 17 Jun 2026 14:49:20 -0400 Subject: [PATCH 2/2] refactor(thread): type chip icon keys as a closed union GroupIconEntry.key is now GroupIconKey ("subagent" | "mcp" | kind:${CodeToolKind}) instead of string, so the label map and addIcon calls are checked at compile time. Generated-By: PostHog Code Task-Id: 9fd8d7c6-d3d6-4495-a94a-9f24088530fe --- .../components/new-thread/buildThreadGroups.ts | 5 +++-- .../components/new-thread/conversationThreadConfig.ts | 11 +++++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/packages/ui/src/features/sessions/components/new-thread/buildThreadGroups.ts b/packages/ui/src/features/sessions/components/new-thread/buildThreadGroups.ts index 902bd610d8..0701fde940 100644 --- a/packages/ui/src/features/sessions/components/new-thread/buildThreadGroups.ts +++ b/packages/ui/src/features/sessions/components/new-thread/buildThreadGroups.ts @@ -4,6 +4,7 @@ import { buildDoneLabel, type CollapseMode, type GroupCounts, + type GroupIconKey, grouping, iconForToolKind, MCP_ICON, @@ -12,7 +13,7 @@ import { export interface GroupIconEntry { Icon: Icon; - key: string; + key: GroupIconKey; } export interface GroupSummary { @@ -125,7 +126,7 @@ function summarize(items: ConversationItem[]): GroupSummary { const icons: GroupIconEntry[] = []; const seenIcons = new Set(); - const addIcon = (Icon: Icon, key: string) => { + const addIcon = (Icon: Icon, key: GroupIconKey) => { if (seenIcons.has(key) || icons.length >= grouping.maxIconsInChip) return; seenIcons.add(key); icons.push({ Icon, key }); diff --git a/packages/ui/src/features/sessions/components/new-thread/conversationThreadConfig.ts b/packages/ui/src/features/sessions/components/new-thread/conversationThreadConfig.ts index b8459e75a1..1ef473979b 100644 --- a/packages/ui/src/features/sessions/components/new-thread/conversationThreadConfig.ts +++ b/packages/ui/src/features/sessions/components/new-thread/conversationThreadConfig.ts @@ -141,8 +141,15 @@ export function iconForToolKind(kind: CodeToolKind | null | undefined): Icon { export const SUBAGENT_ICON: Icon = Robot; export const MCP_ICON: Icon = PuzzlePiece; +/** The closed set of `GroupIconEntry.key` values a chip icon can carry. */ +export type GroupIconKey = + | "subagent" + | "mcp" + | `kind:${CodeToolKind}` + | "kind:other"; + /** Human-readable label for a chip icon, keyed by its `GroupIconEntry.key`. */ -const ICON_KEY_LABELS: Record = { +const ICON_KEY_LABELS: Partial> = { subagent: "Spawned a subagent", mcp: "Called an MCP tool", "kind:read": "Read files", @@ -156,7 +163,7 @@ const ICON_KEY_LABELS: Record = { "kind:question": "Asked a question", }; -export function labelForIconKey(key: string): string { +export function labelForIconKey(key: GroupIconKey): string { return ICON_KEY_LABELS[key] ?? "Ran other tools"; }