@seed-ship/mcp-ui-solid 3.0.1 → 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.
- package/dist/components/ScratchpadPanel.cjs +49 -17
- package/dist/components/ScratchpadPanel.cjs.map +1 -1
- package/dist/components/ScratchpadPanel.d.ts.map +1 -1
- package/dist/components/ScratchpadPanel.js +49 -17
- package/dist/components/ScratchpadPanel.js.map +1 -1
- package/package.json +1 -1
- package/src/components/ScratchpadPanel.tsx +46 -1
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -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)
|
|
@@ -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 {
|
|
@@ -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
|
-
|
|
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
|
|