@epam/ai-dial-mcp-apps 1.3.0-dev.296 → 1.3.0-dev.304
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 +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,
|
|
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.js
CHANGED
|
@@ -47,10 +47,10 @@ var T = {
|
|
|
47
47
|
let t = /* @__PURE__ */ new Set();
|
|
48
48
|
for (let n of e) for (let e of O(n.custom_content?.state).values()) t.add(e.name);
|
|
49
49
|
return t;
|
|
50
|
-
}, N = (e, t
|
|
50
|
+
}, N = (e, t) => {
|
|
51
51
|
if (t.length === 0 || e.role !== n.Assistant) return;
|
|
52
|
-
let
|
|
53
|
-
return t.find((e) =>
|
|
52
|
+
let r = new Set([...O(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
54
|
}, P = (e) => `${e}:mcp-app`, F = (e) => e == null ? void 0 : JSON.stringify(e.toolInput ?? null), I = (e, t) => {
|
|
55
55
|
let n = e.custom_content?.state;
|
|
56
56
|
if (!n) return;
|
|
@@ -70,11 +70,15 @@ var T = {
|
|
|
70
70
|
return t?.toolResult;
|
|
71
71
|
}
|
|
72
72
|
}, R = (t, n, r, i, a, o) => {
|
|
73
|
-
let { hostContext: s, hostInfo: c, sandboxUrl: l, fetchResourceHtml: u, callTool: d } = a, [f, p] = x(), [m, h] = x(), [g, y] = x(
|
|
74
|
-
|
|
75
|
-
|
|
73
|
+
let { hostContext: s, hostInfo: c, sandboxUrl: l, fetchResourceHtml: u, callTool: d } = a, [f, p] = x(), [m, h] = x(), [g, y] = x(), S = b(n);
|
|
74
|
+
v(() => {
|
|
75
|
+
S.current = n;
|
|
76
|
+
});
|
|
77
|
+
let C = F(n), [w, T] = x(() => t == null || l == null ? E.Unavailable : E.Loading), [D, O] = x(0), k = _(() => {
|
|
78
|
+
r.invalidate(i), O((e) => e + 1);
|
|
79
|
+
}, [r, i]), A = _(async (e) => {
|
|
76
80
|
if (t != null && l != null) try {
|
|
77
|
-
let
|
|
81
|
+
let n = S.current, { html: a, toolResult: o } = await r.getOrFetch(i, C, async () => {
|
|
78
82
|
let [e, r] = await Promise.all([u(t.toolsetId, t.resourceUri), L(t, n, d)]);
|
|
79
83
|
return {
|
|
80
84
|
html: e,
|
|
@@ -82,13 +86,13 @@ var T = {
|
|
|
82
86
|
};
|
|
83
87
|
});
|
|
84
88
|
if (e()) return;
|
|
85
|
-
p(
|
|
89
|
+
p(a), h(n?.toolInput), y(o), T(E.Ready);
|
|
86
90
|
} catch {
|
|
87
|
-
e() ||
|
|
91
|
+
e() || T(E.Error);
|
|
88
92
|
}
|
|
89
93
|
}, [
|
|
90
94
|
t,
|
|
91
|
-
|
|
95
|
+
C,
|
|
92
96
|
l,
|
|
93
97
|
r,
|
|
94
98
|
i,
|
|
@@ -97,40 +101,40 @@ var T = {
|
|
|
97
101
|
]);
|
|
98
102
|
v(() => {
|
|
99
103
|
if (t == null || l == null) {
|
|
100
|
-
|
|
104
|
+
T(E.Unavailable);
|
|
101
105
|
return;
|
|
102
106
|
}
|
|
103
107
|
let e = !1;
|
|
104
|
-
return
|
|
108
|
+
return T(E.Loading), A(() => e), () => {
|
|
105
109
|
e = !0;
|
|
106
110
|
};
|
|
107
111
|
}, [
|
|
108
112
|
t,
|
|
109
113
|
l,
|
|
110
|
-
|
|
111
|
-
|
|
114
|
+
A,
|
|
115
|
+
D
|
|
112
116
|
]);
|
|
113
|
-
let
|
|
117
|
+
let j = _(async (e, n) => {
|
|
114
118
|
if (t == null) throw Error(`Tool call "${e}" failed: no matching MCP App`);
|
|
115
119
|
return d(t.toolsetId, e, n, t.kind);
|
|
116
120
|
}, [t, d]);
|
|
117
|
-
return
|
|
118
|
-
status:
|
|
119
|
-
reload:
|
|
120
|
-
attemptId:
|
|
121
|
+
return w !== E.Ready || t == null || l == null || f == null ? {
|
|
122
|
+
status: w,
|
|
123
|
+
reload: k,
|
|
124
|
+
attemptId: D
|
|
121
125
|
} : {
|
|
122
|
-
status:
|
|
123
|
-
reload:
|
|
124
|
-
attemptId:
|
|
126
|
+
status: w,
|
|
127
|
+
reload: k,
|
|
128
|
+
attemptId: D,
|
|
125
129
|
content: {
|
|
126
130
|
type: e.McpApp,
|
|
127
131
|
html: f,
|
|
128
132
|
sandboxUrl: l,
|
|
129
|
-
toolInput:
|
|
130
|
-
toolResult:
|
|
133
|
+
toolInput: m,
|
|
134
|
+
toolResult: g,
|
|
131
135
|
hostContext: s,
|
|
132
136
|
hostInfo: c,
|
|
133
|
-
onToolCall:
|
|
137
|
+
onToolCall: j,
|
|
134
138
|
onRequestDisplayMode: o
|
|
135
139
|
}
|
|
136
140
|
};
|
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.
|
|
4
|
+
"version": "1.3.0-dev.304",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "./index.js",
|
|
@@ -19,10 +19,10 @@
|
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@tabler/icons-react": "^3.50.0",
|
|
21
21
|
"@modelcontextprotocol/sdk": "^1.32.2",
|
|
22
|
-
"@epam/ai-dial-attachment-canvas": "1.3.0-dev.
|
|
22
|
+
"@epam/ai-dial-attachment-canvas": "1.3.0-dev.304"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
|
-
"@epam/ai-dial-chat-shared": "1.3.0-dev.
|
|
25
|
+
"@epam/ai-dial-chat-shared": "1.3.0-dev.304",
|
|
26
26
|
"@epam/ai-dial-ui-kit": "^0.16.0-dev.67",
|
|
27
27
|
"react": "^19.2.8"
|
|
28
28
|
},
|
package/utils/mcp-app.d.ts
CHANGED
|
@@ -23,8 +23,9 @@ export declare const sanitizeToolName: (input: string) => string;
|
|
|
23
23
|
export declare const collectToolCallNames: (messages: Message[]) => Set<string>;
|
|
24
24
|
/**
|
|
25
25
|
* Returns the `mcpAppTools` entry that best matches this message: the one
|
|
26
|
-
* whose name was actually called
|
|
27
|
-
* of its two known orchestrator-specific
|
|
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).
|
|
28
29
|
*
|
|
29
30
|
* If no real call matches, a `discovery: 'direct'` tool (the deployment
|
|
30
31
|
* itself IS this MCP server, whether it's a bare Toolset or an Application —
|
|
@@ -37,18 +38,16 @@ export declare const collectToolCallNames: (messages: Message[]) => Set<string>;
|
|
|
37
38
|
*
|
|
38
39
|
* Otherwise (a `discovery: 'indirect'` match — a real MCP-capable toolset a
|
|
39
40
|
* different, tool-calling deployment delegates to, guessed by name-prefix), a
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
* never show the trigger, even though the deployment supports MCP Apps in
|
|
46
|
-
* 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.
|
|
47
46
|
*
|
|
48
47
|
* Returns `undefined` for non-assistant messages or when the deployment has
|
|
49
48
|
* no MCP-Apps-capable tool at all.
|
|
50
49
|
*/
|
|
51
|
-
export declare const findMcpAppForMessage: (message: Message, mcpAppTools: McpAppToolRef[]
|
|
50
|
+
export declare const findMcpAppForMessage: (message: Message, mcpAppTools: McpAppToolRef[]) => McpAppToolRef | undefined;
|
|
52
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. */
|
|
53
52
|
export declare const mcpAppCanvasKey: (messageIndex: number) => string;
|
|
54
53
|
/**
|
|
@@ -90,16 +89,13 @@ export declare const resolveMcpAppToolCallSeed: (message: Message, toolName: str
|
|
|
90
89
|
* - `seed?.toolInput != null` — a `discovery: 'indirect'` match (the toolset
|
|
91
90
|
* a *different*, tool-calling deployment appears to delegate to) whose
|
|
92
91
|
* `toolName` was matched against a *real* tool call actually seen in
|
|
93
|
-
* `custom_content.state` (`findMcpAppForMessage`'s name-match branch
|
|
94
|
-
*
|
|
95
|
-
* 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
|
|
96
94
|
* really invoked with carries no more risk than the direct case.
|
|
97
95
|
*
|
|
98
|
-
*
|
|
99
|
-
*
|
|
100
|
-
*
|
|
101
|
-
* wrong tool or re-trigger a non-idempotent side effect; it keeps
|
|
102
|
-
* `seed?.toolResult` (`undefined` here) as-is. Falls back to
|
|
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
|
|
103
99
|
* `seed?.toolResult` if an attempted live call fails (e.g. the deployment
|
|
104
100
|
* has no live MCP session outside the original conversation turn).
|
|
105
101
|
*/
|
package/utils/mcp-app.d.ts.map
CHANGED
|
@@ -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;AA8D5B;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,gBAAgB,GAAI,OAAO,MAAM,KAAG,MAMhD,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,GAAI,UAAU,OAAO,EAAE,KAAG,GAAG,CAAC,MAAM,CAUpE,CAAC;AAEF
|
|
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;AA8D5B;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,gBAAgB,GAAI,OAAO,MAAM,KAAG,MAMhD,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,GAAI,UAAU,OAAO,EAAE,KAAG,GAAG,CAAC,MAAM,CAUpE,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,oBAAoB,GAC/B,SAAS,OAAO,EAChB,aAAa,aAAa,EAAE,KAC3B,aAAa,GAAG,SAYlB,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,eAAO,MAAM,uBAAuB,GAClC,OAAO,aAAa,EACpB,MAAM,kBAAkB,GAAG,SAAS,EACpC,UAAU,cAAc,KACvB,OAAO,CAAC,cAAc,GAAG,SAAS,CAgBpC,CAAC"}
|