Chat cards
Timeline
What happened to one record, newest first and grouped by day: who did it, what changed from what to what, and the comment or email behind it. Long feeds fold behind “Show earlier events”.
When to use it
Section titled “When to use it”Use it when: The user asks what happened to one record (a deal, a ticket, an order): who did what and when, in order. Comments, emails, status moves and field changes, grouped by day.
Use something else when: The record’s current state matters more than its history (entity card). Events across many records (records list or table). A trend in numbers over time (chart).
What the agent receives
Section titled “What the agent receives”| The template calls | The agent gets | When |
|---|---|---|
displayed() | FUNCTION_TOOL_DISPLAYED | As soon as the card shows. The agent goes on. Opening an event is your app’s job. |
States
Section titled “States”Besides its data, the template draws these as itself, with mountState(). Pick one on the preview with State.
| State | When it shows |
|---|---|
| Loading | While the card loads again in place, for example after Try again. While execute runs, the SDK shows its own loader. |
| Empty | execute found no events for the record. The card says so and the agent explains why. |
| Error | execute returned the failure as data, so the agent can explain it. Try again loads in place. |
mountState({ root, head, title: "…", state: { kind: "error", text: "…", retry } });The hosted action and the in-page handler below show each case. The state types are LoadingState, EmptyState and ErrorState in fs-kit.
TimelineData
Section titled “TimelineData”| Field | Type | Notes |
|---|---|---|
title | string | |
subtitle (optional) | string | |
icon (optional) | IconName | Default: clock. |
events | TimelineEvent[] | In any order: the card sorts them newest first and groups them by day. |
visible (optional) | number | How many events show before “Show N earlier events”. Default: 5. |
footnote (optional) | string | Short note on the left of the footer, e.g. “Last 30 days”. |
link (optional) | { label: string; href: string } | A footer link to the full history in your app. |
TimelineEvent
Section titled “TimelineEvent”| Field | Type | Notes |
|---|---|---|
id | string | Your event’s id: actions.open gets the event back. |
kind | TimelineKind | Sets the icon and its tone: created, updated, comment, status, email, call or system. |
actor (optional) | string | Who did it, by name. Leave it out for events your system made. |
actorAvatarUrl (optional) | string | A photo for the actor’s avatar. Falls back to initials. |
action | string | What happened, after the actor’s name: “moved the deal to Negotiation”. Without an actor, the whole sentence. |
at | string | When, as an ISO 8601 time. Shown relative (“2 hours ago”), the exact time on hover. |
detail (optional) | string | A comment’s text, an email’s subject or a call’s note. Up to three lines show. |
changes (optional) | TimelineChange[] | Field changes, drawn as old value, arrow, new value. |
linkLabel (optional) | string | Shows a link on this event, e.g. “Open email”. With href it goes there; without, it calls actions.open. |
href (optional) | string | Where the event’s link goes in your app. |
TimelineChange
Section titled “TimelineChange”| Field | Type | Notes |
|---|---|---|
field | string | The field’s name, e.g. “Stage”. |
from (optional) | string | The old value. Leave it out when the field was empty. |
to | string | The new value. |
TimelineActions
Section titled “TimelineActions”| Field | Type | Notes |
|---|---|---|
open() (optional) | (event: TimelineEvent) => void | An event’s link was clicked and the event has no href. Open it in your app. |
Install
Section titled “Install”Copy the template and the shared kit into your code: agent/ui/ in an agent repo, or anywhere in your app. The template imports only ./fs-kit.js. Then wire it up from the hosted action or the in-page handler.
- Hosted action: TypeScript, JavaScript
- In-page handler: TypeScript, JavaScript
- timeline: TypeScript, JavaScript
- fs-kit: TypeScript, JavaScript
The hosted action needs an agent repo with one folder per action (agent/actions/<action_key>/index.ts). If your repo keeps its actions in agent/actions/index.ts, use the in-page handler: it runs the same template in your app.
All templates in machine-readable form: /ui-catalog/catalog.json.