Phase 2: Refactor Prompts cluster to MCP SDK types

Replace ad hoc local types with MCP SDK schema types across the Prompts
group components and PromptsScreen, per the v2 UX interfaces plan.

- PromptListItem: accept `prompt: Prompt` instead of flat `name`/`description`;
  render `title ?? name` as primary label
- PromptControls: accept `Prompt[]` + `selectedName` instead of `PromptItem[]`;
  no-op on clicking already-selected prompt; search includes title field
- PromptArgumentsForm: accept `prompt: Prompt` instead of flat props;
  read `prompt.arguments` directly; display `title ?? name` as heading
- PromptMessagesDisplay: narrow type from `(PromptMessage | SamplingMessage)[]`
  to `PromptMessage[]` per spec
- PromptsScreen: accept `Prompt[]` + `selectedPromptName` + `GetPromptState`;
  derive selected prompt via `prompts.find()`; own `argumentValues` state
  locally; reset arguments on tool switch
- Delete local `PromptItem`, `SelectedPrompt`, `PromptArgument` types
- Update all stories with real SDK `Prompt` fixtures
- Update ConnectedView PromptsActive story

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
cliffhall 2026-04-18 17:49:27 -04:00
commit de40b3720e

View file

@ -594,60 +594,52 @@ export const PromptsActive: Story = {
{
name: "summarize",
description: "Summarize a document",
selected: false,
},
{
name: "translate",
description: "Translate text to another language",
selected: true,
arguments: [
{
name: "text",
required: true,
description: "The text to translate",
},
{
name: "targetLanguage",
required: true,
description: "Target language code",
},
],
},
{
name: "code-review",
description: "Review code for issues",
selected: false,
},
]}
selectedPrompt={{
name: "translate",
description: "Translate text to another language",
arguments: [
{
name: "text",
required: true,
description: "The text to translate",
},
{
name: "targetLanguage",
required: true,
description: "Target language code",
},
],
argumentValues: {
text: "Hello, how are you?",
targetLanguage: "es",
},
}}
messages={{
onCopyAll: fn(),
messages: [
{
role: "user",
content: {
type: "text",
text: 'Translate the following text to Spanish: "Hello, how are you?"',
selectedPromptName="translate"
getPromptState={{
status: "ok",
result: {
messages: [
{
role: "user",
content: {
type: "text",
text: 'Translate the following text to Spanish: "Hello, how are you?"',
},
},
},
{
role: "assistant",
content: { type: "text", text: "Hola, como estas?" },
},
],
{
role: "assistant",
content: { type: "text", text: "Hola, como estas?" },
},
],
},
}}
listChanged={true}
onRefreshList={fn()}
onSelectPrompt={fn()}
onArgumentChange={fn()}
onGetPrompt={fn()}
onCopyMessages={fn()}
/>
),
},