@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.
Files changed (69) hide show
  1. package/dist/cards/ActionSegmentCard.stories.d.ts +6 -0
  2. package/dist/cards/ActionSegmentCard.stories.js +48 -0
  3. package/dist/cards/AnalysisDocumentCard.js +1 -1
  4. package/dist/cards/AnalysisDocumentCard.stories.d.ts +6 -0
  5. package/dist/cards/AnalysisDocumentCard.stories.js +29 -0
  6. package/dist/cards/AskUserQuestionsCard.js +7 -7
  7. package/dist/cards/AskUserQuestionsCard.stories.d.ts +7 -0
  8. package/dist/cards/AskUserQuestionsCard.stories.js +56 -0
  9. package/dist/cards/CoverageReportCard.js +4 -4
  10. package/dist/cards/CoverageReportCard.stories.d.ts +6 -0
  11. package/dist/cards/CoverageReportCard.stories.js +69 -0
  12. package/dist/cards/OrchestrationPlanCard.js +5 -5
  13. package/dist/cards/OrchestrationPlanCard.stories.d.ts +6 -0
  14. package/dist/cards/OrchestrationPlanCard.stories.js +36 -0
  15. package/dist/cards/PlanSelectorCard.js +11 -11
  16. package/dist/cards/PlanSelectorCard.stories.d.ts +6 -0
  17. package/dist/cards/PlanSelectorCard.stories.js +50 -0
  18. package/dist/cards/PlanStepsCard.js +1 -1
  19. package/dist/cards/PlanStepsCard.stories.d.ts +6 -0
  20. package/dist/cards/PlanStepsCard.stories.js +25 -0
  21. package/dist/cards/QuizCard.js +3 -3
  22. package/dist/cards/QuizCard.stories.d.ts +6 -0
  23. package/dist/cards/QuizCard.stories.js +43 -0
  24. package/dist/cards/ResearchPlanCard.js +10 -10
  25. package/dist/cards/ResearchPlanCard.stories.d.ts +6 -0
  26. package/dist/cards/ResearchPlanCard.stories.js +50 -0
  27. package/dist/cards/SearchSourcesCard.js +4 -4
  28. package/dist/cards/SearchSourcesCard.stories.d.ts +6 -0
  29. package/dist/cards/SearchSourcesCard.stories.js +40 -0
  30. package/dist/cards/SuggestedRepliesCard.stories.d.ts +6 -0
  31. package/dist/cards/SuggestedRepliesCard.stories.js +31 -0
  32. package/dist/cards/SummaryMessageCard.js +3 -3
  33. package/dist/cards/SummaryMessageCard.stories.d.ts +7 -0
  34. package/dist/cards/SummaryMessageCard.stories.js +40 -0
  35. package/dist/cards/ThinkingProcessCard.js +3 -3
  36. package/dist/cards/ThinkingProcessCard.stories.d.ts +7 -0
  37. package/dist/cards/ThinkingProcessCard.stories.js +37 -0
  38. package/dist/cards/ToolExecutionCard.js +7 -7
  39. package/dist/cards/ToolExecutionCard.stories.d.ts +7 -0
  40. package/dist/cards/ToolExecutionCard.stories.js +53 -0
  41. package/package.json +2 -2
  42. package/src/DesignTokens.mdx +83 -0
  43. package/src/Introduction.mdx +21 -21
  44. package/src/cards/ActionSegmentCard.stories.tsx +57 -0
  45. package/src/cards/AnalysisDocumentCard.stories.tsx +38 -0
  46. package/src/cards/AnalysisDocumentCard.tsx +3 -3
  47. package/src/cards/AskUserQuestionsCard.stories.tsx +66 -0
  48. package/src/cards/AskUserQuestionsCard.tsx +11 -11
  49. package/src/cards/CoverageReportCard.stories.tsx +78 -0
  50. package/src/cards/CoverageReportCard.tsx +12 -12
  51. package/src/cards/OrchestrationPlanCard.stories.tsx +45 -0
  52. package/src/cards/OrchestrationPlanCard.tsx +19 -19
  53. package/src/cards/PlanSelectorCard.stories.tsx +59 -0
  54. package/src/cards/PlanSelectorCard.tsx +19 -19
  55. package/src/cards/PlanStepsCard.stories.tsx +34 -0
  56. package/src/cards/PlanStepsCard.tsx +2 -2
  57. package/src/cards/QuizCard.stories.tsx +52 -0
  58. package/src/cards/QuizCard.tsx +5 -5
  59. package/src/cards/ResearchPlanCard.stories.tsx +59 -0
  60. package/src/cards/ResearchPlanCard.tsx +14 -14
  61. package/src/cards/SearchSourcesCard.stories.tsx +49 -0
  62. package/src/cards/SearchSourcesCard.tsx +10 -10
  63. package/src/cards/SuggestedRepliesCard.stories.tsx +40 -0
  64. package/src/cards/SummaryMessageCard.stories.tsx +50 -0
  65. package/src/cards/SummaryMessageCard.tsx +3 -3
  66. package/src/cards/ThinkingProcessCard.stories.tsx +47 -0
  67. package/src/cards/ThinkingProcessCard.tsx +4 -4
  68. package/src/cards/ToolExecutionCard.stories.tsx +63 -0
  69. package/src/cards/ToolExecutionCard.tsx +13 -13
@@ -0,0 +1,83 @@
1
+ import { Meta } from '@storybook/blocks';
2
+
3
+ <Meta title="Design Tokens" />
4
+
5
+ # Design Tokens & Tailwind Preset
6
+
7
+ `@steerable/agent-ui` ships semantic CSS variables and animations via `@steerable/agent-ui/tailwind-preset` so host apps can rebrand every component without modifying JSX.
8
+
9
+ ## Semantic Tokens (`--agent-*`)
10
+
11
+ | Token | Tailwind utility | Light default | Purpose |
12
+ | --- | --- | --- | --- |
13
+ | `--agent-canvas` | `bg-agent-canvas` | `0 0% 100%` | Primary surface background |
14
+ | `--agent-foreground` | `text-agent-foreground` | `240 10% 3.9%` | Primary body copy |
15
+ | `--agent-muted` | `bg-agent-muted` | `240 4.8% 95.9%` | Secondary cards, pills, and subtle containers |
16
+ | `--agent-muted-foreground` | `text-agent-muted-foreground` | `240 5% 32%` | Secondary labels and timestamps (WCAG AA ≥ 4.5:1) |
17
+ | `--agent-border` | `border-agent-border` | `240 5.9% 90%` | Card and control outlines |
18
+ | `--agent-accent` | `bg-agent-accent` / `text-agent-accent` | `217 91% 42%` | Primary actions and active indicators |
19
+ | `--agent-accent-foreground` | `text-agent-accent-foreground` | `0 0% 100%` | Text/icons rendered on top of `--agent-accent` |
20
+ | `--agent-destructive` | `text-agent-destructive` | `0 75% 42%` | Errors, failed runs, and destructive actions |
21
+ | `--agent-tool-read` | `text-agent-tool-read` | `142 71% 22%` | Read-only tool badges |
22
+ | `--agent-tool-write` | `text-agent-tool-write` | `28 90% 28%` | Mutating tool badges |
23
+ | `--agent-tool-destructive` | `text-agent-tool-destructive` | `0 75% 42%` | High-risk / destructive tool badges |
24
+ | `--agent-radius` | `rounded-agent-sm` / `md` / `lg` | `0.75rem` | Base radius scaled down by `4px` and `2px` |
25
+
26
+ ## Animations
27
+
28
+ * `animate-agent-cursor-blink` — 1s stepped cursor blink during token streaming.
29
+ * `animate-agent-shimmer` — 2s linear shimmer for pending/loading skeletons.
30
+
31
+ ## Tailwind v3 Setup
32
+
33
+ ```ts
34
+ // tailwind.config.ts
35
+ import preset from '@steerable/agent-ui/tailwind-preset';
36
+
37
+ export default {
38
+ presets: [preset],
39
+ content: [
40
+ './src/**/*.{ts,tsx}',
41
+ './node_modules/@steerable/agent-ui/dist/**/*.{js,mjs}',
42
+ ],
43
+ };
44
+ ```
45
+
46
+ Override tokens in your global stylesheet:
47
+
48
+ ```css
49
+ :root {
50
+ --agent-accent: 152 62% 31%;
51
+ --agent-radius: 0.5rem;
52
+ }
53
+
54
+ .dark {
55
+ --agent-canvas: 240 10% 3.9%;
56
+ --agent-foreground: 0 0% 98%;
57
+ }
58
+ ```
59
+
60
+ ## Tailwind v4 Setup (`@theme`)
61
+
62
+ When using `@tailwindcss/vite` or Tailwind v4 CSS-first configuration, define `--color-agent-*`, `--radius-agent-*`, and `--animate-agent-*` directly inside `@theme` (see `packages/agent-ui/ts/.storybook/preview.css`):
63
+
64
+ ```css
65
+ @import "tailwindcss";
66
+
67
+ @theme {
68
+ --color-agent-canvas: hsl(0 0% 100%);
69
+ --color-agent-foreground: hsl(240 10% 3.9%);
70
+ --color-agent-muted: hsl(240 4.8% 95.9%);
71
+ --color-agent-muted-foreground: hsl(240 5% 32%);
72
+ --color-agent-border: hsl(240 5.9% 90%);
73
+ --color-agent-accent: hsl(217 91% 42%);
74
+ --color-agent-accent-foreground: hsl(0 0% 100%);
75
+ --color-agent-destructive: hsl(0 75% 42%);
76
+ --color-agent-tool-read: hsl(142 71% 22%);
77
+ --color-agent-tool-write: hsl(28 90% 28%);
78
+ --color-agent-tool-destructive: hsl(0 75% 42%);
79
+ --radius-agent-sm: calc(0.75rem - 4px);
80
+ --radius-agent-md: calc(0.75rem - 2px);
81
+ --radius-agent-lg: 0.75rem;
82
+ }
83
+ ```
@@ -4,22 +4,32 @@ import { Meta } from '@storybook/blocks';
4
4
 
5
5
  # @steerable/agent-ui
6
6
 
7
- > Headless React building blocks for Steerable agent UIs — chat shells, tool-call cards, orchestration plans, raw SSE inspectors, plus the hooks that wire them to any transport.
7
+ > Headless React building blocks for Steerable agent UIs — 7 core components, 14 structured message cards, state/transport helpers, and 3 lifecycle hooks.
8
8
 
9
9
  This package ships the visual surface area you need to drop a Steerable agent into a React app, plus the lifecycle hooks that own message state and tool-call status. Components are intentionally **headless**: they render through Tailwind utility classes built on a small set of `--agent-*` design tokens, so consuming apps can theme them, replace any subtree, or compose them into bespoke layouts without forking.
10
10
 
11
11
  ## What's in this Storybook
12
12
 
13
- * **Components** — visual primitives:
14
- * [`ChatPanel`](?path=/docs/components-chatpanel--docs) — the foundational chat shell (`MessageList` + composer + stop button).
13
+ * **Components** (`@steerable/agent-ui`) — core chat primitives:
14
+ * [`ChatPanel`](?path=/docs/components-chatpanel--docs) — foundational chat shell (`MessageList` + composer + stop button).
15
15
  * [`MessageList`](?path=/docs/components-messagelist--docs) — auto-scrolling list with a render-prop bubble.
16
+ * [`AgentSelector`](?path=/docs/components-agentselector--docs) — segmented selector for switching the active chat agent.
17
+ * [`ModelSelector`](?path=/docs/components-modelselector--docs) — gateway model catalog picker with reasoning effort controls.
16
18
  * [`OrchestrationPlanCard`](?path=/docs/components-orchestrationplancard--docs) — multi-step plan with per-step status.
17
19
  * [`ToolCallRenderer`](?path=/docs/components-toolcallrenderer--docs) — tool-call card with mode badges, approval, expandable args/result.
18
- * [`SSEStreamView`](?path=/docs/components-ssestreamview--docs) — append-only SSE event log, useful in trace tabs and dev consoles.
19
- * **Hooks** — transport-agnostic state:
20
+ * [`SSEStreamView`](?path=/docs/components-ssestreamview--docs) — append-only SSE event log for trace tabs and dev consoles.
21
+ * **Cards** (`@steerable/agent-ui/cards`) — 14 structured block renderers backed by `spec/blocks/*.schema.json`:
22
+ * [`ToolExecutionCard`](?path=/docs/cards-toolexecutioncard--docs) · [`ActionSegmentCard`](?path=/docs/cards-actionsegmentcard--docs) · [`ThinkingProcessCard`](?path=/docs/cards-thinkingprocesscard--docs) · [`SummaryMessageCard`](?path=/docs/cards-summarymessagecard--docs)
23
+ * [`OrchestrationPlanCard`](?path=/docs/cards-orchestrationplancard--docs) · [`PlanStepsCard`](?path=/docs/cards-planstepscard--docs) · [`PlanSelectorCard`](?path=/docs/cards-planselectorcard--docs) · [`ResearchPlanCard`](?path=/docs/cards-researchplancard--docs)
24
+ * [`AskUserQuestionsCard`](?path=/docs/cards-askuserquestionscard--docs) · [`SuggestedRepliesCard`](?path=/docs/cards-suggestedrepliescard--docs) · [`SearchSourcesCard`](?path=/docs/cards-searchsourcescard--docs)
25
+ * [`AnalysisDocumentCard`](?path=/docs/cards-analysisdocumentcard--docs) · [`QuizCard`](?path=/docs/cards-quizcard--docs) · [`CoverageReportCard`](?path=/docs/cards-coveragereportcard--docs)
26
+ * **Hooks** (`@steerable/agent-ui/hooks`) — transport-agnostic state:
20
27
  * [`useChatStream`](?path=/docs/hooks-usechatstream--docs) — owns message state and translates `SSEEvent` into `ChatMessage` mutations.
21
28
  * [`useToolCallStatus`](?path=/docs/hooks-usetoolcallstatus--docs) — derives status + mode + approval requirements for a single tool call.
22
29
  * [`useAgentSession`](?path=/docs/hooks-useagentsession--docs) — wraps create / resume / list against any session storage adapter.
30
+ * **State & Transport** (`@steerable/agent-ui/state`) & **Design Tokens** (`@steerable/agent-ui/tailwind-preset`):
31
+ * [`MockChatStreamTransport`](?path=/docs/state-mockchatstreamtransport--docs) — scripted SSE replay transport for tests and demos.
32
+ * [`Design Tokens`](?path=/docs/design-tokens--docs) — full `--agent-*` CSS variable reference and Tailwind v3 / v4 integration.
23
33
 
24
34
  ## Installation (consuming app)
25
35
 
@@ -41,14 +51,14 @@ export default {
41
51
  };
42
52
  ```
43
53
 
44
- For Tailwind v4 callers, mirror the design tokens with `@theme` (see `apps/web/src/app/globals.css` in `deeppath` for an in-tree example, and `packages/agent-ui/ts/.storybook/preview.css` here for a minimal copy you can paste).
54
+ For Tailwind v4 callers, mirror the design tokens with `@theme` (see [Design Tokens](?path=/docs/design-tokens--docs) and `packages/agent-shell/web/src/styles/index.css` for an in-tree reference).
45
55
 
46
56
  ## Design philosophy
47
57
 
48
- 1. **Headless first.** Every component takes a render prop or accepts `children` for the parts a real app wants to customise (markdown rendering, mention chips, search-source pills, …). Defaults are dumb on purpose so you don't end up forking the whole component to swap one row.
58
+ 1. **Headless first.** Every component takes a render prop or accepts `children` for the parts a real app wants to customise (markdown rendering, mention chips, search-source pills, …). Defaults stay minimal so you never fork a component to swap one row.
49
59
  2. **One token vocabulary.** All colors, radii, and animations come from `--agent-*` variables. Themes ship as CSS overrides, never as React props.
50
- 3. **Transport-agnostic hooks.** `useChatStream` and friends never speak HTTP or know which provider serves the events — they call into a transport you pass in. This is what lets `deeppath/apps/web` and `deeppath-agent` share the same chat surface while one talks to FastAPI/SSE and the other talks to the embedded sidecar over IPC.
51
- 4. **Mirror the framework spec.** `ChatMessage`, `ToolCall`, `ToolResult`, `SSEEvent`, `AgentSession` are imported from `@steerable/agent-protocol`, which is generated from the JSON schemas in `spec/`. The TS and Py worlds stay lock-step.
60
+ 3. **Transport-agnostic hooks.** `useChatStream` and friends never speak HTTP or know which provider serves the events — they call into a transport you pass in, letting FastAPI/SSE hosts and embedded desktop sidecars share the same React UI.
61
+ 4. **Mirror the framework spec.** `ChatMessage`, `ToolCall`, `ToolResult`, `SSEEvent`, `AgentSession`, and card block payloads come from `@steerable/agent-protocol`, generated from JSON schemas in `spec/`.
52
62
 
53
63
  ## Working with this Storybook locally
54
64
 
@@ -56,16 +66,6 @@ For Tailwind v4 callers, mirror the design tokens with `@theme` (see `apps/web/s
56
66
  cd packages/agent-ui/ts
57
67
  pnpm storybook # http://localhost:6006
58
68
  pnpm storybook:build # static bundle in storybook-static/
59
- ```
60
-
61
- To regenerate visual snapshots (Phase 6, Playwright VRT):
62
-
63
- ```bash
64
- pnpm storybook:vrt --update-snapshots
65
- ```
66
-
67
- To run the headless mount + a11y test suite:
68
-
69
- ```bash
70
- pnpm storybook:test # expects pnpm storybook to be running on :6006
69
+ pnpm storybook:test # axe a11y + mount checks (with storybook running on :6006)
70
+ pnpm storybook:vrt # Playwright visual regression
71
71
  ```
@@ -0,0 +1,57 @@
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+ import { ActionSegmentCard } from './ActionSegmentCard.js';
3
+
4
+ const meta: Meta<typeof ActionSegmentCard> = {
5
+ title: 'Cards/ActionSegmentCard',
6
+ component: ActionSegmentCard,
7
+ parameters: {
8
+ layout: 'centered',
9
+ docs: {
10
+ description: {
11
+ component:
12
+ 'Groups sequential or parallel tool segments inside a single assistant turn using `ToolExecutionCard` rows.',
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 ActionSegmentCard>;
27
+
28
+ export const Default: Story = {
29
+ args: {
30
+ payload: {
31
+ segments: [
32
+ {
33
+ id: 'seg-1',
34
+ kind: 'local_read_file',
35
+ status: 'succeeded',
36
+ label: 'Read docs/spec/runtime-contract.json',
37
+ args: { path: 'docs/spec/runtime-contract.json' },
38
+ output: '38 RPC methods loaded',
39
+ error: null,
40
+ startedAt: null,
41
+ finishedAt: null,
42
+ },
43
+ {
44
+ id: 'seg-2',
45
+ kind: 'local_exec_shell',
46
+ status: 'running',
47
+ label: 'Running conformance checks',
48
+ args: { command: 'pnpm --filter @steerable/agent-protocol test' },
49
+ output: null,
50
+ error: null,
51
+ startedAt: null,
52
+ finishedAt: null,
53
+ },
54
+ ],
55
+ },
56
+ },
57
+ };
@@ -0,0 +1,38 @@
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+ import { AnalysisDocumentCard } from './AnalysisDocumentCard.js';
3
+
4
+ const meta: Meta<typeof AnalysisDocumentCard> = {
5
+ title: 'Cards/AnalysisDocumentCard',
6
+ component: AnalysisDocumentCard,
7
+ parameters: {
8
+ layout: 'centered',
9
+ docs: {
10
+ description: {
11
+ component:
12
+ 'Structured long-form analysis report container with pluggable `renderMarkdown` and footer slots.',
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 AnalysisDocumentCard>;
27
+
28
+ export const Default: Story = {
29
+ args: {
30
+ payload: {
31
+ title: 'Sandbox & Egress Confinement Audit',
32
+ createdAt: '2026-11-17T09:00:00Z',
33
+ modelId: 'glm-5.3-flash',
34
+ body: 'All 38 JSON-RPC sidecar methods operate under Seatbelt/bwrap confinement with per-host CONNECT allow-listing.',
35
+ },
36
+ renderMarkdown: (body) => <p className="text-sm leading-relaxed">{body}</p>,
37
+ },
38
+ };
@@ -49,16 +49,16 @@ export const AnalysisDocumentCard: React.FC<AnalysisDocumentCardProps> = ({
49
49
  >
50
50
  {payload.title && headerVariant === 'strip' ? (
51
51
  <div className="border-b border-[var(--agent-border,#e5e7eb)] bg-[var(--agent-muted,#f3f4f6)]/50 px-4 py-2">
52
- <span className="block truncate text-xs font-medium text-[var(--agent-muted-foreground,#6b7280)]">
52
+ <span className="block truncate text-xs font-medium text-[var(--agent-muted-foreground,#4b5563)]">
53
53
  {payload.title}
54
54
  </span>
55
55
  </div>
56
56
  ) : (
57
57
  <header className="mb-3 flex items-center gap-2 border-b border-[var(--agent-border,#e5e7eb)] px-4 pt-3 pb-2">
58
- <BookIcon size={14} className="text-[var(--agent-muted-foreground,#6b7280)]" />
58
+ <BookIcon size={14} className="text-[var(--agent-muted-foreground,#4b5563)]" />
59
59
  <h3 className="text-sm font-medium">{payload.title || '分析报告'}</h3>
60
60
  {payload.modelId && (
61
- <span className="ml-auto rounded-full bg-[var(--agent-muted,#f3f4f6)] px-2 py-0.5 text-[10px] uppercase tracking-wider text-[var(--agent-muted-foreground,#6b7280)]">
61
+ <span className="ml-auto rounded-full bg-[var(--agent-muted,#f3f4f6)] px-2 py-0.5 text-[10px] uppercase tracking-wider text-[var(--agent-muted-foreground,#4b5563)]">
62
62
  {payload.modelId}
63
63
  </span>
64
64
  )}
@@ -0,0 +1,66 @@
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+ import { AskUserQuestionsCard } from './AskUserQuestionsCard.js';
3
+
4
+ const meta: Meta<typeof AskUserQuestionsCard> = {
5
+ title: 'Cards/AskUserQuestionsCard',
6
+ component: AskUserQuestionsCard,
7
+ parameters: {
8
+ layout: 'centered',
9
+ actions: { argTypesRegex: '^on[A-Z].*' },
10
+ docs: {
11
+ description: {
12
+ component:
13
+ 'Structured multi-question prompt emitted by `ask_user`, supporting single-select, multi-select, custom free-text, and read-only answered states.',
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 AskUserQuestionsCard>;
28
+
29
+ export const Interactive: Story = {
30
+ args: {
31
+ allowCustomText: true,
32
+ onSubmit: () => {},
33
+ onAutoContinue: () => {},
34
+ payload: {
35
+ intro: 'Choose how to configure the sandbox before running tests:',
36
+ questions: [
37
+ {
38
+ id: 'q1',
39
+ text: 'Which egress policy should this session enforce?',
40
+ type: 'select',
41
+ options: ['Allow-list only (recommended)', 'Offline (no network)', 'Audit mode'],
42
+ multiSelect: false,
43
+ },
44
+ ],
45
+ },
46
+ },
47
+ };
48
+
49
+ export const Answered: Story = {
50
+ args: {
51
+ onSubmit: () => {},
52
+ payload: {
53
+ intro: 'Choose how to configure the sandbox before running tests:',
54
+ questions: [
55
+ {
56
+ id: 'q1',
57
+ text: 'Which egress policy should this session enforce?',
58
+ type: 'select',
59
+ options: ['Allow-list only (recommended)', 'Offline (no network)'],
60
+ multiSelect: false,
61
+ },
62
+ ],
63
+ answers: { q1: 'Allow-list only (recommended)' },
64
+ },
65
+ },
66
+ };
@@ -193,7 +193,7 @@ export const AskUserQuestionsCard: React.FC<AskUserQuestionsCardProps> = ({
193
193
  <div className="flex items-start justify-between gap-3">
194
194
  <div className="flex flex-1 items-start gap-2">
195
195
  {!payload.intro && (
196
- <MessageQuestionIcon size={14} className="mt-0.5 text-[var(--agent-muted-foreground,#6b7280)]" />
196
+ <MessageQuestionIcon size={14} className="mt-0.5 text-[var(--agent-muted-foreground,#4b5563)]" />
197
197
  )}
198
198
  {payload.intro ? (
199
199
  <p className="flex-1 text-sm">{payload.intro}</p>
@@ -223,7 +223,7 @@ export const AskUserQuestionsCard: React.FC<AskUserQuestionsCardProps> = ({
223
223
  <li key={q.id} className="space-y-2">
224
224
  <div className="flex items-center gap-2">
225
225
  {q.header && (
226
- <span className="inline-flex items-center rounded-full bg-[var(--agent-muted,#f3f4f6)] px-2 py-0.5 text-[10px] font-medium uppercase tracking-wide text-[var(--agent-muted-foreground,#6b7280)]">
226
+ <span className="inline-flex items-center rounded-full bg-[var(--agent-muted,#f3f4f6)] px-2 py-0.5 text-[10px] font-medium uppercase tracking-wide text-[var(--agent-muted-foreground,#4b5563)]">
227
227
  {q.header}
228
228
  </span>
229
229
  )}
@@ -231,7 +231,7 @@ export const AskUserQuestionsCard: React.FC<AskUserQuestionsCardProps> = ({
231
231
  <p className="text-sm font-medium">
232
232
  {idx + 1}. {q.text}
233
233
  {!inputOnly && q.multiSelect && (
234
- <span className="ml-1.5 text-xs font-normal text-[var(--agent-muted-foreground,#6b7280)]">
234
+ <span className="ml-1.5 text-xs font-normal text-[var(--agent-muted-foreground,#4b5563)]">
235
235
  {multiSelectLabel}
236
236
  </span>
237
237
  )}
@@ -244,7 +244,7 @@ export const AskUserQuestionsCard: React.FC<AskUserQuestionsCardProps> = ({
244
244
  placeholder={q.placeholder || (q.type === 'password' ? '输入密码' : '输入你的回答...')}
245
245
  value={customText[q.id] || ''}
246
246
  onChange={(e) => setCustomText((p) => ({ ...p, [q.id]: e.target.value }))}
247
- className="w-full rounded-lg border border-[var(--agent-border,#e5e7eb)] bg-[var(--agent-background,#fff)] px-3 py-1.5 text-xs text-[var(--agent-foreground,#111827)] outline-none placeholder:text-[var(--agent-muted-foreground,#6b7280)] focus:border-[var(--agent-primary,#18181b)] focus:ring-1 focus:ring-[var(--agent-primary,#18181b)] disabled:cursor-not-allowed disabled:opacity-60"
247
+ className="w-full rounded-lg border border-[var(--agent-border,#e5e7eb)] bg-[var(--agent-background,#fff)] px-3 py-1.5 text-xs text-[var(--agent-foreground,#111827)] outline-none placeholder:text-[var(--agent-muted-foreground,#4b5563)] focus:border-[var(--agent-primary,#18181b)] focus:ring-1 focus:ring-[var(--agent-primary,#18181b)] disabled:cursor-not-allowed disabled:opacity-60"
248
248
  />
249
249
  )}
250
250
 
@@ -269,7 +269,7 @@ export const AskUserQuestionsCard: React.FC<AskUserQuestionsCardProps> = ({
269
269
  'rounded-full border px-3 py-1.5 text-xs font-medium transition-all duration-200',
270
270
  selected
271
271
  ? 'border-[var(--agent-border,#e5e7eb)] bg-[var(--agent-muted,#f3f4f6)] text-[var(--agent-foreground,#111827)] ring-1 ring-[var(--agent-border,#e5e7eb)]'
272
- : 'border-[var(--agent-border,#e5e7eb)] bg-[var(--agent-card-bg,#fff)] text-[var(--agent-muted-foreground,#6b7280)] hover:bg-[var(--agent-muted,#f3f4f6)] hover:text-[var(--agent-foreground,#111827)]',
272
+ : 'border-[var(--agent-border,#e5e7eb)] bg-[var(--agent-card-bg,#fff)] text-[var(--agent-muted-foreground,#4b5563)] hover:bg-[var(--agent-muted,#f3f4f6)] hover:text-[var(--agent-foreground,#111827)]',
273
273
  isReadOnly ? 'cursor-not-allowed opacity-60' : 'cursor-pointer',
274
274
  ].join(' ')}
275
275
  >
@@ -287,7 +287,7 @@ export const AskUserQuestionsCard: React.FC<AskUserQuestionsCardProps> = ({
287
287
  disabled={isReadOnly}
288
288
  onClick={() => enterCustom(q.id)}
289
289
  className={[
290
- 'rounded-full border border-dashed border-[var(--agent-border,#e5e7eb)] px-3 py-1.5 text-xs font-medium text-[var(--agent-muted-foreground,#6b7280)] transition-all duration-200 hover:bg-[var(--agent-muted,#f3f4f6)] hover:text-[var(--agent-foreground,#111827)]',
290
+ 'rounded-full border border-dashed border-[var(--agent-border,#e5e7eb)] px-3 py-1.5 text-xs font-medium text-[var(--agent-muted-foreground,#4b5563)] transition-all duration-200 hover:bg-[var(--agent-muted,#f3f4f6)] hover:text-[var(--agent-foreground,#111827)]',
291
291
  isReadOnly ? 'cursor-not-allowed opacity-60' : 'cursor-pointer',
292
292
  ].join(' ')}
293
293
  >
@@ -309,13 +309,13 @@ export const AskUserQuestionsCard: React.FC<AskUserQuestionsCardProps> = ({
309
309
  onChange={(e) =>
310
310
  setCustomText((p) => ({ ...p, [q.id]: e.target.value }))
311
311
  }
312
- className="flex-1 rounded-lg border border-[var(--agent-border,#e5e7eb)] bg-[var(--agent-background,#fff)] px-3 py-1.5 text-xs text-[var(--agent-foreground,#111827)] outline-none placeholder:text-[var(--agent-muted-foreground,#6b7280)] focus:border-[var(--agent-primary,#18181b)] focus:ring-1 focus:ring-[var(--agent-primary,#18181b)] disabled:cursor-not-allowed disabled:opacity-60"
312
+ className="flex-1 rounded-lg border border-[var(--agent-border,#e5e7eb)] bg-[var(--agent-background,#fff)] px-3 py-1.5 text-xs text-[var(--agent-foreground,#111827)] outline-none placeholder:text-[var(--agent-muted-foreground,#4b5563)] focus:border-[var(--agent-primary,#18181b)] focus:ring-1 focus:ring-[var(--agent-primary,#18181b)] disabled:cursor-not-allowed disabled:opacity-60"
313
313
  />
314
314
  <button
315
315
  type="button"
316
316
  disabled={isReadOnly}
317
317
  onClick={() => cancelCustom(q.id)}
318
- className="text-xs text-[var(--agent-muted-foreground,#6b7280)] transition-colors duration-200 hover:text-[var(--agent-foreground,#111827)]"
318
+ className="text-xs text-[var(--agent-muted-foreground,#4b5563)] transition-colors duration-200 hover:text-[var(--agent-foreground,#111827)]"
319
319
  >
320
320
  取消
321
321
  </button>
@@ -329,14 +329,14 @@ export const AskUserQuestionsCard: React.FC<AskUserQuestionsCardProps> = ({
329
329
  </ol>
330
330
 
331
331
  {payload.outro && (
332
- <p className="text-xs text-[var(--agent-muted-foreground,#6b7280)] whitespace-pre-line">
332
+ <p className="text-xs text-[var(--agent-muted-foreground,#4b5563)] whitespace-pre-line">
333
333
  {payload.outro}
334
334
  </p>
335
335
  )}
336
336
 
337
337
  {!isReadOnly && onSubmit && (
338
338
  <div className="flex items-center justify-between pt-1">
339
- <span className="text-xs text-[var(--agent-muted-foreground,#6b7280)]">
339
+ <span className="text-xs text-[var(--agent-muted-foreground,#4b5563)]">
340
340
  {bottomHint}
341
341
  </span>
342
342
  <button
@@ -346,7 +346,7 @@ export const AskUserQuestionsCard: React.FC<AskUserQuestionsCardProps> = ({
346
346
  className={[
347
347
  'inline-flex items-center gap-1.5 rounded-full px-4 py-1.5 text-xs font-medium transition-all duration-200',
348
348
  submitting || (requireAllAnswered && !allAnswered)
349
- ? 'cursor-not-allowed bg-[var(--agent-muted,#f3f4f6)] text-[var(--agent-muted-foreground,#6b7280)]'
349
+ ? 'cursor-not-allowed bg-[var(--agent-muted,#f3f4f6)] text-[var(--agent-muted-foreground,#4b5563)]'
350
350
  : 'bg-[var(--agent-primary,#18181b)] text-[var(--agent-primary-foreground,#fff)] shadow-sm hover:opacity-90',
351
351
  ].join(' ')}
352
352
  >
@@ -0,0 +1,78 @@
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+ import { CoverageReportCard } from './CoverageReportCard.js';
3
+
4
+ const meta: Meta<typeof CoverageReportCard> = {
5
+ title: 'Cards/CoverageReportCard',
6
+ component: CoverageReportCard,
7
+ parameters: {
8
+ layout: 'centered',
9
+ actions: { argTypesRegex: '^on[A-Z].*' },
10
+ docs: {
11
+ description: {
12
+ component:
13
+ 'Displays topic coverage, mastery metrics, weak points, and optional remediation selection.',
14
+ },
15
+ },
16
+ },
17
+ decorators: [
18
+ (Story) => (
19
+ <div className="w-[520px]">
20
+ <Story />
21
+ </div>
22
+ ),
23
+ ],
24
+ };
25
+
26
+ export default meta;
27
+ type Story = StoryObj<typeof CoverageReportCard>;
28
+
29
+ export const Default: Story = {
30
+ args: {
31
+ allowWeakPointSelection: true,
32
+ onRemediate: () => {},
33
+ payload: {
34
+ reportId: 'cov-1',
35
+ title: 'Harness Conformance Coverage',
36
+ overallCoverage: 0.86,
37
+ overallMastery: 0.79,
38
+ summary: 'Strong coverage on wire types and retries; two edge cases flagged for follow-up.',
39
+ sections: [
40
+ {
41
+ id: 'sec-proto',
42
+ name: 'Protocol Schema',
43
+ coverage: 0.95,
44
+ mastery: 0.92,
45
+ totalCount: 20,
46
+ learnedCount: 19,
47
+ testedCount: 19,
48
+ masteredCount: 18,
49
+ weakKpIds: [],
50
+ },
51
+ {
52
+ id: 'sec-recovery',
53
+ name: 'Tool Recovery',
54
+ coverage: 0.78,
55
+ mastery: 0.68,
56
+ totalCount: 14,
57
+ learnedCount: 11,
58
+ testedCount: 11,
59
+ masteredCount: 10,
60
+ weakKpIds: ['wp-1'],
61
+ },
62
+ ],
63
+ weakPoints: [
64
+ {
65
+ id: 'wp-1',
66
+ name: 'Unclosed nested XML tool tag',
67
+ sectionName: 'Tool Recovery',
68
+ accuracy: 0.55,
69
+ recommendation: 'Add edge-case regression test for truncated XML parameters.',
70
+ },
71
+ ],
72
+ actions: {
73
+ allowRemediateQuiz: true,
74
+ remediateActionLabel: 'Practice weak points',
75
+ },
76
+ },
77
+ },
78
+ };
@@ -91,17 +91,17 @@ export const CoverageReportCard: React.FC<CoverageReportCardProps> = ({
91
91
 
92
92
  <div className="grid grid-cols-2 gap-2">
93
93
  <div className="rounded-md border border-[var(--agent-border,#e5e7eb)] bg-[var(--agent-background,#fff)] p-2">
94
- <p className="text-[11px] text-[var(--agent-muted-foreground,#6b7280)]">整体覆盖率</p>
94
+ <p className="text-[11px] text-[var(--agent-muted-foreground,#4b5563)]">整体覆盖率</p>
95
95
  <p className="text-base font-semibold">{pct(payload.overallCoverage)}</p>
96
96
  </div>
97
97
  <div className="rounded-md border border-[var(--agent-border,#e5e7eb)] bg-[var(--agent-background,#fff)] p-2">
98
- <p className="text-[11px] text-[var(--agent-muted-foreground,#6b7280)]">整体掌握率</p>
98
+ <p className="text-[11px] text-[var(--agent-muted-foreground,#4b5563)]">整体掌握率</p>
99
99
  <p className="text-base font-semibold">{pct(payload.overallMastery)}</p>
100
100
  </div>
101
101
  </div>
102
102
 
103
103
  {payload.summary && (
104
- <p className="text-xs text-[var(--agent-muted-foreground,#6b7280)] whitespace-pre-line">
104
+ <p className="text-xs text-[var(--agent-muted-foreground,#4b5563)] whitespace-pre-line">
105
105
  {payload.summary}
106
106
  </p>
107
107
  )}
@@ -116,7 +116,7 @@ export const CoverageReportCard: React.FC<CoverageReportCardProps> = ({
116
116
  >
117
117
  <div className="mb-1 flex items-center justify-between">
118
118
  <span className="text-sm font-medium">{section.name}</span>
119
- <span className="text-xs text-[var(--agent-muted-foreground,#6b7280)]">
119
+ <span className="text-xs text-[var(--agent-muted-foreground,#4b5563)]">
120
120
  覆盖 {pct(section.coverage)} · 掌握 {pct(section.mastery)}
121
121
  </span>
122
122
  </div>
@@ -132,7 +132,7 @@ export const CoverageReportCard: React.FC<CoverageReportCardProps> = ({
132
132
  />
133
133
  </div>
134
134
  {renderSectionStats && (
135
- <div className="mt-1 text-[11px] text-[var(--agent-muted-foreground,#6b7280)]">
135
+ <div className="mt-1 text-[11px] text-[var(--agent-muted-foreground,#4b5563)]">
136
136
  {asReactNode(renderSectionStats(section))}
137
137
  </div>
138
138
  )}
@@ -142,13 +142,13 @@ export const CoverageReportCard: React.FC<CoverageReportCardProps> = ({
142
142
  </div>
143
143
 
144
144
  <div className="space-y-2 rounded-md border border-[var(--agent-border,#e5e7eb)] bg-[var(--agent-background,#fff)] p-2">
145
- <div className="flex items-center gap-1.5 text-xs font-medium text-amber-600 dark:text-amber-400">
145
+ <div className="flex items-center gap-1.5 text-xs font-medium text-amber-700 dark:text-amber-400">
146
146
  <AlertIcon size={12} />
147
147
  薄弱知识点
148
148
  </div>
149
149
  {weakPoints.length === 0 ? (
150
150
  emptyWeakPointsLabel ? (
151
- <div className="inline-flex items-center gap-1.5 text-xs text-green-600 dark:text-green-400">
151
+ <div className="inline-flex items-center gap-1.5 text-xs text-green-700 dark:text-green-400">
152
152
  <CheckIcon size={12} />
153
153
  {emptyWeakPointsLabel}
154
154
  </div>
@@ -169,7 +169,7 @@ export const CoverageReportCard: React.FC<CoverageReportCardProps> = ({
169
169
  {point.name}
170
170
  {point.sectionName ? ` · ${point.sectionName}` : ''}
171
171
  </p>
172
- <p className="text-[var(--agent-muted-foreground,#6b7280)]">
172
+ <p className="text-[var(--agent-muted-foreground,#4b5563)]">
173
173
  正确率 {pct(point.accuracy)} · {point.recommendation}
174
174
  </p>
175
175
  </div>
@@ -182,10 +182,10 @@ export const CoverageReportCard: React.FC<CoverageReportCardProps> = ({
182
182
  <li key={wp.id}>
183
183
  <span className="font-medium">{wp.name}</span>
184
184
  {wp.sectionName && (
185
- <span className="ml-1 text-[var(--agent-muted-foreground,#6b7280)]">· {wp.sectionName}</span>
185
+ <span className="ml-1 text-[var(--agent-muted-foreground,#4b5563)]">· {wp.sectionName}</span>
186
186
  )}
187
- <span className="ml-1 text-[var(--agent-muted-foreground,#6b7280)]">· 正确率 {pct(wp.accuracy)}</span>
188
- <p className="text-[var(--agent-muted-foreground,#6b7280)]">{wp.recommendation}</p>
187
+ <span className="ml-1 text-[var(--agent-muted-foreground,#4b5563)]">· 正确率 {pct(wp.accuracy)}</span>
188
+ <p className="text-[var(--agent-muted-foreground,#4b5563)]">{wp.recommendation}</p>
189
189
  </li>
190
190
  ))}
191
191
  </ul>
@@ -194,7 +194,7 @@ export const CoverageReportCard: React.FC<CoverageReportCardProps> = ({
194
194
 
195
195
  {payload.actions?.allowRemediateQuiz && onRemediate && weakPoints.length > 0 && (
196
196
  <div className="flex items-center justify-between pt-1">
197
- <span className="text-xs text-[var(--agent-muted-foreground,#6b7280)]">
197
+ <span className="text-xs text-[var(--agent-muted-foreground,#4b5563)]">
198
198
  {remediateHint}
199
199
  </span>
200
200
  <button
@@ -0,0 +1,45 @@
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+ import { OrchestrationPlanCard } from './OrchestrationPlanCard.js';
3
+
4
+ const meta: Meta<typeof OrchestrationPlanCard> = {
5
+ title: 'Cards/OrchestrationPlanCard',
6
+ component: OrchestrationPlanCard,
7
+ parameters: {
8
+ layout: 'centered',
9
+ docs: {
10
+ description: {
11
+ component:
12
+ 'Schema-backed multi-agent orchestration plan card (`@steerable/agent-ui/cards`) tracking delegated tasks and live statuses.',
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 OrchestrationPlanCard>;
27
+
28
+ export const Default: Story = {
29
+ args: {
30
+ payload: {
31
+ rationale: 'Verify protocol drift and run sandbox conformance checks in parallel.',
32
+ mode: 'parallel',
33
+ tasks: [
34
+ { id: 't1', agentId: 'spec-auditor', prompt: 'Validate runtime-contract.json against TS & Py types' },
35
+ { id: 't2', agentId: 'sandbox-tester', prompt: 'Verify Seatbelt & CONNECT egress allow-list rules' },
36
+ { id: 't3', agentId: 'reporter', prompt: 'Compile summary deliverable' },
37
+ ],
38
+ },
39
+ taskStatuses: {
40
+ t1: 'ok',
41
+ t2: 'running',
42
+ t3: 'pending',
43
+ },
44
+ },
45
+ };