@cline/ui 0.1.0
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 +497 -0
- package/README.md +172 -0
- package/components/agent-chat/agent-chat.css +383 -0
- package/components/agent-chat/index.tsx +776 -0
- package/dist/components/agent-chat/index.d.ts +68 -0
- package/dist/components/agent-chat/index.d.ts.map +1 -0
- package/dist/components/agent-chat/index.js +278 -0
- package/dist/components/agent-chat/index.js.map +1 -0
- package/package.json +88 -0
- package/theme/base.css +125 -0
- package/theme/index.css +3 -0
- package/theme/theme.css +57 -0
- package/theme/tokens.css +137 -0
package/ADOPTION.md
ADDED
|
@@ -0,0 +1,497 @@
|
|
|
1
|
+
# `@cline/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
|
+
`@cline/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
|
+
- Light and dark semantic colors
|
|
17
|
+
- Standard shadcn token names
|
|
18
|
+
- Typography families, sizes, weights, line heights, and letter spacing
|
|
19
|
+
- Borders, radii, cards, navigation, sidebar, and chart colors
|
|
20
|
+
- Selection and scrollbar values
|
|
21
|
+
- A small brand palette for artwork
|
|
22
|
+
- Tailwind v4 mappings
|
|
23
|
+
- Optional global, interaction, and Markdown styles
|
|
24
|
+
|
|
25
|
+
The first component surface provides:
|
|
26
|
+
|
|
27
|
+
- Sticky agent-conversation structure and a scroll-to-latest affordance
|
|
28
|
+
- User, assistant, system, status, and error message presentation
|
|
29
|
+
- Message actions with accessible labels and focus behavior
|
|
30
|
+
- Controlled or uncontrolled reasoning disclosures
|
|
31
|
+
- Static or expandable tool activity with running, success, and error states
|
|
32
|
+
- Empty-conversation presentation
|
|
33
|
+
|
|
34
|
+
Each application continues to own:
|
|
35
|
+
|
|
36
|
+
- Runtime message and tool schemas
|
|
37
|
+
- Session, provider, transport, streaming, and persistence behavior
|
|
38
|
+
- Markdown rendering and external-link/image policy
|
|
39
|
+
- Approval and follow-up-question orchestration
|
|
40
|
+
- Checkpoint, fork, clipboard, and toast behavior
|
|
41
|
+
- Page layouts, navigation, and product workflows
|
|
42
|
+
- Font-file loading and framework integration
|
|
43
|
+
- Product-specific animation and deliberate visual overrides
|
|
44
|
+
|
|
45
|
+
This boundary gives Cline products a shared visual and interaction language
|
|
46
|
+
without turning `@cline/ui` into a second agent runtime.
|
|
47
|
+
|
|
48
|
+
## Current status
|
|
49
|
+
|
|
50
|
+
`@cline/ui` is configured for public npm publication with its own version and
|
|
51
|
+
manual release workflow. Check availability with `npm view @cline/ui version`;
|
|
52
|
+
an `E404` means the first release is still pending. The API is pre-stable, so
|
|
53
|
+
production consumers should pin exact versions and review compatibility notes
|
|
54
|
+
when updating.
|
|
55
|
+
|
|
56
|
+
Desktop is the first production-shaped consumer of both the theme and shared
|
|
57
|
+
chat primitives. Storybook is the reference catalog for isolated component
|
|
58
|
+
states. Hub and other agent interfaces are candidates for the next adoption
|
|
59
|
+
pass once their runtime and Markdown adapters are mapped explicitly.
|
|
60
|
+
|
|
61
|
+
## Choose an adoption level
|
|
62
|
+
|
|
63
|
+
| Goal | Import | Tailwind required | React required |
|
|
64
|
+
| --- | --- | --- | --- |
|
|
65
|
+
| Use only light/dark CSS variables | `@cline/ui/theme/tokens.css` | No | No |
|
|
66
|
+
| Use tokens through Tailwind utilities | `tokens.css` then `theme.css` | Tailwind v4 | No |
|
|
67
|
+
| Use the complete theme and shared base behavior | `@cline/ui/theme/index.css` | Tailwind v4 | No |
|
|
68
|
+
| Compose shared agent-chat presentation | `@cline/ui/components/agent-chat` plus its CSS | No, if tokens are mapped in plain CSS | React 18.3 or 19 |
|
|
69
|
+
|
|
70
|
+
The package exports `base.css` separately for consumers that want its global,
|
|
71
|
+
Markdown, scrollbar, selection, cursor, and native `color-scheme` behavior.
|
|
72
|
+
|
|
73
|
+
There is no root JavaScript export and no `@cline/ui/theme` shorthand. Use the
|
|
74
|
+
explicit paths documented here so dependencies remain visible.
|
|
75
|
+
|
|
76
|
+
## Install inside the Cline monorepo
|
|
77
|
+
|
|
78
|
+
Add the workspace dependency:
|
|
79
|
+
|
|
80
|
+
```json
|
|
81
|
+
{
|
|
82
|
+
"dependencies": {
|
|
83
|
+
"@cline/ui": "workspace:*"
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Run the repository's normal package installation workflow after updating the
|
|
89
|
+
manifest and lockfile.
|
|
90
|
+
|
|
91
|
+
## Install from npm in another repository
|
|
92
|
+
|
|
93
|
+
After the initial release is available, install the latest production UI
|
|
94
|
+
release. The `--exact` flag records the resolved version instead of a range:
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
bun add --exact @cline/ui
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
The package is ESM. Its React entry point targets browser applications. Install
|
|
101
|
+
only the prerequisites for the layer being adopted:
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
# Required only for agent-chat components
|
|
105
|
+
bun add react@^19 react-dom@^19
|
|
106
|
+
|
|
107
|
+
# Required for the documented Tailwind-backed theme and Cline fonts
|
|
108
|
+
bun add @fontsource-variable/schibsted-grotesk @fontsource/azeret-mono
|
|
109
|
+
bun add --dev tailwindcss
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Applications already on React 18.3 can retain that compatible version.
|
|
113
|
+
Tokens-only consumers do not need React or Tailwind.
|
|
114
|
+
|
|
115
|
+
Commit the consuming repository's lockfile so builds continue using the same
|
|
116
|
+
resolved version. Use the package manager's update command when the team
|
|
117
|
+
intentionally wants to move to a newer release:
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
bun update @cline/ui
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
For deliberate previews, UI releases can publish an unstable `next` npm tag:
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
bun add --exact @cline/ui@next
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Do not use `next` for production applications. UI versions move independently
|
|
130
|
+
from the runtime SDK packages.
|
|
131
|
+
|
|
132
|
+
## Option 1: complete Tailwind v4 theme
|
|
133
|
+
|
|
134
|
+
Import fonts and Tailwind before the complete theme:
|
|
135
|
+
|
|
136
|
+
```css
|
|
137
|
+
@import "@fontsource-variable/schibsted-grotesk";
|
|
138
|
+
@import "@fontsource/azeret-mono/latin.css";
|
|
139
|
+
@import "tailwindcss";
|
|
140
|
+
@import "@cline/ui/theme/index.css";
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
This supplies:
|
|
144
|
+
|
|
145
|
+
- Framework-neutral token values
|
|
146
|
+
- Tailwind semantic mappings and dark variant
|
|
147
|
+
- Global typography and body styles
|
|
148
|
+
- Markdown and code-block styling
|
|
149
|
+
- Scrollbar and selection styling
|
|
150
|
+
- Consistent pointer affordances
|
|
151
|
+
- Native light/dark `color-scheme`
|
|
152
|
+
|
|
153
|
+
Application-specific CSS should follow these imports.
|
|
154
|
+
|
|
155
|
+
## Option 2: Tailwind mappings without base styles
|
|
156
|
+
|
|
157
|
+
Use this when the application wants the shared tokens and utilities but already
|
|
158
|
+
owns document, Markdown, scrollbar, or cursor behavior:
|
|
159
|
+
|
|
160
|
+
```css
|
|
161
|
+
@import "@fontsource-variable/schibsted-grotesk";
|
|
162
|
+
@import "@fontsource/azeret-mono/latin.css";
|
|
163
|
+
@import "tailwindcss";
|
|
164
|
+
@import "@cline/ui/theme/tokens.css";
|
|
165
|
+
@import "@cline/ui/theme/theme.css";
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
If the application later opts into shared base behavior, import
|
|
169
|
+
`@cline/ui/theme/base.css` after `theme.css`.
|
|
170
|
+
|
|
171
|
+
## Option 3: framework-neutral tokens
|
|
172
|
+
|
|
173
|
+
Applications without Tailwind can import only the variables:
|
|
174
|
+
|
|
175
|
+
```css
|
|
176
|
+
@import "@cline/ui/theme/tokens.css";
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
Token-only consumers must provide:
|
|
180
|
+
|
|
181
|
+
- Font files
|
|
182
|
+
- Resets and document defaults
|
|
183
|
+
- Native `color-scheme`, if desired
|
|
184
|
+
- Their own mapping from CSS variables to framework utilities
|
|
185
|
+
- Their own dark-mode class activation
|
|
186
|
+
|
|
187
|
+
For native controls that should follow the selected theme:
|
|
188
|
+
|
|
189
|
+
```css
|
|
190
|
+
:root {
|
|
191
|
+
color-scheme: light;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
.dark {
|
|
195
|
+
color-scheme: dark;
|
|
196
|
+
}
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
## Add the agent-chat components
|
|
200
|
+
|
|
201
|
+
With the complete Tailwind theme, import the component styles afterward:
|
|
202
|
+
|
|
203
|
+
```css
|
|
204
|
+
@import "@cline/ui/theme/index.css";
|
|
205
|
+
@import "@cline/ui/components/agent-chat.css";
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
Without Tailwind, import the framework-neutral tokens and component styles,
|
|
209
|
+
then apply the shared font family at an app or chat root (tokens define font
|
|
210
|
+
values but do not apply document typography):
|
|
211
|
+
|
|
212
|
+
```css
|
|
213
|
+
@import "@cline/ui/theme/tokens.css";
|
|
214
|
+
@import "@cline/ui/components/agent-chat.css";
|
|
215
|
+
|
|
216
|
+
.agent-chat-root {
|
|
217
|
+
font-family: var(--font-sans);
|
|
218
|
+
}
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
Then compose the presentation around the consuming application's own data:
|
|
222
|
+
|
|
223
|
+
```tsx
|
|
224
|
+
import type { ReactNode } from "react";
|
|
225
|
+
import {
|
|
226
|
+
type AgentMessageRole,
|
|
227
|
+
Conversation,
|
|
228
|
+
ConversationContent,
|
|
229
|
+
ConversationScrollButton,
|
|
230
|
+
ConversationViewport,
|
|
231
|
+
Message,
|
|
232
|
+
MessageActions,
|
|
233
|
+
MessageAction,
|
|
234
|
+
MessageContent,
|
|
235
|
+
Reasoning,
|
|
236
|
+
ReasoningContent,
|
|
237
|
+
ReasoningTrigger,
|
|
238
|
+
ToolActivity,
|
|
239
|
+
ToolActivityContent,
|
|
240
|
+
ToolActivityTrigger,
|
|
241
|
+
} from "@cline/ui/components/agent-chat";
|
|
242
|
+
|
|
243
|
+
type ProductMessage = {
|
|
244
|
+
id: string;
|
|
245
|
+
role: "human" | "agent" | "system" | "error";
|
|
246
|
+
content: string;
|
|
247
|
+
reasoning?: string;
|
|
248
|
+
isStreaming?: boolean;
|
|
249
|
+
};
|
|
250
|
+
|
|
251
|
+
const roleMap: Record<ProductMessage["role"], AgentMessageRole> = {
|
|
252
|
+
human: "user",
|
|
253
|
+
agent: "assistant",
|
|
254
|
+
system: "system",
|
|
255
|
+
error: "error",
|
|
256
|
+
};
|
|
257
|
+
|
|
258
|
+
type AgentTranscriptProps = {
|
|
259
|
+
conversationId: string;
|
|
260
|
+
messages: ProductMessage[];
|
|
261
|
+
onCopy: (message: ProductMessage) => void;
|
|
262
|
+
renderMarkdown: (content: string) => ReactNode;
|
|
263
|
+
};
|
|
264
|
+
|
|
265
|
+
export function AgentTranscript({
|
|
266
|
+
conversationId,
|
|
267
|
+
messages,
|
|
268
|
+
onCopy,
|
|
269
|
+
renderMarkdown,
|
|
270
|
+
}: AgentTranscriptProps) {
|
|
271
|
+
return (
|
|
272
|
+
<Conversation
|
|
273
|
+
className="agent-chat-root"
|
|
274
|
+
key={conversationId}
|
|
275
|
+
style={{ height: "32rem" }}
|
|
276
|
+
>
|
|
277
|
+
<ConversationViewport aria-label="Agent conversation">
|
|
278
|
+
<ConversationContent>
|
|
279
|
+
{messages.map((message) => (
|
|
280
|
+
<Message from={roleMap[message.role]} key={message.id}>
|
|
281
|
+
<MessageContent>
|
|
282
|
+
{message.reasoning ? (
|
|
283
|
+
<Reasoning isStreaming={message.isStreaming}>
|
|
284
|
+
<ReasoningTrigger />
|
|
285
|
+
<ReasoningContent>
|
|
286
|
+
{renderMarkdown(message.reasoning)}
|
|
287
|
+
</ReasoningContent>
|
|
288
|
+
</Reasoning>
|
|
289
|
+
) : null}
|
|
290
|
+
|
|
291
|
+
{renderMarkdown(message.content)}
|
|
292
|
+
</MessageContent>
|
|
293
|
+
|
|
294
|
+
<MessageActions>
|
|
295
|
+
<MessageAction label="Copy message" onClick={() => onCopy(message)}>
|
|
296
|
+
Copy
|
|
297
|
+
</MessageAction>
|
|
298
|
+
</MessageActions>
|
|
299
|
+
</Message>
|
|
300
|
+
))}
|
|
301
|
+
|
|
302
|
+
<ToolActivity expandable>
|
|
303
|
+
<ToolActivityTrigger
|
|
304
|
+
label="Edited 2 files"
|
|
305
|
+
additions={24}
|
|
306
|
+
deletions={8}
|
|
307
|
+
status="success"
|
|
308
|
+
/>
|
|
309
|
+
<ToolActivityContent>Normalized tool details</ToolActivityContent>
|
|
310
|
+
</ToolActivity>
|
|
311
|
+
</ConversationContent>
|
|
312
|
+
</ConversationViewport>
|
|
313
|
+
<ConversationScrollButton />
|
|
314
|
+
</Conversation>
|
|
315
|
+
);
|
|
316
|
+
}
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
The explicit height keeps this standalone example scrollable. In a real shell,
|
|
320
|
+
an equivalent bounded flex layout works too: every ancestor in the height chain
|
|
321
|
+
must allow shrinking (commonly `min-height: 0`) and the conversation must fill
|
|
322
|
+
the available height.
|
|
323
|
+
|
|
324
|
+
The example intentionally injects a consumer-owned `renderMarkdown`. Different
|
|
325
|
+
products currently have different Streamdown plugins, syntax-highlighting
|
|
326
|
+
budgets, link-confirmation behavior, and image policies. The React `key` resets
|
|
327
|
+
conversation-local state when the active session changes. The shared package
|
|
328
|
+
standardizes the surrounding presentation without silently changing those
|
|
329
|
+
security and product decisions.
|
|
330
|
+
|
|
331
|
+
Map runtime roles and tool states at the consumer boundary. Do not make the UI
|
|
332
|
+
package depend on `@cline/core`, the Vercel AI SDK, desktop schemas, or transport
|
|
333
|
+
events.
|
|
334
|
+
|
|
335
|
+
## Explore components in Storybook
|
|
336
|
+
|
|
337
|
+
From the Cline repository root:
|
|
338
|
+
|
|
339
|
+
```bash
|
|
340
|
+
bun -F @cline/ui storybook
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
Open `http://localhost:6006`. The toolbar switches light/dark mode and offers
|
|
344
|
+
representative chat and mobile viewports. Stories cover:
|
|
345
|
+
|
|
346
|
+
- Theme colors, typography, radii, and controls
|
|
347
|
+
- Complete and empty conversations
|
|
348
|
+
- User, assistant, and error messages
|
|
349
|
+
- Collapsed, expanded, and streaming reasoning
|
|
350
|
+
- Pending, running, successful, and failed tool activity
|
|
351
|
+
- Expandable and static tool summaries
|
|
352
|
+
|
|
353
|
+
In the repository's agent sandbox, bind to a forwarded host and unused port:
|
|
354
|
+
|
|
355
|
+
```bash
|
|
356
|
+
bun -F @cline/ui storybook -- --host 0.0.0.0 --port 3490 --exact-port
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
Build the production Storybook bundle with:
|
|
360
|
+
|
|
361
|
+
```bash
|
|
362
|
+
bun -F @cline/ui build-storybook
|
|
363
|
+
```
|
|
364
|
+
|
|
365
|
+
Storybook is the isolated component reference. Real application builds remain
|
|
366
|
+
the integration test for runtime adapters and product CSS.
|
|
367
|
+
|
|
368
|
+
The catalog currently runs from a Cline monorepo checkout. Story sources and
|
|
369
|
+
configuration are not included in the npm package, and the catalog is not
|
|
370
|
+
hosted yet.
|
|
371
|
+
|
|
372
|
+
## Token usage
|
|
373
|
+
|
|
374
|
+
Product components should use semantic tokens:
|
|
375
|
+
|
|
376
|
+
```css
|
|
377
|
+
.card {
|
|
378
|
+
color: var(--card-foreground);
|
|
379
|
+
background: var(--card);
|
|
380
|
+
border-color: var(--border);
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
.primary-action {
|
|
384
|
+
color: var(--primary-foreground);
|
|
385
|
+
background: var(--primary);
|
|
386
|
+
}
|
|
387
|
+
```
|
|
388
|
+
|
|
389
|
+
Use the small `--brand-*` palette and `--primary-emphasis` for branded artwork
|
|
390
|
+
or deliberate emphasis. Normal controls should prefer semantic tokens so they
|
|
391
|
+
continue to work across light, dark, and future theme layers.
|
|
392
|
+
|
|
393
|
+
## Product overrides
|
|
394
|
+
|
|
395
|
+
Import the package first, then override standard semantic values:
|
|
396
|
+
|
|
397
|
+
```css
|
|
398
|
+
@import "@cline/ui/theme/index.css";
|
|
399
|
+
|
|
400
|
+
:root {
|
|
401
|
+
--primary: /* product-specific value */;
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
.dark {
|
|
405
|
+
--primary: /* dark product-specific value */;
|
|
406
|
+
}
|
|
407
|
+
```
|
|
408
|
+
|
|
409
|
+
Do not copy `tokens.css` or component CSS into the consuming application.
|
|
410
|
+
Explicit overrides make product differences reviewable and allow future
|
|
411
|
+
package upgrades.
|
|
412
|
+
|
|
413
|
+
## Consumer-owned behavior
|
|
414
|
+
|
|
415
|
+
Keep the following outside `@cline/ui`:
|
|
416
|
+
|
|
417
|
+
- Next, Tauri, VS Code, and runtime-specific behavior
|
|
418
|
+
- `#__next`, viewport locking, and shell layout
|
|
419
|
+
- Application routes and information architecture
|
|
420
|
+
- Session, workspace, provider, and sidecar behavior
|
|
421
|
+
- Runtime event normalization and persistence
|
|
422
|
+
- Tool-name classification and raw tool-payload parsing
|
|
423
|
+
- Approval and question request orchestration
|
|
424
|
+
- Product-specific actions and animation
|
|
425
|
+
- Components that have not been proven reusable by multiple products
|
|
426
|
+
|
|
427
|
+
The package should standardize repeated visual and interaction language, not
|
|
428
|
+
erase product boundaries.
|
|
429
|
+
|
|
430
|
+
## Adoption checklist
|
|
431
|
+
|
|
432
|
+
- [ ] Choose `workspace:*` or a pinned npm version.
|
|
433
|
+
- [ ] Commit the consuming project's lockfile.
|
|
434
|
+
- [ ] Choose tokens-only, Tailwind mappings, or the complete theme.
|
|
435
|
+
- [ ] Load the required font files.
|
|
436
|
+
- [ ] Import files in the documented order.
|
|
437
|
+
- [ ] Import `agent-chat.css` when using the React primitives.
|
|
438
|
+
- [ ] Install React 18.3 or 19 when using the React primitives.
|
|
439
|
+
- [ ] Map product message/tool models at the package boundary.
|
|
440
|
+
- [ ] Use the stable conversation identifier as the `Conversation` React `key`.
|
|
441
|
+
- [ ] Keep Markdown and link/image policy explicit in the consumer.
|
|
442
|
+
- [ ] Confirm the application's `.dark` behavior.
|
|
443
|
+
- [ ] Put deliberate overrides after package imports.
|
|
444
|
+
- [ ] Build the application in development and production.
|
|
445
|
+
- [ ] Compare representative screens in light and dark modes.
|
|
446
|
+
- [ ] Exercise focus, hover, disabled, streaming, and error states.
|
|
447
|
+
- [ ] Check the same states in Storybook.
|
|
448
|
+
- [ ] Record required overrides and missing shared behavior.
|
|
449
|
+
|
|
450
|
+
## Contract and compatibility expectations
|
|
451
|
+
|
|
452
|
+
Until the package has a stable version, contract changes should:
|
|
453
|
+
|
|
454
|
+
- Include a compatibility note
|
|
455
|
+
- Run the package build, typechecking, and tests
|
|
456
|
+
- Build Storybook
|
|
457
|
+
- Build every active consumer
|
|
458
|
+
- Include light/dark visual evidence when values change
|
|
459
|
+
- Avoid renaming standard shadcn/Tailwind variables
|
|
460
|
+
- Keep `tokens.css` framework-neutral
|
|
461
|
+
- Keep component props independent of product runtime schemas
|
|
462
|
+
- Keep product-specific layout and orchestration out of the package
|
|
463
|
+
|
|
464
|
+
Removing or changing the meaning of a semantic token or component prop should
|
|
465
|
+
eventually be treated as a breaking change. Additive tokens, props, and entry
|
|
466
|
+
points can be introduced compatibly.
|
|
467
|
+
|
|
468
|
+
## Release and stability roadmap
|
|
469
|
+
|
|
470
|
+
The npm package solves cross-repository distribution. The remaining work is to
|
|
471
|
+
validate and stabilize the public contract.
|
|
472
|
+
|
|
473
|
+
Recommended sequence:
|
|
474
|
+
|
|
475
|
+
1. Adopt the theme and chat primitives in a second production-shaped Cline app.
|
|
476
|
+
2. Record where that app needs adapters or deliberate variations.
|
|
477
|
+
3. Assign design and engineering owners.
|
|
478
|
+
4. Define browser, React, Tailwind, compatibility, and deprecation policies.
|
|
479
|
+
5. Add screenshot regression coverage for representative Storybook states.
|
|
480
|
+
6. Expand clean-consumer fixtures as supported frameworks are proven.
|
|
481
|
+
7. Define the compatibility point at which the API can be treated as stable.
|
|
482
|
+
|
|
483
|
+
Likely follow-up components should be driven by repeated needs. Approval cards,
|
|
484
|
+
follow-up questions, attachments, and prompt composers are candidates, but their
|
|
485
|
+
current product contracts should be compared before standardizing them.
|
|
486
|
+
|
|
487
|
+
## Useful references
|
|
488
|
+
|
|
489
|
+
- [Package README](./README.md)
|
|
490
|
+
- [Agent-chat components](./components/agent-chat/index.tsx)
|
|
491
|
+
- [Agent-chat styles](./components/agent-chat/agent-chat.css)
|
|
492
|
+
- [Tokens](./theme/tokens.css)
|
|
493
|
+
- [Tailwind mappings](./theme/theme.css)
|
|
494
|
+
- [Optional base styles](./theme/base.css)
|
|
495
|
+
- [Complete theme](./theme/index.css)
|
|
496
|
+
- [Package manifest](./package.json)
|
|
497
|
+
- [Desktop theme integration test (monorepo)](https://github.com/cline/cline/blob/main/apps/examples/desktop-app/webview/styles/theme-integration.test.ts)
|
package/README.md
ADDED
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
# `@cline/ui`
|
|
2
|
+
|
|
3
|
+
Shared visual foundations and reusable React presentation primitives for Cline
|
|
4
|
+
web products. The package lets teams adopt the same semantic theme and agent
|
|
5
|
+
chat language without adopting another product's routes, state, or runtime.
|
|
6
|
+
|
|
7
|
+
The package is configured for public npm releases on its own version and
|
|
8
|
+
release cycle. Its API is still pre-stable, so consumers should pin an exact
|
|
9
|
+
version and review compatibility notes when updating. Check availability with
|
|
10
|
+
`npm view @cline/ui version`; an `E404` means the first release is still pending.
|
|
11
|
+
|
|
12
|
+
See the [adoption primer](./ADOPTION.md) for complete setup instructions,
|
|
13
|
+
component examples, boundaries, and release status.
|
|
14
|
+
|
|
15
|
+
## Install
|
|
16
|
+
|
|
17
|
+
After the initial release is available:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
bun add --exact @cline/ui
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Use `@cline/ui@next` only for deliberate previews. Monorepo consumers use
|
|
24
|
+
`"@cline/ui": "workspace:*"` instead.
|
|
25
|
+
|
|
26
|
+
## Entry points
|
|
27
|
+
|
|
28
|
+
| Import | Contents | Runtime requirement |
|
|
29
|
+
| --- | --- | --- |
|
|
30
|
+
| `@cline/ui/theme/tokens.css` | Light/dark custom properties only | CSS |
|
|
31
|
+
| `@cline/ui/theme/theme.css` | Tailwind v4 semantic mapping and dark variant | Tailwind v4 |
|
|
32
|
+
| `@cline/ui/theme/base.css` | Optional document, Markdown, scrollbar, selection, and cursor styles | Tailwind v4 |
|
|
33
|
+
| `@cline/ui/theme/index.css` | Complete theme: tokens, Tailwind mapping, and base styles | Tailwind v4 |
|
|
34
|
+
| `@cline/ui/components/agent-chat` | Conversation, message, reasoning, action, and tool-activity React primitives | React 18.3 or 19 |
|
|
35
|
+
| `@cline/ui/components/agent-chat.css` | Framework-neutral styles for the agent-chat primitives | Theme tokens |
|
|
36
|
+
|
|
37
|
+
The token entry point has no React, Tailwind, font-package, or desktop runtime
|
|
38
|
+
dependency. Apps provide Schibsted Grotesk and Azeret Mono themselves, which
|
|
39
|
+
lets each bundler control font loading and asset emission.
|
|
40
|
+
|
|
41
|
+
## Theme usage
|
|
42
|
+
|
|
43
|
+
For a Tailwind v4 app, import framework and consumer dependencies first:
|
|
44
|
+
|
|
45
|
+
```css
|
|
46
|
+
@import "@fontsource-variable/schibsted-grotesk";
|
|
47
|
+
@import "@fontsource/azeret-mono/latin.css";
|
|
48
|
+
@import "tailwindcss";
|
|
49
|
+
@import "@cline/ui/theme/index.css";
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
An app that only needs framework-neutral values can import:
|
|
53
|
+
|
|
54
|
+
```css
|
|
55
|
+
@import "@cline/ui/theme/tokens.css";
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
The theme follows the standard shadcn semantic contract (`--background`,
|
|
59
|
+
`--foreground`, `--card`, `--primary`, `--border`, `--ring`, charts, and
|
|
60
|
+
sidebar surfaces) and Tailwind theme names. This means shadcn components and
|
|
61
|
+
normal Tailwind utilities inherit Cline defaults without custom adapters.
|
|
62
|
+
|
|
63
|
+
Brand artwork may use the small extension set (`--primary-emphasis` and the
|
|
64
|
+
`--brand-*` palette). Product controls should prefer semantic variables.
|
|
65
|
+
|
|
66
|
+
## Agent-chat usage
|
|
67
|
+
|
|
68
|
+
Agent-chat consumers must provide React 18.3 or 19. Install React in the
|
|
69
|
+
consuming application if it is not already present:
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
bun add react@^19 react-dom@^19
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Applications already on React 18.3 can retain that compatible version.
|
|
76
|
+
|
|
77
|
+
In the application's global CSS, import the component styles after at least the
|
|
78
|
+
theme tokens:
|
|
79
|
+
|
|
80
|
+
```css
|
|
81
|
+
@import "@cline/ui/theme/tokens.css";
|
|
82
|
+
@import "@cline/ui/components/agent-chat.css";
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Then import the React components:
|
|
86
|
+
|
|
87
|
+
```tsx
|
|
88
|
+
import {
|
|
89
|
+
Conversation,
|
|
90
|
+
ConversationContent,
|
|
91
|
+
ConversationEmptyState,
|
|
92
|
+
ConversationScrollButton,
|
|
93
|
+
ConversationViewport,
|
|
94
|
+
Message,
|
|
95
|
+
MessageAction,
|
|
96
|
+
MessageActions,
|
|
97
|
+
MessageContent,
|
|
98
|
+
Reasoning,
|
|
99
|
+
ReasoningContent,
|
|
100
|
+
ReasoningTrigger,
|
|
101
|
+
ToolActivity,
|
|
102
|
+
ToolActivityCode,
|
|
103
|
+
ToolActivityContent,
|
|
104
|
+
ToolActivityDetails,
|
|
105
|
+
ToolActivityTrigger,
|
|
106
|
+
} from "@cline/ui/components/agent-chat";
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
`Conversation` owns sticky scrolling, `Message` owns role presentation,
|
|
110
|
+
`Reasoning` and `ToolActivity` provide accessible disclosures, and the smaller
|
|
111
|
+
action, empty-state, detail, and code primitives fill out common transcript
|
|
112
|
+
states. Give each conversation a bounded height through an explicit height or
|
|
113
|
+
a complete flex/min-height chain so its viewport can scroll.
|
|
114
|
+
|
|
115
|
+
These are presentation primitives, not an agent SDK. Consumers map their own
|
|
116
|
+
message and tool schemas into the components and retain their own Markdown,
|
|
117
|
+
transport, approvals, persistence, and product actions.
|
|
118
|
+
|
|
119
|
+
## Storybook
|
|
120
|
+
|
|
121
|
+
Run the interactive component catalog from the repository root:
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
bun -F @cline/ui storybook
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Then open `http://localhost:6006`. Build the static catalog with:
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
bun -F @cline/ui build-storybook
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
In the repository's agent sandbox, bind to a forwarded host and unused port:
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
bun -F @cline/ui storybook -- --host 0.0.0.0 --port 3490 --exact-port
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
The catalog includes the theme foundations and representative agent-chat
|
|
140
|
+
states in light, dark, desktop, and narrow viewports.
|
|
141
|
+
|
|
142
|
+
Storybook currently runs from a Cline monorepo checkout. It is not hosted or
|
|
143
|
+
included in the npm package; deployment can be added once the catalog and
|
|
144
|
+
ownership model settle.
|
|
145
|
+
|
|
146
|
+
## Layering and compatibility
|
|
147
|
+
|
|
148
|
+
- Import the Cline theme after Tailwind so its default typography values win.
|
|
149
|
+
- Import `agent-chat.css` after theme tokens.
|
|
150
|
+
- Override `:root` or `.dark` after package imports for deliberate product
|
|
151
|
+
variations; do not rename the default semantic contract.
|
|
152
|
+
- `base.css` is optional because it contains opinionated Markdown and global
|
|
153
|
+
interaction styles.
|
|
154
|
+
- Shell layout, routes, provider/session state, and runtime behavior stay with
|
|
155
|
+
each consumer.
|
|
156
|
+
- Contract changes should include a compatibility note, package tests, a
|
|
157
|
+
Storybook build, and at least one real consumer build.
|
|
158
|
+
|
|
159
|
+
## Releases
|
|
160
|
+
|
|
161
|
+
The standalone `ui-publish.yml` workflow validates the package and publishes
|
|
162
|
+
only after a manual dispatch from `main`. Production releases use the npm
|
|
163
|
+
`latest` tag; deliberate previews use `next`. UI releases do not trigger the
|
|
164
|
+
SDK release, GitHub releases, or Slack announcements.
|
|
165
|
+
|
|
166
|
+
Maintainers use the repository's `publish-ui` skill for the initial bootstrap
|
|
167
|
+
and later releases.
|
|
168
|
+
|
|
169
|
+
The install command above pins the resolved release. Commit the consumer
|
|
170
|
+
lockfile and update deliberately. The package is ESM and its React components
|
|
171
|
+
target browser applications. A complete Tailwind theme also requires Tailwind
|
|
172
|
+
v4 and the two font packages shown above.
|