AI Summary

A short summary of a long thread or record, with its sources.

AI

Thread summary

Summarizes 38 comments. Uses 1 credit.

Installation

pnpm dlx shadcn@latest add checkfu/uicontext/summary

Usage

import type { Citation } from "./ui/uicontext/components/kit/Cite.ts"import { Summary, type SummaryStatus } from "./ui/uicontext/components/kit/Summary.ts"
const Message = UiSchema.TaggedEnum({	RequestedThreadSummary: {},	RequestedStopThreadSummary: {},})// your app runs the model: pass its status and text as they arrive, then the sources it usedexport const ThreadSummary = (	h: Html.H<typeof Message.Type>,	run: { readonly status: SummaryStatus; readonly text: string; readonly sources: ReadonlyArray<Citation> },) =>	Summary(h, {		props: { id: "thread-summary", title: "Summary", ...run },		onEmit: {			RequestedGenerate: () => Message.RequestedThreadSummary(),			RequestedRegenerate: () => Message.RequestedThreadSummary(),			RequestedStop: () => Message.RequestedStopThreadSummary(),			OpenedSource: () => undefined,		},	})

Examples

Out of date, and failed

A summary whose thread moved on says why and offers Regenerate. A failed one says what happened, with Try again.

AI

Thread summary

Out of date

6 new comments since it was written

Card payments fail for customers in the EU since Tuesday's deploy 12. The new 3-D Secure redirect drops the session cookie, so the bank's answer never reaches checkout. Ben has a fix in review and wants a second reviewer before it ships 3.

3 sources
  1. 1Mira's commentPAY-412
  2. 2Deploy log, 14:02#deploys
  3. 3Ben's pull requestcheckout-web#881
AI

Meeting summary

Refused, empty and read-only

Out of credits, nothing to say, and a viewer who can't start a run: each says why in a sentence.

AI

Weekly summary

AI

Answer

No answer in the pages you can see. Try other words, or ask someone with access.

AI

Page summary

No summary yet. Editors can generate one.

API reference

Props

Summary props
NameTypeDescription
agentIdstringThe id agents see this by; summary:<id> when left out
idrequiredstringIdentifies the summary in the events it sends
titlerequiredstringThe card's heading: "Summary"
statusrequiredSummaryStatusWhere it stands: idle, waiting, streaming, succeeded, stopped, empty, failed or refused
textrequiredstringMarkdown; [n] names the source whose label is n
sourcesrequiredCitation[]What it was written from, numbered; [n] in the text cites one
stalebooleanIts inputs changed since it was written
staleReasonstringWhy it's out of date, shown with Regenerate: "5 new comments since"
generatedAtstringWhen it was written, as an ISO timestamp; shown with locale and timeZone
nowstringNow, as an ISO timestamp, to say "Generated 2 hours ago"; a date and time when absent
localestringFormats generatedAt; the reader's own when left out
timeZonestringThe time zone for generatedAt; the reader's own when left out
attributionAttributionDataWho asked for it, or what wrote it
noticestringFor failed and refused: what went wrong and what to do, as a sentence
canCan(["regenerate", "stop"])What the viewer may do: "regenerate" shows Generate and Regenerate (not for a viewer, or a plan without it); "stop" shows Stop (not when the run can't be cancelled). Both when left out.
usagestringWhat a run costs, said before it runs: "Uses 1 credit"
openSourcesInAppbooleanThe app opens sources itself (OpenedSource) instead of following their links
waitingLabelstringWhat shows while nothing has arrived: "Searching…" (default "Summarizing…")
collapseAfternumberCollapse text longer than this many characters behind "Show more"

Events

Summary events
EventPayloadDescription
RequestedGenerate{ id: string }The person asked for a first summary
RequestedRegenerate{ id: string }A new run; the old text stays until the new one arrives
RequestedStop{ id: string }The person stopped the run
OpenedSource{ id: string; source: string }The person opened a source, when openSourcesInApp is set

Agent actions

What agents can do with Summary
ActionDescription
ClickedGenerateGenerate the summary
ClickedRegenerateWrite the summary again from its current inputs (a new run)
ClickedStopStop the summary being written

Accessibility

  • The summary is a region named by its title, marked busy while it's written; why it's out of date is said in words.
  • Show more says whether it's expanded, and its sources are a disclosure of numbered citations.
  • Agents can generate, regenerate or stop it.

Source