@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
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { clsx } from "clsx";
|
|
4
|
+
import {
|
|
5
|
+
type ComponentPropsWithoutRef,
|
|
6
|
+
createContext,
|
|
7
|
+
forwardRef,
|
|
8
|
+
useContext,
|
|
9
|
+
} from "react";
|
|
10
|
+
|
|
11
|
+
/** Presentation only. Hosts retain drafts, input events, menus, and runtime actions. */
|
|
12
|
+
export type AgentComposerVariant = "welcome" | "conversation";
|
|
13
|
+
type VariantProps = { variant?: AgentComposerVariant };
|
|
14
|
+
|
|
15
|
+
const AgentComposerVariantContext =
|
|
16
|
+
createContext<AgentComposerVariant>("conversation");
|
|
17
|
+
|
|
18
|
+
function useAgentComposerVariant(variant?: AgentComposerVariant) {
|
|
19
|
+
const inheritedVariant = useContext(AgentComposerVariantContext);
|
|
20
|
+
return variant ?? inheritedVariant;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export type AgentComposerProps = ComponentPropsWithoutRef<"div"> & VariantProps;
|
|
24
|
+
|
|
25
|
+
export const AgentComposer = forwardRef<HTMLDivElement, AgentComposerProps>(
|
|
26
|
+
function AgentComposer(
|
|
27
|
+
{ variant = "conversation", className, ...props },
|
|
28
|
+
ref,
|
|
29
|
+
) {
|
|
30
|
+
return (
|
|
31
|
+
<AgentComposerVariantContext.Provider value={variant}>
|
|
32
|
+
<div
|
|
33
|
+
{...props}
|
|
34
|
+
ref={ref}
|
|
35
|
+
className={clsx(
|
|
36
|
+
variant === "welcome"
|
|
37
|
+
? "overflow-visible rounded-cline-ui-xl border border-cline-ui-border/90 bg-cline-ui-surface-1/40 shadow-[0_24px_80px_-56px_color-mix(in_oklab,var(--primary)_72%,transparent)] backdrop-blur-md"
|
|
38
|
+
: "overflow-visible rounded-cline-ui-xl border border-cline-ui-border bg-cline-ui-surface-2 backdrop-blur-sm focus-within:border-cline-ui-primary/50 focus-within:ring-1 focus-within:ring-cline-ui-primary/20",
|
|
39
|
+
className,
|
|
40
|
+
)}
|
|
41
|
+
/>
|
|
42
|
+
</AgentComposerVariantContext.Provider>
|
|
43
|
+
);
|
|
44
|
+
},
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
export type AgentComposerBodyProps = ComponentPropsWithoutRef<"div"> &
|
|
48
|
+
VariantProps & { hasQueue?: boolean };
|
|
49
|
+
|
|
50
|
+
export const AgentComposerBody = forwardRef<
|
|
51
|
+
HTMLDivElement,
|
|
52
|
+
AgentComposerBodyProps
|
|
53
|
+
>(function AgentComposerBody(
|
|
54
|
+
{ variant: variantProp, hasQueue = false, className, ...props },
|
|
55
|
+
ref,
|
|
56
|
+
) {
|
|
57
|
+
const variant = useAgentComposerVariant(variantProp);
|
|
58
|
+
return (
|
|
59
|
+
<div
|
|
60
|
+
{...props}
|
|
61
|
+
ref={ref}
|
|
62
|
+
className={clsx(
|
|
63
|
+
variant === "welcome"
|
|
64
|
+
? "px-4 py-3 pb-2 pt-4"
|
|
65
|
+
: hasQueue
|
|
66
|
+
? "px-4 py-3 pb-4 pt-0"
|
|
67
|
+
: "px-4 py-4",
|
|
68
|
+
className,
|
|
69
|
+
)}
|
|
70
|
+
/>
|
|
71
|
+
);
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
export type AgentComposerFieldProps = ComponentPropsWithoutRef<"div"> &
|
|
75
|
+
VariantProps;
|
|
76
|
+
|
|
77
|
+
export const AgentComposerField = forwardRef<
|
|
78
|
+
HTMLDivElement,
|
|
79
|
+
AgentComposerFieldProps
|
|
80
|
+
>(function AgentComposerField(
|
|
81
|
+
{ variant: variantProp, className, ...props },
|
|
82
|
+
ref,
|
|
83
|
+
) {
|
|
84
|
+
const variant = useAgentComposerVariant(variantProp);
|
|
85
|
+
return (
|
|
86
|
+
<div
|
|
87
|
+
{...props}
|
|
88
|
+
ref={ref}
|
|
89
|
+
className={clsx(
|
|
90
|
+
variant === "welcome"
|
|
91
|
+
? "flex items-end gap-2 border-cline-ui-border focus-within:border-cline-ui-primary/50 focus-within:ring-cline-ui-primary/20 min-h-16 rounded-none border-0 bg-transparent px-0 py-0 focus-within:ring-0"
|
|
92
|
+
: "flex gap-2 border-cline-ui-border focus-within:ring-cline-ui-primary/20 min-h-24 items-start rounded-none border-0 bg-transparent px-0 py-0 focus-within:border-transparent focus-within:ring-0",
|
|
93
|
+
className,
|
|
94
|
+
)}
|
|
95
|
+
/>
|
|
96
|
+
);
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
export type AgentComposerTextareaProps = ComponentPropsWithoutRef<"textarea"> &
|
|
100
|
+
VariantProps;
|
|
101
|
+
|
|
102
|
+
export const AgentComposerTextarea = forwardRef<
|
|
103
|
+
HTMLTextAreaElement,
|
|
104
|
+
AgentComposerTextareaProps
|
|
105
|
+
>(function AgentComposerTextarea(
|
|
106
|
+
{ variant: variantProp, className, ...props },
|
|
107
|
+
ref,
|
|
108
|
+
) {
|
|
109
|
+
const variant = useAgentComposerVariant(variantProp);
|
|
110
|
+
return (
|
|
111
|
+
<textarea
|
|
112
|
+
{...props}
|
|
113
|
+
ref={ref}
|
|
114
|
+
className={clsx(
|
|
115
|
+
variant === "welcome"
|
|
116
|
+
? "field-sizing-content flex-1 resize-none overflow-y-auto bg-transparent text-cline-ui-sm leading-5 text-cline-ui-foreground placeholder:text-cline-ui-muted-foreground outline-none self-start"
|
|
117
|
+
: "field-sizing-content flex-1 resize-none overflow-y-auto bg-transparent text-cline-ui-sm leading-5 text-cline-ui-foreground placeholder:text-cline-ui-muted-foreground outline-none",
|
|
118
|
+
className,
|
|
119
|
+
)}
|
|
120
|
+
/>
|
|
121
|
+
);
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
export type AgentComposerActionsProps = ComponentPropsWithoutRef<"div"> &
|
|
125
|
+
VariantProps;
|
|
126
|
+
|
|
127
|
+
export const AgentComposerActions = forwardRef<
|
|
128
|
+
HTMLDivElement,
|
|
129
|
+
AgentComposerActionsProps
|
|
130
|
+
>(function AgentComposerActions(
|
|
131
|
+
{ variant: variantProp, className, ...props },
|
|
132
|
+
ref,
|
|
133
|
+
) {
|
|
134
|
+
const variant = useAgentComposerVariant(variantProp);
|
|
135
|
+
return (
|
|
136
|
+
<div
|
|
137
|
+
{...props}
|
|
138
|
+
ref={ref}
|
|
139
|
+
className={clsx(
|
|
140
|
+
variant === "welcome"
|
|
141
|
+
? "flex shrink-0 items-center gap-2"
|
|
142
|
+
: "flex shrink-0 items-center gap-2 self-end",
|
|
143
|
+
className,
|
|
144
|
+
)}
|
|
145
|
+
/>
|
|
146
|
+
);
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
export type AgentComposerStopButtonProps = ComponentPropsWithoutRef<"button"> &
|
|
150
|
+
VariantProps;
|
|
151
|
+
|
|
152
|
+
export const AgentComposerStopButton = forwardRef<
|
|
153
|
+
HTMLButtonElement,
|
|
154
|
+
AgentComposerStopButtonProps
|
|
155
|
+
>(function AgentComposerStopButton(
|
|
156
|
+
{ variant: variantProp, className, ...props },
|
|
157
|
+
ref,
|
|
158
|
+
) {
|
|
159
|
+
const variant = useAgentComposerVariant(variantProp);
|
|
160
|
+
return (
|
|
161
|
+
<button
|
|
162
|
+
{...props}
|
|
163
|
+
ref={ref}
|
|
164
|
+
className={clsx(
|
|
165
|
+
variant === "welcome"
|
|
166
|
+
? "bg-cline-ui-foreground p-1.5 text-cline-ui-background hover:bg-cline-ui-destructive rounded-cline-ui-md"
|
|
167
|
+
: "bg-cline-ui-foreground p-1.5 text-cline-ui-background hover:bg-cline-ui-destructive rounded-full",
|
|
168
|
+
className,
|
|
169
|
+
)}
|
|
170
|
+
/>
|
|
171
|
+
);
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
export type AgentComposerSendButtonProps = ComponentPropsWithoutRef<"button"> &
|
|
175
|
+
VariantProps;
|
|
176
|
+
|
|
177
|
+
export const AgentComposerSendButton = forwardRef<
|
|
178
|
+
HTMLButtonElement,
|
|
179
|
+
AgentComposerSendButtonProps
|
|
180
|
+
>(function AgentComposerSendButton(
|
|
181
|
+
{ variant: variantProp, className, ...props },
|
|
182
|
+
ref,
|
|
183
|
+
) {
|
|
184
|
+
const variant = useAgentComposerVariant(variantProp);
|
|
185
|
+
return (
|
|
186
|
+
<button
|
|
187
|
+
{...props}
|
|
188
|
+
ref={ref}
|
|
189
|
+
className={clsx(
|
|
190
|
+
variant === "welcome"
|
|
191
|
+
? "p-1.5 disabled:cursor-not-allowed disabled:opacity-50 rounded-cline-ui-md bg-[linear-gradient(145deg,var(--primary-emphasis),var(--primary))] text-white shadow-sm hover:brightness-110"
|
|
192
|
+
: "p-1.5 disabled:cursor-not-allowed disabled:opacity-50 rounded-full bg-cline-ui-primary text-cline-ui-background hover:bg-cline-ui-primary/80",
|
|
193
|
+
className,
|
|
194
|
+
)}
|
|
195
|
+
/>
|
|
196
|
+
);
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
export type AgentComposerAttachmentsProps = ComponentPropsWithoutRef<"div">;
|
|
200
|
+
|
|
201
|
+
export const AgentComposerAttachments = forwardRef<
|
|
202
|
+
HTMLDivElement,
|
|
203
|
+
AgentComposerAttachmentsProps
|
|
204
|
+
>(function AgentComposerAttachments({ className, ...props }, ref) {
|
|
205
|
+
return (
|
|
206
|
+
<div
|
|
207
|
+
{...props}
|
|
208
|
+
ref={ref}
|
|
209
|
+
className={clsx("mt-2 flex flex-wrap gap-1.5", className)}
|
|
210
|
+
/>
|
|
211
|
+
);
|
|
212
|
+
});
|
|
213
|
+
|
|
214
|
+
export type AgentComposerSettingsProps = ComponentPropsWithoutRef<"div">;
|
|
215
|
+
|
|
216
|
+
export const AgentComposerSettings = forwardRef<
|
|
217
|
+
HTMLDivElement,
|
|
218
|
+
AgentComposerSettingsProps
|
|
219
|
+
>(function AgentComposerSettings({ className, ...props }, ref) {
|
|
220
|
+
return (
|
|
221
|
+
<div
|
|
222
|
+
{...props}
|
|
223
|
+
ref={ref}
|
|
224
|
+
className={clsx(
|
|
225
|
+
"flex min-w-0 items-center justify-between gap-x-3 gap-y-2 rounded-b-cline-ui-xl border-t border-cline-ui-border bg-cline-ui-muted/20 px-2 py-2 text-cline-ui-sm text-cline-ui-muted-foreground",
|
|
226
|
+
className,
|
|
227
|
+
)}
|
|
228
|
+
/>
|
|
229
|
+
);
|
|
230
|
+
});
|
|
231
|
+
|
|
232
|
+
export type AgentComposerSettingsGroupProps = ComponentPropsWithoutRef<"div">;
|
|
233
|
+
|
|
234
|
+
export const AgentComposerSettingsGroup = forwardRef<
|
|
235
|
+
HTMLDivElement,
|
|
236
|
+
AgentComposerSettingsGroupProps
|
|
237
|
+
>(function AgentComposerSettingsGroup({ className, ...props }, ref) {
|
|
238
|
+
return (
|
|
239
|
+
<div
|
|
240
|
+
{...props}
|
|
241
|
+
ref={ref}
|
|
242
|
+
className={clsx("flex min-w-0 flex-auto items-center gap-2", className)}
|
|
243
|
+
/>
|
|
244
|
+
);
|
|
245
|
+
});
|
|
246
|
+
|
|
247
|
+
export type AgentComposerSettingsEndProps = ComponentPropsWithoutRef<"div">;
|
|
248
|
+
|
|
249
|
+
export const AgentComposerSettingsEnd = forwardRef<
|
|
250
|
+
HTMLDivElement,
|
|
251
|
+
AgentComposerSettingsEndProps
|
|
252
|
+
>(function AgentComposerSettingsEnd({ className, ...props }, ref) {
|
|
253
|
+
return (
|
|
254
|
+
<div
|
|
255
|
+
{...props}
|
|
256
|
+
ref={ref}
|
|
257
|
+
className={clsx(
|
|
258
|
+
"ml-auto flex min-w-0 items-center gap-2 max-[560px]:shrink-0",
|
|
259
|
+
className,
|
|
260
|
+
)}
|
|
261
|
+
/>
|
|
262
|
+
);
|
|
263
|
+
});
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import type { ReactNode } from "react";
|
|
4
|
+
|
|
5
|
+
/** Current request context metrics, not accumulated session token traffic. */
|
|
6
|
+
export interface AgentContextUsageData {
|
|
7
|
+
tokensIn: number;
|
|
8
|
+
tokensOut: number;
|
|
9
|
+
cacheReadTokens: number;
|
|
10
|
+
contextWindow?: number;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface AgentContextUsagePresentation {
|
|
14
|
+
/** Accessible name for the host-owned trigger. */
|
|
15
|
+
triggerLabel: string;
|
|
16
|
+
/** Decorative SVG; place inside the host's trigger without another wrapper. */
|
|
17
|
+
ring: ReactNode;
|
|
18
|
+
/** Popover body; the host owns the popover's positioning and interactions. */
|
|
19
|
+
details: ReactNode;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface AgentContextUsageProps {
|
|
23
|
+
usage: AgentContextUsageData;
|
|
24
|
+
/** Optional host-formatted session cost, separate from current context usage. */
|
|
25
|
+
costLabel?: ReactNode;
|
|
26
|
+
children: (presentation: AgentContextUsagePresentation) => ReactNode;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Desktop's context meter and details, composed into host-owned controls.
|
|
31
|
+
* Produces no wrapper or trigger when usage/context metadata is unavailable.
|
|
32
|
+
*/
|
|
33
|
+
export function AgentContextUsage({
|
|
34
|
+
usage,
|
|
35
|
+
costLabel,
|
|
36
|
+
children,
|
|
37
|
+
}: AgentContextUsageProps) {
|
|
38
|
+
const contextWindow = usage.contextWindow;
|
|
39
|
+
const totalTokens = usage.tokensIn + usage.tokensOut;
|
|
40
|
+
if (totalTokens <= 0 || !contextWindow || contextWindow <= 0) {
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const ratio = Math.min(
|
|
45
|
+
Math.max(totalTokens / Math.max(contextWindow, 1), 0),
|
|
46
|
+
1,
|
|
47
|
+
);
|
|
48
|
+
const percent = Math.round(ratio * 100);
|
|
49
|
+
const ringColorClass =
|
|
50
|
+
ratio >= 0.75
|
|
51
|
+
? "stroke-red-500"
|
|
52
|
+
: ratio >= 0.5
|
|
53
|
+
? "stroke-orange-500"
|
|
54
|
+
: "stroke-cline-ui-primary";
|
|
55
|
+
const contextUsageLabel = `${formatCompactTokens(totalTokens)} / ${formatCompactTokens(contextWindow)} (${percent}%)`;
|
|
56
|
+
const cachedTokens = Math.min(usage.cacheReadTokens, usage.tokensIn);
|
|
57
|
+
const uncachedInputTokens = Math.max(usage.tokensIn - cachedTokens, 0);
|
|
58
|
+
const segmentScale =
|
|
59
|
+
totalTokens > contextWindow ? contextWindow / totalTokens : 1;
|
|
60
|
+
const segmentWidth = (tokens: number) =>
|
|
61
|
+
`${(tokens / contextWindow) * segmentScale * 100}%`;
|
|
62
|
+
const radius = 8.5;
|
|
63
|
+
const circumference = 2 * Math.PI * radius;
|
|
64
|
+
|
|
65
|
+
return children({
|
|
66
|
+
triggerLabel: `Context window: ${totalTokens.toLocaleString()} of ${contextWindow.toLocaleString()} tokens used (${percent}%)`,
|
|
67
|
+
ring: (
|
|
68
|
+
<svg
|
|
69
|
+
aria-hidden="true"
|
|
70
|
+
className="-rotate-90 size-3.5"
|
|
71
|
+
height="22"
|
|
72
|
+
viewBox="0 0 22 22"
|
|
73
|
+
width="22"
|
|
74
|
+
>
|
|
75
|
+
<circle
|
|
76
|
+
className="stroke-cline-ui-muted-foreground/20"
|
|
77
|
+
cx="11"
|
|
78
|
+
cy="11"
|
|
79
|
+
fill="none"
|
|
80
|
+
r={radius}
|
|
81
|
+
strokeWidth="4"
|
|
82
|
+
/>
|
|
83
|
+
<circle
|
|
84
|
+
className={ringColorClass}
|
|
85
|
+
cx="11"
|
|
86
|
+
cy="11"
|
|
87
|
+
fill="none"
|
|
88
|
+
r={radius}
|
|
89
|
+
strokeDasharray={circumference}
|
|
90
|
+
strokeDashoffset={circumference * (1 - ratio)}
|
|
91
|
+
strokeLinecap="round"
|
|
92
|
+
strokeWidth="4"
|
|
93
|
+
/>
|
|
94
|
+
</svg>
|
|
95
|
+
),
|
|
96
|
+
details: (
|
|
97
|
+
<div className="px-3 py-3">
|
|
98
|
+
<div className="flex items-center justify-between gap-4 text-cline-ui-sm">
|
|
99
|
+
<span className="text-cline-ui-muted-foreground">Context window</span>
|
|
100
|
+
<span className="font-cline-ui-mono text-cline-ui-sm text-cline-ui-foreground">
|
|
101
|
+
{contextUsageLabel}
|
|
102
|
+
</span>
|
|
103
|
+
</div>
|
|
104
|
+
<div className="mt-2 flex h-1 overflow-hidden rounded-full bg-cline-ui-muted">
|
|
105
|
+
<div
|
|
106
|
+
aria-hidden="true"
|
|
107
|
+
className="h-full shrink-0 bg-cline-ui-primary transition-[width] duration-120"
|
|
108
|
+
data-token-kind="uncached-input"
|
|
109
|
+
style={{ width: segmentWidth(uncachedInputTokens) }}
|
|
110
|
+
/>
|
|
111
|
+
<div
|
|
112
|
+
aria-hidden="true"
|
|
113
|
+
className="h-full shrink-0 bg-cline-ui-primary/60 transition-[background,width] duration-120"
|
|
114
|
+
data-token-kind="cached-input"
|
|
115
|
+
style={{
|
|
116
|
+
backgroundImage:
|
|
117
|
+
"linear-gradient(to right, var(--primary), color-mix(in srgb, var(--primary) 60%, transparent))",
|
|
118
|
+
width: segmentWidth(cachedTokens),
|
|
119
|
+
}}
|
|
120
|
+
/>
|
|
121
|
+
<div
|
|
122
|
+
aria-hidden="true"
|
|
123
|
+
className="h-full shrink-0 bg-blue-500 transition-[background,width] duration-120"
|
|
124
|
+
data-token-kind="output"
|
|
125
|
+
style={{
|
|
126
|
+
backgroundImage:
|
|
127
|
+
"linear-gradient(to right, color-mix(in srgb, var(--primary) 60%, transparent), var(--color-blue-500))",
|
|
128
|
+
width: segmentWidth(usage.tokensOut),
|
|
129
|
+
}}
|
|
130
|
+
/>
|
|
131
|
+
</div>
|
|
132
|
+
<div className="mt-3 space-y-2 text-cline-ui-sm">
|
|
133
|
+
<div className="flex items-center justify-between gap-4">
|
|
134
|
+
<span className="text-cline-ui-muted-foreground">Input tokens</span>
|
|
135
|
+
<span className="font-cline-ui-mono text-cline-ui-foreground">
|
|
136
|
+
{usage.tokensIn.toLocaleString()}
|
|
137
|
+
</span>
|
|
138
|
+
</div>
|
|
139
|
+
<div className="flex items-center justify-between gap-4">
|
|
140
|
+
<span className="text-cline-ui-muted-foreground">
|
|
141
|
+
Output tokens
|
|
142
|
+
</span>
|
|
143
|
+
<span className="font-cline-ui-mono text-cline-ui-foreground">
|
|
144
|
+
{usage.tokensOut.toLocaleString()}
|
|
145
|
+
</span>
|
|
146
|
+
</div>
|
|
147
|
+
<div className="flex items-center justify-between gap-4">
|
|
148
|
+
<span className="text-cline-ui-muted-foreground">
|
|
149
|
+
Cached tokens
|
|
150
|
+
</span>
|
|
151
|
+
<span className="font-cline-ui-mono text-cline-ui-foreground">
|
|
152
|
+
{usage.cacheReadTokens.toLocaleString()}
|
|
153
|
+
</span>
|
|
154
|
+
</div>
|
|
155
|
+
{costLabel || costLabel === 0 ? (
|
|
156
|
+
<div className="flex items-center justify-between gap-4">
|
|
157
|
+
<span className="text-cline-ui-muted-foreground">Cost</span>
|
|
158
|
+
<span className="font-cline-ui-mono text-cline-ui-foreground">
|
|
159
|
+
{costLabel}
|
|
160
|
+
</span>
|
|
161
|
+
</div>
|
|
162
|
+
) : null}
|
|
163
|
+
</div>
|
|
164
|
+
</div>
|
|
165
|
+
),
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
function formatCompactTokens(value: number): string {
|
|
170
|
+
if (value >= 1_000_000) {
|
|
171
|
+
return `${(value / 1_000_000).toFixed(1)}M`;
|
|
172
|
+
}
|
|
173
|
+
if (value >= 1_000) {
|
|
174
|
+
return `${formatCompactUnit(value / 1_000)}k`;
|
|
175
|
+
}
|
|
176
|
+
return value.toLocaleString();
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
function formatCompactUnit(value: number): string {
|
|
180
|
+
return value.toFixed(1).replace(/\.0$/, "");
|
|
181
|
+
}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { clsx } from "clsx";
|
|
4
|
+
import type { ComponentPropsWithoutRef, ReactNode } from "react";
|
|
5
|
+
|
|
6
|
+
export type AgentSessionContentProps = ComponentPropsWithoutRef<"div">;
|
|
7
|
+
|
|
8
|
+
/** Shared width constraint for both the transcript and its composer. */
|
|
9
|
+
export function AgentSessionContent({
|
|
10
|
+
children,
|
|
11
|
+
className,
|
|
12
|
+
...props
|
|
13
|
+
}: AgentSessionContentProps) {
|
|
14
|
+
return (
|
|
15
|
+
<div
|
|
16
|
+
{...props}
|
|
17
|
+
className={clsx(
|
|
18
|
+
"mx-auto w-full min-w-0 max-w-(--breakpoint-lg)",
|
|
19
|
+
className,
|
|
20
|
+
)}
|
|
21
|
+
>
|
|
22
|
+
{children}
|
|
23
|
+
</div>
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface AgentConversationHeaderProps
|
|
28
|
+
extends Omit<ComponentPropsWithoutRef<"header">, "children" | "title"> {
|
|
29
|
+
/** Status, title/editor, and title menu, in reading order. */
|
|
30
|
+
children: ReactNode;
|
|
31
|
+
/** Host-owned controls. Omit to remove the action group entirely. */
|
|
32
|
+
actions?: ReactNode;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** Presentation only: title editing, menus, navigation and native chrome stay with the host. */
|
|
36
|
+
export function AgentConversationHeader({
|
|
37
|
+
children,
|
|
38
|
+
actions,
|
|
39
|
+
className,
|
|
40
|
+
...props
|
|
41
|
+
}: AgentConversationHeaderProps) {
|
|
42
|
+
return (
|
|
43
|
+
<header
|
|
44
|
+
{...props}
|
|
45
|
+
className={clsx(
|
|
46
|
+
"flex h-12 items-center justify-between gap-2 px-4",
|
|
47
|
+
className,
|
|
48
|
+
)}
|
|
49
|
+
>
|
|
50
|
+
<div className="flex min-w-0 flex-1 items-center gap-2">{children}</div>
|
|
51
|
+
{actions != null && actions !== false ? (
|
|
52
|
+
<div className="flex shrink-0 items-center gap-2">{actions}</div>
|
|
53
|
+
) : null}
|
|
54
|
+
</header>
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface AgentConversationLayoutProps {
|
|
59
|
+
/** Switches between the welcome composition and an existing conversation. */
|
|
60
|
+
welcome: boolean;
|
|
61
|
+
welcomeHeader?: ReactNode;
|
|
62
|
+
body: ReactNode;
|
|
63
|
+
composer: ReactNode;
|
|
64
|
+
notice?: ReactNode;
|
|
65
|
+
/** An onboarding or setup surface above the composer. */
|
|
66
|
+
welcomeSetup?: ReactNode;
|
|
67
|
+
/** Hide without unmounting the welcome composer while setup is shown. */
|
|
68
|
+
hideWelcomeComposer?: boolean;
|
|
69
|
+
welcomeFooter?: ReactNode;
|
|
70
|
+
/** Optional host animation class for the conversation body. */
|
|
71
|
+
bodyClassName?: string;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/** Keeps transcript and composer containers mounted while the welcome state changes. */
|
|
75
|
+
export function AgentConversationLayout({
|
|
76
|
+
welcome,
|
|
77
|
+
welcomeHeader,
|
|
78
|
+
body,
|
|
79
|
+
composer,
|
|
80
|
+
notice,
|
|
81
|
+
welcomeSetup,
|
|
82
|
+
hideWelcomeComposer = false,
|
|
83
|
+
welcomeFooter,
|
|
84
|
+
bodyClassName,
|
|
85
|
+
}: AgentConversationLayoutProps) {
|
|
86
|
+
return (
|
|
87
|
+
<div
|
|
88
|
+
className={
|
|
89
|
+
welcome
|
|
90
|
+
? "relative h-full min-h-0 overflow-hidden bg-cline-ui-background"
|
|
91
|
+
: "contents"
|
|
92
|
+
}
|
|
93
|
+
>
|
|
94
|
+
<div
|
|
95
|
+
className={
|
|
96
|
+
welcome
|
|
97
|
+
? "relative z-10 h-full w-full overflow-x-hidden overflow-y-auto"
|
|
98
|
+
: "contents"
|
|
99
|
+
}
|
|
100
|
+
>
|
|
101
|
+
<div
|
|
102
|
+
className={
|
|
103
|
+
welcome
|
|
104
|
+
? "mx-auto flex w-full max-w-240 flex-col px-6 pb-32 pt-[clamp(8rem,26vh,17rem)] max-[720px]:px-4 max-[720px]:pb-20 max-[720px]:pt-16"
|
|
105
|
+
: "contents"
|
|
106
|
+
}
|
|
107
|
+
>
|
|
108
|
+
{welcome ? welcomeHeader : null}
|
|
109
|
+
<div
|
|
110
|
+
className={
|
|
111
|
+
welcome
|
|
112
|
+
? "hidden"
|
|
113
|
+
: clsx(bodyClassName, "h-full min-h-0 overflow-hidden")
|
|
114
|
+
}
|
|
115
|
+
key="conversation-body"
|
|
116
|
+
>
|
|
117
|
+
{body}
|
|
118
|
+
</div>
|
|
119
|
+
{welcome ? notice : null}
|
|
120
|
+
{welcome ? welcomeSetup : null}
|
|
121
|
+
<div
|
|
122
|
+
className={clsx(
|
|
123
|
+
welcome ? "mt-4 w-full" : "z-20 shrink-0 px-6 pb-6",
|
|
124
|
+
welcome && hideWelcomeComposer && "hidden",
|
|
125
|
+
)}
|
|
126
|
+
key="persistent-composer"
|
|
127
|
+
>
|
|
128
|
+
{welcome ? (
|
|
129
|
+
composer
|
|
130
|
+
) : (
|
|
131
|
+
<AgentSessionContent>{composer}</AgentSessionContent>
|
|
132
|
+
)}
|
|
133
|
+
</div>
|
|
134
|
+
{welcome ? welcomeFooter : null}
|
|
135
|
+
</div>
|
|
136
|
+
</div>
|
|
137
|
+
</div>
|
|
138
|
+
);
|
|
139
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
.cline-ui-agent-hero-heading {
|
|
2
|
+
margin: 0;
|
|
3
|
+
color: var(--foreground);
|
|
4
|
+
font-size: clamp(2rem, 3vw, 2.6rem);
|
|
5
|
+
font-weight: var(--font-weight-semibold);
|
|
6
|
+
letter-spacing: -0.025em;
|
|
7
|
+
line-height: 1.12;
|
|
8
|
+
text-align: left;
|
|
9
|
+
text-wrap: balance;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/* Opacity and transform avoid per-character blur repaints. */
|
|
13
|
+
.cline-ui-agent-hero-heading__character {
|
|
14
|
+
display: inline-block;
|
|
15
|
+
white-space: pre;
|
|
16
|
+
color: var(--brand-violet);
|
|
17
|
+
animation: cline-ui-agent-hero-word-in 0.5s cubic-bezier(0.2, 0.65, 0.3, 1)
|
|
18
|
+
both;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/* Per-character clipping avoids invisible text on transformed WebKit layers. */
|
|
22
|
+
@supports ((-webkit-background-clip: text) or (background-clip: text)) {
|
|
23
|
+
.cline-ui-agent-hero-heading__character {
|
|
24
|
+
background-image: linear-gradient(
|
|
25
|
+
135deg,
|
|
26
|
+
var(--brand-periwinkle),
|
|
27
|
+
var(--brand-violet) 55%,
|
|
28
|
+
var(--brand-magenta)
|
|
29
|
+
);
|
|
30
|
+
-webkit-background-clip: text;
|
|
31
|
+
background-clip: text;
|
|
32
|
+
-webkit-text-fill-color: transparent;
|
|
33
|
+
color: transparent;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
@media (prefers-reduced-motion: reduce) {
|
|
38
|
+
.cline-ui-agent-hero-heading__character {
|
|
39
|
+
animation: none;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
@keyframes cline-ui-agent-hero-word-in {
|
|
44
|
+
0% {
|
|
45
|
+
opacity: 0;
|
|
46
|
+
transform: translateY(0.42em);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
100% {
|
|
50
|
+
opacity: 1;
|
|
51
|
+
transform: translateY(0);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { useEffect, useState } from "react";
|
|
4
|
+
|
|
5
|
+
const HERO_VERBS = ["build", "create", "fix", "know"] as const;
|
|
6
|
+
const HERO_CYCLE_MS = 5000;
|
|
7
|
+
|
|
8
|
+
export function AgentHeroHeading() {
|
|
9
|
+
const [verbIndex, setVerbIndex] = useState(0);
|
|
10
|
+
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
const media = window.matchMedia?.("(prefers-reduced-motion: reduce)");
|
|
13
|
+
if (media?.matches) return;
|
|
14
|
+
const interval = window.setInterval(() => {
|
|
15
|
+
setVerbIndex((current) => (current + 1) % HERO_VERBS.length);
|
|
16
|
+
}, HERO_CYCLE_MS);
|
|
17
|
+
return () => window.clearInterval(interval);
|
|
18
|
+
}, []);
|
|
19
|
+
|
|
20
|
+
const verb = HERO_VERBS[verbIndex];
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<h1
|
|
24
|
+
aria-label="What would you like to build?"
|
|
25
|
+
className="cline-ui-agent-hero-heading"
|
|
26
|
+
>
|
|
27
|
+
<span aria-hidden="true">
|
|
28
|
+
What would you like to{" "}
|
|
29
|
+
<span className="cline-ui-agent-hero-heading__word" key={verb}>
|
|
30
|
+
{verb.split("").map((character, index) => (
|
|
31
|
+
<span
|
|
32
|
+
className="cline-ui-agent-hero-heading__character"
|
|
33
|
+
// biome-ignore lint/suspicious/noArrayIndexKey: the keyed word remounts as a unit and character positions never reorder
|
|
34
|
+
key={`${verb}-${index}`}
|
|
35
|
+
style={{ animationDelay: `${index * 45}ms` }}
|
|
36
|
+
>
|
|
37
|
+
{character}
|
|
38
|
+
</span>
|
|
39
|
+
))}
|
|
40
|
+
</span>
|
|
41
|
+
?
|
|
42
|
+
</span>
|
|
43
|
+
</h1>
|
|
44
|
+
);
|
|
45
|
+
}
|