@epam/ai-dial-mcp-apps 1.2.0-dev.6 → 1.2.0-dev.69

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.
@@ -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,17 @@ 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;
33
+ /** Color overrides applied as CSS custom properties on the preview's root. */
34
+ colors?: McpAppInlinePreviewColors;
24
35
  }
25
36
  /** Renders a compact, always-visible preview of a message's matched MCP App — see `McpAppInlinePreviewProps`. */
26
37
  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":"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"}
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"}
@@ -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"}
@@ -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,wBAgGF,CAAC"}
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 ADDED
@@ -0,0 +1,2 @@
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*/.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.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 { DIAL_ICON_SIZE as n, DIAL_KIT_ICON_STROKE as r, ElementSize as i, GhostIconButton as a, Spinner as o } from "@epam/ai-dial-ui-kit";
3
- import { IconAlertTriangle as s, IconArrowsMaximize as c, IconRefresh as l } from "@tabler/icons-react";
4
- import { memo as u, useCallback as d, useEffect as f, useMemo as p, useRef as m, useState as h } from "react";
5
- import { MessageRole as g } from "@epam/ai-dial-chat-shared";
6
- import { jsx as _, jsxs as v } from "react/jsx-runtime";
7
- //#region src/models/mcp-apps.ts
8
- var y = /* @__PURE__ */ function(e) {
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, 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
+ //#region src/constants/public-class-names.ts
8
+ var C = {
9
+ preview: "dial-mcp-apps-preview",
10
+ previewHeader: "dial-mcp-apps-preview-header"
11
+ }, w = /* @__PURE__ */ function(e) {
9
12
  return e.Loading = "loading", e.Ready = "ready", e.Error = "error", e.Unavailable = "unavailable", e;
10
- }({}), b = (e) => {
13
+ }({}), T = (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
- }, x = (e) => {
20
+ }, E = (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: b(e.function.arguments)
35
+ args: T(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
- }, S = (e) => {
43
+ }, D = (e) => {
41
44
  let t = /* @__PURE__ */ new Set();
42
- for (let n of e) for (let e of x(n.custom_content?.state).values()) t.add(e.name);
45
+ for (let n of e) for (let e of E(n.custom_content?.state).values()) t.add(e.name);
43
46
  return t;
44
- }, C = (e, t, n) => {
45
- if (t.length === 0 || e.role !== g.Assistant) return;
46
- let r = new Set([...x(e.custom_content?.state).values()].map((e) => e.name));
47
- return t.find((e) => r.has(e.toolName)) || t.find((e) => e.discovery === "direct") || (n ? t[0] : void 0);
48
- }, w = (e) => `${e}:mcp-app`, T = (e) => e == null ? void 0 : JSON.stringify(e.toolInput ?? null), E = (e, t) => {
47
+ }, O = (e, t, r) => {
48
+ if (t.length === 0 || e.role !== n.Assistant) return;
49
+ let i = new Set([...E(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
+ }, k = (e) => `${e}:mcp-app`, A = (e) => e == null ? void 0 : JSON.stringify(e.toolInput ?? null), j = (e, t) => {
49
52
  let n = e.custom_content?.state;
50
53
  if (!n) return;
51
- let r = [...x(n).values()].reverse().find((e) => e.name === t);
54
+ let r = [...E(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,59 +59,59 @@ var y = /* @__PURE__ */ function(e) {
56
59
  text: r.result
57
60
  }] }
58
61
  };
59
- }, D = async (e, t, n) => {
62
+ }, M = 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
- }, O = (t, n, r, i, a, o) => {
67
- let { hostContext: s, sandboxUrl: c, fetchResourceHtml: l, callTool: u } = a, [p, m] = h(), [g, _] = h(), [v, b] = h(() => t == null || c == null ? y.Unavailable : y.Loading), [x, S] = h(0), C = d(() => {
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(() => {
68
71
  r.invalidate(i), S((e) => e + 1);
69
- }, [r, i]), w = d(async (e) => {
70
- if (!(t == null || c == null)) try {
71
- let a = T(n), { html: o, toolResult: s } = await r.getOrFetch(i, a, async () => {
72
- let [e, r] = await Promise.all([l(t.toolsetId, t.resourceUri), D(t, n, u)]);
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)]);
73
76
  return {
74
77
  html: e,
75
78
  toolResult: r
76
79
  };
77
80
  });
78
81
  if (e()) return;
79
- m(o), _(s), b(y.Ready);
82
+ p(o), _(s), b(w.Ready);
80
83
  } catch {
81
- e() || b(y.Error);
84
+ e() || b(w.Error);
82
85
  }
83
86
  }, [
84
87
  t,
85
88
  n,
86
- c,
89
+ l,
87
90
  r,
88
91
  i,
89
- l,
90
- u
92
+ u,
93
+ d
91
94
  ]);
92
- f(() => {
93
- if (t == null || c == null) {
94
- b(y.Unavailable);
95
+ g(() => {
96
+ if (t == null || l == null) {
97
+ b(w.Unavailable);
95
98
  return;
96
99
  }
97
100
  let e = !1;
98
- return b(y.Loading), w(() => e), () => {
101
+ return b(w.Loading), T(() => e), () => {
99
102
  e = !0;
100
103
  };
101
104
  }, [
102
105
  t,
103
- c,
104
- w,
106
+ l,
107
+ T,
105
108
  x
106
109
  ]);
107
- let E = d(async (e, n) => {
110
+ let E = h(async (e, n) => {
108
111
  if (t == null) throw Error(`Tool call "${e}" failed: no matching MCP App`);
109
- return u(t.toolsetId, e, n, t.kind);
110
- }, [t, u]);
111
- return v !== y.Ready || t == null || c == null || p == null ? {
112
+ return d(t.toolsetId, e, n, t.kind);
113
+ }, [t, d]);
114
+ return v !== w.Ready || t == null || l == null || f == null ? {
112
115
  status: v,
113
116
  reload: C
114
117
  } : {
@@ -116,84 +119,129 @@ var y = /* @__PURE__ */ function(e) {
116
119
  reload: C,
117
120
  content: {
118
121
  type: e.McpApp,
119
- html: p,
120
- sandboxUrl: c,
122
+ html: f,
123
+ sandboxUrl: l,
121
124
  toolInput: n?.toolInput,
122
- toolResult: g,
125
+ toolResult: m,
123
126
  hostContext: s,
127
+ hostInfo: c,
124
128
  onToolCall: E,
125
129
  onRequestDisplayMode: o
126
130
  }
127
131
  };
128
- }, k = u(({ match: e, toolCall: u, cache: f, cacheKey: p, hostAdapter: m, onExpand: h, expandAriaLabel: g, reloadAriaLabel: b, actionsGroupAriaLabel: x = "MCP app actions", loadErrorLabel: S }) => {
129
- let { status: C, content: w, reload: T } = O(e, u, f, p, m, d((e) => e === "fullscreen" ? (h(), "fullscreen") : "inline", [h]));
130
- return C === y.Unavailable ? null : /* @__PURE__ */ v("div", {
131
- className: "bg-layer-2 flex w-full min-w-0 flex-col overflow-hidden rounded-xl border border-tertiary",
132
- children: [/* @__PURE__ */ _("div", {
133
- className: "flex min-h-10 items-center justify-end border-b border-tertiary px-4 py-2",
134
- children: /* @__PURE__ */ v("div", {
132
+ }, P = {
133
+ preview: "_preview_19as4_11",
134
+ previewHeader: "_previewHeader_19as4_23"
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", {
135
174
  role: "toolbar",
136
- "aria-label": x,
137
- className: "flex items-center gap-1",
138
- children: [/* @__PURE__ */ _(a, {
139
- icon: /* @__PURE__ */ _(l, {
140
- size: n.SM,
141
- stroke: r,
175
+ "aria-label": O,
176
+ className: "flex shrink-0 items-center gap-1",
177
+ children: [/* @__PURE__ */ x(c, {
178
+ icon: /* @__PURE__ */ x(p, {
179
+ size: i.SM,
180
+ stroke: a,
142
181
  "aria-hidden": !0
143
182
  }),
144
- "aria-label": b,
145
- size: i.Small,
146
- onClick: T
147
- }), /* @__PURE__ */ _(a, {
148
- icon: /* @__PURE__ */ _(c, {
149
- size: n.SM,
150
- stroke: r,
183
+ "aria-label": D,
184
+ size: o.Small,
185
+ onClick: V
186
+ }), /* @__PURE__ */ x(c, {
187
+ icon: /* @__PURE__ */ x(f, {
188
+ size: i.SM,
189
+ stroke: a,
151
190
  "aria-hidden": !0
152
191
  }),
153
- "aria-label": g,
154
- size: i.Small,
155
- onClick: h
192
+ "aria-label": E,
193
+ size: o.Small,
194
+ onClick: T
156
195
  })]
157
- })
158
- }), /* @__PURE__ */ v("div", {
196
+ })]
197
+ }), /* @__PURE__ */ x("div", {
159
198
  className: "relative min-h-[200px] w-full",
160
- children: [
161
- C === y.Loading && /* @__PURE__ */ _("div", {
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", {
162
209
  className: "absolute inset-0 flex items-center justify-center",
163
- children: /* @__PURE__ */ _(o, {})
210
+ children: /* @__PURE__ */ x(l, {})
164
211
  }),
165
- C === y.Error && /* @__PURE__ */ v("div", {
212
+ z === w.Error && /* @__PURE__ */ S("div", {
166
213
  className: "absolute inset-0 flex flex-col items-center justify-center gap-2 p-4",
167
- children: [/* @__PURE__ */ _(s, {
214
+ children: [/* @__PURE__ */ x(d, {
168
215
  size: 40,
169
- stroke: r,
216
+ stroke: a,
170
217
  "aria-hidden": !0,
171
218
  className: "text-error"
172
- }), /* @__PURE__ */ _("p", {
219
+ }), /* @__PURE__ */ x("p", {
173
220
  role: "alert",
174
221
  className: "dial-body-text text-center text-primary",
175
- children: S
222
+ children: k
176
223
  })]
177
224
  }),
178
- C === y.Ready && w && /* @__PURE__ */ _(t, {
179
- content: w,
180
- errorLabel: S
225
+ z === w.Ready && B && /* @__PURE__ */ x(t, {
226
+ content: B,
227
+ errorLabel: k,
228
+ onAppInfo: I
181
229
  })
182
- ]
230
+ ] })
183
231
  })]
184
232
  });
185
- }), A = 900 * 1e3, j = (e) => {
186
- let t = m(/* @__PURE__ */ new Map()), n = m(/* @__PURE__ */ new Map());
187
- return p(() => {
233
+ }), I = 900 * 1e3, L = (e) => {
234
+ let t = v(/* @__PURE__ */ new Map()), n = v(/* @__PURE__ */ new Map());
235
+ return _(() => {
188
236
  let r = (t) => `${e}:${t}`, i = (e, t) => `${r(e)}::${t ?? ""}`, a = (e, n) => {
189
237
  let i = t.current.get(r(e));
190
- if (i != null && i.seedKey === n && !(Date.now() - i.cachedAt > A)) return {
238
+ if (i != null && i.seedKey === n && !(Date.now() - i.cachedAt > I)) return {
191
239
  html: i.html,
192
240
  toolResult: i.toolResult
193
241
  };
194
242
  }, o = (e, n, i) => {
195
243
  let a = Date.now();
196
- for (let [e, n] of t.current) a - n.cachedAt > A && t.current.delete(e);
244
+ for (let [e, n] of t.current) a - n.cachedAt > I && t.current.delete(e);
197
245
  t.current.set(r(e), {
198
246
  ...n,
199
247
  seedKey: i,
@@ -220,4 +268,4 @@ var y = /* @__PURE__ */ function(e) {
220
268
  }, [e]);
221
269
  };
222
270
  //#endregion
223
- export { k as McpAppInlinePreview, y as McpAppInlinePreviewStatus, S as collectToolCallNames, T as computeMcpAppSeedKey, C as findMcpAppForMessage, w as mcpAppCanvasKey, E as resolveMcpAppToolCallSeed, D as resolveMcpAppToolResult, O as useMcpAppInlinePreview, j as useMcpAppResponseCache };
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 };
@@ -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. */
@@ -99,4 +101,16 @@ export interface McpAppHostAdapter {
99
101
  /** Forwards a tool call the mounted app makes on its own (`onToolCall`) or the live re-call `resolveMcpAppToolResult` performs. */
100
102
  callTool: CallMcpAppTool;
101
103
  }
104
+ /**
105
+ * Color overrides for `McpAppInlinePreview`, applied as CSS custom properties
106
+ * on the preview's root.
107
+ */
108
+ export interface McpAppInlinePreviewColors {
109
+ /** Surface the mounted app sits on. Fallback: `--bg-layer-raised`. */
110
+ previewBackground?: string;
111
+ /** Border around the preview card. Fallback: `--stroke-tertiary`. */
112
+ previewBorder?: string;
113
+ /** Divider under the header strip. Fallback: `--stroke-tertiary`. */
114
+ previewHeaderBorder?: string;
115
+ }
102
116
  //# sourceMappingURL=mcp-apps.d.ts.map
@@ -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,CAAC;CAChC;AAED,sJAAsJ;AACtJ,MAAM,WAAW,kBAAkB;IACjC,iDAAiD;IACjD,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACpC,gDAAgD;IAChD,UAAU,CAAC,EAAE,cAAc,CAAC;CAC7B;AAED,+GAA+G;AAC/G,MAAM,MAAM,uBAAuB,GAAG,CACpC,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAA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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.6",
4
+ "version": "1.2.0-dev.69",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
7
7
  "main": "./index.js",
@@ -9,6 +9,7 @@
9
9
  "types": "./index.d.ts",
10
10
  "exports": {
11
11
  "./package.json": "./package.json",
12
+ "./styles.css": "./index.css",
12
13
  ".": {
13
14
  "types": "./index.d.ts",
14
15
  "import": "./index.js",
@@ -19,11 +20,11 @@
19
20
  "@tabler/icons-react": "^3.44.0",
20
21
  "@mcp-ui/client": "^7.1.1",
21
22
  "@modelcontextprotocol/sdk": "^1.29.0",
22
- "@epam/ai-dial-attachment-canvas": "1.2.0-dev.6"
23
+ "@epam/ai-dial-attachment-canvas": "1.2.0-dev.69"
23
24
  },
24
25
  "peerDependencies": {
25
- "@epam/ai-dial-chat-shared": "1.2.0-dev.6",
26
- "@epam/ai-dial-ui-kit": "^0.14.2",
26
+ "@epam/ai-dial-chat-shared": "1.2.0-dev.69",
27
+ "@epam/ai-dial-ui-kit": "^0.15.0-dev.9",
27
28
  "react": "^19.2.8"
28
29
  },
29
30
  "repository": {