@steerable/agent-ui 0.12.4 → 0.12.5
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/dist/cards/ActionSegmentCard.stories.d.ts +6 -0
- package/dist/cards/ActionSegmentCard.stories.js +48 -0
- package/dist/cards/AnalysisDocumentCard.js +1 -1
- package/dist/cards/AnalysisDocumentCard.stories.d.ts +6 -0
- package/dist/cards/AnalysisDocumentCard.stories.js +29 -0
- package/dist/cards/AskUserQuestionsCard.js +7 -7
- package/dist/cards/AskUserQuestionsCard.stories.d.ts +7 -0
- package/dist/cards/AskUserQuestionsCard.stories.js +56 -0
- package/dist/cards/CoverageReportCard.js +4 -4
- package/dist/cards/CoverageReportCard.stories.d.ts +6 -0
- package/dist/cards/CoverageReportCard.stories.js +69 -0
- package/dist/cards/OrchestrationPlanCard.js +5 -5
- package/dist/cards/OrchestrationPlanCard.stories.d.ts +6 -0
- package/dist/cards/OrchestrationPlanCard.stories.js +36 -0
- package/dist/cards/PlanSelectorCard.js +11 -11
- package/dist/cards/PlanSelectorCard.stories.d.ts +6 -0
- package/dist/cards/PlanSelectorCard.stories.js +50 -0
- package/dist/cards/PlanStepsCard.js +1 -1
- package/dist/cards/PlanStepsCard.stories.d.ts +6 -0
- package/dist/cards/PlanStepsCard.stories.js +25 -0
- package/dist/cards/QuizCard.js +3 -3
- package/dist/cards/QuizCard.stories.d.ts +6 -0
- package/dist/cards/QuizCard.stories.js +43 -0
- package/dist/cards/ResearchPlanCard.js +10 -10
- package/dist/cards/ResearchPlanCard.stories.d.ts +6 -0
- package/dist/cards/ResearchPlanCard.stories.js +50 -0
- package/dist/cards/SearchSourcesCard.js +4 -4
- package/dist/cards/SearchSourcesCard.stories.d.ts +6 -0
- package/dist/cards/SearchSourcesCard.stories.js +40 -0
- package/dist/cards/SuggestedRepliesCard.stories.d.ts +6 -0
- package/dist/cards/SuggestedRepliesCard.stories.js +31 -0
- package/dist/cards/SummaryMessageCard.js +3 -3
- package/dist/cards/SummaryMessageCard.stories.d.ts +7 -0
- package/dist/cards/SummaryMessageCard.stories.js +40 -0
- package/dist/cards/ThinkingProcessCard.js +3 -3
- package/dist/cards/ThinkingProcessCard.stories.d.ts +7 -0
- package/dist/cards/ThinkingProcessCard.stories.js +37 -0
- package/dist/cards/ToolExecutionCard.js +7 -7
- package/dist/cards/ToolExecutionCard.stories.d.ts +7 -0
- package/dist/cards/ToolExecutionCard.stories.js +53 -0
- package/package.json +2 -2
- package/src/DesignTokens.mdx +83 -0
- package/src/Introduction.mdx +21 -21
- package/src/cards/ActionSegmentCard.stories.tsx +57 -0
- package/src/cards/AnalysisDocumentCard.stories.tsx +38 -0
- package/src/cards/AnalysisDocumentCard.tsx +3 -3
- package/src/cards/AskUserQuestionsCard.stories.tsx +66 -0
- package/src/cards/AskUserQuestionsCard.tsx +11 -11
- package/src/cards/CoverageReportCard.stories.tsx +78 -0
- package/src/cards/CoverageReportCard.tsx +12 -12
- package/src/cards/OrchestrationPlanCard.stories.tsx +45 -0
- package/src/cards/OrchestrationPlanCard.tsx +19 -19
- package/src/cards/PlanSelectorCard.stories.tsx +59 -0
- package/src/cards/PlanSelectorCard.tsx +19 -19
- package/src/cards/PlanStepsCard.stories.tsx +34 -0
- package/src/cards/PlanStepsCard.tsx +2 -2
- package/src/cards/QuizCard.stories.tsx +52 -0
- package/src/cards/QuizCard.tsx +5 -5
- package/src/cards/ResearchPlanCard.stories.tsx +59 -0
- package/src/cards/ResearchPlanCard.tsx +14 -14
- package/src/cards/SearchSourcesCard.stories.tsx +49 -0
- package/src/cards/SearchSourcesCard.tsx +10 -10
- package/src/cards/SuggestedRepliesCard.stories.tsx +40 -0
- package/src/cards/SummaryMessageCard.stories.tsx +50 -0
- package/src/cards/SummaryMessageCard.tsx +3 -3
- package/src/cards/ThinkingProcessCard.stories.tsx +47 -0
- package/src/cards/ThinkingProcessCard.tsx +4 -4
- package/src/cards/ToolExecutionCard.stories.tsx +63 -0
- package/src/cards/ToolExecutionCard.tsx +13 -13
|
@@ -87,7 +87,7 @@ const STATUS_LABEL: Record<OrchestrationTaskStatus, string> = {
|
|
|
87
87
|
};
|
|
88
88
|
|
|
89
89
|
const DOT_CLASS: Record<OrchestrationTaskStatus, string> = {
|
|
90
|
-
pending: 'bg-[var(--agent-muted-foreground,#
|
|
90
|
+
pending: 'bg-[var(--agent-muted-foreground,#4b5563)]',
|
|
91
91
|
running: 'bg-amber-500 animate-pulse',
|
|
92
92
|
ok: 'bg-emerald-500',
|
|
93
93
|
skipped: 'bg-[var(--agent-muted-foreground,#d1d5db)]',
|
|
@@ -137,14 +137,14 @@ export const OrchestrationPlanCard: React.FC<OrchestrationPlanCardProps> = ({
|
|
|
137
137
|
>
|
|
138
138
|
{above}
|
|
139
139
|
<div className="rounded-lg border border-[var(--agent-border,#e5e7eb)] bg-[var(--agent-card-bg,#fff)] text-sm shadow-sm">
|
|
140
|
-
<div className="flex w-full items-center gap-2 px-3 py-2 text-xs text-[var(--agent-muted-foreground,#
|
|
140
|
+
<div className="flex w-full items-center gap-2 px-3 py-2 text-xs text-[var(--agent-muted-foreground,#4b5563)]">
|
|
141
141
|
<LoaderIcon size={14} className="shrink-0 animate-spin" />
|
|
142
142
|
<GitBranchIcon size={14} className="shrink-0" />
|
|
143
143
|
<span className="inline-flex shrink-0 items-center gap-1.5 whitespace-nowrap">
|
|
144
144
|
{headerLabel ?? (
|
|
145
145
|
<span className="font-medium text-[var(--agent-foreground,#111827)]">协调员</span>
|
|
146
146
|
)}
|
|
147
|
-
<span className="text-[var(--agent-muted-foreground,#
|
|
147
|
+
<span className="text-[var(--agent-muted-foreground,#4b5563)]">·</span>
|
|
148
148
|
<span>{loadingHint ?? '正在规划'}</span>
|
|
149
149
|
</span>
|
|
150
150
|
</div>
|
|
@@ -166,18 +166,18 @@ export const OrchestrationPlanCard: React.FC<OrchestrationPlanCardProps> = ({
|
|
|
166
166
|
{above}
|
|
167
167
|
<div className="rounded-lg border border-rose-500/30 bg-rose-500/5 text-sm shadow-sm">
|
|
168
168
|
<div className="flex w-full items-start gap-2 px-3 py-2 text-xs">
|
|
169
|
-
<AlertIcon size={14} className="mt-0.5 shrink-0 text-rose-
|
|
170
|
-
<GitBranchIcon size={14} className="mt-0.5 shrink-0 text-[var(--agent-muted-foreground,#
|
|
169
|
+
<AlertIcon size={14} className="mt-0.5 shrink-0 text-rose-700" />
|
|
170
|
+
<GitBranchIcon size={14} className="mt-0.5 shrink-0 text-[var(--agent-muted-foreground,#4b5563)]" />
|
|
171
171
|
<div className="min-w-0 flex-1">
|
|
172
172
|
<div className="inline-flex items-center gap-1.5 whitespace-nowrap">
|
|
173
173
|
{headerLabel ?? (
|
|
174
174
|
<span className="font-medium text-[var(--agent-foreground,#111827)]">协调员</span>
|
|
175
175
|
)}
|
|
176
|
-
<span className="text-[var(--agent-muted-foreground,#
|
|
177
|
-
<span className="text-rose-
|
|
176
|
+
<span className="text-[var(--agent-muted-foreground,#4b5563)]">·</span>
|
|
177
|
+
<span className="text-rose-700">规划失败</span>
|
|
178
178
|
</div>
|
|
179
179
|
{failure && (
|
|
180
|
-
<div className="mt-1 break-words leading-relaxed text-[var(--agent-muted-foreground,#
|
|
180
|
+
<div className="mt-1 break-words leading-relaxed text-[var(--agent-muted-foreground,#4b5563)]">
|
|
181
181
|
{failure}
|
|
182
182
|
</div>
|
|
183
183
|
)}
|
|
@@ -216,7 +216,7 @@ export const OrchestrationPlanCard: React.FC<OrchestrationPlanCardProps> = ({
|
|
|
216
216
|
<button
|
|
217
217
|
type="button"
|
|
218
218
|
onClick={() => setExpanded(!expanded)}
|
|
219
|
-
className="flex w-full items-center justify-between gap-2 px-3 py-2 text-left text-xs text-[var(--agent-muted-foreground,#
|
|
219
|
+
className="flex w-full items-center justify-between gap-2 px-3 py-2 text-left text-xs text-[var(--agent-muted-foreground,#4b5563)] transition-all duration-200 hover:text-[var(--agent-foreground,#111827)]"
|
|
220
220
|
>
|
|
221
221
|
<span className="flex min-w-0 items-center gap-2">
|
|
222
222
|
{expanded ? <ChevronDownIcon size={14} /> : <ChevronRightIcon size={14} />}
|
|
@@ -227,23 +227,23 @@ export const OrchestrationPlanCard: React.FC<OrchestrationPlanCardProps> = ({
|
|
|
227
227
|
)}
|
|
228
228
|
{headerSecondary !== undefined ? (
|
|
229
229
|
<>
|
|
230
|
-
<span className="text-[var(--agent-muted-foreground,#
|
|
230
|
+
<span className="text-[var(--agent-muted-foreground,#4b5563)]">·</span>
|
|
231
231
|
<span>{headerSecondary}</span>
|
|
232
232
|
</>
|
|
233
233
|
) : (
|
|
234
234
|
<>
|
|
235
|
-
<span className="text-[var(--agent-muted-foreground,#
|
|
235
|
+
<span className="text-[var(--agent-muted-foreground,#4b5563)]">·</span>
|
|
236
236
|
<span>{tasks.length} 个子任务</span>
|
|
237
237
|
</>
|
|
238
238
|
)}
|
|
239
239
|
{!hideMode && payload.mode && (
|
|
240
|
-
<span className="ml-1 rounded-full bg-[var(--agent-muted,#f3f4f6)] px-2 py-0.5 text-[10px] uppercase tracking-wider text-[var(--agent-muted-foreground,#
|
|
240
|
+
<span className="ml-1 rounded-full bg-[var(--agent-muted,#f3f4f6)] px-2 py-0.5 text-[10px] uppercase tracking-wider text-[var(--agent-muted-foreground,#4b5563)]">
|
|
241
241
|
{payload.mode}
|
|
242
242
|
</span>
|
|
243
243
|
)}
|
|
244
244
|
</span>
|
|
245
245
|
{payload.rationale && !expanded && (
|
|
246
|
-
<span className="min-w-0 flex-1 truncate text-[var(--agent-muted-foreground,#
|
|
246
|
+
<span className="min-w-0 flex-1 truncate text-[var(--agent-muted-foreground,#4b5563)]">
|
|
247
247
|
{payload.rationale}
|
|
248
248
|
</span>
|
|
249
249
|
)}
|
|
@@ -252,11 +252,11 @@ export const OrchestrationPlanCard: React.FC<OrchestrationPlanCardProps> = ({
|
|
|
252
252
|
<span className="flex shrink-0 items-center gap-2">
|
|
253
253
|
{counts.running > 0 && (
|
|
254
254
|
<span className="flex items-center gap-1">
|
|
255
|
-
<LoaderIcon size={12} className="text-amber-
|
|
255
|
+
<LoaderIcon size={12} className="text-amber-700" /> {counts.running}
|
|
256
256
|
</span>
|
|
257
257
|
)}
|
|
258
258
|
{counts.failed > 0 && (
|
|
259
|
-
<span className="flex items-center gap-1 text-rose-
|
|
259
|
+
<span className="flex items-center gap-1 text-rose-700">
|
|
260
260
|
<AlertIcon size={12} /> {counts.failed}
|
|
261
261
|
</span>
|
|
262
262
|
)}
|
|
@@ -272,7 +272,7 @@ export const OrchestrationPlanCard: React.FC<OrchestrationPlanCardProps> = ({
|
|
|
272
272
|
{expanded && (
|
|
273
273
|
<div className="px-3 pb-3">
|
|
274
274
|
{payload.rationale && (
|
|
275
|
-
<p className="pb-2 text-xs leading-relaxed text-[var(--agent-muted-foreground,#
|
|
275
|
+
<p className="pb-2 text-xs leading-relaxed text-[var(--agent-muted-foreground,#4b5563)]">
|
|
276
276
|
{payload.rationale}
|
|
277
277
|
</p>
|
|
278
278
|
)}
|
|
@@ -297,17 +297,17 @@ export const OrchestrationPlanCard: React.FC<OrchestrationPlanCardProps> = ({
|
|
|
297
297
|
<span className="font-medium text-[var(--agent-foreground,#111827)]">
|
|
298
298
|
{agentNameFor ? agentNameFor(t.agentId) : t.agentId}
|
|
299
299
|
</span>
|
|
300
|
-
<span className="text-xs text-[var(--agent-muted-foreground,#
|
|
300
|
+
<span className="text-xs text-[var(--agent-muted-foreground,#4b5563)]">
|
|
301
301
|
{STATUS_LABEL[status]}
|
|
302
302
|
</span>
|
|
303
303
|
</div>
|
|
304
304
|
{t.prompt && (
|
|
305
|
-
<p className="mt-0.5 line-clamp-2 text-xs text-[var(--agent-muted-foreground,#
|
|
305
|
+
<p className="mt-0.5 line-clamp-2 text-xs text-[var(--agent-muted-foreground,#4b5563)]">
|
|
306
306
|
{t.prompt}
|
|
307
307
|
</p>
|
|
308
308
|
)}
|
|
309
309
|
{(t.dependsOn?.length ?? 0) > 0 && (
|
|
310
|
-
<p className="mt-0.5 text-[10px] uppercase tracking-wider text-[var(--agent-muted-foreground,#
|
|
310
|
+
<p className="mt-0.5 text-[10px] uppercase tracking-wider text-[var(--agent-muted-foreground,#4b5563)]">
|
|
311
311
|
依赖:{t.dependsOn!.join(', ')}
|
|
312
312
|
</p>
|
|
313
313
|
)}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { PlanSelectorCard } from './PlanSelectorCard.js';
|
|
3
|
+
|
|
4
|
+
const meta: Meta<typeof PlanSelectorCard> = {
|
|
5
|
+
title: 'Cards/PlanSelectorCard',
|
|
6
|
+
component: PlanSelectorCard,
|
|
7
|
+
parameters: {
|
|
8
|
+
layout: 'centered',
|
|
9
|
+
actions: { argTypesRegex: '^on[A-Z].*' },
|
|
10
|
+
docs: {
|
|
11
|
+
description: {
|
|
12
|
+
component:
|
|
13
|
+
'Interactive plan comparison card allowing users to choose among competing execution strategies.',
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
decorators: [
|
|
18
|
+
(Story) => (
|
|
19
|
+
<div className="w-[540px]">
|
|
20
|
+
<Story />
|
|
21
|
+
</div>
|
|
22
|
+
),
|
|
23
|
+
],
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export default meta;
|
|
27
|
+
type Story = StoryObj<typeof PlanSelectorCard>;
|
|
28
|
+
|
|
29
|
+
export const Default: Story = {
|
|
30
|
+
args: {
|
|
31
|
+
payload: {
|
|
32
|
+
comparison: 'Fast path uses GLM-5.3-Flash with deterministic recovery; thorough path adds multi-run validation.',
|
|
33
|
+
goalAttribution: { type: 'new', newGoalTitle: 'Stabilize tool-call recovery' },
|
|
34
|
+
plans: [
|
|
35
|
+
{
|
|
36
|
+
id: 'flash-fast',
|
|
37
|
+
name: 'Flash + Deterministic Guard',
|
|
38
|
+
summary: 'Lowest cost per solved task using GLM-5.3-Flash with grounding vetoes.',
|
|
39
|
+
approach: 'Single-loop execution with automatic XML/text call recovery.',
|
|
40
|
+
bestFor: 'Fast daily coding & terminal automation',
|
|
41
|
+
metrics: { duration: '~15s', effortLevel: 'low', riskLevel: 'low' },
|
|
42
|
+
pros: ['Lowest token cost', 'Zero graph boilerplate'],
|
|
43
|
+
cons: ['Single pass on ambiguous tasks'],
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
id: 'deep-verify',
|
|
47
|
+
name: 'Multi-pass Verification',
|
|
48
|
+
summary: 'Runs parallel subagents for schema audit and test verification.',
|
|
49
|
+
approach: 'Coordinator + specialist subagents with post-edit test gates.',
|
|
50
|
+
bestFor: 'Release-critical protocol changes',
|
|
51
|
+
metrics: { duration: '~45s', effortLevel: 'high', riskLevel: 'low' },
|
|
52
|
+
pros: ['Cross-checks TS and Python parity'],
|
|
53
|
+
cons: ['Higher token budget'],
|
|
54
|
+
},
|
|
55
|
+
],
|
|
56
|
+
},
|
|
57
|
+
onSelect: () => {},
|
|
58
|
+
},
|
|
59
|
+
};
|
|
@@ -40,34 +40,34 @@ type Level = 'low' | 'medium' | 'high';
|
|
|
40
40
|
const EFFORT_CONFIG: Record<Level, { label: string; text: string; bg: string }> = {
|
|
41
41
|
low: {
|
|
42
42
|
label: '低投入',
|
|
43
|
-
text: 'text-green-
|
|
43
|
+
text: 'text-green-700 dark:text-green-400',
|
|
44
44
|
bg: 'bg-green-50 dark:bg-green-950/30',
|
|
45
45
|
},
|
|
46
46
|
medium: {
|
|
47
47
|
label: '中投入',
|
|
48
|
-
text: 'text-amber-
|
|
48
|
+
text: 'text-amber-700 dark:text-amber-400',
|
|
49
49
|
bg: 'bg-amber-50 dark:bg-amber-950/30',
|
|
50
50
|
},
|
|
51
51
|
high: {
|
|
52
52
|
label: '高投入',
|
|
53
|
-
text: 'text-red-
|
|
53
|
+
text: 'text-red-700 dark:text-red-400',
|
|
54
54
|
bg: 'bg-red-50 dark:bg-red-950/30',
|
|
55
55
|
},
|
|
56
56
|
};
|
|
57
57
|
const RISK_CONFIG: Record<Level, { label: string; text: string; bg: string }> = {
|
|
58
58
|
low: {
|
|
59
59
|
label: '低风险',
|
|
60
|
-
text: 'text-green-
|
|
60
|
+
text: 'text-green-700 dark:text-green-400',
|
|
61
61
|
bg: 'bg-green-50 dark:bg-green-950/30',
|
|
62
62
|
},
|
|
63
63
|
medium: {
|
|
64
64
|
label: '中风险',
|
|
65
|
-
text: 'text-amber-
|
|
65
|
+
text: 'text-amber-700 dark:text-amber-400',
|
|
66
66
|
bg: 'bg-amber-50 dark:bg-amber-950/30',
|
|
67
67
|
},
|
|
68
68
|
high: {
|
|
69
69
|
label: '高风险',
|
|
70
|
-
text: 'text-red-
|
|
70
|
+
text: 'text-red-700 dark:text-red-400',
|
|
71
71
|
bg: 'bg-red-50 dark:bg-red-950/30',
|
|
72
72
|
},
|
|
73
73
|
};
|
|
@@ -132,14 +132,14 @@ export const PlanSelectorCard: React.FC<PlanSelectorCardProps> = ({
|
|
|
132
132
|
<TargetIcon size={14} className="text-blue-500" />
|
|
133
133
|
<span className="text-sm font-medium">候选方案</span>
|
|
134
134
|
{goalLabel && (
|
|
135
|
-
<span className="text-xs text-[var(--agent-muted-foreground,#
|
|
135
|
+
<span className="text-xs text-[var(--agent-muted-foreground,#4b5563)]">
|
|
136
136
|
· {goalLabel}
|
|
137
137
|
</span>
|
|
138
138
|
)}
|
|
139
139
|
</div>
|
|
140
140
|
)}
|
|
141
141
|
{renderHeader && goalLabel && (
|
|
142
|
-
<p className="text-xs text-[var(--agent-muted-foreground,#
|
|
142
|
+
<p className="text-xs text-[var(--agent-muted-foreground,#4b5563)]">{goalLabel}</p>
|
|
143
143
|
)}
|
|
144
144
|
|
|
145
145
|
<div className="space-y-2">
|
|
@@ -171,7 +171,7 @@ export const PlanSelectorCard: React.FC<PlanSelectorCardProps> = ({
|
|
|
171
171
|
</span>
|
|
172
172
|
)}
|
|
173
173
|
</div>
|
|
174
|
-
<p className="mt-1 text-xs leading-relaxed text-[var(--agent-muted-foreground,#
|
|
174
|
+
<p className="mt-1 text-xs leading-relaxed text-[var(--agent-muted-foreground,#4b5563)]">
|
|
175
175
|
{p.summary}
|
|
176
176
|
</p>
|
|
177
177
|
</div>
|
|
@@ -179,7 +179,7 @@ export const PlanSelectorCard: React.FC<PlanSelectorCardProps> = ({
|
|
|
179
179
|
|
|
180
180
|
<div className="mt-2 flex flex-wrap items-center gap-2">
|
|
181
181
|
{p.metrics?.duration && (
|
|
182
|
-
<span className="inline-flex items-center gap-1 rounded-full bg-[var(--agent-muted,#f3f4f6)] px-2 py-0.5 text-[10px] font-medium text-[var(--agent-muted-foreground,#
|
|
182
|
+
<span className="inline-flex items-center gap-1 rounded-full bg-[var(--agent-muted,#f3f4f6)] px-2 py-0.5 text-[10px] font-medium text-[var(--agent-muted-foreground,#4b5563)]">
|
|
183
183
|
<ClockIcon size={11} />
|
|
184
184
|
{p.metrics.duration}
|
|
185
185
|
</span>
|
|
@@ -203,7 +203,7 @@ export const PlanSelectorCard: React.FC<PlanSelectorCardProps> = ({
|
|
|
203
203
|
<button
|
|
204
204
|
type="button"
|
|
205
205
|
onClick={() => setExpandedId(isExpanded ? null : p.id)}
|
|
206
|
-
className="inline-flex items-center gap-1 text-[11px] text-[var(--agent-muted-foreground,#
|
|
206
|
+
className="inline-flex items-center gap-1 text-[11px] text-[var(--agent-muted-foreground,#4b5563)] transition-colors duration-200 hover:text-[var(--agent-foreground,#111827)]"
|
|
207
207
|
>
|
|
208
208
|
{isExpanded ? (
|
|
209
209
|
<>
|
|
@@ -241,14 +241,14 @@ export const PlanSelectorCard: React.FC<PlanSelectorCardProps> = ({
|
|
|
241
241
|
<div className="grid grid-cols-2 gap-2">
|
|
242
242
|
{(p.pros?.length ?? 0) > 0 && (
|
|
243
243
|
<div className="space-y-1">
|
|
244
|
-
<div className="flex items-center gap-1 text-[10px] font-medium text-green-
|
|
244
|
+
<div className="flex items-center gap-1 text-[10px] font-medium text-green-700 dark:text-green-400">
|
|
245
245
|
<ThumbsUpIcon size={11} />
|
|
246
246
|
优势
|
|
247
247
|
</div>
|
|
248
248
|
{p.pros!.map((pro, i) => (
|
|
249
249
|
<p
|
|
250
250
|
key={`pro-${i}`}
|
|
251
|
-
className="pl-4 text-[11px] text-[var(--agent-muted-foreground,#
|
|
251
|
+
className="pl-4 text-[11px] text-[var(--agent-muted-foreground,#4b5563)]"
|
|
252
252
|
>
|
|
253
253
|
{pro}
|
|
254
254
|
</p>
|
|
@@ -257,14 +257,14 @@ export const PlanSelectorCard: React.FC<PlanSelectorCardProps> = ({
|
|
|
257
257
|
)}
|
|
258
258
|
{(p.cons?.length ?? 0) > 0 && (
|
|
259
259
|
<div className="space-y-1">
|
|
260
|
-
<div className="flex items-center gap-1 text-[10px] font-medium text-amber-
|
|
260
|
+
<div className="flex items-center gap-1 text-[10px] font-medium text-amber-700 dark:text-amber-400">
|
|
261
261
|
<AlertIcon size={11} />
|
|
262
262
|
注意
|
|
263
263
|
</div>
|
|
264
264
|
{p.cons!.map((con, i) => (
|
|
265
265
|
<p
|
|
266
266
|
key={`con-${i}`}
|
|
267
|
-
className="pl-4 text-[11px] text-[var(--agent-muted-foreground,#
|
|
267
|
+
className="pl-4 text-[11px] text-[var(--agent-muted-foreground,#4b5563)]"
|
|
268
268
|
>
|
|
269
269
|
{con}
|
|
270
270
|
</p>
|
|
@@ -273,7 +273,7 @@ export const PlanSelectorCard: React.FC<PlanSelectorCardProps> = ({
|
|
|
273
273
|
)}
|
|
274
274
|
</div>
|
|
275
275
|
{p.bestFor && (
|
|
276
|
-
<p className="text-[11px] italic text-[var(--agent-muted-foreground,#
|
|
276
|
+
<p className="text-[11px] italic text-[var(--agent-muted-foreground,#4b5563)]">
|
|
277
277
|
适合:{p.bestFor}
|
|
278
278
|
</p>
|
|
279
279
|
)}
|
|
@@ -285,7 +285,7 @@ export const PlanSelectorCard: React.FC<PlanSelectorCardProps> = ({
|
|
|
285
285
|
</div>
|
|
286
286
|
|
|
287
287
|
{payload.comparison && (
|
|
288
|
-
<p className="text-xs text-[var(--agent-muted-foreground,#
|
|
288
|
+
<p className="text-xs text-[var(--agent-muted-foreground,#4b5563)]">
|
|
289
289
|
{payload.comparison}
|
|
290
290
|
</p>
|
|
291
291
|
)}
|
|
@@ -294,12 +294,12 @@ export const PlanSelectorCard: React.FC<PlanSelectorCardProps> = ({
|
|
|
294
294
|
{renderBottomHint
|
|
295
295
|
? asReactNode(renderBottomHint({ submitted: isReadOnly }))
|
|
296
296
|
: !isReadOnly
|
|
297
|
-
? <span className="text-xs text-[var(--agent-muted-foreground,#
|
|
297
|
+
? <span className="text-xs text-[var(--agent-muted-foreground,#4b5563)]">
|
|
298
298
|
点击选择方案
|
|
299
299
|
</span>
|
|
300
300
|
: <div className="flex items-center gap-1.5">
|
|
301
301
|
<CheckIcon size={12} className="text-blue-500" />
|
|
302
|
-
<span className="text-xs text-[var(--agent-muted-foreground,#
|
|
302
|
+
<span className="text-xs text-[var(--agent-muted-foreground,#4b5563)]">
|
|
303
303
|
方案已选择
|
|
304
304
|
</span>
|
|
305
305
|
</div>}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { PlanStepsCard } from './PlanStepsCard.js';
|
|
3
|
+
|
|
4
|
+
const meta: Meta<typeof PlanStepsCard> = {
|
|
5
|
+
title: 'Cards/PlanStepsCard',
|
|
6
|
+
component: PlanStepsCard,
|
|
7
|
+
parameters: {
|
|
8
|
+
layout: 'centered',
|
|
9
|
+
docs: {
|
|
10
|
+
description: {
|
|
11
|
+
component:
|
|
12
|
+
'Compact inline plan-steps breadcrumb card emitted during quick multi-step execution.',
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
decorators: [
|
|
17
|
+
(Story) => (
|
|
18
|
+
<div className="w-[480px]">
|
|
19
|
+
<Story />
|
|
20
|
+
</div>
|
|
21
|
+
),
|
|
22
|
+
],
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export default meta;
|
|
26
|
+
type Story = StoryObj<typeof PlanStepsCard>;
|
|
27
|
+
|
|
28
|
+
export const Default: Story = {
|
|
29
|
+
args: {
|
|
30
|
+
payload: {
|
|
31
|
+
steps: ['Inspect schema', 'Run unit tests', 'Verify output'],
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
};
|
|
@@ -30,8 +30,8 @@ export const PlanStepsCard: React.FC<PlanStepsCardProps> = ({ payload, isStreami
|
|
|
30
30
|
className,
|
|
31
31
|
].filter(Boolean).join(' ')}
|
|
32
32
|
>
|
|
33
|
-
<ListChecksIcon size={14} className="mt-0.5 flex-shrink-0 text-[var(--agent-muted-foreground,#
|
|
34
|
-
<div className="flex flex-wrap items-center gap-1 text-xs text-[var(--agent-muted-foreground,#
|
|
33
|
+
<ListChecksIcon size={14} className="mt-0.5 flex-shrink-0 text-[var(--agent-muted-foreground,#4b5563)]" />
|
|
34
|
+
<div className="flex flex-wrap items-center gap-1 text-xs text-[var(--agent-muted-foreground,#4b5563)]">
|
|
35
35
|
{steps.map((step, idx) => (
|
|
36
36
|
<React.Fragment key={`${idx}-${step}`}>
|
|
37
37
|
{idx > 0 && <span aria-hidden className="select-none opacity-40">/</span>}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { QuizCard } from './QuizCard.js';
|
|
3
|
+
|
|
4
|
+
const meta: Meta<typeof QuizCard> = {
|
|
5
|
+
title: 'Cards/QuizCard',
|
|
6
|
+
component: QuizCard,
|
|
7
|
+
parameters: {
|
|
8
|
+
layout: 'centered',
|
|
9
|
+
actions: { argTypesRegex: '^on[A-Z].*' },
|
|
10
|
+
docs: {
|
|
11
|
+
description: {
|
|
12
|
+
component:
|
|
13
|
+
'Interactive multi-question quiz card supporting single/multiple choice, judge, and short-answer prompts.',
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
decorators: [
|
|
18
|
+
(Story) => (
|
|
19
|
+
<div className="w-[500px]">
|
|
20
|
+
<Story />
|
|
21
|
+
</div>
|
|
22
|
+
),
|
|
23
|
+
],
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export default meta;
|
|
27
|
+
type Story = StoryObj<typeof QuizCard>;
|
|
28
|
+
|
|
29
|
+
export const Default: Story = {
|
|
30
|
+
args: {
|
|
31
|
+
onSubmit: () => {},
|
|
32
|
+
payload: {
|
|
33
|
+
quizId: 'arch-check-1',
|
|
34
|
+
title: 'Steerable Architecture Check',
|
|
35
|
+
description: 'Verify tier dependency and protocol invariants.',
|
|
36
|
+
submitActionLabel: 'Submit answers',
|
|
37
|
+
questions: [
|
|
38
|
+
{
|
|
39
|
+
id: 'q1',
|
|
40
|
+
type: 'choice',
|
|
41
|
+
stem: 'Which tier owns JSON-RPC transport and OS sandboxing for desktop hosts?',
|
|
42
|
+
options: ['Tier 1 Protocol', 'Tier 3 Sidecar', 'Tier 4 UI'],
|
|
43
|
+
allowMultiple: false,
|
|
44
|
+
placeholder: null,
|
|
45
|
+
points: 10,
|
|
46
|
+
knowledgePointId: null,
|
|
47
|
+
difficulty: 1,
|
|
48
|
+
},
|
|
49
|
+
],
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
};
|
package/src/cards/QuizCard.tsx
CHANGED
|
@@ -223,10 +223,10 @@ export const QuizCard: React.FC<QuizCardProps> = ({
|
|
|
223
223
|
<div className="flex items-center gap-2">
|
|
224
224
|
<ClipboardIcon size={14} className="shrink-0 text-blue-500" />
|
|
225
225
|
<span className="break-words font-medium">{payload.title}</span>
|
|
226
|
-
{isReadOnly && <CheckIcon size={12} className="text-emerald-
|
|
226
|
+
{isReadOnly && <CheckIcon size={12} className="text-emerald-700" />}
|
|
227
227
|
</div>
|
|
228
228
|
{payload.description && (
|
|
229
|
-
<p className="break-words text-xs leading-relaxed text-[var(--agent-muted-foreground,#
|
|
229
|
+
<p className="break-words text-xs leading-relaxed text-[var(--agent-muted-foreground,#4b5563)]">
|
|
230
230
|
{payload.description}
|
|
231
231
|
</p>
|
|
232
232
|
)}
|
|
@@ -244,7 +244,7 @@ export const QuizCard: React.FC<QuizCardProps> = ({
|
|
|
244
244
|
{idx + 1}. {q.stem}
|
|
245
245
|
</p>
|
|
246
246
|
{metaNode && (
|
|
247
|
-
<div className="mt-1 flex flex-wrap items-center gap-x-2 gap-y-0.5 text-[11px] text-[var(--agent-muted-foreground,#
|
|
247
|
+
<div className="mt-1 flex flex-wrap items-center gap-x-2 gap-y-0.5 text-[11px] text-[var(--agent-muted-foreground,#4b5563)]">
|
|
248
248
|
{metaNode}
|
|
249
249
|
</div>
|
|
250
250
|
)}
|
|
@@ -271,13 +271,13 @@ export const QuizCard: React.FC<QuizCardProps> = ({
|
|
|
271
271
|
|
|
272
272
|
<div className="flex flex-wrap items-center justify-between gap-x-3 gap-y-2 pt-1">
|
|
273
273
|
{isReadOnly ? (
|
|
274
|
-
<div className="inline-flex min-w-0 items-center gap-1.5 text-xs text-green-
|
|
274
|
+
<div className="inline-flex min-w-0 items-center gap-1.5 text-xs text-green-700 dark:text-green-400">
|
|
275
275
|
<CheckIcon size={12} />
|
|
276
276
|
<span className="truncate">{submittedMessage ?? '已提交'}</span>
|
|
277
277
|
</div>
|
|
278
278
|
) : (
|
|
279
279
|
submitHint && (
|
|
280
|
-
<span className="min-w-0 flex-1 break-words text-xs text-[var(--agent-muted-foreground,#
|
|
280
|
+
<span className="min-w-0 flex-1 break-words text-xs text-[var(--agent-muted-foreground,#4b5563)]">
|
|
281
281
|
{submitHint}
|
|
282
282
|
</span>
|
|
283
283
|
)
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { ResearchPlanCard } from './ResearchPlanCard.js';
|
|
3
|
+
|
|
4
|
+
const meta: Meta<typeof ResearchPlanCard> = {
|
|
5
|
+
title: 'Cards/ResearchPlanCard',
|
|
6
|
+
component: ResearchPlanCard,
|
|
7
|
+
parameters: {
|
|
8
|
+
layout: 'centered',
|
|
9
|
+
docs: {
|
|
10
|
+
description: {
|
|
11
|
+
component:
|
|
12
|
+
'Multi-round research planner card tracking sub-questions, evidence strength, and continuation decisions.',
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
decorators: [
|
|
17
|
+
(Story) => (
|
|
18
|
+
<div className="w-[520px]">
|
|
19
|
+
<Story />
|
|
20
|
+
</div>
|
|
21
|
+
),
|
|
22
|
+
],
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export default meta;
|
|
26
|
+
type Story = StoryObj<typeof ResearchPlanCard>;
|
|
27
|
+
|
|
28
|
+
export const Default: Story = {
|
|
29
|
+
args: {
|
|
30
|
+
totalRounds: 3,
|
|
31
|
+
payload: {
|
|
32
|
+
topic: 'Flash-model tool-call failure modes on Terminal-Bench 2.1',
|
|
33
|
+
round: 2,
|
|
34
|
+
final: false,
|
|
35
|
+
subQuestions: [
|
|
36
|
+
{
|
|
37
|
+
id: 'sq-1',
|
|
38
|
+
question: 'How often do quantized models emit plain-text XML tool calls?',
|
|
39
|
+
kind: 'fact',
|
|
40
|
+
status: 'evidenced_strong',
|
|
41
|
+
evidenceCount: 14,
|
|
42
|
+
note: 'Measured across 89 TB 2.1 tasks.',
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
id: 'sq-2',
|
|
46
|
+
question: 'Which completion veto rule prevents false-positive success claims?',
|
|
47
|
+
kind: 'risk',
|
|
48
|
+
status: 'pending',
|
|
49
|
+
evidenceCount: 2,
|
|
50
|
+
note: null,
|
|
51
|
+
},
|
|
52
|
+
],
|
|
53
|
+
decision: {
|
|
54
|
+
next: 'expand',
|
|
55
|
+
reason: 'Collect token calibration traces for DeepSeek-V3.1-0731.',
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
};
|
|
@@ -42,13 +42,13 @@ const STATUS_LABELS: Record<Status, string> = {
|
|
|
42
42
|
};
|
|
43
43
|
|
|
44
44
|
const STATUS_COLOR: Record<Status, string> = {
|
|
45
|
-
pending: 'bg-[var(--agent-muted,#f3f4f6)] text-[var(--agent-muted-foreground,#
|
|
46
|
-
searching: 'bg-[var(--agent-muted,#f3f4f6)] text-[var(--agent-muted-foreground,#
|
|
47
|
-
evidenced_strong: 'bg-green-500/15 text-green-
|
|
48
|
-
evidenced_medium: 'bg-blue-500/15 text-blue-
|
|
49
|
-
evidenced_weak: 'bg-amber-500/15 text-amber-
|
|
50
|
-
conflicted: 'bg-red-500/15 text-red-
|
|
51
|
-
exhausted: 'bg-zinc-500/15 text-zinc-
|
|
45
|
+
pending: 'bg-[var(--agent-muted,#f3f4f6)] text-[var(--agent-muted-foreground,#4b5563)]',
|
|
46
|
+
searching: 'bg-[var(--agent-muted,#f3f4f6)] text-[var(--agent-muted-foreground,#4b5563)]',
|
|
47
|
+
evidenced_strong: 'bg-green-500/15 text-green-800 dark:text-green-400',
|
|
48
|
+
evidenced_medium: 'bg-blue-500/15 text-blue-800 dark:text-blue-400',
|
|
49
|
+
evidenced_weak: 'bg-amber-500/15 text-amber-800 dark:text-amber-400',
|
|
50
|
+
conflicted: 'bg-red-500/15 text-red-800 dark:text-red-400',
|
|
51
|
+
exhausted: 'bg-zinc-500/15 text-zinc-800 dark:text-zinc-400',
|
|
52
52
|
};
|
|
53
53
|
|
|
54
54
|
const DECISION_LABEL: Record<'continue' | 'expand' | 'converge', string> = {
|
|
@@ -93,11 +93,11 @@ export const ResearchPlanCard: React.FC<ResearchPlanCardProps> = ({
|
|
|
93
93
|
<span className="truncate text-sm font-medium">{payload.topic}</span>
|
|
94
94
|
</div>
|
|
95
95
|
<div className="inline-flex shrink-0 items-center gap-1">
|
|
96
|
-
<span className="rounded-full bg-[var(--agent-muted,#f3f4f6)] px-2 py-0.5 text-xs text-[var(--agent-muted-foreground,#
|
|
96
|
+
<span className="rounded-full bg-[var(--agent-muted,#f3f4f6)] px-2 py-0.5 text-xs text-[var(--agent-muted-foreground,#4b5563)]">
|
|
97
97
|
第 {round}/{totalRounds} 轮
|
|
98
98
|
</span>
|
|
99
99
|
{payload.final && (
|
|
100
|
-
<span className="rounded-full bg-green-500/15 px-2 py-0.5 text-xs text-green-
|
|
100
|
+
<span className="rounded-full bg-green-500/15 px-2 py-0.5 text-xs text-green-800 dark:text-green-400">
|
|
101
101
|
已收敛
|
|
102
102
|
</span>
|
|
103
103
|
)}
|
|
@@ -126,19 +126,19 @@ export const ResearchPlanCard: React.FC<ResearchPlanCardProps> = ({
|
|
|
126
126
|
className="rounded-md border border-[var(--agent-border,#e5e7eb)] bg-[var(--agent-card-bg,#fff)] p-2.5"
|
|
127
127
|
>
|
|
128
128
|
<div className="mb-1.5 flex flex-wrap items-center gap-1.5">
|
|
129
|
-
<span className="rounded-full bg-[var(--agent-muted,#f3f4f6)] px-1.5 py-0.5 text-xs text-[var(--agent-muted-foreground,#
|
|
129
|
+
<span className="rounded-full bg-[var(--agent-muted,#f3f4f6)] px-1.5 py-0.5 text-xs text-[var(--agent-muted-foreground,#4b5563)]">
|
|
130
130
|
{KIND_LABELS[kind] ?? kind}
|
|
131
131
|
</span>
|
|
132
132
|
<span className={`rounded-full px-1.5 py-0.5 text-xs ${STATUS_COLOR[status]}`}>
|
|
133
133
|
{STATUS_LABELS[status] ?? status}
|
|
134
134
|
</span>
|
|
135
|
-
<span className="text-xs text-[var(--agent-muted-foreground,#
|
|
135
|
+
<span className="text-xs text-[var(--agent-muted-foreground,#4b5563)]">
|
|
136
136
|
证据 {q.evidenceCount ?? 0}
|
|
137
137
|
</span>
|
|
138
138
|
</div>
|
|
139
139
|
<div className="text-sm">{q.question}</div>
|
|
140
140
|
{q.note && (
|
|
141
|
-
<div className="mt-1 whitespace-pre-wrap text-xs text-[var(--agent-muted-foreground,#
|
|
141
|
+
<div className="mt-1 whitespace-pre-wrap text-xs text-[var(--agent-muted-foreground,#4b5563)]">
|
|
142
142
|
{q.note}
|
|
143
143
|
</div>
|
|
144
144
|
)}
|
|
@@ -150,12 +150,12 @@ export const ResearchPlanCard: React.FC<ResearchPlanCardProps> = ({
|
|
|
150
150
|
|
|
151
151
|
{payload.decision && (
|
|
152
152
|
<div className="rounded-md border border-[var(--agent-border,#e5e7eb)] bg-[var(--agent-muted,#f3f4f6)]/40 px-2.5 py-2">
|
|
153
|
-
<div className="text-xs text-[var(--agent-muted-foreground,#
|
|
153
|
+
<div className="text-xs text-[var(--agent-muted-foreground,#4b5563)]">下一步决策</div>
|
|
154
154
|
<div className="text-sm font-medium">
|
|
155
155
|
{decisionLabel ?? payload.decision.next}
|
|
156
156
|
</div>
|
|
157
157
|
{payload.decision.reason && (
|
|
158
|
-
<div className="mt-0.5 whitespace-pre-wrap text-xs text-[var(--agent-muted-foreground,#
|
|
158
|
+
<div className="mt-0.5 whitespace-pre-wrap text-xs text-[var(--agent-muted-foreground,#4b5563)]">
|
|
159
159
|
{payload.decision.reason}
|
|
160
160
|
</div>
|
|
161
161
|
)}
|