@cerebriline/ui 0.0.0-stage → 4.100.313
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ADOPTION.md +833 -0
- package/LICENSE +201 -0
- package/RADIX-COLORS-LICENSE +21 -0
- package/README.md +427 -2
- package/components/agent-approval-card.css +70 -0
- package/components/agent-approval-card.tsx +109 -0
- package/components/agent-ask-question.css +103 -0
- package/components/agent-ask-question.tsx +276 -0
- package/components/agent-aurora.css +228 -0
- package/components/agent-aurora.tsx +96 -0
- package/components/agent-changes.css +13 -0
- package/components/agent-changes.tsx +167 -0
- package/components/agent-chat/agent-chat.css +556 -0
- package/components/agent-chat/index.tsx +1037 -0
- package/components/agent-chat/tool-diff.tsx +165 -0
- package/components/agent-chat/tool-summary/agents.ts +114 -0
- package/components/agent-chat/tool-summary/diff.ts +152 -0
- package/components/agent-chat/tool-summary/index.ts +928 -0
- package/components/agent-chat/tool-summary/parsers.ts +611 -0
- package/components/agent-chat/tool-summary/paths.ts +84 -0
- package/components/agent-chat/tool-summary/team.ts +401 -0
- package/components/agent-command-output.tsx +63 -0
- package/components/agent-composer.tsx +263 -0
- package/components/agent-context-usage.tsx +181 -0
- package/components/agent-conversation-layout.tsx +139 -0
- package/components/agent-hero-heading.css +53 -0
- package/components/agent-hero-heading.tsx +45 -0
- package/components/agent-image-lightbox.tsx +48 -0
- package/components/agent-prompt-queue.css +20 -0
- package/components/agent-prompt-queue.tsx +350 -0
- package/components/agent-pull-request-bar.css +13 -0
- package/components/agent-pull-request-bar.tsx +346 -0
- package/components/agent-quick-actions.css +19 -0
- package/components/agent-quick-actions.tsx +70 -0
- package/components/agent-session-row.tsx +183 -0
- package/components/agent-welcome-hero-pointer.ts +199 -0
- package/components/agent-welcome-hero.css +205 -0
- package/components/agent-welcome-hero.tsx +68 -0
- package/components/attachment-drop-zone.tsx +154 -0
- package/components/badge.tsx +21 -0
- package/components/button.tsx +324 -0
- package/components/generated-media.tsx +173 -0
- package/components/github-icon.tsx +19 -0
- package/components/index.ts +133 -0
- package/components/markdown.css +490 -0
- package/components/markdown.ts +365 -0
- package/components/mermaid-block.tsx +722 -0
- package/components/mermaid-diagram.ts +1260 -0
- package/components/mermaid-dom.ts +301 -0
- package/components/message-scroller.css +118 -0
- package/components/message-scroller.tsx +114 -0
- package/components/search-combobox.css +67 -0
- package/components/search-combobox.tsx +433 -0
- package/components/session-status.css +19 -0
- package/components/session-status.tsx +39 -0
- package/components/switch.css +221 -0
- package/components/switch.tsx +48 -0
- package/components.css +16 -0
- package/dist/components/agent-approval-card.d.ts +14 -0
- package/dist/components/agent-approval-card.d.ts.map +1 -0
- package/dist/components/agent-approval-card.js +12 -0
- package/dist/components/agent-approval-card.js.map +1 -0
- package/dist/components/agent-ask-question.d.ts +18 -0
- package/dist/components/agent-ask-question.d.ts.map +1 -0
- package/dist/components/agent-ask-question.js +101 -0
- package/dist/components/agent-ask-question.js.map +1 -0
- package/dist/components/agent-aurora.d.ts +3 -0
- package/dist/components/agent-aurora.d.ts.map +1 -0
- package/dist/components/agent-aurora.js +60 -0
- package/dist/components/agent-aurora.js.map +1 -0
- package/dist/components/agent-changes.d.ts +26 -0
- package/dist/components/agent-changes.d.ts.map +1 -0
- package/dist/components/agent-changes.js +19 -0
- package/dist/components/agent-changes.js.map +1 -0
- package/dist/components/agent-chat/disclosure.d.ts +25 -0
- package/dist/components/agent-chat/disclosure.d.ts.map +1 -0
- package/dist/components/agent-chat/disclosure.js +39 -0
- package/dist/components/agent-chat/disclosure.js.map +1 -0
- package/dist/components/agent-chat/index.d.ts +140 -0
- package/dist/components/agent-chat/index.d.ts.map +1 -0
- package/dist/components/agent-chat/index.js +379 -0
- package/dist/components/agent-chat/index.js.map +1 -0
- package/dist/components/agent-chat/tool-diff.d.ts +32 -0
- package/dist/components/agent-chat/tool-diff.d.ts.map +1 -0
- package/dist/components/agent-chat/tool-diff.js +97 -0
- package/dist/components/agent-chat/tool-diff.js.map +1 -0
- package/dist/components/agent-chat/tool-summary/agents.d.ts +10 -0
- package/dist/components/agent-chat/tool-summary/agents.d.ts.map +1 -0
- package/dist/components/agent-chat/tool-summary/agents.js +100 -0
- package/dist/components/agent-chat/tool-summary/agents.js.map +1 -0
- package/dist/components/agent-chat/tool-summary/diff.d.ts +22 -0
- package/dist/components/agent-chat/tool-summary/diff.d.ts.map +1 -0
- package/dist/components/agent-chat/tool-summary/diff.js +127 -0
- package/dist/components/agent-chat/tool-summary/diff.js.map +1 -0
- package/dist/components/agent-chat/tool-summary/index.d.ts +145 -0
- package/dist/components/agent-chat/tool-summary/index.d.ts.map +1 -0
- package/dist/components/agent-chat/tool-summary/index.js +663 -0
- package/dist/components/agent-chat/tool-summary/index.js.map +1 -0
- package/dist/components/agent-chat/tool-summary/parsers.d.ts +114 -0
- package/dist/components/agent-chat/tool-summary/parsers.d.ts.map +1 -0
- package/dist/components/agent-chat/tool-summary/parsers.js +502 -0
- package/dist/components/agent-chat/tool-summary/parsers.js.map +1 -0
- package/dist/components/agent-chat/tool-summary/paths.d.ts +10 -0
- package/dist/components/agent-chat/tool-summary/paths.d.ts.map +1 -0
- package/dist/components/agent-chat/tool-summary/paths.js +88 -0
- package/dist/components/agent-chat/tool-summary/paths.js.map +1 -0
- package/dist/components/agent-chat/tool-summary/team.d.ts +16 -0
- package/dist/components/agent-chat/tool-summary/team.d.ts.map +1 -0
- package/dist/components/agent-chat/tool-summary/team.js +283 -0
- package/dist/components/agent-chat/tool-summary/team.js.map +1 -0
- package/dist/components/agent-command-output.d.ts +14 -0
- package/dist/components/agent-command-output.d.ts.map +1 -0
- package/dist/components/agent-command-output.js +22 -0
- package/dist/components/agent-command-output.js.map +1 -0
- package/dist/components/agent-composer.d.ts +34 -0
- package/dist/components/agent-composer.d.ts.map +1 -0
- package/dist/components/agent-composer.js +65 -0
- package/dist/components/agent-composer.js.map +1 -0
- package/dist/components/agent-context-usage.d.ts +28 -0
- package/dist/components/agent-context-usage.d.ts.map +1 -0
- package/dist/components/agent-context-usage.js +51 -0
- package/dist/components/agent-context-usage.js.map +1 -0
- package/dist/components/agent-conversation-layout.d.ts +30 -0
- package/dist/components/agent-conversation-layout.d.ts.map +1 -0
- package/dist/components/agent-conversation-layout.js +24 -0
- package/dist/components/agent-conversation-layout.js.map +1 -0
- package/dist/components/agent-hero-heading.d.ts +2 -0
- package/dist/components/agent-hero-heading.d.ts.map +1 -0
- package/dist/components/agent-hero-heading.js +20 -0
- package/dist/components/agent-hero-heading.js.map +1 -0
- package/dist/components/agent-image-lightbox.d.ts +11 -0
- package/dist/components/agent-image-lightbox.d.ts.map +1 -0
- package/dist/components/agent-image-lightbox.js +8 -0
- package/dist/components/agent-image-lightbox.js.map +1 -0
- package/dist/components/agent-prompt-queue.d.ts +14 -0
- package/dist/components/agent-prompt-queue.d.ts.map +1 -0
- package/dist/components/agent-prompt-queue.js +114 -0
- package/dist/components/agent-prompt-queue.js.map +1 -0
- package/dist/components/agent-pull-request-bar.d.ts +72 -0
- package/dist/components/agent-pull-request-bar.d.ts.map +1 -0
- package/dist/components/agent-pull-request-bar.js +90 -0
- package/dist/components/agent-pull-request-bar.js.map +1 -0
- package/dist/components/agent-quick-actions.d.ts +14 -0
- package/dist/components/agent-quick-actions.d.ts.map +1 -0
- package/dist/components/agent-quick-actions.js +12 -0
- package/dist/components/agent-quick-actions.js.map +1 -0
- package/dist/components/agent-session-row.d.ts +45 -0
- package/dist/components/agent-session-row.d.ts.map +1 -0
- package/dist/components/agent-session-row.js +34 -0
- package/dist/components/agent-session-row.js.map +1 -0
- package/dist/components/agent-welcome-hero-pointer.d.ts +3 -0
- package/dist/components/agent-welcome-hero-pointer.d.ts.map +1 -0
- package/dist/components/agent-welcome-hero-pointer.js +169 -0
- package/dist/components/agent-welcome-hero-pointer.js.map +1 -0
- package/dist/components/agent-welcome-hero.d.ts +9 -0
- package/dist/components/agent-welcome-hero.d.ts.map +1 -0
- package/dist/components/agent-welcome-hero.js +14 -0
- package/dist/components/agent-welcome-hero.js.map +1 -0
- package/dist/components/attachment-drop-zone.d.ts +15 -0
- package/dist/components/attachment-drop-zone.d.ts.map +1 -0
- package/dist/components/attachment-drop-zone.js +64 -0
- package/dist/components/attachment-drop-zone.js.map +1 -0
- package/dist/components/badge.d.ts +5 -0
- package/dist/components/badge.d.ts.map +1 -0
- package/dist/components/badge.js +7 -0
- package/dist/components/badge.js.map +1 -0
- package/dist/components/button.d.ts +27 -0
- package/dist/components/button.d.ts.map +1 -0
- package/dist/components/button.js +209 -0
- package/dist/components/button.js.map +1 -0
- package/dist/components/generated-media.d.ts +12 -0
- package/dist/components/generated-media.d.ts.map +1 -0
- package/dist/components/generated-media.js +105 -0
- package/dist/components/generated-media.js.map +1 -0
- package/dist/components/github-icon.d.ts +3 -0
- package/dist/components/github-icon.d.ts.map +1 -0
- package/dist/components/github-icon.js +6 -0
- package/dist/components/github-icon.js.map +1 -0
- package/dist/components/index.d.ts +24 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +25 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/markdown.d.ts +48 -0
- package/dist/components/markdown.d.ts.map +1 -0
- package/dist/components/markdown.js +264 -0
- package/dist/components/markdown.js.map +1 -0
- package/dist/components/mermaid-block.d.ts +14 -0
- package/dist/components/mermaid-block.d.ts.map +1 -0
- package/dist/components/mermaid-block.js +339 -0
- package/dist/components/mermaid-block.js.map +1 -0
- package/dist/components/mermaid-diagram.d.ts +264 -0
- package/dist/components/mermaid-diagram.d.ts.map +1 -0
- package/dist/components/mermaid-diagram.js +999 -0
- package/dist/components/mermaid-diagram.js.map +1 -0
- package/dist/components/mermaid-dom.d.ts +51 -0
- package/dist/components/mermaid-dom.d.ts.map +1 -0
- package/dist/components/mermaid-dom.js +246 -0
- package/dist/components/mermaid-dom.js.map +1 -0
- package/dist/components/message-scroller.d.ts +23 -0
- package/dist/components/message-scroller.d.ts.map +1 -0
- package/dist/components/message-scroller.js +31 -0
- package/dist/components/message-scroller.js.map +1 -0
- package/dist/components/search-combobox.d.ts +44 -0
- package/dist/components/search-combobox.d.ts.map +1 -0
- package/dist/components/search-combobox.js +191 -0
- package/dist/components/search-combobox.js.map +1 -0
- package/dist/components/session-status.d.ts +9 -0
- package/dist/components/session-status.d.ts.map +1 -0
- package/dist/components/session-status.js +11 -0
- package/dist/components/session-status.js.map +1 -0
- package/dist/components/switch.d.ts +7 -0
- package/dist/components/switch.d.ts.map +1 -0
- package/dist/components/switch.js +14 -0
- package/dist/components/switch.js.map +1 -0
- package/package.json +177 -5
- package/theme/base.css +83 -0
- package/theme/component-theme.css +126 -0
- package/theme/index.css +3 -0
- package/theme/palette.css +347 -0
- package/theme/scoped-tokens.css +503 -0
- package/theme/theme.css +90 -0
- package/theme/tokens.css +165 -0
package/ADOPTION.md
ADDED
|
@@ -0,0 +1,833 @@
|
|
|
1
|
+
# `@cerebriline/ui` adoption primer
|
|
2
|
+
|
|
3
|
+
This guide is for Cline engineering teams that want a web application to share
|
|
4
|
+
the Cline visual language and agent-chat presentation without copying desktop
|
|
5
|
+
styles or adopting desktop product structure.
|
|
6
|
+
|
|
7
|
+
## The short version
|
|
8
|
+
|
|
9
|
+
`@cerebriline/ui` has two opt-in layers:
|
|
10
|
+
|
|
11
|
+
1. A shared CSS theme built around standard shadcn/Tailwind semantic names.
|
|
12
|
+
2. Reusable React presentation primitives for common agent-chat interfaces.
|
|
13
|
+
|
|
14
|
+
The theme provides:
|
|
15
|
+
|
|
16
|
+
- Cline-owned Slate, Violet, Ruby, Green, Amber, and Sky solid/alpha palettes
|
|
17
|
+
- Light and dark semantic colors
|
|
18
|
+
- Standard shadcn token names
|
|
19
|
+
- Typography families, sizes, weights, line heights, and letter spacing
|
|
20
|
+
- Borders, radii, cards, navigation, sidebar, and chart colors
|
|
21
|
+
- Selection and scrollbar values
|
|
22
|
+
- A small brand palette for artwork
|
|
23
|
+
- Tailwind v4 mappings
|
|
24
|
+
- Optional global, interaction, and Markdown styles
|
|
25
|
+
|
|
26
|
+
The first component surface provides:
|
|
27
|
+
|
|
28
|
+
- Sticky agent-conversation structure and a scroll-to-latest affordance
|
|
29
|
+
- User, assistant, system, status, and error message presentation
|
|
30
|
+
- Message actions with accessible labels and focus behavior
|
|
31
|
+
- Controlled or uncontrolled reasoning disclosures
|
|
32
|
+
- Static or expandable tool activity with running, success, and error states
|
|
33
|
+
- Empty-conversation presentation
|
|
34
|
+
|
|
35
|
+
Each application continues to own:
|
|
36
|
+
|
|
37
|
+
- Runtime message and tool schemas
|
|
38
|
+
- Session, provider, transport, streaming, and persistence behavior
|
|
39
|
+
- Markdown rendering and external-link/image policy
|
|
40
|
+
- Approval and follow-up-question orchestration
|
|
41
|
+
- Checkpoint, fork, clipboard, and toast behavior
|
|
42
|
+
- Page layouts, navigation, and product workflows
|
|
43
|
+
- Font-file loading and framework integration
|
|
44
|
+
- Product-specific animation and deliberate visual overrides
|
|
45
|
+
|
|
46
|
+
This boundary gives Cline products a shared visual and interaction language
|
|
47
|
+
without turning `@cerebriline/ui` into a second agent runtime.
|
|
48
|
+
|
|
49
|
+
The boundary is about runtime coupling, not about keeping the package small.
|
|
50
|
+
When more than one product needs the same presentation behavior, the goal is
|
|
51
|
+
to extract it here as a shared module rather than let each app grow its own
|
|
52
|
+
copy — that is the direction `@cerebriline/ui` is headed, and more shared modules
|
|
53
|
+
are expected over time. Two exist today:
|
|
54
|
+
|
|
55
|
+
- `@cerebriline/ui/components/agent-chat/tool-summary` — pure, framework-free
|
|
56
|
+
functions (`buildToolSummary`, `buildGroupedToolLabel`, and the underlying
|
|
57
|
+
parsers) that turn a raw `{ toolName, input, result }` payload into the
|
|
58
|
+
labels, per-item details, diff counts, and before/after texts every surface
|
|
59
|
+
should show. `unknown` in, data out — no React, no icons, no dependency on
|
|
60
|
+
`@cerebriline/core` or transport events.
|
|
61
|
+
- `@cerebriline/ui/components/agent-chat/tool-diff` — `ToolFileDiff`, a thin
|
|
62
|
+
wrapper over [`@pierre/diffs`](https://github.com/pierrecomputer/pierre)
|
|
63
|
+
(optional peer dependency) that renders a tool-summary file item as a
|
|
64
|
+
syntax-highlighted, theme-aware diff with consistent defaults.
|
|
65
|
+
|
|
66
|
+
Shared modules like these keep read/edit/command rows identical across
|
|
67
|
+
products while consumers still own their message schemas, icon assets, and
|
|
68
|
+
overall rendering. Before hand-rolling presentation logic in an app, check
|
|
69
|
+
whether it belongs here instead.
|
|
70
|
+
|
|
71
|
+
`AgentChangesPanel` and `AgentChangedFile` share the Changes pane header,
|
|
72
|
+
scrolling, file disclosure, path, copy feedback, and diff counts. Pass rendered
|
|
73
|
+
diff children and clipboard/native-editor callbacks; each host retains its
|
|
74
|
+
change collector, workspace paths, and conversation focus restoration.
|
|
75
|
+
|
|
76
|
+
`AgentPullRequestBar` shares PR state, merge readiness, diff counts, and check
|
|
77
|
+
presentation. Hosts provide normalized data, refresh/navigation callbacks,
|
|
78
|
+
and their accessible checks popover through `renderChecks`. Fetching, polling,
|
|
79
|
+
authentication, and telemetry stay in the host. Import these components from
|
|
80
|
+
`@cerebriline/ui` and their styles through the existing `@cerebriline/ui/components.css`.
|
|
81
|
+
|
|
82
|
+
`AgentCommandOutput` shares the desktop terminal frame and follow-output scrolling.
|
|
83
|
+
Pass ANSI-rendered or normalized output as children; transport and output limits
|
|
84
|
+
stay in the host. `AgentImageLightboxContent` shares the expanded image, backdrop
|
|
85
|
+
close action, and close control; hosts retain their dialog, focus, keyboard, and
|
|
86
|
+
image navigation. Import both from `@cerebriline/ui` with `@cerebriline/ui/components.css`.
|
|
87
|
+
|
|
88
|
+
## Current status
|
|
89
|
+
|
|
90
|
+
`@cerebriline/ui` is configured for public npm publication with its own version and
|
|
91
|
+
manual release workflow. Check availability with `npm view @cerebriline/ui version`;
|
|
92
|
+
an `E404` means the first release is still pending. The API is pre-stable, so
|
|
93
|
+
production consumers should pin exact versions and review compatibility notes
|
|
94
|
+
when updating.
|
|
95
|
+
|
|
96
|
+
Desktop is the first production-shaped consumer of both the theme and shared
|
|
97
|
+
chat primitives. Storybook is the reference catalog for isolated component
|
|
98
|
+
states. Hub and other agent interfaces are candidates for the next adoption
|
|
99
|
+
pass once their runtime and Markdown adapters are mapped explicitly.
|
|
100
|
+
|
|
101
|
+
## Choose an adoption level
|
|
102
|
+
|
|
103
|
+
| Goal | Import | Tailwind required | React required |
|
|
104
|
+
| --- | --- | --- | --- |
|
|
105
|
+
| Use only light/dark CSS variables | `@cerebriline/ui/theme/tokens.css` | No | No |
|
|
106
|
+
| Render shared root React primitives without host resets | `scoped-tokens.css`, `components.css`, and `@cerebriline/ui` | Tailwind v4 | React 18.3 or 19 |
|
|
107
|
+
| Use tokens through Tailwind utilities | `tokens.css` then `theme.css` | Tailwind v4 | No |
|
|
108
|
+
| Use the complete theme and shared base behavior | `@cerebriline/ui/theme/index.css` | Tailwind v4 | No |
|
|
109
|
+
| Compose shared agent-chat presentation | `@cerebriline/ui/components/agent-chat` plus its CSS | No, if tokens are mapped in plain CSS | React 18.3 or 19 |
|
|
110
|
+
|
|
111
|
+
The package exports `base.css` separately for consumers that want its global,
|
|
112
|
+
Markdown, scrollbar, selection, cursor, and native `color-scheme` behavior.
|
|
113
|
+
|
|
114
|
+
There is no `@cerebriline/ui/theme` shorthand. Use the explicit paths documented here
|
|
115
|
+
so dependencies remain visible.
|
|
116
|
+
|
|
117
|
+
## Install inside the Cline monorepo
|
|
118
|
+
|
|
119
|
+
Add the workspace dependency:
|
|
120
|
+
|
|
121
|
+
```json
|
|
122
|
+
{
|
|
123
|
+
"dependencies": {
|
|
124
|
+
"@cerebriline/ui": "workspace:*"
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Run the repository's normal package installation workflow after updating the
|
|
130
|
+
manifest and lockfile.
|
|
131
|
+
|
|
132
|
+
## Install from npm in another repository
|
|
133
|
+
|
|
134
|
+
After the initial release is available, install the latest production UI
|
|
135
|
+
release. The `--exact` flag records the resolved version instead of a range:
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
bun add --exact @cerebriline/ui
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
The package is ESM. Its React entry point targets browser applications. Install
|
|
142
|
+
only the prerequisites for the layer being adopted:
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
# Required for React components
|
|
146
|
+
bun add react@^19 react-dom@^19
|
|
147
|
+
|
|
148
|
+
# Required for the documented Tailwind-backed theme and Cline fonts
|
|
149
|
+
bun add @fontsource-variable/inter @fontsource-variable/geist-mono
|
|
150
|
+
bun add --dev tailwindcss
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
Applications already on React 18.3 can retain that compatible version.
|
|
154
|
+
Tokens-only consumers do not need React or Tailwind.
|
|
155
|
+
|
|
156
|
+
Commit the consuming repository's lockfile so builds continue using the same
|
|
157
|
+
resolved version. Use the package manager's update command when the team
|
|
158
|
+
intentionally wants to move to a newer release:
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
bun update @cerebriline/ui
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
For deliberate previews, UI releases can publish an unstable `next` npm tag:
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
bun add --exact @cerebriline/ui@next
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
Do not use `next` for production applications. UI versions move independently
|
|
171
|
+
from the runtime SDK packages.
|
|
172
|
+
|
|
173
|
+
## Option 1: complete Tailwind v4 theme
|
|
174
|
+
|
|
175
|
+
Import fonts and Tailwind before the complete theme:
|
|
176
|
+
|
|
177
|
+
```css
|
|
178
|
+
@import "@fontsource-variable/inter";
|
|
179
|
+
@import "@fontsource-variable/geist-mono";
|
|
180
|
+
@import "tailwindcss";
|
|
181
|
+
@import "@cerebriline/ui/theme/index.css";
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
This supplies:
|
|
185
|
+
|
|
186
|
+
- Framework-neutral token values
|
|
187
|
+
- Tailwind semantic mappings and dark variant
|
|
188
|
+
- Global typography and body styles
|
|
189
|
+
- Markdown and code-block styling
|
|
190
|
+
- Scrollbar and selection styling
|
|
191
|
+
- Consistent pointer affordances
|
|
192
|
+
- Native light/dark `color-scheme`
|
|
193
|
+
|
|
194
|
+
Application-specific CSS should follow these imports.
|
|
195
|
+
|
|
196
|
+
## Option 2: Tailwind mappings without base styles
|
|
197
|
+
|
|
198
|
+
Use this when the application wants the shared tokens and utilities but already
|
|
199
|
+
owns document, Markdown, scrollbar, or cursor behavior:
|
|
200
|
+
|
|
201
|
+
```css
|
|
202
|
+
@import "@fontsource-variable/inter";
|
|
203
|
+
@import "@fontsource-variable/geist-mono";
|
|
204
|
+
@import "tailwindcss";
|
|
205
|
+
@import "@cerebriline/ui/theme/tokens.css";
|
|
206
|
+
@import "@cerebriline/ui/theme/theme.css";
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
For an existing Tailwind v4 surface that must preserve its host shell, keep
|
|
210
|
+
Tailwind setup host-owned and add the scoped Cline imports:
|
|
211
|
+
|
|
212
|
+
```css
|
|
213
|
+
@import "@cerebriline/ui/theme/scoped-tokens.css";
|
|
214
|
+
@import "@cerebriline/ui/components.css";
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
Render shared components inside `.cline-ui-theme`. Dark values activate when
|
|
218
|
+
`.dark` is on that wrapper or an ancestor. `components.css` registers only
|
|
219
|
+
package-namespaced Tailwind mappings, so generic host utilities such as
|
|
220
|
+
`bg-background`, `text-foreground`, and `rounded-lg` retain their host-defined
|
|
221
|
+
meaning outside the wrapper.
|
|
222
|
+
|
|
223
|
+
Do not import `theme.css` for this scoped setup. That entry point deliberately
|
|
224
|
+
registers the complete, generic Cline utility vocabulary and is intended only
|
|
225
|
+
for applications that want Cline to own those utility names globally.
|
|
226
|
+
|
|
227
|
+
The root primitives use package-owned semantic color, typography, radius, and
|
|
228
|
+
dark-variant names. Structural utilities still use Tailwind's standard spacing,
|
|
229
|
+
shadow, and breakpoint scales; hosts that customize those scales may change
|
|
230
|
+
component metrics while their own utility names and token values remain intact.
|
|
231
|
+
|
|
232
|
+
If the application later opts into Cline's global utility vocabulary and base
|
|
233
|
+
behavior, switch to the complete theme setup in Option 1.
|
|
234
|
+
|
|
235
|
+
## Option 3: framework-neutral tokens
|
|
236
|
+
|
|
237
|
+
Applications without Tailwind can import only the variables:
|
|
238
|
+
|
|
239
|
+
```css
|
|
240
|
+
@import "@cerebriline/ui/theme/tokens.css";
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
Token-only consumers must provide:
|
|
244
|
+
|
|
245
|
+
- Font files
|
|
246
|
+
- Resets and document defaults
|
|
247
|
+
- Native `color-scheme`, if desired
|
|
248
|
+
- Their own mapping from CSS variables to framework utilities
|
|
249
|
+
- Their own dark-mode class activation
|
|
250
|
+
|
|
251
|
+
For native controls that should follow the selected theme:
|
|
252
|
+
|
|
253
|
+
```css
|
|
254
|
+
:root {
|
|
255
|
+
color-scheme: light;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
.dark {
|
|
259
|
+
color-scheme: dark;
|
|
260
|
+
}
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
## Switch
|
|
264
|
+
|
|
265
|
+
Import `Switch` from `@cerebriline/ui` after setting up the theme and
|
|
266
|
+
`@cerebriline/ui/components.css`.
|
|
267
|
+
|
|
268
|
+
```tsx
|
|
269
|
+
import { Switch } from "@cerebriline/ui";
|
|
270
|
+
|
|
271
|
+
<div className="flex items-center gap-2">
|
|
272
|
+
<Switch id="notifications" name="notifications" defaultChecked />
|
|
273
|
+
<label htmlFor="notifications">Enable notifications</label>
|
|
274
|
+
</div>;
|
|
275
|
+
|
|
276
|
+
// For application-owned state:
|
|
277
|
+
<Switch
|
|
278
|
+
aria-label="Enable notifications"
|
|
279
|
+
checked={notificationsEnabled}
|
|
280
|
+
onCheckedChange={setNotificationsEnabled}
|
|
281
|
+
/>;
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
Provide a visible label or an accessible name with `aria-label`. Keep the name
|
|
285
|
+
stable when toggling; the native checked state communicates whether the switch
|
|
286
|
+
is on. The control supports Space activation and label clicks.
|
|
287
|
+
|
|
288
|
+
Native input props, including `disabled`, `required`, `form`, `name`, `value`,
|
|
289
|
+
`onChange`, and accessible naming attributes, apply to the checkbox. Refs target
|
|
290
|
+
`HTMLInputElement`. `className`, `style`, and `hidden` apply to the outer wrapper;
|
|
291
|
+
`dir` applies to both the input and wrapper and supports RTL placement. Wrapper
|
|
292
|
+
layout defaults use the CSS components layer, so Tailwind utilities such as
|
|
293
|
+
`hidden`, `w-20`, and `h-10` can override them. Changing the wrapper dimensions
|
|
294
|
+
changes the hit area; the visual track keeps its own size.
|
|
295
|
+
|
|
296
|
+
Use `defaultChecked` for browser-owned state or `checked` with
|
|
297
|
+
`onCheckedChange` for controlled state. If both callbacks are supplied,
|
|
298
|
+
`onChange` runs first, then `onCheckedChange` receives the new boolean value.
|
|
299
|
+
Uncontrolled switches follow native form reset behavior; controlled switches
|
|
300
|
+
must be reset by their owner. Disabled switches, including those in disabled
|
|
301
|
+
fieldsets, are excluded from form submission.
|
|
302
|
+
|
|
303
|
+
The switch scales with the root font size and reserves a minimum 24px hit area
|
|
304
|
+
on each axis by default.
|
|
305
|
+
|
|
306
|
+
Checked tracks blend 80% `--primary` with 20% `--accent-8` and use
|
|
307
|
+
`--primary-emphasis` on hover; keyboard focus uses `--ring`. Enabled thumbs
|
|
308
|
+
remain white. The switch supports light/dark themes, system colors in
|
|
309
|
+
forced-colors mode, and reduced motion.
|
|
310
|
+
|
|
311
|
+
When migrating from the desktop's Radix wrapper, update button refs to
|
|
312
|
+
`HTMLInputElement` and read the native `checked` property in tests instead of
|
|
313
|
+
`aria-checked`. Continue using `checked` and `onCheckedChange` for controlled
|
|
314
|
+
state. Radix's `asChild`, children, and `data-state`/`data-disabled` hooks are not
|
|
315
|
+
provided. State selectors belong on the native input (`:checked`, `:disabled`,
|
|
316
|
+
`:focus-visible`); wrapper classes cannot use input-only pseudo-classes or act
|
|
317
|
+
as a checked `peer` for sibling labels. Use a visible label's `htmlFor` and the
|
|
318
|
+
input's `id` for association. Space toggles the switch; Enter follows native
|
|
319
|
+
checkbox behavior.
|
|
320
|
+
|
|
321
|
+
## Add the agent-chat components
|
|
322
|
+
|
|
323
|
+
With the complete Tailwind theme, import the component styles afterward:
|
|
324
|
+
|
|
325
|
+
```css
|
|
326
|
+
@import "@cerebriline/ui/theme/index.css";
|
|
327
|
+
@import "@cerebriline/ui/components/agent-chat.css";
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
Without Tailwind, import the framework-neutral tokens and component styles,
|
|
331
|
+
then apply the shared font family at an app or chat root (tokens define font
|
|
332
|
+
values but do not apply document typography):
|
|
333
|
+
|
|
334
|
+
```css
|
|
335
|
+
@import "@cerebriline/ui/theme/tokens.css";
|
|
336
|
+
@import "@cerebriline/ui/components/agent-chat.css";
|
|
337
|
+
|
|
338
|
+
.agent-chat-root {
|
|
339
|
+
font-family: var(--font-sans);
|
|
340
|
+
}
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
Then compose the presentation around the consuming application's own data:
|
|
344
|
+
|
|
345
|
+
```tsx
|
|
346
|
+
import type { ReactNode } from "react";
|
|
347
|
+
import {
|
|
348
|
+
type AgentMessageRole,
|
|
349
|
+
Conversation,
|
|
350
|
+
ConversationContent,
|
|
351
|
+
ConversationScrollButton,
|
|
352
|
+
ConversationViewport,
|
|
353
|
+
Message,
|
|
354
|
+
MessageActions,
|
|
355
|
+
MessageAction,
|
|
356
|
+
MessageContent,
|
|
357
|
+
Reasoning,
|
|
358
|
+
ReasoningContent,
|
|
359
|
+
ReasoningTrigger,
|
|
360
|
+
ToolActivity,
|
|
361
|
+
ToolActivityContent,
|
|
362
|
+
ToolActivityTrigger,
|
|
363
|
+
} from "@cerebriline/ui/components/agent-chat";
|
|
364
|
+
|
|
365
|
+
type ProductMessage = {
|
|
366
|
+
id: string;
|
|
367
|
+
role: "human" | "agent" | "system" | "error";
|
|
368
|
+
content: string;
|
|
369
|
+
reasoning?: string;
|
|
370
|
+
isStreaming?: boolean;
|
|
371
|
+
};
|
|
372
|
+
|
|
373
|
+
const roleMap: Record<ProductMessage["role"], AgentMessageRole> = {
|
|
374
|
+
human: "user",
|
|
375
|
+
agent: "assistant",
|
|
376
|
+
system: "system",
|
|
377
|
+
error: "error",
|
|
378
|
+
};
|
|
379
|
+
|
|
380
|
+
type AgentTranscriptProps = {
|
|
381
|
+
conversationId: string;
|
|
382
|
+
messages: ProductMessage[];
|
|
383
|
+
onCopy: (message: ProductMessage) => void;
|
|
384
|
+
renderMarkdown: (content: string) => ReactNode;
|
|
385
|
+
};
|
|
386
|
+
|
|
387
|
+
export function AgentTranscript({
|
|
388
|
+
conversationId,
|
|
389
|
+
messages,
|
|
390
|
+
onCopy,
|
|
391
|
+
renderMarkdown,
|
|
392
|
+
}: AgentTranscriptProps) {
|
|
393
|
+
return (
|
|
394
|
+
<Conversation
|
|
395
|
+
className="agent-chat-root"
|
|
396
|
+
key={conversationId}
|
|
397
|
+
style={{ height: "32rem" }}
|
|
398
|
+
>
|
|
399
|
+
<ConversationViewport aria-label="Agent conversation">
|
|
400
|
+
<ConversationContent>
|
|
401
|
+
{messages.map((message) => (
|
|
402
|
+
<Message from={roleMap[message.role]} key={message.id}>
|
|
403
|
+
<MessageContent>
|
|
404
|
+
{message.reasoning ? (
|
|
405
|
+
<Reasoning isStreaming={message.isStreaming}>
|
|
406
|
+
<ReasoningTrigger />
|
|
407
|
+
<ReasoningContent>
|
|
408
|
+
{renderMarkdown(message.reasoning)}
|
|
409
|
+
</ReasoningContent>
|
|
410
|
+
</Reasoning>
|
|
411
|
+
) : null}
|
|
412
|
+
|
|
413
|
+
{renderMarkdown(message.content)}
|
|
414
|
+
</MessageContent>
|
|
415
|
+
|
|
416
|
+
<MessageActions>
|
|
417
|
+
<MessageAction label="Copy message" onClick={() => onCopy(message)}>
|
|
418
|
+
Copy
|
|
419
|
+
</MessageAction>
|
|
420
|
+
</MessageActions>
|
|
421
|
+
</Message>
|
|
422
|
+
))}
|
|
423
|
+
|
|
424
|
+
<ToolActivity expandable>
|
|
425
|
+
<ToolActivityTrigger
|
|
426
|
+
label="Edited 2 files"
|
|
427
|
+
additions={24}
|
|
428
|
+
deletions={8}
|
|
429
|
+
status="success"
|
|
430
|
+
/>
|
|
431
|
+
<ToolActivityContent>Normalized tool details</ToolActivityContent>
|
|
432
|
+
</ToolActivity>
|
|
433
|
+
</ConversationContent>
|
|
434
|
+
</ConversationViewport>
|
|
435
|
+
<ConversationScrollButton />
|
|
436
|
+
</Conversation>
|
|
437
|
+
);
|
|
438
|
+
}
|
|
439
|
+
```
|
|
440
|
+
|
|
441
|
+
The explicit height keeps this standalone example scrollable. In a real shell,
|
|
442
|
+
an equivalent bounded flex layout works too: every ancestor in the height chain
|
|
443
|
+
must allow shrinking (commonly `min-height: 0`) and the conversation must fill
|
|
444
|
+
the available height.
|
|
445
|
+
|
|
446
|
+
The example intentionally injects a consumer-owned `renderMarkdown`. Different
|
|
447
|
+
products currently have different Streamdown plugins, syntax-highlighting
|
|
448
|
+
budgets, link-confirmation behavior, and image policies. The React `key` resets
|
|
449
|
+
conversation-local state when the active session changes. The shared package
|
|
450
|
+
standardizes the surrounding presentation without silently changing those
|
|
451
|
+
security and product decisions.
|
|
452
|
+
|
|
453
|
+
Map runtime roles and tool states at the consumer boundary. Do not make the UI
|
|
454
|
+
package depend on `@cerebriline/core`, the Vercel AI SDK, desktop schemas, or transport
|
|
455
|
+
events.
|
|
456
|
+
|
|
457
|
+
## Explore components in Storybook
|
|
458
|
+
|
|
459
|
+
From the Cline repository root:
|
|
460
|
+
|
|
461
|
+
```bash
|
|
462
|
+
bun -F @cerebriline/ui storybook
|
|
463
|
+
```
|
|
464
|
+
|
|
465
|
+
Open `http://localhost:6006`. The toolbar switches light/dark mode and offers
|
|
466
|
+
representative chat and mobile viewports. Stories cover:
|
|
467
|
+
|
|
468
|
+
- Theme colors, typography, radii, and controls
|
|
469
|
+
- Complete and empty conversations
|
|
470
|
+
- User, assistant, and error messages
|
|
471
|
+
- Collapsed, expanded, and streaming reasoning
|
|
472
|
+
- Pending, running, successful, and failed tool activity
|
|
473
|
+
- Expandable and static tool summaries
|
|
474
|
+
|
|
475
|
+
In the repository's agent sandbox, bind to a forwarded host and unused port:
|
|
476
|
+
|
|
477
|
+
```bash
|
|
478
|
+
bun -F @cerebriline/ui storybook -- --host 0.0.0.0 --port 3490 --exact-port
|
|
479
|
+
```
|
|
480
|
+
|
|
481
|
+
Build the production Storybook bundle with:
|
|
482
|
+
|
|
483
|
+
```bash
|
|
484
|
+
bun -F @cerebriline/ui build-storybook
|
|
485
|
+
```
|
|
486
|
+
|
|
487
|
+
Storybook is the isolated component reference. Real application builds remain
|
|
488
|
+
the integration test for runtime adapters and product CSS.
|
|
489
|
+
|
|
490
|
+
The catalog currently runs from a Cline monorepo checkout. Story sources and
|
|
491
|
+
configuration are not included in the npm package, and the catalog is not
|
|
492
|
+
hosted yet.
|
|
493
|
+
|
|
494
|
+
## Token usage
|
|
495
|
+
|
|
496
|
+
Product components should use semantic tokens:
|
|
497
|
+
|
|
498
|
+
```css
|
|
499
|
+
.card {
|
|
500
|
+
color: var(--card-foreground);
|
|
501
|
+
background: var(--card);
|
|
502
|
+
border-color: var(--border);
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
.primary-action {
|
|
506
|
+
color: var(--primary-foreground);
|
|
507
|
+
background: var(--primary);
|
|
508
|
+
}
|
|
509
|
+
```
|
|
510
|
+
|
|
511
|
+
Theme authors can tune the visual hierarchy without rewriting component
|
|
512
|
+
semantics:
|
|
513
|
+
|
|
514
|
+
```css
|
|
515
|
+
:root,
|
|
516
|
+
.dark {
|
|
517
|
+
--surface-1: var(--neutral-1);
|
|
518
|
+
--surface-2: var(--neutral-2);
|
|
519
|
+
--focus-ring: var(--accent-8);
|
|
520
|
+
}
|
|
521
|
+
```
|
|
522
|
+
|
|
523
|
+
Use the small `--brand-*` palette only for branded artwork. Normal controls
|
|
524
|
+
should prefer visual/status roles or shadcn semantic tokens so they continue to
|
|
525
|
+
work across light, dark, and future theme layers.
|
|
526
|
+
|
|
527
|
+
## Radius utilities
|
|
528
|
+
|
|
529
|
+
Use `rounded-cline-ui-lg` and other `rounded-cline-ui-*` theme sizes in
|
|
530
|
+
shared components. They use Cline's radius tokens without taking over the
|
|
531
|
+
host application's `rounded-lg` utility. Desktop's equivalent utilities
|
|
532
|
+
resolve to the same radius values. Keep structural shapes such as
|
|
533
|
+
`rounded-full` unchanged; there is no `rounded-cline-ui-full` token.
|
|
534
|
+
|
|
535
|
+
## Product overrides
|
|
536
|
+
|
|
537
|
+
Import the package first, then override standard semantic values:
|
|
538
|
+
|
|
539
|
+
```css
|
|
540
|
+
@import "@cerebriline/ui/theme/index.css";
|
|
541
|
+
|
|
542
|
+
:root {
|
|
543
|
+
--primary: /* product-specific value */;
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
.dark {
|
|
547
|
+
--primary: /* dark product-specific value */;
|
|
548
|
+
}
|
|
549
|
+
```
|
|
550
|
+
|
|
551
|
+
Do not copy `tokens.css` or component CSS into the consuming application.
|
|
552
|
+
Explicit overrides make product differences reviewable and allow future
|
|
553
|
+
package upgrades.
|
|
554
|
+
|
|
555
|
+
## Consumer-owned behavior
|
|
556
|
+
|
|
557
|
+
Keep the following outside `@cerebriline/ui`:
|
|
558
|
+
|
|
559
|
+
- Next, Tauri, VS Code, and runtime-specific behavior
|
|
560
|
+
- `#__next`, viewport locking, and shell layout
|
|
561
|
+
- Application routes and information architecture
|
|
562
|
+
- Session, workspace, provider, and sidecar behavior
|
|
563
|
+
- Runtime event normalization and persistence
|
|
564
|
+
- Approval and question request orchestration
|
|
565
|
+
- Product-specific actions and animation
|
|
566
|
+
- Components that have not been proven reusable by multiple products
|
|
567
|
+
|
|
568
|
+
The package should standardize repeated visual and interaction language, not
|
|
569
|
+
erase product boundaries.
|
|
570
|
+
|
|
571
|
+
## Adoption checklist
|
|
572
|
+
|
|
573
|
+
- [ ] Choose `workspace:*` or a pinned npm version.
|
|
574
|
+
- [ ] Commit the consuming project's lockfile.
|
|
575
|
+
- [ ] Choose tokens-only, Tailwind mappings, or the complete theme.
|
|
576
|
+
- [ ] Load the required font files.
|
|
577
|
+
- [ ] Import files in the documented order.
|
|
578
|
+
- [ ] Import `agent-chat.css` when using the React primitives.
|
|
579
|
+
- [ ] Install React 18.3 or 19 when using the React primitives.
|
|
580
|
+
- [ ] Map product message/tool models at the package boundary.
|
|
581
|
+
- [ ] Use the stable conversation identifier as the `Conversation` React `key`.
|
|
582
|
+
- [ ] Keep Markdown and link/image policy explicit in the consumer.
|
|
583
|
+
- [ ] Confirm the application's `.dark` behavior.
|
|
584
|
+
- [ ] Put deliberate overrides after package imports.
|
|
585
|
+
- [ ] Build the application in development and production.
|
|
586
|
+
- [ ] Compare representative screens in light and dark modes.
|
|
587
|
+
- [ ] Exercise focus, hover, disabled, streaming, and error states.
|
|
588
|
+
- [ ] Check the same states in Storybook.
|
|
589
|
+
- [ ] Record required overrides and missing shared behavior.
|
|
590
|
+
|
|
591
|
+
## Contract and compatibility expectations
|
|
592
|
+
|
|
593
|
+
Until the package has a stable version, contract changes should:
|
|
594
|
+
|
|
595
|
+
- Include a compatibility note
|
|
596
|
+
- Run the package build, typechecking, and tests
|
|
597
|
+
- Build Storybook
|
|
598
|
+
- Build every active consumer
|
|
599
|
+
- Include light/dark visual evidence when values change
|
|
600
|
+
- Avoid renaming standard shadcn/Tailwind variables
|
|
601
|
+
- Keep Cline-owned palette values in `palette.css` and author UI through visual
|
|
602
|
+
or status roles
|
|
603
|
+
- Keep `tokens.css` framework-neutral
|
|
604
|
+
- Keep component props independent of product runtime schemas
|
|
605
|
+
- Keep product-specific layout and orchestration out of the package
|
|
606
|
+
|
|
607
|
+
Removing or changing the meaning of a semantic token or component prop should
|
|
608
|
+
eventually be treated as a breaking change. Additive tokens, props, and entry
|
|
609
|
+
points can be introduced compatibly.
|
|
610
|
+
|
|
611
|
+
## Release and stability roadmap
|
|
612
|
+
|
|
613
|
+
The npm package solves cross-repository distribution. The remaining work is to
|
|
614
|
+
validate and stabilize the public contract.
|
|
615
|
+
|
|
616
|
+
Recommended sequence:
|
|
617
|
+
|
|
618
|
+
1. Adopt the theme and chat primitives in a second production-shaped Cline app.
|
|
619
|
+
2. Record where that app needs adapters or deliberate variations.
|
|
620
|
+
3. Assign design and engineering owners.
|
|
621
|
+
4. Define browser, React, Tailwind, compatibility, and deprecation policies.
|
|
622
|
+
5. Add screenshot regression coverage for representative Storybook states.
|
|
623
|
+
6. Expand clean-consumer fixtures as supported frameworks are proven.
|
|
624
|
+
7. Define the compatibility point at which the API can be treated as stable.
|
|
625
|
+
|
|
626
|
+
Likely follow-up components should be driven by repeated needs. Approval cards,
|
|
627
|
+
follow-up questions, attachments, and prompt composers are candidates, but their
|
|
628
|
+
current product contracts should be compared before standardizing them.
|
|
629
|
+
|
|
630
|
+
## Useful references
|
|
631
|
+
|
|
632
|
+
- [Package README](./README.md)
|
|
633
|
+
- [Agent-chat components](./components/agent-chat/index.tsx)
|
|
634
|
+
- [Agent-chat styles](./components/agent-chat/agent-chat.css)
|
|
635
|
+
- [Tokens](./theme/tokens.css)
|
|
636
|
+
- [Palette](./theme/palette.css)
|
|
637
|
+
- [Tailwind mappings](./theme/theme.css)
|
|
638
|
+
- [Optional base styles](./theme/base.css)
|
|
639
|
+
- [Complete theme](./theme/index.css)
|
|
640
|
+
- [Package manifest](./package.json)
|
|
641
|
+
- [Desktop theme integration test (monorepo)](https://github.com/cline/cline/blob/main/apps/examples/desktop-app/webview/styles/theme-integration.test.ts)
|
|
642
|
+
|
|
643
|
+
## Conversation layout and header
|
|
644
|
+
|
|
645
|
+
`AgentConversationLayout` takes host-rendered `welcomeHeader`, `body`, `composer`,
|
|
646
|
+
`notice`, `welcomeSetup`, and `welcomeFooter` slots. `AgentSessionContent`
|
|
647
|
+
provides the shared content width; `AgentConversationHeader` groups title/status
|
|
648
|
+
children with optional `actions`. Import `components.css` and theme tokens as
|
|
649
|
+
described above.
|
|
650
|
+
|
|
651
|
+
`welcome` selects the layout; the body remains mounted when hidden.
|
|
652
|
+
`hideWelcomeComposer` hides the welcome composer without unmounting it, but
|
|
653
|
+
switching layouts can remount the composer. Keep drafts in host state.
|
|
654
|
+
`bodyClassName` accepts host animation classes. Hosts retain scrolling, title
|
|
655
|
+
editing, menus, native title-bar behavior, and all event handlers.
|
|
656
|
+
|
|
657
|
+
## Composer presentation
|
|
658
|
+
|
|
659
|
+
`AgentComposer` and its body, field, textarea, action, attachment-list, and
|
|
660
|
+
settings primitives preserve the desktop composer's welcome/conversation
|
|
661
|
+
presentation. They render the original native elements without extra wrappers;
|
|
662
|
+
refs and native event/ARIA props forward to those elements. Import
|
|
663
|
+
`@cerebriline/ui/components.css` and the shared tokens as described above.
|
|
664
|
+
|
|
665
|
+
Compose the host's PR bar before `AgentComposerBody`. Inside the body, render
|
|
666
|
+
`AgentPromptQueue`, the host's suggestion positioning wrapper and
|
|
667
|
+
`AgentComposerField` (textarea and actions), feedback, and optional
|
|
668
|
+
`AgentComposerAttachments`, in that order. Nested variant-aware primitives
|
|
669
|
+
inherit the `AgentComposer` variant unless they set an explicit override. Pass
|
|
670
|
+
`hasQueue` to the body. Render model/settings controls in
|
|
671
|
+
`AgentComposerSettingsGroup`, with workspace/usage controls in
|
|
672
|
+
`AgentComposerSettingsEnd`, both inside `AgentComposerSettings`.
|
|
673
|
+
|
|
674
|
+
The host owns draft state, textarea sizing, IME/keyboard/paste behavior, focus
|
|
675
|
+
forwarding, suggestion menus, attachment chips and uploads, queue operations,
|
|
676
|
+
model/settings popovers, voice controls, and send/stop callbacks and visibility.
|
|
677
|
+
The shared send/stop buttons style host-provided children; supply their accessible
|
|
678
|
+
labels, titles, `type="button"`, disabled state, and handlers. This is an additive
|
|
679
|
+
presentation API, not a runtime composer or a form with implicit submission.
|
|
680
|
+
|
|
681
|
+
## Session rows
|
|
682
|
+
|
|
683
|
+
`AgentSessionRow`, `AgentSessionRowEditor`, and `AgentSessionOverview` are
|
|
684
|
+
exported from `@cerebriline/ui`. Import `components.css` with the shared theme (or
|
|
685
|
+
scoped tokens inside `.cline-ui-theme`) as for the other root components.
|
|
686
|
+
|
|
687
|
+
The row owns the desktop row geometry, selected/hover appearance, timestamp
|
|
688
|
+
placement, and pending/provisioning/running/unread dot precedence. Pass
|
|
689
|
+
already-formatted `label` and `timestamp`, optional `leading` icons, a
|
|
690
|
+
`pinnedIndicator`, and an `action` element. The action remains a sibling of the
|
|
691
|
+
navigation button; the host supplies its hover/focus styles, disabled state,
|
|
692
|
+
accessible label, and event cancellation. `onSelect` handles row activation.
|
|
693
|
+
Root DOM props and refs pass through to the existing wrapper so host-owned
|
|
694
|
+
hover-card/context-menu triggers can use `asChild` without another DOM node.
|
|
695
|
+
|
|
696
|
+
By default, the navigation control is the same native `button` used by desktop.
|
|
697
|
+
For URL-addressable navigation, use `renderControl` to render the supplied
|
|
698
|
+
class and row content through the host's link component. The optional action
|
|
699
|
+
stays a sibling:
|
|
700
|
+
|
|
701
|
+
```tsx
|
|
702
|
+
<AgentSessionRow
|
|
703
|
+
label={session.title}
|
|
704
|
+
timestamp={session.updatedLabel}
|
|
705
|
+
action={<DeleteSessionButton session={session} />}
|
|
706
|
+
renderControl={({ className, children }) => (
|
|
707
|
+
<Link
|
|
708
|
+
className={className}
|
|
709
|
+
href={`/sessions/${session.id}`}
|
|
710
|
+
target="_blank"
|
|
711
|
+
>
|
|
712
|
+
{children}
|
|
713
|
+
</Link>
|
|
714
|
+
)}
|
|
715
|
+
/>
|
|
716
|
+
```
|
|
717
|
+
|
|
718
|
+
The host link owns `href`, click, accessibility, disabled, and router behavior.
|
|
719
|
+
`disabled` and `onSelect` apply only to the default desktop button.
|
|
720
|
+
|
|
721
|
+
`AgentSessionRowEditor` provides the matching edit frame; the host still owns
|
|
722
|
+
the input, focus, Enter/Escape/blur handling, and saving indicator.
|
|
723
|
+
`AgentSessionOverview` presents a title and `[label, value, fullValue?]` metadata
|
|
724
|
+
rows inside the host's hover card. Formatting, open state, positioning, context
|
|
725
|
+
menus, pin/fork/delete permissions, routing, grouping, and persistence stay in
|
|
726
|
+
the application. These primitives do not add new statuses or cloud actions.
|
|
727
|
+
|
|
728
|
+
## Context usage
|
|
729
|
+
|
|
730
|
+
`AgentContextUsage` extracts the desktop context ring and detail body without
|
|
731
|
+
changing the host's button, popover, positioning, focus, or dismissal behavior.
|
|
732
|
+
It does not insert a wrapper. Import `components.css` and the appropriate theme
|
|
733
|
+
tokens as usual. When the context limit or token usage is unavailable, it renders
|
|
734
|
+
nothing and does not invoke the child callback.
|
|
735
|
+
|
|
736
|
+
```tsx
|
|
737
|
+
import { AgentContextUsage } from "@cerebriline/ui";
|
|
738
|
+
|
|
739
|
+
<AgentContextUsage
|
|
740
|
+
usage={{ tokensIn: 1200, tokensOut: 300, cacheReadTokens: 400, contextWindow: 200000 }}
|
|
741
|
+
costLabel="$0.014"
|
|
742
|
+
>
|
|
743
|
+
{({ triggerLabel, ring, details }) => (
|
|
744
|
+
<HostPopover>
|
|
745
|
+
<HostPopoverTrigger asChild>
|
|
746
|
+
<HostButton aria-label={triggerLabel}>{ring}</HostButton>
|
|
747
|
+
</HostPopoverTrigger>
|
|
748
|
+
<HostPopoverContent>{details}</HostPopoverContent>
|
|
749
|
+
</HostPopover>
|
|
750
|
+
)}
|
|
751
|
+
</AgentContextUsage>;
|
|
752
|
+
```
|
|
753
|
+
|
|
754
|
+
The `Host*` names above are host controls, not package exports. Desktop retains
|
|
755
|
+
its existing trigger classes, IDs, top/end placement, eight-pixel offset, and
|
|
756
|
+
Radix interaction. The shared body uses namespaced utilities mapped to the same
|
|
757
|
+
desktop tokens. Current request input/output drives context pressure and the
|
|
758
|
+
existing 50%/75% warnings; lifetime token traffic must not be passed as context
|
|
759
|
+
usage. `costLabel` is a separate optional, host-formatted cumulative cost.
|
|
760
|
+
Fetching metrics, choosing the model limit, and computing cumulative cost remain
|
|
761
|
+
host responsibilities.
|
|
762
|
+
|
|
763
|
+
## Message scroller
|
|
764
|
+
|
|
765
|
+
Use `@cerebriline/ui/components/message-scroller` with React 19 for transcripts that
|
|
766
|
+
anchor new user turns and preserve the reader's position during streaming.
|
|
767
|
+
The behavior comes from `@shadcn/react`; the shared wrapper adds Cline styles.
|
|
768
|
+
Import `@cerebriline/ui/components.css`, or import
|
|
769
|
+
`@cerebriline/ui/components/message-scroller.css` with theme tokens for a plain CSS
|
|
770
|
+
host. Place the scroller in a parent with a constrained height.
|
|
771
|
+
|
|
772
|
+
```tsx
|
|
773
|
+
import {
|
|
774
|
+
MessageScroller,
|
|
775
|
+
MessageScrollerButton,
|
|
776
|
+
MessageScrollerContent,
|
|
777
|
+
MessageScrollerItem,
|
|
778
|
+
MessageScrollerProvider,
|
|
779
|
+
MessageScrollerViewport,
|
|
780
|
+
useMessageScroller,
|
|
781
|
+
useMessageScrollerVisibility,
|
|
782
|
+
} from "@cerebriline/ui/components/message-scroller";
|
|
783
|
+
|
|
784
|
+
function Transcript({ messages }) {
|
|
785
|
+
return (
|
|
786
|
+
<MessageScrollerProvider autoScroll defaultScrollPosition="last-anchor">
|
|
787
|
+
<MessageScroller>
|
|
788
|
+
<MessageScrollerViewport aria-label="Conversation">
|
|
789
|
+
<MessageScrollerContent>
|
|
790
|
+
{messages.map((message) => (
|
|
791
|
+
<MessageScrollerItem
|
|
792
|
+
key={message.id}
|
|
793
|
+
messageId={message.id}
|
|
794
|
+
scrollAnchor={message.role === "user"}
|
|
795
|
+
>
|
|
796
|
+
{message.content}
|
|
797
|
+
</MessageScrollerItem>
|
|
798
|
+
))}
|
|
799
|
+
</MessageScrollerContent>
|
|
800
|
+
</MessageScrollerViewport>
|
|
801
|
+
<MessageScrollerButton />
|
|
802
|
+
<Outline messages={messages} />
|
|
803
|
+
</MessageScroller>
|
|
804
|
+
</MessageScrollerProvider>
|
|
805
|
+
);
|
|
806
|
+
}
|
|
807
|
+
|
|
808
|
+
function Outline({ messages }) {
|
|
809
|
+
const { scrollToMessage } = useMessageScroller();
|
|
810
|
+
const { currentAnchorId } = useMessageScrollerVisibility();
|
|
811
|
+
return (
|
|
812
|
+
<nav aria-label="Transcript outline">
|
|
813
|
+
{messages.filter((message) => message.role === "user").map((message) => (
|
|
814
|
+
<button
|
|
815
|
+
key={message.id}
|
|
816
|
+
type="button"
|
|
817
|
+
aria-current={currentAnchorId === message.id ? "location" : undefined}
|
|
818
|
+
onClick={() => scrollToMessage(message.id, { align: "start" })}
|
|
819
|
+
>
|
|
820
|
+
{message.content}
|
|
821
|
+
</button>
|
|
822
|
+
))}
|
|
823
|
+
</nav>
|
|
824
|
+
);
|
|
825
|
+
}
|
|
826
|
+
```
|
|
827
|
+
|
|
828
|
+
Every direct transcript child, including tool groups, loading rows, and
|
|
829
|
+
approval panels, must be a `MessageScrollerItem`. Use stable IDs to support
|
|
830
|
+
jumps and reader-position tracking. A collapsed tool group can keep the same
|
|
831
|
+
row ID as its expanded form. The host chooses which rows anchor turns and
|
|
832
|
+
which messages appear in its outline; transport and session state remain in
|
|
833
|
+
the app. Key the provider by session ID when switching transcripts.
|