@epam/ai-dial-mcp-apps 1.2.0-dev.61 → 1.2.0-dev.72
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 +9 -0
- package/components/McpAppInlinePreview/McpAppInlinePreview.d.ts.map +1 -1
- package/hooks/useMcpAppInlinePreview/useMcpAppInlinePreview.d.ts.map +1 -1
- package/index.css +1 -1
- package/index.js +124 -87
- package/models/mcp-apps.d.ts +3 -1
- package/models/mcp-apps.d.ts.map +1 -1
- package/package.json +3 -3
|
@@ -21,6 +21,15 @@ export interface McpAppInlinePreviewProps {
|
|
|
21
21
|
actionsGroupAriaLabel?: string;
|
|
22
22
|
/** Message shown when the resource fails to load or the app fails to initialize. */
|
|
23
23
|
loadErrorLabel: string;
|
|
24
|
+
/**
|
|
25
|
+
* Whether this message's MCP App is currently open in the full-width
|
|
26
|
+
* canvas. When `true`, the header stays (so the tool/app identity is still
|
|
27
|
+
* visible) but the body shows `openedInCanvasLabel` centered instead of
|
|
28
|
+
* mounting the app — only one live app instance exists at a time.
|
|
29
|
+
*/
|
|
30
|
+
isOpenedInCanvas?: boolean;
|
|
31
|
+
/** Message shown centered in the body when `isOpenedInCanvas` is `true`. */
|
|
32
|
+
openedInCanvasLabel: string;
|
|
24
33
|
/** Color overrides applied as CSS custom properties on the preview's root. */
|
|
25
34
|
colors?: McpAppInlinePreviewColors;
|
|
26
35
|
}
|
|
@@ -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":"AAqBA,OAAO,EAEL,KAAK,iBAAiB,EACtB,KAAK,yBAAyB,EAC9B,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACvB,KAAK,aAAa,EACnB,MAAM,uBAAuB,CAAC;AAG/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;IACvB;;;;;OAKG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,4EAA4E;IAC5E,mBAAmB,EAAE,MAAM,CAAC;IAC5B,8EAA8E;IAC9E,MAAM,CAAC,EAAE,yBAAyB,CAAC;CACpC;AAqLD,iHAAiH;AACjH,eAAO,MAAM,mBAAmB,gEAAgC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
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,
|
|
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,wBAkGF,CAAC"}
|
package/index.css
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
._preview_19as4_11{background:var(--mcpapp-preview-bg,var(--bg-layer-raised,#fcfcfc));border-color:var(--mcpapp-preview-border,var(--stroke-tertiary,#e0e6f0))}._previewHeader_19as4_23{border-bottom-color:var(--mcpapp-preview-header-border,var(--stroke-tertiary,#e0e6f0))}
|
|
2
|
-
/*$vite$:1*/.absolute{position:absolute}.relative{position:relative}.inset-0{inset:0}.block{display:block}.inline{display:inline}.flex{display:flex}.min-h-10{min-height:2.5rem}.min-h-\[200px\]{min-height:200px}.w-full{width:100%}.min-w-0{min-width:0}.flex-col{flex-direction:column}.items-center{align-items:center}.justify-
|
|
2
|
+
/*$vite$:1*/.visible{visibility:visible}.absolute{position:absolute}.relative{position:relative}.inset-0{inset:0}.mx-1{margin-left:.25rem;margin-right:.25rem}.mx-1\.5{margin-left:.375rem;margin-right:.375rem}.ms-2{margin-inline-start:.5rem}.block{display:block}.inline-block{display:inline-block}.inline{display:inline}.flex{display:flex}.h-3{height:.75rem}.min-h-10{min-height:2.5rem}.min-h-\[200px\]{min-height:200px}.w-0{width:0}.w-full{width:100%}.min-w-0{min-width:0}.shrink-0{flex-shrink:0}.flex-col{flex-direction:column}.items-center{align-items:center}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-1{gap:.25rem}.gap-2{gap:.5rem}.overflow-hidden{overflow:hidden}.rounded-xl{border-radius:.75rem}.border{border-width:1px}.border-b{border-bottom-width:1px}.border-s{border-inline-start-width:1px}.p-4{padding:1rem}.px-4{padding-left:1rem;padding-right:1rem}.py-2{padding-bottom:.5rem;padding-top:.5rem}.text-center{text-align:center}.align-middle{vertical-align:middle}.text-error{color:var(--text-error,#ae2f2f)}.text-primary{color:var(--text-primary,#161b2d)}.text-secondary{color:var(--text-secondary,#57647a)}
|
package/index.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import { AttachmentContentType as e, McpAppCanvasRenderer as t } from "@epam/ai-dial-attachment-canvas";
|
|
2
2
|
import { MessageRole as n, buildCssVars as r } from "@epam/ai-dial-chat-shared";
|
|
3
|
-
import { DIAL_ICON_SIZE as i, DIAL_KIT_ICON_STROKE as a, ElementSize as o,
|
|
4
|
-
import { IconAlertTriangle as
|
|
5
|
-
import { memo as
|
|
6
|
-
import { jsx as
|
|
3
|
+
import { DIAL_ICON_SIZE as i, DIAL_KIT_ICON_STROKE as a, ElementSize as o, EllipsisTooltip as s, GhostIconButton as c, Spinner as l, mergeClasses 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 { Fragment as b, jsx as x, jsxs as S } from "react/jsx-runtime";
|
|
7
7
|
//#region src/constants/public-class-names.ts
|
|
8
|
-
var
|
|
8
|
+
var C = {
|
|
9
9
|
preview: "dial-mcp-apps-preview",
|
|
10
10
|
previewHeader: "dial-mcp-apps-preview-header"
|
|
11
|
-
},
|
|
11
|
+
}, w = /* @__PURE__ */ function(e) {
|
|
12
12
|
return e.Loading = "loading", e.Ready = "ready", e.Error = "error", e.Unavailable = "unavailable", e;
|
|
13
|
-
}({}),
|
|
13
|
+
}({}), T = (e) => {
|
|
14
14
|
try {
|
|
15
15
|
let t = JSON.parse(e);
|
|
16
16
|
return typeof t == "object" && t ? t : {};
|
|
17
17
|
} catch {
|
|
18
18
|
return {};
|
|
19
19
|
}
|
|
20
|
-
},
|
|
20
|
+
}, E = (e) => {
|
|
21
21
|
let t = /* @__PURE__ */ new Map();
|
|
22
22
|
for (let n of e?.tool_messages ?? []) {
|
|
23
23
|
for (let e of n.tool_calls ?? []) t.set(e.id, {
|
|
@@ -32,7 +32,7 @@ var x = {
|
|
|
32
32
|
for (let n of e?.tool_execution_history ?? []) {
|
|
33
33
|
for (let e of n.tool_calls ?? []) t.set(e.id, {
|
|
34
34
|
name: e.function.name,
|
|
35
|
-
args:
|
|
35
|
+
args: T(e.function.arguments)
|
|
36
36
|
});
|
|
37
37
|
if (n.role === "tool" && n.tool_call_id) {
|
|
38
38
|
let e = t.get(n.tool_call_id);
|
|
@@ -40,18 +40,18 @@ var x = {
|
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
return t;
|
|
43
|
-
},
|
|
43
|
+
}, D = (e) => {
|
|
44
44
|
let t = /* @__PURE__ */ new Set();
|
|
45
|
-
for (let n of e) for (let e of
|
|
45
|
+
for (let n of e) for (let e of E(n.custom_content?.state).values()) t.add(e.name);
|
|
46
46
|
return t;
|
|
47
|
-
},
|
|
47
|
+
}, O = (e, t, r) => {
|
|
48
48
|
if (t.length === 0 || e.role !== n.Assistant) return;
|
|
49
|
-
let i = new Set([...
|
|
49
|
+
let i = new Set([...E(e.custom_content?.state).values()].map((e) => e.name));
|
|
50
50
|
return t.find((e) => i.has(e.toolName)) || t.find((e) => e.discovery === "direct") || (r ? t[0] : void 0);
|
|
51
|
-
},
|
|
51
|
+
}, k = (e) => `${e}:mcp-app`, A = (e) => e == null ? void 0 : JSON.stringify(e.toolInput ?? null), j = (e, t) => {
|
|
52
52
|
let n = e.custom_content?.state;
|
|
53
53
|
if (!n) return;
|
|
54
|
-
let r = [...
|
|
54
|
+
let r = [...E(n).values()].reverse().find((e) => e.name === t);
|
|
55
55
|
if (r) return {
|
|
56
56
|
toolInput: r.args,
|
|
57
57
|
toolResult: r.result == null ? void 0 : { content: [{
|
|
@@ -59,152 +59,189 @@ var x = {
|
|
|
59
59
|
text: r.result
|
|
60
60
|
}] }
|
|
61
61
|
};
|
|
62
|
-
},
|
|
62
|
+
}, M = async (e, t, n) => {
|
|
63
63
|
if (!(e.discovery === "direct" || t?.toolInput != null)) return t?.toolResult;
|
|
64
64
|
try {
|
|
65
65
|
return await n(e.toolsetId, e.mcpToolName, t?.toolInput ?? {}, e.kind);
|
|
66
66
|
} catch {
|
|
67
67
|
return t?.toolResult;
|
|
68
68
|
}
|
|
69
|
-
},
|
|
70
|
-
let { hostContext: s,
|
|
71
|
-
r.invalidate(i),
|
|
72
|
-
}, [r, i]),
|
|
73
|
-
if (!(t == null ||
|
|
74
|
-
let a =
|
|
75
|
-
let [e, r] = await Promise.all([
|
|
69
|
+
}, N = (t, n, r, i, a, o) => {
|
|
70
|
+
let { hostContext: s, hostInfo: c, sandboxUrl: l, fetchResourceHtml: u, callTool: d } = a, [f, p] = y(), [m, _] = y(), [v, b] = y(() => t == null || l == null ? w.Unavailable : w.Loading), [x, S] = y(0), C = h(() => {
|
|
71
|
+
r.invalidate(i), S((e) => e + 1);
|
|
72
|
+
}, [r, i]), T = h(async (e) => {
|
|
73
|
+
if (!(t == null || l == null)) try {
|
|
74
|
+
let a = A(n), { html: o, toolResult: s } = await r.getOrFetch(i, a, async () => {
|
|
75
|
+
let [e, r] = await Promise.all([u(t.toolsetId, t.resourceUri), M(t, n, d)]);
|
|
76
76
|
return {
|
|
77
77
|
html: e,
|
|
78
78
|
toolResult: r
|
|
79
79
|
};
|
|
80
80
|
});
|
|
81
81
|
if (e()) return;
|
|
82
|
-
|
|
82
|
+
p(o), _(s), b(w.Ready);
|
|
83
83
|
} catch {
|
|
84
|
-
e() ||
|
|
84
|
+
e() || b(w.Error);
|
|
85
85
|
}
|
|
86
86
|
}, [
|
|
87
87
|
t,
|
|
88
88
|
n,
|
|
89
|
-
|
|
89
|
+
l,
|
|
90
90
|
r,
|
|
91
91
|
i,
|
|
92
|
-
|
|
93
|
-
|
|
92
|
+
u,
|
|
93
|
+
d
|
|
94
94
|
]);
|
|
95
|
-
|
|
96
|
-
if (t == null ||
|
|
97
|
-
|
|
95
|
+
g(() => {
|
|
96
|
+
if (t == null || l == null) {
|
|
97
|
+
b(w.Unavailable);
|
|
98
98
|
return;
|
|
99
99
|
}
|
|
100
100
|
let e = !1;
|
|
101
|
-
return
|
|
101
|
+
return b(w.Loading), T(() => e), () => {
|
|
102
102
|
e = !0;
|
|
103
103
|
};
|
|
104
104
|
}, [
|
|
105
105
|
t,
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
106
|
+
l,
|
|
107
|
+
T,
|
|
108
|
+
x
|
|
109
109
|
]);
|
|
110
|
-
let
|
|
110
|
+
let E = h(async (e, n) => {
|
|
111
111
|
if (t == null) throw Error(`Tool call "${e}" failed: no matching MCP App`);
|
|
112
|
-
return
|
|
113
|
-
}, [t,
|
|
114
|
-
return
|
|
115
|
-
status:
|
|
112
|
+
return d(t.toolsetId, e, n, t.kind);
|
|
113
|
+
}, [t, d]);
|
|
114
|
+
return v !== w.Ready || t == null || l == null || f == null ? {
|
|
115
|
+
status: v,
|
|
116
116
|
reload: C
|
|
117
117
|
} : {
|
|
118
|
-
status:
|
|
118
|
+
status: v,
|
|
119
119
|
reload: C,
|
|
120
120
|
content: {
|
|
121
121
|
type: e.McpApp,
|
|
122
|
-
html:
|
|
123
|
-
sandboxUrl:
|
|
122
|
+
html: f,
|
|
123
|
+
sandboxUrl: l,
|
|
124
124
|
toolInput: n?.toolInput,
|
|
125
|
-
toolResult:
|
|
125
|
+
toolResult: m,
|
|
126
126
|
hostContext: s,
|
|
127
|
-
|
|
127
|
+
hostInfo: c,
|
|
128
|
+
onToolCall: E,
|
|
128
129
|
onRequestDisplayMode: o
|
|
129
130
|
}
|
|
130
131
|
};
|
|
131
|
-
},
|
|
132
|
+
}, P = {
|
|
132
133
|
preview: "_preview_19as4_11",
|
|
133
134
|
previewHeader: "_previewHeader_19as4_23"
|
|
134
|
-
},
|
|
135
|
-
let
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
135
|
+
}, F = m(({ match: e, toolCall: n, cache: m, cacheKey: _, hostAdapter: v, onExpand: T, expandAriaLabel: E, reloadAriaLabel: D, actionsGroupAriaLabel: O = "MCP app actions", loadErrorLabel: k, isOpenedInCanvas: A = !1, openedInCanvasLabel: j, colors: M }) => {
|
|
136
|
+
let [F, I] = y(void 0);
|
|
137
|
+
g(() => {
|
|
138
|
+
I(void 0);
|
|
139
|
+
}, [_]);
|
|
140
|
+
let L = h((e) => e === "fullscreen" ? (T(), "fullscreen") : "inline", [T]), R = r({
|
|
141
|
+
"--mcpapp-preview-bg": M?.previewBackground,
|
|
142
|
+
"--mcpapp-preview-border": M?.previewBorder,
|
|
143
|
+
"--mcpapp-preview-header-border": M?.previewHeaderBorder
|
|
144
|
+
}), { status: z, content: B, reload: V } = N(e, n, m, _, v, L);
|
|
145
|
+
return z === w.Unavailable ? null : /* @__PURE__ */ S("div", {
|
|
146
|
+
style: R,
|
|
147
|
+
className: u(P.preview, "flex w-full min-w-0 flex-col overflow-hidden rounded-xl border", C.preview),
|
|
148
|
+
children: [/* @__PURE__ */ S("div", {
|
|
149
|
+
className: u(P.previewHeader, "flex min-h-10 items-center justify-between gap-2 border-b px-4 py-2", C.previewHeader),
|
|
150
|
+
children: [/* @__PURE__ */ x(s, {
|
|
151
|
+
text: F == null ? /* @__PURE__ */ x("span", {
|
|
152
|
+
className: "dial-tiny-lead-semi-text",
|
|
153
|
+
children: e.mcpToolName
|
|
154
|
+
}) : /* @__PURE__ */ S(b, { children: [
|
|
155
|
+
/* @__PURE__ */ x("span", {
|
|
156
|
+
className: "dial-tiny-lead-semi-text",
|
|
157
|
+
children: e.mcpToolName
|
|
158
|
+
}),
|
|
159
|
+
/* @__PURE__ */ x("span", {
|
|
160
|
+
"aria-hidden": !0,
|
|
161
|
+
className: "border-current mx-1.5 inline-block h-3 w-0 border-s align-middle"
|
|
162
|
+
}),
|
|
163
|
+
/* @__PURE__ */ x("span", {
|
|
164
|
+
className: "dial-tiny-lead-semi-text",
|
|
165
|
+
children: F.name
|
|
166
|
+
}),
|
|
167
|
+
F.version && /* @__PURE__ */ x("span", {
|
|
168
|
+
className: "dial-caption-text ms-2",
|
|
169
|
+
children: F.version
|
|
170
|
+
})
|
|
171
|
+
] }),
|
|
172
|
+
className: "text-secondary"
|
|
173
|
+
}), /* @__PURE__ */ S("div", {
|
|
146
174
|
role: "toolbar",
|
|
147
|
-
"aria-label":
|
|
148
|
-
className: "flex items-center gap-1",
|
|
149
|
-
children: [/* @__PURE__ */
|
|
150
|
-
icon: /* @__PURE__ */
|
|
175
|
+
"aria-label": O,
|
|
176
|
+
className: "flex shrink-0 items-center gap-1",
|
|
177
|
+
children: [/* @__PURE__ */ x(c, {
|
|
178
|
+
icon: /* @__PURE__ */ x(p, {
|
|
151
179
|
size: i.SM,
|
|
152
180
|
stroke: a,
|
|
153
181
|
"aria-hidden": !0
|
|
154
182
|
}),
|
|
155
|
-
"aria-label":
|
|
183
|
+
"aria-label": D,
|
|
156
184
|
size: o.Small,
|
|
157
|
-
onClick:
|
|
158
|
-
}), /* @__PURE__ */
|
|
159
|
-
icon: /* @__PURE__ */
|
|
185
|
+
onClick: V
|
|
186
|
+
}), /* @__PURE__ */ x(c, {
|
|
187
|
+
icon: /* @__PURE__ */ x(f, {
|
|
160
188
|
size: i.SM,
|
|
161
189
|
stroke: a,
|
|
162
190
|
"aria-hidden": !0
|
|
163
191
|
}),
|
|
164
|
-
"aria-label":
|
|
192
|
+
"aria-label": E,
|
|
165
193
|
size: o.Small,
|
|
166
|
-
onClick:
|
|
194
|
+
onClick: T
|
|
167
195
|
})]
|
|
168
|
-
})
|
|
169
|
-
}), /* @__PURE__ */
|
|
196
|
+
})]
|
|
197
|
+
}), /* @__PURE__ */ x("div", {
|
|
170
198
|
className: "relative min-h-[200px] w-full",
|
|
171
|
-
children:
|
|
172
|
-
|
|
199
|
+
children: A ? /* @__PURE__ */ x("div", {
|
|
200
|
+
role: "status",
|
|
201
|
+
"aria-live": "polite",
|
|
202
|
+
className: "absolute inset-0 flex items-center justify-center p-4",
|
|
203
|
+
children: /* @__PURE__ */ x("span", {
|
|
204
|
+
className: "dial-body-text text-center text-secondary",
|
|
205
|
+
children: j
|
|
206
|
+
})
|
|
207
|
+
}) : /* @__PURE__ */ S(b, { children: [
|
|
208
|
+
z === w.Loading && /* @__PURE__ */ x("div", {
|
|
173
209
|
className: "absolute inset-0 flex items-center justify-center",
|
|
174
|
-
children: /* @__PURE__ */
|
|
210
|
+
children: /* @__PURE__ */ x(l, {})
|
|
175
211
|
}),
|
|
176
|
-
|
|
212
|
+
z === w.Error && /* @__PURE__ */ S("div", {
|
|
177
213
|
className: "absolute inset-0 flex flex-col items-center justify-center gap-2 p-4",
|
|
178
|
-
children: [/* @__PURE__ */
|
|
214
|
+
children: [/* @__PURE__ */ x(d, {
|
|
179
215
|
size: 40,
|
|
180
216
|
stroke: a,
|
|
181
217
|
"aria-hidden": !0,
|
|
182
218
|
className: "text-error"
|
|
183
|
-
}), /* @__PURE__ */
|
|
219
|
+
}), /* @__PURE__ */ x("p", {
|
|
184
220
|
role: "alert",
|
|
185
221
|
className: "dial-body-text text-center text-primary",
|
|
186
|
-
children:
|
|
222
|
+
children: k
|
|
187
223
|
})]
|
|
188
224
|
}),
|
|
189
|
-
|
|
190
|
-
content:
|
|
191
|
-
errorLabel:
|
|
225
|
+
z === w.Ready && B && /* @__PURE__ */ x(t, {
|
|
226
|
+
content: B,
|
|
227
|
+
errorLabel: k,
|
|
228
|
+
onAppInfo: I
|
|
192
229
|
})
|
|
193
|
-
]
|
|
230
|
+
] })
|
|
194
231
|
})]
|
|
195
232
|
});
|
|
196
|
-
}),
|
|
197
|
-
let t =
|
|
198
|
-
return
|
|
233
|
+
}), I = 900 * 1e3, L = (e) => {
|
|
234
|
+
let t = v(/* @__PURE__ */ new Map()), n = v(/* @__PURE__ */ new Map());
|
|
235
|
+
return _(() => {
|
|
199
236
|
let r = (t) => `${e}:${t}`, i = (e, t) => `${r(e)}::${t ?? ""}`, a = (e, n) => {
|
|
200
237
|
let i = t.current.get(r(e));
|
|
201
|
-
if (i != null && i.seedKey === n && !(Date.now() - i.cachedAt >
|
|
238
|
+
if (i != null && i.seedKey === n && !(Date.now() - i.cachedAt > I)) return {
|
|
202
239
|
html: i.html,
|
|
203
240
|
toolResult: i.toolResult
|
|
204
241
|
};
|
|
205
242
|
}, o = (e, n, i) => {
|
|
206
243
|
let a = Date.now();
|
|
207
|
-
for (let [e, n] of t.current) a - n.cachedAt >
|
|
244
|
+
for (let [e, n] of t.current) a - n.cachedAt > I && t.current.delete(e);
|
|
208
245
|
t.current.set(r(e), {
|
|
209
246
|
...n,
|
|
210
247
|
seedKey: i,
|
|
@@ -231,4 +268,4 @@ var x = {
|
|
|
231
268
|
}, [e]);
|
|
232
269
|
};
|
|
233
270
|
//#endregion
|
|
234
|
-
export {
|
|
271
|
+
export { C as MCP_APPS_CLASS, F as McpAppInlinePreview, w as McpAppInlinePreviewStatus, D as collectToolCallNames, A as computeMcpAppSeedKey, O as findMcpAppForMessage, k as mcpAppCanvasKey, j as resolveMcpAppToolCallSeed, M as resolveMcpAppToolResult, N as useMcpAppInlinePreview, L as useMcpAppResponseCache };
|
package/models/mcp-apps.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { McpUiHostContext } from '@mcp-ui/client';
|
|
2
|
-
import { CallToolResult } from '@modelcontextprotocol/sdk/types.js';
|
|
2
|
+
import { CallToolResult, Implementation } from '@modelcontextprotocol/sdk/types.js';
|
|
3
3
|
/** Which of the host's two MCP proxy routes a deployment id resolves through — a plain toolset, or an application that is itself an MCP server. */
|
|
4
4
|
export type McpDeploymentKind = 'toolset' | 'application';
|
|
5
5
|
/**
|
|
@@ -92,6 +92,8 @@ export declare enum McpAppInlinePreviewStatus {
|
|
|
92
92
|
export interface McpAppHostAdapter {
|
|
93
93
|
/** `McpUiHostContext` to deliver to the mounted app's `ui/initialize` handshake. */
|
|
94
94
|
hostContext: McpUiHostContext;
|
|
95
|
+
/** Host identity (`name`/`version`) to deliver to the mounted app's `ui/initialize` handshake. */
|
|
96
|
+
hostInfo: Implementation;
|
|
95
97
|
/** Operator-configured MCP Apps sandbox-proxy URL, or `null` when unconfigured. */
|
|
96
98
|
sandboxUrl: string | null;
|
|
97
99
|
/** Fetches the matched tool's MCP Apps `ui://` resource. */
|
package/models/mcp-apps.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-apps.d.ts","sourceRoot":"","sources":["../../src/models/mcp-apps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"mcp-apps.d.ts","sourceRoot":"","sources":["../../src/models/mcp-apps.ts"],"names":[],"mappings":"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"}
|
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.2.0-dev.
|
|
4
|
+
"version": "1.2.0-dev.72",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "./index.js",
|
|
@@ -20,10 +20,10 @@
|
|
|
20
20
|
"@tabler/icons-react": "^3.44.0",
|
|
21
21
|
"@mcp-ui/client": "^7.1.1",
|
|
22
22
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
23
|
-
"@epam/ai-dial-attachment-canvas": "1.2.0-dev.
|
|
23
|
+
"@epam/ai-dial-attachment-canvas": "1.2.0-dev.72"
|
|
24
24
|
},
|
|
25
25
|
"peerDependencies": {
|
|
26
|
-
"@epam/ai-dial-chat-shared": "1.2.0-dev.
|
|
26
|
+
"@epam/ai-dial-chat-shared": "1.2.0-dev.72",
|
|
27
27
|
"@epam/ai-dial-ui-kit": "^0.15.0-dev.9",
|
|
28
28
|
"react": "^19.2.8"
|
|
29
29
|
},
|