@frontmcp/ui 1.9.2 → 1.9.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/bridge/adapters/ext-apps.adapter.d.ts +19 -2
- package/bridge/adapters/ext-apps.adapter.d.ts.map +1 -1
- package/bridge/index.js +64 -16
- package/bridge/runtime/iife-generator.d.ts.map +1 -1
- package/bridge/types.d.ts +20 -5
- package/bridge/types.d.ts.map +1 -1
- package/esm/bridge/index.mjs +64 -16
- package/esm/package.json +2 -2
- package/package.json +2 -2
|
@@ -57,6 +57,7 @@ export declare class ExtAppsAdapter extends BaseAdapter {
|
|
|
57
57
|
private _trustedOrigin;
|
|
58
58
|
private _originTrustPending;
|
|
59
59
|
private _hostCapabilities;
|
|
60
|
+
private modelContext;
|
|
60
61
|
constructor(config?: ExtAppsAdapterConfig);
|
|
61
62
|
/**
|
|
62
63
|
* Check if we're in an iframe with explicit ext-apps context.
|
|
@@ -79,18 +80,29 @@ export declare class ExtAppsAdapter extends BaseAdapter {
|
|
|
79
80
|
callTool(name: string, args: Record<string, unknown>): Promise<unknown>;
|
|
80
81
|
sendMessage(content: string): Promise<void>;
|
|
81
82
|
openLink(url: string): Promise<void>;
|
|
83
|
+
/**
|
|
84
|
+
* Ask the host for a display mode it offers (`hostContext.availableDisplayModes`), and keep the
|
|
85
|
+
* mode it answers with, which differs from `mode` when the host refuses the change.
|
|
86
|
+
*/
|
|
82
87
|
requestDisplayMode(mode: DisplayMode): Promise<void>;
|
|
83
88
|
/**
|
|
84
89
|
* Report the widget's size to the host with the standard
|
|
85
90
|
* `ui/notifications/size-changed` notification (`{ width?, height? }` in px).
|
|
86
91
|
*/
|
|
87
92
|
setSize(size: WidgetSize): Promise<void>;
|
|
93
|
+
/**
|
|
94
|
+
* Ask the host to tear the widget down with `ui/notifications/request-teardown`. The host
|
|
95
|
+
* decides; if it agrees, it sends `ui/resource-teardown`.
|
|
96
|
+
*/
|
|
88
97
|
requestClose(): Promise<void>;
|
|
89
98
|
/**
|
|
90
99
|
* Update the model context with widget state.
|
|
91
100
|
*
|
|
92
101
|
* This allows the widget to pass contextual information to the model,
|
|
93
|
-
* which can be used to inform subsequent interactions.
|
|
102
|
+
* which can be used to inform subsequent interactions. It is sent as
|
|
103
|
+
* `ui/update-model-context`: an object as `structuredContent` and as a JSON
|
|
104
|
+
* text block, anything else as a text block. The host keeps only the latest
|
|
105
|
+
* update, so with `merge` an object is merged into the last one here.
|
|
94
106
|
*
|
|
95
107
|
* @param context - The context data to update
|
|
96
108
|
* @param merge - Whether to merge with existing context (default: true)
|
|
@@ -100,7 +112,7 @@ export declare class ExtAppsAdapter extends BaseAdapter {
|
|
|
100
112
|
* Send a log message to the host.
|
|
101
113
|
*
|
|
102
114
|
* Allows the widget to forward log messages to the host for debugging
|
|
103
|
-
* or monitoring purposes
|
|
115
|
+
* or monitoring purposes, with the standard MCP `notifications/message`.
|
|
104
116
|
*
|
|
105
117
|
* @param level - Log level (debug, info, warn, error)
|
|
106
118
|
* @param message - Log message
|
|
@@ -134,6 +146,11 @@ export declare class ExtAppsAdapter extends BaseAdapter {
|
|
|
134
146
|
* Handle incoming postMessage events.
|
|
135
147
|
*/
|
|
136
148
|
private _handleMessage;
|
|
149
|
+
/**
|
|
150
|
+
* Handle a JSON-RPC request from the host. `ui/resource-teardown` means the host is about to
|
|
151
|
+
* unmount the widget: emit `bridge:teardown` for cleanup, then answer `{}` to the origin it came from.
|
|
152
|
+
*/
|
|
153
|
+
private _handleHostRequest;
|
|
137
154
|
/**
|
|
138
155
|
* Handle JSON-RPC response.
|
|
139
156
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ext-apps.adapter.d.ts","sourceRoot":"","sources":["../../../src/bridge/adapters/ext-apps.adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;
|
|
1
|
+
{"version":3,"file":"ext-apps.adapter.d.ts","sourceRoot":"","sources":["../../../src/bridge/adapters/ext-apps.adapter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H,OAAO,CAAC,wBAAwB;IAyBhC;;OAEG;IACH,OAAO,CAAC,gBAAgB;IASxB;;OAEG;IACH,OAAO,CAAC,YAAY;IA2BpB;;;;;;OAMG;IACH,OAAO,CAAC,iBAAiB;IAczB;;;OAGG;IACH,OAAO,CAAC,YAAY;IAapB;;OAEG;IACH,OAAO,CAAC,wBAAwB;IA0BhC;;OAEG;YACW,iBAAiB;IA2D/B;;;;;;OAMG;IACH,OAAO,CAAC,gBAAgB;IAgCxB;;OAEG;IACH,OAAO,CAAC,gBAAgB;CAUzB;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,CAAC,EAAE,oBAAoB,GAAG,cAAc,CAElF;AAED;;GAEG;AACH,qBAAa,wBAAyB,SAAQ,KAAK;gBACrC,OAAO,EAAE,MAAM;CAI5B"}
|
package/bridge/index.js
CHANGED
|
@@ -1066,6 +1066,7 @@ function createOpenAIAdapter() {
|
|
|
1066
1066
|
}
|
|
1067
1067
|
|
|
1068
1068
|
// libs/ui/src/bridge/adapters/ext-apps.adapter.ts
|
|
1069
|
+
var import_bridge_runtime = require("@frontmcp/uipack/bridge-runtime");
|
|
1069
1070
|
var ExtAppsAdapter = class extends BaseAdapter {
|
|
1070
1071
|
id = "ext-apps";
|
|
1071
1072
|
name = "ext-apps (SEP-1865)";
|
|
@@ -1079,6 +1080,7 @@ var ExtAppsAdapter = class extends BaseAdapter {
|
|
|
1079
1080
|
_originTrustPending = false;
|
|
1080
1081
|
// Guard against race condition in trust-on-first-use
|
|
1081
1082
|
_hostCapabilities = {};
|
|
1083
|
+
modelContext;
|
|
1082
1084
|
constructor(config) {
|
|
1083
1085
|
super();
|
|
1084
1086
|
this._config = config || {};
|
|
@@ -1161,26 +1163,37 @@ var ExtAppsAdapter = class extends BaseAdapter {
|
|
|
1161
1163
|
// Actions (via JSON-RPC)
|
|
1162
1164
|
// ============================================
|
|
1163
1165
|
async callTool(name, args) {
|
|
1164
|
-
if (!this._hostCapabilities.serverToolProxy) {
|
|
1166
|
+
if (!this._hostCapabilities.serverTools && !this._hostCapabilities.serverToolProxy) {
|
|
1165
1167
|
throw new ExtAppsNotSupportedError("Server tool proxy not supported by host");
|
|
1166
1168
|
}
|
|
1167
|
-
return this._sendRequest("
|
|
1169
|
+
return this._sendRequest("tools/call", {
|
|
1168
1170
|
name,
|
|
1169
|
-
arguments: args
|
|
1171
|
+
arguments: args,
|
|
1172
|
+
_meta: { [import_bridge_runtime.WIDGET_CALL_META_KEY]: true }
|
|
1170
1173
|
});
|
|
1171
1174
|
}
|
|
1172
1175
|
async sendMessage(content) {
|
|
1173
1176
|
await this._sendRequest("ui/message", { content });
|
|
1174
1177
|
}
|
|
1175
1178
|
async openLink(url) {
|
|
1176
|
-
if (!this._hostCapabilities.openLink) {
|
|
1179
|
+
if (!this._hostCapabilities.openLinks && !this._hostCapabilities.openLink) {
|
|
1177
1180
|
return super.openLink(url);
|
|
1178
1181
|
}
|
|
1179
|
-
await this._sendRequest("ui/
|
|
1182
|
+
await this._sendRequest("ui/open-link", { url });
|
|
1180
1183
|
}
|
|
1184
|
+
/**
|
|
1185
|
+
* Ask the host for a display mode it offers (`hostContext.availableDisplayModes`), and keep the
|
|
1186
|
+
* mode it answers with, which differs from `mode` when the host refuses the change.
|
|
1187
|
+
*/
|
|
1181
1188
|
async requestDisplayMode(mode) {
|
|
1182
|
-
|
|
1183
|
-
|
|
1189
|
+
if (!this._hostContext.availableDisplayModes?.includes(mode)) {
|
|
1190
|
+
throw new ExtAppsNotSupportedError(`Display mode "${mode}" is not available on this host`);
|
|
1191
|
+
}
|
|
1192
|
+
const result = await this._sendRequest("ui/request-display-mode", { mode });
|
|
1193
|
+
const setMode = import_bridge_runtime.MCP_APPS_DISPLAY_MODES.find((displayMode) => displayMode === result?.mode);
|
|
1194
|
+
if (setMode) {
|
|
1195
|
+
this._hostContext = { ...this._hostContext, displayMode: setMode };
|
|
1196
|
+
}
|
|
1184
1197
|
}
|
|
1185
1198
|
/**
|
|
1186
1199
|
* Report the widget's size to the host with the standard
|
|
@@ -1192,8 +1205,12 @@ var ExtAppsAdapter = class extends BaseAdapter {
|
|
|
1192
1205
|
if (typeof size.height === "number") params.height = size.height;
|
|
1193
1206
|
this._sendNotification("ui/notifications/size-changed", params);
|
|
1194
1207
|
}
|
|
1208
|
+
/**
|
|
1209
|
+
* Ask the host to tear the widget down with `ui/notifications/request-teardown`. The host
|
|
1210
|
+
* decides; if it agrees, it sends `ui/resource-teardown`.
|
|
1211
|
+
*/
|
|
1195
1212
|
async requestClose() {
|
|
1196
|
-
|
|
1213
|
+
this._sendNotification("ui/notifications/request-teardown", {});
|
|
1197
1214
|
}
|
|
1198
1215
|
// ============================================
|
|
1199
1216
|
// Extended ext-apps Methods (Full Specification)
|
|
@@ -1202,22 +1219,33 @@ var ExtAppsAdapter = class extends BaseAdapter {
|
|
|
1202
1219
|
* Update the model context with widget state.
|
|
1203
1220
|
*
|
|
1204
1221
|
* This allows the widget to pass contextual information to the model,
|
|
1205
|
-
* which can be used to inform subsequent interactions.
|
|
1222
|
+
* which can be used to inform subsequent interactions. It is sent as
|
|
1223
|
+
* `ui/update-model-context`: an object as `structuredContent` and as a JSON
|
|
1224
|
+
* text block, anything else as a text block. The host keeps only the latest
|
|
1225
|
+
* update, so with `merge` an object is merged into the last one here.
|
|
1206
1226
|
*
|
|
1207
1227
|
* @param context - The context data to update
|
|
1208
1228
|
* @param merge - Whether to merge with existing context (default: true)
|
|
1209
1229
|
*/
|
|
1210
1230
|
async updateModelContext(context, merge = true) {
|
|
1211
|
-
if (!this._hostCapabilities.modelContextUpdate) {
|
|
1231
|
+
if (!this._hostCapabilities.updateModelContext && !this._hostCapabilities.modelContextUpdate) {
|
|
1212
1232
|
throw new ExtAppsNotSupportedError("Model context update not supported by host");
|
|
1213
1233
|
}
|
|
1214
|
-
|
|
1234
|
+
const isObject = typeof context === "object" && context !== null && !Array.isArray(context);
|
|
1235
|
+
const structuredContent = isObject ? { ...merge ? this.modelContext : void 0, ...context } : void 0;
|
|
1236
|
+
this.modelContext = structuredContent;
|
|
1237
|
+
const sentContext = structuredContent ?? context;
|
|
1238
|
+
const text = typeof sentContext === "string" ? sentContext : JSON.stringify(sentContext);
|
|
1239
|
+
await this._sendRequest("ui/update-model-context", {
|
|
1240
|
+
content: [{ type: "text", text }],
|
|
1241
|
+
...structuredContent ? { structuredContent } : {}
|
|
1242
|
+
});
|
|
1215
1243
|
}
|
|
1216
1244
|
/**
|
|
1217
1245
|
* Send a log message to the host.
|
|
1218
1246
|
*
|
|
1219
1247
|
* Allows the widget to forward log messages to the host for debugging
|
|
1220
|
-
* or monitoring purposes
|
|
1248
|
+
* or monitoring purposes, with the standard MCP `notifications/message`.
|
|
1221
1249
|
*
|
|
1222
1250
|
* @param level - Log level (debug, info, warn, error)
|
|
1223
1251
|
* @param message - Log message
|
|
@@ -1229,7 +1257,10 @@ var ExtAppsAdapter = class extends BaseAdapter {
|
|
|
1229
1257
|
logFn(`[Widget] ${message}`, data);
|
|
1230
1258
|
return;
|
|
1231
1259
|
}
|
|
1232
|
-
|
|
1260
|
+
this._sendNotification("notifications/message", {
|
|
1261
|
+
level: level === "warn" ? "warning" : level,
|
|
1262
|
+
data: data === void 0 ? message : { message, data }
|
|
1263
|
+
});
|
|
1233
1264
|
}
|
|
1234
1265
|
/**
|
|
1235
1266
|
* Register a widget-defined tool.
|
|
@@ -1291,6 +1322,18 @@ var ExtAppsAdapter = class extends BaseAdapter {
|
|
|
1291
1322
|
this._handleNotification(data);
|
|
1292
1323
|
return;
|
|
1293
1324
|
}
|
|
1325
|
+
if ("method" in data && "id" in data) {
|
|
1326
|
+
this._handleHostRequest(data, event.origin);
|
|
1327
|
+
}
|
|
1328
|
+
}
|
|
1329
|
+
/**
|
|
1330
|
+
* Handle a JSON-RPC request from the host. `ui/resource-teardown` means the host is about to
|
|
1331
|
+
* unmount the widget: emit `bridge:teardown` for cleanup, then answer `{}` to the origin it came from.
|
|
1332
|
+
*/
|
|
1333
|
+
_handleHostRequest(request, origin) {
|
|
1334
|
+
if (request.method !== "ui/resource-teardown") return;
|
|
1335
|
+
this._emitBridgeEvent("bridge:teardown", {});
|
|
1336
|
+
this._postMessage({ jsonrpc: "2.0", id: request.id, result: {} }, origin);
|
|
1294
1337
|
}
|
|
1295
1338
|
/**
|
|
1296
1339
|
* Handle JSON-RPC response.
|
|
@@ -1325,6 +1368,7 @@ var ExtAppsAdapter = class extends BaseAdapter {
|
|
|
1325
1368
|
break;
|
|
1326
1369
|
case "ui/notifications/initialized":
|
|
1327
1370
|
break;
|
|
1371
|
+
case "ui/notifications/tool-cancelled":
|
|
1328
1372
|
case "ui/notifications/cancelled":
|
|
1329
1373
|
this._handleCancelled(notification.params);
|
|
1330
1374
|
break;
|
|
@@ -1367,6 +1411,9 @@ var ExtAppsAdapter = class extends BaseAdapter {
|
|
|
1367
1411
|
if (params.displayMode !== void 0) {
|
|
1368
1412
|
changes.displayMode = params.displayMode;
|
|
1369
1413
|
}
|
|
1414
|
+
if (params.availableDisplayModes !== void 0) {
|
|
1415
|
+
changes.availableDisplayModes = params.availableDisplayModes;
|
|
1416
|
+
}
|
|
1370
1417
|
if (params.viewport !== void 0) {
|
|
1371
1418
|
changes.viewport = params.viewport;
|
|
1372
1419
|
}
|
|
@@ -1469,7 +1516,8 @@ var ExtAppsAdapter = class extends BaseAdapter {
|
|
|
1469
1516
|
appCapabilities: {
|
|
1470
1517
|
tools: {
|
|
1471
1518
|
listChanged: false
|
|
1472
|
-
}
|
|
1519
|
+
},
|
|
1520
|
+
availableDisplayModes: [...import_bridge_runtime.MCP_APPS_DISPLAY_MODES]
|
|
1473
1521
|
},
|
|
1474
1522
|
protocolVersion: this._config.options?.protocolVersion || "2024-11-05"
|
|
1475
1523
|
};
|
|
@@ -1482,9 +1530,9 @@ var ExtAppsAdapter = class extends BaseAdapter {
|
|
|
1482
1530
|
this._hostCapabilities = result.hostCapabilities || {};
|
|
1483
1531
|
this._capabilities = {
|
|
1484
1532
|
...this._capabilities,
|
|
1485
|
-
canCallTools: Boolean(this._hostCapabilities.serverToolProxy),
|
|
1533
|
+
canCallTools: Boolean(this._hostCapabilities.serverTools || this._hostCapabilities.serverToolProxy),
|
|
1486
1534
|
canSendMessages: true,
|
|
1487
|
-
canOpenLinks: Boolean(this._hostCapabilities.openLink),
|
|
1535
|
+
canOpenLinks: Boolean(this._hostCapabilities.openLinks || this._hostCapabilities.openLink),
|
|
1488
1536
|
supportsDisplayModes: true
|
|
1489
1537
|
};
|
|
1490
1538
|
if (result.hostContext) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"iife-generator.d.ts","sourceRoot":"","sources":["../../../src/bridge/runtime/iife-generator.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;
|
|
1
|
+
{"version":3,"file":"iife-generator.d.ts","sourceRoot":"","sources":["../../../src/bridge/runtime/iife-generator.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,uDAAuD;IACvD,QAAQ,CAAC,EAAE,CAAC,QAAQ,GAAG,UAAU,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAC,EAAE,CAAC;IACvE,2BAA2B;IAC3B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,2CAA2C;IAC3C,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,wBAAwB;IACxB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,GAAE,oBAAyB,GAAG,MAAM,CA6F7E;AAgjCD;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,SAAS,GAAG,QAAQ,GAAG,QAAQ,GAAG,WAAW,EACvD,OAAO,GAAE,IAAI,CAAC,oBAAoB,EAAE,UAAU,CAAM,GACnD,MAAM,CAYR;AAED;;;GAGG;AACH,eAAO,MAAM,uBAAuB,QAAuB,CAAC;AAE5D;;GAEG;AACH,eAAO,MAAM,kBAAkB;;;;;CAK9B,CAAC"}
|
package/bridge/types.d.ts
CHANGED
|
@@ -60,6 +60,8 @@ export interface HostContext {
|
|
|
60
60
|
theme: 'light' | 'dark';
|
|
61
61
|
/** Current display mode */
|
|
62
62
|
displayMode: DisplayMode;
|
|
63
|
+
/** Display modes the host offers (MCP Apps) */
|
|
64
|
+
availableDisplayModes?: DisplayMode[];
|
|
63
65
|
/** BCP 47 locale */
|
|
64
66
|
locale: string;
|
|
65
67
|
/** IANA timezone */
|
|
@@ -277,6 +279,8 @@ export interface ExtAppsInitializeParams {
|
|
|
277
279
|
tools?: {
|
|
278
280
|
listChanged: boolean;
|
|
279
281
|
};
|
|
282
|
+
/** Display modes the widget supports */
|
|
283
|
+
availableDisplayModes?: DisplayMode[];
|
|
280
284
|
};
|
|
281
285
|
protocolVersion: string;
|
|
282
286
|
}
|
|
@@ -290,15 +294,23 @@ export interface ExtAppsInitializeResult {
|
|
|
290
294
|
version: string;
|
|
291
295
|
};
|
|
292
296
|
hostCapabilities: {
|
|
293
|
-
/** Host supports opening links */
|
|
297
|
+
/** Host supports opening links (MCP Apps spec name) */
|
|
298
|
+
openLinks?: Record<string, unknown>;
|
|
299
|
+
/** Host supports opening links (earlier FrontMCP name) */
|
|
294
300
|
openLink?: boolean;
|
|
295
|
-
/** Host
|
|
301
|
+
/** Host can proxy tool calls to the MCP server (MCP Apps spec name) */
|
|
302
|
+
serverTools?: {
|
|
303
|
+
listChanged?: boolean;
|
|
304
|
+
};
|
|
305
|
+
/** Host supports proxying tool calls to the MCP server (earlier FrontMCP name) */
|
|
296
306
|
serverToolProxy?: boolean;
|
|
297
307
|
/** Host supports reading resources */
|
|
298
308
|
resourceRead?: boolean;
|
|
299
309
|
/** Host supports logging */
|
|
300
|
-
logging?: boolean
|
|
301
|
-
/** Host
|
|
310
|
+
logging?: boolean | Record<string, unknown>;
|
|
311
|
+
/** Host accepts `ui/update-model-context`, with the content types it takes (MCP Apps spec name) */
|
|
312
|
+
updateModelContext?: Record<string, unknown>;
|
|
313
|
+
/** Host supports model context updates (earlier FrontMCP name) */
|
|
302
314
|
modelContextUpdate?: boolean;
|
|
303
315
|
/** Host supports widget-defined tools */
|
|
304
316
|
widgetTools?: boolean;
|
|
@@ -327,6 +339,7 @@ export interface ExtAppsToolResultParams {
|
|
|
327
339
|
export interface ExtAppsHostContextChangeParams {
|
|
328
340
|
theme?: 'light' | 'dark';
|
|
329
341
|
displayMode?: DisplayMode;
|
|
342
|
+
availableDisplayModes?: DisplayMode[];
|
|
330
343
|
viewport?: ViewportInfo;
|
|
331
344
|
locale?: string;
|
|
332
345
|
timezone?: string;
|
|
@@ -334,7 +347,7 @@ export interface ExtAppsHostContextChangeParams {
|
|
|
334
347
|
/**
|
|
335
348
|
* Bridge event types for CustomEvent dispatch.
|
|
336
349
|
*/
|
|
337
|
-
export type BridgeEventType = 'bridge:ready' | 'bridge:error' | 'bridge:adapter-changed' | 'context:change' | 'tool:input' | 'tool:input-partial' | 'tool:result' | 'tool:cancelled';
|
|
350
|
+
export type BridgeEventType = 'bridge:ready' | 'bridge:error' | 'bridge:adapter-changed' | 'bridge:teardown' | 'context:change' | 'tool:input' | 'tool:input-partial' | 'tool:result' | 'tool:cancelled';
|
|
338
351
|
/**
|
|
339
352
|
* Bridge event payload map.
|
|
340
353
|
*/
|
|
@@ -350,6 +363,8 @@ export interface BridgeEventPayloads {
|
|
|
350
363
|
from?: string;
|
|
351
364
|
to: string;
|
|
352
365
|
};
|
|
366
|
+
/** The host is about to unmount the widget (MCP Apps `ui/resource-teardown`); clean up synchronously. */
|
|
367
|
+
'bridge:teardown': Record<string, never>;
|
|
353
368
|
'context:change': Partial<HostContext>;
|
|
354
369
|
'tool:input': {
|
|
355
370
|
arguments: Record<string, unknown>;
|
package/bridge/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/bridge/types.ts"],"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,CAAC,WAAW,CAAC,KAAK,IAAI,GAAG,MAAM,IAAI,CAAC;IAC/E,YAAY,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,GAAG,MAAM,IAAI,CAAC;CAC/D"}
|
package/esm/bridge/index.mjs
CHANGED
|
@@ -1014,6 +1014,7 @@ function createOpenAIAdapter() {
|
|
|
1014
1014
|
}
|
|
1015
1015
|
|
|
1016
1016
|
// libs/ui/src/bridge/adapters/ext-apps.adapter.ts
|
|
1017
|
+
import { MCP_APPS_DISPLAY_MODES, WIDGET_CALL_META_KEY } from "@frontmcp/uipack/bridge-runtime";
|
|
1017
1018
|
var ExtAppsAdapter = class extends BaseAdapter {
|
|
1018
1019
|
id = "ext-apps";
|
|
1019
1020
|
name = "ext-apps (SEP-1865)";
|
|
@@ -1027,6 +1028,7 @@ var ExtAppsAdapter = class extends BaseAdapter {
|
|
|
1027
1028
|
_originTrustPending = false;
|
|
1028
1029
|
// Guard against race condition in trust-on-first-use
|
|
1029
1030
|
_hostCapabilities = {};
|
|
1031
|
+
modelContext;
|
|
1030
1032
|
constructor(config) {
|
|
1031
1033
|
super();
|
|
1032
1034
|
this._config = config || {};
|
|
@@ -1109,26 +1111,37 @@ var ExtAppsAdapter = class extends BaseAdapter {
|
|
|
1109
1111
|
// Actions (via JSON-RPC)
|
|
1110
1112
|
// ============================================
|
|
1111
1113
|
async callTool(name, args) {
|
|
1112
|
-
if (!this._hostCapabilities.serverToolProxy) {
|
|
1114
|
+
if (!this._hostCapabilities.serverTools && !this._hostCapabilities.serverToolProxy) {
|
|
1113
1115
|
throw new ExtAppsNotSupportedError("Server tool proxy not supported by host");
|
|
1114
1116
|
}
|
|
1115
|
-
return this._sendRequest("
|
|
1117
|
+
return this._sendRequest("tools/call", {
|
|
1116
1118
|
name,
|
|
1117
|
-
arguments: args
|
|
1119
|
+
arguments: args,
|
|
1120
|
+
_meta: { [WIDGET_CALL_META_KEY]: true }
|
|
1118
1121
|
});
|
|
1119
1122
|
}
|
|
1120
1123
|
async sendMessage(content) {
|
|
1121
1124
|
await this._sendRequest("ui/message", { content });
|
|
1122
1125
|
}
|
|
1123
1126
|
async openLink(url) {
|
|
1124
|
-
if (!this._hostCapabilities.openLink) {
|
|
1127
|
+
if (!this._hostCapabilities.openLinks && !this._hostCapabilities.openLink) {
|
|
1125
1128
|
return super.openLink(url);
|
|
1126
1129
|
}
|
|
1127
|
-
await this._sendRequest("ui/
|
|
1130
|
+
await this._sendRequest("ui/open-link", { url });
|
|
1128
1131
|
}
|
|
1132
|
+
/**
|
|
1133
|
+
* Ask the host for a display mode it offers (`hostContext.availableDisplayModes`), and keep the
|
|
1134
|
+
* mode it answers with, which differs from `mode` when the host refuses the change.
|
|
1135
|
+
*/
|
|
1129
1136
|
async requestDisplayMode(mode) {
|
|
1130
|
-
|
|
1131
|
-
|
|
1137
|
+
if (!this._hostContext.availableDisplayModes?.includes(mode)) {
|
|
1138
|
+
throw new ExtAppsNotSupportedError(`Display mode "${mode}" is not available on this host`);
|
|
1139
|
+
}
|
|
1140
|
+
const result = await this._sendRequest("ui/request-display-mode", { mode });
|
|
1141
|
+
const setMode = MCP_APPS_DISPLAY_MODES.find((displayMode) => displayMode === result?.mode);
|
|
1142
|
+
if (setMode) {
|
|
1143
|
+
this._hostContext = { ...this._hostContext, displayMode: setMode };
|
|
1144
|
+
}
|
|
1132
1145
|
}
|
|
1133
1146
|
/**
|
|
1134
1147
|
* Report the widget's size to the host with the standard
|
|
@@ -1140,8 +1153,12 @@ var ExtAppsAdapter = class extends BaseAdapter {
|
|
|
1140
1153
|
if (typeof size.height === "number") params.height = size.height;
|
|
1141
1154
|
this._sendNotification("ui/notifications/size-changed", params);
|
|
1142
1155
|
}
|
|
1156
|
+
/**
|
|
1157
|
+
* Ask the host to tear the widget down with `ui/notifications/request-teardown`. The host
|
|
1158
|
+
* decides; if it agrees, it sends `ui/resource-teardown`.
|
|
1159
|
+
*/
|
|
1143
1160
|
async requestClose() {
|
|
1144
|
-
|
|
1161
|
+
this._sendNotification("ui/notifications/request-teardown", {});
|
|
1145
1162
|
}
|
|
1146
1163
|
// ============================================
|
|
1147
1164
|
// Extended ext-apps Methods (Full Specification)
|
|
@@ -1150,22 +1167,33 @@ var ExtAppsAdapter = class extends BaseAdapter {
|
|
|
1150
1167
|
* Update the model context with widget state.
|
|
1151
1168
|
*
|
|
1152
1169
|
* This allows the widget to pass contextual information to the model,
|
|
1153
|
-
* which can be used to inform subsequent interactions.
|
|
1170
|
+
* which can be used to inform subsequent interactions. It is sent as
|
|
1171
|
+
* `ui/update-model-context`: an object as `structuredContent` and as a JSON
|
|
1172
|
+
* text block, anything else as a text block. The host keeps only the latest
|
|
1173
|
+
* update, so with `merge` an object is merged into the last one here.
|
|
1154
1174
|
*
|
|
1155
1175
|
* @param context - The context data to update
|
|
1156
1176
|
* @param merge - Whether to merge with existing context (default: true)
|
|
1157
1177
|
*/
|
|
1158
1178
|
async updateModelContext(context, merge = true) {
|
|
1159
|
-
if (!this._hostCapabilities.modelContextUpdate) {
|
|
1179
|
+
if (!this._hostCapabilities.updateModelContext && !this._hostCapabilities.modelContextUpdate) {
|
|
1160
1180
|
throw new ExtAppsNotSupportedError("Model context update not supported by host");
|
|
1161
1181
|
}
|
|
1162
|
-
|
|
1182
|
+
const isObject = typeof context === "object" && context !== null && !Array.isArray(context);
|
|
1183
|
+
const structuredContent = isObject ? { ...merge ? this.modelContext : void 0, ...context } : void 0;
|
|
1184
|
+
this.modelContext = structuredContent;
|
|
1185
|
+
const sentContext = structuredContent ?? context;
|
|
1186
|
+
const text = typeof sentContext === "string" ? sentContext : JSON.stringify(sentContext);
|
|
1187
|
+
await this._sendRequest("ui/update-model-context", {
|
|
1188
|
+
content: [{ type: "text", text }],
|
|
1189
|
+
...structuredContent ? { structuredContent } : {}
|
|
1190
|
+
});
|
|
1163
1191
|
}
|
|
1164
1192
|
/**
|
|
1165
1193
|
* Send a log message to the host.
|
|
1166
1194
|
*
|
|
1167
1195
|
* Allows the widget to forward log messages to the host for debugging
|
|
1168
|
-
* or monitoring purposes
|
|
1196
|
+
* or monitoring purposes, with the standard MCP `notifications/message`.
|
|
1169
1197
|
*
|
|
1170
1198
|
* @param level - Log level (debug, info, warn, error)
|
|
1171
1199
|
* @param message - Log message
|
|
@@ -1177,7 +1205,10 @@ var ExtAppsAdapter = class extends BaseAdapter {
|
|
|
1177
1205
|
logFn(`[Widget] ${message}`, data);
|
|
1178
1206
|
return;
|
|
1179
1207
|
}
|
|
1180
|
-
|
|
1208
|
+
this._sendNotification("notifications/message", {
|
|
1209
|
+
level: level === "warn" ? "warning" : level,
|
|
1210
|
+
data: data === void 0 ? message : { message, data }
|
|
1211
|
+
});
|
|
1181
1212
|
}
|
|
1182
1213
|
/**
|
|
1183
1214
|
* Register a widget-defined tool.
|
|
@@ -1239,6 +1270,18 @@ var ExtAppsAdapter = class extends BaseAdapter {
|
|
|
1239
1270
|
this._handleNotification(data);
|
|
1240
1271
|
return;
|
|
1241
1272
|
}
|
|
1273
|
+
if ("method" in data && "id" in data) {
|
|
1274
|
+
this._handleHostRequest(data, event.origin);
|
|
1275
|
+
}
|
|
1276
|
+
}
|
|
1277
|
+
/**
|
|
1278
|
+
* Handle a JSON-RPC request from the host. `ui/resource-teardown` means the host is about to
|
|
1279
|
+
* unmount the widget: emit `bridge:teardown` for cleanup, then answer `{}` to the origin it came from.
|
|
1280
|
+
*/
|
|
1281
|
+
_handleHostRequest(request, origin) {
|
|
1282
|
+
if (request.method !== "ui/resource-teardown") return;
|
|
1283
|
+
this._emitBridgeEvent("bridge:teardown", {});
|
|
1284
|
+
this._postMessage({ jsonrpc: "2.0", id: request.id, result: {} }, origin);
|
|
1242
1285
|
}
|
|
1243
1286
|
/**
|
|
1244
1287
|
* Handle JSON-RPC response.
|
|
@@ -1273,6 +1316,7 @@ var ExtAppsAdapter = class extends BaseAdapter {
|
|
|
1273
1316
|
break;
|
|
1274
1317
|
case "ui/notifications/initialized":
|
|
1275
1318
|
break;
|
|
1319
|
+
case "ui/notifications/tool-cancelled":
|
|
1276
1320
|
case "ui/notifications/cancelled":
|
|
1277
1321
|
this._handleCancelled(notification.params);
|
|
1278
1322
|
break;
|
|
@@ -1315,6 +1359,9 @@ var ExtAppsAdapter = class extends BaseAdapter {
|
|
|
1315
1359
|
if (params.displayMode !== void 0) {
|
|
1316
1360
|
changes.displayMode = params.displayMode;
|
|
1317
1361
|
}
|
|
1362
|
+
if (params.availableDisplayModes !== void 0) {
|
|
1363
|
+
changes.availableDisplayModes = params.availableDisplayModes;
|
|
1364
|
+
}
|
|
1318
1365
|
if (params.viewport !== void 0) {
|
|
1319
1366
|
changes.viewport = params.viewport;
|
|
1320
1367
|
}
|
|
@@ -1417,7 +1464,8 @@ var ExtAppsAdapter = class extends BaseAdapter {
|
|
|
1417
1464
|
appCapabilities: {
|
|
1418
1465
|
tools: {
|
|
1419
1466
|
listChanged: false
|
|
1420
|
-
}
|
|
1467
|
+
},
|
|
1468
|
+
availableDisplayModes: [...MCP_APPS_DISPLAY_MODES]
|
|
1421
1469
|
},
|
|
1422
1470
|
protocolVersion: this._config.options?.protocolVersion || "2024-11-05"
|
|
1423
1471
|
};
|
|
@@ -1430,9 +1478,9 @@ var ExtAppsAdapter = class extends BaseAdapter {
|
|
|
1430
1478
|
this._hostCapabilities = result.hostCapabilities || {};
|
|
1431
1479
|
this._capabilities = {
|
|
1432
1480
|
...this._capabilities,
|
|
1433
|
-
canCallTools: Boolean(this._hostCapabilities.serverToolProxy),
|
|
1481
|
+
canCallTools: Boolean(this._hostCapabilities.serverTools || this._hostCapabilities.serverToolProxy),
|
|
1434
1482
|
canSendMessages: true,
|
|
1435
|
-
canOpenLinks: Boolean(this._hostCapabilities.openLink),
|
|
1483
|
+
canOpenLinks: Boolean(this._hostCapabilities.openLinks || this._hostCapabilities.openLink),
|
|
1436
1484
|
supportsDisplayModes: true
|
|
1437
1485
|
};
|
|
1438
1486
|
if (result.hostContext) {
|
package/esm/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@frontmcp/ui",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.4",
|
|
4
4
|
"description": "FrontMCP UI - MUI-based React components, renderers, and MCP bridge for MCP applications",
|
|
5
5
|
"author": "AgentFront <info@agentfront.dev>",
|
|
6
6
|
"homepage": "https://docs.agentfront.dev",
|
|
@@ -439,7 +439,7 @@
|
|
|
439
439
|
}
|
|
440
440
|
},
|
|
441
441
|
"optionalDependencies": {
|
|
442
|
-
"@frontmcp/uipack": "1.9.
|
|
442
|
+
"@frontmcp/uipack": "1.9.4"
|
|
443
443
|
},
|
|
444
444
|
"devDependencies": {
|
|
445
445
|
"@types/dompurify": "^3.0.0",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@frontmcp/ui",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.4",
|
|
4
4
|
"description": "FrontMCP UI - MUI-based React components, renderers, and MCP bridge for MCP applications",
|
|
5
5
|
"author": "AgentFront <info@agentfront.dev>",
|
|
6
6
|
"homepage": "https://docs.agentfront.dev",
|
|
@@ -439,7 +439,7 @@
|
|
|
439
439
|
}
|
|
440
440
|
},
|
|
441
441
|
"optionalDependencies": {
|
|
442
|
-
"@frontmcp/uipack": "1.9.
|
|
442
|
+
"@frontmcp/uipack": "1.9.4"
|
|
443
443
|
},
|
|
444
444
|
"devDependencies": {
|
|
445
445
|
"@types/dompurify": "^3.0.0",
|