@mcpjam/widget-react 0.1.2 → 0.1.4
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/index.js +17 -7
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -769,7 +769,9 @@ function useToolInputStreaming({
|
|
|
769
769
|
const outputKey = `${toolCallId}:${serialized}`;
|
|
770
770
|
if (lastToolOutputRef.current === outputKey) return;
|
|
771
771
|
lastToolOutputRef.current = outputKey;
|
|
772
|
-
bridge.sendToolResult(
|
|
772
|
+
bridge.sendToolResult(
|
|
773
|
+
toolOutput
|
|
774
|
+
);
|
|
773
775
|
}, [isReady, toolCallId, toolOutput, toolState, bridgeRef, reinitCount]);
|
|
774
776
|
useEffect(() => {
|
|
775
777
|
if (!isReady || toolState !== "output-error") return;
|
|
@@ -1158,7 +1160,9 @@ function McpAppsModal({
|
|
|
1158
1160
|
const resolvedToolInput = toolInputRef.current ?? {};
|
|
1159
1161
|
bridge.sendToolInput({ arguments: resolvedToolInput });
|
|
1160
1162
|
if (toolOutputRef.current) {
|
|
1161
|
-
bridge.sendToolResult(
|
|
1163
|
+
bridge.sendToolResult(
|
|
1164
|
+
toolOutputRef.current
|
|
1165
|
+
);
|
|
1162
1166
|
}
|
|
1163
1167
|
const appCaps = bridge.getAppCapabilities();
|
|
1164
1168
|
if (appCaps?.tools) {
|
|
@@ -3227,7 +3231,7 @@ function MCPAppsRendererSurface({
|
|
|
3227
3231
|
});
|
|
3228
3232
|
return { mode: granted };
|
|
3229
3233
|
}
|
|
3230
|
-
if (requestedMode !== "inline" && userPreferInlineRef.current) {
|
|
3234
|
+
if (requestedMode !== "inline" && policy === "user-initiated-only" && userPreferInlineRef.current) {
|
|
3231
3235
|
logWidgetDebug("ui-to-host", "ui/request-display-mode", {
|
|
3232
3236
|
requested: requestedMode,
|
|
3233
3237
|
granted: "inline",
|
|
@@ -3240,10 +3244,16 @@ function MCPAppsRendererSurface({
|
|
|
3240
3244
|
);
|
|
3241
3245
|
const isMobile = isPlaygroundActiveRef.current ? playgroundDeviceTypeRef.current === "mobile" || playgroundDeviceTypeRef.current === "tablet" : true;
|
|
3242
3246
|
const mobileAdjustedMode = isMobile && requestedMode === "pip" ? "fullscreen" : requestedMode;
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
+
if (!hostAvailableModes.includes(mobileAdjustedMode)) {
|
|
3248
|
+
const granted = effectiveDisplayModeRef.current;
|
|
3249
|
+
logWidgetDebug("ui-to-host", "ui/request-display-mode", {
|
|
3250
|
+
requested: requestedMode,
|
|
3251
|
+
granted,
|
|
3252
|
+
reason: "mode-unavailable"
|
|
3253
|
+
});
|
|
3254
|
+
return { mode: granted };
|
|
3255
|
+
}
|
|
3256
|
+
const actualMode = mobileAdjustedMode;
|
|
3247
3257
|
setDisplayModeRef.current(actualMode);
|
|
3248
3258
|
if (actualMode === "pip") {
|
|
3249
3259
|
onRequestPipRef.current?.(displayWidgetIdRef.current);
|