Skip to content
Merged
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
Original file line number Diff line number Diff line change
@@ -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";

Expand Down Expand Up @@ -69,7 +73,11 @@ export function ToolCallGroupChip({
!expanded && summary.icons.length > 0 ? (
<span className="ml-1 flex shrink-0 items-center gap-1.5 text-gray-9">
{summary.icons.map(({ Icon, key }) => (
<Icon key={key} size={13} />
<Tooltip key={key} content={labelForIconKey(key)}>
<span className="flex items-center">
<Icon size={13} />
</span>
</Tooltip>
))}
</span>
) : null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
buildDoneLabel,
type CollapseMode,
type GroupCounts,
type GroupIconKey,
grouping,
iconForToolKind,
MCP_ICON,
Expand All @@ -12,7 +13,7 @@ import {

export interface GroupIconEntry {
Icon: Icon;
key: string;
key: GroupIconKey;
}

export interface GroupSummary {
Expand Down Expand Up @@ -125,7 +126,7 @@ function summarize(items: ConversationItem[]): GroupSummary {
const icons: GroupIconEntry[] = [];
const seenIcons = new Set<string>();

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 });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,32 @@ 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: Partial<Record<GroupIconKey, string>> = {
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: GroupIconKey): string {
return ICON_KEY_LABELS[key] ?? "Ran other tools";
}

// ---------- Motion ----------

/**
Expand Down
Loading