@epam/ai-dial-mcp-apps 1.4.0-dev.96 → 1.4.0-rc.1
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 -3
- package/components/McpAppInlinePreview/McpAppInlinePreview.d.ts.map +1 -1
- package/components/RendererLoadBoundary/RendererLoadBoundary.d.ts +26 -0
- package/components/RendererLoadBoundary/RendererLoadBoundary.d.ts.map +1 -0
- package/hooks/useMcpAppInlinePreview/useMcpAppInlinePreview.d.ts.map +1 -1
- package/index.css +2 -2
- package/index.js +139 -141
- package/models/mcp-apps.d.ts +0 -4
- package/models/mcp-apps.d.ts.map +1 -1
- package/package.json +4 -4
|
@@ -23,11 +23,17 @@ export interface McpAppInlinePreviewProps {
|
|
|
23
23
|
loadErrorLabel: string;
|
|
24
24
|
/** Accessible label of the spinner shown while the app loads. Defaults to `'Loading app'`. */
|
|
25
25
|
loadingAriaLabel?: string;
|
|
26
|
+
/**
|
|
27
|
+
* Called with the error when the renderer fails to load or throws while
|
|
28
|
+
* rendering, so the host can log it; the preview then shows
|
|
29
|
+
* `loadErrorLabel`.
|
|
30
|
+
*/
|
|
31
|
+
onRendererError?: (error: Error) => void;
|
|
26
32
|
/**
|
|
27
33
|
* Whether this message's MCP App is currently open in the full-width
|
|
28
|
-
* canvas. When `true`, the header
|
|
29
|
-
*
|
|
30
|
-
*
|
|
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.
|
|
31
37
|
*/
|
|
32
38
|
isOpenedInCanvas?: boolean;
|
|
33
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"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Component, ReactNode } from 'react';
|
|
2
|
+
/** Props for the internal `RendererLoadBoundary`. */
|
|
3
|
+
export interface RendererLoadBoundaryProps {
|
|
4
|
+
/** The lazily loaded renderer. */
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
/** Called once with the thrown error when loading or rendering `children` fails. */
|
|
7
|
+
onError: (error: Error) => void;
|
|
8
|
+
}
|
|
9
|
+
interface RendererLoadBoundaryState {
|
|
10
|
+
hasError: boolean;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Catches a rejected renderer import (or a render error) under
|
|
14
|
+
* `McpAppInlinePreview` and reports it through `onError`, rendering nothing
|
|
15
|
+
* itself: the preview shows its own error state, so the announcing
|
|
16
|
+
* `LiveRegion` stays outside this boundary. The preview keys it on its load
|
|
17
|
+
* attempt, so a reload remounts it with a fresh import.
|
|
18
|
+
*/
|
|
19
|
+
export declare class RendererLoadBoundary extends Component<RendererLoadBoundaryProps, RendererLoadBoundaryState> {
|
|
20
|
+
state: RendererLoadBoundaryState;
|
|
21
|
+
static getDerivedStateFromError(): RendererLoadBoundaryState;
|
|
22
|
+
componentDidCatch(error: unknown): void;
|
|
23
|
+
render(): ReactNode;
|
|
24
|
+
}
|
|
25
|
+
export {};
|
|
26
|
+
//# sourceMappingURL=RendererLoadBoundary.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RendererLoadBoundary.d.ts","sourceRoot":"","sources":["../../../src/components/RendererLoadBoundary/RendererLoadBoundary.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAElD,qDAAqD;AACrD,MAAM,WAAW,yBAAyB;IACxC,kCAAkC;IAClC,QAAQ,EAAE,SAAS,CAAC;IACpB,oFAAoF;IACpF,OAAO,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;CACjC;AAED,UAAU,yBAAyB;IACjC,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED;;;;;;GAMG;AACH,qBAAa,oBAAqB,SAAQ,SAAS,CACjD,yBAAyB,EACzB,yBAAyB,CAC1B;IACU,KAAK,EAAE,yBAAyB,CAAuB;IAEhE,MAAM,CAAC,wBAAwB,IAAI,yBAAyB;IAInD,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI;IAMvC,MAAM,IAAI,SAAS;CAG7B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMcpAppInlinePreview.d.ts","sourceRoot":"","sources":["../../../src/hooks/useMcpAppInlinePreview/useMcpAppInlinePreview.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"useMcpAppInlinePreview.d.ts","sourceRoot":"","sources":["../../../src/hooks/useMcpAppInlinePreview/useMcpAppInlinePreview.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,mBAAmB,EACnB,iBAAiB,EAClB,MAAM,iCAAiC,CAAC;AAGzC,OAAO,EACL,yBAAyB,EACzB,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACvB,KAAK,aAAa,EACnB,MAAM,uBAAuB,CAAC;AAe/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;IACnB,sLAAsL;IACtL,SAAS,EAAE,MAAM,CAAC;CACnB;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,wBAmHF,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}.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,8 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { memo as g, useCallback as _, useEffect as v, useMemo as y, useRef as b, useState as x } from "react";
|
|
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, 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";
|
|
6
5
|
import { Fragment as S, jsx as C, jsxs as w } from "react/jsx-runtime";
|
|
7
6
|
//#region src/constants/public-class-names.ts
|
|
8
7
|
var T = {
|
|
@@ -51,10 +50,10 @@ var T = {
|
|
|
51
50
|
let t = /* @__PURE__ */ new Set();
|
|
52
51
|
for (let n of e) for (let e of N(n.custom_content?.state).values()) t.add(e.name);
|
|
53
52
|
return t;
|
|
54
|
-
}, R = (
|
|
55
|
-
if (
|
|
56
|
-
let r = new Set([...N(
|
|
57
|
-
return
|
|
53
|
+
}, R = (t, n) => {
|
|
54
|
+
if (n.length === 0 || t.role !== e.Assistant) return;
|
|
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);
|
|
58
57
|
}, z = (e) => `${e}:mcp-app`, B = (e) => e == null ? void 0 : JSON.stringify(e.toolInput ?? null), V = (e, t) => {
|
|
59
58
|
let n = e.custom_content?.state;
|
|
60
59
|
if (!n) return;
|
|
@@ -79,197 +78,196 @@ var T = {
|
|
|
79
78
|
} catch {
|
|
80
79
|
return t?.toolResult;
|
|
81
80
|
}
|
|
82
|
-
}, U = (t, n, r, i, a
|
|
83
|
-
let { hostContext:
|
|
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);
|
|
84
83
|
v(() => {
|
|
85
|
-
|
|
84
|
+
y.current = t;
|
|
86
85
|
});
|
|
87
|
-
let
|
|
88
|
-
|
|
89
|
-
}, [
|
|
90
|
-
if (
|
|
91
|
-
let
|
|
92
|
-
let [
|
|
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
|
+
if (e != null && c != null) try {
|
|
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)]);
|
|
93
92
|
return {
|
|
94
|
-
html:
|
|
95
|
-
toolResult:
|
|
93
|
+
html: t,
|
|
94
|
+
toolResult: n
|
|
96
95
|
};
|
|
97
96
|
});
|
|
98
|
-
if (
|
|
99
|
-
|
|
97
|
+
if (t()) return;
|
|
98
|
+
f(a), m(i?.toolInput), g(o), w(E.Ready);
|
|
100
99
|
} catch {
|
|
101
|
-
|
|
100
|
+
t() || w(E.Error);
|
|
102
101
|
}
|
|
103
102
|
}, [
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
103
|
+
e,
|
|
104
|
+
S,
|
|
105
|
+
c,
|
|
106
|
+
n,
|
|
107
107
|
r,
|
|
108
|
-
|
|
109
|
-
u
|
|
110
|
-
d
|
|
108
|
+
l,
|
|
109
|
+
u
|
|
111
110
|
]);
|
|
112
111
|
v(() => {
|
|
113
|
-
if (
|
|
114
|
-
|
|
112
|
+
if (e == null || c == null) {
|
|
113
|
+
w(E.Unavailable);
|
|
115
114
|
return;
|
|
116
115
|
}
|
|
117
|
-
let
|
|
118
|
-
return
|
|
119
|
-
|
|
116
|
+
let t = !1;
|
|
117
|
+
return w(E.Loading), k(() => t), () => {
|
|
118
|
+
t = !0;
|
|
120
119
|
};
|
|
121
120
|
}, [
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
121
|
+
e,
|
|
122
|
+
c,
|
|
123
|
+
k,
|
|
124
|
+
T
|
|
126
125
|
]);
|
|
127
|
-
let
|
|
128
|
-
if (
|
|
129
|
-
return
|
|
130
|
-
}, [
|
|
131
|
-
return
|
|
132
|
-
status:
|
|
133
|
-
reload:
|
|
134
|
-
attemptId:
|
|
126
|
+
let A = _(async (t, n) => {
|
|
127
|
+
if (e == null) throw Error(`Tool call "${t}" failed: no matching MCP App`);
|
|
128
|
+
return u(e.toolsetId, t, n, e.kind);
|
|
129
|
+
}, [e, u]);
|
|
130
|
+
return C !== E.Ready || e == null || c == null || d == null ? {
|
|
131
|
+
status: C,
|
|
132
|
+
reload: O,
|
|
133
|
+
attemptId: T
|
|
135
134
|
} : {
|
|
136
|
-
status:
|
|
137
|
-
reload:
|
|
138
|
-
attemptId:
|
|
135
|
+
status: C,
|
|
136
|
+
reload: O,
|
|
137
|
+
attemptId: T,
|
|
139
138
|
content: {
|
|
140
|
-
type:
|
|
141
|
-
html:
|
|
142
|
-
sandboxUrl:
|
|
143
|
-
toolInput:
|
|
144
|
-
toolResult:
|
|
145
|
-
hostContext:
|
|
146
|
-
hostInfo:
|
|
147
|
-
onToolCall:
|
|
148
|
-
onRequestDisplayMode:
|
|
139
|
+
type: U,
|
|
140
|
+
html: d,
|
|
141
|
+
sandboxUrl: c,
|
|
142
|
+
toolInput: p,
|
|
143
|
+
toolResult: h,
|
|
144
|
+
hostContext: o,
|
|
145
|
+
hostInfo: s,
|
|
146
|
+
onToolCall: A,
|
|
147
|
+
onRequestDisplayMode: a
|
|
149
148
|
}
|
|
150
149
|
};
|
|
151
|
-
},
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
}
|
|
159
|
-
|
|
150
|
+
}, ee = class extends p {
|
|
151
|
+
state = { hasError: !1 };
|
|
152
|
+
static getDerivedStateFromError() {
|
|
153
|
+
return { hasError: !0 };
|
|
154
|
+
}
|
|
155
|
+
componentDidCatch(e) {
|
|
156
|
+
this.props.onError(e instanceof Error ? e : Error(String(e)));
|
|
157
|
+
}
|
|
158
|
+
render() {
|
|
159
|
+
return this.state.hasError ? null : this.props.children;
|
|
160
|
+
}
|
|
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);
|
|
160
176
|
v(() => {
|
|
161
|
-
|
|
162
|
-
}, [
|
|
163
|
-
let
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
"
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
children: [/* @__PURE__ */ C(s, {
|
|
180
|
-
text: z == null ? /* @__PURE__ */ C("span", {
|
|
181
|
-
className: L,
|
|
182
|
-
children: e.mcpToolName
|
|
183
|
-
}) : /* @__PURE__ */ w(S, { children: [
|
|
184
|
-
/* @__PURE__ */ C("span", {
|
|
185
|
-
className: L,
|
|
186
|
-
children: e.mcpToolName
|
|
187
|
-
}),
|
|
188
|
-
/* @__PURE__ */ C("span", {
|
|
189
|
-
"aria-hidden": !0,
|
|
190
|
-
className: "mx-1.5 inline-block h-3 w-0 border-s border-current align-middle"
|
|
191
|
-
}),
|
|
192
|
-
/* @__PURE__ */ C("span", {
|
|
193
|
-
className: L,
|
|
194
|
-
children: z.name
|
|
195
|
-
})
|
|
196
|
-
] }),
|
|
197
|
-
className: W.headerText
|
|
198
|
-
}), /* @__PURE__ */ w("div", {
|
|
177
|
+
K().catch(() => void 0);
|
|
178
|
+
}, []);
|
|
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", {
|
|
186
|
+
className: "absolute inset-0 flex items-center justify-center",
|
|
187
|
+
children: /* @__PURE__ */ C(c, { ariaLabel: M })
|
|
188
|
+
});
|
|
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", {
|
|
199
195
|
role: "toolbar",
|
|
200
196
|
"aria-label": A,
|
|
201
197
|
className: "flex shrink-0 items-center gap-1",
|
|
202
|
-
children: [/* @__PURE__ */ C(
|
|
203
|
-
icon: /* @__PURE__ */ C(
|
|
204
|
-
size:
|
|
205
|
-
stroke:
|
|
198
|
+
children: [/* @__PURE__ */ C(a, {
|
|
199
|
+
icon: /* @__PURE__ */ C(f, {
|
|
200
|
+
size: n.SM,
|
|
201
|
+
stroke: r,
|
|
206
202
|
"aria-hidden": !0
|
|
207
203
|
}),
|
|
208
204
|
"aria-label": k,
|
|
209
|
-
size:
|
|
210
|
-
onClick:
|
|
211
|
-
}), /* @__PURE__ */ C(
|
|
212
|
-
icon: /* @__PURE__ */ C(
|
|
213
|
-
size:
|
|
214
|
-
stroke:
|
|
205
|
+
size: i.Small,
|
|
206
|
+
onClick: U
|
|
207
|
+
}), /* @__PURE__ */ C(a, {
|
|
208
|
+
icon: /* @__PURE__ */ C(d, {
|
|
209
|
+
size: n.SM,
|
|
210
|
+
stroke: r,
|
|
215
211
|
"aria-hidden": !0
|
|
216
212
|
}),
|
|
217
213
|
"aria-label": O,
|
|
218
|
-
size:
|
|
214
|
+
size: i.Small,
|
|
219
215
|
onClick: D
|
|
220
216
|
})]
|
|
221
|
-
})
|
|
217
|
+
})
|
|
222
218
|
}), /* @__PURE__ */ w("div", {
|
|
223
219
|
className: "relative min-h-[100px] w-full",
|
|
224
|
-
children: [/* @__PURE__ */ C(
|
|
220
|
+
children: [/* @__PURE__ */ C(o, {
|
|
225
221
|
visuallyHidden: !0,
|
|
226
|
-
as:
|
|
227
|
-
children:
|
|
228
|
-
}),
|
|
222
|
+
as: s.Span,
|
|
223
|
+
children: Q
|
|
224
|
+
}), P ? /* @__PURE__ */ C("div", {
|
|
229
225
|
"aria-hidden": !0,
|
|
230
226
|
className: "absolute inset-0 flex items-center justify-center p-4",
|
|
231
227
|
children: /* @__PURE__ */ C("span", {
|
|
232
|
-
className:
|
|
233
|
-
children:
|
|
228
|
+
className: l(R, "text-center", G.placeholderText),
|
|
229
|
+
children: F
|
|
234
230
|
})
|
|
235
231
|
}) : /* @__PURE__ */ w(S, { children: [
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
children: /* @__PURE__ */ C(d, { ariaLabel: M })
|
|
239
|
-
}),
|
|
240
|
-
G === E.Error && /* @__PURE__ */ w("div", {
|
|
232
|
+
V === E.Loading && $,
|
|
233
|
+
Z && /* @__PURE__ */ w("div", {
|
|
241
234
|
className: "absolute inset-0 flex flex-col items-center justify-center gap-2 p-4",
|
|
242
|
-
children: [/* @__PURE__ */ C(
|
|
235
|
+
children: [/* @__PURE__ */ C(u, {
|
|
243
236
|
size: 40,
|
|
244
|
-
stroke:
|
|
237
|
+
stroke: r,
|
|
245
238
|
"aria-hidden": !0,
|
|
246
|
-
className:
|
|
239
|
+
className: G.errorIcon
|
|
247
240
|
}), /* @__PURE__ */ C("p", {
|
|
248
241
|
"aria-hidden": !0,
|
|
249
|
-
className:
|
|
242
|
+
className: l(R, "text-center", G.errorText),
|
|
250
243
|
children: j
|
|
251
244
|
})]
|
|
252
245
|
}),
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
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
|
|
253
|
+
})
|
|
254
|
+
})
|
|
255
|
+
}, q)
|
|
258
256
|
] })]
|
|
259
257
|
})]
|
|
260
258
|
});
|
|
261
|
-
}),
|
|
259
|
+
}), J = 9e5, Y = (e) => {
|
|
262
260
|
let t = b(/* @__PURE__ */ new Map()), n = b(/* @__PURE__ */ new Map());
|
|
263
261
|
return y(() => {
|
|
264
262
|
let r = (t) => `${e}:${t}`, i = (e, t) => `${r(e)}::${t ?? ""}`, a = (e, n) => {
|
|
265
263
|
let i = t.current.get(r(e));
|
|
266
|
-
if (i != null && i.seedKey === n && !(Date.now() - i.cachedAt >
|
|
264
|
+
if (i != null && i.seedKey === n && !(Date.now() - i.cachedAt > J)) return {
|
|
267
265
|
html: i.html,
|
|
268
266
|
toolResult: i.toolResult
|
|
269
267
|
};
|
|
270
268
|
}, o = (e, n, i) => {
|
|
271
269
|
let a = Date.now();
|
|
272
|
-
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);
|
|
273
271
|
t.current.set(r(e), {
|
|
274
272
|
...n,
|
|
275
273
|
seedKey: i,
|
|
@@ -296,4 +294,4 @@ var T = {
|
|
|
296
294
|
}, [e]);
|
|
297
295
|
};
|
|
298
296
|
//#endregion
|
|
299
|
-
export { T as MCP_APPS_CLASS,
|
|
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,MAAM,CAAC;IAClB,4CAA4C;IAC5C,WAAW,EAAE,MAAM,CAAC;IACpB,oIA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;IAClC;;;;;;;;;OASG;IACH,UAAU,EAAE,CACV,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,MAAM,GAAG,SAAS,EAC3B,OAAO,EAAE,MAAM,OAAO,CAAC,oBAAoB,CAAC,KACzC,OAAO,CAAC,oBAAoB,CAAC,CAAC;CACpC;AAED,sDAAsD;AACtD,oBAAY,yBAAyB;IACnC,OAAO,YAAY;IACnB,KAAK,UAAU;IACf,KAAK,UAAU;IACf,WAAW,gBAAgB;CAC5B;AAED;;;;;GAKG;AACH,MAAM,WAAW,iBAAiB;IAChC,oFAAoF;IACpF,WAAW,EAAE,gBAAgB,CAAC;IAC9B,kGAAkG;IAClG,QAAQ,EAAE,cAAc,CAAC;IACzB,mFAAmF;IACnF,UAAU,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;IAC7B,sFAAsF;IACtF,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,8DAA8D;IAC9D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,wEAAwE;IACxE,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,4DAA4D;AAC5D,MAAM,WAAW,6BAA6B;IAC5C,0GAA0G;IAC1G,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B"}
|
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.4.0-
|
|
4
|
+
"version": "1.4.0-rc.1",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"sideEffects": [
|
|
7
7
|
"**/*.css",
|
|
@@ -23,11 +23,11 @@
|
|
|
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-
|
|
26
|
+
"@epam/ai-dial-attachment-canvas": "1.4.0-rc.1"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
29
|
-
"@epam/ai-dial-chat-shared": "1.4.0-
|
|
30
|
-
"@epam/ai-dial-ui-kit": "^0.
|
|
29
|
+
"@epam/ai-dial-chat-shared": "1.4.0-rc.1",
|
|
30
|
+
"@epam/ai-dial-ui-kit": "^0.17.0",
|
|
31
31
|
"react": "^19.2.8"
|
|
32
32
|
},
|
|
33
33
|
"repository": {
|