@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,346 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
ChevronDown,
|
|
5
|
+
ExternalLink,
|
|
6
|
+
GitBranch,
|
|
7
|
+
GitMerge,
|
|
8
|
+
GitPullRequest,
|
|
9
|
+
GitPullRequestClosed,
|
|
10
|
+
GitPullRequestDraft,
|
|
11
|
+
RefreshCw,
|
|
12
|
+
X,
|
|
13
|
+
} from "lucide-react";
|
|
14
|
+
import type { ReactElement, ReactNode } from "react";
|
|
15
|
+
|
|
16
|
+
export type AgentPullRequestCheck = {
|
|
17
|
+
name: string;
|
|
18
|
+
state: "pending" | "success" | "failure" | "skipped";
|
|
19
|
+
url?: string;
|
|
20
|
+
};
|
|
21
|
+
export type AgentPullRequestData = {
|
|
22
|
+
repository: string;
|
|
23
|
+
branch: string;
|
|
24
|
+
branchUrl?: string;
|
|
25
|
+
createUrl?: string | null;
|
|
26
|
+
published?: boolean;
|
|
27
|
+
pullRequest?: {
|
|
28
|
+
number: number;
|
|
29
|
+
title: string;
|
|
30
|
+
url: string;
|
|
31
|
+
state: "OPEN" | "CLOSED" | "MERGED";
|
|
32
|
+
isDraft: boolean;
|
|
33
|
+
mergeable: "MERGEABLE" | "CONFLICTING" | "UNKNOWN";
|
|
34
|
+
mergeStateStatus: string;
|
|
35
|
+
additions?: number;
|
|
36
|
+
deletions?: number;
|
|
37
|
+
checks?: AgentPullRequestCheck[];
|
|
38
|
+
checksUnavailable?: boolean;
|
|
39
|
+
} | null;
|
|
40
|
+
};
|
|
41
|
+
export type AgentPullRequestNavigation = "open" | "create" | "check" | "branch";
|
|
42
|
+
export type AgentPullRequestBarProps = {
|
|
43
|
+
data?: AgentPullRequestData | null;
|
|
44
|
+
error?: string | null;
|
|
45
|
+
loading?: boolean;
|
|
46
|
+
onRefresh: () => void;
|
|
47
|
+
onDismissError?: () => void;
|
|
48
|
+
/** Native hosts intercept navigation; web hosts use ordinary external links. */
|
|
49
|
+
onNavigate?: (url: string, action: AgentPullRequestNavigation) => void;
|
|
50
|
+
/** Hosts supply their established accessible popover, including its portal. */
|
|
51
|
+
renderChecks: (trigger: ReactElement, content: ReactElement) => ReactNode;
|
|
52
|
+
};
|
|
53
|
+
export function getAgentPullRequestMergeStatus(
|
|
54
|
+
pr: NonNullable<AgentPullRequestData["pullRequest"]>,
|
|
55
|
+
) {
|
|
56
|
+
if (pr.state === "MERGED")
|
|
57
|
+
return { label: "Merged", tone: "merged" } as const;
|
|
58
|
+
if (pr.state === "CLOSED")
|
|
59
|
+
return { label: "Closed", tone: "failure" } as const;
|
|
60
|
+
if (pr.isDraft) return { label: "Draft", tone: "neutral" } as const;
|
|
61
|
+
if (pr.mergeable === "CONFLICTING" || pr.mergeStateStatus === "DIRTY")
|
|
62
|
+
return { label: "Conflicts", tone: "failure" } as const;
|
|
63
|
+
if (pr.mergeStateStatus === "BLOCKED")
|
|
64
|
+
return { label: "Blocked", tone: "warning" } as const;
|
|
65
|
+
if (pr.mergeStateStatus === "BEHIND")
|
|
66
|
+
return { label: "Behind base", tone: "warning" } as const;
|
|
67
|
+
if (pr.mergeStateStatus === "UNSTABLE")
|
|
68
|
+
return { label: "Checks failing", tone: "failure" } as const;
|
|
69
|
+
if (pr.mergeable === "UNKNOWN")
|
|
70
|
+
return { label: "Merge status pending", tone: "neutral" } as const;
|
|
71
|
+
if (pr.mergeStateStatus === "CLEAN")
|
|
72
|
+
return { label: "Ready to merge", tone: "success" } as const;
|
|
73
|
+
if (pr.mergeable === "MERGEABLE")
|
|
74
|
+
return { label: "No conflicts", tone: "neutral" } as const;
|
|
75
|
+
return { label: "Merge status pending", tone: "neutral" } as const;
|
|
76
|
+
}
|
|
77
|
+
export function summarizeAgentPullRequestChecks(
|
|
78
|
+
checks: AgentPullRequestCheck[],
|
|
79
|
+
) {
|
|
80
|
+
if (!checks.length) return "none";
|
|
81
|
+
if (checks.some((c) => c.state === "failure")) return "failure";
|
|
82
|
+
if (checks.some((c) => c.state === "pending")) return "pending";
|
|
83
|
+
if (checks.every((c) => c.state === "skipped")) return "skipped";
|
|
84
|
+
return "success";
|
|
85
|
+
}
|
|
86
|
+
const checkLabels = {
|
|
87
|
+
unavailable: "CI unavailable",
|
|
88
|
+
none: "No checks",
|
|
89
|
+
pending: "CI pending",
|
|
90
|
+
success: "CI passed",
|
|
91
|
+
failure: "CI failed",
|
|
92
|
+
skipped: "CI skipped",
|
|
93
|
+
};
|
|
94
|
+
const statusColors = {
|
|
95
|
+
merged: "text-purple-400",
|
|
96
|
+
failure: "text-red-400",
|
|
97
|
+
warning: "text-yellow-500",
|
|
98
|
+
neutral: "text-cline-ui-muted-foreground",
|
|
99
|
+
success: "text-green-500",
|
|
100
|
+
};
|
|
101
|
+
const checkColors = {
|
|
102
|
+
unavailable: "bg-cline-ui-muted-foreground",
|
|
103
|
+
none: "bg-cline-ui-muted-foreground",
|
|
104
|
+
pending: "bg-yellow-500",
|
|
105
|
+
success: "bg-green-500",
|
|
106
|
+
failure: "bg-red-500",
|
|
107
|
+
skipped: "bg-cline-ui-muted-foreground",
|
|
108
|
+
};
|
|
109
|
+
export function AgentPullRequestBar({
|
|
110
|
+
data,
|
|
111
|
+
error,
|
|
112
|
+
loading = false,
|
|
113
|
+
onRefresh,
|
|
114
|
+
onDismissError,
|
|
115
|
+
onNavigate,
|
|
116
|
+
renderChecks,
|
|
117
|
+
}: AgentPullRequestBarProps) {
|
|
118
|
+
const pr = data?.pullRequest;
|
|
119
|
+
const PullRequestIcon =
|
|
120
|
+
pr?.state === "MERGED"
|
|
121
|
+
? GitMerge
|
|
122
|
+
: pr?.state === "CLOSED"
|
|
123
|
+
? GitPullRequestClosed
|
|
124
|
+
: pr?.isDraft
|
|
125
|
+
? GitPullRequestDraft
|
|
126
|
+
: pr || data?.createUrl
|
|
127
|
+
? GitPullRequest
|
|
128
|
+
: GitBranch;
|
|
129
|
+
if (!error && !data?.branch && !pr) return null;
|
|
130
|
+
const status = pr ? getAgentPullRequestMergeStatus(pr) : null;
|
|
131
|
+
const ci =
|
|
132
|
+
!pr?.checks || pr.checksUnavailable
|
|
133
|
+
? "unavailable"
|
|
134
|
+
: summarizeAgentPullRequestChecks(pr.checks);
|
|
135
|
+
const link = (
|
|
136
|
+
url: string,
|
|
137
|
+
action: AgentPullRequestNavigation,
|
|
138
|
+
children: ReactNode,
|
|
139
|
+
title?: string,
|
|
140
|
+
label?: string,
|
|
141
|
+
) =>
|
|
142
|
+
onNavigate ? (
|
|
143
|
+
<button
|
|
144
|
+
type="button"
|
|
145
|
+
className={`cline-ui-pr-bar__link hover:underline ${action === "open" || action === "create" ? "shrink-0 font-medium" : "text-left"}`}
|
|
146
|
+
title={title}
|
|
147
|
+
aria-label={label}
|
|
148
|
+
onClick={() => onNavigate(url, action)}
|
|
149
|
+
>
|
|
150
|
+
{children}
|
|
151
|
+
{(action === "create" || action === "check") && (
|
|
152
|
+
<>
|
|
153
|
+
{" "}
|
|
154
|
+
<ExternalLink className="inline size-3" />
|
|
155
|
+
</>
|
|
156
|
+
)}
|
|
157
|
+
</button>
|
|
158
|
+
) : (
|
|
159
|
+
<a
|
|
160
|
+
className={`cline-ui-pr-bar__link hover:underline ${action === "open" || action === "create" ? "shrink-0 font-medium" : "text-left"}`}
|
|
161
|
+
href={url}
|
|
162
|
+
target="_blank"
|
|
163
|
+
rel="noopener noreferrer"
|
|
164
|
+
title={title}
|
|
165
|
+
aria-label={label}
|
|
166
|
+
>
|
|
167
|
+
{children}
|
|
168
|
+
{(action === "create" || action === "check") && (
|
|
169
|
+
<>
|
|
170
|
+
{" "}
|
|
171
|
+
<ExternalLink className="inline size-3" />
|
|
172
|
+
</>
|
|
173
|
+
)}
|
|
174
|
+
</a>
|
|
175
|
+
);
|
|
176
|
+
const checksContent = (
|
|
177
|
+
<div
|
|
178
|
+
className="cline-ui-pr-bar__checks p-3"
|
|
179
|
+
data-native-navigation={onNavigate ? true : undefined}
|
|
180
|
+
>
|
|
181
|
+
<p className="cline-ui-pr-bar__checks-title mb-2 text-cline-ui-sm font-medium">
|
|
182
|
+
Checks for #{pr?.number}
|
|
183
|
+
</p>
|
|
184
|
+
{ci === "unavailable" ? (
|
|
185
|
+
<p className="text-cline-ui-xs text-cline-ui-muted-foreground">
|
|
186
|
+
Checks could not be loaded. Refresh to try again.
|
|
187
|
+
</p>
|
|
188
|
+
) : ci === "none" ? (
|
|
189
|
+
<p className="text-cline-ui-xs text-cline-ui-muted-foreground">
|
|
190
|
+
No checks reported for this pull request.
|
|
191
|
+
</p>
|
|
192
|
+
) : null}
|
|
193
|
+
<ul className="max-h-64 space-y-2 overflow-y-auto">
|
|
194
|
+
{pr?.checks?.map((check, index) => (
|
|
195
|
+
<li
|
|
196
|
+
className="flex items-center gap-2 text-cline-ui-xs"
|
|
197
|
+
key={`${check.name}:${index}`}
|
|
198
|
+
>
|
|
199
|
+
<span
|
|
200
|
+
aria-hidden="true"
|
|
201
|
+
className={`cline-ui-pr-bar__dot size-2 shrink-0 rounded-full ${checkColors[check.state]}`}
|
|
202
|
+
data-state={check.state}
|
|
203
|
+
/>
|
|
204
|
+
<span className="cline-ui-pr-bar__check-name min-w-0 flex-1 break-words">
|
|
205
|
+
{check.url ? link(check.url, "check", check.name) : check.name}
|
|
206
|
+
</span>
|
|
207
|
+
<span
|
|
208
|
+
className={`cline-ui-pr-bar__muted text-cline-ui-muted-foreground ${onNavigate ? "" : "shrink-0"}`}
|
|
209
|
+
>
|
|
210
|
+
{check.state}
|
|
211
|
+
</span>
|
|
212
|
+
</li>
|
|
213
|
+
))}
|
|
214
|
+
</ul>
|
|
215
|
+
</div>
|
|
216
|
+
);
|
|
217
|
+
return (
|
|
218
|
+
<section
|
|
219
|
+
className="cline-ui-pr-bar border-b border-cline-ui-border px-4 py-2 text-cline-ui-xs"
|
|
220
|
+
aria-label="Pull request status"
|
|
221
|
+
data-native-navigation={onNavigate ? true : undefined}
|
|
222
|
+
>
|
|
223
|
+
{error && (
|
|
224
|
+
<div className="cline-ui-pr-bar__error mb-1 flex items-start gap-2 text-cline-ui-muted-foreground">
|
|
225
|
+
<output className="min-w-0 flex-1">{error}</output>
|
|
226
|
+
{onDismissError && (
|
|
227
|
+
<button
|
|
228
|
+
type="button"
|
|
229
|
+
aria-label="Dismiss pull request error"
|
|
230
|
+
className="shrink-0 rounded p-1 hover:bg-cline-ui-muted"
|
|
231
|
+
onClick={onDismissError}
|
|
232
|
+
>
|
|
233
|
+
<X className="size-3" />
|
|
234
|
+
</button>
|
|
235
|
+
)}
|
|
236
|
+
</div>
|
|
237
|
+
)}
|
|
238
|
+
<div className="cline-ui-pr-bar__row flex min-w-0 flex-wrap items-center gap-2">
|
|
239
|
+
{data &&
|
|
240
|
+
(data.branch ? (
|
|
241
|
+
<>
|
|
242
|
+
<PullRequestIcon
|
|
243
|
+
className={`cline-ui-pr-bar__icon size-4 shrink-0 cline-ui-pr-bar__tone--${status?.tone ?? "neutral"} ${statusColors[status?.tone ?? "neutral"]}`}
|
|
244
|
+
/>
|
|
245
|
+
{pr ? (
|
|
246
|
+
<>
|
|
247
|
+
{link(
|
|
248
|
+
pr.url,
|
|
249
|
+
"open",
|
|
250
|
+
<>#{pr.number}</>,
|
|
251
|
+
pr.title,
|
|
252
|
+
`Open pull request #${pr.number}: ${pr.title}`,
|
|
253
|
+
)}
|
|
254
|
+
<span
|
|
255
|
+
className={`shrink-0 cline-ui-pr-bar__tone--${status?.tone} ${statusColors[status?.tone ?? "neutral"]}`}
|
|
256
|
+
>
|
|
257
|
+
{status?.label}
|
|
258
|
+
</span>
|
|
259
|
+
</>
|
|
260
|
+
) : data.createUrl ? (
|
|
261
|
+
link(
|
|
262
|
+
data.createUrl,
|
|
263
|
+
"create",
|
|
264
|
+
"Create PR",
|
|
265
|
+
"Open GitHub’s comparison form for this branch. Push your commits before submitting.",
|
|
266
|
+
)
|
|
267
|
+
) : null}
|
|
268
|
+
<span
|
|
269
|
+
className="cline-ui-pr-bar__branch min-w-0 flex-1 truncate text-cline-ui-muted-foreground"
|
|
270
|
+
title={`${data.repository} · ${data.branch}`}
|
|
271
|
+
>
|
|
272
|
+
{data.repository.split("/").pop()}{" "}
|
|
273
|
+
<span className="ml-1">
|
|
274
|
+
{data.branchUrl
|
|
275
|
+
? link(
|
|
276
|
+
data.branchUrl,
|
|
277
|
+
"branch",
|
|
278
|
+
<span className="min-w-0 truncate">{data.branch}</span>,
|
|
279
|
+
)
|
|
280
|
+
: data.branch}
|
|
281
|
+
</span>
|
|
282
|
+
</span>
|
|
283
|
+
{!pr && data.published === false && (
|
|
284
|
+
<span>Task branch not on GitHub</span>
|
|
285
|
+
)}
|
|
286
|
+
{pr && (
|
|
287
|
+
<>
|
|
288
|
+
{pr.additions !== undefined && pr.deletions !== undefined && (
|
|
289
|
+
<span
|
|
290
|
+
className="cline-ui-pr-bar__counts shrink-0 tabular-nums"
|
|
291
|
+
{...(onNavigate
|
|
292
|
+
? {}
|
|
293
|
+
: {
|
|
294
|
+
role: "img",
|
|
295
|
+
"aria-label": `${pr.additions} additions, ${pr.deletions} deletions`,
|
|
296
|
+
})}
|
|
297
|
+
title={`${pr.additions} additions, ${pr.deletions} deletions`}
|
|
298
|
+
>
|
|
299
|
+
<span className="cline-ui-pr-bar__tone--success text-green-500">
|
|
300
|
+
+{pr.additions.toLocaleString()}
|
|
301
|
+
</span>{" "}
|
|
302
|
+
<span className="cline-ui-pr-bar__tone--failure text-red-400">
|
|
303
|
+
−{pr.deletions.toLocaleString()}
|
|
304
|
+
</span>
|
|
305
|
+
</span>
|
|
306
|
+
)}
|
|
307
|
+
{renderChecks(
|
|
308
|
+
<button
|
|
309
|
+
type="button"
|
|
310
|
+
className="cline-ui-pr-bar__check-trigger flex shrink-0 items-center gap-1.5 rounded-md bg-cline-ui-muted px-2 py-1"
|
|
311
|
+
aria-label={
|
|
312
|
+
ci === "none" ? "No CI checks" : checkLabels[ci]
|
|
313
|
+
}
|
|
314
|
+
>
|
|
315
|
+
<span
|
|
316
|
+
aria-hidden="true"
|
|
317
|
+
className={`cline-ui-pr-bar__dot size-2 rounded-full ${checkColors[ci]}`}
|
|
318
|
+
data-state={ci}
|
|
319
|
+
/>
|
|
320
|
+
{checkLabels[ci]}
|
|
321
|
+
<ChevronDown className="size-3" />
|
|
322
|
+
</button>,
|
|
323
|
+
checksContent,
|
|
324
|
+
)}
|
|
325
|
+
</>
|
|
326
|
+
)}
|
|
327
|
+
</>
|
|
328
|
+
) : (
|
|
329
|
+
<span>Task branch unavailable.</span>
|
|
330
|
+
))}
|
|
331
|
+
<button
|
|
332
|
+
type="button"
|
|
333
|
+
disabled={loading}
|
|
334
|
+
onClick={onRefresh}
|
|
335
|
+
aria-label="Refresh pull request status"
|
|
336
|
+
title="Refresh pull request status"
|
|
337
|
+
className="cline-ui-pr-bar__refresh shrink-0 rounded p-1 text-cline-ui-muted-foreground hover:bg-cline-ui-muted disabled:opacity-50"
|
|
338
|
+
>
|
|
339
|
+
<RefreshCw
|
|
340
|
+
className={`size-3 ${loading ? `animate-spin ${onNavigate ? "" : "motion-reduce:animate-none"}` : ""}`}
|
|
341
|
+
/>
|
|
342
|
+
</button>
|
|
343
|
+
</div>
|
|
344
|
+
</section>
|
|
345
|
+
);
|
|
346
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
.cline-ui-agent-quick-actions,
|
|
2
|
+
.cline-ui-agent-quick-actions__item {
|
|
3
|
+
box-sizing: border-box;
|
|
4
|
+
border-style: solid;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.cline-ui-agent-quick-actions__item {
|
|
8
|
+
font: inherit;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.cline-ui-agent-quick-actions__item:hover:not(:disabled) {
|
|
12
|
+
background: color-mix(in oklab, var(--background) 55%, transparent);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.cline-ui-agent-quick-actions__item:hover:not(:disabled)
|
|
16
|
+
.cline-ui-agent-quick-actions__arrow {
|
|
17
|
+
background: var(--primary);
|
|
18
|
+
color: var(--primary-foreground);
|
|
19
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
export interface AgentQuickAction {
|
|
2
|
+
description: string;
|
|
3
|
+
id: string;
|
|
4
|
+
label: string;
|
|
5
|
+
value: string;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface AgentQuickActionsProps {
|
|
9
|
+
actions: AgentQuickAction[];
|
|
10
|
+
className?: string;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
onSelect: (action: AgentQuickAction) => void;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function AgentQuickActions({
|
|
16
|
+
actions,
|
|
17
|
+
className,
|
|
18
|
+
disabled = false,
|
|
19
|
+
onSelect,
|
|
20
|
+
}: AgentQuickActionsProps) {
|
|
21
|
+
if (actions.length === 0) return null;
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<div
|
|
25
|
+
className={[
|
|
26
|
+
"cline-ui-agent-quick-actions w-full overflow-hidden rounded-cline-ui-xl border border-cline-ui-border/60 bg-cline-ui-background/95 px-2 shadow-sm",
|
|
27
|
+
className,
|
|
28
|
+
]
|
|
29
|
+
.filter(Boolean)
|
|
30
|
+
.join(" ")}
|
|
31
|
+
>
|
|
32
|
+
{actions.map((action) => (
|
|
33
|
+
<button
|
|
34
|
+
className="cline-ui-agent-quick-actions__item flex w-full cursor-pointer items-center justify-between gap-5 rounded-none border-0 bg-transparent p-3 text-left text-inherit transition-[background-color] duration-150 ease-in-out not-last:border-b not-last:border-cline-ui-border/80 focus-visible:outline-none focus-visible:shadow-[inset_0_0_0_2px_var(--ring)] disabled:cursor-not-allowed disabled:opacity-50"
|
|
35
|
+
disabled={disabled}
|
|
36
|
+
key={action.id}
|
|
37
|
+
onClick={() => onSelect(action)}
|
|
38
|
+
type="button"
|
|
39
|
+
>
|
|
40
|
+
<span className="cline-ui-agent-quick-actions__copy min-w-0">
|
|
41
|
+
<span className="cline-ui-agent-quick-actions__label block font-cline-ui-medium text-[0.9375rem] text-cline-ui-foreground">
|
|
42
|
+
{action.label}
|
|
43
|
+
</span>
|
|
44
|
+
<span className="cline-ui-agent-quick-actions__description mt-0.5 block overflow-hidden text-ellipsis whitespace-nowrap text-cline-ui-muted-foreground text-cline-ui-sm">
|
|
45
|
+
{action.description}
|
|
46
|
+
</span>
|
|
47
|
+
</span>
|
|
48
|
+
<span
|
|
49
|
+
aria-hidden="true"
|
|
50
|
+
className="cline-ui-agent-quick-actions__arrow flex size-7 shrink-0 items-center justify-center rounded-cline-ui-md bg-cline-ui-primary/10 text-cline-ui-primary transition-[background-color,color] duration-150 ease-in-out"
|
|
51
|
+
>
|
|
52
|
+
<svg
|
|
53
|
+
aria-hidden="true"
|
|
54
|
+
className="block size-3"
|
|
55
|
+
fill="none"
|
|
56
|
+
stroke="currentColor"
|
|
57
|
+
strokeLinecap="round"
|
|
58
|
+
strokeLinejoin="round"
|
|
59
|
+
strokeWidth="2"
|
|
60
|
+
viewBox="0 0 24 24"
|
|
61
|
+
>
|
|
62
|
+
<path d="M5 12h14" />
|
|
63
|
+
<path d="m12 5 7 7-7 7" />
|
|
64
|
+
</svg>
|
|
65
|
+
</span>
|
|
66
|
+
</button>
|
|
67
|
+
))}
|
|
68
|
+
</div>
|
|
69
|
+
);
|
|
70
|
+
}
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { clsx } from "clsx";
|
|
4
|
+
import {
|
|
5
|
+
type ComponentPropsWithoutRef,
|
|
6
|
+
forwardRef,
|
|
7
|
+
type ReactNode,
|
|
8
|
+
} from "react";
|
|
9
|
+
|
|
10
|
+
interface AgentSessionRowSharedProps
|
|
11
|
+
extends Omit<ComponentPropsWithoutRef<"div">, "children" | "onSelect"> {
|
|
12
|
+
active?: boolean;
|
|
13
|
+
/** Pending actions take precedence over runtime status; unread is idle-only. */
|
|
14
|
+
status?: "idle" | "pending" | "provisioning" | "running";
|
|
15
|
+
unread?: boolean;
|
|
16
|
+
label: ReactNode;
|
|
17
|
+
timestamp?: ReactNode;
|
|
18
|
+
leading?: ReactNode;
|
|
19
|
+
pinnedIndicator?: ReactNode;
|
|
20
|
+
/** A sibling action, so interactive controls never nest inside the row button. */
|
|
21
|
+
action?: ReactNode;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
interface AgentSessionRowDefaultControlProps {
|
|
25
|
+
disabled?: boolean;
|
|
26
|
+
onSelect?: ComponentPropsWithoutRef<"button">["onClick"];
|
|
27
|
+
renderControl?: undefined;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
interface AgentSessionRowHostControlProps {
|
|
31
|
+
/** Opt into host-owned URL/router semantics while reusing the row presentation. */
|
|
32
|
+
renderControl: (props: {
|
|
33
|
+
className: string;
|
|
34
|
+
children: ReactNode;
|
|
35
|
+
}) => ReactNode;
|
|
36
|
+
disabled?: never;
|
|
37
|
+
onSelect?: never;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export type AgentSessionRowProps = AgentSessionRowSharedProps &
|
|
41
|
+
(AgentSessionRowDefaultControlProps | AgentSessionRowHostControlProps);
|
|
42
|
+
|
|
43
|
+
/** Presentation only. Root props/ref support host-owned hover/context triggers. */
|
|
44
|
+
export const AgentSessionRow = forwardRef<HTMLDivElement, AgentSessionRowProps>(
|
|
45
|
+
function AgentSessionRow(
|
|
46
|
+
{
|
|
47
|
+
active = false,
|
|
48
|
+
disabled = false,
|
|
49
|
+
status = "idle",
|
|
50
|
+
unread = false,
|
|
51
|
+
label,
|
|
52
|
+
timestamp,
|
|
53
|
+
leading,
|
|
54
|
+
pinnedIndicator,
|
|
55
|
+
action,
|
|
56
|
+
onSelect,
|
|
57
|
+
renderControl,
|
|
58
|
+
className,
|
|
59
|
+
...props
|
|
60
|
+
},
|
|
61
|
+
ref,
|
|
62
|
+
) {
|
|
63
|
+
const statusDotClass =
|
|
64
|
+
status === "pending"
|
|
65
|
+
? "bg-yellow-400"
|
|
66
|
+
: status === "provisioning"
|
|
67
|
+
? "animate-pulse bg-yellow-400"
|
|
68
|
+
: status === "running"
|
|
69
|
+
? "bg-green-500"
|
|
70
|
+
: unread
|
|
71
|
+
? "bg-blue-500"
|
|
72
|
+
: "";
|
|
73
|
+
const navigationClassName = clsx(
|
|
74
|
+
"group grid h-8 w-full max-w-full min-w-0 grid-cols-[minmax(0,1fr)_auto] items-center gap-1 overflow-hidden rounded-cline-ui-md px-2 text-left text-cline-ui-sm font-cline-ui-normal",
|
|
75
|
+
active
|
|
76
|
+
? "bg-cline-ui-surface-hover text-cline-ui-sidebar-foreground"
|
|
77
|
+
: "text-cline-ui-sidebar-foreground/80 group-hover/row:bg-cline-ui-surface-hover",
|
|
78
|
+
);
|
|
79
|
+
const navigationContent = (
|
|
80
|
+
<>
|
|
81
|
+
<span className="flex max-w-full min-w-0 items-center gap-1.5 overflow-hidden">
|
|
82
|
+
{leading}
|
|
83
|
+
<span className="block min-w-0 flex-1 overflow-hidden text-ellipsis whitespace-nowrap text-cline-ui-sm font-cline-ui-normal leading-tight">
|
|
84
|
+
{label}
|
|
85
|
+
</span>
|
|
86
|
+
</span>
|
|
87
|
+
<span className="flex shrink-0 items-center gap-1.5 text-cline-ui-sm text-cline-ui-muted-foreground">
|
|
88
|
+
{statusDotClass ? (
|
|
89
|
+
<span
|
|
90
|
+
aria-hidden="true"
|
|
91
|
+
className={clsx("size-1.5 rounded-full", statusDotClass)}
|
|
92
|
+
/>
|
|
93
|
+
) : null}
|
|
94
|
+
{pinnedIndicator}
|
|
95
|
+
<span className={action ? "group-hover/row:invisible" : undefined}>
|
|
96
|
+
{timestamp}
|
|
97
|
+
</span>
|
|
98
|
+
</span>
|
|
99
|
+
</>
|
|
100
|
+
);
|
|
101
|
+
return (
|
|
102
|
+
<div
|
|
103
|
+
{...props}
|
|
104
|
+
ref={ref}
|
|
105
|
+
className={clsx("group/row relative min-w-0", className)}
|
|
106
|
+
>
|
|
107
|
+
{renderControl ? (
|
|
108
|
+
renderControl({
|
|
109
|
+
className: navigationClassName,
|
|
110
|
+
children: navigationContent,
|
|
111
|
+
})
|
|
112
|
+
) : (
|
|
113
|
+
<button
|
|
114
|
+
className={navigationClassName}
|
|
115
|
+
disabled={disabled}
|
|
116
|
+
onClick={onSelect}
|
|
117
|
+
type="button"
|
|
118
|
+
>
|
|
119
|
+
{navigationContent}
|
|
120
|
+
</button>
|
|
121
|
+
)}
|
|
122
|
+
{action}
|
|
123
|
+
</div>
|
|
124
|
+
);
|
|
125
|
+
},
|
|
126
|
+
);
|
|
127
|
+
|
|
128
|
+
export interface AgentSessionRowEditorProps {
|
|
129
|
+
active?: boolean;
|
|
130
|
+
/** Host-owned rename input and pending indicator, without additional wrappers. */
|
|
131
|
+
children: ReactNode;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export function AgentSessionRowEditor({
|
|
135
|
+
active = false,
|
|
136
|
+
children,
|
|
137
|
+
}: AgentSessionRowEditorProps) {
|
|
138
|
+
return (
|
|
139
|
+
<div
|
|
140
|
+
className={clsx(
|
|
141
|
+
"grid h-8 w-full max-w-full min-w-0 grid-cols-[minmax(0,1fr)_auto] items-center gap-1 overflow-hidden rounded-cline-ui-md px-2",
|
|
142
|
+
active
|
|
143
|
+
? "bg-cline-ui-surface-hover text-cline-ui-sidebar-foreground"
|
|
144
|
+
: "text-cline-ui-sidebar-foreground/80",
|
|
145
|
+
)}
|
|
146
|
+
>
|
|
147
|
+
{children}
|
|
148
|
+
</div>
|
|
149
|
+
);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
export interface AgentSessionOverviewProps {
|
|
153
|
+
title: ReactNode;
|
|
154
|
+
/** Already formatted metadata: label, display value, optional full tooltip. */
|
|
155
|
+
items: ReadonlyArray<readonly [string, ReactNode, string?]>;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/** Hover-card content only; positioning, open state and metadata belong to the host. */
|
|
159
|
+
export function AgentSessionOverview({
|
|
160
|
+
title,
|
|
161
|
+
items,
|
|
162
|
+
}: AgentSessionOverviewProps) {
|
|
163
|
+
return (
|
|
164
|
+
<div className="min-w-0 space-y-2">
|
|
165
|
+
<div className="wrap-break-word text-cline-ui-sm font-cline-ui-medium">
|
|
166
|
+
{title}
|
|
167
|
+
</div>
|
|
168
|
+
<div className="grid grid-cols-[max-content_minmax(0,1fr)] gap-x-2 gap-y-1.5 text-cline-ui-xs">
|
|
169
|
+
{items.map(([label, value, fullValue]) => (
|
|
170
|
+
<div className="contents" key={label}>
|
|
171
|
+
<span className="text-cline-ui-muted-foreground">{label}</span>
|
|
172
|
+
<span
|
|
173
|
+
className="min-w-0 truncate font-cline-ui-mono text-cline-ui-foreground"
|
|
174
|
+
title={fullValue}
|
|
175
|
+
>
|
|
176
|
+
{value}
|
|
177
|
+
</span>
|
|
178
|
+
</div>
|
|
179
|
+
))}
|
|
180
|
+
</div>
|
|
181
|
+
</div>
|
|
182
|
+
);
|
|
183
|
+
}
|