@epam/ai-dial-mcp-apps 1.3.0-dev.35 → 1.3.0-dev.354

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, McpAppInlinePreviewColors, McpAppResponseCache, McpAppToolCallSeed, McpAppToolRef } from '../../models/mcp-apps';
1
+ import { McpAppHostAdapter, McpAppInlinePreviewColors, McpAppInlinePreviewTypography, 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
+ /** Accessible label of the spinner shown while the app loads. Defaults to `'Loading app'`. */
25
+ loadingAriaLabel?: string;
24
26
  /**
25
27
  * Whether this message's MCP App is currently open in the full-width
26
28
  * canvas. When `true`, the header stays (so the tool/app identity is still
@@ -32,6 +34,8 @@ export interface McpAppInlinePreviewProps {
32
34
  openedInCanvasLabel: string;
33
35
  /** Color overrides applied as CSS custom properties on the preview's root. */
34
36
  colors?: McpAppInlinePreviewColors;
37
+ /** Typography class overrides; each field has a kit scale default. */
38
+ typography?: McpAppInlinePreviewTypography;
35
39
  }
36
40
  /** Renders a compact, always-visible preview of a message's matched MCP App — see `McpAppInlinePreviewProps`. */
37
41
  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":"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;AAuLD,iHAAiH;AACjH,eAAO,MAAM,mBAAmB,gEAAgC,CAAC"}
1
+ {"version":3,"file":"McpAppInlinePreview.d.ts","sourceRoot":"","sources":["../../../src/components/McpAppInlinePreview/McpAppInlinePreview.tsx"],"names":[],"mappings":"AAuBA,OAAO,EAEL,KAAK,iBAAiB,EACtB,KAAK,yBAAyB,EAC9B,KAAK,6BAA6B,EAClC,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,8FAA8F;IAC9F,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;;;;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;AA0MD,iHAAiH;AACjH,eAAO,MAAM,mBAAmB,gEAAgC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"useMcpAppInlinePreview.d.ts","sourceRoot":"","sources":["../../../src/hooks/useMcpAppInlinePreview/useMcpAppInlinePreview.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACvB,MAAM,iCAAiC,CAAC;AAGzC,OAAO,EACL,yBAAyB,EACzB,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACvB,KAAK,aAAa,EACnB,MAAM,uBAAuB,CAAC;AAM/B,kDAAkD;AAClD,MAAM,WAAW,wBAAwB;IACvC,iDAAiD;IACjD,MAAM,EAAE,yBAAyB,CAAC;IAClC,6CAA6C;IAC7C,OAAO,CAAC,EAAE,mBAAmB,CAAC;IAC9B,+FAA+F;IAC/F,MAAM,EAAE,MAAM,IAAI,CAAC;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,wBAmGF,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;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,2 +1,3 @@
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\.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)}
1
+ ._preview_1xqr3_10{background:var(--mcpapp-preview-bg,var(--bg-layer-raised,#fcfcfc));border-color:var(--mcpapp-preview-border,var(--stroke-tertiary,#e0e6f0))}._previewHeader_1xqr3_22{border-bottom-color:var(--mcpapp-preview-header-border,var(--stroke-tertiary,#e0e6f0))}._headerText_1xqr3_26{color:var(--mcpapp-header-text,var(--text-secondary,#57647a))}._placeholderText_1xqr3_30{color:var(--mcpapp-placeholder-text,var(--text-secondary,#57647a))}._errorIcon_1xqr3_34{color:var(--mcpapp-error-icon,var(--text-error,#ae2f2f))}._errorText_1xqr3_38{color:var(--mcpapp-error-text,var(--text-primary,#161b2d))}
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}.mx-1\.5{margin-inline:.375rem}.block{display:block}.flex{display:flex}.inline{display:inline}.inline-block{display:inline-block}.h-3{height:.75rem}.min-h-10{min-height:2.5rem}.min-h-\[100px\]{min-height:100px}.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-between{justify-content:space-between}.justify-center{justify-content:center}.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-s{border-inline-start-style:var(--tw-border-style);border-inline-start-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-current{border-color:currentColor}.p-4{padding:1rem}.px-4{padding-inline:1rem}.py-2{padding-block:.5rem}.text-center{text-align:center}.align-middle{vertical-align:middle}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}
package/index.d.ts CHANGED
@@ -3,7 +3,7 @@ export { useMcpAppInlinePreview, type McpAppInlinePreviewState, } from './hooks/
3
3
  export { useMcpAppResponseCache } from './hooks/useMcpAppResponseCache/useMcpAppResponseCache';
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
- export { collectToolCallNames, findMcpAppForMessage, mcpAppCanvasKey, computeMcpAppSeedKey, resolveMcpAppToolCallSeed, resolveMcpAppToolResult, } from './utils/mcp-app';
6
+ export { collectToolCallNames, findMcpAppForMessage, mcpAppCanvasKey, computeMcpAppSeedKey, resolveMcpAppToolCallSeed, resolveMcpAppToolResult, sanitizeToolName, } from './utils/mcp-app';
7
7
  export { MCP_APPS_CLASS } from './constants/public-class-names';
8
- export type { McpAppInlinePreviewColors } from './models/mcp-apps';
8
+ export type { McpAppInlinePreviewColors, McpAppInlinePreviewTypography, } from './models/mcp-apps';
9
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;AACzB,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAChE,YAAY,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,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,EACvB,gBAAgB,GACjB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAChE,YAAY,EACV,yBAAyB,EACzB,6BAA6B,GAC9B,MAAM,mBAAmB,CAAC"}
package/index.js CHANGED
@@ -1,23 +1,23 @@
1
1
  import { AttachmentContentType as e, McpAppCanvasRenderer as t } from "@epam/ai-dial-attachment-canvas";
2
2
  import { MessageRole as n, buildCssVars as r } from "@epam/ai-dial-chat-shared";
3
- import { DIAL_ICON_SIZE as i, DIAL_KIT_ICON_STROKE as a, ElementSize as o, 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";
3
+ import { DIAL_ICON_SIZE as i, DIAL_KIT_ICON_STROKE as a, ElementSize as o, EllipsisTooltip as s, GhostIconButton as c, LiveRegion as l, LiveRegionElement as u, Spinner as d, mergeClasses as f } from "@epam/ai-dial-ui-kit";
4
+ import { IconAlertTriangle as p, IconArrowsMaximize as m, IconRefresh as h } from "@tabler/icons-react";
5
+ import { memo as g, useCallback as _, useEffect as v, useMemo as y, useRef as b, useState as x } from "react";
6
+ import { Fragment as S, jsx as C, jsxs as w } from "react/jsx-runtime";
7
7
  //#region src/constants/public-class-names.ts
8
- var C = {
8
+ var T = {
9
9
  preview: "dial-mcp-apps-preview",
10
10
  previewHeader: "dial-mcp-apps-preview-header"
11
- }, w = /* @__PURE__ */ function(e) {
11
+ }, E = /* @__PURE__ */ function(e) {
12
12
  return e.Loading = "loading", e.Ready = "ready", e.Error = "error", e.Unavailable = "unavailable", e;
13
- }({}), T = (e) => {
13
+ }({}), D = 500, O = 500, k = (e) => new Promise((t) => setTimeout(t, e)), A = (e) => {
14
14
  try {
15
15
  let t = JSON.parse(e);
16
16
  return typeof t == "object" && t ? t : {};
17
17
  } catch {
18
18
  return {};
19
19
  }
20
- }, E = (e) => {
20
+ }, j = (e) => {
21
21
  let t = /* @__PURE__ */ new Map();
22
22
  for (let n of e?.tool_messages ?? []) {
23
23
  for (let e of n.tool_calls ?? []) t.set(e.id, {
@@ -32,7 +32,7 @@ var C = {
32
32
  for (let n of e?.tool_execution_history ?? []) {
33
33
  for (let e of n.tool_calls ?? []) t.set(e.id, {
34
34
  name: e.function.name,
35
- args: T(e.function.arguments)
35
+ args: A(e.function.arguments)
36
36
  });
37
37
  if (n.role === "tool" && n.tool_call_id) {
38
38
  let e = t.get(n.tool_call_id);
@@ -40,18 +40,21 @@ var C = {
40
40
  }
41
41
  }
42
42
  return t;
43
- }, D = (e) => {
43
+ }, M = /[^a-zA-Z0-9_-]+/g, N = 64, P = (e) => {
44
+ let t = e.replace(M, "_");
45
+ return t !== "" && !/^[a-zA-Z_]/.test(t) && (t = `_${t}`), t.slice(0, N);
46
+ }, F = (e) => {
44
47
  let t = /* @__PURE__ */ new Set();
45
- for (let n of e) for (let e of E(n.custom_content?.state).values()) t.add(e.name);
48
+ for (let n of e) for (let e of j(n.custom_content?.state).values()) t.add(e.name);
46
49
  return t;
47
- }, O = (e, t, r) => {
50
+ }, I = (e, t) => {
48
51
  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) => {
52
+ let r = new Set([...j(e.custom_content?.state).values()].filter((e) => e.result != null).map((e) => e.name));
53
+ return t.find((e) => r.has(e.toolName)) || t.find((e) => e.discovery === "direct");
54
+ }, L = (e) => `${e}:mcp-app`, R = (e) => e == null ? void 0 : JSON.stringify(e.toolInput ?? null), z = (e, t) => {
52
55
  let n = e.custom_content?.state;
53
56
  if (!n) return;
54
- let r = [...E(n).values()].reverse().find((e) => e.name === t);
57
+ let r = [...j(n).values()].reverse().find((e) => e.name === t);
55
58
  if (r) return {
56
59
  toolInput: r.args,
57
60
  toolResult: r.result == null ? void 0 : { content: [{
@@ -59,191 +62,210 @@ var C = {
59
62
  text: r.result
60
63
  }] }
61
64
  };
62
- }, M = async (e, t, n) => {
63
- if (!(e.discovery === "direct" || t?.toolInput != null)) return t?.toolResult;
65
+ }, B = async (e, t, n) => {
66
+ if (e.discovery !== "direct" && t?.toolInput == null) return t?.toolResult;
67
+ let r = () => n(e.toolsetId, e.mcpToolName, t?.toolInput ?? {}, e.kind);
64
68
  try {
65
- return await n(e.toolsetId, e.mcpToolName, t?.toolInput ?? {}, e.kind);
69
+ return await r();
70
+ } catch {
71
+ await k(D + Math.random() * O);
72
+ }
73
+ try {
74
+ return await r();
66
75
  } catch {
67
76
  return t?.toolResult;
68
77
  }
69
- }, N = (t, n, r, i, a, o) => {
70
- let { hostContext: s, hostInfo: c, sandboxUrl: l, fetchResourceHtml: u, callTool: d } = a, [f, p] = y(), [m, _] = y(), [v, b] = y(() => t == null || l == null ? w.Unavailable : w.Loading), [x, S] = y(0), C = h(() => {
71
- r.invalidate(i), S((e) => e + 1);
72
- }, [r, i]), T = h(async (e) => {
73
- if (!(t == null || l == null)) try {
74
- let a = A(n), { html: o, toolResult: s } = await r.getOrFetch(i, a, async () => {
75
- let [e, r] = await Promise.all([u(t.toolsetId, t.resourceUri), M(t, n, d)]);
78
+ }, V = (t, n, r, i, a, o) => {
79
+ let { hostContext: s, hostInfo: c, sandboxUrl: l, fetchResourceHtml: u, callTool: d } = a, [f, p] = x(), [m, h] = x(), [g, y] = x(), S = b(n);
80
+ v(() => {
81
+ S.current = n;
82
+ });
83
+ let C = R(n), [w, T] = x(() => t == null || l == null ? E.Unavailable : E.Loading), [D, O] = x(0), k = _(() => {
84
+ r.invalidate(i), O((e) => e + 1);
85
+ }, [r, i]), A = _(async (e) => {
86
+ if (t != null && l != null) try {
87
+ let n = S.current, { html: a, toolResult: o } = await r.getOrFetch(i, C, async () => {
88
+ let [e, r] = await Promise.all([u(t.toolsetId, t.resourceUri), B(t, n, d)]);
76
89
  return {
77
90
  html: e,
78
91
  toolResult: r
79
92
  };
80
93
  });
81
94
  if (e()) return;
82
- p(o), _(s), b(w.Ready);
95
+ p(a), h(n?.toolInput), y(o), T(E.Ready);
83
96
  } catch {
84
- e() || b(w.Error);
97
+ e() || T(E.Error);
85
98
  }
86
99
  }, [
87
100
  t,
88
- n,
101
+ C,
89
102
  l,
90
103
  r,
91
104
  i,
92
105
  u,
93
106
  d
94
107
  ]);
95
- g(() => {
108
+ v(() => {
96
109
  if (t == null || l == null) {
97
- b(w.Unavailable);
110
+ T(E.Unavailable);
98
111
  return;
99
112
  }
100
113
  let e = !1;
101
- return b(w.Loading), T(() => e), () => {
114
+ return T(E.Loading), A(() => e), () => {
102
115
  e = !0;
103
116
  };
104
117
  }, [
105
118
  t,
106
119
  l,
107
- T,
108
- x
120
+ A,
121
+ D
109
122
  ]);
110
- let E = h(async (e, n) => {
123
+ let j = _(async (e, n) => {
111
124
  if (t == null) throw Error(`Tool call "${e}" failed: no matching MCP App`);
112
125
  return d(t.toolsetId, e, n, t.kind);
113
126
  }, [t, d]);
114
- return v !== w.Ready || t == null || l == null || f == null ? {
115
- status: v,
116
- reload: C,
117
- attemptId: x
127
+ return w !== E.Ready || t == null || l == null || f == null ? {
128
+ status: w,
129
+ reload: k,
130
+ attemptId: D
118
131
  } : {
119
- status: v,
120
- reload: C,
121
- attemptId: x,
132
+ status: w,
133
+ reload: k,
134
+ attemptId: D,
122
135
  content: {
123
136
  type: e.McpApp,
124
137
  html: f,
125
138
  sandboxUrl: l,
126
- toolInput: n?.toolInput,
127
- toolResult: m,
139
+ toolInput: m,
140
+ toolResult: g,
128
141
  hostContext: s,
129
142
  hostInfo: c,
130
- onToolCall: E,
143
+ onToolCall: j,
131
144
  onRequestDisplayMode: o
132
145
  }
133
146
  };
134
- }, P = {
135
- preview: "_preview_19as4_11",
136
- previewHeader: "_previewHeader_19as4_23"
137
- }, 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 }) => {
138
- let [F, I] = y(void 0);
139
- g(() => {
140
- I(void 0);
141
- }, [_]);
142
- let L = h((e) => e === "fullscreen" ? (T(), "fullscreen") : "inline", [T]), R = r({
143
- "--mcpapp-preview-bg": M?.previewBackground,
144
- "--mcpapp-preview-border": M?.previewBorder,
145
- "--mcpapp-preview-header-border": M?.previewHeaderBorder
146
- }), { status: z, content: B, reload: V, attemptId: H } = N(e, n, m, _, v, L);
147
- return z === w.Unavailable ? null : /* @__PURE__ */ S("div", {
148
- style: R,
149
- className: u(P.preview, "flex w-full min-w-0 flex-col overflow-hidden rounded-xl border", C.preview),
150
- children: [/* @__PURE__ */ S("div", {
151
- className: u(P.previewHeader, "flex min-h-10 items-center justify-between gap-2 border-b px-4 py-2", C.previewHeader),
152
- children: [/* @__PURE__ */ x(s, {
153
- text: F == null ? /* @__PURE__ */ x("span", {
154
- className: "dial-tiny-lead-semi-text",
147
+ }, H = {
148
+ preview: "_preview_1xqr3_10",
149
+ previewHeader: "_previewHeader_1xqr3_22",
150
+ headerText: "_headerText_1xqr3_26",
151
+ placeholderText: "_placeholderText_1xqr3_30",
152
+ errorIcon: "_errorIcon_1xqr3_34",
153
+ errorText: "_errorText_1xqr3_38"
154
+ }, U = g(({ match: e, toolCall: n, cache: g, cacheKey: y, hostAdapter: b, onExpand: D, expandAriaLabel: O, reloadAriaLabel: k, actionsGroupAriaLabel: A = "MCP app actions", loadErrorLabel: j, loadingAriaLabel: M = "Loading app", isOpenedInCanvas: N = !1, openedInCanvasLabel: P, colors: F, typography: I }) => {
155
+ let { headerNameClassName: L = "dial-tiny-lead-semi-text", messageClassName: R = "dial-body-text" } = I ?? {}, [z, B] = x(void 0);
156
+ v(() => {
157
+ B(void 0);
158
+ }, [y]);
159
+ let U = _((e) => e === "fullscreen" ? (D(), "fullscreen") : "inline", [D]), W = r({
160
+ "--mcpapp-preview-bg": F?.previewBackground,
161
+ "--mcpapp-preview-border": F?.previewBorder,
162
+ "--mcpapp-preview-header-border": F?.previewHeaderBorder,
163
+ "--mcpapp-header-text": F?.headerText,
164
+ "--mcpapp-placeholder-text": F?.placeholderText,
165
+ "--mcpapp-error-icon": F?.errorIcon,
166
+ "--mcpapp-error-text": F?.errorText
167
+ }), { status: G, content: K, reload: q, attemptId: J } = V(e, n, g, y, b, U);
168
+ if (G === E.Unavailable) return null;
169
+ let Y = "";
170
+ return N ? Y = P : G === E.Error && (Y = j), /* @__PURE__ */ w("div", {
171
+ style: W,
172
+ className: f(H.preview, "flex w-full min-w-0 flex-col overflow-hidden rounded-xl border", T.preview),
173
+ children: [/* @__PURE__ */ w("div", {
174
+ className: f(H.previewHeader, "flex min-h-10 items-center justify-between gap-2 border-b px-4 py-2", T.previewHeader),
175
+ children: [/* @__PURE__ */ C(s, {
176
+ text: z == null ? /* @__PURE__ */ C("span", {
177
+ className: L,
155
178
  children: e.mcpToolName
156
- }) : /* @__PURE__ */ S(b, { children: [
157
- /* @__PURE__ */ x("span", {
158
- className: "dial-tiny-lead-semi-text",
179
+ }) : /* @__PURE__ */ w(S, { children: [
180
+ /* @__PURE__ */ C("span", {
181
+ className: L,
159
182
  children: e.mcpToolName
160
183
  }),
161
- /* @__PURE__ */ x("span", {
184
+ /* @__PURE__ */ C("span", {
162
185
  "aria-hidden": !0,
163
- className: "border-current mx-1.5 inline-block h-3 w-0 border-s align-middle"
164
- }),
165
- /* @__PURE__ */ x("span", {
166
- className: "dial-tiny-lead-semi-text",
167
- children: F.name
186
+ className: "mx-1.5 inline-block h-3 w-0 border-s border-current align-middle"
168
187
  }),
169
- F.version && /* @__PURE__ */ x("span", {
170
- className: "dial-caption-text ms-2",
171
- children: F.version
188
+ /* @__PURE__ */ C("span", {
189
+ className: L,
190
+ children: z.name
172
191
  })
173
192
  ] }),
174
- className: "text-secondary"
175
- }), /* @__PURE__ */ S("div", {
193
+ className: H.headerText
194
+ }), /* @__PURE__ */ w("div", {
176
195
  role: "toolbar",
177
- "aria-label": O,
196
+ "aria-label": A,
178
197
  className: "flex shrink-0 items-center gap-1",
179
- children: [/* @__PURE__ */ x(c, {
180
- icon: /* @__PURE__ */ x(p, {
198
+ children: [/* @__PURE__ */ C(c, {
199
+ icon: /* @__PURE__ */ C(h, {
181
200
  size: i.SM,
182
201
  stroke: a,
183
202
  "aria-hidden": !0
184
203
  }),
185
- "aria-label": D,
204
+ "aria-label": k,
186
205
  size: o.Small,
187
- onClick: V
188
- }), /* @__PURE__ */ x(c, {
189
- icon: /* @__PURE__ */ x(f, {
206
+ onClick: q
207
+ }), /* @__PURE__ */ C(c, {
208
+ icon: /* @__PURE__ */ C(m, {
190
209
  size: i.SM,
191
210
  stroke: a,
192
211
  "aria-hidden": !0
193
212
  }),
194
- "aria-label": E,
213
+ "aria-label": O,
195
214
  size: o.Small,
196
- onClick: T
215
+ onClick: D
197
216
  })]
198
217
  })]
199
- }), /* @__PURE__ */ x("div", {
200
- className: "relative min-h-[200px] w-full",
201
- children: A ? /* @__PURE__ */ x("div", {
202
- role: "status",
203
- "aria-live": "polite",
218
+ }), /* @__PURE__ */ w("div", {
219
+ className: "relative min-h-[100px] w-full",
220
+ children: [/* @__PURE__ */ C(l, {
221
+ visuallyHidden: !0,
222
+ as: u.Span,
223
+ children: Y
224
+ }), N ? /* @__PURE__ */ C("div", {
225
+ "aria-hidden": !0,
204
226
  className: "absolute inset-0 flex items-center justify-center p-4",
205
- children: /* @__PURE__ */ x("span", {
206
- className: "dial-body-text text-center text-secondary",
207
- children: j
227
+ children: /* @__PURE__ */ C("span", {
228
+ className: f(R, "text-center", H.placeholderText),
229
+ children: P
208
230
  })
209
- }) : /* @__PURE__ */ S(b, { children: [
210
- z === w.Loading && /* @__PURE__ */ x("div", {
231
+ }) : /* @__PURE__ */ w(S, { children: [
232
+ G === E.Loading && /* @__PURE__ */ C("div", {
211
233
  className: "absolute inset-0 flex items-center justify-center",
212
- children: /* @__PURE__ */ x(l, {})
234
+ children: /* @__PURE__ */ C(d, { ariaLabel: M })
213
235
  }),
214
- z === w.Error && /* @__PURE__ */ S("div", {
236
+ G === E.Error && /* @__PURE__ */ w("div", {
215
237
  className: "absolute inset-0 flex flex-col items-center justify-center gap-2 p-4",
216
- children: [/* @__PURE__ */ x(d, {
238
+ children: [/* @__PURE__ */ C(p, {
217
239
  size: 40,
218
240
  stroke: a,
219
241
  "aria-hidden": !0,
220
- className: "text-error"
221
- }), /* @__PURE__ */ x("p", {
222
- role: "alert",
223
- className: "dial-body-text text-center text-primary",
224
- children: k
242
+ className: H.errorIcon
243
+ }), /* @__PURE__ */ C("p", {
244
+ "aria-hidden": !0,
245
+ className: f(R, "text-center", H.errorText),
246
+ children: j
225
247
  })]
226
248
  }),
227
- z === w.Ready && B && /* @__PURE__ */ x(t, {
228
- content: B,
229
- errorLabel: k,
230
- onAppInfo: I
231
- }, H)
232
- ] })
249
+ G === E.Ready && K && /* @__PURE__ */ C(t, {
250
+ content: K,
251
+ errorLabel: j,
252
+ onAppInfo: B
253
+ }, J)
254
+ ] })]
233
255
  })]
234
256
  });
235
- }), I = 900 * 1e3, L = (e) => {
236
- let t = v(/* @__PURE__ */ new Map()), n = v(/* @__PURE__ */ new Map());
237
- return _(() => {
257
+ }), W = 9e5, G = (e) => {
258
+ let t = b(/* @__PURE__ */ new Map()), n = b(/* @__PURE__ */ new Map());
259
+ return y(() => {
238
260
  let r = (t) => `${e}:${t}`, i = (e, t) => `${r(e)}::${t ?? ""}`, a = (e, n) => {
239
261
  let i = t.current.get(r(e));
240
- if (i != null && i.seedKey === n && !(Date.now() - i.cachedAt > I)) return {
262
+ if (i != null && i.seedKey === n && !(Date.now() - i.cachedAt > W)) return {
241
263
  html: i.html,
242
264
  toolResult: i.toolResult
243
265
  };
244
266
  }, o = (e, n, i) => {
245
267
  let a = Date.now();
246
- for (let [e, n] of t.current) a - n.cachedAt > I && t.current.delete(e);
268
+ for (let [e, n] of t.current) a - n.cachedAt > W && t.current.delete(e);
247
269
  t.current.set(r(e), {
248
270
  ...n,
249
271
  seedKey: i,
@@ -270,4 +292,4 @@ var C = {
270
292
  }, [e]);
271
293
  };
272
294
  //#endregion
273
- 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 };
295
+ export { T as MCP_APPS_CLASS, U as McpAppInlinePreview, E as McpAppInlinePreviewStatus, F as collectToolCallNames, R as computeMcpAppSeedKey, I as findMcpAppForMessage, L as mcpAppCanvasKey, z as resolveMcpAppToolCallSeed, B as resolveMcpAppToolResult, P as sanitizeToolName, V as useMcpAppInlinePreview, G as useMcpAppResponseCache };
@@ -1,5 +1,6 @@
1
- import { McpUiHostContext } from '@mcp-ui/client';
1
+ import { McpAppCanvasContent } from '@epam/ai-dial-attachment-canvas';
2
2
  import { CallToolResult, Implementation } from '@modelcontextprotocol/sdk/types.js';
3
+ type McpUiHostContext = NonNullable<McpAppCanvasContent['hostContext']>;
3
4
  /** 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
5
  export type McpDeploymentKind = 'toolset' | 'application';
5
6
  /**
@@ -112,5 +113,21 @@ export interface McpAppInlinePreviewColors {
112
113
  previewBorder?: string;
113
114
  /** Divider under the header strip. Fallback: `--stroke-tertiary`. */
114
115
  previewHeaderBorder?: string;
116
+ /** Text color of the header strip's app or tool name. Fallback: `--text-secondary`. */
117
+ headerText?: string;
118
+ /** Text color of the "opened in canvas" placeholder. Fallback: `--text-secondary`. */
119
+ placeholderText?: string;
120
+ /** Color of the load-error icon. Fallback: `--text-error`. */
121
+ errorIcon?: string;
122
+ /** Text color of the load-error message. Fallback: `--text-primary`. */
123
+ errorText?: string;
115
124
  }
125
+ /** Typography class overrides for `McpAppInlinePreview`. */
126
+ export interface McpAppInlinePreviewTypography {
127
+ /** Typography class of the header strip's tool and app names. Defaults to `'dial-tiny-lead-semi-text'`. */
128
+ headerNameClassName?: string;
129
+ /** Typography class of the "opened in canvas" and load-error messages. Defaults to `'dial-body-text'`. */
130
+ messageClassName?: string;
131
+ }
132
+ export {};
116
133
  //# 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,EACV,cAAc,EACd,cAAc,EACf,MAAM,oCAAoC,CAAC;AAE5C,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,iEAAi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;IAC3G,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,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.3.0-dev.35",
4
+ "version": "1.3.0-dev.354",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
7
7
  "main": "./index.js",
@@ -17,14 +17,13 @@
17
17
  }
18
18
  },
19
19
  "dependencies": {
20
- "@tabler/icons-react": "^3.44.0",
21
- "@mcp-ui/client": "^7.1.1",
22
- "@modelcontextprotocol/sdk": "^1.32.1",
23
- "@epam/ai-dial-attachment-canvas": "1.3.0-dev.35"
20
+ "@tabler/icons-react": "^3.50.0",
21
+ "@modelcontextprotocol/sdk": "^1.32.2",
22
+ "@epam/ai-dial-attachment-canvas": "1.3.0-dev.354"
24
23
  },
25
24
  "peerDependencies": {
26
- "@epam/ai-dial-chat-shared": "1.3.0-dev.35",
27
- "@epam/ai-dial-ui-kit": "^0.15.3",
25
+ "@epam/ai-dial-chat-shared": "1.3.0-dev.354",
26
+ "@epam/ai-dial-ui-kit": "^0.16.0",
28
27
  "react": "^19.2.8"
29
28
  },
30
29
  "repository": {
@@ -1,6 +1,20 @@
1
1
  import { Message } from '@epam/ai-dial-chat-shared';
2
2
  import { CallToolResult } from '@modelcontextprotocol/sdk/types.js';
3
3
  import { CallMcpAppTool, McpAppToolCallSeed, McpAppToolRef } from '../models/mcp-apps';
4
+ /**
5
+ * Reproduces the tool-name sanitization QuickApps applies to
6
+ * `${toolsetName}_${toolName}` before sending a tool to the LLM
7
+ * (`sanitize_toolname` in `epam/ai-dial-quickapps-backend`,
8
+ * `src/quickapp/common/utils.py`): every run of characters outside
9
+ * `[a-zA-Z0-9_-]` becomes a single `_`, a name not starting with a letter or `_`
10
+ * gets a leading `_`, and the result is cut to 64 characters.
11
+ *
12
+ * Temporary heuristic: the host has no toolset id on a tool call, so it can only
13
+ * correlate a call with a toolset by guessing this name. Replace it once MCP Apps
14
+ * are fully supported and the orchestrator reports the toolset a call belongs to.
15
+ * @param input - raw `${toolsetName}_${toolName}` (or `${toolsetName}_` prefix)
16
+ */
17
+ export declare const sanitizeToolName: (input: string) => string;
4
18
  /**
5
19
  * Collects every real tool-call name seen across `messages`' `custom_content.state`
6
20
  * (in whichever known orchestrator shape is present). Used to discover an MCP-capable
@@ -9,8 +23,9 @@ import { CallMcpAppTool, McpAppToolCallSeed, McpAppToolRef } from '../models/mcp
9
23
  export declare const collectToolCallNames: (messages: Message[]) => Set<string>;
10
24
  /**
11
25
  * Returns the `mcpAppTools` entry that best matches this message: the one
12
- * whose name was actually called (per `custom_content.state`, in whichever
13
- * of its two known orchestrator-specific shapes is present).
26
+ * whose name was actually called and has returned a result (per
27
+ * `custom_content.state`, in whichever of its two known orchestrator-specific
28
+ * shapes is present).
14
29
  *
15
30
  * If no real call matches, a `discovery: 'direct'` tool (the deployment
16
31
  * itself IS this MCP server, whether it's a bare Toolset or an Application —
@@ -23,18 +38,16 @@ export declare const collectToolCallNames: (messages: Message[]) => Set<string>;
23
38
  *
24
39
  * Otherwise (a `discovery: 'indirect'` match — a real MCP-capable toolset a
25
40
  * different, tool-calling deployment delegates to, guessed by name-prefix), a
26
- * real match is required once the message has settled; while still
27
- * streaming, `custom_content.state` may not have caught up with a tool call
28
- * the model already made this turn, so the first such tool is guessed
29
- * optimistically rather than popping in a beat late. Once settled, a
30
- * deployment that finished without calling any MCP-capable toolset must
31
- * never show the trigger, even though the deployment supports MCP Apps in
32
- * general.
41
+ * call to that tool that has already returned a result is required, whether
42
+ * the message is streaming or settled. A call without a result is still
43
+ * running, and with no call at all the model may never call the tool, so
44
+ * guessing earlier would mount the app on every answer in a conversation that
45
+ * once used it, and the app would wait for data that never arrives.
33
46
  *
34
47
  * Returns `undefined` for non-assistant messages or when the deployment has
35
48
  * no MCP-Apps-capable tool at all.
36
49
  */
37
- export declare const findMcpAppForMessage: (message: Message, mcpAppTools: McpAppToolRef[], isStreaming: boolean) => McpAppToolRef | undefined;
50
+ export declare const findMcpAppForMessage: (message: Message, mcpAppTools: McpAppToolRef[]) => McpAppToolRef | undefined;
38
51
  /** Stable key identifying a message's MCP App canvas in an attachment canvas's `attachmentId` tracking, mirroring the `${messageIndex}:${attachmentId}` scheme used for regular attachment tiles. */
39
52
  export declare const mcpAppCanvasKey: (messageIndex: number) => string;
40
53
  /**
@@ -76,18 +89,16 @@ export declare const resolveMcpAppToolCallSeed: (message: Message, toolName: str
76
89
  * - `seed?.toolInput != null` — a `discovery: 'indirect'` match (the toolset
77
90
  * a *different*, tool-calling deployment appears to delegate to) whose
78
91
  * `toolName` was matched against a *real* tool call actually seen in
79
- * `custom_content.state` (`findMcpAppForMessage`'s name-match branch, not
80
- * its streaming-optimistic `mcpAppTools[0]` guess). Once a real call is
81
- * confirmed, re-calling it with the exact same `toolsetId`/args it was
92
+ * `custom_content.state` (`findMcpAppForMessage`'s name-match branch).
93
+ * Once a real call is confirmed, re-calling it with the exact same `toolsetId`/args it was
82
94
  * really invoked with carries no more risk than the direct case.
83
95
  *
84
- * Only the streaming-optimistic guess (`discovery: 'indirect'` with no real
85
- * call seen yet, so `seed` is `undefined`) is skipped — that toolset/tool
86
- * pairing is still an unconfirmed guess, and re-calling it could hit the
87
- * wrong tool or re-trigger a non-idempotent side effect; it keeps
88
- * `seed?.toolResult` (`undefined` here) as-is. Falls back to
89
- * `seed?.toolResult` if an attempted live call fails (e.g. the deployment
90
- * has no live MCP session outside the original conversation turn).
96
+ * An `indirect` match with no seed is skipped — that toolset/tool pairing
97
+ * is unconfirmed, and re-calling it could hit the wrong tool or re-trigger a
98
+ * non-idempotent side effect; it keeps `seed?.toolResult` as-is. Falls back to
99
+ * `seed?.toolResult` if an attempted live call fails twice (e.g. the
100
+ * deployment has no live MCP session outside the original conversation turn).
101
+ * A failed live call is retried once after a short randomized delay.
91
102
  */
92
103
  export declare const resolveMcpAppToolResult: (match: McpAppToolRef, seed: McpAppToolCallSeed | undefined, callTool: CallMcpAppTool) => Promise<CallToolResult | undefined>;
93
104
  //# sourceMappingURL=mcp-app.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"mcp-app.d.ts","sourceRoot":"","sources":["../../src/utils/mcp-app.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,OAAO,EAEb,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,KAAK,EACV,cAAc,EACd,kBAAkB,EAClB,aAAa,EACd,MAAM,oBAAoB,CAAC;AA2D5B;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,GAAI,UAAU,OAAO,EAAE,KAAG,GAAG,CAAC,MAAM,CAUpE,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,eAAO,MAAM,oBAAoB,GAC/B,SAAS,OAAO,EAChB,aAAa,aAAa,EAAE,EAC5B,aAAa,OAAO,KACnB,aAAa,GAAG,SAclB,CAAC;AAEF,qMAAqM;AACrM,eAAO,MAAM,eAAe,GAAI,cAAc,MAAM,KAAG,MAC5B,CAAC;AAE5B;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,GAC/B,UAAU,kBAAkB,GAAG,SAAS,KACvC,MAAM,GAAG,SAC+D,CAAC;AAE5E;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,yBAAyB,GACpC,SAAS,OAAO,EAChB,UAAU,MAAM,KACf,kBAAkB,GAAG,SAgBvB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,eAAO,MAAM,uBAAuB,GAClC,OAAO,aAAa,EACpB,MAAM,kBAAkB,GAAG,SAAS,EACpC,UAAU,cAAc,KACvB,OAAO,CAAC,cAAc,GAAG,SAAS,C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