Chat bubbles, time dividers and quiet event lines for a conversation with an agent.
What's the latest on Halcyon Health?
From Tuesday's call notes, they need SSO and a calendar integration before they'll start a pilot.
The pilot plan and their account notes are up to date.
Good. Ask @Inbox whether Marcus replied.
AskedInbox
Reading Marcus's reply…
import type { Html } from "@effect/ui/html"import * as stylex from "@stylexjs/stylex"import { FileCard } from "./ui/uicontext/components/kit/FileList.ts"import { Bubble, BubbleGroup, ThreadEvent, TimeDivider } from "./ui/uicontext/components/kit/Messaging.ts"import { PersonaAvatar } from "./ui/uicontext/components/kit/Persona.ts"import { Thinking } from "./ui/uicontext/components/kit/Stream.ts"import { sx } from "./ui/uicontext/components/Sx.ts"import { space } from "./ui/uicontext/components/tokens.stylex.ts"const styles = stylex.create({ thread: { display: "flex", flexDirection: "column", gap: space.lg, width: "min(100%, 34rem)" }, working: { display: "flex", alignItems: "center", gap: space.md },})export const Conversation = <M>(h: Html.H<M>) => h.div.attrs(sx(styles.thread)).children( TimeDivider(h, "Yesterday, 6:02 PM"), BubbleGroup(h, { mine: true, children: [Bubble(h, { mine: true, text: "What's the latest on Halcyon Health?" })] }), BubbleGroup(h, { children: [ Bubble(h, { text: "From Tuesday's call notes, they need SSO and a calendar integration before they'll start a pilot." }), Bubble(h, { text: "The pilot plan and their account notes are up to date." }), FileCard(h, { file: { id: "agenda", name: "Halcyon kickoff agenda.pdf", size: 1_240_000, detail: "12 pages", href: "#agenda" } }), ], }), BubbleGroup(h, { mine: true, children: [Bubble(h, { mine: true, text: "Good. Ask @Inbox whether Marcus replied.", mentions: ["Inbox"] })] }), ThreadEvent(h, { text: "Asked", subject: "Inbox", icon: "handoff", href: "#inbox" }), TimeDivider(h, "Today, 8:41 AM"), h.div.attrs(sx(styles.working)).children(PersonaAvatar(h, { persona: { shape: "circle", color: "purple" }, size: "sm", state: "working" }), Thinking(h, "Reading Marcus's reply…")), )Installation
pnpm dlx shadcn@latest add checkfu/uicontext/messagingUsage
import { Bubble, BubbleGroup, ThreadEvent } from "./ui/uicontext/components/kit/Messaging.ts"export const Exchange = <M>(h: Html.H<M>) => [ BubbleGroup(h, { mine: true, children: [Bubble(h, { mine: true, text: "Brief me every morning at 8. Ask @Inbox what's waiting.", mentions: ["Inbox"] })] }), ThreadEvent(h, { text: "Created routine", subject: "Morning briefing", icon: "routine", href: "/agents/chief/routines/briefing" }), BubbleGroup(h, { children: [Bubble(h, { text: "I'll brief you every day at 8:00 AM, starting tomorrow." })] }),]Examples
Inline events
Things that happened, not things said: a routine made, another agent asked, work handed on, something learned. The subject links to it.
Created routineMorning briefing
AskedInbox
Message fromChief of Staff
RememberedMeetings only after 10:00 AM
Paused routineWeekly team update
import type { Html } from "@effect/ui/html"import * as stylex from "@stylexjs/stylex"import { ThreadEvent } from "./ui/uicontext/components/kit/Messaging.ts"import { sx } from "./ui/uicontext/components/Sx.ts"const styles = stylex.create({ column: { display: "flex", flexDirection: "column", width: "min(100%, 30rem)" } })export const Events = <M>(h: Html.H<M>) => h.div.attrs(sx(styles.column)).children( ThreadEvent(h, { text: "Created routine", subject: "Morning briefing", icon: "routine", href: "#briefing" }), ThreadEvent(h, { text: "Asked", subject: "Inbox", icon: "handoff", href: "#inbox" }), ThreadEvent(h, { text: "Message from", subject: "Chief of Staff", icon: "message", href: "#chief" }), ThreadEvent(h, { text: "Remembered", subject: "Meetings only after 10:00 AM", icon: "memory" }), ThreadEvent(h, { text: "Paused routine", subject: "Weekly team update", icon: "pause" }), )API reference
BubbleView function
Options
| Name | Type | Default | Description |
|---|---|---|---|
mine | boolean | — | The reader's own message: on the end side |
tone | "ink" | "tint" | ink | How your own bubbles look: ink (dark on light) or a soft tint; ink by default |
text | string | — | Plain text, line breaks kept, with mentions picked out |
mentions | string[] | — | Agents' names to pick out when the text says "@Name" |
children | View.Children | — | Rich content instead of text: a reply's Markdown |
wide | boolean | — | Take the full width the group allows: a bubble holding a card |
style | Style | — | — |
BubbleGroupView function
Options
| Name | Type | Description |
|---|---|---|
mine | boolean | — |
childrenrequired | View.Children | — |
ThreadEventView function
Options
| Name | Type | Description |
|---|---|---|
textrequired | string | What happened, as a short phrase: "Created routine", "Asked", "Handed to" |
subject | string | What it happened to: a routine's name, an agent's name |
icon | ThreadEventIcon | — |
href | string | Opens the subject: the routine, the other agent's conversation |
onSelect | Message | — |