@epam/ai-dial-mcp-apps 1.3.0-dev.364 → 1.3.0-dev.371
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/index.d.ts +2 -1
- package/index.d.ts.map +1 -1
- package/index.js +38 -34
- package/models/mcp-apps.d.ts +1 -18
- package/models/mcp-apps.d.ts.map +1 -1
- package/package.json +3 -3
- package/types/mcp-apps.d.ts +25 -0
- package/types/mcp-apps.d.ts.map +1 -0
- package/utils/mcp-app.d.ts +4 -4
- package/utils/mcp-app.d.ts.map +1 -1
package/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export { McpAppInlinePreview, type McpAppInlinePreviewProps, } from './components/McpAppInlinePreview/McpAppInlinePreview';
|
|
2
2
|
export { useMcpAppInlinePreview, type McpAppInlinePreviewState, } from './hooks/useMcpAppInlinePreview/useMcpAppInlinePreview';
|
|
3
3
|
export { useMcpAppResponseCache } from './hooks/useMcpAppResponseCache/useMcpAppResponseCache';
|
|
4
|
-
export
|
|
4
|
+
export { McpAppToolDiscovery, McpDeploymentKind } from './types/mcp-apps';
|
|
5
|
+
export type { McpAppToolRef, McpAppToolCallSeed, FetchMcpAppResourceHtml, CallMcpAppTool, CachedMcpAppResponse, McpAppResponseCache, McpAppHostAdapter, } from './models/mcp-apps';
|
|
5
6
|
export { McpAppInlinePreviewStatus } from './models/mcp-apps';
|
|
6
7
|
export { collectToolCallNames, findMcpAppForMessage, mcpAppCanvasKey, computeMcpAppSeedKey, resolveMcpAppToolCallSeed, resolveMcpAppToolResult, sanitizeToolName, } from './utils/mcp-app';
|
|
7
8
|
export { MCP_APPS_CLASS } from './constants/public-class-names';
|
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,
|
|
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,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAC1E,YAAY,EACV,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
|
@@ -10,14 +10,18 @@ var T = {
|
|
|
10
10
|
previewHeader: "dial-mcp-apps-preview-header"
|
|
11
11
|
}, E = /* @__PURE__ */ function(e) {
|
|
12
12
|
return e.Loading = "loading", e.Ready = "ready", e.Error = "error", e.Unavailable = "unavailable", e;
|
|
13
|
-
}({}), D =
|
|
13
|
+
}({}), D = /* @__PURE__ */ function(e) {
|
|
14
|
+
return e.Toolset = "toolset", e.Application = "application", e;
|
|
15
|
+
}({}), O = /* @__PURE__ */ function(e) {
|
|
16
|
+
return e.Direct = "direct", e.Indirect = "indirect", e;
|
|
17
|
+
}({}), k = 500, A = 500, j = (e) => new Promise((t) => setTimeout(t, e)), M = (e) => {
|
|
14
18
|
try {
|
|
15
19
|
let t = JSON.parse(e);
|
|
16
20
|
return typeof t == "object" && t ? t : {};
|
|
17
21
|
} catch {
|
|
18
22
|
return {};
|
|
19
23
|
}
|
|
20
|
-
},
|
|
24
|
+
}, N = (e) => {
|
|
21
25
|
let t = /* @__PURE__ */ new Map();
|
|
22
26
|
for (let n of e?.tool_messages ?? []) {
|
|
23
27
|
for (let e of n.tool_calls ?? []) t.set(e.id, {
|
|
@@ -32,7 +36,7 @@ var T = {
|
|
|
32
36
|
for (let n of e?.tool_execution_history ?? []) {
|
|
33
37
|
for (let e of n.tool_calls ?? []) t.set(e.id, {
|
|
34
38
|
name: e.function.name,
|
|
35
|
-
args:
|
|
39
|
+
args: M(e.function.arguments)
|
|
36
40
|
});
|
|
37
41
|
if (n.role === "tool" && n.tool_call_id) {
|
|
38
42
|
let e = t.get(n.tool_call_id);
|
|
@@ -40,21 +44,21 @@ var T = {
|
|
|
40
44
|
}
|
|
41
45
|
}
|
|
42
46
|
return t;
|
|
43
|
-
},
|
|
44
|
-
let t = e.replace(
|
|
45
|
-
return t !== "" && !/^[a-zA-Z_]/.test(t) && (t = `_${t}`), t.slice(0,
|
|
46
|
-
},
|
|
47
|
+
}, P = /[^a-zA-Z0-9_-]+/g, F = 64, I = (e) => {
|
|
48
|
+
let t = e.replace(P, "_");
|
|
49
|
+
return t !== "" && !/^[a-zA-Z_]/.test(t) && (t = `_${t}`), t.slice(0, F);
|
|
50
|
+
}, L = (e) => {
|
|
47
51
|
let t = /* @__PURE__ */ new Set();
|
|
48
|
-
for (let n of e) for (let e of
|
|
52
|
+
for (let n of e) for (let e of N(n.custom_content?.state).values()) t.add(e.name);
|
|
49
53
|
return t;
|
|
50
|
-
},
|
|
54
|
+
}, R = (e, t) => {
|
|
51
55
|
if (t.length === 0 || e.role !== n.Assistant) return;
|
|
52
|
-
let r = new Set([...
|
|
53
|
-
return t.find((e) => r.has(e.toolName)) || t.find((e) => e.discovery ===
|
|
54
|
-
},
|
|
56
|
+
let r = new Set([...N(e.custom_content?.state).values()].filter((e) => e.result != null).map((e) => e.name));
|
|
57
|
+
return t.find((e) => r.has(e.toolName)) || t.find((e) => e.discovery === O.Direct);
|
|
58
|
+
}, z = (e) => `${e}:mcp-app`, B = (e) => e == null ? void 0 : JSON.stringify(e.toolInput ?? null), V = (e, t) => {
|
|
55
59
|
let n = e.custom_content?.state;
|
|
56
60
|
if (!n) return;
|
|
57
|
-
let r = [...
|
|
61
|
+
let r = [...N(n).values()].reverse().find((e) => e.name === t);
|
|
58
62
|
if (r) return {
|
|
59
63
|
toolInput: r.args,
|
|
60
64
|
toolResult: r.result == null ? void 0 : { content: [{
|
|
@@ -62,30 +66,30 @@ var T = {
|
|
|
62
66
|
text: r.result
|
|
63
67
|
}] }
|
|
64
68
|
};
|
|
65
|
-
},
|
|
66
|
-
if (e.discovery !==
|
|
69
|
+
}, H = async (e, t, n) => {
|
|
70
|
+
if (e.discovery !== O.Direct && t?.toolInput == null) return t?.toolResult;
|
|
67
71
|
let r = () => n(e.toolsetId, e.mcpToolName, t?.toolInput ?? {}, e.kind);
|
|
68
72
|
try {
|
|
69
73
|
return await r();
|
|
70
74
|
} catch {
|
|
71
|
-
await k
|
|
75
|
+
await j(k + Math.random() * A);
|
|
72
76
|
}
|
|
73
77
|
try {
|
|
74
78
|
return await r();
|
|
75
79
|
} catch {
|
|
76
80
|
return t?.toolResult;
|
|
77
81
|
}
|
|
78
|
-
},
|
|
82
|
+
}, U = (t, n, r, i, a, o) => {
|
|
79
83
|
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
84
|
v(() => {
|
|
81
85
|
S.current = n;
|
|
82
86
|
});
|
|
83
|
-
let C =
|
|
87
|
+
let C = B(n), [w, T] = x(() => t == null || l == null ? E.Unavailable : E.Loading), [D, O] = x(0), k = _(() => {
|
|
84
88
|
r.invalidate(i), O((e) => e + 1);
|
|
85
89
|
}, [r, i]), A = _(async (e) => {
|
|
86
90
|
if (t != null && l != null) try {
|
|
87
91
|
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),
|
|
92
|
+
let [e, r] = await Promise.all([u(t.toolsetId, t.resourceUri), H(t, n, d)]);
|
|
89
93
|
return {
|
|
90
94
|
html: e,
|
|
91
95
|
toolResult: r
|
|
@@ -144,19 +148,19 @@ var T = {
|
|
|
144
148
|
onRequestDisplayMode: o
|
|
145
149
|
}
|
|
146
150
|
};
|
|
147
|
-
},
|
|
151
|
+
}, W = {
|
|
148
152
|
preview: "_preview_1xqr3_10",
|
|
149
153
|
previewHeader: "_previewHeader_1xqr3_22",
|
|
150
154
|
headerText: "_headerText_1xqr3_26",
|
|
151
155
|
placeholderText: "_placeholderText_1xqr3_30",
|
|
152
156
|
errorIcon: "_errorIcon_1xqr3_34",
|
|
153
157
|
errorText: "_errorText_1xqr3_38"
|
|
154
|
-
},
|
|
158
|
+
}, G = 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
159
|
let { headerNameClassName: L = "dial-tiny-lead-semi-text", messageClassName: R = "dial-body-text" } = I ?? {}, [z, B] = x(void 0);
|
|
156
160
|
v(() => {
|
|
157
161
|
B(void 0);
|
|
158
162
|
}, [y]);
|
|
159
|
-
let
|
|
163
|
+
let V = _((e) => e === "fullscreen" ? (D(), "fullscreen") : "inline", [D]), H = r({
|
|
160
164
|
"--mcpapp-preview-bg": F?.previewBackground,
|
|
161
165
|
"--mcpapp-preview-border": F?.previewBorder,
|
|
162
166
|
"--mcpapp-preview-header-border": F?.previewHeaderBorder,
|
|
@@ -164,14 +168,14 @@ var T = {
|
|
|
164
168
|
"--mcpapp-placeholder-text": F?.placeholderText,
|
|
165
169
|
"--mcpapp-error-icon": F?.errorIcon,
|
|
166
170
|
"--mcpapp-error-text": F?.errorText
|
|
167
|
-
}), { status: G, content: K, reload: q, attemptId: J } =
|
|
171
|
+
}), { status: G, content: K, reload: q, attemptId: J } = U(e, n, g, y, b, V);
|
|
168
172
|
if (G === E.Unavailable) return null;
|
|
169
173
|
let Y = "";
|
|
170
174
|
return N ? Y = P : G === E.Error && (Y = j), /* @__PURE__ */ w("div", {
|
|
171
|
-
style:
|
|
172
|
-
className: f(
|
|
175
|
+
style: H,
|
|
176
|
+
className: f(W.preview, "flex w-full min-w-0 flex-col overflow-hidden rounded-xl border", T.preview),
|
|
173
177
|
children: [/* @__PURE__ */ w("div", {
|
|
174
|
-
className: f(
|
|
178
|
+
className: f(W.previewHeader, "flex min-h-10 items-center justify-between gap-2 border-b px-4 py-2", T.previewHeader),
|
|
175
179
|
children: [/* @__PURE__ */ C(s, {
|
|
176
180
|
text: z == null ? /* @__PURE__ */ C("span", {
|
|
177
181
|
className: L,
|
|
@@ -190,7 +194,7 @@ var T = {
|
|
|
190
194
|
children: z.name
|
|
191
195
|
})
|
|
192
196
|
] }),
|
|
193
|
-
className:
|
|
197
|
+
className: W.headerText
|
|
194
198
|
}), /* @__PURE__ */ w("div", {
|
|
195
199
|
role: "toolbar",
|
|
196
200
|
"aria-label": A,
|
|
@@ -225,7 +229,7 @@ var T = {
|
|
|
225
229
|
"aria-hidden": !0,
|
|
226
230
|
className: "absolute inset-0 flex items-center justify-center p-4",
|
|
227
231
|
children: /* @__PURE__ */ C("span", {
|
|
228
|
-
className: f(R, "text-center",
|
|
232
|
+
className: f(R, "text-center", W.placeholderText),
|
|
229
233
|
children: P
|
|
230
234
|
})
|
|
231
235
|
}) : /* @__PURE__ */ w(S, { children: [
|
|
@@ -239,10 +243,10 @@ var T = {
|
|
|
239
243
|
size: 40,
|
|
240
244
|
stroke: a,
|
|
241
245
|
"aria-hidden": !0,
|
|
242
|
-
className:
|
|
246
|
+
className: W.errorIcon
|
|
243
247
|
}), /* @__PURE__ */ C("p", {
|
|
244
248
|
"aria-hidden": !0,
|
|
245
|
-
className: f(R, "text-center",
|
|
249
|
+
className: f(R, "text-center", W.errorText),
|
|
246
250
|
children: j
|
|
247
251
|
})]
|
|
248
252
|
}),
|
|
@@ -254,18 +258,18 @@ var T = {
|
|
|
254
258
|
] })]
|
|
255
259
|
})]
|
|
256
260
|
});
|
|
257
|
-
}),
|
|
261
|
+
}), K = 9e5, q = (e) => {
|
|
258
262
|
let t = b(/* @__PURE__ */ new Map()), n = b(/* @__PURE__ */ new Map());
|
|
259
263
|
return y(() => {
|
|
260
264
|
let r = (t) => `${e}:${t}`, i = (e, t) => `${r(e)}::${t ?? ""}`, a = (e, n) => {
|
|
261
265
|
let i = t.current.get(r(e));
|
|
262
|
-
if (i != null && i.seedKey === n && !(Date.now() - i.cachedAt >
|
|
266
|
+
if (i != null && i.seedKey === n && !(Date.now() - i.cachedAt > K)) return {
|
|
263
267
|
html: i.html,
|
|
264
268
|
toolResult: i.toolResult
|
|
265
269
|
};
|
|
266
270
|
}, o = (e, n, i) => {
|
|
267
271
|
let a = Date.now();
|
|
268
|
-
for (let [e, n] of t.current) a - n.cachedAt >
|
|
272
|
+
for (let [e, n] of t.current) a - n.cachedAt > K && t.current.delete(e);
|
|
269
273
|
t.current.set(r(e), {
|
|
270
274
|
...n,
|
|
271
275
|
seedKey: i,
|
|
@@ -292,4 +296,4 @@ var T = {
|
|
|
292
296
|
}, [e]);
|
|
293
297
|
};
|
|
294
298
|
//#endregion
|
|
295
|
-
export { T as MCP_APPS_CLASS,
|
|
299
|
+
export { T as MCP_APPS_CLASS, G 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, U as useMcpAppInlinePreview, q as useMcpAppResponseCache };
|
package/models/mcp-apps.d.ts
CHANGED
|
@@ -1,24 +1,7 @@
|
|
|
1
1
|
import { McpAppCanvasContent } from '@epam/ai-dial-attachment-canvas';
|
|
2
2
|
import { CallToolResult, Implementation } from '@modelcontextprotocol/sdk/types.js';
|
|
3
|
+
import { McpAppToolDiscovery, McpDeploymentKind } from '../types/mcp-apps';
|
|
3
4
|
type McpUiHostContext = NonNullable<McpAppCanvasContent['hostContext']>;
|
|
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. */
|
|
5
|
-
export type McpDeploymentKind = 'toolset' | 'application';
|
|
6
|
-
/**
|
|
7
|
-
* How a tool was discovered — determines whether it's safe to live-re-call
|
|
8
|
-
* (see `resolveMcpAppToolResult`) or treat as "always available" for a
|
|
9
|
-
* message with no other evidence (see `findMcpAppForMessage`).
|
|
10
|
-
*
|
|
11
|
-
* - `'direct'`: the active deployment itself IS this MCP server (whether
|
|
12
|
-
* it's a bare Toolset or an Application declaring `features.mcp`) — the
|
|
13
|
-
* host is talking to it directly, so which tool a mounted app's own
|
|
14
|
-
* invocation targets is unambiguous.
|
|
15
|
-
* - `'indirect'`: a different, tool-calling deployment's message happened to
|
|
16
|
-
* call a name prefixed with a toolset's display name; the toolset is a
|
|
17
|
-
* name-prefix *guess*, not a confirmed link the host was told about, so
|
|
18
|
-
* re-calling it live risks hitting the wrong tool or re-triggering a
|
|
19
|
-
* non-idempotent side effect.
|
|
20
|
-
*/
|
|
21
|
-
export type McpAppToolDiscovery = 'direct' | 'indirect';
|
|
22
5
|
/** A tool's declared MCP Apps UI resource, keyed by the toolset it was discovered on. */
|
|
23
6
|
export interface McpAppToolRef {
|
|
24
7
|
/** Id of the toolset/application this tool was discovered on. */
|
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;
|
|
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,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,MAA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AE,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,uFAAuF;IACvF,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,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,2GAA2G;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.
|
|
4
|
+
"version": "1.3.0-dev.371",
|
|
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.371"
|
|
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.371",
|
|
26
26
|
"@epam/ai-dial-ui-kit": "^0.16.0",
|
|
27
27
|
"react": "^19.2.8"
|
|
28
28
|
},
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/** 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. */
|
|
2
|
+
export declare enum McpDeploymentKind {
|
|
3
|
+
Toolset = "toolset",
|
|
4
|
+
Application = "application"
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* How a tool was discovered — determines whether it's safe to live-re-call
|
|
8
|
+
* (see `resolveMcpAppToolResult`) or treat as "always available" for a
|
|
9
|
+
* message with no other evidence (see `findMcpAppForMessage`).
|
|
10
|
+
*
|
|
11
|
+
* - `Direct`: the active deployment itself IS this MCP server (whether
|
|
12
|
+
* it's a bare Toolset or an Application declaring `features.mcp`) — the
|
|
13
|
+
* host is talking to it directly, so which tool a mounted app's own
|
|
14
|
+
* invocation targets is unambiguous.
|
|
15
|
+
* - `Indirect`: a different, tool-calling deployment's message happened to
|
|
16
|
+
* call a name prefixed with a toolset's display name; the toolset is a
|
|
17
|
+
* name-prefix *guess*, not a confirmed link the host was told about, so
|
|
18
|
+
* re-calling it live risks hitting the wrong tool or re-triggering a
|
|
19
|
+
* non-idempotent side effect.
|
|
20
|
+
*/
|
|
21
|
+
export declare enum McpAppToolDiscovery {
|
|
22
|
+
Direct = "direct",
|
|
23
|
+
Indirect = "indirect"
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=mcp-apps.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-apps.d.ts","sourceRoot":"","sources":["../../src/types/mcp-apps.ts"],"names":[],"mappings":"AAAA,mJAAmJ;AACnJ,oBAAY,iBAAiB;IAC3B,OAAO,YAAY;IACnB,WAAW,gBAAgB;CAC5B;AAED;;;;;;;;;;;;;;GAcG;AACH,oBAAY,mBAAmB;IAC7B,MAAM,WAAW;IACjB,QAAQ,aAAa;CACtB"}
|
package/utils/mcp-app.d.ts
CHANGED
|
@@ -27,7 +27,7 @@ export declare const collectToolCallNames: (messages: Message[]) => Set<string>;
|
|
|
27
27
|
* `custom_content.state`, in whichever of its two known orchestrator-specific
|
|
28
28
|
* shapes is present).
|
|
29
29
|
*
|
|
30
|
-
* If no real call matches, a `
|
|
30
|
+
* If no real call matches, a `McpAppToolDiscovery.Direct` tool (the deployment
|
|
31
31
|
* itself IS this MCP server, whether it's a bare Toolset or an Application —
|
|
32
32
|
* see `useMcpAppTools`) always wins regardless: such a deployment's own
|
|
33
33
|
* response IS its MCP App responding, and it typically never populates
|
|
@@ -36,7 +36,7 @@ export declare const collectToolCallNames: (messages: Message[]) => Set<string>;
|
|
|
36
36
|
* class of self-hosted-app gap `openspec/changes/archive/2026-09-30-mcp-apps-support/design.md`'s D9 "Known gap" documents for
|
|
37
37
|
* discovery — here it recurs at per-message matching).
|
|
38
38
|
*
|
|
39
|
-
* Otherwise (a `
|
|
39
|
+
* Otherwise (a `McpAppToolDiscovery.Indirect` match — a real MCP-capable toolset a
|
|
40
40
|
* different, tool-calling deployment delegates to, guessed by name-prefix), a
|
|
41
41
|
* call to that tool that has already returned a result is required, whether
|
|
42
42
|
* the message is streaming or settled. A call without a result is still
|
|
@@ -79,14 +79,14 @@ export declare const resolveMcpAppToolCallSeed: (message: Message, toolName: str
|
|
|
79
79
|
* app's UI to render anything at all.
|
|
80
80
|
*
|
|
81
81
|
* Attempted whenever the call is confirmed safe:
|
|
82
|
-
* - `match.discovery ===
|
|
82
|
+
* - `match.discovery === McpAppToolDiscovery.Direct` — the deployment the host is talking to
|
|
83
83
|
* IS this MCP server (whether a bare Toolset or an Application), so
|
|
84
84
|
* `toolsetId`/`mcpToolName`/`kind` are unambiguous. Called even when `seed`
|
|
85
85
|
* has no `toolInput`, since a self-hosting MCP App never populates
|
|
86
86
|
* `custom_content.state` in the first place (see `findMcpAppForMessage`) —
|
|
87
87
|
* `{}` is passed instead, the same "give me your current/initial state"
|
|
88
88
|
* call the app's own resource would make on `ui/initialize`.
|
|
89
|
-
* - `seed?.toolInput != null` — a `
|
|
89
|
+
* - `seed?.toolInput != null` — a `McpAppToolDiscovery.Indirect` match (the toolset
|
|
90
90
|
* a *different*, tool-calling deployment appears to delegate to) whose
|
|
91
91
|
* `toolName` was matched against a *real* tool call actually seen in
|
|
92
92
|
* `custom_content.state` (`findMcpAppForMessage`'s name-match branch).
|
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;
|
|
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;AAyE5B;;;;;;;;;;;;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,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