@epam/ai-dial-mcp-apps 1.1.0-dev.459 → 1.1.0-dev.467
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/components/McpAppInlinePreview/McpAppInlinePreview.d.ts +2 -0
- package/components/McpAppInlinePreview/McpAppInlinePreview.d.ts.map +1 -1
- package/constants/mcp-protocol.d.ts +17 -0
- package/constants/mcp-protocol.d.ts.map +1 -0
- package/constants.js +7 -0
- package/hooks/useMcpAppInlinePreview/useMcpAppInlinePreview.d.ts +6 -2
- package/hooks/useMcpAppInlinePreview/useMcpAppInlinePreview.d.ts.map +1 -1
- package/index.d.ts +1 -0
- package/index.d.ts.map +1 -1
- package/index.js +104 -96
- package/package.json +8 -3
|
@@ -17,6 +17,8 @@ export interface McpAppInlinePreviewProps {
|
|
|
17
17
|
expandAriaLabel: string;
|
|
18
18
|
/** Accessible label for the reload button. */
|
|
19
19
|
reloadAriaLabel: string;
|
|
20
|
+
/** Accessible name for the header's actions group. Defaults to `'MCP app actions'`. */
|
|
21
|
+
actionsGroupAriaLabel?: string;
|
|
20
22
|
/** Message shown when the resource fails to load or the app fails to initialize. */
|
|
21
23
|
loadErrorLabel: string;
|
|
22
24
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"McpAppInlinePreview.d.ts","sourceRoot":"","sources":["../../../src/components/McpAppInlinePreview/McpAppInlinePreview.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"McpAppInlinePreview.d.ts","sourceRoot":"","sources":["../../../src/components/McpAppInlinePreview/McpAppInlinePreview.tsx"],"names":[],"mappings":"AAgBA,OAAO,EAEL,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACvB,KAAK,aAAa,EACnB,MAAM,uBAAuB,CAAC;AAE/B,qDAAqD;AACrD,MAAM,WAAW,wBAAwB;IACvC,uCAAuC;IACvC,KAAK,EAAE,aAAa,CAAC;IACrB,sFAAsF;IACtF,QAAQ,CAAC,EAAE,kBAAkB,CAAC;IAC9B,uIAAuI;IACvI,KAAK,EAAE,mBAAmB,CAAC;IAC3B,gEAAgE;IAChE,QAAQ,EAAE,MAAM,CAAC;IACjB,6GAA6G;IAC7G,WAAW,EAAE,iBAAiB,CAAC;IAC/B,kEAAkE;IAClE,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,wDAAwD;IACxD,eAAe,EAAE,MAAM,CAAC;IACxB,8CAA8C;IAC9C,eAAe,EAAE,MAAM,CAAC;IACxB,uFAAuF;IACvF,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,oFAAoF;IACpF,cAAc,EAAE,MAAM,CAAC;CACxB;AAyHD,iHAAiH;AACjH,eAAO,MAAM,mBAAmB,gEAAgC,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** MCP protocol version advertised in the `initialize` handshake. */
|
|
2
|
+
export declare const MCP_PROTOCOL_VERSION = "2024-11-05";
|
|
3
|
+
/** Header the MCP Streamable HTTP transport uses to carry the session id. */
|
|
4
|
+
export declare const MCP_SESSION_ID_HEADER = "mcp-session-id";
|
|
5
|
+
/**
|
|
6
|
+
* Header carrying the protocol version the server negotiated in its
|
|
7
|
+
* `initialize` result. The MCP lifecycle requires it on every request that
|
|
8
|
+
* follows a completed handshake, so a server that supports several versions
|
|
9
|
+
* keeps answering in the one it agreed on.
|
|
10
|
+
*/
|
|
11
|
+
export declare const MCP_PROTOCOL_VERSION_HEADER = "mcp-protocol-version";
|
|
12
|
+
/** Client identity advertised in the `initialize` handshake. */
|
|
13
|
+
export declare const MCP_CLIENT_INFO: {
|
|
14
|
+
name: string;
|
|
15
|
+
version: string;
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=mcp-protocol.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-protocol.d.ts","sourceRoot":"","sources":["../../src/constants/mcp-protocol.ts"],"names":[],"mappings":"AAOA,qEAAqE;AACrE,eAAO,MAAM,oBAAoB,eAAe,CAAC;AAEjD,6EAA6E;AAC7E,eAAO,MAAM,qBAAqB,mBAAmB,CAAC;AAEtD;;;;;GAKG;AACH,eAAO,MAAM,2BAA2B,yBAAyB,CAAC;AAElE,gEAAgE;AAChE,eAAO,MAAM,eAAe;;;CAA6C,CAAC"}
|
package/constants.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
//#region src/constants/mcp-protocol.ts
|
|
2
|
+
var e = "2024-11-05", t = "mcp-session-id", n = "mcp-protocol-version", r = {
|
|
3
|
+
name: "ai-dial-chat",
|
|
4
|
+
version: "1.0.0"
|
|
5
|
+
};
|
|
6
|
+
//#endregion
|
|
7
|
+
export { r as MCP_CLIENT_INFO, e as MCP_PROTOCOL_VERSION, n as MCP_PROTOCOL_VERSION_HEADER, t as MCP_SESSION_ID_HEADER };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { McpAppCanvasContent } from '@epam/ai-dial-attachment-canvas';
|
|
1
|
+
import { McpAppCanvasContent, McpAppDisplayMode } from '@epam/ai-dial-attachment-canvas';
|
|
2
2
|
import { McpAppInlinePreviewStatus, McpAppHostAdapter, McpAppResponseCache, McpAppToolCallSeed, McpAppToolRef } from '../../models/mcp-apps';
|
|
3
3
|
/** State returned by `useMcpAppInlinePreview`. */
|
|
4
4
|
export interface McpAppInlinePreviewState {
|
|
@@ -23,6 +23,10 @@ export interface McpAppInlinePreviewState {
|
|
|
23
23
|
* fetching — switching from this preview to the full canvas (or back) for
|
|
24
24
|
* the same message reuses the same fetch/live-tool-re-call instead of
|
|
25
25
|
* repeating it. Call the returned `reload` to bypass and refresh it.
|
|
26
|
+
*
|
|
27
|
+
* `onRequestDisplayMode`, when passed, is forwarded to the mounted app's
|
|
28
|
+
* `ui/request-display-mode` handler — this hook has no opinion on surface
|
|
29
|
+
* switching, so the host decides what a mode request does.
|
|
26
30
|
*/
|
|
27
|
-
export declare const useMcpAppInlinePreview: (match: McpAppToolRef | undefined, toolCall: McpAppToolCallSeed | undefined, cache: McpAppResponseCache, cacheKey: string, hostAdapter: McpAppHostAdapter) => McpAppInlinePreviewState;
|
|
31
|
+
export declare const useMcpAppInlinePreview: (match: McpAppToolRef | undefined, toolCall: McpAppToolCallSeed | undefined, cache: McpAppResponseCache, cacheKey: string, hostAdapter: McpAppHostAdapter, onRequestDisplayMode?: (mode: McpAppDisplayMode) => McpAppDisplayMode | void) => McpAppInlinePreviewState;
|
|
28
32
|
//# sourceMappingURL=useMcpAppInlinePreview.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMcpAppInlinePreview.d.ts","sourceRoot":"","sources":["../../../src/hooks/useMcpAppInlinePreview/useMcpAppInlinePreview.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,mBAAmB,
|
|
1
|
+
{"version":3,"file":"useMcpAppInlinePreview.d.ts","sourceRoot":"","sources":["../../../src/hooks/useMcpAppInlinePreview/useMcpAppInlinePreview.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACvB,MAAM,iCAAiC,CAAC;AAGzC,OAAO,EACL,yBAAyB,EACzB,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACvB,KAAK,aAAa,EACnB,MAAM,uBAAuB,CAAC;AAM/B,kDAAkD;AAClD,MAAM,WAAW,wBAAwB;IACvC,iDAAiD;IACjD,MAAM,EAAE,yBAAyB,CAAC;IAClC,6CAA6C;IAC7C,OAAO,CAAC,EAAE,mBAAmB,CAAC;IAC9B,+FAA+F;IAC/F,MAAM,EAAE,MAAM,IAAI,CAAC;CACpB;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,sBAAsB,GACjC,OAAO,aAAa,GAAG,SAAS,EAChC,UAAU,kBAAkB,GAAG,SAAS,EACxC,OAAO,mBAAmB,EAC1B,UAAU,MAAM,EAChB,aAAa,iBAAiB,EAC9B,uBAAuB,CAAC,IAAI,EAAE,iBAAiB,KAAK,iBAAiB,GAAG,IAAI,KAC3E,wBAgGF,CAAC"}
|
package/index.d.ts
CHANGED
|
@@ -4,4 +4,5 @@ export { useMcpAppResponseCache } from './hooks/useMcpAppResponseCache/useMcpApp
|
|
|
4
4
|
export type { McpDeploymentKind, McpAppToolDiscovery, McpAppToolRef, McpAppToolCallSeed, FetchMcpAppResourceHtml, CallMcpAppTool, CachedMcpAppResponse, McpAppResponseCache, McpAppHostAdapter, } from './models/mcp-apps';
|
|
5
5
|
export { McpAppInlinePreviewStatus } from './models/mcp-apps';
|
|
6
6
|
export { collectToolCallNames, findMcpAppForMessage, mcpAppCanvasKey, computeMcpAppSeedKey, resolveMcpAppToolCallSeed, resolveMcpAppToolResult, } from './utils/mcp-app';
|
|
7
|
+
export { MCP_CLIENT_INFO, MCP_PROTOCOL_VERSION, MCP_PROTOCOL_VERSION_HEADER, MCP_SESSION_ID_HEADER, } from './constants/mcp-protocol';
|
|
7
8
|
//# sourceMappingURL=index.d.ts.map
|
package/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,KAAK,wBAAwB,GAC9B,MAAM,sDAAsD,CAAC;AAC9D,OAAO,EACL,sBAAsB,EACtB,KAAK,wBAAwB,GAC9B,MAAM,uDAAuD,CAAC;AAC/D,OAAO,EAAE,sBAAsB,EAAE,MAAM,uDAAuD,CAAC;AAC/F,YAAY,EACV,iBAAiB,EACjB,mBAAmB,EACnB,aAAa,EACb,kBAAkB,EAClB,uBAAuB,EACvB,cAAc,EACd,oBAAoB,EACpB,mBAAmB,EACnB,iBAAiB,GAClB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EACL,oBAAoB,EACpB,oBAAoB,EACpB,eAAe,EACf,oBAAoB,EACpB,yBAAyB,EACzB,uBAAuB,GACxB,MAAM,iBAAiB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,KAAK,wBAAwB,GAC9B,MAAM,sDAAsD,CAAC;AAC9D,OAAO,EACL,sBAAsB,EACtB,KAAK,wBAAwB,GAC9B,MAAM,uDAAuD,CAAC;AAC/D,OAAO,EAAE,sBAAsB,EAAE,MAAM,uDAAuD,CAAC;AAC/F,YAAY,EACV,iBAAiB,EACjB,mBAAmB,EACnB,aAAa,EACb,kBAAkB,EAClB,uBAAuB,EACvB,cAAc,EACd,oBAAoB,EACpB,mBAAmB,EACnB,iBAAiB,GAClB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EACL,oBAAoB,EACpB,oBAAoB,EACpB,eAAe,EACf,oBAAoB,EACpB,yBAAyB,EACzB,uBAAuB,GACxB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,eAAe,EACf,oBAAoB,EACpB,2BAA2B,EAC3B,qBAAqB,GACtB,MAAM,0BAA0B,CAAC"}
|
package/index.js
CHANGED
|
@@ -1,20 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
1
|
+
import { MCP_CLIENT_INFO as e, MCP_PROTOCOL_VERSION as t, MCP_PROTOCOL_VERSION_HEADER as n, MCP_SESSION_ID_HEADER as r } from "./constants.js";
|
|
2
|
+
import { AttachmentContentType as i, McpAppCanvasRenderer as a } from "@epam/ai-dial-attachment-canvas";
|
|
3
|
+
import { DIAL_ICON_SIZE as o, DIAL_KIT_ICON_STROKE as s, ElementSize as c, GhostIconButton as l, Spinner as u } from "@epam/ai-dial-ui-kit";
|
|
4
|
+
import { IconAlertTriangle as d, IconArrowsMaximize as f, IconRefresh as p } from "@tabler/icons-react";
|
|
5
|
+
import { memo as m, useCallback as h, useEffect as g, useMemo as _, useRef as v, useState as y } from "react";
|
|
6
|
+
import { MessageRole as b } from "@epam/ai-dial-chat-shared";
|
|
7
|
+
import { jsx as x, jsxs as S } from "react/jsx-runtime";
|
|
7
8
|
//#region src/models/mcp-apps.ts
|
|
8
|
-
var
|
|
9
|
+
var C = /* @__PURE__ */ function(e) {
|
|
9
10
|
return e.Loading = "loading", e.Ready = "ready", e.Error = "error", e.Unavailable = "unavailable", e;
|
|
10
|
-
}({}),
|
|
11
|
+
}({}), w = (e) => {
|
|
11
12
|
try {
|
|
12
13
|
let t = JSON.parse(e);
|
|
13
14
|
return typeof t == "object" && t ? t : {};
|
|
14
15
|
} catch {
|
|
15
16
|
return {};
|
|
16
17
|
}
|
|
17
|
-
},
|
|
18
|
+
}, T = (e) => {
|
|
18
19
|
let t = /* @__PURE__ */ new Map();
|
|
19
20
|
for (let n of e?.tool_messages ?? []) {
|
|
20
21
|
for (let e of n.tool_calls ?? []) t.set(e.id, {
|
|
@@ -29,7 +30,7 @@ var _ = /* @__PURE__ */ function(e) {
|
|
|
29
30
|
for (let n of e?.tool_execution_history ?? []) {
|
|
30
31
|
for (let e of n.tool_calls ?? []) t.set(e.id, {
|
|
31
32
|
name: e.function.name,
|
|
32
|
-
args:
|
|
33
|
+
args: w(e.function.arguments)
|
|
33
34
|
});
|
|
34
35
|
if (n.role === "tool" && n.tool_call_id) {
|
|
35
36
|
let e = t.get(n.tool_call_id);
|
|
@@ -37,18 +38,18 @@ var _ = /* @__PURE__ */ function(e) {
|
|
|
37
38
|
}
|
|
38
39
|
}
|
|
39
40
|
return t;
|
|
40
|
-
},
|
|
41
|
+
}, E = (e) => {
|
|
41
42
|
let t = /* @__PURE__ */ new Set();
|
|
42
|
-
for (let n of e) for (let e of
|
|
43
|
+
for (let n of e) for (let e of T(n.custom_content?.state).values()) t.add(e.name);
|
|
43
44
|
return t;
|
|
44
|
-
},
|
|
45
|
-
if (t.length === 0 || e.role !==
|
|
46
|
-
let r = new Set([...
|
|
45
|
+
}, D = (e, t, n) => {
|
|
46
|
+
if (t.length === 0 || e.role !== b.Assistant) return;
|
|
47
|
+
let r = new Set([...T(e.custom_content?.state).values()].map((e) => e.name));
|
|
47
48
|
return t.find((e) => r.has(e.toolName)) || t.find((e) => e.discovery === "direct") || (n ? t[0] : void 0);
|
|
48
|
-
},
|
|
49
|
+
}, O = (e) => `${e}:mcp-app`, k = (e) => e == null ? void 0 : JSON.stringify(e.toolInput ?? null), A = (e, t) => {
|
|
49
50
|
let n = e.custom_content?.state;
|
|
50
51
|
if (!n) return;
|
|
51
|
-
let r = [...
|
|
52
|
+
let r = [...T(n).values()].reverse().find((e) => e.name === t);
|
|
52
53
|
if (r) return {
|
|
53
54
|
toolInput: r.args,
|
|
54
55
|
toolResult: r.result == null ? void 0 : { content: [{
|
|
@@ -56,137 +57,144 @@ var _ = /* @__PURE__ */ function(e) {
|
|
|
56
57
|
text: r.result
|
|
57
58
|
}] }
|
|
58
59
|
};
|
|
59
|
-
},
|
|
60
|
+
}, j = async (e, t, n) => {
|
|
60
61
|
if (!(e.discovery === "direct" || t?.toolInput != null)) return t?.toolResult;
|
|
61
62
|
try {
|
|
62
63
|
return await n(e.toolsetId, e.mcpToolName, t?.toolInput ?? {}, e.kind);
|
|
63
64
|
} catch {
|
|
64
65
|
return t?.toolResult;
|
|
65
66
|
}
|
|
66
|
-
},
|
|
67
|
-
let { hostContext:
|
|
68
|
-
|
|
69
|
-
}, [
|
|
70
|
-
if (!(
|
|
71
|
-
let a =
|
|
72
|
-
let [
|
|
67
|
+
}, M = (e, t, n, r, a, o) => {
|
|
68
|
+
let { hostContext: s, sandboxUrl: c, fetchResourceHtml: l, callTool: u } = a, [d, f] = y(), [p, m] = y(), [_, v] = y(() => e == null || c == null ? C.Unavailable : C.Loading), [b, x] = y(0), S = h(() => {
|
|
69
|
+
n.invalidate(r), x((e) => e + 1);
|
|
70
|
+
}, [n, r]), w = h(async (i) => {
|
|
71
|
+
if (!(e == null || c == null)) try {
|
|
72
|
+
let a = k(t), { html: o, toolResult: s } = await n.getOrFetch(r, a, async () => {
|
|
73
|
+
let [n, r] = await Promise.all([l(e.toolsetId, e.resourceUri), j(e, t, u)]);
|
|
73
74
|
return {
|
|
74
|
-
html:
|
|
75
|
+
html: n,
|
|
75
76
|
toolResult: r
|
|
76
77
|
};
|
|
77
78
|
});
|
|
78
|
-
if (
|
|
79
|
-
|
|
79
|
+
if (i()) return;
|
|
80
|
+
f(o), m(s), v(C.Ready);
|
|
80
81
|
} catch {
|
|
81
|
-
|
|
82
|
+
i() || v(C.Error);
|
|
82
83
|
}
|
|
83
84
|
}, [
|
|
85
|
+
e,
|
|
84
86
|
t,
|
|
87
|
+
c,
|
|
85
88
|
n,
|
|
86
|
-
s,
|
|
87
89
|
r,
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
d
|
|
90
|
+
l,
|
|
91
|
+
u
|
|
91
92
|
]);
|
|
92
|
-
|
|
93
|
-
if (
|
|
94
|
-
|
|
93
|
+
g(() => {
|
|
94
|
+
if (e == null || c == null) {
|
|
95
|
+
v(C.Unavailable);
|
|
95
96
|
return;
|
|
96
97
|
}
|
|
97
|
-
let
|
|
98
|
-
return
|
|
99
|
-
|
|
98
|
+
let t = !1;
|
|
99
|
+
return v(C.Loading), w(() => t), () => {
|
|
100
|
+
t = !0;
|
|
100
101
|
};
|
|
101
102
|
}, [
|
|
102
|
-
|
|
103
|
-
|
|
103
|
+
e,
|
|
104
|
+
c,
|
|
104
105
|
w,
|
|
105
106
|
b
|
|
106
107
|
]);
|
|
107
|
-
let
|
|
108
|
-
if (
|
|
109
|
-
return
|
|
110
|
-
}, [
|
|
111
|
-
return
|
|
112
|
-
status:
|
|
108
|
+
let T = h(async (t, n) => {
|
|
109
|
+
if (e == null) throw Error(`Tool call "${t}" failed: no matching MCP App`);
|
|
110
|
+
return u(e.toolsetId, t, n, e.kind);
|
|
111
|
+
}, [e, u]);
|
|
112
|
+
return _ !== C.Ready || e == null || c == null || d == null ? {
|
|
113
|
+
status: _,
|
|
113
114
|
reload: S
|
|
114
115
|
} : {
|
|
115
|
-
status:
|
|
116
|
+
status: _,
|
|
116
117
|
reload: S,
|
|
117
118
|
content: {
|
|
118
|
-
type:
|
|
119
|
-
html:
|
|
120
|
-
sandboxUrl:
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
119
|
+
type: i.McpApp,
|
|
120
|
+
html: d,
|
|
121
|
+
sandboxUrl: c,
|
|
122
|
+
toolInput: t?.toolInput,
|
|
123
|
+
toolResult: p,
|
|
124
|
+
hostContext: s,
|
|
125
|
+
onToolCall: T,
|
|
126
|
+
onRequestDisplayMode: o
|
|
126
127
|
}
|
|
127
128
|
};
|
|
128
|
-
},
|
|
129
|
-
let { status:
|
|
130
|
-
return
|
|
131
|
-
className: "bg-layer-2 flex w-full flex-col overflow-hidden rounded border border-tertiary",
|
|
132
|
-
children: [/* @__PURE__ */
|
|
133
|
-
className: "flex items-center justify-end
|
|
134
|
-
children:
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
}),
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
129
|
+
}, N = m(({ match: e, toolCall: t, cache: n, cacheKey: r, hostAdapter: i, onExpand: m, expandAriaLabel: g, reloadAriaLabel: _, actionsGroupAriaLabel: v = "MCP app actions", loadErrorLabel: y }) => {
|
|
130
|
+
let { status: b, content: w, reload: T } = M(e, t, n, r, i, h((e) => e === "fullscreen" ? (m(), "fullscreen") : "inline", [m]));
|
|
131
|
+
return b === C.Unavailable ? null : /* @__PURE__ */ S("div", {
|
|
132
|
+
className: "bg-layer-2 flex w-full min-w-0 flex-col overflow-hidden rounded-xl border border-tertiary",
|
|
133
|
+
children: [/* @__PURE__ */ x("div", {
|
|
134
|
+
className: "flex min-h-10 items-center justify-end border-b border-tertiary px-4 py-2",
|
|
135
|
+
children: /* @__PURE__ */ S("div", {
|
|
136
|
+
role: "toolbar",
|
|
137
|
+
"aria-label": v,
|
|
138
|
+
className: "flex items-center gap-1",
|
|
139
|
+
children: [/* @__PURE__ */ x(l, {
|
|
140
|
+
icon: /* @__PURE__ */ x(p, {
|
|
141
|
+
size: o.SM,
|
|
142
|
+
stroke: s,
|
|
143
|
+
"aria-hidden": !0
|
|
144
|
+
}),
|
|
145
|
+
"aria-label": _,
|
|
146
|
+
size: c.Small,
|
|
147
|
+
onClick: T
|
|
148
|
+
}), /* @__PURE__ */ x(l, {
|
|
149
|
+
icon: /* @__PURE__ */ x(f, {
|
|
150
|
+
size: o.SM,
|
|
151
|
+
stroke: s,
|
|
152
|
+
"aria-hidden": !0
|
|
153
|
+
}),
|
|
154
|
+
"aria-label": g,
|
|
155
|
+
size: c.Small,
|
|
156
|
+
onClick: m
|
|
157
|
+
})]
|
|
158
|
+
})
|
|
159
|
+
}), /* @__PURE__ */ S("div", {
|
|
152
160
|
className: "relative min-h-[200px] w-full",
|
|
153
161
|
children: [
|
|
154
|
-
|
|
162
|
+
b === C.Loading && /* @__PURE__ */ x("div", {
|
|
155
163
|
className: "absolute inset-0 flex items-center justify-center",
|
|
156
|
-
children: /* @__PURE__ */
|
|
164
|
+
children: /* @__PURE__ */ x(u, {})
|
|
157
165
|
}),
|
|
158
|
-
|
|
166
|
+
b === C.Error && /* @__PURE__ */ S("div", {
|
|
159
167
|
className: "absolute inset-0 flex flex-col items-center justify-center gap-2 p-4",
|
|
160
|
-
children: [/* @__PURE__ */
|
|
168
|
+
children: [/* @__PURE__ */ x(d, {
|
|
161
169
|
size: 40,
|
|
162
|
-
stroke:
|
|
170
|
+
stroke: s,
|
|
163
171
|
"aria-hidden": !0,
|
|
164
172
|
className: "text-error"
|
|
165
|
-
}), /* @__PURE__ */
|
|
173
|
+
}), /* @__PURE__ */ x("p", {
|
|
166
174
|
role: "alert",
|
|
167
175
|
className: "dial-body-text text-center text-primary",
|
|
168
|
-
children:
|
|
176
|
+
children: y
|
|
169
177
|
})]
|
|
170
178
|
}),
|
|
171
|
-
|
|
172
|
-
content:
|
|
173
|
-
errorLabel:
|
|
179
|
+
b === C.Ready && w && /* @__PURE__ */ x(a, {
|
|
180
|
+
content: w,
|
|
181
|
+
errorLabel: y
|
|
174
182
|
})
|
|
175
183
|
]
|
|
176
184
|
})]
|
|
177
185
|
});
|
|
178
|
-
}),
|
|
179
|
-
let t =
|
|
180
|
-
return
|
|
186
|
+
}), P = 900 * 1e3, F = (e) => {
|
|
187
|
+
let t = v(/* @__PURE__ */ new Map()), n = v(/* @__PURE__ */ new Map());
|
|
188
|
+
return _(() => {
|
|
181
189
|
let r = (t) => `${e}:${t}`, i = (e, t) => `${r(e)}::${t ?? ""}`, a = (e, n) => {
|
|
182
190
|
let i = t.current.get(r(e));
|
|
183
|
-
if (i != null && i.seedKey === n && !(Date.now() - i.cachedAt >
|
|
191
|
+
if (i != null && i.seedKey === n && !(Date.now() - i.cachedAt > P)) return {
|
|
184
192
|
html: i.html,
|
|
185
193
|
toolResult: i.toolResult
|
|
186
194
|
};
|
|
187
195
|
}, o = (e, n, i) => {
|
|
188
196
|
let a = Date.now();
|
|
189
|
-
for (let [e, n] of t.current) a - n.cachedAt >
|
|
197
|
+
for (let [e, n] of t.current) a - n.cachedAt > P && t.current.delete(e);
|
|
190
198
|
t.current.set(r(e), {
|
|
191
199
|
...n,
|
|
192
200
|
seedKey: i,
|
|
@@ -213,4 +221,4 @@ var _ = /* @__PURE__ */ function(e) {
|
|
|
213
221
|
}, [e]);
|
|
214
222
|
};
|
|
215
223
|
//#endregion
|
|
216
|
-
export {
|
|
224
|
+
export { e as MCP_CLIENT_INFO, t as MCP_PROTOCOL_VERSION, n as MCP_PROTOCOL_VERSION_HEADER, r as MCP_SESSION_ID_HEADER, N as McpAppInlinePreview, C as McpAppInlinePreviewStatus, E as collectToolCallNames, k as computeMcpAppSeedKey, D as findMcpAppForMessage, O as mcpAppCanvasKey, A as resolveMcpAppToolCallSeed, j as resolveMcpAppToolResult, M as useMcpAppInlinePreview, F as useMcpAppResponseCache };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@epam/ai-dial-mcp-apps",
|
|
3
3
|
"description": "Host-agnostic MCP Apps building blocks — tool-call/message matching, the response cache, and the inline preview hook/component shared by the full-width canvas and inline surfaces",
|
|
4
|
-
"version": "1.1.0-dev.
|
|
4
|
+
"version": "1.1.0-dev.467",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "./index.js",
|
|
@@ -13,11 +13,16 @@
|
|
|
13
13
|
"types": "./index.d.ts",
|
|
14
14
|
"import": "./index.js",
|
|
15
15
|
"default": "./index.js"
|
|
16
|
+
},
|
|
17
|
+
"./constants": {
|
|
18
|
+
"types": "./constants/mcp-protocol.d.ts",
|
|
19
|
+
"import": "./constants.js",
|
|
20
|
+
"default": "./constants.js"
|
|
16
21
|
}
|
|
17
22
|
},
|
|
18
23
|
"peerDependencies": {
|
|
19
|
-
"@epam/ai-dial-attachment-canvas": "1.1.0-dev.
|
|
20
|
-
"@epam/ai-dial-chat-shared": "1.1.0-dev.
|
|
24
|
+
"@epam/ai-dial-attachment-canvas": "1.1.0-dev.467",
|
|
25
|
+
"@epam/ai-dial-chat-shared": "1.1.0-dev.467",
|
|
21
26
|
"@epam/ai-dial-ui-kit": "^0.14.0-dev.15",
|
|
22
27
|
"@mcp-ui/client": "^7.1.1",
|
|
23
28
|
"@modelcontextprotocol/sdk": "^1.27.1",
|