@epam/ai-dial-mcp-apps 1.2.0-dev.46 → 1.2.0-dev.50
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 +3 -1
- package/components/McpAppInlinePreview/McpAppInlinePreview.d.ts.map +1 -1
- package/constants/public-class-names.d.ts +11 -0
- package/constants/public-class-names.d.ts.map +1 -0
- package/index.css +2 -1
- package/index.d.ts +2 -0
- package/index.d.ts.map +1 -1
- package/index.js +88 -77
- package/models/mcp-apps.d.ts +12 -0
- package/models/mcp-apps.d.ts.map +1 -1
- package/package.json +4 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { McpAppHostAdapter, McpAppResponseCache, McpAppToolCallSeed, McpAppToolRef } from '../../models/mcp-apps';
|
|
1
|
+
import { McpAppHostAdapter, McpAppInlinePreviewColors, McpAppResponseCache, McpAppToolCallSeed, McpAppToolRef } from '../../models/mcp-apps';
|
|
2
2
|
/** Props for the `McpAppInlinePreview` component. */
|
|
3
3
|
export interface McpAppInlinePreviewProps {
|
|
4
4
|
/** Matched MCP App tool to preview. */
|
|
@@ -21,6 +21,8 @@ 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
|
+
/** Color overrides applied as CSS custom properties on the preview's root. */
|
|
25
|
+
colors?: McpAppInlinePreviewColors;
|
|
24
26
|
}
|
|
25
27
|
/** Renders a compact, always-visible preview of a message's matched MCP App — see `McpAppInlinePreviewProps`. */
|
|
26
28
|
export declare const McpAppInlinePreview: import('react').NamedExoticComponent<McpAppInlinePreviewProps>;
|
|
@@ -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":"AAmBA,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,8EAA8E;IAC9E,MAAM,CAAC,EAAE,yBAAyB,CAAC;CACpC;AA6ID,iHAAiH;AACjH,eAAO,MAAM,mBAAmB,gEAAgC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const MCP_APPS_CLASS: {
|
|
2
|
+
/** The preview's bordered outer card. */
|
|
3
|
+
readonly preview: "dial-mcp-apps-preview";
|
|
4
|
+
/**
|
|
5
|
+
* The header strip above the mounted app, holding the reload and
|
|
6
|
+
* expand-to-canvas actions. It sits outside the app's own content, so a host
|
|
7
|
+
* restyling it never overlaps what the app draws.
|
|
8
|
+
*/
|
|
9
|
+
readonly previewHeader: "dial-mcp-apps-preview-header";
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=public-class-names.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"public-class-names.d.ts","sourceRoot":"","sources":["../../src/constants/public-class-names.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,cAAc;IACzB,yCAAyC;;IAEzC;;;;OAIG;;CAEK,CAAC"}
|
package/index.css
CHANGED
|
@@ -1 +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-end{justify-content:flex-end}.justify-center{justify-content:center}.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}.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}.text-error{color:var(--text-error,#ae2f2f)}.text-primary{color:var(--text-primary,#161b2d)}
|
package/index.d.ts
CHANGED
|
@@ -4,4 +4,6 @@ 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_APPS_CLASS } from './constants/public-class-names';
|
|
8
|
+
export type { McpAppInlinePreviewColors } from './models/mcp-apps';
|
|
7
9
|
//# 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,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAChE,YAAY,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC"}
|
package/index.js
CHANGED
|
@@ -1,20 +1,23 @@
|
|
|
1
1
|
import { AttachmentContentType as e, McpAppCanvasRenderer as t } from "@epam/ai-dial-attachment-canvas";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { jsx as
|
|
7
|
-
//#region src/
|
|
8
|
-
var
|
|
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, GhostIconButton as s, Spinner as c, mergeClasses as l } from "@epam/ai-dial-ui-kit";
|
|
4
|
+
import { IconAlertTriangle as u, IconArrowsMaximize as d, IconRefresh as f } from "@tabler/icons-react";
|
|
5
|
+
import { memo as p, useCallback as m, useEffect as h, useMemo as g, useRef as _, useState as v } from "react";
|
|
6
|
+
import { jsx as y, jsxs as b } from "react/jsx-runtime";
|
|
7
|
+
//#region src/constants/public-class-names.ts
|
|
8
|
+
var x = {
|
|
9
|
+
preview: "dial-mcp-apps-preview",
|
|
10
|
+
previewHeader: "dial-mcp-apps-preview-header"
|
|
11
|
+
}, S = /* @__PURE__ */ function(e) {
|
|
9
12
|
return e.Loading = "loading", e.Ready = "ready", e.Error = "error", e.Unavailable = "unavailable", e;
|
|
10
|
-
}({}),
|
|
13
|
+
}({}), C = (e) => {
|
|
11
14
|
try {
|
|
12
15
|
let t = JSON.parse(e);
|
|
13
16
|
return typeof t == "object" && t ? t : {};
|
|
14
17
|
} catch {
|
|
15
18
|
return {};
|
|
16
19
|
}
|
|
17
|
-
},
|
|
20
|
+
}, w = (e) => {
|
|
18
21
|
let t = /* @__PURE__ */ new Map();
|
|
19
22
|
for (let n of e?.tool_messages ?? []) {
|
|
20
23
|
for (let e of n.tool_calls ?? []) t.set(e.id, {
|
|
@@ -29,7 +32,7 @@ var y = /* @__PURE__ */ function(e) {
|
|
|
29
32
|
for (let n of e?.tool_execution_history ?? []) {
|
|
30
33
|
for (let e of n.tool_calls ?? []) t.set(e.id, {
|
|
31
34
|
name: e.function.name,
|
|
32
|
-
args:
|
|
35
|
+
args: C(e.function.arguments)
|
|
33
36
|
});
|
|
34
37
|
if (n.role === "tool" && n.tool_call_id) {
|
|
35
38
|
let e = t.get(n.tool_call_id);
|
|
@@ -37,18 +40,18 @@ var y = /* @__PURE__ */ function(e) {
|
|
|
37
40
|
}
|
|
38
41
|
}
|
|
39
42
|
return t;
|
|
40
|
-
},
|
|
43
|
+
}, T = (e) => {
|
|
41
44
|
let t = /* @__PURE__ */ new Set();
|
|
42
|
-
for (let n of e) for (let e of
|
|
45
|
+
for (let n of e) for (let e of w(n.custom_content?.state).values()) t.add(e.name);
|
|
43
46
|
return t;
|
|
44
|
-
},
|
|
45
|
-
if (t.length === 0 || e.role !==
|
|
46
|
-
let
|
|
47
|
-
return t.find((e) =>
|
|
48
|
-
},
|
|
47
|
+
}, E = (e, t, r) => {
|
|
48
|
+
if (t.length === 0 || e.role !== n.Assistant) return;
|
|
49
|
+
let i = new Set([...w(e.custom_content?.state).values()].map((e) => e.name));
|
|
50
|
+
return t.find((e) => i.has(e.toolName)) || t.find((e) => e.discovery === "direct") || (r ? t[0] : void 0);
|
|
51
|
+
}, D = (e) => `${e}:mcp-app`, O = (e) => e == null ? void 0 : JSON.stringify(e.toolInput ?? null), k = (e, t) => {
|
|
49
52
|
let n = e.custom_content?.state;
|
|
50
53
|
if (!n) return;
|
|
51
|
-
let r = [...
|
|
54
|
+
let r = [...w(n).values()].reverse().find((e) => e.name === t);
|
|
52
55
|
if (r) return {
|
|
53
56
|
toolInput: r.args,
|
|
54
57
|
toolResult: r.result == null ? void 0 : { content: [{
|
|
@@ -56,29 +59,29 @@ var y = /* @__PURE__ */ function(e) {
|
|
|
56
59
|
text: r.result
|
|
57
60
|
}] }
|
|
58
61
|
};
|
|
59
|
-
},
|
|
62
|
+
}, A = async (e, t, n) => {
|
|
60
63
|
if (!(e.discovery === "direct" || t?.toolInput != null)) return t?.toolResult;
|
|
61
64
|
try {
|
|
62
65
|
return await n(e.toolsetId, e.mcpToolName, t?.toolInput ?? {}, e.kind);
|
|
63
66
|
} catch {
|
|
64
67
|
return t?.toolResult;
|
|
65
68
|
}
|
|
66
|
-
},
|
|
67
|
-
let { hostContext: s, sandboxUrl: c, fetchResourceHtml: l, callTool: u } = a, [
|
|
68
|
-
r.invalidate(i),
|
|
69
|
-
}, [r, i]), w =
|
|
69
|
+
}, j = (t, n, r, i, a, o) => {
|
|
70
|
+
let { hostContext: s, sandboxUrl: c, fetchResourceHtml: l, callTool: u } = a, [d, f] = v(), [p, g] = v(), [_, y] = v(() => t == null || c == null ? S.Unavailable : S.Loading), [b, x] = v(0), C = m(() => {
|
|
71
|
+
r.invalidate(i), x((e) => e + 1);
|
|
72
|
+
}, [r, i]), w = m(async (e) => {
|
|
70
73
|
if (!(t == null || c == null)) try {
|
|
71
|
-
let a =
|
|
72
|
-
let [e, r] = await Promise.all([l(t.toolsetId, t.resourceUri),
|
|
74
|
+
let a = O(n), { html: o, toolResult: s } = await r.getOrFetch(i, a, async () => {
|
|
75
|
+
let [e, r] = await Promise.all([l(t.toolsetId, t.resourceUri), A(t, n, u)]);
|
|
73
76
|
return {
|
|
74
77
|
html: e,
|
|
75
78
|
toolResult: r
|
|
76
79
|
};
|
|
77
80
|
});
|
|
78
81
|
if (e()) return;
|
|
79
|
-
|
|
82
|
+
f(o), g(s), y(S.Ready);
|
|
80
83
|
} catch {
|
|
81
|
-
e() ||
|
|
84
|
+
e() || y(S.Error);
|
|
82
85
|
}
|
|
83
86
|
}, [
|
|
84
87
|
t,
|
|
@@ -89,111 +92,119 @@ var y = /* @__PURE__ */ function(e) {
|
|
|
89
92
|
l,
|
|
90
93
|
u
|
|
91
94
|
]);
|
|
92
|
-
|
|
95
|
+
h(() => {
|
|
93
96
|
if (t == null || c == null) {
|
|
94
|
-
|
|
97
|
+
y(S.Unavailable);
|
|
95
98
|
return;
|
|
96
99
|
}
|
|
97
100
|
let e = !1;
|
|
98
|
-
return
|
|
101
|
+
return y(S.Loading), w(() => e), () => {
|
|
99
102
|
e = !0;
|
|
100
103
|
};
|
|
101
104
|
}, [
|
|
102
105
|
t,
|
|
103
106
|
c,
|
|
104
107
|
w,
|
|
105
|
-
|
|
108
|
+
b
|
|
106
109
|
]);
|
|
107
|
-
let
|
|
110
|
+
let T = m(async (e, n) => {
|
|
108
111
|
if (t == null) throw Error(`Tool call "${e}" failed: no matching MCP App`);
|
|
109
112
|
return u(t.toolsetId, e, n, t.kind);
|
|
110
113
|
}, [t, u]);
|
|
111
|
-
return
|
|
112
|
-
status:
|
|
114
|
+
return _ !== S.Ready || t == null || c == null || d == null ? {
|
|
115
|
+
status: _,
|
|
113
116
|
reload: C
|
|
114
117
|
} : {
|
|
115
|
-
status:
|
|
118
|
+
status: _,
|
|
116
119
|
reload: C,
|
|
117
120
|
content: {
|
|
118
121
|
type: e.McpApp,
|
|
119
|
-
html:
|
|
122
|
+
html: d,
|
|
120
123
|
sandboxUrl: c,
|
|
121
124
|
toolInput: n?.toolInput,
|
|
122
|
-
toolResult:
|
|
125
|
+
toolResult: p,
|
|
123
126
|
hostContext: s,
|
|
124
|
-
onToolCall:
|
|
127
|
+
onToolCall: T,
|
|
125
128
|
onRequestDisplayMode: o
|
|
126
129
|
}
|
|
127
130
|
};
|
|
128
|
-
},
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
131
|
+
}, M = {
|
|
132
|
+
preview: "_preview_19as4_11",
|
|
133
|
+
previewHeader: "_previewHeader_19as4_23"
|
|
134
|
+
}, N = p(({ match: e, toolCall: n, cache: p, cacheKey: h, hostAdapter: g, onExpand: _, expandAriaLabel: v, reloadAriaLabel: C, actionsGroupAriaLabel: w = "MCP app actions", loadErrorLabel: T, colors: E }) => {
|
|
135
|
+
let D = m((e) => e === "fullscreen" ? (_(), "fullscreen") : "inline", [_]), O = r({
|
|
136
|
+
"--mcpapp-preview-bg": E?.previewBackground,
|
|
137
|
+
"--mcpapp-preview-border": E?.previewBorder,
|
|
138
|
+
"--mcpapp-preview-header-border": E?.previewHeaderBorder
|
|
139
|
+
}), { status: k, content: A, reload: N } = j(e, n, p, h, g, D);
|
|
140
|
+
return k === S.Unavailable ? null : /* @__PURE__ */ b("div", {
|
|
141
|
+
style: O,
|
|
142
|
+
className: l(M.preview, "flex w-full min-w-0 flex-col overflow-hidden rounded-xl border", x.preview),
|
|
143
|
+
children: [/* @__PURE__ */ y("div", {
|
|
144
|
+
className: l(M.previewHeader, "flex min-h-10 items-center justify-end border-b px-4 py-2", x.previewHeader),
|
|
145
|
+
children: /* @__PURE__ */ b("div", {
|
|
135
146
|
role: "toolbar",
|
|
136
|
-
"aria-label":
|
|
147
|
+
"aria-label": w,
|
|
137
148
|
className: "flex items-center gap-1",
|
|
138
|
-
children: [/* @__PURE__ */
|
|
139
|
-
icon: /* @__PURE__ */
|
|
140
|
-
size:
|
|
141
|
-
stroke:
|
|
149
|
+
children: [/* @__PURE__ */ y(s, {
|
|
150
|
+
icon: /* @__PURE__ */ y(f, {
|
|
151
|
+
size: i.SM,
|
|
152
|
+
stroke: a,
|
|
142
153
|
"aria-hidden": !0
|
|
143
154
|
}),
|
|
144
|
-
"aria-label":
|
|
145
|
-
size:
|
|
146
|
-
onClick:
|
|
147
|
-
}), /* @__PURE__ */
|
|
148
|
-
icon: /* @__PURE__ */
|
|
149
|
-
size:
|
|
150
|
-
stroke:
|
|
155
|
+
"aria-label": C,
|
|
156
|
+
size: o.Small,
|
|
157
|
+
onClick: N
|
|
158
|
+
}), /* @__PURE__ */ y(s, {
|
|
159
|
+
icon: /* @__PURE__ */ y(d, {
|
|
160
|
+
size: i.SM,
|
|
161
|
+
stroke: a,
|
|
151
162
|
"aria-hidden": !0
|
|
152
163
|
}),
|
|
153
|
-
"aria-label":
|
|
154
|
-
size:
|
|
155
|
-
onClick:
|
|
164
|
+
"aria-label": v,
|
|
165
|
+
size: o.Small,
|
|
166
|
+
onClick: _
|
|
156
167
|
})]
|
|
157
168
|
})
|
|
158
|
-
}), /* @__PURE__ */
|
|
169
|
+
}), /* @__PURE__ */ b("div", {
|
|
159
170
|
className: "relative min-h-[200px] w-full",
|
|
160
171
|
children: [
|
|
161
|
-
|
|
172
|
+
k === S.Loading && /* @__PURE__ */ y("div", {
|
|
162
173
|
className: "absolute inset-0 flex items-center justify-center",
|
|
163
|
-
children: /* @__PURE__ */
|
|
174
|
+
children: /* @__PURE__ */ y(c, {})
|
|
164
175
|
}),
|
|
165
|
-
|
|
176
|
+
k === S.Error && /* @__PURE__ */ b("div", {
|
|
166
177
|
className: "absolute inset-0 flex flex-col items-center justify-center gap-2 p-4",
|
|
167
|
-
children: [/* @__PURE__ */
|
|
178
|
+
children: [/* @__PURE__ */ y(u, {
|
|
168
179
|
size: 40,
|
|
169
|
-
stroke:
|
|
180
|
+
stroke: a,
|
|
170
181
|
"aria-hidden": !0,
|
|
171
182
|
className: "text-error"
|
|
172
|
-
}), /* @__PURE__ */
|
|
183
|
+
}), /* @__PURE__ */ y("p", {
|
|
173
184
|
role: "alert",
|
|
174
185
|
className: "dial-body-text text-center text-primary",
|
|
175
|
-
children:
|
|
186
|
+
children: T
|
|
176
187
|
})]
|
|
177
188
|
}),
|
|
178
|
-
|
|
179
|
-
content:
|
|
180
|
-
errorLabel:
|
|
189
|
+
k === S.Ready && A && /* @__PURE__ */ y(t, {
|
|
190
|
+
content: A,
|
|
191
|
+
errorLabel: T
|
|
181
192
|
})
|
|
182
193
|
]
|
|
183
194
|
})]
|
|
184
195
|
});
|
|
185
|
-
}),
|
|
186
|
-
let t =
|
|
187
|
-
return
|
|
196
|
+
}), P = 900 * 1e3, F = (e) => {
|
|
197
|
+
let t = _(/* @__PURE__ */ new Map()), n = _(/* @__PURE__ */ new Map());
|
|
198
|
+
return g(() => {
|
|
188
199
|
let r = (t) => `${e}:${t}`, i = (e, t) => `${r(e)}::${t ?? ""}`, a = (e, n) => {
|
|
189
200
|
let i = t.current.get(r(e));
|
|
190
|
-
if (i != null && i.seedKey === n && !(Date.now() - i.cachedAt >
|
|
201
|
+
if (i != null && i.seedKey === n && !(Date.now() - i.cachedAt > P)) return {
|
|
191
202
|
html: i.html,
|
|
192
203
|
toolResult: i.toolResult
|
|
193
204
|
};
|
|
194
205
|
}, o = (e, n, i) => {
|
|
195
206
|
let a = Date.now();
|
|
196
|
-
for (let [e, n] of t.current) a - n.cachedAt >
|
|
207
|
+
for (let [e, n] of t.current) a - n.cachedAt > P && t.current.delete(e);
|
|
197
208
|
t.current.set(r(e), {
|
|
198
209
|
...n,
|
|
199
210
|
seedKey: i,
|
|
@@ -220,4 +231,4 @@ var y = /* @__PURE__ */ function(e) {
|
|
|
220
231
|
}, [e]);
|
|
221
232
|
};
|
|
222
233
|
//#endregion
|
|
223
|
-
export {
|
|
234
|
+
export { x as MCP_APPS_CLASS, N as McpAppInlinePreview, S as McpAppInlinePreviewStatus, T as collectToolCallNames, O as computeMcpAppSeedKey, E as findMcpAppForMessage, D as mcpAppCanvasKey, k as resolveMcpAppToolCallSeed, A as resolveMcpAppToolResult, j as useMcpAppInlinePreview, F as useMcpAppResponseCache };
|
package/models/mcp-apps.d.ts
CHANGED
|
@@ -99,4 +99,16 @@ export interface McpAppHostAdapter {
|
|
|
99
99
|
/** Forwards a tool call the mounted app makes on its own (`onToolCall`) or the live re-call `resolveMcpAppToolResult` performs. */
|
|
100
100
|
callTool: CallMcpAppTool;
|
|
101
101
|
}
|
|
102
|
+
/**
|
|
103
|
+
* Color overrides for `McpAppInlinePreview`, applied as CSS custom properties
|
|
104
|
+
* on the preview's root.
|
|
105
|
+
*/
|
|
106
|
+
export interface McpAppInlinePreviewColors {
|
|
107
|
+
/** Surface the mounted app sits on. Fallback: `--bg-layer-raised`. */
|
|
108
|
+
previewBackground?: string;
|
|
109
|
+
/** Border around the preview card. Fallback: `--stroke-tertiary`. */
|
|
110
|
+
previewBorder?: string;
|
|
111
|
+
/** Divider under the header strip. Fallback: `--stroke-tertiary`. */
|
|
112
|
+
previewHeaderBorder?: string;
|
|
113
|
+
}
|
|
102
114
|
//# sourceMappingURL=mcp-apps.d.ts.map
|
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,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAEzE,mJAAmJ;AACnJ,MAAM,MAAM,iBAAiB,GAAG,SAAS,GAAG,aAAa,CAAC;AAE1D;;;;;;;;;;;;;;GAcG;AACH,MAAM,MAAM,mBAAmB,GAAG,QAAQ,GAAG,UAAU,CAAC;AAExD,yFAAyF;AACzF,MAAM,WAAW,aAAa;IAC5B,iEAAiE;IACjE,SAAS,EAAE,MAAM,CAAC;IAClB,4CAA4C;IAC5C,WAAW,EAAE,MAAM,CAAC;IACpB,oIAAoI;IACpI,QAAQ,EAAE,MAAM,CAAC;IACjB,mIAAmI;IACnI,WAAW,EAAE,MAAM,CAAC;IACpB,mGAAmG;IACnG,IAAI,EAAE,iBAAiB,CAAC;IACxB,gEAAgE;IAChE,SAAS,EAAE,mBAAmB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AAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,4DAA4D;IAC5D,iBAAiB,EAAE,uBAAuB,CAAC;IAC3C,mIAAmI;IACnI,QAAQ,EAAE,cAAc,CAAC;CAC1B;AAED;;;GAGG;AACH,MAAM,WAAW,yBAAyB;IACxC,sEAAsE;IACtE,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,qEAAqE;IACrE,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,qEAAqE;IACrE,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B"}
|
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.50",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "./index.js",
|
|
@@ -20,11 +20,11 @@
|
|
|
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.50"
|
|
24
24
|
},
|
|
25
25
|
"peerDependencies": {
|
|
26
|
-
"@epam/ai-dial-chat-shared": "1.2.0-dev.
|
|
27
|
-
"@epam/ai-dial-ui-kit": "^0.
|
|
26
|
+
"@epam/ai-dial-chat-shared": "1.2.0-dev.50",
|
|
27
|
+
"@epam/ai-dial-ui-kit": "^0.15.0-dev.7",
|
|
28
28
|
"react": "^19.2.8"
|
|
29
29
|
},
|
|
30
30
|
"repository": {
|