@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.
@@ -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 _a;
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
- (_a = props.onAction) == null ? void 0 : _a.call(props, action, data);
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 _a;
99
+ var _a2;
71
100
  debugLog("state", {
72
101
  status: props.state.status,
73
- sections: (_a = props.state.sections) == null ? void 0 : _a.length,
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 _a;
82
- return (_a = props.onClose) == null ? void 0 : _a.call(props);
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 _a;
168
+ var _a2;
140
169
  e.stopPropagation();
141
- (_a = props.onClose) == null ? void 0 : _a.call(props);
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 _a;
301
- return (_a = props.onAction) == null ? void 0 : _a.call(props, "refine_filters");
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 _a;
335
- return (_a = props.onRetry) == null ? void 0 : _a.call(props);
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 _a;
349
- return (_a = props.onClose) == null ? void 0 : _a.call(props);
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 _a;
385
- return ((_a = props.state.sections) == null ? void 0 : _a.length) || 0;
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);
@@ -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 {
@@ -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
- return {
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 (() => {