@epam/ai-dial-mcp-apps 1.4.0-dev.176 → 1.4.0-dev.180
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.
|
@@ -31,9 +31,9 @@ export interface McpAppInlinePreviewProps {
|
|
|
31
31
|
onRendererError?: (error: Error) => void;
|
|
32
32
|
/**
|
|
33
33
|
* Whether this message's MCP App is currently open in the full-width
|
|
34
|
-
* canvas. When `true`, the header
|
|
35
|
-
*
|
|
36
|
-
*
|
|
34
|
+
* canvas. When `true`, the header's actions stay but the body shows
|
|
35
|
+
* `openedInCanvasLabel` centered instead of mounting the app — only one
|
|
36
|
+
* live app instance exists at a time.
|
|
37
37
|
*/
|
|
38
38
|
isOpenedInCanvas?: boolean;
|
|
39
39
|
/** Message shown centered in the body when `isOpenedInCanvas` is `true`. */
|
|
@@ -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":"AA6BA,OAAO,EAEL,KAAK,iBAAiB,EACtB,KAAK,yBAAyB,EAC9B,KAAK,6BAA6B,EAClC,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACvB,KAAK,aAAa,EACnB,MAAM,uBAAuB,CAAC;AAuB/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,8FAA8F;IAC9F,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;;;OAIG;IACH,eAAe,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IACzC;;;;;OAKG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,4EAA4E;IAC5E,mBAAmB,EAAE,MAAM,CAAC;IAC5B,8EAA8E;IAC9E,MAAM,CAAC,EAAE,yBAAyB,CAAC;IACnC,sEAAsE;IACtE,UAAU,CAAC,EAAE,6BAA6B,CAAC;CAC5C;AA8MD,iHAAiH;AACjH,eAAO,MAAM,mBAAmB,gEAAgC,CAAC"}
|
package/index.css
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
.
|
|
1
|
+
._preview_1ia27_10{background:var(--mcpapp-preview-bg,var(--bg-layer-raised,#fcfcfc));border-color:var(--mcpapp-preview-border,var(--stroke-tertiary,#e0e6f0))}._previewHeader_1ia27_22{border-bottom-color:var(--mcpapp-preview-header-border,var(--stroke-tertiary,#e0e6f0))}._placeholderText_1ia27_26{color:var(--mcpapp-placeholder-text,var(--text-secondary,#57647a))}._errorIcon_1ia27_30{color:var(--mcpapp-error-icon,var(--text-error,#ae2f2f))}._errorText_1ia27_34{color:var(--mcpapp-error-text,var(--text-primary,#161b2d))}
|
|
2
2
|
/*$vite$:1*//*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */
|
|
3
|
-
@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-border-style:solid}}}.absolute{position:absolute}.relative{position:relative}.static{position:static}.inset-0{inset:0}.
|
|
3
|
+
@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-border-style:solid}}}.absolute{position:absolute}.relative{position:relative}.static{position:static}.inset-0{inset:0}.block{display:block}.flex{display:flex}.inline{display:inline}.min-h-10{min-height:2.5rem}.min-h-\[100px\]{min-height:100px}.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-end{justify-content:flex-end}.gap-1{gap:.25rem}.gap-2{gap:.5rem}.overflow-hidden{overflow:hidden}.rounded-xl{border-radius:.75rem}.border{border-style:var(--tw-border-style);border-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.p-4{padding:1rem}.px-4{padding-inline:1rem}.py-2{padding-block:.5rem}.text-center{text-align:center}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}
|
package/index.js
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
import { MessageRole as e, buildCssVars as t } from "@epam/ai-dial-chat-shared";
|
|
2
|
-
import { DIAL_ICON_SIZE as n, DIAL_KIT_ICON_STROKE as r, ElementSize as i,
|
|
3
|
-
import { IconAlertTriangle as
|
|
4
|
-
import { Component as
|
|
5
|
-
import { Fragment as
|
|
2
|
+
import { DIAL_ICON_SIZE as n, DIAL_KIT_ICON_STROKE as r, ElementSize as i, GhostIconButton as a, LiveRegion as o, LiveRegionElement as s, Spinner as c, mergeClasses as l } from "@epam/ai-dial-ui-kit";
|
|
3
|
+
import { IconAlertTriangle as u, IconArrowsMaximize as d, IconRefresh as f } from "@tabler/icons-react";
|
|
4
|
+
import { Component as p, Suspense as m, lazy as h, memo as g, useCallback as _, useEffect as v, useMemo as y, useRef as b, useState as x } from "react";
|
|
5
|
+
import { Fragment as S, jsx as C, jsxs as w } from "react/jsx-runtime";
|
|
6
6
|
//#region src/constants/public-class-names.ts
|
|
7
|
-
var
|
|
7
|
+
var T = {
|
|
8
8
|
preview: "dial-mcp-apps-preview",
|
|
9
9
|
previewHeader: "dial-mcp-apps-preview-header"
|
|
10
|
-
},
|
|
10
|
+
}, E = /* @__PURE__ */ function(e) {
|
|
11
11
|
return e.Loading = "loading", e.Ready = "ready", e.Error = "error", e.Unavailable = "unavailable", e;
|
|
12
|
-
}({}),
|
|
12
|
+
}({}), D = /* @__PURE__ */ function(e) {
|
|
13
13
|
return e.Toolset = "toolset", e.Application = "application", e;
|
|
14
|
-
}({}),
|
|
14
|
+
}({}), O = /* @__PURE__ */ function(e) {
|
|
15
15
|
return e.Direct = "direct", e.Indirect = "indirect", e;
|
|
16
|
-
}({}),
|
|
16
|
+
}({}), k = 500, A = 500, j = (e) => new Promise((t) => setTimeout(t, e)), M = (e) => {
|
|
17
17
|
try {
|
|
18
18
|
let t = JSON.parse(e);
|
|
19
19
|
return typeof t == "object" && t ? t : {};
|
|
20
20
|
} catch {
|
|
21
21
|
return {};
|
|
22
22
|
}
|
|
23
|
-
},
|
|
23
|
+
}, N = (e) => {
|
|
24
24
|
let t = /* @__PURE__ */ new Map();
|
|
25
25
|
for (let n of e?.tool_messages ?? []) {
|
|
26
26
|
for (let e of n.tool_calls ?? []) t.set(e.id, {
|
|
@@ -35,7 +35,7 @@ var E = {
|
|
|
35
35
|
for (let n of e?.tool_execution_history ?? []) {
|
|
36
36
|
for (let e of n.tool_calls ?? []) t.set(e.id, {
|
|
37
37
|
name: e.function.name,
|
|
38
|
-
args:
|
|
38
|
+
args: M(e.function.arguments)
|
|
39
39
|
});
|
|
40
40
|
if (n.role === "tool" && n.tool_call_id) {
|
|
41
41
|
let e = t.get(n.tool_call_id);
|
|
@@ -43,21 +43,21 @@ var E = {
|
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
return t;
|
|
46
|
-
},
|
|
47
|
-
let t = e.replace(
|
|
48
|
-
return t !== "" && !/^[a-zA-Z_]/.test(t) && (t = `_${t}`), t.slice(0,
|
|
49
|
-
},
|
|
46
|
+
}, P = /[^a-zA-Z0-9_-]+/g, F = 64, I = (e) => {
|
|
47
|
+
let t = e.replace(P, "_");
|
|
48
|
+
return t !== "" && !/^[a-zA-Z_]/.test(t) && (t = `_${t}`), t.slice(0, F);
|
|
49
|
+
}, L = (e) => {
|
|
50
50
|
let t = /* @__PURE__ */ new Set();
|
|
51
|
-
for (let n of e) for (let e of
|
|
51
|
+
for (let n of e) for (let e of N(n.custom_content?.state).values()) t.add(e.name);
|
|
52
52
|
return t;
|
|
53
|
-
},
|
|
53
|
+
}, R = (t, n) => {
|
|
54
54
|
if (n.length === 0 || t.role !== e.Assistant) return;
|
|
55
|
-
let r = new Set([...
|
|
56
|
-
return n.find((e) => r.has(e.toolName)) || n.find((e) => e.discovery ===
|
|
57
|
-
},
|
|
55
|
+
let r = new Set([...N(t.custom_content?.state).values()].filter((e) => e.result != null).map((e) => e.name));
|
|
56
|
+
return n.find((e) => r.has(e.toolName)) || n.find((e) => e.discovery === O.Direct);
|
|
57
|
+
}, z = (e) => `${e}:mcp-app`, B = (e) => e == null ? void 0 : JSON.stringify(e.toolInput ?? null), V = (e, t) => {
|
|
58
58
|
let n = e.custom_content?.state;
|
|
59
59
|
if (!n) return;
|
|
60
|
-
let r = [...
|
|
60
|
+
let r = [...N(n).values()].reverse().find((e) => e.name === t);
|
|
61
61
|
if (r) return {
|
|
62
62
|
toolInput: r.args,
|
|
63
63
|
toolResult: r.result == null ? void 0 : { content: [{
|
|
@@ -65,56 +65,56 @@ var E = {
|
|
|
65
65
|
text: r.result
|
|
66
66
|
}] }
|
|
67
67
|
};
|
|
68
|
-
},
|
|
69
|
-
if (e.discovery !==
|
|
68
|
+
}, H = async (e, t, n) => {
|
|
69
|
+
if (e.discovery !== O.Direct && t?.toolInput == null) return t?.toolResult;
|
|
70
70
|
let r = () => n(e.toolsetId, e.mcpToolName, t?.toolInput ?? {}, e.kind);
|
|
71
71
|
try {
|
|
72
72
|
return await r();
|
|
73
73
|
} catch {
|
|
74
|
-
await
|
|
74
|
+
await j(k + Math.random() * A);
|
|
75
75
|
}
|
|
76
76
|
try {
|
|
77
77
|
return await r();
|
|
78
78
|
} catch {
|
|
79
79
|
return t?.toolResult;
|
|
80
80
|
}
|
|
81
|
-
},
|
|
82
|
-
let { hostContext: o, hostInfo: s, sandboxUrl: c, fetchResourceHtml: l, callTool: u } = i, [d, f] =
|
|
83
|
-
|
|
84
|
-
|
|
81
|
+
}, U = "mcp_app", W = (e, t, n, r, i, a) => {
|
|
82
|
+
let { hostContext: o, hostInfo: s, sandboxUrl: c, fetchResourceHtml: l, callTool: u } = i, [d, f] = x(), [p, m] = x(), [h, g] = x(), y = b(t);
|
|
83
|
+
v(() => {
|
|
84
|
+
y.current = t;
|
|
85
85
|
});
|
|
86
|
-
let
|
|
87
|
-
n.invalidate(r),
|
|
88
|
-
}, [n, r]), k =
|
|
86
|
+
let S = B(t), [C, w] = x(() => e == null || c == null ? E.Unavailable : E.Loading), [T, D] = x(0), O = _(() => {
|
|
87
|
+
n.invalidate(r), D((e) => e + 1);
|
|
88
|
+
}, [n, r]), k = _(async (t) => {
|
|
89
89
|
if (e != null && c != null) try {
|
|
90
|
-
let i =
|
|
91
|
-
let [t, n] = await Promise.all([l(e.toolsetId, e.resourceUri),
|
|
90
|
+
let i = y.current, { html: a, toolResult: o } = await n.getOrFetch(r, S, async () => {
|
|
91
|
+
let [t, n] = await Promise.all([l(e.toolsetId, e.resourceUri), H(e, i, u)]);
|
|
92
92
|
return {
|
|
93
93
|
html: t,
|
|
94
94
|
toolResult: n
|
|
95
95
|
};
|
|
96
96
|
});
|
|
97
97
|
if (t()) return;
|
|
98
|
-
f(a), m(i?.toolInput), g(o), w(
|
|
98
|
+
f(a), m(i?.toolInput), g(o), w(E.Ready);
|
|
99
99
|
} catch {
|
|
100
|
-
t() || w(
|
|
100
|
+
t() || w(E.Error);
|
|
101
101
|
}
|
|
102
102
|
}, [
|
|
103
103
|
e,
|
|
104
|
-
|
|
104
|
+
S,
|
|
105
105
|
c,
|
|
106
106
|
n,
|
|
107
107
|
r,
|
|
108
108
|
l,
|
|
109
109
|
u
|
|
110
110
|
]);
|
|
111
|
-
|
|
111
|
+
v(() => {
|
|
112
112
|
if (e == null || c == null) {
|
|
113
|
-
w(
|
|
113
|
+
w(E.Unavailable);
|
|
114
114
|
return;
|
|
115
115
|
}
|
|
116
116
|
let t = !1;
|
|
117
|
-
return w(
|
|
117
|
+
return w(E.Loading), k(() => t), () => {
|
|
118
118
|
t = !0;
|
|
119
119
|
};
|
|
120
120
|
}, [
|
|
@@ -123,11 +123,11 @@ var E = {
|
|
|
123
123
|
k,
|
|
124
124
|
T
|
|
125
125
|
]);
|
|
126
|
-
let A =
|
|
126
|
+
let A = _(async (t, n) => {
|
|
127
127
|
if (e == null) throw Error(`Tool call "${t}" failed: no matching MCP App`);
|
|
128
128
|
return u(e.toolsetId, t, n, e.kind);
|
|
129
129
|
}, [e, u]);
|
|
130
|
-
return C !==
|
|
130
|
+
return C !== E.Ready || e == null || c == null || d == null ? {
|
|
131
131
|
status: C,
|
|
132
132
|
reload: O,
|
|
133
133
|
attemptId: T
|
|
@@ -136,7 +136,7 @@ var E = {
|
|
|
136
136
|
reload: O,
|
|
137
137
|
attemptId: T,
|
|
138
138
|
content: {
|
|
139
|
-
type:
|
|
139
|
+
type: U,
|
|
140
140
|
html: d,
|
|
141
141
|
sandboxUrl: c,
|
|
142
142
|
toolInput: p,
|
|
@@ -147,7 +147,7 @@ var E = {
|
|
|
147
147
|
onRequestDisplayMode: a
|
|
148
148
|
}
|
|
149
149
|
};
|
|
150
|
-
}, ee = class extends
|
|
150
|
+
}, ee = class extends p {
|
|
151
151
|
state = { hasError: !1 };
|
|
152
152
|
static getDerivedStateFromError() {
|
|
153
153
|
return { hasError: !0 };
|
|
@@ -158,142 +158,116 @@ var E = {
|
|
|
158
158
|
render() {
|
|
159
159
|
return this.state.hasError ? null : this.props.children;
|
|
160
160
|
}
|
|
161
|
-
},
|
|
162
|
-
preview: "
|
|
163
|
-
previewHeader: "
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
"--mcpapp-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
"--mcpapp-placeholder-text": L?.placeholderText,
|
|
179
|
-
"--mcpapp-error-icon": L?.errorIcon,
|
|
180
|
-
"--mcpapp-error-text": L?.errorText
|
|
181
|
-
}), { status: J, content: Y, reload: X, attemptId: Z } = G(e, m, g, _, x, U);
|
|
182
|
-
y(() => {
|
|
183
|
-
q().catch(() => void 0);
|
|
161
|
+
}, G = {
|
|
162
|
+
preview: "_preview_1ia27_10",
|
|
163
|
+
previewHeader: "_previewHeader_1ia27_22",
|
|
164
|
+
placeholderText: "_placeholderText_1ia27_26",
|
|
165
|
+
errorIcon: "_errorIcon_1ia27_30",
|
|
166
|
+
errorText: "_errorText_1ia27_34"
|
|
167
|
+
}, K = async () => ({ default: (await import("@epam/ai-dial-attachment-canvas/mcp-app-renderer")).McpAppCanvasRenderer }), te = () => h(K), q = g(({ match: e, toolCall: p, cache: h, cacheKey: g, hostAdapter: b, onExpand: D, expandAriaLabel: O, reloadAriaLabel: k, actionsGroupAriaLabel: A = "MCP app actions", loadErrorLabel: j, loadingAriaLabel: M = "Loading app", onRendererError: N, isOpenedInCanvas: P = !1, openedInCanvasLabel: F, colors: I, typography: L }) => {
|
|
168
|
+
let { messageClassName: R = "dial-body-text" } = L ?? {}, z = _((e) => e === "fullscreen" ? (D(), "fullscreen") : "inline", [D]), B = t({
|
|
169
|
+
"--mcpapp-preview-bg": I?.previewBackground,
|
|
170
|
+
"--mcpapp-preview-border": I?.previewBorder,
|
|
171
|
+
"--mcpapp-preview-header-border": I?.previewHeaderBorder,
|
|
172
|
+
"--mcpapp-placeholder-text": I?.placeholderText,
|
|
173
|
+
"--mcpapp-error-icon": I?.errorIcon,
|
|
174
|
+
"--mcpapp-error-text": I?.errorText
|
|
175
|
+
}), { status: V, content: H, reload: U, attemptId: q } = W(e, p, h, g, b, z);
|
|
176
|
+
v(() => {
|
|
177
|
+
K().catch(() => void 0);
|
|
184
178
|
}, []);
|
|
185
|
-
let
|
|
186
|
-
|
|
187
|
-
}, [
|
|
188
|
-
if (
|
|
189
|
-
let
|
|
190
|
-
|
|
191
|
-
let
|
|
179
|
+
let J = y(te, [q]), [Y, ne] = x(void 0), X = Y === q, re = _((e) => {
|
|
180
|
+
ne(q), N?.(e);
|
|
181
|
+
}, [q, N]);
|
|
182
|
+
if (V === E.Unavailable) return null;
|
|
183
|
+
let Z = V === E.Error || X, Q = "";
|
|
184
|
+
P ? Q = F : Z && (Q = j);
|
|
185
|
+
let $ = /* @__PURE__ */ C("div", {
|
|
192
186
|
className: "absolute inset-0 flex items-center justify-center",
|
|
193
|
-
children: /* @__PURE__ */
|
|
187
|
+
children: /* @__PURE__ */ C(c, { ariaLabel: M })
|
|
194
188
|
});
|
|
195
|
-
return /* @__PURE__ */
|
|
196
|
-
style:
|
|
197
|
-
className:
|
|
198
|
-
children: [/* @__PURE__ */
|
|
199
|
-
className:
|
|
200
|
-
children:
|
|
201
|
-
text: V == null ? /* @__PURE__ */ w("span", {
|
|
202
|
-
className: z,
|
|
203
|
-
children: e.mcpToolName
|
|
204
|
-
}) : /* @__PURE__ */ T(C, { children: [
|
|
205
|
-
/* @__PURE__ */ w("span", {
|
|
206
|
-
className: z,
|
|
207
|
-
children: e.mcpToolName
|
|
208
|
-
}),
|
|
209
|
-
/* @__PURE__ */ w("span", {
|
|
210
|
-
"aria-hidden": !0,
|
|
211
|
-
className: "mx-1.5 inline-block h-3 w-0 border-s border-current align-middle"
|
|
212
|
-
}),
|
|
213
|
-
/* @__PURE__ */ w("span", {
|
|
214
|
-
className: z,
|
|
215
|
-
children: V.name
|
|
216
|
-
})
|
|
217
|
-
] }),
|
|
218
|
-
className: K.headerText
|
|
219
|
-
}), /* @__PURE__ */ T("div", {
|
|
189
|
+
return /* @__PURE__ */ w("div", {
|
|
190
|
+
style: B,
|
|
191
|
+
className: l(G.preview, "flex w-full min-w-0 flex-col overflow-hidden rounded-xl border", T.preview),
|
|
192
|
+
children: [/* @__PURE__ */ C("div", {
|
|
193
|
+
className: l(G.previewHeader, "flex min-h-10 items-center justify-end gap-2 border-b px-4 py-2", T.previewHeader),
|
|
194
|
+
children: /* @__PURE__ */ w("div", {
|
|
220
195
|
role: "toolbar",
|
|
221
|
-
"aria-label":
|
|
196
|
+
"aria-label": A,
|
|
222
197
|
className: "flex shrink-0 items-center gap-1",
|
|
223
|
-
children: [/* @__PURE__ */
|
|
224
|
-
icon: /* @__PURE__ */
|
|
198
|
+
children: [/* @__PURE__ */ C(a, {
|
|
199
|
+
icon: /* @__PURE__ */ C(f, {
|
|
225
200
|
size: n.SM,
|
|
226
201
|
stroke: r,
|
|
227
202
|
"aria-hidden": !0
|
|
228
203
|
}),
|
|
229
|
-
"aria-label":
|
|
204
|
+
"aria-label": k,
|
|
230
205
|
size: i.Small,
|
|
231
|
-
onClick:
|
|
232
|
-
}), /* @__PURE__ */
|
|
233
|
-
icon: /* @__PURE__ */
|
|
206
|
+
onClick: U
|
|
207
|
+
}), /* @__PURE__ */ C(a, {
|
|
208
|
+
icon: /* @__PURE__ */ C(d, {
|
|
234
209
|
size: n.SM,
|
|
235
210
|
stroke: r,
|
|
236
211
|
"aria-hidden": !0
|
|
237
212
|
}),
|
|
238
|
-
"aria-label":
|
|
213
|
+
"aria-label": O,
|
|
239
214
|
size: i.Small,
|
|
240
|
-
onClick:
|
|
215
|
+
onClick: D
|
|
241
216
|
})]
|
|
242
|
-
})
|
|
243
|
-
}), /* @__PURE__ */
|
|
217
|
+
})
|
|
218
|
+
}), /* @__PURE__ */ w("div", {
|
|
244
219
|
className: "relative min-h-[100px] w-full",
|
|
245
|
-
children: [/* @__PURE__ */
|
|
220
|
+
children: [/* @__PURE__ */ C(o, {
|
|
246
221
|
visuallyHidden: !0,
|
|
247
|
-
as:
|
|
248
|
-
children:
|
|
249
|
-
}),
|
|
222
|
+
as: s.Span,
|
|
223
|
+
children: Q
|
|
224
|
+
}), P ? /* @__PURE__ */ C("div", {
|
|
250
225
|
"aria-hidden": !0,
|
|
251
226
|
className: "absolute inset-0 flex items-center justify-center p-4",
|
|
252
|
-
children: /* @__PURE__ */
|
|
253
|
-
className:
|
|
254
|
-
children:
|
|
227
|
+
children: /* @__PURE__ */ C("span", {
|
|
228
|
+
className: l(R, "text-center", G.placeholderText),
|
|
229
|
+
children: F
|
|
255
230
|
})
|
|
256
|
-
}) : /* @__PURE__ */
|
|
257
|
-
|
|
258
|
-
|
|
231
|
+
}) : /* @__PURE__ */ w(S, { children: [
|
|
232
|
+
V === E.Loading && $,
|
|
233
|
+
Z && /* @__PURE__ */ w("div", {
|
|
259
234
|
className: "absolute inset-0 flex flex-col items-center justify-center gap-2 p-4",
|
|
260
|
-
children: [/* @__PURE__ */
|
|
235
|
+
children: [/* @__PURE__ */ C(u, {
|
|
261
236
|
size: 40,
|
|
262
237
|
stroke: r,
|
|
263
238
|
"aria-hidden": !0,
|
|
264
|
-
className:
|
|
265
|
-
}), /* @__PURE__ */
|
|
239
|
+
className: G.errorIcon
|
|
240
|
+
}), /* @__PURE__ */ C("p", {
|
|
266
241
|
"aria-hidden": !0,
|
|
267
|
-
className:
|
|
268
|
-
children:
|
|
242
|
+
className: l(R, "text-center", G.errorText),
|
|
243
|
+
children: j
|
|
269
244
|
})]
|
|
270
245
|
}),
|
|
271
|
-
|
|
272
|
-
onError:
|
|
273
|
-
children: /* @__PURE__ */
|
|
274
|
-
fallback:
|
|
275
|
-
children: /* @__PURE__ */
|
|
276
|
-
content:
|
|
277
|
-
errorLabel:
|
|
278
|
-
onAppInfo: H
|
|
246
|
+
V === E.Ready && H && !X && /* @__PURE__ */ C(ee, {
|
|
247
|
+
onError: re,
|
|
248
|
+
children: /* @__PURE__ */ C(m, {
|
|
249
|
+
fallback: $,
|
|
250
|
+
children: /* @__PURE__ */ C(J, {
|
|
251
|
+
content: H,
|
|
252
|
+
errorLabel: j
|
|
279
253
|
})
|
|
280
254
|
})
|
|
281
|
-
},
|
|
255
|
+
}, q)
|
|
282
256
|
] })]
|
|
283
257
|
})]
|
|
284
258
|
});
|
|
285
|
-
}),
|
|
286
|
-
let t =
|
|
287
|
-
return
|
|
259
|
+
}), J = 9e5, Y = (e) => {
|
|
260
|
+
let t = b(/* @__PURE__ */ new Map()), n = b(/* @__PURE__ */ new Map());
|
|
261
|
+
return y(() => {
|
|
288
262
|
let r = (t) => `${e}:${t}`, i = (e, t) => `${r(e)}::${t ?? ""}`, a = (e, n) => {
|
|
289
263
|
let i = t.current.get(r(e));
|
|
290
|
-
if (i != null && i.seedKey === n && !(Date.now() - i.cachedAt >
|
|
264
|
+
if (i != null && i.seedKey === n && !(Date.now() - i.cachedAt > J)) return {
|
|
291
265
|
html: i.html,
|
|
292
266
|
toolResult: i.toolResult
|
|
293
267
|
};
|
|
294
268
|
}, o = (e, n, i) => {
|
|
295
269
|
let a = Date.now();
|
|
296
|
-
for (let [e, n] of t.current) a - n.cachedAt >
|
|
270
|
+
for (let [e, n] of t.current) a - n.cachedAt > J && t.current.delete(e);
|
|
297
271
|
t.current.set(r(e), {
|
|
298
272
|
...n,
|
|
299
273
|
seedKey: i,
|
|
@@ -320,4 +294,4 @@ var E = {
|
|
|
320
294
|
}, [e]);
|
|
321
295
|
};
|
|
322
296
|
//#endregion
|
|
323
|
-
export {
|
|
297
|
+
export { T as MCP_APPS_CLASS, q as McpAppInlinePreview, E as McpAppInlinePreviewStatus, O as McpAppToolDiscovery, D as McpDeploymentKind, L as collectToolCallNames, B as computeMcpAppSeedKey, R as findMcpAppForMessage, z as mcpAppCanvasKey, V as resolveMcpAppToolCallSeed, H as resolveMcpAppToolResult, I as sanitizeToolName, W as useMcpAppInlinePreview, Y as useMcpAppResponseCache };
|
package/models/mcp-apps.d.ts
CHANGED
|
@@ -96,8 +96,6 @@ export interface McpAppInlinePreviewColors {
|
|
|
96
96
|
previewBorder?: string;
|
|
97
97
|
/** Divider under the header strip. Fallback: `--stroke-tertiary`. */
|
|
98
98
|
previewHeaderBorder?: string;
|
|
99
|
-
/** Text color of the header strip's app or tool name. Fallback: `--text-secondary`. */
|
|
100
|
-
headerText?: string;
|
|
101
99
|
/** Text color of the "opened in canvas" placeholder. Fallback: `--text-secondary`. */
|
|
102
100
|
placeholderText?: string;
|
|
103
101
|
/** Color of the load-error icon. Fallback: `--text-error`. */
|
|
@@ -107,8 +105,6 @@ export interface McpAppInlinePreviewColors {
|
|
|
107
105
|
}
|
|
108
106
|
/** Typography class overrides for `McpAppInlinePreview`. */
|
|
109
107
|
export interface McpAppInlinePreviewTypography {
|
|
110
|
-
/** Typography class of the header strip's tool and app names. Defaults to `'dial-tiny-lead-semi-text'`. */
|
|
111
|
-
headerNameClassName?: string;
|
|
112
108
|
/** Typography class of the "opened in canvas" and load-error messages. Defaults to `'dial-body-text'`. */
|
|
113
109
|
messageClassName?: string;
|
|
114
110
|
}
|
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,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAC3E,OAAO,KAAK,EACV,cAAc,EACd,cAAc,EACf,MAAM,oCAAoC,CAAC;AAC5C,OAAO,KAAK,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEhF,KAAK,gBAAgB,GAAG,WAAW,CAAC,mBAAmB,CAAC,aAAa,CAAC,CAAC,CAAC;AAExE,yFAAyF;AACzF,MAAM,WAAW,aAAa;IAC5B,iEAAiE;IACjE,SAAS,EAAE,M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
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.4.0-dev.
|
|
4
|
+
"version": "1.4.0-dev.180",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"sideEffects": [
|
|
7
7
|
"**/*.css",
|
|
@@ -23,10 +23,10 @@
|
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@tabler/icons-react": "^3.50.0",
|
|
25
25
|
"@modelcontextprotocol/sdk": "^1.32.2",
|
|
26
|
-
"@epam/ai-dial-attachment-canvas": "1.4.0-dev.
|
|
26
|
+
"@epam/ai-dial-attachment-canvas": "1.4.0-dev.180"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
29
|
-
"@epam/ai-dial-chat-shared": "1.4.0-dev.
|
|
29
|
+
"@epam/ai-dial-chat-shared": "1.4.0-dev.180",
|
|
30
30
|
"@epam/ai-dial-ui-kit": "^0.17.0",
|
|
31
31
|
"react": "^19.2.8"
|
|
32
32
|
},
|