# Away digest

What happened since you were last here, in the order you'd act on it: waiting on you, failed, finished. Empty groups are left out; nothing at all says so in one line.

- Registry name: `away-digest` (`@candor/away-digest`)
- Tier: Pro. Installing it needs a Pro, Premium or Team licence key: the person runs `npx candor-ui key <key>` themselves; never ask for the key in chat or write it to a file.
- Docs: https://candor.themethodic.com/docs/away-digest

## Install

```bash
npx candor-ui add away-digest
```

Run `npx candor-ui@latest init` once first (https://candor.themethodic.com/get-started.md). Without the CLI: `npx shadcn@latest add @candor/away-digest`.
It brings in: locale, ops, relative-time, utils.
npm packages: lucide-react@^1.67.0.

## Example

```tsx
"use client"

import { AwayDigest } from "@/components/away-digest"
import type { DigestItem } from "@/lib/ops"

const ago = (m: number) => new Date(Date.now() - m * 60_000).toISOString()

const items: DigestItem[] = [
  { id: "g1", kind: "waiting", title: "Approve: Add region to customers", detail: "Production · 4 changes", at: ago(25) },
  { id: "g2", kind: "waiting", title: "Question from the Architect agent", detail: "Should the admin view show region too?", at: ago(14) },
  { id: "g3", kind: "failed", title: "Add region to customers: backfill stopped", detail: "Row lock on batch 12", at: ago(48) },
  { id: "g4", kind: "finished", title: "Weekly unused-flags report", detail: "6 flags fully rolled out for 30 days", at: ago(60 * 9) },
]

export default function Example() {
  return <AwayDigest className="max-w-lg" since={ago(60 * 16)} items={items} onOpen={() => {}} />
}
```

## <AwayDigest>

Props:

- `since: string`: When the person was last here (ISO date), shown as a relative time.
- `items: DigestItem[]`: What happened since, grouped by kind: waiting, failed, finished.
- `onOpen?: ((id: string) => void) | undefined`: Called with an item's id when a person opens it.
- `className?: string | undefined`

## Strings (`awayDigest`)

The fixed words, English by default. Override any of them under `awayDigest` in `<LocaleProvider strings={{ awayDigest: { … } }}>`; the table is exported as `awayDigestStrings`.

- `whileAway`: While you were away
- `sinceLastHere`: Since you were last here
- `things`: { one: "{count} thing", other: "{count} things" }
- `nothingHappened`: Nothing happened while you were away.
- `group`: {label} · {count}
- `waiting`: Waiting on you
- `failed`: Failed
- `finished`: Finished

## Rules for using Candor UI

- Components take plain typed data. Never pass model output as HTML or render it as a link; messages are typed blocks.
- A control that can't be used says why: wrap it in `<Locked reason="…">`, don't just disable it.
- Don't show a value you don't have: leave it out (it renders as —) rather than guess. An estimate is labelled as one.
- Nothing is pre-selected in a decision a person makes, and the agent is named from your app's data, never from model output.
- Your app's words go in `LocaleProvider` (fixed strings) and `TermsProvider` (nouns); entity kinds and agent roles in `EntityKindsProvider` and `AgentRolesProvider`.
