# CopilotPrimitives

## 2026-06-17 — CopilotThinkingSteps is now collapsible (Claude/GPT style)

**Prompted by:** Hellen (collapse to a summary; expand via chevron to see steps)

### What changed
- `CopilotThinkingSteps` now renders a collapsed one-line summary by default with a chevron; clicking expands the full reasoning trace (completed steps + current). New props: `summary`, `isThinking` (default true), `defaultExpanded` (default false).
- While `isThinking`, the summary tracks the live step and the last step animates; once done, it collapses to "Thought process" (overridable via `summary`).

### Why
- Matches the familiar Claude/Gemini/GPT thinking UX — a compact summary that the broker can expand on demand instead of a permanently-visible step list.

### Affected tokens / files
- `packages/shadcn/src/components/ui/copilot-primitives.tsx`

## 2026-06-17 — Add CopilotThinkingSteps (shared agent reasoning indicator)

**Prompted by:** Hellen (the agent-thinking pattern existed but only privately)

### What changed
- New atom `CopilotThinkingSteps` surfaces the agent's reasoning steps (square bouncing dots + the in-progress step; earlier steps shown completed). Ports the previously-private `PolicyAIThinkingSteps` pattern into a shared, exported component.
- `CopilotPanel`'s `thinking` thread item now renders this (steps[]) instead of a single shimmer label.

### Why
- The library had four duplicate thinking indicators, only `ChatWidgetTypingIndicator` exported. The richest (reasoning steps) was locked inside policy-ai. This makes it reusable and gives the Copilot a proper agent-thinking display.

### Affected tokens / files
- `packages/shadcn/src/components/ui/copilot-primitives.tsx`
- Follow-up: policy-ai / support-agent / ai-assistant-drawer could migrate their private copies to this shared component.

## 2026-06-17 — Compose DS primitives (Alert + Chip) instead of raw markup

**Prompted by:** Hellen (review: reuse published components, don't hand-roll)

### What changed
- `CopilotErrorMessage` now renders via `Alert variant="destructive"` + `AlertTitle` / `AlertDescription` (was a hand-styled div).
- `CopilotRateLimitMessage` now renders via `Alert variant="warning"`.
- `CopilotSourceCitation` chips now render via `Chip variant="outline"` (was hand-styled span/button); interactive chips add `role="button"` + keyboard handling.

### Why
- Inherit the design system's variants, tokens, contrast and sharp-corner rules from `Alert`/`Chip`/`Badge` instead of duplicating styling — consistency + less drift.

### Affected tokens / files
- `packages/shadcn/src/components/ui/copilot-primitives.tsx`

## 2026-06-17 — New response atoms for the broker Copilot extension

**Prompted by:** Copilot extension design work (Hellen)

### What changed
- New atom file `copilot-primitives.tsx` with three display-only response atoms:
  - `CopilotErrorMessage` — failed response with optional detail + Retry action.
  - `CopilotRateLimitMessage` — usage/quota exhausted, with optional reset hint + upgrade action.
  - `CopilotSourceCitation` — "Based on:" chips citing WealthX data sources (contact / deal / document / appointment), optionally clickable.

### Why
- The broker Copilot extension needs distinct, well-styled renderers for each AI "response case" — error, quota, and source attribution — that the existing plain-text chat bubbles did not cover.

### Affected tokens / files
- `packages/shadcn/src/components/ui/copilot-primitives.tsx`
- Destructive tokens (`destructive/10`, `destructive/30`) for the error state; neutral `muted` surface for rate-limit.
