@mcp-use/client 2.0.0-beta.3 → 2.0.0-beta.5
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/.tsbuildinfo +1 -1
- package/dist/index-browser.d.ts +1 -1
- package/dist/index-browser.d.ts.map +1 -1
- package/dist/index-browser.js +12 -141
- package/dist/index-browser.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +13 -160
- package/dist/index.js.map +1 -1
- package/dist/react/index.js +123 -167
- package/dist/react/index.js.map +1 -1
- package/dist/react/view/ViewRenderer.d.ts +1 -1
- package/dist/react/view/ViewRenderer.d.ts.map +1 -1
- package/dist/react/view/types.d.ts +14 -0
- package/dist/react/view/types.d.ts.map +1 -1
- package/dist/react/view/use-display-mode.d.ts +1 -0
- package/dist/react/view/use-display-mode.d.ts.map +1 -1
- package/dist/telemetry/index.d.ts +1 -1
- package/dist/telemetry/index.d.ts.map +1 -1
- package/dist/telemetry/tel-fetch.d.ts +0 -6
- package/dist/telemetry/tel-fetch.d.ts.map +1 -1
- package/dist/telemetry/telemetry-node.d.ts.map +1 -1
- package/dist/telemetry/telemetry.d.ts +0 -8
- package/dist/telemetry/telemetry.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/react/index.js
CHANGED
|
@@ -1473,7 +1473,7 @@ var HttpConnector = class extends BaseConnector {
|
|
|
1473
1473
|
};
|
|
1474
1474
|
|
|
1475
1475
|
// src/utils/version.ts
|
|
1476
|
-
var VERSION = "2.0.0-beta.
|
|
1476
|
+
var VERSION = "2.0.0-beta.4";
|
|
1477
1477
|
function getPackageVersion() {
|
|
1478
1478
|
return VERSION;
|
|
1479
1479
|
}
|
|
@@ -2370,62 +2370,6 @@ async function telFetch(url, init) {
|
|
|
2370
2370
|
}
|
|
2371
2371
|
var POSTHOG_HOST = "https://eu.i.posthog.com";
|
|
2372
2372
|
var POSTHOG_API_KEY = "phc_lyTtbYwvkdSbrcMQNPiKiiRWrrM1seyKIMjycSvItEI";
|
|
2373
|
-
var SCARF_GATEWAY_URL = "https://mcpuse.gateway.scarf.sh/events-ts";
|
|
2374
|
-
var SCARF_GATEWAY_BEACON_URL = "https://mcpuse.gateway.scarf.sh/simple/";
|
|
2375
|
-
var SCARF_BEACON_MAX_URL = 1800;
|
|
2376
|
-
var SCARF_BEACON_TRUNCATED_KEYS = /* @__PURE__ */ new Set(["query", "response", "messages"]);
|
|
2377
|
-
function stringifyScarfValue(value) {
|
|
2378
|
-
if (value === null || value === void 0) return "";
|
|
2379
|
-
if (typeof value === "string") return value;
|
|
2380
|
-
if (typeof value === "number" || typeof value === "boolean") {
|
|
2381
|
-
return String(value);
|
|
2382
|
-
}
|
|
2383
|
-
try {
|
|
2384
|
-
return JSON.stringify(value);
|
|
2385
|
-
} catch {
|
|
2386
|
-
return String(value);
|
|
2387
|
-
}
|
|
2388
|
-
}
|
|
2389
|
-
function buildScarfBeaconUrl(properties, baseUrl = SCARF_GATEWAY_BEACON_URL) {
|
|
2390
|
-
const params = new URLSearchParams();
|
|
2391
|
-
for (const [key, value] of Object.entries(properties)) {
|
|
2392
|
-
let serialized = stringifyScarfValue(value);
|
|
2393
|
-
if (SCARF_BEACON_TRUNCATED_KEYS.has(key) && serialized.length > 120) {
|
|
2394
|
-
serialized = `${serialized.slice(0, 117)}...`;
|
|
2395
|
-
}
|
|
2396
|
-
if (serialized !== "") params.set(key, serialized);
|
|
2397
|
-
}
|
|
2398
|
-
let url = `${baseUrl}${baseUrl.includes("?") ? "&" : "?"}${params.toString()}`;
|
|
2399
|
-
if (url.length <= SCARF_BEACON_MAX_URL) return url;
|
|
2400
|
-
const keys = [...params.keys()].sort(
|
|
2401
|
-
(a, b) => (params.get(b)?.length ?? 0) - (params.get(a)?.length ?? 0)
|
|
2402
|
-
);
|
|
2403
|
-
for (const key of keys) {
|
|
2404
|
-
if (url.length <= SCARF_BEACON_MAX_URL) break;
|
|
2405
|
-
if (key === "event" || key === "user_id") continue;
|
|
2406
|
-
params.delete(key);
|
|
2407
|
-
url = `${baseUrl}${baseUrl.includes("?") ? "&" : "?"}${params.toString()}`;
|
|
2408
|
-
}
|
|
2409
|
-
return url.slice(0, SCARF_BEACON_MAX_URL);
|
|
2410
|
-
}
|
|
2411
|
-
function captureScarfPost(properties, endpoint) {
|
|
2412
|
-
return telFetch(endpoint, {
|
|
2413
|
-
method: "POST",
|
|
2414
|
-
headers: { "Content-Type": "application/json" },
|
|
2415
|
-
keepalive: true,
|
|
2416
|
-
body: JSON.stringify(properties)
|
|
2417
|
-
});
|
|
2418
|
-
}
|
|
2419
|
-
function captureScarfBeacon(properties, endpoint) {
|
|
2420
|
-
try {
|
|
2421
|
-
const url = buildScarfBeaconUrl(properties, endpoint);
|
|
2422
|
-
const img = new Image();
|
|
2423
|
-
img.referrerPolicy = "no-referrer-when-downgrade";
|
|
2424
|
-
img.src = url;
|
|
2425
|
-
} catch {
|
|
2426
|
-
}
|
|
2427
|
-
return Promise.resolve();
|
|
2428
|
-
}
|
|
2429
2373
|
function capturePostHog(params) {
|
|
2430
2374
|
const host = params.host ?? POSTHOG_HOST;
|
|
2431
2375
|
const apiKey = params.apiKey ?? POSTHOG_API_KEY;
|
|
@@ -2442,13 +2386,6 @@ function capturePostHog(params) {
|
|
|
2442
2386
|
})
|
|
2443
2387
|
});
|
|
2444
2388
|
}
|
|
2445
|
-
function captureScarf(properties, endpoint = SCARF_GATEWAY_URL) {
|
|
2446
|
-
if (typeof window !== "undefined") {
|
|
2447
|
-
const beaconEndpoint = endpoint === SCARF_GATEWAY_URL ? SCARF_GATEWAY_BEACON_URL : endpoint;
|
|
2448
|
-
return captureScarfBeacon(properties, beaconEndpoint);
|
|
2449
|
-
}
|
|
2450
|
-
return captureScarfPost(properties, endpoint);
|
|
2451
|
-
}
|
|
2452
2389
|
|
|
2453
2390
|
// src/telemetry/telemetry.ts
|
|
2454
2391
|
function generateUUID() {
|
|
@@ -2459,18 +2396,6 @@ function secureRandomString() {
|
|
|
2459
2396
|
globalThis.crypto.getRandomValues(array);
|
|
2460
2397
|
return Array.from(array, (v) => v.toString(16).padStart(2, "0")).join("");
|
|
2461
2398
|
}
|
|
2462
|
-
function isVersionGreater(a, b) {
|
|
2463
|
-
const parse = (v) => v.split("-")[0].split(".").map((n) => parseInt(n, 10) || 0);
|
|
2464
|
-
const pa = parse(a);
|
|
2465
|
-
const pb = parse(b);
|
|
2466
|
-
const len = Math.max(pa.length, pb.length);
|
|
2467
|
-
for (let i = 0; i < len; i++) {
|
|
2468
|
-
const da = pa[i] ?? 0;
|
|
2469
|
-
const db = pb[i] ?? 0;
|
|
2470
|
-
if (da !== db) return da > db;
|
|
2471
|
-
}
|
|
2472
|
-
return false;
|
|
2473
|
-
}
|
|
2474
2399
|
var USER_ID_STORAGE_KEY = "mcp_use_user_id";
|
|
2475
2400
|
var PROJECT_API_KEY = "phc_lyTtbYwvkdSbrcMQNPiKiiRWrrM1seyKIMjycSvItEI";
|
|
2476
2401
|
var HOST = "https://eu.i.posthog.com";
|
|
@@ -2499,10 +2424,7 @@ function createLocalStorageBackend() {
|
|
|
2499
2424
|
localStorage.setItem(USER_ID_STORAGE_KEY, id);
|
|
2500
2425
|
} catch {
|
|
2501
2426
|
}
|
|
2502
|
-
}
|
|
2503
|
-
// Package-download dedup is node/Scarf-oriented; localStorage unused.
|
|
2504
|
-
getDownloadedVersion: () => null,
|
|
2505
|
-
setDownloadedVersion: () => void 0
|
|
2427
|
+
}
|
|
2506
2428
|
};
|
|
2507
2429
|
}
|
|
2508
2430
|
function detectRuntimeEnvironment() {
|
|
@@ -2570,17 +2492,13 @@ var Telemetry = class _Telemetry {
|
|
|
2570
2492
|
_currUserId = null;
|
|
2571
2493
|
_telemetryEnabled = false;
|
|
2572
2494
|
_pending = /* @__PURE__ */ new Set();
|
|
2573
|
-
_scarfEnabled = false;
|
|
2574
2495
|
_runtimeEnvironment;
|
|
2575
2496
|
_storageCapability;
|
|
2576
2497
|
_storage;
|
|
2577
|
-
/** True when node entry installed fs storage (package-download dedup). */
|
|
2578
|
-
_fsBacked;
|
|
2579
2498
|
_source;
|
|
2580
2499
|
_productVersion;
|
|
2581
2500
|
constructor() {
|
|
2582
2501
|
this._runtimeEnvironment = detectRuntimeEnvironment();
|
|
2583
|
-
this._fsBacked = configuredStorage !== null;
|
|
2584
2502
|
this._storage = configuredStorage ?? createLocalStorageBackend() ?? null;
|
|
2585
2503
|
this._storageCapability = this._storage ? "persistent" : "session-only";
|
|
2586
2504
|
this._source = readSourceHint() || this._runtimeEnvironment;
|
|
@@ -2599,14 +2517,6 @@ var Telemetry = class _Telemetry {
|
|
|
2599
2517
|
"Anonymized telemetry enabled. Set MCP_USE_ANONYMIZED_TELEMETRY=false to disable."
|
|
2600
2518
|
);
|
|
2601
2519
|
this._telemetryEnabled = true;
|
|
2602
|
-
this._scarfEnabled = true;
|
|
2603
|
-
if (this._fsBacked) {
|
|
2604
|
-
setTimeout(() => {
|
|
2605
|
-
this.trackPackageDownload({ triggered_by: "initialization" }).catch(
|
|
2606
|
-
(e) => logger.debug(`Failed to track package download: ${e}`)
|
|
2607
|
-
);
|
|
2608
|
-
}, 0);
|
|
2609
|
-
}
|
|
2610
2520
|
}
|
|
2611
2521
|
}
|
|
2612
2522
|
get runtimeEnvironment() {
|
|
@@ -2638,7 +2548,7 @@ var Telemetry = class _Telemetry {
|
|
|
2638
2548
|
this._productVersion = version;
|
|
2639
2549
|
}
|
|
2640
2550
|
get isEnabled() {
|
|
2641
|
-
return this._telemetryEnabled
|
|
2551
|
+
return this._telemetryEnabled;
|
|
2642
2552
|
}
|
|
2643
2553
|
get userId() {
|
|
2644
2554
|
if (this._currUserId) return this._currUserId;
|
|
@@ -2661,7 +2571,7 @@ var Telemetry = class _Telemetry {
|
|
|
2661
2571
|
return this._currUserId;
|
|
2662
2572
|
}
|
|
2663
2573
|
async capture(event) {
|
|
2664
|
-
if (!this._telemetryEnabled
|
|
2574
|
+
if (!this._telemetryEnabled) return;
|
|
2665
2575
|
const currentUserId = this.userId;
|
|
2666
2576
|
const properties = {
|
|
2667
2577
|
...event.properties,
|
|
@@ -2670,52 +2580,15 @@ var Telemetry = class _Telemetry {
|
|
|
2670
2580
|
source: this._source,
|
|
2671
2581
|
runtime: this._runtimeEnvironment
|
|
2672
2582
|
};
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
properties
|
|
2680
|
-
});
|
|
2681
|
-
this._pending.add(p);
|
|
2682
|
-
void p.finally(() => this._pending.delete(p));
|
|
2683
|
-
}
|
|
2684
|
-
if (this._scarfEnabled) {
|
|
2685
|
-
const p = captureScarf({
|
|
2686
|
-
...properties,
|
|
2687
|
-
user_id: currentUserId,
|
|
2688
|
-
event: event.name
|
|
2689
|
-
});
|
|
2690
|
-
this._pending.add(p);
|
|
2691
|
-
void p.finally(() => this._pending.delete(p));
|
|
2692
|
-
}
|
|
2693
|
-
}
|
|
2694
|
-
async trackPackageDownload(properties) {
|
|
2695
|
-
if (!this._scarfEnabled || !this._fsBacked || !this._storage) return;
|
|
2696
|
-
const currentVersion = getPackageVersion();
|
|
2697
|
-
const saved = this._storage.getDownloadedVersion();
|
|
2698
|
-
let firstDownload = false;
|
|
2699
|
-
let shouldTrack = false;
|
|
2700
|
-
if (!saved) {
|
|
2701
|
-
shouldTrack = true;
|
|
2702
|
-
firstDownload = true;
|
|
2703
|
-
this._storage.setDownloadedVersion(currentVersion);
|
|
2704
|
-
} else if (isVersionGreater(currentVersion, saved)) {
|
|
2705
|
-
shouldTrack = true;
|
|
2706
|
-
this._storage.setDownloadedVersion(currentVersion);
|
|
2707
|
-
}
|
|
2708
|
-
if (!shouldTrack) return;
|
|
2709
|
-
await captureScarf({
|
|
2710
|
-
...properties || {},
|
|
2711
|
-
mcp_use_version: currentVersion,
|
|
2712
|
-
user_id: this.userId,
|
|
2713
|
-
event: "package_download",
|
|
2714
|
-
first_download: firstDownload,
|
|
2715
|
-
language: "typescript",
|
|
2716
|
-
source: this._source,
|
|
2717
|
-
runtime: this._runtimeEnvironment
|
|
2583
|
+
const p = capturePostHog({
|
|
2584
|
+
host: HOST,
|
|
2585
|
+
apiKey: PROJECT_API_KEY,
|
|
2586
|
+
event: event.name,
|
|
2587
|
+
distinctId: currentUserId,
|
|
2588
|
+
properties
|
|
2718
2589
|
});
|
|
2590
|
+
this._pending.add(p);
|
|
2591
|
+
void p.finally(() => this._pending.delete(p));
|
|
2719
2592
|
}
|
|
2720
2593
|
async trackAgentExecution(data) {
|
|
2721
2594
|
if (!this.isEnabled) return;
|
|
@@ -6881,6 +6754,7 @@ import React2, {
|
|
|
6881
6754
|
memo,
|
|
6882
6755
|
useCallback as useCallback6,
|
|
6883
6756
|
useEffect as useEffect5,
|
|
6757
|
+
useMemo as useMemo3,
|
|
6884
6758
|
useRef as useRef4,
|
|
6885
6759
|
useState as useState4
|
|
6886
6760
|
} from "react";
|
|
@@ -7299,9 +7173,9 @@ function buildSandboxProxyBlobHtml(search) {
|
|
|
7299
7173
|
// src/react/view/use-display-mode.ts
|
|
7300
7174
|
import { useCallback as useCallback5, useEffect as useEffect4 } from "react";
|
|
7301
7175
|
var SHELL_BASE = "w-full h-full min-h-0 bg-background flex flex-col [&:fullscreen]:h-full [&:fullscreen]:w-full [&:fullscreen]:bg-background";
|
|
7302
|
-
var WIDGET_FULLSCREEN_OVERLAY_CLASSES = `fixed inset-0 z-[
|
|
7176
|
+
var WIDGET_FULLSCREEN_OVERLAY_CLASSES = `fixed inset-0 z-[200] ${SHELL_BASE}`;
|
|
7303
7177
|
var WIDGET_PIP_SHELL_CLASSES = [
|
|
7304
|
-
"fixed top-4 left-1/2 -translate-x-1/2 z-[
|
|
7178
|
+
"fixed top-4 left-1/2 -translate-x-1/2 z-[200]",
|
|
7305
7179
|
"rounded-3xl w-full min-w-[300px] h-[400px]",
|
|
7306
7180
|
"shadow-2xl border overflow-hidden",
|
|
7307
7181
|
"bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/80",
|
|
@@ -7359,7 +7233,8 @@ function useViewDisplayModeControls({
|
|
|
7359
7233
|
}
|
|
7360
7234
|
var VIEW_DIMENSIONS = {
|
|
7361
7235
|
PIP_MAX_WIDTH: 700,
|
|
7362
|
-
DEFAULT_HEIGHT: 400
|
|
7236
|
+
DEFAULT_HEIGHT: 400,
|
|
7237
|
+
FULLSCREEN_HEADER_HEIGHT: 50
|
|
7363
7238
|
};
|
|
7364
7239
|
|
|
7365
7240
|
// src/react/view/view-detection.ts
|
|
@@ -7390,6 +7265,24 @@ var DEFAULT_HOST_CAPABILITIES = {
|
|
|
7390
7265
|
// ponytail: always advertised; bridge.onmessage no-ops when onMessage unset
|
|
7391
7266
|
message: { text: {} }
|
|
7392
7267
|
};
|
|
7268
|
+
function CloseIcon() {
|
|
7269
|
+
return /* @__PURE__ */ React2.createElement(
|
|
7270
|
+
"svg",
|
|
7271
|
+
{
|
|
7272
|
+
width: "14",
|
|
7273
|
+
height: "14",
|
|
7274
|
+
viewBox: "0 0 24 24",
|
|
7275
|
+
fill: "none",
|
|
7276
|
+
stroke: "currentColor",
|
|
7277
|
+
strokeWidth: "2",
|
|
7278
|
+
strokeLinecap: "round",
|
|
7279
|
+
strokeLinejoin: "round",
|
|
7280
|
+
"aria-hidden": true
|
|
7281
|
+
},
|
|
7282
|
+
/* @__PURE__ */ React2.createElement("path", { d: "M18 6 6 18" }),
|
|
7283
|
+
/* @__PURE__ */ React2.createElement("path", { d: "m6 6 12 12" })
|
|
7284
|
+
);
|
|
7285
|
+
}
|
|
7393
7286
|
function waitForSandboxProxyReady(iframe) {
|
|
7394
7287
|
return new Promise((resolve) => {
|
|
7395
7288
|
const listener = (event) => {
|
|
@@ -7451,6 +7344,9 @@ function ViewRendererBase({
|
|
|
7451
7344
|
wrapTransport,
|
|
7452
7345
|
toolCallTimeout = DEFAULT_TOOL_CALL_TIMEOUT,
|
|
7453
7346
|
mockOpenAiFileApis = false,
|
|
7347
|
+
onInlineHeightChange,
|
|
7348
|
+
fullscreenHeader,
|
|
7349
|
+
renderFullscreenClose,
|
|
7454
7350
|
className,
|
|
7455
7351
|
testId = "mcp-app-frame",
|
|
7456
7352
|
invoking,
|
|
@@ -7472,12 +7368,19 @@ function ViewRendererBase({
|
|
|
7472
7368
|
);
|
|
7473
7369
|
const [internalDisplayMode, setInternalDisplayMode] = useState4("inline");
|
|
7474
7370
|
const displayMode = displayModeProp ?? internalDisplayMode;
|
|
7475
|
-
const
|
|
7476
|
-
|
|
7371
|
+
const effectiveHostContext = useMemo3(() => {
|
|
7372
|
+
if (!hostContext) return hostContext;
|
|
7373
|
+
if (hostContext.displayMode === displayMode) return hostContext;
|
|
7374
|
+
return { ...hostContext, displayMode };
|
|
7375
|
+
}, [hostContext, displayMode]);
|
|
7376
|
+
const hostContextRef = useRef4(effectiveHostContext);
|
|
7377
|
+
hostContextRef.current = effectiveHostContext;
|
|
7477
7378
|
const onMessageRef = useRef4(onMessage);
|
|
7478
7379
|
onMessageRef.current = onMessage;
|
|
7479
7380
|
const toolInputRef = useRef4(toolInput);
|
|
7480
7381
|
toolInputRef.current = toolInput;
|
|
7382
|
+
const partialToolInputRef = useRef4(partialToolInput);
|
|
7383
|
+
partialToolInputRef.current = partialToolInput;
|
|
7481
7384
|
const toolOutputRef = useRef4(toolOutput);
|
|
7482
7385
|
toolOutputRef.current = toolOutput;
|
|
7483
7386
|
const customPropsRef = useRef4(customProps);
|
|
@@ -7496,6 +7399,8 @@ function ViewRendererBase({
|
|
|
7496
7399
|
onReadyRef.current = onReady;
|
|
7497
7400
|
const onLifecycleChangeRef = useRef4(onLifecycleChange);
|
|
7498
7401
|
onLifecycleChangeRef.current = onLifecycleChange;
|
|
7402
|
+
const onInlineHeightChangeRef = useRef4(onInlineHeightChange);
|
|
7403
|
+
onInlineHeightChangeRef.current = onInlineHeightChange;
|
|
7499
7404
|
const sandboxUrlRef = useRef4(sandboxUrl);
|
|
7500
7405
|
sandboxUrlRef.current = sandboxUrl;
|
|
7501
7406
|
const cspModeRef = useRef4(cspMode);
|
|
@@ -7755,7 +7660,10 @@ function ViewRendererBase({
|
|
|
7755
7660
|
height
|
|
7756
7661
|
}) => {
|
|
7757
7662
|
if (displayModeRef.current !== "inline") return;
|
|
7758
|
-
if (height !== void 0)
|
|
7663
|
+
if (height !== void 0) {
|
|
7664
|
+
setInlineHeight(height);
|
|
7665
|
+
onInlineHeightChangeRef.current?.(height);
|
|
7666
|
+
}
|
|
7759
7667
|
};
|
|
7760
7668
|
const initPromise = hookInitialized(bridge);
|
|
7761
7669
|
let transport = new PostMessageTransport(
|
|
@@ -7777,11 +7685,18 @@ function ViewRendererBase({
|
|
|
7777
7685
|
bridgeRef.current = bridge;
|
|
7778
7686
|
setInitCount((c) => c + 1);
|
|
7779
7687
|
onLifecycleChangeRef.current?.({ status: "initialized" });
|
|
7780
|
-
const
|
|
7781
|
-
|
|
7782
|
-
|
|
7783
|
-
|
|
7784
|
-
|
|
7688
|
+
const currentPartialToolInput = partialToolInputRef.current;
|
|
7689
|
+
if (currentPartialToolInput) {
|
|
7690
|
+
bridge.sendToolInputPartial({
|
|
7691
|
+
arguments: currentPartialToolInput
|
|
7692
|
+
});
|
|
7693
|
+
} else {
|
|
7694
|
+
const mergedArgs = {
|
|
7695
|
+
...toolInputRef.current,
|
|
7696
|
+
...parseCustomProps(customPropsRef.current)
|
|
7697
|
+
};
|
|
7698
|
+
bridge.sendToolInput({ arguments: mergedArgs });
|
|
7699
|
+
}
|
|
7785
7700
|
const toolResultPayload = buildToolResultPayload(
|
|
7786
7701
|
toolOutputRef.current,
|
|
7787
7702
|
customPropsRef.current
|
|
@@ -7835,9 +7750,9 @@ function ViewRendererBase({
|
|
|
7835
7750
|
]);
|
|
7836
7751
|
useEffect5(() => {
|
|
7837
7752
|
const bridge = bridgeRef.current;
|
|
7838
|
-
if (!bridge || initCount === 0 || !
|
|
7839
|
-
bridge.setHostContext(
|
|
7840
|
-
}, [
|
|
7753
|
+
if (!bridge || initCount === 0 || !effectiveHostContext) return;
|
|
7754
|
+
bridge.setHostContext(effectiveHostContext);
|
|
7755
|
+
}, [effectiveHostContext, initCount]);
|
|
7841
7756
|
useEffect5(() => {
|
|
7842
7757
|
const bridge = bridgeRef.current;
|
|
7843
7758
|
if (!bridge || initCount === 0 || !partialToolInput) return;
|
|
@@ -7845,13 +7760,13 @@ function ViewRendererBase({
|
|
|
7845
7760
|
}, [initCount, partialToolInput]);
|
|
7846
7761
|
useEffect5(() => {
|
|
7847
7762
|
const bridge = bridgeRef.current;
|
|
7848
|
-
if (!bridge || initCount === 0) return;
|
|
7763
|
+
if (!bridge || initCount === 0 || partialToolInput) return;
|
|
7849
7764
|
const mergedArgs = {
|
|
7850
7765
|
...toolInput,
|
|
7851
7766
|
...parseCustomProps(customProps)
|
|
7852
7767
|
};
|
|
7853
7768
|
bridge.sendToolInput({ arguments: mergedArgs });
|
|
7854
|
-
}, [initCount, toolInput, customProps]);
|
|
7769
|
+
}, [initCount, toolInput, partialToolInput, customProps]);
|
|
7855
7770
|
useEffect5(() => {
|
|
7856
7771
|
const bridge = bridgeRef.current;
|
|
7857
7772
|
if (!bridge || initCount === 0) return;
|
|
@@ -7875,6 +7790,7 @@ function ViewRendererBase({
|
|
|
7875
7790
|
const timer = setTimeout(() => setShowSpinner(false), 300);
|
|
7876
7791
|
return () => clearTimeout(timer);
|
|
7877
7792
|
}, [initCount, showSpinner]);
|
|
7793
|
+
const showHostBorder = resolved !== null && resolved.prefersBorder && displayMode !== "fullscreen";
|
|
7878
7794
|
if (loadError) {
|
|
7879
7795
|
return /* @__PURE__ */ React2.createElement("div", { className }, /* @__PURE__ */ React2.createElement("div", { className: "border border-red-200/50 dark:border-red-800/50 bg-red-50/30 dark:bg-red-950/20 rounded-lg p-4" }, /* @__PURE__ */ React2.createElement("p", { className: "text-sm text-red-600 dark:text-red-400" }, "Failed to load view: ", loadError)));
|
|
7880
7796
|
}
|
|
@@ -7892,29 +7808,69 @@ function ViewRendererBase({
|
|
|
7892
7808
|
"div",
|
|
7893
7809
|
{
|
|
7894
7810
|
ref: containerRef,
|
|
7895
|
-
className: containerClassName,
|
|
7811
|
+
className: isFullscreen ? `${containerClassName} flex flex-col` : containerClassName,
|
|
7896
7812
|
style: isPip ? {
|
|
7897
7813
|
height: VIEW_DIMENSIONS.DEFAULT_HEIGHT,
|
|
7898
7814
|
maxWidth: VIEW_DIMENSIONS.PIP_MAX_WIDTH,
|
|
7899
7815
|
zIndex: 100
|
|
7900
7816
|
} : isFullscreen ? { zIndex: 100 } : void 0
|
|
7901
7817
|
},
|
|
7902
|
-
|
|
7818
|
+
isFullscreen && // ponytail: inspector Tailwind may not emit client arbitrary classes
|
|
7819
|
+
// (h-[50px], grid-cols-[auto_1fr_auto]) — use inline layout instead.
|
|
7820
|
+
/* @__PURE__ */ React2.createElement(
|
|
7821
|
+
"header",
|
|
7822
|
+
{
|
|
7823
|
+
className: "grid shrink-0 items-center border-b border-zinc-200 bg-background px-3 dark:border-zinc-700",
|
|
7824
|
+
style: {
|
|
7825
|
+
height: VIEW_DIMENSIONS.FULLSCREEN_HEADER_HEIGHT,
|
|
7826
|
+
gridTemplateColumns: "auto 1fr auto"
|
|
7827
|
+
}
|
|
7828
|
+
},
|
|
7829
|
+
renderFullscreenClose ? renderFullscreenClose({
|
|
7830
|
+
onClick: () => void handleDisplayModeChange("inline"),
|
|
7831
|
+
"data-testid": "debugger-exit-fullscreen-button",
|
|
7832
|
+
"aria-label": "Exit fullscreen"
|
|
7833
|
+
}) : /* @__PURE__ */ React2.createElement(
|
|
7834
|
+
"button",
|
|
7835
|
+
{
|
|
7836
|
+
type: "button",
|
|
7837
|
+
"data-testid": "debugger-exit-fullscreen-button",
|
|
7838
|
+
"aria-label": "Exit fullscreen",
|
|
7839
|
+
className: "flex size-8 cursor-pointer items-center justify-center rounded-full border border-zinc-200 bg-background text-foreground shadow-sm hover:bg-muted dark:border-zinc-700",
|
|
7840
|
+
onClick: () => void handleDisplayModeChange("inline")
|
|
7841
|
+
},
|
|
7842
|
+
/* @__PURE__ */ React2.createElement(CloseIcon, null)
|
|
7843
|
+
),
|
|
7844
|
+
/* @__PURE__ */ React2.createElement("div", { className: "flex min-w-0 items-center justify-center gap-2 px-2" }, fullscreenHeader?.iconUrl ? /* @__PURE__ */ React2.createElement(
|
|
7845
|
+
"img",
|
|
7846
|
+
{
|
|
7847
|
+
src: fullscreenHeader.iconUrl,
|
|
7848
|
+
alt: "",
|
|
7849
|
+
className: "size-6 shrink-0 rounded-md object-contain"
|
|
7850
|
+
}
|
|
7851
|
+
) : null, /* @__PURE__ */ React2.createElement("span", { className: "truncate text-sm font-medium text-foreground" }, fullscreenHeader?.title ?? toolName)),
|
|
7852
|
+
/* @__PURE__ */ React2.createElement("div", { className: "size-8 shrink-0", "aria-hidden": true })
|
|
7853
|
+
),
|
|
7854
|
+
isPip && (renderFullscreenClose ? /* @__PURE__ */ React2.createElement("div", { className: "absolute right-3 top-3", style: { zIndex: 110 } }, renderFullscreenClose({
|
|
7855
|
+
onClick: () => void handleDisplayModeChange("inline"),
|
|
7856
|
+
"data-testid": "debugger-exit-pip-button",
|
|
7857
|
+
"aria-label": "Exit picture-in-picture"
|
|
7858
|
+
})) : /* @__PURE__ */ React2.createElement(
|
|
7903
7859
|
"button",
|
|
7904
7860
|
{
|
|
7905
7861
|
type: "button",
|
|
7906
|
-
"data-testid":
|
|
7907
|
-
"aria-label":
|
|
7908
|
-
className: "absolute right-3 top-3 z-[110] flex size-8 items-center justify-center rounded-full border border-border bg-background/90 text-
|
|
7862
|
+
"data-testid": "debugger-exit-pip-button",
|
|
7863
|
+
"aria-label": "Exit picture-in-picture",
|
|
7864
|
+
className: "absolute right-3 top-3 z-[110] flex size-8 cursor-pointer items-center justify-center rounded-full border border-border bg-background/90 text-foreground shadow-sm backdrop-blur-sm hover:bg-background",
|
|
7909
7865
|
style: { zIndex: 110 },
|
|
7910
7866
|
onClick: () => void handleDisplayModeChange("inline")
|
|
7911
7867
|
},
|
|
7912
|
-
|
|
7913
|
-
),
|
|
7868
|
+
/* @__PURE__ */ React2.createElement(CloseIcon, null)
|
|
7869
|
+
)),
|
|
7914
7870
|
/* @__PURE__ */ React2.createElement(
|
|
7915
7871
|
"div",
|
|
7916
7872
|
{
|
|
7917
|
-
className: isFullscreen
|
|
7873
|
+
className: isFullscreen ? "relative flex min-h-0 w-full flex-1 flex-col" : isPip ? "relative w-full h-full min-h-0 flex flex-1 flex-col" : "relative w-full flex flex-1 justify-center items-center"
|
|
7918
7874
|
},
|
|
7919
7875
|
showSpinner && /* @__PURE__ */ React2.createElement("div", { className: "flex absolute inset-0 items-center justify-center z-10" }, /* @__PURE__ */ React2.createElement("span", { className: "text-sm text-muted-foreground" }, "Loading\u2026")),
|
|
7920
7876
|
!isPip && !isFullscreen && (invoking || invoked) && /* @__PURE__ */ React2.createElement("div", { className: "absolute -top-8 left-2 z-10 whitespace-nowrap pointer-events-none text-xs text-muted-foreground" }, invoking && !toolOutput ? invoking : invoked),
|
|
@@ -7931,10 +7887,7 @@ function ViewRendererBase({
|
|
|
7931
7887
|
{
|
|
7932
7888
|
ref: iframeRef,
|
|
7933
7889
|
title: `MCP App: ${toolName}`,
|
|
7934
|
-
className: "w-full h-full border-
|
|
7935
|
-
style: {
|
|
7936
|
-
border: resolved.prefersBorder && displayMode !== "fullscreen" ? void 0 : "none"
|
|
7937
|
-
}
|
|
7890
|
+
className: showHostBorder ? "w-full h-full bg-transparent border border-border rounded-xl" : "w-full h-full bg-transparent border-0"
|
|
7938
7891
|
}
|
|
7939
7892
|
)
|
|
7940
7893
|
)
|
|
@@ -7956,6 +7909,9 @@ function viewRendererAreEqual(prev, next) {
|
|
|
7956
7909
|
if (prev.hostCapabilities !== next.hostCapabilities) return false;
|
|
7957
7910
|
if (prev.cspMode !== next.cspMode) return false;
|
|
7958
7911
|
if (prev.mockOpenAiFileApis !== next.mockOpenAiFileApis) return false;
|
|
7912
|
+
if (prev.onInlineHeightChange !== next.onInlineHeightChange) return false;
|
|
7913
|
+
if (prev.fullscreenHeader !== next.fullscreenHeader) return false;
|
|
7914
|
+
if (prev.renderFullscreenClose !== next.renderFullscreenClose) return false;
|
|
7959
7915
|
if (prev.className !== next.className) return false;
|
|
7960
7916
|
if (prev.onReady !== next.onReady) return false;
|
|
7961
7917
|
if (prev.onLifecycleChange !== next.onLifecycleChange) return false;
|