@seed-ship/mcp-ui-solid 5.5.1 → 5.6.0
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/CHANGELOG.md +47 -0
- package/dist/components/FormRenderer.cjs +13 -2
- package/dist/components/FormRenderer.cjs.map +1 -1
- package/dist/components/FormRenderer.d.ts.map +1 -1
- package/dist/components/FormRenderer.js +13 -2
- package/dist/components/FormRenderer.js.map +1 -1
- package/dist/components/GenerativeUIErrorBoundary.cjs +11 -0
- package/dist/components/GenerativeUIErrorBoundary.cjs.map +1 -1
- package/dist/components/GenerativeUIErrorBoundary.d.ts.map +1 -1
- package/dist/components/GenerativeUIErrorBoundary.js +11 -0
- package/dist/components/GenerativeUIErrorBoundary.js.map +1 -1
- package/dist/components/StreamingUIRenderer.cjs +49 -3
- package/dist/components/StreamingUIRenderer.cjs.map +1 -1
- package/dist/components/StreamingUIRenderer.d.ts.map +1 -1
- package/dist/components/StreamingUIRenderer.js +51 -5
- package/dist/components/StreamingUIRenderer.js.map +1 -1
- package/dist/components/UIResourceRenderer.cjs +62 -3
- package/dist/components/UIResourceRenderer.cjs.map +1 -1
- package/dist/components/UIResourceRenderer.d.ts.map +1 -1
- package/dist/components/UIResourceRenderer.js +64 -5
- package/dist/components/UIResourceRenderer.js.map +1 -1
- package/dist/context/MCPUITelemetryContext.cjs +25 -0
- package/dist/context/MCPUITelemetryContext.cjs.map +1 -0
- package/dist/context/MCPUITelemetryContext.d.ts +36 -0
- package/dist/context/MCPUITelemetryContext.d.ts.map +1 -0
- package/dist/context/MCPUITelemetryContext.js +25 -0
- package/dist/context/MCPUITelemetryContext.js.map +1 -0
- package/dist/index.cjs +6 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -1
- package/dist/mcp-ui-spec/dist/schemas.cjs +16 -5
- package/dist/mcp-ui-spec/dist/schemas.cjs.map +1 -1
- package/dist/mcp-ui-spec/dist/schemas.js +16 -5
- package/dist/mcp-ui-spec/dist/schemas.js.map +1 -1
- package/dist/services/telemetry.cjs +56 -0
- package/dist/services/telemetry.cjs.map +1 -0
- package/dist/services/telemetry.d.ts +87 -0
- package/dist/services/telemetry.d.ts.map +1 -0
- package/dist/services/telemetry.js +56 -0
- package/dist/services/telemetry.js.map +1 -0
- package/dist/services/validation.cjs +25 -24
- package/dist/services/validation.cjs.map +1 -1
- package/dist/services/validation.d.ts.map +1 -1
- package/dist/services/validation.js +26 -25
- package/dist/services/validation.js.map +1 -1
- package/package.json +2 -2
- package/src/components/FormRenderer.tsx +14 -0
- package/src/components/GenerativeUIErrorBoundary.tsx +17 -1
- package/src/components/StreamingUIRenderer.tsx +55 -3
- package/src/components/UIResourceRenderer.tsx +79 -3
- package/src/context/MCPUITelemetryContext.test.tsx +119 -0
- package/src/context/MCPUITelemetryContext.tsx +71 -0
- package/src/index.ts +15 -0
- package/src/services/telemetry.test.ts +134 -0
- package/src/services/telemetry.ts +149 -0
- package/src/services/validation.ts +43 -41
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UIResourceRenderer.d.ts","sourceRoot":"","sources":["../../src/components/UIResourceRenderer.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,SAAS,
|
|
1
|
+
{"version":3,"file":"UIResourceRenderer.d.ts","sourceRoot":"","sources":["../../src/components/UIResourceRenderer.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,SAAS,EAAyE,MAAM,UAAU,CAAA;AAE3G,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,aAAa,EAA0B,MAAM,UAAU,CAAA;AAM5F;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,mBAAmB,GAAG,OAAO,GAAG,aAAa,GAAG,QAAQ,CAAA;AA8DpE;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC;;OAEG;IACH,OAAO,EAAE,WAAW,GAAG,QAAQ,CAAA;IAE/B;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAElB;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAA;IAExC;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IAEd;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,mBAAmB,CAAA;CAChC;AAiJD;;GAEG;AACH;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAYlE;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,GAAG,GAAG,MAAM,CA4ElD;AAsnCD;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,SAAS,CAAC,uBAAuB,CA6GjE,CAAA"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { delegateEvents, createComponent, getNextElement, template, getNextMarker, insert, effect, style, className, setProperty, setAttribute, runHydrationEvents, memo, isServer, use, addEventListener, classList, setStyleProperty } from "solid-js/web";
|
|
2
2
|
import purify from "../node_modules/.pnpm/dompurify@3.4.1/node_modules/dompurify/dist/purify.es.js";
|
|
3
|
-
import { createMemo, For, Show, onMount, createSignal, createEffect } from "solid-js";
|
|
3
|
+
import { createMemo, For, Show, onMount, onCleanup, createSignal, createEffect } from "solid-js";
|
|
4
4
|
import { validateComponent, getIframeSandbox, DEFAULT_RESOURCE_LIMITS } from "../services/validation.js";
|
|
5
5
|
import { GenerativeUIErrorBoundary } from "./GenerativeUIErrorBoundary.js";
|
|
6
|
-
import { markRenderStart, markRenderEnd } from "../utils/perf.js";
|
|
6
|
+
import { markRenderStart, markRenderEnd, PERF_PREFIX } from "../utils/perf.js";
|
|
7
|
+
import { useTelemetry } from "../context/MCPUITelemetryContext.js";
|
|
7
8
|
import { GridRenderer } from "./GridRenderer.js";
|
|
8
9
|
import { FooterRenderer } from "./FooterRenderer.js";
|
|
9
10
|
import { CarouselRenderer } from "./CarouselRenderer.js";
|
|
@@ -1053,9 +1054,44 @@ function LinkRenderer(props) {
|
|
|
1053
1054
|
})();
|
|
1054
1055
|
}
|
|
1055
1056
|
function ComponentRenderer(props) {
|
|
1056
|
-
var _a, _b, _c;
|
|
1057
|
+
var _a, _b, _c, _d, _e, _f;
|
|
1057
1058
|
markRenderStart(props.component.id);
|
|
1058
|
-
|
|
1059
|
+
const telemetry = useTelemetry();
|
|
1060
|
+
onMount(() => {
|
|
1061
|
+
markRenderEnd(props.component.id);
|
|
1062
|
+
if (telemetry) {
|
|
1063
|
+
const ts = Date.now();
|
|
1064
|
+
telemetry.dispatch({
|
|
1065
|
+
type: "component:mounted",
|
|
1066
|
+
id: props.component.id,
|
|
1067
|
+
componentType: props.component.type,
|
|
1068
|
+
ts
|
|
1069
|
+
});
|
|
1070
|
+
if (typeof performance !== "undefined" && typeof performance.getEntriesByName === "function") {
|
|
1071
|
+
const entries = performance.getEntriesByName(`${PERF_PREFIX}${props.component.id}:render`, "measure");
|
|
1072
|
+
const last = entries[entries.length - 1];
|
|
1073
|
+
if (last) {
|
|
1074
|
+
telemetry.dispatch({
|
|
1075
|
+
type: "component:rendered",
|
|
1076
|
+
id: props.component.id,
|
|
1077
|
+
componentType: props.component.type,
|
|
1078
|
+
durationMs: last.duration,
|
|
1079
|
+
ts
|
|
1080
|
+
});
|
|
1081
|
+
}
|
|
1082
|
+
}
|
|
1083
|
+
}
|
|
1084
|
+
});
|
|
1085
|
+
onCleanup(() => {
|
|
1086
|
+
if (telemetry) {
|
|
1087
|
+
telemetry.dispatch({
|
|
1088
|
+
type: "component:unmounted",
|
|
1089
|
+
id: props.component.id,
|
|
1090
|
+
componentType: props.component.type,
|
|
1091
|
+
ts: Date.now()
|
|
1092
|
+
});
|
|
1093
|
+
}
|
|
1094
|
+
});
|
|
1059
1095
|
const validation = validateComponent(props.component);
|
|
1060
1096
|
if (!validation.valid) {
|
|
1061
1097
|
(_a = props.onError) == null ? void 0 : _a.call(props, {
|
|
@@ -1064,8 +1100,18 @@ function ComponentRenderer(props) {
|
|
|
1064
1100
|
componentId: props.component.id,
|
|
1065
1101
|
details: validation.errors
|
|
1066
1102
|
});
|
|
1103
|
+
if (telemetry) {
|
|
1104
|
+
telemetry.dispatch({
|
|
1105
|
+
type: "validation:failed",
|
|
1106
|
+
id: props.component.id,
|
|
1107
|
+
componentType: props.component.type,
|
|
1108
|
+
errorCount: ((_b = validation.errors) == null ? void 0 : _b.length) ?? 0,
|
|
1109
|
+
firstErrorCode: ((_d = (_c = validation.errors) == null ? void 0 : _c[0]) == null ? void 0 : _d.code) ?? null,
|
|
1110
|
+
ts: Date.now()
|
|
1111
|
+
});
|
|
1112
|
+
}
|
|
1067
1113
|
const mode = props.errorMode ?? "block";
|
|
1068
|
-
const firstError = ((
|
|
1114
|
+
const firstError = ((_f = (_e = validation.errors) == null ? void 0 : _e[0]) == null ? void 0 : _f.message) || "Unknown validation error";
|
|
1069
1115
|
if (mode === "silent") {
|
|
1070
1116
|
return null;
|
|
1071
1117
|
}
|
|
@@ -1317,7 +1363,20 @@ function ActionRenderer(props) {
|
|
|
1317
1363
|
execute,
|
|
1318
1364
|
isExecuting
|
|
1319
1365
|
} = useAction();
|
|
1366
|
+
const telemetry = useTelemetry();
|
|
1367
|
+
function dispatchTelemetry() {
|
|
1368
|
+
if (!telemetry) return;
|
|
1369
|
+
const actionName = params.toolName ?? params.action ?? "unknown";
|
|
1370
|
+
telemetry.dispatch({
|
|
1371
|
+
type: "action:dispatched",
|
|
1372
|
+
id: props.component.id,
|
|
1373
|
+
componentType: "action",
|
|
1374
|
+
actionName,
|
|
1375
|
+
ts: Date.now()
|
|
1376
|
+
});
|
|
1377
|
+
}
|
|
1320
1378
|
const handleClick = async (e) => {
|
|
1379
|
+
dispatchTelemetry();
|
|
1321
1380
|
if (params.action === "tool-call" && params.toolName) {
|
|
1322
1381
|
e.preventDefault();
|
|
1323
1382
|
await execute(params.toolName, params.params || {});
|