@seed-ship/mcp-ui-solid 3.0.1 → 3.0.3
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/dist/index.cjs +3 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/stores/scratchpad-store.cjs +90 -0
- package/dist/stores/scratchpad-store.cjs.map +1 -0
- package/dist/stores/scratchpad-store.d.ts +34 -0
- package/dist/stores/scratchpad-store.d.ts.map +1 -0
- package/dist/stores/scratchpad-store.js +90 -0
- package/dist/stores/scratchpad-store.js.map +1 -0
- package/package.json +1 -1
- package/src/components/ScratchpadPanel.tsx +46 -1
- package/src/index.ts +1 -0
- package/src/stores/scratchpad-store.ts +119 -0
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -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);
|
|
@@ -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 {
|
|
@@ -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 (() => {
|