@seed-ship/mcp-ui-solid 3.0.0 → 3.0.2

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.
@@ -36,7 +36,7 @@ export interface ScratchpadPanelProps {
36
36
 
37
37
  const STATUS_BADGES: Record<ScratchpadState['status'], { label: string; class: string }> = {
38
38
  loading: { label: 'Loading...', class: 'bg-yellow-100 text-yellow-700 dark:bg-yellow-900/30 dark:text-yellow-400' },
39
- ready: { label: 'Ready', class: 'bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400' },
39
+ ready: { label: 'Action available', class: 'bg-cyan-100 text-cyan-700 dark:bg-cyan-900/30 dark:text-cyan-400' },
40
40
  waiting_human: { label: 'Your turn', class: 'bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400 animate-pulse' },
41
41
  processing: { label: 'Processing...', class: 'bg-purple-100 text-purple-700 dark:bg-purple-900/30 dark:text-purple-400' },
42
42
  complete: { label: 'Complete', class: 'bg-green-100 text-green-600 dark:bg-green-900/30 dark:text-green-400' },
@@ -63,10 +63,49 @@ export const ScratchpadPanel: Component<ScratchpadPanelProps> = (props) => {
63
63
  console.log(`[ScratchpadPanel:${props.state.id}] ${event}`, data || '')
64
64
  }
65
65
 
66
+ // ─── DX1: Proactive console messages (always, not just debug) ───
67
+
68
+ const VALID_TRANSITIONS: Record<string, string[]> = {
69
+ loading: ['processing', 'waiting_human', 'error'],
70
+ waiting_human: ['processing', 'ready', 'complete', 'error'],
71
+ processing: ['ready', 'complete', 'error', 'waiting_human'],
72
+ ready: ['processing', 'complete', 'error', 'waiting_human'],
73
+ complete: [],
74
+ error: ['processing', 'ready', 'waiting_human'],
75
+ }
76
+ let prevStatus = props.state.status
77
+
78
+ // Etape 1: create log
79
+ console.info(
80
+ `%c[MCP-UI] Scratchpad created%c id=${props.state.id} sections=${props.state.sections?.length || 0} status=${props.state.status}${props.pinned ? ' pinned=true' : ''}`,
81
+ 'color: #10b981; font-weight: bold', 'color: inherit'
82
+ )
83
+
84
+ // Etape 3: status transitions + Etape 4: auto-close info
85
+ createEffect(() => {
86
+ const newStatus = props.state.status
87
+ if (newStatus !== prevStatus) {
88
+ console.info(`%c[MCP-UI] Scratchpad status%c ${props.state.id}: ${prevStatus} → ${newStatus}`, 'color: #3b82f6; font-weight: bold', 'color: inherit')
89
+ if (!VALID_TRANSITIONS[prevStatus]?.includes(newStatus)) {
90
+ console.warn(`[MCP-UI] Scratchpad ${props.state.id}: unusual transition ${prevStatus} → ${newStatus}. Expected: ${VALID_TRANSITIONS[prevStatus]?.join(', ') || 'none (terminal)'}`)
91
+ }
92
+ prevStatus = newStatus
93
+ }
94
+ // Etape 4
95
+ if (props.autoCloseDelay && newStatus !== 'complete') {
96
+ console.info(`[MCP-UI] Scratchpad ${props.state.id}: autoCloseDelay=${props.autoCloseDelay}ms but status='${newStatus}' — auto-close will NOT trigger.`)
97
+ }
98
+ })
99
+
66
100
  // Action aliases that auto-close the scratchpad
67
101
  const CLOSE_ALIASES = new Set(['done', 'close', 'dismiss', 'validate', 'cancel', 'sufficient'])
68
102
 
69
103
  const handleAction = (action: string, data?: unknown) => {
104
+ // DX1 Etape 5: action dispatch
105
+ console.info(`%c[MCP-UI] Action dispatched%c value='${action}' asyncAction=${!!props.asyncAction}`, 'color: #f59e0b; font-weight: bold', 'color: inherit')
106
+ if (!props.asyncAction && /^(try_alt:|retry|fetch|load)/.test(action)) {
107
+ console.warn(`[MCP-UI] ScratchpadPanel: action '${action}' looks async but asyncAction prop is not set. The button will NOT show a loading state.`)
108
+ }
70
109
  debugLog('onAction', { action, asyncAction: props.asyncAction, data })
71
110
  if (props.asyncAction && !CLOSE_ALIASES.has(action)) {
72
111
  setLoadingAction(action)
@@ -123,7 +162,7 @@ export const ScratchpadPanel: Component<ScratchpadPanelProps> = (props) => {
123
162
  props.state.status === 'waiting_human'
124
163
  ? 'border-blue-300 dark:border-blue-600'
125
164
  : 'border-gray-200 dark:border-gray-700'
126
- }`}
165
+ } ${props.pinned ? 'sticky top-0 z-40' : ''}`}
127
166
  style={{ animation: 'scratchpad-slide-down 0.2s ease-out' }}
128
167
  >
129
168
  {/* Header */}
@@ -503,6 +542,9 @@ const EmbeddedFormSection: Component<{
503
542
  .filter(([, v]) => v !== undefined && v !== '' && !(Array.isArray(v) && v.length === 0))
504
543
  )
505
544
 
545
+ // DX1 Etape 7: form submit log
546
+ console.info(`%c[MCP-UI] Form submitted%c section=${props.sectionId} fields=${Object.keys(values).join(',')}`, 'color: #8b5cf6; font-weight: bold', 'color: inherit')
547
+
506
548
  if (props.onSubmit) {
507
549
  props.onSubmit(props.sectionId, values)
508
550
  } else {
@@ -547,7 +589,7 @@ const EnrichedStepsSection: Component<{
547
589
  <div class="space-y-3">
548
590
  <For each={stepsData().steps}>
549
591
  {(step: any) => (
550
- <div class={`rounded-lg ${step.status === 'active' ? 'bg-blue-50/50 dark:bg-blue-900/10 border border-blue-200 dark:border-blue-800 p-3' : 'px-1'}`}>
592
+ <div class={`rounded-lg ${step.status === 'active' ? 'bg-blue-50/50 dark:bg-blue-900/10 border border-blue-200 dark:border-blue-800 p-3 animate-pulse' : 'px-1'}`}>
551
593
  <div class={`flex items-center gap-2 text-sm font-medium ${
552
594
  step.status === 'done' ? 'text-green-600 dark:text-green-400'
553
595
  : step.status === 'active' ? 'text-blue-600 dark:text-blue-400'
@@ -822,7 +864,7 @@ const StepperProgressSection: Component<{ content: unknown }> = (props) => {
822
864
  </Show>
823
865
  <div class={`flex items-center gap-1 px-2 py-1 rounded text-xs ${
824
866
  step.status === 'done' ? 'bg-green-50 dark:bg-green-900/20 text-green-700 dark:text-green-400'
825
- : step.status === 'active' ? 'bg-blue-50 dark:bg-blue-900/20 text-blue-700 dark:text-blue-400 font-medium'
867
+ : step.status === 'active' ? 'bg-blue-50 dark:bg-blue-900/20 text-blue-700 dark:text-blue-400 font-medium animate-pulse'
826
868
  : step.status === 'error' ? 'bg-red-50 dark:bg-red-900/20 text-red-700 dark:text-red-400'
827
869
  : 'text-gray-400'
828
870
  }`}>
@@ -849,7 +891,10 @@ const ErrorSectionRenderer: Component<{
849
891
  const [showDetails, setShowDetails] = createSignal(false)
850
892
  const data = () => {
851
893
  const c = props.content as any
852
- return { message: c?.message || 'Error', severity: c?.severity || 'error', retryAction: c?.retryAction, retryLabel: c?.retryLabel || 'Retry', details: c?.details, timestamp: c?.timestamp }
894
+ const d = { message: c?.message || 'Error', severity: c?.severity || 'error', retryAction: c?.retryAction, retryLabel: c?.retryLabel || 'Retry', details: c?.details, timestamp: c?.timestamp }
895
+ // DX1 Etape 8
896
+ console.info(`%c[MCP-UI] Error section rendered%c severity=${d.severity} retry=${!!d.retryAction}`, 'color: #ef4444; font-weight: bold', 'color: inherit')
897
+ return d
853
898
  }
854
899
  const isWarning = () => data().severity === 'warning'
855
900