@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.
- package/dist/components/ScratchpadPanel.cjs +54 -22
- package/dist/components/ScratchpadPanel.cjs.map +1 -1
- package/dist/components/ScratchpadPanel.d.ts.map +1 -1
- package/dist/components/ScratchpadPanel.js +54 -22
- package/dist/components/ScratchpadPanel.js.map +1 -1
- package/package.json +1 -1
- package/src/components/ScratchpadPanel.tsx +50 -5
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -10,8 +10,8 @@ const STATUS_BADGES = {
|
|
|
10
10
|
class: "bg-yellow-100 text-yellow-700 dark:bg-yellow-900/30 dark:text-yellow-400"
|
|
11
11
|
},
|
|
12
12
|
ready: {
|
|
13
|
-
label: "
|
|
14
|
-
class: "bg-
|
|
13
|
+
label: "Action available",
|
|
14
|
+
class: "bg-cyan-100 text-cyan-700 dark:bg-cyan-900/30 dark:text-cyan-400"
|
|
15
15
|
},
|
|
16
16
|
waiting_human: {
|
|
17
17
|
label: "Your turn",
|
|
@@ -31,6 +31,7 @@ const STATUS_BADGES = {
|
|
|
31
31
|
}
|
|
32
32
|
};
|
|
33
33
|
const ScratchpadPanel = (props) => {
|
|
34
|
+
var _a;
|
|
34
35
|
const [collapsed, setCollapsed] = createSignal(false);
|
|
35
36
|
const [localPreview, setLocalPreview] = createSignal(void 0);
|
|
36
37
|
const [loadingAction, setLoadingAction] = createSignal(null);
|
|
@@ -48,9 +49,37 @@ const ScratchpadPanel = (props) => {
|
|
|
48
49
|
setLastEvent(event);
|
|
49
50
|
console.log(`[ScratchpadPanel:${props.state.id}] ${event}`, data || "");
|
|
50
51
|
};
|
|
52
|
+
const VALID_TRANSITIONS = {
|
|
53
|
+
loading: ["processing", "waiting_human", "error"],
|
|
54
|
+
waiting_human: ["processing", "ready", "complete", "error"],
|
|
55
|
+
processing: ["ready", "complete", "error", "waiting_human"],
|
|
56
|
+
ready: ["processing", "complete", "error", "waiting_human"],
|
|
57
|
+
complete: [],
|
|
58
|
+
error: ["processing", "ready", "waiting_human"]
|
|
59
|
+
};
|
|
60
|
+
let prevStatus = props.state.status;
|
|
61
|
+
console.info(`%c[MCP-UI] Scratchpad created%c id=${props.state.id} sections=${((_a = props.state.sections) == null ? void 0 : _a.length) || 0} status=${props.state.status}${props.pinned ? " pinned=true" : ""}`, "color: #10b981; font-weight: bold", "color: inherit");
|
|
62
|
+
createEffect(() => {
|
|
63
|
+
var _a2, _b;
|
|
64
|
+
const newStatus = props.state.status;
|
|
65
|
+
if (newStatus !== prevStatus) {
|
|
66
|
+
console.info(`%c[MCP-UI] Scratchpad status%c ${props.state.id}: ${prevStatus} → ${newStatus}`, "color: #3b82f6; font-weight: bold", "color: inherit");
|
|
67
|
+
if (!((_a2 = VALID_TRANSITIONS[prevStatus]) == null ? void 0 : _a2.includes(newStatus))) {
|
|
68
|
+
console.warn(`[MCP-UI] Scratchpad ${props.state.id}: unusual transition ${prevStatus} → ${newStatus}. Expected: ${((_b = VALID_TRANSITIONS[prevStatus]) == null ? void 0 : _b.join(", ")) || "none (terminal)"}`);
|
|
69
|
+
}
|
|
70
|
+
prevStatus = newStatus;
|
|
71
|
+
}
|
|
72
|
+
if (props.autoCloseDelay && newStatus !== "complete") {
|
|
73
|
+
console.info(`[MCP-UI] Scratchpad ${props.state.id}: autoCloseDelay=${props.autoCloseDelay}ms but status='${newStatus}' — auto-close will NOT trigger.`);
|
|
74
|
+
}
|
|
75
|
+
});
|
|
51
76
|
const CLOSE_ALIASES = /* @__PURE__ */ new Set(["done", "close", "dismiss", "validate", "cancel", "sufficient"]);
|
|
52
77
|
const handleAction = (action, data) => {
|
|
53
|
-
var
|
|
78
|
+
var _a2;
|
|
79
|
+
console.info(`%c[MCP-UI] Action dispatched%c value='${action}' asyncAction=${!!props.asyncAction}`, "color: #f59e0b; font-weight: bold", "color: inherit");
|
|
80
|
+
if (!props.asyncAction && /^(try_alt:|retry|fetch|load)/.test(action)) {
|
|
81
|
+
console.warn(`[MCP-UI] ScratchpadPanel: action '${action}' looks async but asyncAction prop is not set. The button will NOT show a loading state.`);
|
|
82
|
+
}
|
|
54
83
|
debugLog("onAction", {
|
|
55
84
|
action,
|
|
56
85
|
asyncAction: props.asyncAction,
|
|
@@ -59,16 +88,16 @@ const ScratchpadPanel = (props) => {
|
|
|
59
88
|
if (props.asyncAction && !CLOSE_ALIASES.has(action)) {
|
|
60
89
|
setLoadingAction(action);
|
|
61
90
|
}
|
|
62
|
-
(
|
|
91
|
+
(_a2 = props.onAction) == null ? void 0 : _a2.call(props, action, data);
|
|
63
92
|
if (CLOSE_ALIASES.has(action) && props.onClose) {
|
|
64
93
|
props.onClose();
|
|
65
94
|
}
|
|
66
95
|
};
|
|
67
96
|
createEffect(() => {
|
|
68
|
-
var
|
|
97
|
+
var _a2;
|
|
69
98
|
debugLog("state", {
|
|
70
99
|
status: props.state.status,
|
|
71
|
-
sections: (
|
|
100
|
+
sections: (_a2 = props.state.sections) == null ? void 0 : _a2.length,
|
|
72
101
|
filters: Object.keys(props.state.filters || {}),
|
|
73
102
|
turn: props.state.turn
|
|
74
103
|
});
|
|
@@ -76,8 +105,8 @@ const ScratchpadPanel = (props) => {
|
|
|
76
105
|
createEffect(() => {
|
|
77
106
|
if (props.state.status === "complete" && props.autoCloseDelay && !props.pinned) {
|
|
78
107
|
const timer = setTimeout(() => {
|
|
79
|
-
var
|
|
80
|
-
return (
|
|
108
|
+
var _a2;
|
|
109
|
+
return (_a2 = props.onClose) == null ? void 0 : _a2.call(props);
|
|
81
110
|
}, props.autoCloseDelay);
|
|
82
111
|
onCleanup(() => clearTimeout(timer));
|
|
83
112
|
}
|
|
@@ -134,9 +163,9 @@ const ScratchpadPanel = (props) => {
|
|
|
134
163
|
get children() {
|
|
135
164
|
var _el$1 = getNextElement(_tmpl$2);
|
|
136
165
|
_el$1.$$click = (e) => {
|
|
137
|
-
var
|
|
166
|
+
var _a2;
|
|
138
167
|
e.stopPropagation();
|
|
139
|
-
(
|
|
168
|
+
(_a2 = props.onClose) == null ? void 0 : _a2.call(props);
|
|
140
169
|
};
|
|
141
170
|
runHydrationEvents();
|
|
142
171
|
return _el$1;
|
|
@@ -295,8 +324,8 @@ const ScratchpadPanel = (props) => {
|
|
|
295
324
|
get children() {
|
|
296
325
|
var _el$17 = getNextElement(_tmpl$5), _el$18 = _el$17.firstChild, _el$19 = _el$18.nextSibling, _el$20 = _el$19.nextSibling;
|
|
297
326
|
_el$20.$$click = () => {
|
|
298
|
-
var
|
|
299
|
-
return (
|
|
327
|
+
var _a2;
|
|
328
|
+
return (_a2 = props.onAction) == null ? void 0 : _a2.call(props, "refine_filters");
|
|
300
329
|
};
|
|
301
330
|
runHydrationEvents();
|
|
302
331
|
return _el$17;
|
|
@@ -329,8 +358,8 @@ const ScratchpadPanel = (props) => {
|
|
|
329
358
|
get children() {
|
|
330
359
|
var _el$33 = getNextElement(_tmpl$8);
|
|
331
360
|
_el$33.$$click = () => {
|
|
332
|
-
var
|
|
333
|
-
return (
|
|
361
|
+
var _a2;
|
|
362
|
+
return (_a2 = props.onRetry) == null ? void 0 : _a2.call(props);
|
|
334
363
|
};
|
|
335
364
|
runHydrationEvents();
|
|
336
365
|
return _el$33;
|
|
@@ -343,8 +372,8 @@ const ScratchpadPanel = (props) => {
|
|
|
343
372
|
get children() {
|
|
344
373
|
var _el$34 = getNextElement(_tmpl$9);
|
|
345
374
|
_el$34.$$click = () => {
|
|
346
|
-
var
|
|
347
|
-
return (
|
|
375
|
+
var _a2;
|
|
376
|
+
return (_a2 = props.onClose) == null ? void 0 : _a2.call(props);
|
|
348
377
|
};
|
|
349
378
|
runHydrationEvents();
|
|
350
379
|
return _el$34;
|
|
@@ -379,8 +408,8 @@ const ScratchpadPanel = (props) => {
|
|
|
379
408
|
insert(_el$52, () => props.state.id, _el$58, _co$10);
|
|
380
409
|
insert(_el$52, eventCount, _el$60, _co$11);
|
|
381
410
|
insert(_el$52, () => {
|
|
382
|
-
var
|
|
383
|
-
return ((
|
|
411
|
+
var _a2;
|
|
412
|
+
return ((_a2 = props.state.sections) == null ? void 0 : _a2.length) || 0;
|
|
384
413
|
}, _el$62, _co$12);
|
|
385
414
|
insert(_el$52, () => props.state.status, _el$64, _co$13);
|
|
386
415
|
insert(_el$52, lastEvent, _el$66, _co$14);
|
|
@@ -388,7 +417,7 @@ const ScratchpadPanel = (props) => {
|
|
|
388
417
|
}
|
|
389
418
|
}), _el$70, _co$16);
|
|
390
419
|
effect((_p$) => {
|
|
391
|
-
var _v$ = `w-full bg-white dark:bg-gray-800 rounded-xl border shadow-lg overflow-visible ${props.state.status === "waiting_human" ? "border-blue-300 dark:border-blue-600" : "border-gray-200 dark:border-gray-700"}`, _v$2 = `flex items-center justify-between px-4 py-3 border-b border-gray-100 dark:border-gray-700 ${isCollapsible() ? "cursor-pointer select-none hover:bg-gray-50 dark:hover:bg-gray-750" : ""}`, _v$3 = `px-2 py-0.5 text-xs font-medium rounded-full ${badge().class}`;
|
|
420
|
+
var _v$ = `w-full bg-white dark:bg-gray-800 rounded-xl border shadow-lg overflow-visible ${props.state.status === "waiting_human" ? "border-blue-300 dark:border-blue-600" : "border-gray-200 dark:border-gray-700"} ${props.pinned ? "sticky top-0 z-40" : ""}`, _v$2 = `flex items-center justify-between px-4 py-3 border-b border-gray-100 dark:border-gray-700 ${isCollapsible() ? "cursor-pointer select-none hover:bg-gray-50 dark:hover:bg-gray-750" : ""}`, _v$3 = `px-2 py-0.5 text-xs font-medium rounded-full ${badge().class}`;
|
|
392
421
|
_v$ !== _p$.e && className(_el$, _p$.e = _v$);
|
|
393
422
|
_v$2 !== _p$.t && className(_el$2, _p$.t = _v$2);
|
|
394
423
|
_v$3 !== _p$.a && className(_el$0, _p$.a = _v$3);
|
|
@@ -844,6 +873,7 @@ const EmbeddedFormSection = (props) => {
|
|
|
844
873
|
const field = config().fields.find((f) => f.name === key);
|
|
845
874
|
return (field == null ? void 0 : field.fieldStatus) !== "unsupported";
|
|
846
875
|
}).filter(([, v]) => v !== void 0 && v !== "" && !(Array.isArray(v) && v.length === 0)));
|
|
876
|
+
console.info(`%c[MCP-UI] Form submitted%c section=${props.sectionId} fields=${Object.keys(values).join(",")}`, "color: #8b5cf6; font-weight: bold", "color: inherit");
|
|
847
877
|
if (props.onSubmit) {
|
|
848
878
|
props.onSubmit(props.sectionId, values);
|
|
849
879
|
} else {
|
|
@@ -928,7 +958,7 @@ const EnrichedStepsSection = (props) => {
|
|
|
928
958
|
}
|
|
929
959
|
}), _el$177, _co$39);
|
|
930
960
|
effect((_p$) => {
|
|
931
|
-
var _v$4 = `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"}`, _v$5 = `flex items-center gap-2 text-sm font-medium ${step.status === "done" ? "text-green-600 dark:text-green-400" : step.status === "active" ? "text-blue-600 dark:text-blue-400" : "text-gray-400"}`;
|
|
961
|
+
var _v$4 = `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"}`, _v$5 = `flex items-center gap-2 text-sm font-medium ${step.status === "done" ? "text-green-600 dark:text-green-400" : step.status === "active" ? "text-blue-600 dark:text-blue-400" : "text-gray-400"}`;
|
|
932
962
|
_v$4 !== _p$.e && className(_el$164, _p$.e = _v$4);
|
|
933
963
|
_v$5 !== _p$.t && className(_el$165, _p$.t = _v$5);
|
|
934
964
|
return _p$;
|
|
@@ -1293,7 +1323,7 @@ const StepperProgressSection = (props) => {
|
|
|
1293
1323
|
return _el$258;
|
|
1294
1324
|
}
|
|
1295
1325
|
}), _el$260, _co$56);
|
|
1296
|
-
effect(() => className(_el$255, `flex items-center gap-1 px-2 py-1 rounded text-xs ${step.status === "done" ? "bg-green-50 dark:bg-green-900/20 text-green-700 dark:text-green-400" : step.status === "active" ? "bg-blue-50 dark:bg-blue-900/20 text-blue-700 dark:text-blue-400 font-medium" : step.status === "error" ? "bg-red-50 dark:bg-red-900/20 text-red-700 dark:text-red-400" : "text-gray-400"}`));
|
|
1326
|
+
effect(() => className(_el$255, `flex items-center gap-1 px-2 py-1 rounded text-xs ${step.status === "done" ? "bg-green-50 dark:bg-green-900/20 text-green-700 dark:text-green-400" : step.status === "active" ? "bg-blue-50 dark:bg-blue-900/20 text-blue-700 dark:text-blue-400 font-medium animate-pulse" : step.status === "error" ? "bg-red-50 dark:bg-red-900/20 text-red-700 dark:text-red-400" : "text-gray-400"}`));
|
|
1297
1327
|
return _el$255;
|
|
1298
1328
|
})()]
|
|
1299
1329
|
}));
|
|
@@ -1305,7 +1335,7 @@ const ErrorSectionRenderer = (props) => {
|
|
|
1305
1335
|
const [showDetails, setShowDetails] = createSignal(false);
|
|
1306
1336
|
const data = () => {
|
|
1307
1337
|
const c = props.content;
|
|
1308
|
-
|
|
1338
|
+
const d = {
|
|
1309
1339
|
message: (c == null ? void 0 : c.message) || "Error",
|
|
1310
1340
|
severity: (c == null ? void 0 : c.severity) || "error",
|
|
1311
1341
|
retryAction: c == null ? void 0 : c.retryAction,
|
|
@@ -1313,6 +1343,8 @@ const ErrorSectionRenderer = (props) => {
|
|
|
1313
1343
|
details: c == null ? void 0 : c.details,
|
|
1314
1344
|
timestamp: c == null ? void 0 : c.timestamp
|
|
1315
1345
|
};
|
|
1346
|
+
console.info(`%c[MCP-UI] Error section rendered%c severity=${d.severity} retry=${!!d.retryAction}`, "color: #ef4444; font-weight: bold", "color: inherit");
|
|
1347
|
+
return d;
|
|
1316
1348
|
};
|
|
1317
1349
|
const isWarning = () => data().severity === "warning";
|
|
1318
1350
|
return (() => {
|