# @aleph-alpha/chat-kit

Chat kit for building chat interfaces with Vue. Ships components, handlers (message tree via `useMessageHandler`, markdown, labels — from the package root or `@aleph-alpha/chat-kit/handlers`), a composables entry for `useChat` _(under development)_, and a services layer for backends _(under development)_.

> Part of the [frontend-hub](https://github.com/Aleph-Alpha/frontend-hub) monorepo.

## Installation

```bash
pnpm add @aleph-alpha/chat-kit
```

## Architecture

Chat Kit is organised into **three layers**:

1. **Components** — Pre-built Vue 3 components for chat UIs, split into **base** (presentational) and **composed** (opinionated patterns).
2. **Handlers** — Reactive utilities for chat state management: `useMessageHandler` (conversation tree), `useMarkdownParser` (markdown pipeline), `useChatKitLabels` (i18n).
3. **Services** _(under development)_ — Abstract `ChatService` / `IChatService` for backend communication and streaming. Not ready for production use.

`useChat` _(under development)_ lives in `composables/` as a planned high-level orchestrator that composes handlers and services into a single API

## Usage

Import from specific entry points for tree-shaking:

```typescript
// Services only
import { ChatService, type IChatService } from '@aleph-alpha/chat-kit/services';

// Handlers only
import { useMessageHandler } from '@aleph-alpha/chat-kit/handlers';

// Composables only
import { useChat } from '@aleph-alpha/chat-kit/composables';

// Components only
import { CkConversation } from '@aleph-alpha/chat-kit/components';

// Everything
import { ChatService, useChat, CkConversation } from '@aleph-alpha/chat-kit';
```

## Development

This package lives in the `frontend-hub` monorepo. To work on it locally:

```bash
git clone git@github.com:Aleph-Alpha/frontend-hub.git
cd frontend-hub
pnpm install

# Run tests
pnpm nx run chat-kit:test

# Lint
pnpm nx run chat-kit:lint

# Storybook
pnpm nx run chat-kit:storybook
```

## Documentation

- [Overview](./docs/overview.md) — Architecture and features
- [Quick Start](./docs/quick-start.md) — Install and minimal chat UI
- [Handlers and Services](./docs/handlers-and-services.md) — Message state, markdown, labels, services
- [API Reference](./docs/reference.md) — Public exports (components, handlers, composables, services, types)
- [CI/CD Flow](../../.github/documentation/GITHUB_CI_FLOW.md) — Release process and PR checks
- [Storybook Deployment](../../.github/documentation/STORYBOOK_DEPLOYMENT.md) — Preview and production Storybook

## License

MIT.
