@seed-ship/mcp-ui-solid 4.3.8 → 4.3.9

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.
@@ -94,7 +94,19 @@ export interface ChatCommands {
94
94
  appendPrompt: (text: string) => void
95
95
 
96
96
  // --- Structured interactions ---
97
- /** Show a ChatPrompt (choice, confirm, form) above the input (C4) */
97
+ /**
98
+ * Show a ChatPrompt (choice, confirm, form) above the input (C4).
99
+ *
100
+ * **Known limitation (v4.3.9):** Not re-entrant. If called while another
101
+ * prompt is already active, the previous prompt's Promise will never resolve
102
+ * (memory leak). Host apps must queue prompts or dismiss the previous one
103
+ * manually before showing a new one. Fix planned for v4.4.0 (auto-reject
104
+ * previous prompt or FIFO queue).
105
+ *
106
+ * **AbortSignal limitation (v4.3.9):** The `signal` argument is currently
107
+ * unused — `ChatPrompt` does not listen to aborts. Host apps must wire
108
+ * abort → Promise rejection themselves. Fix planned for v4.4.0.
109
+ */
98
110
  showChatPrompt: (config: ChatPromptConfig, signal?: AbortSignal) => Promise<ChatPromptResponse>
99
111
  /** Dismiss the active ChatPrompt */
100
112
  dismissChatPrompt: () => void
@@ -180,12 +192,20 @@ export interface ChatCommandHandler {
180
192
  * Configuration for a ChatPrompt interaction.
181
193
  */
182
194
  export interface ChatPromptConfig {
183
- /** Prompt type */
184
- type: 'choice' | 'confirm' | 'form' | 'select'
195
+ /**
196
+ * Prompt type:
197
+ * - 'choice' → large visual buttons with icon + description (horizontal/vertical/grid layout)
198
+ * - 'confirm' → yes/no dialog with danger variant
199
+ * - 'form' → full form with 18 field types (text, select, autocomplete, conditional, ...)
200
+ *
201
+ * NOTE: 'select' was declared in v4.0 but never implemented — removed in v4.3.9.
202
+ * Use 'form' with a single `{type: 'select'}` field, or 'choice' for large visual picks.
203
+ */
204
+ type: 'choice' | 'confirm' | 'form'
185
205
  /** Title / question displayed */
186
206
  title: string
187
207
  /** Type-specific configuration */
188
- config: ChoicePromptConfig | ConfirmPromptConfig | FormPromptConfig | SelectPromptConfig
208
+ config: ChoicePromptConfig | ConfirmPromptConfig | FormPromptConfig
189
209
  }
190
210
 
191
211
  export interface ChoicePromptConfig {
@@ -194,6 +214,13 @@ export interface ChoicePromptConfig {
194
214
  label: string
195
215
  icon?: string
196
216
  description?: string
217
+ /**
218
+ * Free-form metadata (confidence, source, tags, ...).
219
+ * Opaque to default renderer — use a custom ChoiceBody wrapper to display it.
220
+ * Preserved through showChatPrompt → ChatPromptResponse roundtrip.
221
+ * @since v4.3.9
222
+ */
223
+ metadata?: Record<string, unknown>
197
224
  }>
198
225
  layout?: 'horizontal' | 'vertical' | 'grid'
199
226
  }
@@ -258,12 +285,6 @@ export interface FormPromptConfig {
258
285
  }
259
286
  }
260
287
 
261
- export interface SelectPromptConfig {
262
- options: Array<{ value: string; label: string; group?: string }>
263
- placeholder?: string
264
- searchable?: boolean
265
- }
266
-
267
288
  /**
268
289
  * @experimental
269
290
  * Structured response from a ChatPrompt.
@@ -274,7 +295,17 @@ export interface ChatPromptResponse {
274
295
  value: string | Record<string, unknown>
275
296
  /** Human-readable label (for display in chat as user message) */
276
297
  label: string
277
- /** Whether the user dismissed without answering */
298
+ /**
299
+ * True when user closed the prompt without explicit answer.
300
+ * - X icon click (any type) → dismissed: true
301
+ * - Cancel button in 'confirm' → dismissed: true
302
+ * - Choice button click → dismissed: undefined (explicit answer)
303
+ * - Form submit → dismissed: undefined (explicit answer)
304
+ * - AbortSignal triggered → Promise rejection (NOT a response).
305
+ * NOTE: Host app is currently responsible for wiring AbortSignal to
306
+ * Promise.reject. mcp-ui's ChatPrompt component does NOT listen to
307
+ * the signal yet (v4.3.9 known limitation, fix planned in v4.4.0).
308
+ */
278
309
  dismissed?: boolean
279
310
  }
280
311
 
@@ -434,13 +465,29 @@ export interface ToolCallEvent {
434
465
  }
435
466
 
436
467
  export interface ClarificationEvent {
468
+ /** The question to ask the user */
437
469
  question: string
470
+ /** Available options (aligns with ChoicePromptConfig.options shape) */
438
471
  options: Array<{
439
472
  value: string
440
473
  label: string
474
+ /** @deprecated Use metadata.file_id instead. Will be removed in v5.0.0. */
441
475
  file_id?: number
476
+ /**
477
+ * Free-form metadata (confidence, source, tags, ...).
478
+ * Opaque to mcp-ui — host apps pass it through as-is.
479
+ * @since v4.3.9
480
+ */
481
+ metadata?: Record<string, unknown>
442
482
  }>
483
+ /** Original user message that triggered the clarification */
443
484
  original_message?: string
485
+ /**
486
+ * Free-form type tag for host routing (e.g. 'intent_disambiguate', 'file_select').
487
+ * Opaque to mcp-ui — hosts use it to decide how to render/route the clarification.
488
+ * @since v4.3.9
489
+ */
490
+ type?: string
444
491
  }
445
492
 
446
493
  // ─── Data Validation (v3.1.0 — anti-hallucination) ──────────