Thread

A conversation between people and agents, with actions on each message.

  1. Why are sign-in links expiring before the email arrives?

  2. Support has 12 tickets about it since Friday.

  3. Scoutfor Ada Lovelace
    Thought for 9s

    Compare each sign-in email's send time with its delivery time, for the last 200 sends.

    Links last 10 minutes, but the mail queue has been taking up to 14. I checked the last 200 sends: 31 arrived after their link expired.

  4. Can you draft a fix that keeps links valid for 30 minutes?

  5. Scout

    On it. I'll change LINK_TTL to 30 minutes and add a test for a slow queue

Installation

pnpm dlx shadcn@latest add checkfu/uicontext/thread

Usage

import { ThreadView } from "./ui/uicontext/components/kit/Thread.ts"import type { ThreadMessage } from "./ui/uicontext/components/kit/Thread.ts"
const Message = UiSchema.TaggedEnum({ RequestedMessageAction: { message: Schema.String, action: Schema.String } })export const IssueThread = (h: Html.H<typeof Message.Type>, messages: ReadonlyArray<ThreadMessage>) =>	ThreadView(h, {		props: {			label: "Discussion",			messages, // each with an actor, an ISO `at`, a Markdown body and its `actions`			me: "ada",		},		onEmit: { RequestedAction: ({ message, action }) => Message.RequestedMessageAction({ message, action }) },	})

Examples

With an approval

An agent asks before it acts, and the thread keeps the answer.

  1. Email the conference receipt to finance so they can expense it.

  2. Scoutfor Ada Lovelace

    Found it in your inbox: the 2-day pass, $749. Here's the email I'll send.

  3. Send this email to [email protected]

    Scout wants to
    Subject
    Conference pass receipt, $749
    Attachment
    receipt-2026.pdf

Read-only

Thread renders a transcript without actions, for history, exports and audit pages.

  1. ATAlan Turing

    The nightly export failed again at the invoices step.

  2. Second night in a row, same step.

  3. Scoutfor Alan Turing

    The invoices table grew past the export's 5,000 row page limit on Friday. Paging the query fixes it; I opened a draft change.

  4. Thanks. Merged it, and tonight's run finished in 4 minutes.

API reference

ThreadViewComponent

Props

ThreadView props
NameTypeDefaultDescription
messagesrequiredThreadMessage[]—The messages to show, oldest first
mestring—The signed-in person's id: their messages are right-aligned bubbles
labelstring"Messages"The list's accessible name; "Messages" by default
pendingActorActor—Who writes what's in the pending slot (a Stream); the slot shows only with an actor
agentIdstring—The id agents see this thread by; derived from label when left out
localestring—Formats each message's ISO at; the reader's own when left out
timeZonestring—The time zone for message times; the reader's own when left out

Events

ThreadView events
EventPayloadDescription
RequestedAction{ message: string; action: string; body?: string }The person picked an action on a message, such as Copy or Retry. An "edit" of the reader's own message (ThreadView) arrives once they save, with the new body. Paging through versions arrives as "previous-branch" or "next-branch".

Slots

pending

ThreadView function

Options

Thread options
NameTypeDefaultDescription
messagesrequiredThreadMessage[]—The messages to show, oldest first
mestring—The signed-in person's id: their messages are right-aligned bubbles
pending{ readonly actor: Actor; readonly children: View.Children }—Something still arriving (a Stream), shown last under its actor
labelstring"Messages"The list's accessible name; "Messages" by default
localestring—Formats each message's ISO at; the reader's own when left out
timeZonestring—The time zone for message times; the reader's own when left out

ThreadViewWithBodiesView function

Options

ThreadViewWithBodies options
NameTypeDescription
renderBodyrequired(message: ThreadMessage) => View.Input<NoInfer<Message>, R>Draws a message's body; return undefined to show its text as Markdown
slots{ readonly pending?: View.Input<NoInfer<Message>, P> }pending: what's still arriving, such as a Stream, shown under pendingActor

Accessibility

  • The thread is a list; each message names its author and time for screen readers, and agent messages say who they acted for.
  • Message actions appear on hover and on keyboard focus, and always on touch screens.
  • Agents can read recent messages and take an action, naming the message it applies to.

Source