Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
## Install packages

```bash
npm install @threadplane/chat @threadplane/ag-ui @ag-ui/client
npm install @threadplane/chat @threadplane/ag-ui @ag-ui/client @ag-ui/core
```

`@threadplane/chat` provides the chat UI primitives. `@threadplane/ag-ui` provides the adapter that wires an AG-UI backend into the `Agent` contract those primitives consume.
Expand All @@ -21,9 +21,9 @@ npm install @threadplane/chat @threadplane/ag-ui @ag-ui/client
| Package | Version |
|---|---|
| `@threadplane/chat` | `*` |
| `@threadplane/licensing` | `*` |
| `@angular/core` | `^20.0.0 \|\| ^21.0.0` |
| `@ag-ui/client` | `*` |
| `@ag-ui/core` | `*` |
| `rxjs` | `~7.8.0` |

## Configure the provider
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Want to see the finished result before you build? Open the live [AG-UI demo](htt
<Step title="Install the packages">

```bash
npm install @threadplane/chat @threadplane/ag-ui @ag-ui/client
npm install @threadplane/chat @threadplane/ag-ui @ag-ui/client @ag-ui/core
```

</Step>
Expand Down Expand Up @@ -77,7 +77,7 @@ So swapping backends is a one-line change in `app.config.ts`, and the component

```diff
- import { provideAgent } from '@threadplane/langgraph';
- providers: [provideAgent({ apiUrl: '...' })], // LangGraph
- providers: [provideAgent({ apiUrl: '...', assistantId: '...' })], // LangGraph
+ import { provideAgent } from '@threadplane/ag-ui';
+ providers: [provideAgent({ url: '...' })], // AG-UI
```
Expand Down
2 changes: 1 addition & 1 deletion apps/website/content/docs/ag-ui/guides/interrupts.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ decision = interrupt({
`injectAgent()` exposes a `interrupt()` signal that is populated whenever the adapter receives an `on_interrupt` CUSTOM event. Pair it with `<chat-approval-card>` from `@threadplane/chat` to render an approval dialog without manual event wiring:

```typescript
import { Component } from '@angular/core';
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { ChatComponent, ChatApprovalCardComponent } from '@threadplane/chat';
import { injectAgent } from '@threadplane/ag-ui';
import type { ChatApprovalAction } from '@threadplane/chat';
Expand Down
26 changes: 7 additions & 19 deletions apps/website/content/docs/chat/a2ui/surface-component.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ The `events` output forwards all `RenderEvent` emissions from the render engine.

**1. Convert surface to Spec (`surfaceToSpec`)**

The `surfaceToSpec()` function walks the flat component map and produces a json-render `Spec`. It requires a component with `id: 'root'` to be present — if no root exists, nothing renders.
The internal surface-to-spec conversion walks the flat component map and produces a json-render `Spec`. It uses a component with `id: 'root'` when present; otherwise it uses the first component in the map as the render root. Empty component maps render nothing.

**2. Resolve dynamic values**

Expand All @@ -52,7 +52,7 @@ Before the spec is emitted, each component prop is evaluated against the surface

**3. Map actions to `on` bindings**

`surfaceToSpec()` converts each component's A2UI `action` prop into a render-spec `on` binding on the corresponding element. Event actions map to the `a2ui:event` handler, and function call actions map to the `a2ui:localAction` handler. This bridges the A2UI interaction model to the render-lib event system.
The internal conversion maps each component's A2UI `action` prop into a render-spec `on` binding on the corresponding element. Event actions map to the `a2ui:event` handler, and function call actions map to the `a2ui:localAction` handler. This bridges the A2UI interaction model to the render-lib event system.

**4. Expand template children**

Expand Down Expand Up @@ -94,8 +94,8 @@ export class AgentPanelComponent {
}
```

<Callout type="info" title="Root component required">
The surface must contain a component with `id: 'root'`. If no root component has been received yet (for example, while the agent is still streaming), `A2uiSurfaceComponent` renders nothing until one arrives.
<Callout type="info" title="Root component selection">
`A2uiSurfaceComponent` prefers a component with `id: 'root'` when one exists. If the surface has components but no `root`, it renders from the first component ID. Empty component maps render nothing.
</Callout>

### Wiring handlers and actions
Expand Down Expand Up @@ -149,23 +149,11 @@ export class InteractiveSurfaceComponent {
}
```

## surfaceToSpec()
## Internal conversion

The conversion function is exported for testing or custom rendering pipelines.
`A2uiSurfaceComponent` handles surface-to-spec conversion internally when it receives a legacy `surface` input. That conversion returns no rendered output for an empty component map. Otherwise it produces a complete json-render `Spec`, preferring a `root` component when present and falling back to the first component ID.

**Import:**

```typescript
import { surfaceToSpec } from '@threadplane/chat';
```

**Signature:**

```typescript
function surfaceToSpec(surface: A2uiSurface): Spec | null
```

Returns `null` when the surface has no `root` component. Otherwise returns a complete json-render `Spec` with all dynamic values resolved against the current `dataModel`.
The conversion helper is not part of the public `@threadplane/chat` API. Use `A2uiSurfaceComponent` or `createA2uiSurfaceStore()` for supported integration points.

## What's Next

Expand Down
2 changes: 1 addition & 1 deletion apps/website/content/docs/chat/api/provide-chat.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ import { provideChat } from '@threadplane/chat';

export const appConfig: ApplicationConfig = {
providers: [
provideAgent({ apiUrl: 'http://localhost:2024' }),
provideAgent({ apiUrl: 'http://localhost:2024', assistantId: 'chat' }),
provideChat({
avatarLabel: 'B',
assistantName: 'Bot',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ npm install @threadplane/chat @threadplane/ag-ui marked
`marked` is a required peer dependency used to render assistant message markdown (code blocks, tables, headings). The chat components ship with their own design tokens and component-scoped styles — no Tailwind, PostCSS, or global stylesheet import is required.

<Callout type="info" title="Full peer dependency list">
`@threadplane/chat` declares peers on `@angular/core`, `@angular/common`, `@angular/forms`, `@angular/platform-browser` (all `^20.0.0 || ^21.0.0`), plus `@threadplane/licensing`, `@threadplane/render`, `@threadplane/a2ui`, `@json-render/core` (`^0.16.0`), `@langchain/core` (`^1.1.33`), `rxjs` (`~7.8.0`), and `marked` (`^15 || ^16`). npm 7+ installs all of these automatically.
`@threadplane/chat` declares peers on `@angular/core`, `@angular/common`, `@angular/platform-browser`, `@angular/router` (all `^20.0.0 || ^21.0.0`), plus `@threadplane/licensing`, `@threadplane/render`, `@threadplane/a2ui`, `@json-render/core` (`^0.16.0`), `@langchain/core` (`^1.1.33`), `rxjs` (`~7.8.0`), `marked` (`^15 || ^16`), `zod` (`^3.25.0`), and optional `katex` (`^0.16.0 || ^0.17.0`). npm 7+ installs all required peers automatically.
</Callout>

## 2. Add your license token
Expand Down
4 changes: 2 additions & 2 deletions apps/website/content/docs/chat/getting-started/quickstart.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ Evaluating? No license needed — the chat runs without a token (with a one-time
<Step title="Install the package">

```bash
npm install @threadplane/chat marked
npm install @threadplane/chat @threadplane/langgraph marked
```

`marked` is the markdown renderer used for assistant messages.
`@threadplane/langgraph` provides the adapter used by the provider snippet below. `marked` is the markdown renderer used for assistant messages.

</Step>
<Step title="Configure providers">
Expand Down
Loading
Loading