@seed-ship/mcp-ui-solid 2.6.4 → 2.8.0

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.
@@ -58,6 +58,9 @@ export interface ChatEvents {
58
58
  onBriefing: (event: ChatEventBase & { briefing: BriefingEvent }) => void
59
59
  onCapabilityChange: (event: ChatEventBase & { capabilities: string[] }) => void
60
60
 
61
+ // --- Scratchpad (HITL shared workspace) ---
62
+ onScratchpad: (event: ChatEventBase & { scratchpad: ScratchpadEvent }) => void
63
+
61
64
  // --- Fallback ---
62
65
  onCustomEvent: (type: string, event: ChatEventBase & { data: unknown }) => void
63
66
  }
@@ -221,8 +224,29 @@ export interface FormPromptConfig {
221
224
  checkboxLabel?: string
222
225
  /** Help text below field */
223
226
  helpText?: string
227
+ /** Dependent field — update options when parent field changes */
228
+ dependsOn?: {
229
+ field: string
230
+ apiUrl: string
231
+ labelField: string
232
+ valueField: string
233
+ extraParams?: Record<string, string>
234
+ }
235
+ /** Conditional visibility (show/hide based on another field value) */
236
+ showWhen?: { field: string; operator: 'equals' | 'not_equals' | 'in'; value: any }
224
237
  }>
225
238
  submitLabel?: string
239
+ /** Live preview configuration — shows stats as user fills the form */
240
+ preview?: {
241
+ /** API endpoint to call for preview */
242
+ endpoint: string
243
+ /** Debounce delay in ms (default: 500) */
244
+ debounceMs?: number
245
+ /** Fields to include in the preview request */
246
+ fields: string[]
247
+ /** Display format */
248
+ format?: 'text' | 'stats'
249
+ }
226
250
  }
227
251
 
228
252
  export interface SelectPromptConfig {
@@ -293,6 +317,52 @@ export interface BriefingSection {
293
317
  components?: UIComponent[]
294
318
  }
295
319
 
320
+ // ─── Scratchpad types ────────────────────────────────────────
321
+
322
+ /**
323
+ * @experimental
324
+ * Scratchpad state — shared workspace between agent and human.
325
+ * The agent fills sections, the human can edit filters and validate.
326
+ */
327
+ export interface ScratchpadState {
328
+ id: string
329
+ title: string
330
+ sections: ScratchpadSection[]
331
+ /** Active filters — human can add/remove */
332
+ filters: Record<string, string | string[]>
333
+ /** Live preview (auto-updated when filters change) */
334
+ preview?: { count: number; rows?: Record<string, unknown>[]; summary: string }
335
+ /** Agent messages (explanations, questions) */
336
+ agentMessages: Array<{ text: string; type: 'info' | 'question' | 'warning' }>
337
+ status: 'loading' | 'ready' | 'waiting_human' | 'processing' | 'complete'
338
+ }
339
+
340
+ export interface ScratchpadSection {
341
+ id: string
342
+ title: string
343
+ type: 'data' | 'filter' | 'preview' | 'message' | 'action' | 'steps' | 'form'
344
+ content: unknown
345
+ /** Can the human edit this section? */
346
+ editable: boolean
347
+ /** Who filled this section */
348
+ source: 'agent' | 'human' | 'api'
349
+ }
350
+
351
+ /**
352
+ * @experimental
353
+ * SSE event for scratchpad create/update/close.
354
+ */
355
+ export interface ScratchpadEvent {
356
+ id: string
357
+ action: 'create' | 'update' | 'close'
358
+ title?: string
359
+ sections?: ScratchpadSection[]
360
+ filters?: Record<string, string | string[]>
361
+ preview?: { count: number; rows?: Record<string, unknown>[]; summary: string }
362
+ agentMessages?: Array<{ text: string; type: 'info' | 'question' | 'warning' }>
363
+ status?: ScratchpadState['status']
364
+ }
365
+
296
366
  // ─── SSE / Stream types ──────────────────────────────────────
297
367
 
298
368
  export interface StreamDoneMetadata {
@@ -344,6 +344,21 @@ export interface FormFieldParams {
344
344
  /** Debounce delay in ms (default: 300) */
345
345
  debounceMs?: number
346
346
 
347
+ // Dependent field — update options when parent changes
348
+ /** Field dependency configuration */
349
+ dependsOn?: {
350
+ /** Name of the parent field */
351
+ field: string
352
+ /** API URL template — use {value} for parent value (e.g. '/departements/{value}/communes') */
353
+ apiUrl: string
354
+ /** Field in API response to display */
355
+ labelField: string
356
+ /** Field in API response for value */
357
+ valueField: string
358
+ /** Extra query parameters */
359
+ extraParams?: Record<string, string>
360
+ }
361
+
347
362
  // Checkbox specific
348
363
  checkboxLabel?: string
349
364