@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
|
@@ -12,8 +12,8 @@ const STATUS_BADGES = {
|
|
|
12
12
|
class: "bg-yellow-100 text-yellow-700 dark:bg-yellow-900/30 dark:text-yellow-400"
|
|
13
13
|
},
|
|
14
14
|
ready: {
|
|
15
|
-
label: "
|
|
16
|
-
class: "bg-
|
|
15
|
+
label: "Action available",
|
|
16
|
+
class: "bg-cyan-100 text-cyan-700 dark:bg-cyan-900/30 dark:text-cyan-400"
|
|
17
17
|
},
|
|
18
18
|
waiting_human: {
|
|
19
19
|
label: "Your turn",
|
|
@@ -33,6 +33,7 @@ const STATUS_BADGES = {
|
|
|
33
33
|
}
|
|
34
34
|
};
|
|
35
35
|
const ScratchpadPanel = (props) => {
|
|
36
|
+
var _a;
|
|
36
37
|
const [collapsed, setCollapsed] = solidJs.createSignal(false);
|
|
37
38
|
const [localPreview, setLocalPreview] = solidJs.createSignal(void 0);
|
|
38
39
|
const [loadingAction, setLoadingAction] = solidJs.createSignal(null);
|
|
@@ -50,9 +51,37 @@ const ScratchpadPanel = (props) => {
|
|
|
50
51
|
setLastEvent(event);
|
|
51
52
|
console.log(`[ScratchpadPanel:${props.state.id}] ${event}`, data || "");
|
|
52
53
|
};
|
|
54
|
+
const VALID_TRANSITIONS = {
|
|
55
|
+
loading: ["processing", "waiting_human", "error"],
|
|
56
|
+
waiting_human: ["processing", "ready", "complete", "error"],
|
|
57
|
+
processing: ["ready", "complete", "error", "waiting_human"],
|
|
58
|
+
ready: ["processing", "complete", "error", "waiting_human"],
|
|
59
|
+
complete: [],
|
|
60
|
+
error: ["processing", "ready", "waiting_human"]
|
|
61
|
+
};
|
|
62
|
+
let prevStatus = props.state.status;
|
|
63
|
+
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");
|
|
64
|
+
solidJs.createEffect(() => {
|
|
65
|
+
var _a2, _b;
|
|
66
|
+
const newStatus = props.state.status;
|
|
67
|
+
if (newStatus !== prevStatus) {
|
|
68
|
+
console.info(`%c[MCP-UI] Scratchpad status%c ${props.state.id}: ${prevStatus} → ${newStatus}`, "color: #3b82f6; font-weight: bold", "color: inherit");
|
|
69
|
+
if (!((_a2 = VALID_TRANSITIONS[prevStatus]) == null ? void 0 : _a2.includes(newStatus))) {
|
|
70
|
+
console.warn(`[MCP-UI] Scratchpad ${props.state.id}: unusual transition ${prevStatus} → ${newStatus}. Expected: ${((_b = VALID_TRANSITIONS[prevStatus]) == null ? void 0 : _b.join(", ")) || "none (terminal)"}`);
|
|
71
|
+
}
|
|
72
|
+
prevStatus = newStatus;
|
|
73
|
+
}
|
|
74
|
+
if (props.autoCloseDelay && newStatus !== "complete") {
|
|
75
|
+
console.info(`[MCP-UI] Scratchpad ${props.state.id}: autoCloseDelay=${props.autoCloseDelay}ms but status='${newStatus}' — auto-close will NOT trigger.`);
|
|
76
|
+
}
|
|
77
|
+
});
|
|
53
78
|
const CLOSE_ALIASES = /* @__PURE__ */ new Set(["done", "close", "dismiss", "validate", "cancel", "sufficient"]);
|
|
54
79
|
const handleAction = (action, data) => {
|
|
55
|
-
var
|
|
80
|
+
var _a2;
|
|
81
|
+
console.info(`%c[MCP-UI] Action dispatched%c value='${action}' asyncAction=${!!props.asyncAction}`, "color: #f59e0b; font-weight: bold", "color: inherit");
|
|
82
|
+
if (!props.asyncAction && /^(try_alt:|retry|fetch|load)/.test(action)) {
|
|
83
|
+
console.warn(`[MCP-UI] ScratchpadPanel: action '${action}' looks async but asyncAction prop is not set. The button will NOT show a loading state.`);
|
|
84
|
+
}
|
|
56
85
|
debugLog("onAction", {
|
|
57
86
|
action,
|
|
58
87
|
asyncAction: props.asyncAction,
|
|
@@ -61,16 +90,16 @@ const ScratchpadPanel = (props) => {
|
|
|
61
90
|
if (props.asyncAction && !CLOSE_ALIASES.has(action)) {
|
|
62
91
|
setLoadingAction(action);
|
|
63
92
|
}
|
|
64
|
-
(
|
|
93
|
+
(_a2 = props.onAction) == null ? void 0 : _a2.call(props, action, data);
|
|
65
94
|
if (CLOSE_ALIASES.has(action) && props.onClose) {
|
|
66
95
|
props.onClose();
|
|
67
96
|
}
|
|
68
97
|
};
|
|
69
98
|
solidJs.createEffect(() => {
|
|
70
|
-
var
|
|
99
|
+
var _a2;
|
|
71
100
|
debugLog("state", {
|
|
72
101
|
status: props.state.status,
|
|
73
|
-
sections: (
|
|
102
|
+
sections: (_a2 = props.state.sections) == null ? void 0 : _a2.length,
|
|
74
103
|
filters: Object.keys(props.state.filters || {}),
|
|
75
104
|
turn: props.state.turn
|
|
76
105
|
});
|
|
@@ -78,8 +107,8 @@ const ScratchpadPanel = (props) => {
|
|
|
78
107
|
solidJs.createEffect(() => {
|
|
79
108
|
if (props.state.status === "complete" && props.autoCloseDelay && !props.pinned) {
|
|
80
109
|
const timer = setTimeout(() => {
|
|
81
|
-
var
|
|
82
|
-
return (
|
|
110
|
+
var _a2;
|
|
111
|
+
return (_a2 = props.onClose) == null ? void 0 : _a2.call(props);
|
|
83
112
|
}, props.autoCloseDelay);
|
|
84
113
|
solidJs.onCleanup(() => clearTimeout(timer));
|
|
85
114
|
}
|
|
@@ -136,9 +165,9 @@ const ScratchpadPanel = (props) => {
|
|
|
136
165
|
get children() {
|
|
137
166
|
var _el$1 = web.getNextElement(_tmpl$2);
|
|
138
167
|
_el$1.$$click = (e) => {
|
|
139
|
-
var
|
|
168
|
+
var _a2;
|
|
140
169
|
e.stopPropagation();
|
|
141
|
-
(
|
|
170
|
+
(_a2 = props.onClose) == null ? void 0 : _a2.call(props);
|
|
142
171
|
};
|
|
143
172
|
web.runHydrationEvents();
|
|
144
173
|
return _el$1;
|
|
@@ -297,8 +326,8 @@ const ScratchpadPanel = (props) => {
|
|
|
297
326
|
get children() {
|
|
298
327
|
var _el$17 = web.getNextElement(_tmpl$5), _el$18 = _el$17.firstChild, _el$19 = _el$18.nextSibling, _el$20 = _el$19.nextSibling;
|
|
299
328
|
_el$20.$$click = () => {
|
|
300
|
-
var
|
|
301
|
-
return (
|
|
329
|
+
var _a2;
|
|
330
|
+
return (_a2 = props.onAction) == null ? void 0 : _a2.call(props, "refine_filters");
|
|
302
331
|
};
|
|
303
332
|
web.runHydrationEvents();
|
|
304
333
|
return _el$17;
|
|
@@ -331,8 +360,8 @@ const ScratchpadPanel = (props) => {
|
|
|
331
360
|
get children() {
|
|
332
361
|
var _el$33 = web.getNextElement(_tmpl$8);
|
|
333
362
|
_el$33.$$click = () => {
|
|
334
|
-
var
|
|
335
|
-
return (
|
|
363
|
+
var _a2;
|
|
364
|
+
return (_a2 = props.onRetry) == null ? void 0 : _a2.call(props);
|
|
336
365
|
};
|
|
337
366
|
web.runHydrationEvents();
|
|
338
367
|
return _el$33;
|
|
@@ -345,8 +374,8 @@ const ScratchpadPanel = (props) => {
|
|
|
345
374
|
get children() {
|
|
346
375
|
var _el$34 = web.getNextElement(_tmpl$9);
|
|
347
376
|
_el$34.$$click = () => {
|
|
348
|
-
var
|
|
349
|
-
return (
|
|
377
|
+
var _a2;
|
|
378
|
+
return (_a2 = props.onClose) == null ? void 0 : _a2.call(props);
|
|
350
379
|
};
|
|
351
380
|
web.runHydrationEvents();
|
|
352
381
|
return _el$34;
|
|
@@ -381,8 +410,8 @@ const ScratchpadPanel = (props) => {
|
|
|
381
410
|
web.insert(_el$52, () => props.state.id, _el$58, _co$10);
|
|
382
411
|
web.insert(_el$52, eventCount, _el$60, _co$11);
|
|
383
412
|
web.insert(_el$52, () => {
|
|
384
|
-
var
|
|
385
|
-
return ((
|
|
413
|
+
var _a2;
|
|
414
|
+
return ((_a2 = props.state.sections) == null ? void 0 : _a2.length) || 0;
|
|
386
415
|
}, _el$62, _co$12);
|
|
387
416
|
web.insert(_el$52, () => props.state.status, _el$64, _co$13);
|
|
388
417
|
web.insert(_el$52, lastEvent, _el$66, _co$14);
|
|
@@ -390,7 +419,7 @@ const ScratchpadPanel = (props) => {
|
|
|
390
419
|
}
|
|
391
420
|
}), _el$70, _co$16);
|
|
392
421
|
web.effect((_p$) => {
|
|
393
|
-
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}`;
|
|
422
|
+
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}`;
|
|
394
423
|
_v$ !== _p$.e && web.className(_el$, _p$.e = _v$);
|
|
395
424
|
_v$2 !== _p$.t && web.className(_el$2, _p$.t = _v$2);
|
|
396
425
|
_v$3 !== _p$.a && web.className(_el$0, _p$.a = _v$3);
|
|
@@ -846,6 +875,7 @@ const EmbeddedFormSection = (props) => {
|
|
|
846
875
|
const field = config().fields.find((f) => f.name === key);
|
|
847
876
|
return (field == null ? void 0 : field.fieldStatus) !== "unsupported";
|
|
848
877
|
}).filter(([, v]) => v !== void 0 && v !== "" && !(Array.isArray(v) && v.length === 0)));
|
|
878
|
+
console.info(`%c[MCP-UI] Form submitted%c section=${props.sectionId} fields=${Object.keys(values).join(",")}`, "color: #8b5cf6; font-weight: bold", "color: inherit");
|
|
849
879
|
if (props.onSubmit) {
|
|
850
880
|
props.onSubmit(props.sectionId, values);
|
|
851
881
|
} else {
|
|
@@ -930,7 +960,7 @@ const EnrichedStepsSection = (props) => {
|
|
|
930
960
|
}
|
|
931
961
|
}), _el$177, _co$39);
|
|
932
962
|
web.effect((_p$) => {
|
|
933
|
-
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"}`;
|
|
963
|
+
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"}`;
|
|
934
964
|
_v$4 !== _p$.e && web.className(_el$164, _p$.e = _v$4);
|
|
935
965
|
_v$5 !== _p$.t && web.className(_el$165, _p$.t = _v$5);
|
|
936
966
|
return _p$;
|
|
@@ -1295,7 +1325,7 @@ const StepperProgressSection = (props) => {
|
|
|
1295
1325
|
return _el$258;
|
|
1296
1326
|
}
|
|
1297
1327
|
}), _el$260, _co$56);
|
|
1298
|
-
web.effect(() => web.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"}`));
|
|
1328
|
+
web.effect(() => web.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"}`));
|
|
1299
1329
|
return _el$255;
|
|
1300
1330
|
})()]
|
|
1301
1331
|
}));
|
|
@@ -1307,7 +1337,7 @@ const ErrorSectionRenderer = (props) => {
|
|
|
1307
1337
|
const [showDetails, setShowDetails] = solidJs.createSignal(false);
|
|
1308
1338
|
const data = () => {
|
|
1309
1339
|
const c = props.content;
|
|
1310
|
-
|
|
1340
|
+
const d = {
|
|
1311
1341
|
message: (c == null ? void 0 : c.message) || "Error",
|
|
1312
1342
|
severity: (c == null ? void 0 : c.severity) || "error",
|
|
1313
1343
|
retryAction: c == null ? void 0 : c.retryAction,
|
|
@@ -1315,6 +1345,8 @@ const ErrorSectionRenderer = (props) => {
|
|
|
1315
1345
|
details: c == null ? void 0 : c.details,
|
|
1316
1346
|
timestamp: c == null ? void 0 : c.timestamp
|
|
1317
1347
|
};
|
|
1348
|
+
console.info(`%c[MCP-UI] Error section rendered%c severity=${d.severity} retry=${!!d.retryAction}`, "color: #ef4444; font-weight: bold", "color: inherit");
|
|
1349
|
+
return d;
|
|
1318
1350
|
};
|
|
1319
1351
|
const isWarning = () => data().severity === "warning";
|
|
1320
1352
|
return (() => {
|