@epam/ai-dial-chat-hooks 1.2.0-dev.61 → 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.
- package/attachment/useAttachmentValidation/useAttachmentValidation.js +26 -19
- package/attachments.d.ts +10 -4
- package/index.d.ts +18 -10
- package/mcp-apps/useMcpAppHostAdapter/useMcpAppHostAdapter.js +7 -5
- package/mcp-apps/useMcpAppHostContext/useMcpAppHostContext.js +1 -1
- package/mcp-apps/useOpenMcpAppCanvas/useOpenMcpAppCanvas.js +25 -23
- package/mcp-apps.d.ts +8 -6
- package/package.json +15 -15
|
@@ -4,31 +4,38 @@ import { useCallback as n, useEffect as r, useMemo as i, useRef as a } from "rea
|
|
|
4
4
|
import { isMimeTypeAllowed as o, mimeTypesToExtensionLabels as s } from "@epam/ai-dial-attachment-input";
|
|
5
5
|
//#region src/attachment/useAttachmentValidation/useAttachmentValidation.ts
|
|
6
6
|
var c = 100, l = /* @__PURE__ */ function(e) {
|
|
7
|
-
return e.NoTypesAllowed = "noTypesAllowed", e.UnsupportedType = "unsupportedType", e;
|
|
8
|
-
}({}), u = ({ allowedMimeTypes: l,
|
|
9
|
-
let
|
|
10
|
-
(
|
|
11
|
-
let
|
|
7
|
+
return e.NoTypesAllowed = "noTypesAllowed", e.UnsupportedType = "unsupportedType", e.FileTooLarge = "fileTooLarge", e;
|
|
8
|
+
}({}), u = ({ allowedMimeTypes: l, maxFileSizeBytes: u, onValidationError: d, debounceMs: f = c }) => {
|
|
9
|
+
let p = a(l);
|
|
10
|
+
(p.current.length !== l.length || p.current.some((e, t) => e !== l[t])) && (p.current = l);
|
|
11
|
+
let m = p.current, h = m.length > 0, g = i(() => e(m), [m]), _ = a(null), v = a(null);
|
|
12
12
|
return r(() => () => {
|
|
13
|
-
|
|
13
|
+
_.current != null && clearTimeout(_.current), v.current != null && clearTimeout(v.current);
|
|
14
14
|
}, []), {
|
|
15
|
-
inputAttachmentTypes:
|
|
16
|
-
isAttachmentsAllowed:
|
|
15
|
+
inputAttachmentTypes: m,
|
|
16
|
+
isAttachmentsAllowed: h,
|
|
17
17
|
validateAttachment: n((e) => {
|
|
18
|
-
if (!o(e.contentType,
|
|
19
|
-
let e =
|
|
20
|
-
|
|
18
|
+
if (!o(e.contentType, m)) return _.current != null && clearTimeout(_.current), _.current = setTimeout(() => {
|
|
19
|
+
let e = m.length === 0;
|
|
20
|
+
d?.({
|
|
21
21
|
reason: e ? "noTypesAllowed" : "unsupportedType",
|
|
22
|
-
allowedMimeTypes:
|
|
23
|
-
...e ? {} : { formats: s(
|
|
24
|
-
}),
|
|
25
|
-
},
|
|
22
|
+
allowedMimeTypes: m,
|
|
23
|
+
...e ? {} : { formats: s(m) }
|
|
24
|
+
}), _.current = null;
|
|
25
|
+
}, f), t.UnsupportedType;
|
|
26
|
+
if (u != null && e.file.size > u) return v.current != null && clearTimeout(v.current), v.current = setTimeout(() => {
|
|
27
|
+
d?.({
|
|
28
|
+
reason: "fileTooLarge",
|
|
29
|
+
maxFileSizeBytes: u
|
|
30
|
+
}), v.current = null;
|
|
31
|
+
}, f), t.FileTooLarge;
|
|
26
32
|
}, [
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
33
|
+
m,
|
|
34
|
+
u,
|
|
35
|
+
f,
|
|
36
|
+
d
|
|
30
37
|
]),
|
|
31
|
-
fileAccept:
|
|
38
|
+
fileAccept: g
|
|
32
39
|
};
|
|
33
40
|
};
|
|
34
41
|
//#endregion
|
package/attachments.d.ts
CHANGED
|
@@ -6,10 +6,12 @@ import { DisplayAttachment } from '@epam/ai-dial-chat-shared';
|
|
|
6
6
|
export declare interface AttachmentValidationErrorEvent {
|
|
7
7
|
/** Why the attachment(s) were rejected. */
|
|
8
8
|
reason: AttachmentValidationErrorReason;
|
|
9
|
-
/** The resolved MIME types the caller currently allows (possibly empty). */
|
|
10
|
-
allowedMimeTypes
|
|
9
|
+
/** The resolved MIME types the caller currently allows (possibly empty). Present only when `reason` is `NoTypesAllowed` or `UnsupportedType`. */
|
|
10
|
+
allowedMimeTypes?: string[];
|
|
11
11
|
/** Already-formatted, non-translated extension list (e.g. ".png, .jpg"), present only when `reason` is `UnsupportedType`. */
|
|
12
12
|
formats?: string;
|
|
13
|
+
/** The size limit, in bytes, that was exceeded. Present only when `reason` is `FileTooLarge`. */
|
|
14
|
+
maxFileSizeBytes?: number;
|
|
13
15
|
}
|
|
14
16
|
|
|
15
17
|
/** Reason a rejected attachment failed validation. */
|
|
@@ -17,7 +19,9 @@ export declare enum AttachmentValidationErrorReason {
|
|
|
17
19
|
/** No MIME types are allowed at all — attachments are disabled entirely. */
|
|
18
20
|
NoTypesAllowed = "noTypesAllowed",
|
|
19
21
|
/** The attachment's content type is not among the allowed MIME types. */
|
|
20
|
-
UnsupportedType = "unsupportedType"
|
|
22
|
+
UnsupportedType = "unsupportedType",
|
|
23
|
+
/** The attachment's file size exceeds `maxFileSizeBytes`. */
|
|
24
|
+
FileTooLarge = "fileTooLarge"
|
|
21
25
|
}
|
|
22
26
|
|
|
23
27
|
/**
|
|
@@ -61,12 +65,14 @@ export declare interface UseAttachmentActionResult {
|
|
|
61
65
|
* MIME types, debouncing a burst of rejected files into a single
|
|
62
66
|
* `onValidationError` call rather than firing one per file.
|
|
63
67
|
*/
|
|
64
|
-
export declare const useAttachmentValidation: ({ allowedMimeTypes, onValidationError, debounceMs, }: UseAttachmentValidationParams) => UseAttachmentValidationResult;
|
|
68
|
+
export declare const useAttachmentValidation: ({ allowedMimeTypes, maxFileSizeBytes, onValidationError, debounceMs, }: UseAttachmentValidationParams) => UseAttachmentValidationResult;
|
|
65
69
|
|
|
66
70
|
/** Parameters for {@link useAttachmentValidation}. */
|
|
67
71
|
export declare interface UseAttachmentValidationParams {
|
|
68
72
|
/** Resolved MIME types currently allowed for attachments. */
|
|
69
73
|
allowedMimeTypes: string[];
|
|
74
|
+
/** Maximum attachment file size, in bytes. When omitted, no file is rejected for size. */
|
|
75
|
+
maxFileSizeBytes?: number;
|
|
70
76
|
/** Called with a structured event when a rejected attachment is reported, at most once per debounce window. */
|
|
71
77
|
onValidationError?: (event: AttachmentValidationErrorEvent) => void;
|
|
72
78
|
/** Debounce window, in ms, before firing `onValidationError` for a rejected file. Defaults to `100`. */
|
package/index.d.ts
CHANGED
|
@@ -71,6 +71,7 @@ import { FileUploadValidationResult } from '@epam/ai-dial-chat-shared';
|
|
|
71
71
|
import { FilterTab } from '@epam/ai-dial-chat-shared';
|
|
72
72
|
import { getParentFolderPath } from '@epam/ai-dial-chat-shared';
|
|
73
73
|
import type { GroupedAttachmentItem } from '@epam/ai-dial-chat-shared';
|
|
74
|
+
import { Implementation } from '@modelcontextprotocol/sdk/types.js';
|
|
74
75
|
import type { InputHighlightData } from '@epam/pdf-highlighter-kit';
|
|
75
76
|
import { ListFilesItemDto } from '@epam/ai-dial-chat-api-client';
|
|
76
77
|
import { ListFilesResponseDto } from '@epam/ai-dial-chat-api-client';
|
|
@@ -368,10 +369,12 @@ export declare const attachmentToDto: (attachment: Attachment) => AttachmentDto;
|
|
|
368
369
|
export declare interface AttachmentValidationErrorEvent {
|
|
369
370
|
/** Why the attachment(s) were rejected. */
|
|
370
371
|
reason: AttachmentValidationErrorReason;
|
|
371
|
-
/** The resolved MIME types the caller currently allows (possibly empty). */
|
|
372
|
-
allowedMimeTypes
|
|
372
|
+
/** The resolved MIME types the caller currently allows (possibly empty). Present only when `reason` is `NoTypesAllowed` or `UnsupportedType`. */
|
|
373
|
+
allowedMimeTypes?: string[];
|
|
373
374
|
/** Already-formatted, non-translated extension list (e.g. ".png, .jpg"), present only when `reason` is `UnsupportedType`. */
|
|
374
375
|
formats?: string;
|
|
376
|
+
/** The size limit, in bytes, that was exceeded. Present only when `reason` is `FileTooLarge`. */
|
|
377
|
+
maxFileSizeBytes?: number;
|
|
375
378
|
}
|
|
376
379
|
|
|
377
380
|
/** Reason a rejected attachment failed validation. */
|
|
@@ -379,7 +382,9 @@ export declare enum AttachmentValidationErrorReason {
|
|
|
379
382
|
/** No MIME types are allowed at all — attachments are disabled entirely. */
|
|
380
383
|
NoTypesAllowed = "noTypesAllowed",
|
|
381
384
|
/** The attachment's content type is not among the allowed MIME types. */
|
|
382
|
-
UnsupportedType = "unsupportedType"
|
|
385
|
+
UnsupportedType = "unsupportedType",
|
|
386
|
+
/** The attachment's file size exceeds `maxFileSizeBytes`. */
|
|
387
|
+
FileTooLarge = "fileTooLarge"
|
|
383
388
|
}
|
|
384
389
|
|
|
385
390
|
/** Thrown by `transcribeAudio`; carries a machine-readable `reason` instead of translated text. */
|
|
@@ -2279,6 +2284,8 @@ declare type McpAppDisplayMode = NonNullable<McpUiHostContext['displayMode']>;
|
|
|
2279
2284
|
declare interface McpAppHostAdapter {
|
|
2280
2285
|
/** `McpUiHostContext` to deliver to the mounted app's `ui/initialize` handshake. */
|
|
2281
2286
|
hostContext: McpUiHostContext;
|
|
2287
|
+
/** Host identity (`name`/`version`) to deliver to the mounted app's `ui/initialize` handshake. */
|
|
2288
|
+
hostInfo: Implementation;
|
|
2282
2289
|
/** Operator-configured MCP Apps sandbox-proxy URL, or `null` when unconfigured. */
|
|
2283
2290
|
sandboxUrl: string | null;
|
|
2284
2291
|
/** Fetches the matched tool's MCP Apps `ui://` resource. */
|
|
@@ -2295,7 +2302,7 @@ export declare interface McpAppHostContextParams {
|
|
|
2295
2302
|
mcpAppTheme?: string;
|
|
2296
2303
|
/** Host's current i18n locale (BCP 47). */
|
|
2297
2304
|
locale: string;
|
|
2298
|
-
/** Operator-configured MCP App user-agent override. Defaults to `
|
|
2305
|
+
/** Operator-configured MCP App user-agent override. Defaults to the browser's own `navigator.userAgent`. */
|
|
2299
2306
|
mcpAppUserAgent?: string;
|
|
2300
2307
|
/**
|
|
2301
2308
|
* Display modes the host can switch an app between via
|
|
@@ -4119,12 +4126,14 @@ export declare interface UseAttachmentUploadResult {
|
|
|
4119
4126
|
* MIME types, debouncing a burst of rejected files into a single
|
|
4120
4127
|
* `onValidationError` call rather than firing one per file.
|
|
4121
4128
|
*/
|
|
4122
|
-
export declare const useAttachmentValidation: ({ allowedMimeTypes, onValidationError, debounceMs, }: UseAttachmentValidationParams) => UseAttachmentValidationResult;
|
|
4129
|
+
export declare const useAttachmentValidation: ({ allowedMimeTypes, maxFileSizeBytes, onValidationError, debounceMs, }: UseAttachmentValidationParams) => UseAttachmentValidationResult;
|
|
4123
4130
|
|
|
4124
4131
|
/** Parameters for {@link useAttachmentValidation}. */
|
|
4125
4132
|
export declare interface UseAttachmentValidationParams {
|
|
4126
4133
|
/** Resolved MIME types currently allowed for attachments. */
|
|
4127
4134
|
allowedMimeTypes: string[];
|
|
4135
|
+
/** Maximum attachment file size, in bytes. When omitted, no file is rejected for size. */
|
|
4136
|
+
maxFileSizeBytes?: number;
|
|
4128
4137
|
/** Called with a structured event when a rejected attachment is reported, at most once per debounce window. */
|
|
4129
4138
|
onValidationError?: (event: AttachmentValidationErrorEvent) => void;
|
|
4130
4139
|
/** Debounce window, in ms, before firing `onValidationError` for a rejected file. Defaults to `100`. */
|
|
@@ -5168,10 +5177,11 @@ export declare interface UseImportFilePickerResult {
|
|
|
5168
5177
|
* Builds the `McpAppHostAdapter` a host injects into `@epam/ai-dial-mcp-apps`'s
|
|
5169
5178
|
* hooks/components, wiring the library's host-context/tool-call/resource-fetch
|
|
5170
5179
|
* contract to a configured `McpAppsApiClient` and this app's theme/locale/config
|
|
5171
|
-
* values (`hostContextParams`, `sandboxUrl`)
|
|
5172
|
-
*
|
|
5180
|
+
* values (`hostContextParams`, `sandboxUrl`), plus the host's own identity
|
|
5181
|
+
* (`hostInfo`) — this hook itself never reads app context, so a host builds
|
|
5182
|
+
* those values wherever it already has them.
|
|
5173
5183
|
*/
|
|
5174
|
-
export declare const useMcpAppHostAdapter: (displayMode: "inline" | "fullscreen", client: McpAppsApiClient, sandboxUrl: string | null, hostContextParams: McpAppHostContextParams) => McpAppHostAdapter;
|
|
5184
|
+
export declare const useMcpAppHostAdapter: (displayMode: "inline" | "fullscreen", client: McpAppsApiClient, sandboxUrl: string | null, hostContextParams: McpAppHostContextParams, hostInfo: Implementation) => McpAppHostAdapter;
|
|
5175
5185
|
|
|
5176
5186
|
/**
|
|
5177
5187
|
* Builds the `McpUiHostContext` delivered to a mounted MCP App during its
|
|
@@ -5274,8 +5284,6 @@ export declare const useOpenMcpAppCanvas: (cache: McpAppResponseCache, hostAdapt
|
|
|
5274
5284
|
|
|
5275
5285
|
/** User-facing text `useOpenMcpAppCanvas` needs but cannot resolve itself — a lib must not call `t()`. */
|
|
5276
5286
|
export declare interface UseOpenMcpAppCanvasLabels {
|
|
5277
|
-
/** Canvas panel title while an MCP App is loading or open. */
|
|
5278
|
-
title: string;
|
|
5279
5287
|
/** Error label shown when the resource fetch is forbidden (HTTP 403). */
|
|
5280
5288
|
forbiddenErrorLabel: string;
|
|
5281
5289
|
/** Error label shown for any other resource-load/tool-call failure. */
|
|
@@ -2,8 +2,8 @@ import { getApiErrorMessage as e } from "../../api-error/api-error.js";
|
|
|
2
2
|
import { useMcpAppHostContext as t } from "../useMcpAppHostContext/useMcpAppHostContext.js";
|
|
3
3
|
import { useMemo as n } from "react";
|
|
4
4
|
//#region src/mcp-apps/useMcpAppHostAdapter/useMcpAppHostAdapter.ts
|
|
5
|
-
var r = (r, i, a, o) => {
|
|
6
|
-
let
|
|
5
|
+
var r = (r, i, a, o, s) => {
|
|
6
|
+
let c = t(r, o), l = n(() => async (t, n, r, a) => {
|
|
7
7
|
try {
|
|
8
8
|
return await i.callTool(t, n, r, a);
|
|
9
9
|
} catch (t) {
|
|
@@ -11,15 +11,17 @@ var r = (r, i, a, o) => {
|
|
|
11
11
|
}
|
|
12
12
|
}, [i]);
|
|
13
13
|
return n(() => ({
|
|
14
|
-
hostContext:
|
|
14
|
+
hostContext: c,
|
|
15
|
+
hostInfo: s,
|
|
15
16
|
sandboxUrl: a,
|
|
16
17
|
fetchResourceHtml: i.fetchResourceHtml,
|
|
17
|
-
callTool:
|
|
18
|
+
callTool: l
|
|
18
19
|
}), [
|
|
20
|
+
c,
|
|
19
21
|
s,
|
|
20
22
|
a,
|
|
21
23
|
i.fetchResourceHtml,
|
|
22
|
-
|
|
24
|
+
l
|
|
23
25
|
]);
|
|
24
26
|
};
|
|
25
27
|
//#endregion
|
|
@@ -11,7 +11,7 @@ var t = /* @__PURE__ */ "--color-background-primary.--color-background-secondary
|
|
|
11
11
|
theme: i ?? r,
|
|
12
12
|
locale: a,
|
|
13
13
|
timeZone: Intl.DateTimeFormat().resolvedOptions().timeZone,
|
|
14
|
-
userAgent: o ??
|
|
14
|
+
userAgent: o ?? navigator.userAgent,
|
|
15
15
|
platform: "web",
|
|
16
16
|
displayMode: t,
|
|
17
17
|
availableDisplayModes: s ?? ["inline", "fullscreen"],
|
|
@@ -4,56 +4,58 @@ import { useCallback as i, useEffect as a, useRef as o } from "react";
|
|
|
4
4
|
import { computeMcpAppSeedKey as s, resolveMcpAppToolResult as c } from "@epam/ai-dial-mcp-apps";
|
|
5
5
|
//#region src/mcp-apps/useOpenMcpAppCanvas/useOpenMcpAppCanvas.ts
|
|
6
6
|
var l = (l, u, d, f) => {
|
|
7
|
-
let { openCanvas: p, openCanvasLoading: m, closeCanvas: h } = r(), { hostContext: g,
|
|
8
|
-
if (
|
|
9
|
-
f?.(), m(
|
|
7
|
+
let { openCanvas: p, openCanvasLoading: m, closeCanvas: h } = r(), { hostContext: g, hostInfo: _, sandboxUrl: v, fetchResourceHtml: y, callTool: b } = u, x = i((e) => e === "inline" ? (h(), "inline") : "fullscreen", [h]), S = o(null), C = i(async (r, i, a, o = !1) => {
|
|
8
|
+
if (v == null) return !1;
|
|
9
|
+
f?.(), m(r.mcpToolName, i);
|
|
10
10
|
try {
|
|
11
11
|
let e = s(a), n = async () => {
|
|
12
|
-
let [e, t] = await Promise.all([
|
|
12
|
+
let [e, t] = await Promise.all([y(r.toolsetId, r.resourceUri), c(r, a, b)]);
|
|
13
13
|
return {
|
|
14
14
|
html: e,
|
|
15
15
|
toolResult: t
|
|
16
16
|
};
|
|
17
|
-
}, u,
|
|
18
|
-
return i != null && !o ? {html: u, toolResult:
|
|
17
|
+
}, u, d;
|
|
18
|
+
return i != null && !o ? {html: u, toolResult: d} = await l.getOrFetch(i, e, n) : ({html: u, toolResult: d} = await n(), i != null && l.set(i, {
|
|
19
19
|
html: u,
|
|
20
|
-
toolResult:
|
|
20
|
+
toolResult: d
|
|
21
21
|
}, e)), p({
|
|
22
22
|
type: t.McpApp,
|
|
23
23
|
html: u,
|
|
24
|
-
sandboxUrl:
|
|
24
|
+
sandboxUrl: v,
|
|
25
25
|
toolInput: a?.toolInput,
|
|
26
|
-
toolResult:
|
|
26
|
+
toolResult: d,
|
|
27
27
|
hostContext: g,
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
hostInfo: _,
|
|
29
|
+
onToolCall: (e, t) => b(r.toolsetId, e, t, r.kind),
|
|
30
|
+
onRequestDisplayMode: x,
|
|
30
31
|
onReload: () => {
|
|
31
|
-
i != null && l.invalidate(i),
|
|
32
|
+
i != null && l.invalidate(i), S.current?.(r, i, a, !0);
|
|
32
33
|
}
|
|
33
|
-
},
|
|
34
|
-
} catch (
|
|
35
|
-
let
|
|
34
|
+
}, r.mcpToolName, i), !0;
|
|
35
|
+
} catch (a) {
|
|
36
|
+
let o = a instanceof e && a.status === 403;
|
|
36
37
|
return p({
|
|
37
38
|
type: t.Error,
|
|
38
|
-
errorType:
|
|
39
|
-
label:
|
|
40
|
-
},
|
|
39
|
+
errorType: o ? n.Forbidden : n.LoadFailed,
|
|
40
|
+
label: o ? d.forbiddenErrorLabel : d.loadErrorLabel
|
|
41
|
+
}, r.mcpToolName, i), !1;
|
|
41
42
|
}
|
|
42
43
|
}, [
|
|
43
44
|
p,
|
|
44
45
|
m,
|
|
45
46
|
f,
|
|
46
|
-
_,
|
|
47
|
-
g,
|
|
48
47
|
v,
|
|
48
|
+
g,
|
|
49
|
+
_,
|
|
49
50
|
y,
|
|
51
|
+
b,
|
|
50
52
|
l,
|
|
51
53
|
d,
|
|
52
|
-
|
|
54
|
+
x
|
|
53
55
|
]);
|
|
54
56
|
return a(() => {
|
|
55
|
-
|
|
56
|
-
}, [
|
|
57
|
+
S.current = C;
|
|
58
|
+
}, [C]), { openMcpAppCanvas: C };
|
|
57
59
|
};
|
|
58
60
|
//#endregion
|
|
59
61
|
export { l as useOpenMcpAppCanvas };
|
package/mcp-apps.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { CallToolResult } from '@modelcontextprotocol/sdk/types.js';
|
|
2
2
|
import { DeploymentItemDto } from '@epam/ai-dial-chat-api-client';
|
|
3
3
|
import { DialToolsetDto } from '@epam/ai-dial-chat-api-client';
|
|
4
|
+
import { Implementation } from '@modelcontextprotocol/sdk/types.js';
|
|
4
5
|
import { McpAppToolSummaryDto } from '@epam/ai-dial-chat-api-client';
|
|
5
6
|
import { McpUiHostContext } from '@mcp-ui/client';
|
|
6
7
|
import { Message } from '@epam/ai-dial-chat-shared';
|
|
@@ -48,6 +49,8 @@ declare type McpAppDisplayMode = NonNullable<McpUiHostContext['displayMode']>;
|
|
|
48
49
|
declare interface McpAppHostAdapter {
|
|
49
50
|
/** `McpUiHostContext` to deliver to the mounted app's `ui/initialize` handshake. */
|
|
50
51
|
hostContext: McpUiHostContext;
|
|
52
|
+
/** Host identity (`name`/`version`) to deliver to the mounted app's `ui/initialize` handshake. */
|
|
53
|
+
hostInfo: Implementation;
|
|
51
54
|
/** Operator-configured MCP Apps sandbox-proxy URL, or `null` when unconfigured. */
|
|
52
55
|
sandboxUrl: string | null;
|
|
53
56
|
/** Fetches the matched tool's MCP Apps `ui://` resource. */
|
|
@@ -64,7 +67,7 @@ export declare interface McpAppHostContextParams {
|
|
|
64
67
|
mcpAppTheme?: string;
|
|
65
68
|
/** Host's current i18n locale (BCP 47). */
|
|
66
69
|
locale: string;
|
|
67
|
-
/** Operator-configured MCP App user-agent override. Defaults to `
|
|
70
|
+
/** Operator-configured MCP App user-agent override. Defaults to the browser's own `navigator.userAgent`. */
|
|
68
71
|
mcpAppUserAgent?: string;
|
|
69
72
|
/**
|
|
70
73
|
* Display modes the host can switch an app between via
|
|
@@ -180,10 +183,11 @@ declare type McpDeploymentKind = 'toolset' | 'application';
|
|
|
180
183
|
* Builds the `McpAppHostAdapter` a host injects into `@epam/ai-dial-mcp-apps`'s
|
|
181
184
|
* hooks/components, wiring the library's host-context/tool-call/resource-fetch
|
|
182
185
|
* contract to a configured `McpAppsApiClient` and this app's theme/locale/config
|
|
183
|
-
* values (`hostContextParams`, `sandboxUrl`)
|
|
184
|
-
*
|
|
186
|
+
* values (`hostContextParams`, `sandboxUrl`), plus the host's own identity
|
|
187
|
+
* (`hostInfo`) — this hook itself never reads app context, so a host builds
|
|
188
|
+
* those values wherever it already has them.
|
|
185
189
|
*/
|
|
186
|
-
export declare const useMcpAppHostAdapter: (displayMode: "inline" | "fullscreen", client: McpAppsApiClient, sandboxUrl: string | null, hostContextParams: McpAppHostContextParams) => McpAppHostAdapter;
|
|
190
|
+
export declare const useMcpAppHostAdapter: (displayMode: "inline" | "fullscreen", client: McpAppsApiClient, sandboxUrl: string | null, hostContextParams: McpAppHostContextParams, hostInfo: Implementation) => McpAppHostAdapter;
|
|
187
191
|
|
|
188
192
|
/**
|
|
189
193
|
* Builds the `McpUiHostContext` delivered to a mounted MCP App during its
|
|
@@ -243,8 +247,6 @@ export declare const useOpenMcpAppCanvas: (cache: McpAppResponseCache, hostAdapt
|
|
|
243
247
|
|
|
244
248
|
/** User-facing text `useOpenMcpAppCanvas` needs but cannot resolve itself — a lib must not call `t()`. */
|
|
245
249
|
export declare interface UseOpenMcpAppCanvasLabels {
|
|
246
|
-
/** Canvas panel title while an MCP App is loading or open. */
|
|
247
|
-
title: string;
|
|
248
250
|
/** Error label shown when the resource fetch is forbidden (HTTP 403). */
|
|
249
251
|
forbiddenErrorLabel: string;
|
|
250
252
|
/** Error label shown for any other resource-load/tool-call failure. */
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@epam/ai-dial-chat-hooks",
|
|
3
3
|
"description": "Framework-level React hooks extracted from AI DIAL Chat for building custom chat interfaces",
|
|
4
|
-
"version": "1.2.0-dev.
|
|
4
|
+
"version": "1.2.0-dev.69",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "./index.js",
|
|
@@ -106,7 +106,7 @@
|
|
|
106
106
|
}
|
|
107
107
|
},
|
|
108
108
|
"dependencies": {
|
|
109
|
-
"@epam/ai-dial-chat-api-client": "1.2.0-dev.
|
|
109
|
+
"@epam/ai-dial-chat-api-client": "1.2.0-dev.69",
|
|
110
110
|
"dompurify": "3.4.15",
|
|
111
111
|
"fflate": "^0.8.3",
|
|
112
112
|
"lru-cache": "^10.4.3",
|
|
@@ -115,20 +115,20 @@
|
|
|
115
115
|
},
|
|
116
116
|
"peerDependencies": {
|
|
117
117
|
"react": "^19.2.8",
|
|
118
|
-
"@epam/ai-dial-attachment-canvas": "1.2.0-dev.
|
|
119
|
-
"@epam/ai-dial-attachment-input": "1.2.0-dev.
|
|
120
|
-
"@epam/ai-dial-builder-form": "1.2.0-dev.
|
|
121
|
-
"@epam/ai-dial-catalog": "1.2.0-dev.
|
|
122
|
-
"@epam/ai-dial-chat-overlay": "1.2.0-dev.
|
|
123
|
-
"@epam/ai-dial-chat-shared": "1.2.0-dev.
|
|
124
|
-
"@epam/ai-dial-mcp-apps": "1.2.0-dev.
|
|
125
|
-
"@epam/ai-dial-publish-panel": "1.2.0-dev.
|
|
126
|
-
"@epam/ai-dial-quotations": "1.2.0-dev.
|
|
118
|
+
"@epam/ai-dial-attachment-canvas": "1.2.0-dev.69",
|
|
119
|
+
"@epam/ai-dial-attachment-input": "1.2.0-dev.69",
|
|
120
|
+
"@epam/ai-dial-builder-form": "1.2.0-dev.69",
|
|
121
|
+
"@epam/ai-dial-catalog": "1.2.0-dev.69",
|
|
122
|
+
"@epam/ai-dial-chat-overlay": "1.2.0-dev.69",
|
|
123
|
+
"@epam/ai-dial-chat-shared": "1.2.0-dev.69",
|
|
124
|
+
"@epam/ai-dial-mcp-apps": "1.2.0-dev.69",
|
|
125
|
+
"@epam/ai-dial-publish-panel": "1.2.0-dev.69",
|
|
126
|
+
"@epam/ai-dial-quotations": "1.2.0-dev.69",
|
|
127
127
|
"@epam/ai-dial-react-file-manager": "^0.3.0-dev.2",
|
|
128
|
-
"@epam/ai-dial-scheduled-tasks": "1.2.0-dev.
|
|
129
|
-
"@epam/ai-dial-share": "1.2.0-dev.
|
|
130
|
-
"@epam/ai-dial-skill-editor": "1.2.0-dev.
|
|
131
|
-
"@epam/ai-dial-source-panel": "1.2.0-dev.
|
|
128
|
+
"@epam/ai-dial-scheduled-tasks": "1.2.0-dev.69",
|
|
129
|
+
"@epam/ai-dial-share": "1.2.0-dev.69",
|
|
130
|
+
"@epam/ai-dial-skill-editor": "1.2.0-dev.69",
|
|
131
|
+
"@epam/ai-dial-source-panel": "1.2.0-dev.69",
|
|
132
132
|
"@epam/ai-dial-ui-kit": "^0.15.0-dev.9",
|
|
133
133
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
134
134
|
"@epam/pdf-highlighter-kit": "^0.0.19",
|