@mcp-use/client 2.0.0-beta.4 → 2.0.0-beta.6
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 +128 -163
- 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.5";
|
|
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,
|
|
@@ -7459,6 +7355,9 @@ function ViewRendererBase({
|
|
|
7459
7355
|
const iframeRef = useRef4(null);
|
|
7460
7356
|
const bridgeRef = useRef4(null);
|
|
7461
7357
|
const containerRef = useRef4(null);
|
|
7358
|
+
const pendingBlobRevocationsRef = useRef4(
|
|
7359
|
+
/* @__PURE__ */ new Map()
|
|
7360
|
+
);
|
|
7462
7361
|
const connectionRef = useRef4(
|
|
7463
7362
|
source.kind === "live" ? source.connection : null
|
|
7464
7363
|
);
|
|
@@ -7472,8 +7371,13 @@ function ViewRendererBase({
|
|
|
7472
7371
|
);
|
|
7473
7372
|
const [internalDisplayMode, setInternalDisplayMode] = useState4("inline");
|
|
7474
7373
|
const displayMode = displayModeProp ?? internalDisplayMode;
|
|
7475
|
-
const
|
|
7476
|
-
|
|
7374
|
+
const effectiveHostContext = useMemo3(() => {
|
|
7375
|
+
if (!hostContext) return hostContext;
|
|
7376
|
+
if (hostContext.displayMode === displayMode) return hostContext;
|
|
7377
|
+
return { ...hostContext, displayMode };
|
|
7378
|
+
}, [hostContext, displayMode]);
|
|
7379
|
+
const hostContextRef = useRef4(effectiveHostContext);
|
|
7380
|
+
hostContextRef.current = effectiveHostContext;
|
|
7477
7381
|
const onMessageRef = useRef4(onMessage);
|
|
7478
7382
|
onMessageRef.current = onMessage;
|
|
7479
7383
|
const toolInputRef = useRef4(toolInput);
|
|
@@ -7498,6 +7402,8 @@ function ViewRendererBase({
|
|
|
7498
7402
|
onReadyRef.current = onReady;
|
|
7499
7403
|
const onLifecycleChangeRef = useRef4(onLifecycleChange);
|
|
7500
7404
|
onLifecycleChangeRef.current = onLifecycleChange;
|
|
7405
|
+
const onInlineHeightChangeRef = useRef4(onInlineHeightChange);
|
|
7406
|
+
onInlineHeightChangeRef.current = onInlineHeightChange;
|
|
7501
7407
|
const sandboxUrlRef = useRef4(sandboxUrl);
|
|
7502
7408
|
sandboxUrlRef.current = sandboxUrl;
|
|
7503
7409
|
const cspModeRef = useRef4(cspMode);
|
|
@@ -7607,10 +7513,18 @@ function ViewRendererBase({
|
|
|
7607
7513
|
}, [source.kind, liveResourceUri, preloadedHtml, cspMode, resolveSandboxUrl]);
|
|
7608
7514
|
useEffect5(() => {
|
|
7609
7515
|
const url = activeSandboxUrl;
|
|
7516
|
+
if (!url || url.protocol !== "blob:") return;
|
|
7517
|
+
const pending = pendingBlobRevocationsRef.current.get(url.href);
|
|
7518
|
+
if (pending) {
|
|
7519
|
+
clearTimeout(pending);
|
|
7520
|
+
pendingBlobRevocationsRef.current.delete(url.href);
|
|
7521
|
+
}
|
|
7610
7522
|
return () => {
|
|
7611
|
-
|
|
7523
|
+
const timer = setTimeout(() => {
|
|
7612
7524
|
URL.revokeObjectURL(url.href);
|
|
7613
|
-
|
|
7525
|
+
pendingBlobRevocationsRef.current.delete(url.href);
|
|
7526
|
+
}, 1e3);
|
|
7527
|
+
pendingBlobRevocationsRef.current.set(url.href, timer);
|
|
7614
7528
|
};
|
|
7615
7529
|
}, [activeSandboxUrl]);
|
|
7616
7530
|
const isBlobSandbox = activeSandboxUrl?.protocol === "blob:";
|
|
@@ -7671,7 +7585,14 @@ function ViewRendererBase({
|
|
|
7671
7585
|
iframe.setAttribute("allow", allowAttribute);
|
|
7672
7586
|
}
|
|
7673
7587
|
const readyPromise = waitForSandboxProxyReady(iframe);
|
|
7674
|
-
|
|
7588
|
+
if (activeSandboxUrl.protocol === "blob:") {
|
|
7589
|
+
const response = await fetch(activeSandboxUrl.href);
|
|
7590
|
+
const sandboxHtml = await response.text();
|
|
7591
|
+
if (disposed) return;
|
|
7592
|
+
iframe.srcdoc = sandboxHtml;
|
|
7593
|
+
} else {
|
|
7594
|
+
iframe.src = activeSandboxUrl.href;
|
|
7595
|
+
}
|
|
7675
7596
|
await readyPromise;
|
|
7676
7597
|
if (disposed) return;
|
|
7677
7598
|
const capabilities = {
|
|
@@ -7757,7 +7678,10 @@ function ViewRendererBase({
|
|
|
7757
7678
|
height
|
|
7758
7679
|
}) => {
|
|
7759
7680
|
if (displayModeRef.current !== "inline") return;
|
|
7760
|
-
if (height !== void 0)
|
|
7681
|
+
if (height !== void 0) {
|
|
7682
|
+
setInlineHeight(height);
|
|
7683
|
+
onInlineHeightChangeRef.current?.(height);
|
|
7684
|
+
}
|
|
7761
7685
|
};
|
|
7762
7686
|
const initPromise = hookInitialized(bridge);
|
|
7763
7687
|
let transport = new PostMessageTransport(
|
|
@@ -7844,9 +7768,9 @@ function ViewRendererBase({
|
|
|
7844
7768
|
]);
|
|
7845
7769
|
useEffect5(() => {
|
|
7846
7770
|
const bridge = bridgeRef.current;
|
|
7847
|
-
if (!bridge || initCount === 0 || !
|
|
7848
|
-
bridge.setHostContext(
|
|
7849
|
-
}, [
|
|
7771
|
+
if (!bridge || initCount === 0 || !effectiveHostContext) return;
|
|
7772
|
+
bridge.setHostContext(effectiveHostContext);
|
|
7773
|
+
}, [effectiveHostContext, initCount]);
|
|
7850
7774
|
useEffect5(() => {
|
|
7851
7775
|
const bridge = bridgeRef.current;
|
|
7852
7776
|
if (!bridge || initCount === 0 || !partialToolInput) return;
|
|
@@ -7884,6 +7808,7 @@ function ViewRendererBase({
|
|
|
7884
7808
|
const timer = setTimeout(() => setShowSpinner(false), 300);
|
|
7885
7809
|
return () => clearTimeout(timer);
|
|
7886
7810
|
}, [initCount, showSpinner]);
|
|
7811
|
+
const showHostBorder = resolved !== null && resolved.prefersBorder && displayMode !== "fullscreen";
|
|
7887
7812
|
if (loadError) {
|
|
7888
7813
|
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)));
|
|
7889
7814
|
}
|
|
@@ -7901,29 +7826,69 @@ function ViewRendererBase({
|
|
|
7901
7826
|
"div",
|
|
7902
7827
|
{
|
|
7903
7828
|
ref: containerRef,
|
|
7904
|
-
className: containerClassName,
|
|
7829
|
+
className: isFullscreen ? `${containerClassName} flex flex-col` : containerClassName,
|
|
7905
7830
|
style: isPip ? {
|
|
7906
7831
|
height: VIEW_DIMENSIONS.DEFAULT_HEIGHT,
|
|
7907
7832
|
maxWidth: VIEW_DIMENSIONS.PIP_MAX_WIDTH,
|
|
7908
7833
|
zIndex: 100
|
|
7909
7834
|
} : isFullscreen ? { zIndex: 100 } : void 0
|
|
7910
7835
|
},
|
|
7911
|
-
|
|
7836
|
+
isFullscreen && // ponytail: inspector Tailwind may not emit client arbitrary classes
|
|
7837
|
+
// (h-[50px], grid-cols-[auto_1fr_auto]) — use inline layout instead.
|
|
7838
|
+
/* @__PURE__ */ React2.createElement(
|
|
7839
|
+
"header",
|
|
7840
|
+
{
|
|
7841
|
+
className: "grid shrink-0 items-center border-b border-zinc-200 bg-background px-3 dark:border-zinc-700",
|
|
7842
|
+
style: {
|
|
7843
|
+
height: VIEW_DIMENSIONS.FULLSCREEN_HEADER_HEIGHT,
|
|
7844
|
+
gridTemplateColumns: "auto 1fr auto"
|
|
7845
|
+
}
|
|
7846
|
+
},
|
|
7847
|
+
renderFullscreenClose ? renderFullscreenClose({
|
|
7848
|
+
onClick: () => void handleDisplayModeChange("inline"),
|
|
7849
|
+
"data-testid": "debugger-exit-fullscreen-button",
|
|
7850
|
+
"aria-label": "Exit fullscreen"
|
|
7851
|
+
}) : /* @__PURE__ */ React2.createElement(
|
|
7852
|
+
"button",
|
|
7853
|
+
{
|
|
7854
|
+
type: "button",
|
|
7855
|
+
"data-testid": "debugger-exit-fullscreen-button",
|
|
7856
|
+
"aria-label": "Exit fullscreen",
|
|
7857
|
+
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",
|
|
7858
|
+
onClick: () => void handleDisplayModeChange("inline")
|
|
7859
|
+
},
|
|
7860
|
+
/* @__PURE__ */ React2.createElement(CloseIcon, null)
|
|
7861
|
+
),
|
|
7862
|
+
/* @__PURE__ */ React2.createElement("div", { className: "flex min-w-0 items-center justify-center gap-2 px-2" }, fullscreenHeader?.iconUrl ? /* @__PURE__ */ React2.createElement(
|
|
7863
|
+
"img",
|
|
7864
|
+
{
|
|
7865
|
+
src: fullscreenHeader.iconUrl,
|
|
7866
|
+
alt: "",
|
|
7867
|
+
className: "size-6 shrink-0 rounded-md object-contain"
|
|
7868
|
+
}
|
|
7869
|
+
) : null, /* @__PURE__ */ React2.createElement("span", { className: "truncate text-sm font-medium text-foreground" }, fullscreenHeader?.title ?? toolName)),
|
|
7870
|
+
/* @__PURE__ */ React2.createElement("div", { className: "size-8 shrink-0", "aria-hidden": true })
|
|
7871
|
+
),
|
|
7872
|
+
isPip && (renderFullscreenClose ? /* @__PURE__ */ React2.createElement("div", { className: "absolute right-3 top-3", style: { zIndex: 110 } }, renderFullscreenClose({
|
|
7873
|
+
onClick: () => void handleDisplayModeChange("inline"),
|
|
7874
|
+
"data-testid": "debugger-exit-pip-button",
|
|
7875
|
+
"aria-label": "Exit picture-in-picture"
|
|
7876
|
+
})) : /* @__PURE__ */ React2.createElement(
|
|
7912
7877
|
"button",
|
|
7913
7878
|
{
|
|
7914
7879
|
type: "button",
|
|
7915
|
-
"data-testid":
|
|
7916
|
-
"aria-label":
|
|
7917
|
-
className: "absolute right-3 top-3 z-[110] flex size-8 items-center justify-center rounded-full border border-border bg-background/90 text-
|
|
7880
|
+
"data-testid": "debugger-exit-pip-button",
|
|
7881
|
+
"aria-label": "Exit picture-in-picture",
|
|
7882
|
+
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",
|
|
7918
7883
|
style: { zIndex: 110 },
|
|
7919
7884
|
onClick: () => void handleDisplayModeChange("inline")
|
|
7920
7885
|
},
|
|
7921
|
-
|
|
7922
|
-
),
|
|
7886
|
+
/* @__PURE__ */ React2.createElement(CloseIcon, null)
|
|
7887
|
+
)),
|
|
7923
7888
|
/* @__PURE__ */ React2.createElement(
|
|
7924
7889
|
"div",
|
|
7925
7890
|
{
|
|
7926
|
-
className: isFullscreen
|
|
7891
|
+
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"
|
|
7927
7892
|
},
|
|
7928
7893
|
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")),
|
|
7929
7894
|
!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),
|
|
@@ -7940,10 +7905,7 @@ function ViewRendererBase({
|
|
|
7940
7905
|
{
|
|
7941
7906
|
ref: iframeRef,
|
|
7942
7907
|
title: `MCP App: ${toolName}`,
|
|
7943
|
-
className: "w-full h-full border-
|
|
7944
|
-
style: {
|
|
7945
|
-
border: resolved.prefersBorder && displayMode !== "fullscreen" ? void 0 : "none"
|
|
7946
|
-
}
|
|
7908
|
+
className: showHostBorder ? "w-full h-full bg-transparent border border-border rounded-xl" : "w-full h-full bg-transparent border-0"
|
|
7947
7909
|
}
|
|
7948
7910
|
)
|
|
7949
7911
|
)
|
|
@@ -7965,6 +7927,9 @@ function viewRendererAreEqual(prev, next) {
|
|
|
7965
7927
|
if (prev.hostCapabilities !== next.hostCapabilities) return false;
|
|
7966
7928
|
if (prev.cspMode !== next.cspMode) return false;
|
|
7967
7929
|
if (prev.mockOpenAiFileApis !== next.mockOpenAiFileApis) return false;
|
|
7930
|
+
if (prev.onInlineHeightChange !== next.onInlineHeightChange) return false;
|
|
7931
|
+
if (prev.fullscreenHeader !== next.fullscreenHeader) return false;
|
|
7932
|
+
if (prev.renderFullscreenClose !== next.renderFullscreenClose) return false;
|
|
7968
7933
|
if (prev.className !== next.className) return false;
|
|
7969
7934
|
if (prev.onReady !== next.onReady) return false;
|
|
7970
7935
|
if (prev.onLifecycleChange !== next.onLifecycleChange) return false;
|