# Ticket 5.9 — Session Summarisation

**Phase**: 5 — OpenCode-Specific Features
**Priority**: Low
**Depends on**: 2.3

## Description

Allow users to generate an AI-powered summary of a session. Uses OpenCode's `POST /session/:id/summarize` endpoint. Useful for getting a quick overview of long conversations.

## Acceptance Criteria

### AC1: Summarise button on sessions

```gherkin
Given a session with more than 10 messages
When the user clicks "Summarise" in the session menu
Then it calls POST /session/:id/summarize
And displays the summary in a modal or inline card
```

### AC2: Summary content

```gherkin
Given the summary is generated
Then it shows:
  - A concise text summary of the conversation
  - Key decisions made
  - Files modified (if any)
  - Number of tool invocations
```

### AC3: Loading state

```gherkin
When the summary is being generated
Then a loading indicator appears
And the button is disabled until complete
```

## Testable Components

| Component | Test Type | What to Assert |
|-----------|-----------|----------------|
| Summarise API call | Unit | Constructs correct POST to /session/:id/summarize with optional { providerID, modelID } body |
| Summary rendering | E2E | Summary text displays in modal/card |
| Loading state | E2E | Loading indicator shown while summarising, button disabled |

## Reference

- OpenCode summarise: `POST /session/:id/summarize` (accepts optional `{ providerID, modelID }` body)
- REST client method: `summarizeSession(id, opts)` from ticket 1.4
