@epam/ai-dial-chat-hooks 1.1.0-dev.402 → 1.1.0-dev.405

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/file-manager.js CHANGED
@@ -1,4 +1,4 @@
1
1
  import { a as e, i as t, n, o as r, r as i, s as a, t as o } from "./attachment-types-AAoN9E95.js";
2
- import { $ as s, A as c, B as l, C as u, Ct as d, D as f, E as p, F as m, G as h, H as g, I as _, J as v, K as y, L as b, M as x, N as S, O as C, P as w, Q as T, R as E, S as D, St as O, T as k, U as A, V as j, W as M, X as N, Y as P, Z as F, _ as I, _t as L, a as R, at as z, b as B, bt as V, c as H, ct as U, d as W, dt as G, et as K, f as q, ft as J, g as Y, gt as X, h as Z, ht as Q, i as $, it as ee, j as te, k as ne, l as re, lt as ie, m as ae, mt as oe, n as se, nt as ce, o as le, ot as ue, p as de, pt as fe, q as pe, r as me, rt as he, s as ge, st as _e, t as ve, tt as ye, u as be, ut as xe, v as Se, vt as Ce, w as we, wt as Te, x as Ee, xt as De, y as Oe, yt as ke, z as Ae } from "./useDialFileManagerTabConfig-DGQw8H8H.js";
2
+ import { $ as s, A as c, B as l, C as u, Ct as d, D as f, E as p, F as m, G as h, H as g, I as _, J as v, K as y, L as b, M as x, N as S, O as C, P as w, Q as T, R as E, S as D, St as O, T as k, U as A, V as j, W as M, X as N, Y as P, Z as F, _ as I, _t as L, a as R, at as z, b as B, bt as V, c as H, ct as U, d as W, dt as G, et as K, f as q, ft as J, g as Y, gt as X, h as Z, ht as Q, i as $, it as ee, j as te, k as ne, l as re, lt as ie, m as ae, mt as oe, n as se, nt as ce, o as le, ot as ue, p as de, pt as fe, q as pe, r as me, rt as he, s as ge, st as _e, t as ve, tt as ye, u as be, ut as xe, v as Se, vt as Ce, w as we, wt as Te, x as Ee, xt as De, y as Oe, yt as ke, z as Ae } from "./useDialFileManagerTabConfig-CljXkfhP.js";
3
3
  import { useGridEditingScroll as je } from "@epam/ai-dial-chat-shared";
4
4
  export { oe as COLUMNS_WITHOUT_AUTHOR, Q as COLUMNS_WITH_AUTHOR, X as CORE_PERMISSION_MAP, L as DATE_OPTIONS, G as DialFileManagerActionProfile, J as DialFileManagerVariant, Te as DialFilesApiUploadMode, q as DownloadDestinationType, De as FileManagerNotificationReason, O as FileNameValidationErrorReason, d as FileOperationKind, Ce as PATH_SEPARATOR_REGEXP, ke as RESERVED_MARKER_NAME, V as UPLOAD_CONCURRENCY, Y as annotationToDisplayAttachment, Oe as annotationToPdfCanvasContent, I as attachmentDtoToDisplayAttachment, Se as attachmentDtosToDisplayAttachments, E as buildFromCache, T as buildSharedItemVirtualPath, B as clearAttachmentCache, b as createFilesApiClient, _ as createUploadFileWithProgress, fe as deriveActionProfile, s as dialCorePathToRelative, de as dialFileToAttachment, ae as dialFilesToAttachments, Z as dialFolderPathToAttachment, Ae as fetchByTab, l as fetchForSearch, K as findDialFileByPath, j as findFirstSuccessfulCopyMoveItem, ye as findFolderByVirtualPath, ce as formatOperationFolderName, P as getParentFolderPath, Ee as getUrlFileName, he as getVirtualPathName, D as hasAttachmentTextSource, ee as hasDialFileWritePermission, z as hasForbiddenNameSymbols, ue as isCopyMoveDuplicateAllowed, o as isDialFileAcceptType, e as isDialFileId, u as isExternalSourcePreviewable, _e as isShareActionsAllowed, g as mapCorePermissions, A as mapFileMetadataToDialFile, M as mapSearchItem, h as mergeCreatedFolderIntoCache, n as mimeTypesToAttachmentExtensionLabels, i as mimeTypesToDialFileAcceptTypes, t as mimeTypesToFileAccept, U as normalizeVirtualPath, m as openAnnotationAttachment, ie as parseNewFolderVirtualPath, pe as prepareCopyItems, W as prepareDownloadDestination, v as prepareMoveRenameItems, we as referenceAttachmentToPdfCanvasContent, k as resolveCodeCanvasContent, N as resolveDialFileApiPath, r as resolveDialFileBucketAndPath, p as resolveExternalSourceContentType, f as resolveHtmlCanvasContent, C as resolveImageCanvasContent, ne as resolveJsonCanvasContent, c as resolveMarkdownCanvasContent, te as resolveOoxmlCanvasContent, xe as resolveOwnerCoords, x as resolvePdfCanvasContent, a as resolveRelativeDialFilePath, S as resolveTextCanvasContent, w as resolveVisualizerCanvasContent, H as sanitizeFileName, re as splitFileNameExtension, be as trimFileNameToByteLimit, y as updateEntry, ge as useDialFileListing, se as useDialFileManager, ve as useDialFileManagerTabConfig, le as useDialFileMetadata, R as useDialFileMutations, $ as useDialFileSharing, me as useDialFileUploadBatch, je as useGridEditingScroll, F as virtualPathToApiPath };
package/index.d.ts CHANGED
@@ -6,6 +6,7 @@ import { AttachmentDisplayResolvers } from '@epam/ai-dial-chat-shared';
6
6
  import { AttachmentDto } from '@epam/ai-dial-chat-api-client';
7
7
  import { AttachmentErrorReason } from '@epam/ai-dial-chat-shared';
8
8
  import { AttachmentResource } from '@epam/ai-dial-chat-shared';
9
+ import type { CallToolResult } from '@modelcontextprotocol/sdk/types.js';
9
10
  import { CatalogContentTreeNode } from '@epam/ai-dial-catalog';
10
11
  import { CatalogEntityType } from '@epam/ai-dial-chat-shared';
11
12
  import { CatalogItem } from '@epam/ai-dial-catalog';
@@ -74,6 +75,8 @@ import { ListFilesResponseDto } from '@epam/ai-dial-chat-api-client';
74
75
  import { ListPublicFilesRequest } from '@epam/ai-dial-chat-api-client';
75
76
  import { ListSharedFilesRequest } from '@epam/ai-dial-chat-api-client';
76
77
  import { LocaleTextEntryDto } from '@epam/ai-dial-chat-api-client';
78
+ import { McpAppToolSummaryDto } from '@epam/ai-dial-chat-api-client';
79
+ import { McpUiHostContext } from '@mcp-ui/client';
77
80
  import { Message } from '@epam/ai-dial-chat-shared';
78
81
  import { MessageAttachment } from '@epam/ai-dial-chat-shared';
79
82
  import { MessageCustomContent } from '@epam/ai-dial-chat-shared';
@@ -131,6 +134,7 @@ import { ToolbarOptions } from '@epam/ai-dial-react-file-manager';
131
134
  import { ToolMenuItem } from '@epam/ai-dial-chat-shared';
132
135
  import { ToolsetLoginBodyDto } from '@epam/ai-dial-chat-api-client';
133
136
  import { ToolsetLogoutBodyDto } from '@epam/ai-dial-chat-api-client';
137
+ import { ToolsetsApi } from '@epam/ai-dial-chat-api-client';
134
138
  import { UnpublishCatalogEntityDto } from '@epam/ai-dial-chat-api-client';
135
139
  import { UnpublishResultDto } from '@epam/ai-dial-chat-api-client';
136
140
  import { UpdateScheduledTaskBodyDto } from '@epam/ai-dial-chat-api-client';
@@ -467,6 +471,22 @@ export declare const buildToolsetAuthorizeUrl: (auth: ToolsetOAuthSettings, redi
467
471
  /** Builds the MCP endpoint URL for a toolset resource. */
468
472
  export declare const buildToolsetMcpUrl: (baseUrl: string, id: string) => string;
469
473
 
474
+ /** A cached MCP App resource fetch plus its resolved tool result. */
475
+ declare interface CachedMcpAppResponse {
476
+ /** The fetched resource's HTML body. */
477
+ html: string;
478
+ /** The tool call's resolved result, if any. */
479
+ toolResult?: CallToolResult;
480
+ }
481
+
482
+ /** Host-provided function that forwards an MCP App's tool call through the host's backend. */
483
+ declare type CallMcpAppTool = (
484
+ toolsetId: string,
485
+ toolName: string,
486
+ args: unknown,
487
+ kind: McpDeploymentKind,
488
+ ) => Promise<CallToolResult>;
489
+
470
490
  /** Injected API port for catalog item detail fetching. Mirrors exact server-api wrapper signatures. */
471
491
  export declare interface CatalogDetailsApi {
472
492
  /** Fetches deployment-level details for a model, agent, toolset, or application. */
@@ -864,6 +884,14 @@ export declare const createDeploymentChangedMessage: (previousDeploymentId: stri
864
884
  */
865
885
  export declare const createFilesApiClient: (filesApi: FilesApi, uploadFileWithProgress: UploadFileWithProgressFn) => FilesApiClient;
866
886
 
887
+ /**
888
+ * Wraps the generated `ToolsetsApi` in the surface `useMcpAppTools`,
889
+ * `useOpenMcpAppCanvas`, and `@epam/ai-dial-mcp-apps`'s hooks/utilities call,
890
+ * so a host app configures one `ToolsetsApi` instance (base URL, auth
891
+ * headers, CSRF) and passes it here once. Mirrors `createPublishApiClient`.
892
+ */
893
+ export declare const createMcpAppsApiClient: (toolsetsApi: ToolsetsApi) => McpAppsApiClient;
894
+
867
895
  /** Builds a user message and its empty assistant placeholder, both timestamped `now`. */
868
896
  export declare const createMessagePair: (content: string, customContent?: MessageCustomContent, deploymentId?: string | null) => MessagePair;
869
897
 
@@ -1298,6 +1326,12 @@ export declare const fetchForSearch: (filesApi: DialFilesApi, tab: DialFileManag
1298
1326
  items: ListFilesItemDto[];
1299
1327
  }>;
1300
1328
 
1329
+ /** Host-provided function that fetches a toolset's MCP Apps `ui://` resource and resolves to its HTML body. */
1330
+ declare type FetchMcpAppResourceHtml = (
1331
+ toolsetId: string,
1332
+ resourceUri: string,
1333
+ ) => Promise<string>;
1334
+
1301
1335
  /**
1302
1336
  * Structured toast event emitted by file-manager hooks. `reason` carries a
1303
1337
  * library-owned identifier the host translates; `message` is an optional
@@ -2050,6 +2084,137 @@ declare interface MarkdownCanvasContent {
2050
2084
  text: string;
2051
2085
  }
2052
2086
 
2087
+ /**
2088
+ * Dependencies the host must inject into `useMcpAppInlinePreview` /
2089
+ * `McpAppInlinePreview` — everything that requires host context (theming,
2090
+ * locale, the configured API client) rather than being derivable from the
2091
+ * hook's own arguments.
2092
+ */
2093
+ declare interface McpAppHostAdapter {
2094
+ /** `McpUiHostContext` to deliver to the mounted app's `ui/initialize` handshake. */
2095
+ hostContext: McpUiHostContext;
2096
+ /** Operator-configured MCP Apps sandbox-proxy URL, or `null` when unconfigured. */
2097
+ sandboxUrl: string | null;
2098
+ /** Fetches the matched tool's MCP Apps `ui://` resource. */
2099
+ fetchResourceHtml: FetchMcpAppResourceHtml;
2100
+ /** Forwards a tool call the mounted app makes on its own (`onToolCall`) or the live re-call `resolveMcpAppToolResult` performs. */
2101
+ callTool: CallMcpAppTool;
2102
+ }
2103
+
2104
+ /** Host values `useMcpAppHostContext` needs but cannot read itself — a lib must not import the app's theme/i18n/config context. */
2105
+ export declare interface McpAppHostContextParams {
2106
+ /** Host's current theme id (e.g. `'light'`/`'dark'`), used when `mcpAppTheme` is unset. */
2107
+ theme: string;
2108
+ /** Operator-configured MCP App theme override, if any. */
2109
+ mcpAppTheme?: string;
2110
+ /** Host's current i18n locale (BCP 47). */
2111
+ locale: string;
2112
+ /** Operator-configured MCP App user-agent override. Defaults to `'ai-dial-chat'`. */
2113
+ mcpAppUserAgent?: string;
2114
+ }
2115
+
2116
+ /** Thrown by `McpAppsApiClient.fetchResourceHtml` on a non-OK response, carrying the HTTP status so callers can distinguish `403` (forbidden) from any other failure. */
2117
+ export declare class McpAppResourceFetchError extends Error {
2118
+ readonly status: number;
2119
+ constructor(status: number);
2120
+ }
2121
+
2122
+ /** Reads/writes `useMcpAppResponseCache`'s per-conversation cache. */
2123
+ declare interface McpAppResponseCache {
2124
+ /**
2125
+ * Returns the cached entry only if it was written for this exact
2126
+ * `seedKey` (`computeMcpAppSeedKey`) and is younger than the cache's TTL;
2127
+ * otherwise `undefined` (a miss), so a stale or seed-mismatched entry is
2128
+ * never served.
2129
+ */
2130
+ get: (
2131
+ key: string,
2132
+ seedKey: string | undefined,
2133
+ ) => CachedMcpAppResponse | undefined;
2134
+ /** Writes an entry for `key`, tagged with the seed it was resolved from. */
2135
+ set: (
2136
+ key: string,
2137
+ value: CachedMcpAppResponse,
2138
+ seedKey: string | undefined,
2139
+ ) => void;
2140
+ /** Removes the cached entry for `key`, if any. */
2141
+ invalidate: (key: string) => void;
2142
+ /**
2143
+ * Returns the fresh cached entry for `(key, seedKey)` if one exists
2144
+ * (same rules as `get`); otherwise runs `fetchFn` and caches its result.
2145
+ * Concurrent calls for the same `(key, seedKey)` before `fetchFn` settles
2146
+ * are coalesced onto the same in-flight promise instead of each starting
2147
+ * their own — without this, a component re-rendered before its first
2148
+ * fetch resolves (e.g. React StrictMode's dev-only double effect
2149
+ * invocation) would race two independent fetches/live tool re-calls for
2150
+ * the same message.
2151
+ */
2152
+ getOrFetch: (
2153
+ key: string,
2154
+ seedKey: string | undefined,
2155
+ fetchFn: () => Promise<CachedMcpAppResponse>,
2156
+ ) => Promise<CachedMcpAppResponse>;
2157
+ }
2158
+
2159
+ /** The MCP Apps API surface produced by {@link createMcpAppsApiClient}. */
2160
+ export declare interface McpAppsApiClient {
2161
+ /** Fetches a toolset's MCP Apps `ui://` resource and resolves to its HTML body. Throws `McpAppResourceFetchError` on a non-OK response. */
2162
+ fetchResourceHtml: FetchMcpAppResourceHtml;
2163
+ /** Forwards an MCP App's tool call (self-initiated, or `@epam/ai-dial-mcp-apps`'s live re-call) through chat-api. */
2164
+ callTool: CallMcpAppTool;
2165
+ /** Lists the tools of an MCP-capable deployment that declare an MCP Apps UI resource. */
2166
+ listAppTools: (deploymentId: string, kind: McpDeploymentKind) => Promise<McpAppToolSummary[]>;
2167
+ /** Lists every tool name exposed by an MCP-capable deployment's `tools/list`, unfiltered. */
2168
+ listToolNames: (deploymentId: string, kind: McpDeploymentKind) => Promise<string[]>;
2169
+ }
2170
+
2171
+ /** Original tool call's arguments/result, seeded into the mounted app so it renders that invocation immediately instead of an empty initial state. */
2172
+ declare interface McpAppToolCallSeed {
2173
+ /** The tool call's real structured arguments. */
2174
+ toolInput?: Record<string, unknown>;
2175
+ /** The tool call's result, if already known. */
2176
+ toolResult?: CallToolResult;
2177
+ }
2178
+
2179
+ /**
2180
+ * How a tool was discovered — determines whether it's safe to live-re-call
2181
+ * (see `resolveMcpAppToolResult`) or treat as "always available" for a
2182
+ * message with no other evidence (see `findMcpAppForMessage`).
2183
+ *
2184
+ * - `'direct'`: the active deployment itself IS this MCP server (whether
2185
+ * it's a bare Toolset or an Application declaring `features.mcp`) — the
2186
+ * host is talking to it directly, so which tool a mounted app's own
2187
+ * invocation targets is unambiguous.
2188
+ * - `'indirect'`: a different, tool-calling deployment's message happened to
2189
+ * call a name prefixed with a toolset's display name; the toolset is a
2190
+ * name-prefix *guess*, not a confirmed link the host was told about, so
2191
+ * re-calling it live risks hitting the wrong tool or re-triggering a
2192
+ * non-idempotent side effect.
2193
+ */
2194
+ declare type McpAppToolDiscovery = 'direct' | 'indirect';
2195
+
2196
+ /** A tool's declared MCP Apps UI resource, keyed by the toolset it was discovered on. */
2197
+ declare interface McpAppToolRef {
2198
+ /** Id of the toolset/application this tool was discovered on. */
2199
+ toolsetId: string;
2200
+ /** The tool's declared `ui://` resource. */
2201
+ resourceUri: string;
2202
+ /** Name used to correlate this ref against a message's real tool-call data (`resolveMcpAppToolCallSeed`/`findMcpAppForMessage`). */
2203
+ toolName: string;
2204
+ /** The tool's real name as declared by its owning toolset's `tools/list` — what must be passed to the mounted app/`onToolCall`. */
2205
+ mcpToolName: string;
2206
+ /** Deployment kind — determines which host MCP proxy route resolves `tools/call` for this tool. */
2207
+ kind: McpDeploymentKind;
2208
+ /** How this tool was discovered — see `McpAppToolDiscovery`. */
2209
+ discovery: McpAppToolDiscovery;
2210
+ }
2211
+
2212
+ /** A single MCP tool that declares an MCP Apps UI resource. */
2213
+ export declare type McpAppToolSummary = McpAppToolSummaryDto;
2214
+
2215
+ /** 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. */
2216
+ declare type McpDeploymentKind = 'toolset' | 'application';
2217
+
2053
2218
  /** Resource families that DIAL Core exposes an MCP endpoint for. */
2054
2219
  export declare enum McpResourceKind {
2055
2220
  /** Toolsets, served under `/v1/toolset/{id}/mcp`. */
@@ -4534,6 +4699,42 @@ export declare interface UseImportFilePickerResult {
4534
4699
  handleFileChange: (event: ChangeEvent<HTMLInputElement>) => void;
4535
4700
  }
4536
4701
 
4702
+ /**
4703
+ * Builds the `McpAppHostAdapter` a host injects into `@epam/ai-dial-mcp-apps`'s
4704
+ * hooks/components, wiring the library's host-context/tool-call/resource-fetch
4705
+ * contract to a configured `McpAppsApiClient` and this app's theme/locale/config
4706
+ * values (`hostContextParams`, `sandboxUrl`) — this hook itself never reads app
4707
+ * context, so a host builds those values wherever it already has them.
4708
+ */
4709
+ export declare const useMcpAppHostAdapter: (displayMode: "inline" | "fullscreen", client: McpAppsApiClient, sandboxUrl: string | null, hostContextParams: McpAppHostContextParams) => McpAppHostAdapter;
4710
+
4711
+ /**
4712
+ * Builds the `McpUiHostContext` delivered to a mounted MCP App during its
4713
+ * `ui/initialize` handshake, shared by every place that mounts an app —
4714
+ * a full-width attachment canvas (`displayMode: 'fullscreen'`) and a compact
4715
+ * inline preview under a message (`displayMode: 'inline'`) — so the app can
4716
+ * size/style itself differently for each.
4717
+ */
4718
+ export declare const useMcpAppHostContext: (displayMode: "inline" | "fullscreen", { theme, mcpAppTheme, locale, mcpAppUserAgent }: McpAppHostContextParams) => McpUiHostContext;
4719
+
4720
+ /**
4721
+ * Discovers MCP Apps-capable tools available to the current conversation, merging two
4722
+ * sources:
4723
+ *
4724
+ * 1. **Direct** — the active deployment itself, when it declares `features.mcp` (a
4725
+ * toolset, or an application that is itself an MCP server).
4726
+ * 2. **Indirect** — any toolset in `toolsets` whose name prefixes a tool-call name
4727
+ * actually seen in `messages` (e.g. `weather_get_weather` implies the `weather`
4728
+ * toolset). This covers a quick app that has no MCP capability of its own but
4729
+ * internally delegates to an MCP-capable toolset — a link the host does not
4730
+ * otherwise expose. Tool names discovered this way are re-prefixed with the
4731
+ * toolset's name so they match the `{toolset}_{tool}` form seen in real tool
4732
+ * calls, keeping downstream name-matching (`findMcpAppForMessage`) unchanged.
4733
+ *
4734
+ * Empty until loaded, or if neither source yields anything.
4735
+ */
4736
+ export declare const useMcpAppTools: (client: McpAppsApiClient, deployment: DeploymentItemDto | undefined, messages: Message[], toolsets: DialToolsetDto[]) => McpAppToolRef[];
4737
+
4537
4738
  /**
4538
4739
  * Completes an OAuth authorization-code flow from inside the callback popup:
4539
4740
  * reads and clears the redirect state written into this popup's own
@@ -4577,6 +4778,44 @@ export declare interface UseOAuthCallbackCompletionResult {
4577
4778
  failureReason: ToolsetOAuthFailureReason | null;
4578
4779
  }
4579
4780
 
4781
+ /**
4782
+ * Returns `openMcpAppCanvas`, an async function that opens the attachment
4783
+ * canvas for a discovered MCP App tool. `canvasKey`, when passed, is
4784
+ * forwarded as the canvas's `attachmentId` (and as the key into `cache`) so
4785
+ * callers can compare it against `useAttachmentCanvas().attachmentId` to
4786
+ * know whether this exact canvas is the one currently open. `toolCall`, when
4787
+ * passed, seeds the mounted app's initial `toolInput`/`toolResult`. Returns
4788
+ * `true` if the canvas was opened, `false` if `hostAdapter.sandboxUrl` isn't
4789
+ * configured or the resource failed to load.
4790
+ *
4791
+ * `cache` (shared with `@epam/ai-dial-mcp-apps`'s `useMcpAppInlinePreview` via
4792
+ * the same cache instance) is checked before fetching the resource or
4793
+ * re-resolving the tool result — reopening the canvas for a message already
4794
+ * seen (inline or in a prior canvas open) reuses that fetch instead of
4795
+ * repeating it, and a concurrent in-flight fetch for the same message (e.g.
4796
+ * the inline preview hasn't finished loading yet) is coalesced onto rather
4797
+ * than raced against (`cache.getOrFetch`). Pass `forceReload: true` (wired to
4798
+ * the canvas header's reload button, `content.onReload`) to bypass and
4799
+ * refresh the cache entry.
4800
+ *
4801
+ * `onBeforeOpen`, if passed, runs before the canvas opens (e.g. to close
4802
+ * other panels a host keeps mutually exclusive with the canvas) — this hook
4803
+ * has no opinion on what else is open in the host UI.
4804
+ */
4805
+ export declare const useOpenMcpAppCanvas: (cache: McpAppResponseCache, hostAdapter: McpAppHostAdapter, labels: UseOpenMcpAppCanvasLabels, onBeforeOpen?: () => void) => {
4806
+ openMcpAppCanvas: (match: McpAppToolRef, canvasKey?: string, toolCall?: McpAppToolCallSeed, forceReload?: boolean) => Promise<boolean>;
4807
+ };
4808
+
4809
+ /** User-facing text `useOpenMcpAppCanvas` needs but cannot resolve itself — a lib must not call `t()`. */
4810
+ export declare interface UseOpenMcpAppCanvasLabels {
4811
+ /** Canvas panel title while an MCP App is loading or open. */
4812
+ title: string;
4813
+ /** Error label shown when the resource fetch is forbidden (HTTP 403). */
4814
+ forbiddenErrorLabel: string;
4815
+ /** Error label shown for any other resource-load/tool-call failure. */
4816
+ loadErrorLabel: string;
4817
+ }
4818
+
4580
4819
  /**
4581
4820
  * Detects files being dragged over the whole page and exposes the dropped
4582
4821
  * files, using only `document`-level drag events with an enter/leave
package/index.js CHANGED
@@ -20,8 +20,9 @@ import { t as rr } from "./useSkillsState-BoLlwmzb.js";
20
20
  import { n as ir, t as ar } from "./useShareRecipientsCount-BgwCLKY0.js";
21
21
  import { t as or } from "./useConversationScroll-CliIMnjP.js";
22
22
  import { t as sr } from "./useConversationSources-DKaKvjXZ.js";
23
- import { $ as cr, A as lr, B as ur, C as dr, Ct as fr, D as pr, E as mr, F as hr, G as gr, H as _r, I as vr, J as yr, K as br, L as xr, M as Sr, N as Cr, O as wr, P as Tr, Q as Er, R as Dr, S as Or, St as kr, T as Ar, U as jr, V as Mr, W as Nr, X as Pr, Y as Fr, Z as Ir, _ as Lr, _t as Rr, a as zr, at as Br, b as Vr, bt as Hr, c as Ur, ct as Wr, d as Gr, dt as Kr, et as qr, f as Jr, ft as Yr, g as Xr, gt as Zr, h as Qr, ht as $r, i as ei, it as ti, j as ni, k as ri, l as ii, lt as ai, m as oi, mt as si, n as ci, nt as li, o as ui, ot as di, p as fi, pt as pi, q as mi, r as hi, rt as gi, s as _i, st as vi, t as yi, tt as bi, u as xi, ut as Si, v as Ci, vt as wi, w as Ti, wt as Ei, x as Di, xt as Oi, y as ki, yt as Ai, z as ji } from "./useDialFileManagerTabConfig-DGQw8H8H.js";
23
+ import { $ as cr, A as lr, B as ur, C as dr, Ct as fr, D as pr, E as mr, F as hr, G as gr, H as _r, I as vr, J as yr, K as br, L as xr, M as Sr, N as Cr, O as wr, P as Tr, Q as Er, R as Dr, S as Or, St as kr, T as Ar, U as jr, V as Mr, W as Nr, X as Pr, Y as Fr, Z as Ir, _ as Lr, _t as Rr, a as zr, at as Br, b as Vr, bt as Hr, c as Ur, ct as Wr, d as Gr, dt as Kr, et as qr, f as Jr, ft as Yr, g as Xr, gt as Zr, h as Qr, ht as $r, i as ei, it as ti, j as ni, k as ri, l as ii, lt as ai, m as oi, mt as si, n as ci, nt as li, o as ui, ot as di, p as fi, pt as pi, q as mi, r as hi, rt as gi, s as _i, st as vi, t as yi, tt as bi, u as xi, ut as Si, v as Ci, vt as wi, w as Ti, wt as Ei, x as Di, xt as Oi, y as ki, yt as Ai, z as ji } from "./useDialFileManagerTabConfig-CljXkfhP.js";
24
24
  import { n as Mi, r as Ni, t as Pi } from "./usePanelMaxWidth-BEZYuqF9.js";
25
25
  import { t as Fi } from "./useShareLink-xkiaxATt.js";
26
- import { useGridEditingScroll as Ii } from "@epam/ai-dial-chat-shared";
27
- export { G as AttachmentValidationErrorReason, Oe as AuthenticationType, si as COLUMNS_WITHOUT_AUTHOR, $r as COLUMNS_WITH_AUTHOR, Zr as CORE_PERMISSION_MAP, He as CatalogPrimaryActionType, $ as ConversationExportMode, te as ConversationTransferErrorCode, Y as ConversationTransferWarningCode, Rr as DATE_OPTIONS, Q as DEFAULT_MAX_ARCHIVE_BYTES, Kr as DialFileManagerActionProfile, Yr as DialFileManagerVariant, Ei as DialFilesApiUploadMode, Jr as DownloadDestinationType, J as EXPORT_APP_NAME, Z as ExportFileNameKind, ze as FavoriteEntityType, Oi as FileManagerNotificationReason, kr as FileNameValidationErrorReason, fr as FileOperationKind, tt as McpResourceKind, pt as OAuthResourceKind, wi as PATH_SEPARATOR_REGEXP, b as PROMPT_CONTENT_MAX_LENGTH, O as PROMPT_COUNTER_ANNOUNCE_THRESHOLD, T as PROMPT_DESCRIPTION_MAX_LENGTH, S as PROMPT_NAME_MAX_LENGTH, Be as PUBLIC_SKILL_BUCKET, x as PromptFieldError, Lt as PromptSource, Ai as RESERVED_MARKER_NAME, ar as RecipientsCountStatus, Jt as SKILL_FILE_UPLOAD_MAX_BYTES, ge as SKILL_LISTING_MAX_PAGES, _e as SKILL_LISTING_PAGE_SIZE, Zt as SKILL_MANIFEST_FILE, ye as SKILL_MANIFEST_MAX_BYTES, Gt as SKILL_UPLOAD_MAX_FILES, Bt as SKILL_UPLOAD_MAX_TOTAL_BYTES, tr as SkillEditorLoadState, Xe as SkillPreviewErrorKind, le as SkillSource, xt as TOOLSET_REDIRECT_STATE_KEY, vt as ToolsetAuthStatus, ht as ToolsetAuthTypes, mt as ToolsetCredentialsLevel, wt as ToolsetLoginOutcomeType, ct as ToolsetOAuthCallbackQuery, Et as ToolsetOAuthChannelControlType, kt as ToolsetOAuthFailureReason, ut as ToolsetOAuthInitiationResultType, Ot as ToolsetOAuthResultType, Hr as UPLOAD_CONCURRENCY, Gn as UnsupportedTriggerReason, ot as WithLogin, Xr as annotationToDisplayAttachment, ki as annotationToPdfCanvasContent, Xn as apSchedulerDayToJsDay, Ft as appendLocaleCode, Lr as attachmentDtoToDisplayAttachment, Ci as attachmentDtosToDisplayAttachments, wn as attachmentToDto, Pn as attachmentsToDtos, Mt as buildAdditionalLocaleOptions, hn as buildAnnouncementSignature, Me as buildApplicationMcpUrl, De as buildChatCompletionsUrl, et as buildConnectApi, ke as buildDeploymentConnectApi, E as buildExternalServiceScopeId, Dr as buildFromCache, p as buildPromptExportEnvelope, d as buildPromptExportFileName, he as buildPromptOverview, h as buildPromptPath, be as buildResponsesUrl, Er as buildSharedItemVirtualPath, $e as buildSkillContentTree, Yt as buildSkillFilesPayload, Qt as buildSkillManifest, Vt as buildSkillManifestForSubmit, Kt as buildSkillManifestFromFrontmatter, Ce as buildSkillOverview, bt as buildToolsetAuthorizeUrl, Se as buildToolsetMcpUrl, Vr as clearAttachmentCache, At as composeLocalePayload, un as createChatStreamApi, f as createCsrfMiddleware, On as createDeploymentChangedMessage, xr as createFilesApiClient, Cn as createMessagePair, re as createPublishApiClient, m as createUnauthorizedMiddleware, vr as createUploadFileWithProgress, at as decodeToolsetId, Pt as decomposeLocalizedFields, pi as deriveActionProfile, Pe as deriveAvailableTabIds, Vn as deriveConversationRowActionState, Ie as deriveFavoriteItems, cr as dialCorePathToRelative, fi as dialFileToAttachment, oi as dialFilesToAttachments, Qr as dialFolderPathToAttachment, W as downloadAttachment, Tt as emitToolsetLoginSuccess, it as encodeDeploymentId, Dt as encodeToolsetId, ji as fetchByTab, ur as fetchForSearch, Ke as filterCatalogItemsBySelector, Ue as filterHiddenOwnedItems, rt as findDeploymentByIdOrReference, qr as findDialFileByPath, Mr as findFirstSuccessfulCopyMoveItem, bi as findFolderByVirtualPath, mn as formatAppVersion, zt as formatCalendarDate, q as formatDateYM, K as formatDateYMD, li as formatOperationFolderName, X as formatQuotedNameList, u as getApiErrorDetails, c as getApiErrorMessage, l as getApiErrorStatus, v as getBrowserTimezone, Nn as getConversationPath, Tn as getConversationSource, k as getExternalServiceFallbackName, on as getLastDeploymentId, an as getLastUserMessageToolConfiguration, fn as getModelIdFromConversationId, Fr as getParentFolderPath, Bn as getQuickAppConversationStarters, N as getRemainingCharacters, In as getStarterConversationText, gn as getStarterPopulateText, Sn as getStarterSubmitText, rn as getStartersFromSchema, dn as getTimeOfDayGreeting, dt as getToolsetOAuthChannelName, Ct as getToolsetRedirectUri, Di as getUrlFileName, gi as getVirtualPathName, An as hasActiveToolConfig, Un as hasAnnouncementContent, Or as hasAttachmentTextSource, ti as hasDialFileWritePermission, Br as hasForbiddenNameSymbols, nn as hasStructuredAnnouncement, B as includesIgnoreCase, St as initiateOAuthLogin, Dn as isAwaitingGenerationResume, s as isConversationNotFoundError, di as isCopyMoveDuplicateAllowed, w as isCustomAppSchema, o as isDialFileAcceptType, e as isDialFileId, H as isDownloadableAttachment, dr as isExternalSourcePreviewable, Rn as isMessageChanged, pn as isMessageStreaming, xe as isOrganisationPromptItem, st as isPublicToolsetId, M as isQuickAppSchema, vi as isShareActionsAllowed, g as isValidAbsoluteUrl, D as isValidFeaturesData, en as isValidSkillRelativePath, Yn as jsDayToApSchedulerDay, _r as mapCorePermissions, Ee as mapDeploymentDetailsDtoToEntityDetails, pe as mapDeploymentLimitsDtoToCatalogLimits, qe as mapDeploymentLimitsToInput, ae as mapDeploymentToCatalogItem, Te as mapDeploymentToolsetCredentials, ue as mapEntityDetailsToCatalogDetails, jr as mapFileMetadataToDialFile, Jn as mapFormValuesToCreateBody, Kn as mapFormValuesToUpdateBody, nt as mapPromptToCatalogItem, Le as mapPublishConversationResultDto, Ae as mapPublishHistoryEntryDto, qn as mapScheduledTaskDtoToFormValues, Nr as mapSearchItem, ce as mapSkillToCatalogItem, me as mapToolsetCredentials, de as mapToolsetToCatalogItem, gr as mergeCreatedFolderIntoCache, kn as messageHasStages, n as mimeTypesToAttachmentExtensionLabels, i as mimeTypesToDialFileAcceptTypes, t as mimeTypesToFileAccept, Ht as nameFromPath, gt as navigateToolsetOAuthPopup, tn as normalizeResponseFormat, Ut as normalizeSkillName, Wr as normalizeVirtualPath, hr as openAnnotationAttachment, lt as openToolsetOAuthPopup, Rt as padTwoDigits, C as parseExternalServiceUrl, A as parseFeaturesData, ai as parseNewFolderVirtualPath, Nt as parsePromptResourceUrl, Xt as parseSkillManifest, $t as parseSkillManifestDocument, fe as parseSkillResourceUrl, mi as prepareCopyItems, Gr as prepareDownloadDestination, yr as prepareMoveRenameItems, se as readSkillFileBytes, ve as readSkillManifest, Re as reconcileFilterTopics, Ti as referenceAttachmentToPdfCanvasContent, Ze as resolveCatalogPrimaryAction, Ar as resolveCodeCanvasContent, we as resolveDeploymentFolder, Pr as resolveDialFileApiPath, r as resolveDialFileBucketAndPath, mr as resolveExternalSourceContentType, pr as resolveHtmlCanvasContent, wr as resolveImageCanvasContent, ri as resolveJsonCanvasContent, It as resolveLocalizedText, lr as resolveMarkdownCanvasContent, oe as resolveMcpResourceKind, ni as resolveOoxmlCanvasContent, Si as resolveOwnerCoords, Sr as resolvePdfCanvasContent, a as resolveRelativeDialFilePath, Ve as resolveSkillFileDownloadPath, ie as resolveSkillManifestFileId, Cr as resolveTextCanvasContent, Tr as resolveVisualizerCanvasContent, R as safeDecodeURI, z as safeDecodeURIComponent, vn as sanitizeAnnouncementHtml, cn as sanitizeAnnouncementMessageHtml, Ur as sanitizeFileName, sn as sanitizeFooterHtml, P as serializePromptExport, ln as shouldWatchForDisplayNameUpdate, qt as skillFileBytesToBlob, Zn as skillFileToAttachment, ii as splitFileNameExtension, L as stripSurroundingSlashes, ft as subscribeToolsetLoginSuccess, jt as toBaseLocale, _n as toOverlayMessages, Qe as toPublishEntityType, Fe as toPublishRuleDto, xi as trimFileNameToByteLimit, Wt as unpackSkillArchive, br as updateEntry, xn as useActiveConversationSync, Hn as useAsyncConfirmDialog, V as useAttachmentAction, jn as useAttachmentUpload, U as useAttachmentValidation, Ne as useCatalogEditNavigation, Ye as useCatalogItemDetails, Ge as useCatalogToolsetCredentials, Mn as useChatSettingsFormConfig, ee as useConversationExport, bn as useConversationHandlers, ne as useConversationImport, zn as useConversationLookupMaps, yn as useConversationPanelItems, or as useConversationScroll, sr as useConversationSources, Fn as useConversationStream, _i as useDialFileListing, ci as useDialFileManager, yi as useDialFileManagerTabConfig, ui as useDialFileMetadata, zr as useDialFileMutations, ei as useDialFileSharing, hi as useDialFileUploadBatch, je as useFavoriteEntitiesState, Ii as useGridEditingScroll, En as useImportFilePicker, Wn as useOAuthCallbackCompletion, Ni as usePageFileDrag, Pi as usePanelMaxWidth, y as usePromptsState, Je as usePublishFolders, Fi as useShareLink, ir as useShareRecipientsCount, Qn as useSkillEditorLoad, $n as useSkillEditorSubmit, nr as useSkillFileActions, We as useSkillFilePreview, rr as useSkillsState, Ln as useToolsMenu, yt as useToolsetLogin, j as useUsageData, Mi as useViewportWidth, I as validatePromptContent, _ as validatePromptDescription, F as validatePromptName, er as validateSkillFileBatch, Ir as virtualPathToApiPath, _t as waitForToolsetOAuthResult };
26
+ import { a as Ii, i as Li, n as Ri, o as zi, r as Bi, t as Vi } from "./useOpenMcpAppCanvas-C7-AMseH.js";
27
+ import { useGridEditingScroll as Hi } from "@epam/ai-dial-chat-shared";
28
+ export { G as AttachmentValidationErrorReason, Oe as AuthenticationType, si as COLUMNS_WITHOUT_AUTHOR, $r as COLUMNS_WITH_AUTHOR, Zr as CORE_PERMISSION_MAP, He as CatalogPrimaryActionType, $ as ConversationExportMode, te as ConversationTransferErrorCode, Y as ConversationTransferWarningCode, Rr as DATE_OPTIONS, Q as DEFAULT_MAX_ARCHIVE_BYTES, Kr as DialFileManagerActionProfile, Yr as DialFileManagerVariant, Ei as DialFilesApiUploadMode, Jr as DownloadDestinationType, J as EXPORT_APP_NAME, Z as ExportFileNameKind, ze as FavoriteEntityType, Oi as FileManagerNotificationReason, kr as FileNameValidationErrorReason, fr as FileOperationKind, Ii as McpAppResourceFetchError, tt as McpResourceKind, pt as OAuthResourceKind, wi as PATH_SEPARATOR_REGEXP, b as PROMPT_CONTENT_MAX_LENGTH, O as PROMPT_COUNTER_ANNOUNCE_THRESHOLD, T as PROMPT_DESCRIPTION_MAX_LENGTH, S as PROMPT_NAME_MAX_LENGTH, Be as PUBLIC_SKILL_BUCKET, x as PromptFieldError, Lt as PromptSource, Ai as RESERVED_MARKER_NAME, ar as RecipientsCountStatus, Jt as SKILL_FILE_UPLOAD_MAX_BYTES, ge as SKILL_LISTING_MAX_PAGES, _e as SKILL_LISTING_PAGE_SIZE, Zt as SKILL_MANIFEST_FILE, ye as SKILL_MANIFEST_MAX_BYTES, Gt as SKILL_UPLOAD_MAX_FILES, Bt as SKILL_UPLOAD_MAX_TOTAL_BYTES, tr as SkillEditorLoadState, Xe as SkillPreviewErrorKind, le as SkillSource, xt as TOOLSET_REDIRECT_STATE_KEY, vt as ToolsetAuthStatus, ht as ToolsetAuthTypes, mt as ToolsetCredentialsLevel, wt as ToolsetLoginOutcomeType, ct as ToolsetOAuthCallbackQuery, Et as ToolsetOAuthChannelControlType, kt as ToolsetOAuthFailureReason, ut as ToolsetOAuthInitiationResultType, Ot as ToolsetOAuthResultType, Hr as UPLOAD_CONCURRENCY, Gn as UnsupportedTriggerReason, ot as WithLogin, Xr as annotationToDisplayAttachment, ki as annotationToPdfCanvasContent, Xn as apSchedulerDayToJsDay, Ft as appendLocaleCode, Lr as attachmentDtoToDisplayAttachment, Ci as attachmentDtosToDisplayAttachments, wn as attachmentToDto, Pn as attachmentsToDtos, Mt as buildAdditionalLocaleOptions, hn as buildAnnouncementSignature, Me as buildApplicationMcpUrl, De as buildChatCompletionsUrl, et as buildConnectApi, ke as buildDeploymentConnectApi, E as buildExternalServiceScopeId, Dr as buildFromCache, p as buildPromptExportEnvelope, d as buildPromptExportFileName, he as buildPromptOverview, h as buildPromptPath, be as buildResponsesUrl, Er as buildSharedItemVirtualPath, $e as buildSkillContentTree, Yt as buildSkillFilesPayload, Qt as buildSkillManifest, Vt as buildSkillManifestForSubmit, Kt as buildSkillManifestFromFrontmatter, Ce as buildSkillOverview, bt as buildToolsetAuthorizeUrl, Se as buildToolsetMcpUrl, Vr as clearAttachmentCache, At as composeLocalePayload, un as createChatStreamApi, f as createCsrfMiddleware, On as createDeploymentChangedMessage, xr as createFilesApiClient, zi as createMcpAppsApiClient, Cn as createMessagePair, re as createPublishApiClient, m as createUnauthorizedMiddleware, vr as createUploadFileWithProgress, at as decodeToolsetId, Pt as decomposeLocalizedFields, pi as deriveActionProfile, Pe as deriveAvailableTabIds, Vn as deriveConversationRowActionState, Ie as deriveFavoriteItems, cr as dialCorePathToRelative, fi as dialFileToAttachment, oi as dialFilesToAttachments, Qr as dialFolderPathToAttachment, W as downloadAttachment, Tt as emitToolsetLoginSuccess, it as encodeDeploymentId, Dt as encodeToolsetId, ji as fetchByTab, ur as fetchForSearch, Ke as filterCatalogItemsBySelector, Ue as filterHiddenOwnedItems, rt as findDeploymentByIdOrReference, qr as findDialFileByPath, Mr as findFirstSuccessfulCopyMoveItem, bi as findFolderByVirtualPath, mn as formatAppVersion, zt as formatCalendarDate, q as formatDateYM, K as formatDateYMD, li as formatOperationFolderName, X as formatQuotedNameList, u as getApiErrorDetails, c as getApiErrorMessage, l as getApiErrorStatus, v as getBrowserTimezone, Nn as getConversationPath, Tn as getConversationSource, k as getExternalServiceFallbackName, on as getLastDeploymentId, an as getLastUserMessageToolConfiguration, fn as getModelIdFromConversationId, Fr as getParentFolderPath, Bn as getQuickAppConversationStarters, N as getRemainingCharacters, In as getStarterConversationText, gn as getStarterPopulateText, Sn as getStarterSubmitText, rn as getStartersFromSchema, dn as getTimeOfDayGreeting, dt as getToolsetOAuthChannelName, Ct as getToolsetRedirectUri, Di as getUrlFileName, gi as getVirtualPathName, An as hasActiveToolConfig, Un as hasAnnouncementContent, Or as hasAttachmentTextSource, ti as hasDialFileWritePermission, Br as hasForbiddenNameSymbols, nn as hasStructuredAnnouncement, B as includesIgnoreCase, St as initiateOAuthLogin, Dn as isAwaitingGenerationResume, s as isConversationNotFoundError, di as isCopyMoveDuplicateAllowed, w as isCustomAppSchema, o as isDialFileAcceptType, e as isDialFileId, H as isDownloadableAttachment, dr as isExternalSourcePreviewable, Rn as isMessageChanged, pn as isMessageStreaming, xe as isOrganisationPromptItem, st as isPublicToolsetId, M as isQuickAppSchema, vi as isShareActionsAllowed, g as isValidAbsoluteUrl, D as isValidFeaturesData, en as isValidSkillRelativePath, Yn as jsDayToApSchedulerDay, _r as mapCorePermissions, Ee as mapDeploymentDetailsDtoToEntityDetails, pe as mapDeploymentLimitsDtoToCatalogLimits, qe as mapDeploymentLimitsToInput, ae as mapDeploymentToCatalogItem, Te as mapDeploymentToolsetCredentials, ue as mapEntityDetailsToCatalogDetails, jr as mapFileMetadataToDialFile, Jn as mapFormValuesToCreateBody, Kn as mapFormValuesToUpdateBody, nt as mapPromptToCatalogItem, Le as mapPublishConversationResultDto, Ae as mapPublishHistoryEntryDto, qn as mapScheduledTaskDtoToFormValues, Nr as mapSearchItem, ce as mapSkillToCatalogItem, me as mapToolsetCredentials, de as mapToolsetToCatalogItem, gr as mergeCreatedFolderIntoCache, kn as messageHasStages, n as mimeTypesToAttachmentExtensionLabels, i as mimeTypesToDialFileAcceptTypes, t as mimeTypesToFileAccept, Ht as nameFromPath, gt as navigateToolsetOAuthPopup, tn as normalizeResponseFormat, Ut as normalizeSkillName, Wr as normalizeVirtualPath, hr as openAnnotationAttachment, lt as openToolsetOAuthPopup, Rt as padTwoDigits, C as parseExternalServiceUrl, A as parseFeaturesData, ai as parseNewFolderVirtualPath, Nt as parsePromptResourceUrl, Xt as parseSkillManifest, $t as parseSkillManifestDocument, fe as parseSkillResourceUrl, mi as prepareCopyItems, Gr as prepareDownloadDestination, yr as prepareMoveRenameItems, se as readSkillFileBytes, ve as readSkillManifest, Re as reconcileFilterTopics, Ti as referenceAttachmentToPdfCanvasContent, Ze as resolveCatalogPrimaryAction, Ar as resolveCodeCanvasContent, we as resolveDeploymentFolder, Pr as resolveDialFileApiPath, r as resolveDialFileBucketAndPath, mr as resolveExternalSourceContentType, pr as resolveHtmlCanvasContent, wr as resolveImageCanvasContent, ri as resolveJsonCanvasContent, It as resolveLocalizedText, lr as resolveMarkdownCanvasContent, oe as resolveMcpResourceKind, ni as resolveOoxmlCanvasContent, Si as resolveOwnerCoords, Sr as resolvePdfCanvasContent, a as resolveRelativeDialFilePath, Ve as resolveSkillFileDownloadPath, ie as resolveSkillManifestFileId, Cr as resolveTextCanvasContent, Tr as resolveVisualizerCanvasContent, R as safeDecodeURI, z as safeDecodeURIComponent, vn as sanitizeAnnouncementHtml, cn as sanitizeAnnouncementMessageHtml, Ur as sanitizeFileName, sn as sanitizeFooterHtml, P as serializePromptExport, ln as shouldWatchForDisplayNameUpdate, qt as skillFileBytesToBlob, Zn as skillFileToAttachment, ii as splitFileNameExtension, L as stripSurroundingSlashes, ft as subscribeToolsetLoginSuccess, jt as toBaseLocale, _n as toOverlayMessages, Qe as toPublishEntityType, Fe as toPublishRuleDto, xi as trimFileNameToByteLimit, Wt as unpackSkillArchive, br as updateEntry, xn as useActiveConversationSync, Hn as useAsyncConfirmDialog, V as useAttachmentAction, jn as useAttachmentUpload, U as useAttachmentValidation, Ne as useCatalogEditNavigation, Ye as useCatalogItemDetails, Ge as useCatalogToolsetCredentials, Mn as useChatSettingsFormConfig, ee as useConversationExport, bn as useConversationHandlers, ne as useConversationImport, zn as useConversationLookupMaps, yn as useConversationPanelItems, or as useConversationScroll, sr as useConversationSources, Fn as useConversationStream, _i as useDialFileListing, ci as useDialFileManager, yi as useDialFileManagerTabConfig, ui as useDialFileMetadata, zr as useDialFileMutations, ei as useDialFileSharing, hi as useDialFileUploadBatch, je as useFavoriteEntitiesState, Hi as useGridEditingScroll, En as useImportFilePicker, Ri as useMcpAppHostAdapter, Bi as useMcpAppHostContext, Li as useMcpAppTools, Wn as useOAuthCallbackCompletion, Vi as useOpenMcpAppCanvas, Ni as usePageFileDrag, Pi as usePanelMaxWidth, y as usePromptsState, Je as usePublishFolders, Fi as useShareLink, ir as useShareRecipientsCount, Qn as useSkillEditorLoad, $n as useSkillEditorSubmit, nr as useSkillFileActions, We as useSkillFilePreview, rr as useSkillsState, Ln as useToolsMenu, yt as useToolsetLogin, j as useUsageData, Mi as useViewportWidth, I as validatePromptContent, _ as validatePromptDescription, F as validatePromptName, er as validateSkillFileBatch, Ir as virtualPathToApiPath, _t as waitForToolsetOAuthResult };
package/mcp-apps.d.ts ADDED
@@ -0,0 +1,244 @@
1
+ import type { CallToolResult } from '@modelcontextprotocol/sdk/types.js';
2
+ import { DeploymentItemDto } from '@epam/ai-dial-chat-api-client';
3
+ import { DialToolsetDto } from '@epam/ai-dial-chat-api-client';
4
+ import { McpAppToolSummaryDto } from '@epam/ai-dial-chat-api-client';
5
+ import { McpUiHostContext } from '@mcp-ui/client';
6
+ import { Message } from '@epam/ai-dial-chat-shared';
7
+ import { ToolsetsApi } from '@epam/ai-dial-chat-api-client';
8
+
9
+ /** A cached MCP App resource fetch plus its resolved tool result. */
10
+ declare interface CachedMcpAppResponse {
11
+ /** The fetched resource's HTML body. */
12
+ html: string;
13
+ /** The tool call's resolved result, if any. */
14
+ toolResult?: CallToolResult;
15
+ }
16
+
17
+ /** Host-provided function that forwards an MCP App's tool call through the host's backend. */
18
+ declare type CallMcpAppTool = (
19
+ toolsetId: string,
20
+ toolName: string,
21
+ args: unknown,
22
+ kind: McpDeploymentKind,
23
+ ) => Promise<CallToolResult>;
24
+
25
+ /**
26
+ * Wraps the generated `ToolsetsApi` in the surface `useMcpAppTools`,
27
+ * `useOpenMcpAppCanvas`, and `@epam/ai-dial-mcp-apps`'s hooks/utilities call,
28
+ * so a host app configures one `ToolsetsApi` instance (base URL, auth
29
+ * headers, CSRF) and passes it here once. Mirrors `createPublishApiClient`.
30
+ */
31
+ export declare const createMcpAppsApiClient: (toolsetsApi: ToolsetsApi) => McpAppsApiClient;
32
+
33
+ /** Host-provided function that fetches a toolset's MCP Apps `ui://` resource and resolves to its HTML body. */
34
+ declare type FetchMcpAppResourceHtml = (
35
+ toolsetId: string,
36
+ resourceUri: string,
37
+ ) => Promise<string>;
38
+
39
+ /**
40
+ * Dependencies the host must inject into `useMcpAppInlinePreview` /
41
+ * `McpAppInlinePreview` — everything that requires host context (theming,
42
+ * locale, the configured API client) rather than being derivable from the
43
+ * hook's own arguments.
44
+ */
45
+ declare interface McpAppHostAdapter {
46
+ /** `McpUiHostContext` to deliver to the mounted app's `ui/initialize` handshake. */
47
+ hostContext: McpUiHostContext;
48
+ /** Operator-configured MCP Apps sandbox-proxy URL, or `null` when unconfigured. */
49
+ sandboxUrl: string | null;
50
+ /** Fetches the matched tool's MCP Apps `ui://` resource. */
51
+ fetchResourceHtml: FetchMcpAppResourceHtml;
52
+ /** Forwards a tool call the mounted app makes on its own (`onToolCall`) or the live re-call `resolveMcpAppToolResult` performs. */
53
+ callTool: CallMcpAppTool;
54
+ }
55
+
56
+ /** Host values `useMcpAppHostContext` needs but cannot read itself — a lib must not import the app's theme/i18n/config context. */
57
+ export declare interface McpAppHostContextParams {
58
+ /** Host's current theme id (e.g. `'light'`/`'dark'`), used when `mcpAppTheme` is unset. */
59
+ theme: string;
60
+ /** Operator-configured MCP App theme override, if any. */
61
+ mcpAppTheme?: string;
62
+ /** Host's current i18n locale (BCP 47). */
63
+ locale: string;
64
+ /** Operator-configured MCP App user-agent override. Defaults to `'ai-dial-chat'`. */
65
+ mcpAppUserAgent?: string;
66
+ }
67
+
68
+ /** Thrown by `McpAppsApiClient.fetchResourceHtml` on a non-OK response, carrying the HTTP status so callers can distinguish `403` (forbidden) from any other failure. */
69
+ export declare class McpAppResourceFetchError extends Error {
70
+ readonly status: number;
71
+ constructor(status: number);
72
+ }
73
+
74
+ /** Reads/writes `useMcpAppResponseCache`'s per-conversation cache. */
75
+ declare interface McpAppResponseCache {
76
+ /**
77
+ * Returns the cached entry only if it was written for this exact
78
+ * `seedKey` (`computeMcpAppSeedKey`) and is younger than the cache's TTL;
79
+ * otherwise `undefined` (a miss), so a stale or seed-mismatched entry is
80
+ * never served.
81
+ */
82
+ get: (
83
+ key: string,
84
+ seedKey: string | undefined,
85
+ ) => CachedMcpAppResponse | undefined;
86
+ /** Writes an entry for `key`, tagged with the seed it was resolved from. */
87
+ set: (
88
+ key: string,
89
+ value: CachedMcpAppResponse,
90
+ seedKey: string | undefined,
91
+ ) => void;
92
+ /** Removes the cached entry for `key`, if any. */
93
+ invalidate: (key: string) => void;
94
+ /**
95
+ * Returns the fresh cached entry for `(key, seedKey)` if one exists
96
+ * (same rules as `get`); otherwise runs `fetchFn` and caches its result.
97
+ * Concurrent calls for the same `(key, seedKey)` before `fetchFn` settles
98
+ * are coalesced onto the same in-flight promise instead of each starting
99
+ * their own — without this, a component re-rendered before its first
100
+ * fetch resolves (e.g. React StrictMode's dev-only double effect
101
+ * invocation) would race two independent fetches/live tool re-calls for
102
+ * the same message.
103
+ */
104
+ getOrFetch: (
105
+ key: string,
106
+ seedKey: string | undefined,
107
+ fetchFn: () => Promise<CachedMcpAppResponse>,
108
+ ) => Promise<CachedMcpAppResponse>;
109
+ }
110
+
111
+ /** The MCP Apps API surface produced by {@link createMcpAppsApiClient}. */
112
+ export declare interface McpAppsApiClient {
113
+ /** Fetches a toolset's MCP Apps `ui://` resource and resolves to its HTML body. Throws `McpAppResourceFetchError` on a non-OK response. */
114
+ fetchResourceHtml: FetchMcpAppResourceHtml;
115
+ /** Forwards an MCP App's tool call (self-initiated, or `@epam/ai-dial-mcp-apps`'s live re-call) through chat-api. */
116
+ callTool: CallMcpAppTool;
117
+ /** Lists the tools of an MCP-capable deployment that declare an MCP Apps UI resource. */
118
+ listAppTools: (deploymentId: string, kind: McpDeploymentKind) => Promise<McpAppToolSummary[]>;
119
+ /** Lists every tool name exposed by an MCP-capable deployment's `tools/list`, unfiltered. */
120
+ listToolNames: (deploymentId: string, kind: McpDeploymentKind) => Promise<string[]>;
121
+ }
122
+
123
+ /** Original tool call's arguments/result, seeded into the mounted app so it renders that invocation immediately instead of an empty initial state. */
124
+ declare interface McpAppToolCallSeed {
125
+ /** The tool call's real structured arguments. */
126
+ toolInput?: Record<string, unknown>;
127
+ /** The tool call's result, if already known. */
128
+ toolResult?: CallToolResult;
129
+ }
130
+
131
+ /**
132
+ * How a tool was discovered — determines whether it's safe to live-re-call
133
+ * (see `resolveMcpAppToolResult`) or treat as "always available" for a
134
+ * message with no other evidence (see `findMcpAppForMessage`).
135
+ *
136
+ * - `'direct'`: the active deployment itself IS this MCP server (whether
137
+ * it's a bare Toolset or an Application declaring `features.mcp`) — the
138
+ * host is talking to it directly, so which tool a mounted app's own
139
+ * invocation targets is unambiguous.
140
+ * - `'indirect'`: a different, tool-calling deployment's message happened to
141
+ * call a name prefixed with a toolset's display name; the toolset is a
142
+ * name-prefix *guess*, not a confirmed link the host was told about, so
143
+ * re-calling it live risks hitting the wrong tool or re-triggering a
144
+ * non-idempotent side effect.
145
+ */
146
+ declare type McpAppToolDiscovery = 'direct' | 'indirect';
147
+
148
+ /** A tool's declared MCP Apps UI resource, keyed by the toolset it was discovered on. */
149
+ declare interface McpAppToolRef {
150
+ /** Id of the toolset/application this tool was discovered on. */
151
+ toolsetId: string;
152
+ /** The tool's declared `ui://` resource. */
153
+ resourceUri: string;
154
+ /** Name used to correlate this ref against a message's real tool-call data (`resolveMcpAppToolCallSeed`/`findMcpAppForMessage`). */
155
+ toolName: string;
156
+ /** The tool's real name as declared by its owning toolset's `tools/list` — what must be passed to the mounted app/`onToolCall`. */
157
+ mcpToolName: string;
158
+ /** Deployment kind — determines which host MCP proxy route resolves `tools/call` for this tool. */
159
+ kind: McpDeploymentKind;
160
+ /** How this tool was discovered — see `McpAppToolDiscovery`. */
161
+ discovery: McpAppToolDiscovery;
162
+ }
163
+
164
+ /** A single MCP tool that declares an MCP Apps UI resource. */
165
+ export declare type McpAppToolSummary = McpAppToolSummaryDto;
166
+
167
+ /** 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. */
168
+ declare type McpDeploymentKind = 'toolset' | 'application';
169
+
170
+ /**
171
+ * Builds the `McpAppHostAdapter` a host injects into `@epam/ai-dial-mcp-apps`'s
172
+ * hooks/components, wiring the library's host-context/tool-call/resource-fetch
173
+ * contract to a configured `McpAppsApiClient` and this app's theme/locale/config
174
+ * values (`hostContextParams`, `sandboxUrl`) — this hook itself never reads app
175
+ * context, so a host builds those values wherever it already has them.
176
+ */
177
+ export declare const useMcpAppHostAdapter: (displayMode: "inline" | "fullscreen", client: McpAppsApiClient, sandboxUrl: string | null, hostContextParams: McpAppHostContextParams) => McpAppHostAdapter;
178
+
179
+ /**
180
+ * Builds the `McpUiHostContext` delivered to a mounted MCP App during its
181
+ * `ui/initialize` handshake, shared by every place that mounts an app —
182
+ * a full-width attachment canvas (`displayMode: 'fullscreen'`) and a compact
183
+ * inline preview under a message (`displayMode: 'inline'`) — so the app can
184
+ * size/style itself differently for each.
185
+ */
186
+ export declare const useMcpAppHostContext: (displayMode: "inline" | "fullscreen", { theme, mcpAppTheme, locale, mcpAppUserAgent }: McpAppHostContextParams) => McpUiHostContext;
187
+
188
+ /**
189
+ * Discovers MCP Apps-capable tools available to the current conversation, merging two
190
+ * sources:
191
+ *
192
+ * 1. **Direct** — the active deployment itself, when it declares `features.mcp` (a
193
+ * toolset, or an application that is itself an MCP server).
194
+ * 2. **Indirect** — any toolset in `toolsets` whose name prefixes a tool-call name
195
+ * actually seen in `messages` (e.g. `weather_get_weather` implies the `weather`
196
+ * toolset). This covers a quick app that has no MCP capability of its own but
197
+ * internally delegates to an MCP-capable toolset — a link the host does not
198
+ * otherwise expose. Tool names discovered this way are re-prefixed with the
199
+ * toolset's name so they match the `{toolset}_{tool}` form seen in real tool
200
+ * calls, keeping downstream name-matching (`findMcpAppForMessage`) unchanged.
201
+ *
202
+ * Empty until loaded, or if neither source yields anything.
203
+ */
204
+ export declare const useMcpAppTools: (client: McpAppsApiClient, deployment: DeploymentItemDto | undefined, messages: Message[], toolsets: DialToolsetDto[]) => McpAppToolRef[];
205
+
206
+ /**
207
+ * Returns `openMcpAppCanvas`, an async function that opens the attachment
208
+ * canvas for a discovered MCP App tool. `canvasKey`, when passed, is
209
+ * forwarded as the canvas's `attachmentId` (and as the key into `cache`) so
210
+ * callers can compare it against `useAttachmentCanvas().attachmentId` to
211
+ * know whether this exact canvas is the one currently open. `toolCall`, when
212
+ * passed, seeds the mounted app's initial `toolInput`/`toolResult`. Returns
213
+ * `true` if the canvas was opened, `false` if `hostAdapter.sandboxUrl` isn't
214
+ * configured or the resource failed to load.
215
+ *
216
+ * `cache` (shared with `@epam/ai-dial-mcp-apps`'s `useMcpAppInlinePreview` via
217
+ * the same cache instance) is checked before fetching the resource or
218
+ * re-resolving the tool result — reopening the canvas for a message already
219
+ * seen (inline or in a prior canvas open) reuses that fetch instead of
220
+ * repeating it, and a concurrent in-flight fetch for the same message (e.g.
221
+ * the inline preview hasn't finished loading yet) is coalesced onto rather
222
+ * than raced against (`cache.getOrFetch`). Pass `forceReload: true` (wired to
223
+ * the canvas header's reload button, `content.onReload`) to bypass and
224
+ * refresh the cache entry.
225
+ *
226
+ * `onBeforeOpen`, if passed, runs before the canvas opens (e.g. to close
227
+ * other panels a host keeps mutually exclusive with the canvas) — this hook
228
+ * has no opinion on what else is open in the host UI.
229
+ */
230
+ export declare const useOpenMcpAppCanvas: (cache: McpAppResponseCache, hostAdapter: McpAppHostAdapter, labels: UseOpenMcpAppCanvasLabels, onBeforeOpen?: () => void) => {
231
+ openMcpAppCanvas: (match: McpAppToolRef, canvasKey?: string, toolCall?: McpAppToolCallSeed, forceReload?: boolean) => Promise<boolean>;
232
+ };
233
+
234
+ /** User-facing text `useOpenMcpAppCanvas` needs but cannot resolve itself — a lib must not call `t()`. */
235
+ export declare interface UseOpenMcpAppCanvasLabels {
236
+ /** Canvas panel title while an MCP App is loading or open. */
237
+ title: string;
238
+ /** Error label shown when the resource fetch is forbidden (HTTP 403). */
239
+ forbiddenErrorLabel: string;
240
+ /** Error label shown for any other resource-load/tool-call failure. */
241
+ loadErrorLabel: string;
242
+ }
243
+
244
+ export { }
package/mcp-apps.js ADDED
@@ -0,0 +1,2 @@
1
+ import { a as e, i as t, n, o as r, r as i, t as a } from "./useOpenMcpAppCanvas-C7-AMseH.js";
2
+ export { e as McpAppResourceFetchError, r as createMcpAppsApiClient, n as useMcpAppHostAdapter, i as useMcpAppHostContext, t as useMcpAppTools, a as useOpenMcpAppCanvas };
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.1.0-dev.402",
4
+ "version": "1.1.0-dev.405",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
7
7
  "main": "./index.js",
@@ -83,25 +83,32 @@
83
83
  "types": "./utils.d.ts",
84
84
  "import": "./utils.js",
85
85
  "default": "./utils.js"
86
+ },
87
+ "./mcp-apps": {
88
+ "types": "./mcp-apps.d.ts",
89
+ "import": "./mcp-apps.js",
90
+ "default": "./mcp-apps.js"
86
91
  }
87
92
  },
88
93
  "peerDependencies": {
89
94
  "react": "^19.2.6",
90
- "@epam/ai-dial-attachment-canvas": "1.1.0-dev.402",
91
- "@epam/ai-dial-attachment-input": "1.1.0-dev.402",
92
- "@epam/ai-dial-catalog": "1.1.0-dev.402",
93
- "@epam/ai-dial-chat-api-client": "1.1.0-dev.402",
94
- "@epam/ai-dial-chat-overlay": "1.1.0-dev.402",
95
- "@epam/ai-dial-chat-shared": "1.1.0-dev.402",
96
- "@epam/ai-dial-deployment-creation-form": "1.1.0-dev.402",
97
- "@epam/ai-dial-publish-panel": "1.1.0-dev.402",
98
- "@epam/ai-dial-quotations": "1.1.0-dev.402",
95
+ "@epam/ai-dial-attachment-canvas": "1.1.0-dev.405",
96
+ "@epam/ai-dial-attachment-input": "1.1.0-dev.405",
97
+ "@epam/ai-dial-catalog": "1.1.0-dev.405",
98
+ "@epam/ai-dial-chat-api-client": "1.1.0-dev.405",
99
+ "@epam/ai-dial-chat-overlay": "1.1.0-dev.405",
100
+ "@epam/ai-dial-chat-shared": "1.1.0-dev.405",
101
+ "@epam/ai-dial-deployment-creation-form": "1.1.0-dev.405",
102
+ "@epam/ai-dial-mcp-apps": "1.1.0-dev.405",
103
+ "@epam/ai-dial-publish-panel": "1.1.0-dev.405",
104
+ "@epam/ai-dial-quotations": "1.1.0-dev.405",
99
105
  "@epam/ai-dial-react-file-manager": "*",
100
- "@epam/ai-dial-scheduled-tasks": "1.1.0-dev.402",
101
- "@epam/ai-dial-share": "1.1.0-dev.402",
102
- "@epam/ai-dial-skill-editor": "1.1.0-dev.402",
103
- "@epam/ai-dial-source-panel": "1.1.0-dev.402",
106
+ "@epam/ai-dial-scheduled-tasks": "1.1.0-dev.405",
107
+ "@epam/ai-dial-share": "1.1.0-dev.405",
108
+ "@epam/ai-dial-skill-editor": "1.1.0-dev.405",
109
+ "@epam/ai-dial-source-panel": "1.1.0-dev.405",
104
110
  "@epam/ai-dial-ui-kit": "*",
111
+ "@modelcontextprotocol/sdk": "^1.27.1",
105
112
  "@epam/pdf-highlighter-kit": ">=0.0.14"
106
113
  },
107
114
  "peerDependenciesMeta": {
@@ -126,6 +133,9 @@
126
133
  "@epam/ai-dial-deployment-creation-form": {
127
134
  "optional": true
128
135
  },
136
+ "@epam/ai-dial-mcp-apps": {
137
+ "optional": true
138
+ },
129
139
  "@epam/ai-dial-publish-panel": {
130
140
  "optional": true
131
141
  },
@@ -150,6 +160,12 @@
150
160
  "@epam/ai-dial-ui-kit": {
151
161
  "optional": true
152
162
  },
163
+ "@mcp-ui/client": {
164
+ "optional": true
165
+ },
166
+ "@modelcontextprotocol/sdk": {
167
+ "optional": true
168
+ },
153
169
  "@epam/pdf-highlighter-kit": {
154
170
  "optional": true
155
171
  }
@@ -1628,7 +1628,7 @@ var Ke = (e) => !Ve.has(e), $ = (e) => e && e === Math.floor(e) && e > 0 && isFi
1628
1628
  try {
1629
1629
  u(v, await e.createFolder({
1630
1630
  bucket: x,
1631
- parentPath: S || void 0,
1631
+ parentPath: S,
1632
1632
  name: g
1633
1633
  }), s.get(v)), l(), p?.({
1634
1634
  kind: q.FolderCreated,
@@ -0,0 +1,207 @@
1
+ import { n as e } from "./api-error-DuLNy43N.js";
2
+ import { r as t } from "./string-utils-iBi2Y55C.js";
3
+ import { AttachmentContentType as n, AttachmentErrorType as r, useAttachmentCanvas as i } from "@epam/ai-dial-attachment-canvas";
4
+ import { useCallback as a, useEffect as o, useMemo as s, useRef as c, useState as l } from "react";
5
+ import { ResponseError as u } from "@epam/ai-dial-chat-api-client";
6
+ import { collectToolCallNames as d, computeMcpAppSeedKey as f, resolveMcpAppToolResult as p } from "@epam/ai-dial-mcp-apps";
7
+ //#region src/mcp-apps/mcp-apps-api-client.ts
8
+ var m = class extends Error {
9
+ status;
10
+ constructor(e) {
11
+ super(`Failed to fetch MCP app resource: HTTP ${e}`), this.status = e;
12
+ }
13
+ }, h = (e) => ({
14
+ fetchResourceHtml: async (n, r) => {
15
+ try {
16
+ let { raw: i } = await e.getToolsetMcpAppResourceRaw({
17
+ toolsetName: t(n),
18
+ resourceUri: r
19
+ });
20
+ return await i.text();
21
+ } catch (e) {
22
+ throw e instanceof u ? new m(e.response.status) : e;
23
+ }
24
+ },
25
+ callTool: async (n, r, i, a) => {
26
+ let { result: o } = await e.callToolsetMcpAppTool({
27
+ toolsetName: t(n),
28
+ mcpAppToolCallRequestDto: {
29
+ toolName: r,
30
+ arguments: i,
31
+ kind: a
32
+ }
33
+ });
34
+ return o;
35
+ },
36
+ listAppTools: async (n, r) => {
37
+ let { tools: i } = await e.listMcpAppTools({
38
+ deploymentId: t(n),
39
+ kind: r
40
+ });
41
+ return i;
42
+ },
43
+ listToolNames: async (n, r) => {
44
+ let { toolNames: i } = await e.listMcpToolNames({
45
+ deploymentId: t(n),
46
+ kind: r
47
+ });
48
+ return i;
49
+ }
50
+ }), g = (e, t, n, r) => {
51
+ let [i, a] = l([]), [u, f] = l([]), p = c(/* @__PURE__ */ new Set());
52
+ o(() => {
53
+ if (p.current = /* @__PURE__ */ new Set(), f([]), t?.features?.mcp !== !0) {
54
+ a([]);
55
+ return;
56
+ }
57
+ if (t.type !== "toolset" && t.type !== "application") {
58
+ a([]);
59
+ return;
60
+ }
61
+ let n = t.id, r = t.type;
62
+ (async () => {
63
+ try {
64
+ a((await e.listAppTools(n, r)).map(({ resourceUri: e, toolName: t }) => ({
65
+ toolsetId: n,
66
+ resourceUri: e,
67
+ toolName: t,
68
+ mcpToolName: t,
69
+ kind: r,
70
+ discovery: "direct"
71
+ })));
72
+ } catch {
73
+ a([]);
74
+ }
75
+ })();
76
+ }, [
77
+ t?.id,
78
+ t?.type,
79
+ t?.features?.mcp,
80
+ e
81
+ ]);
82
+ let m = s(() => d(n), [n]);
83
+ return o(() => {
84
+ if (m.size === 0) return;
85
+ let t = r.filter((e) => {
86
+ if (p.current.has(e.id)) return !1;
87
+ let t = `${e.displayName ?? e.id}_`;
88
+ return [...m].some((e) => e.startsWith(t));
89
+ });
90
+ if (t.length !== 0) {
91
+ for (let e of t) p.current.add(e.id);
92
+ (async () => {
93
+ let n = await Promise.all(t.map(async (t) => {
94
+ try {
95
+ return (await e.listAppTools(t.id, "toolset")).map(({ resourceUri: e, toolName: n }) => ({
96
+ toolsetId: t.id,
97
+ resourceUri: e,
98
+ toolName: `${t.displayName ?? t.id}_${n}`,
99
+ mcpToolName: n,
100
+ kind: "toolset",
101
+ discovery: "indirect"
102
+ }));
103
+ } catch {
104
+ return [];
105
+ }
106
+ }));
107
+ f((e) => [...e, ...n.flat()]);
108
+ })();
109
+ }
110
+ }, [
111
+ m,
112
+ r,
113
+ e
114
+ ]), [...i, ...u];
115
+ }, _ = /* @__PURE__ */ "--color-background-primary.--color-background-secondary.--color-background-tertiary.--color-background-inverse.--color-background-ghost.--color-background-info.--color-background-danger.--color-background-success.--color-background-warning.--color-background-disabled.--color-text-primary.--color-text-secondary.--color-text-tertiary.--color-text-inverse.--color-text-ghost.--color-text-info.--color-text-danger.--color-text-success.--color-text-warning.--color-text-disabled.--color-border-primary.--color-border-secondary.--color-border-tertiary.--color-border-inverse.--color-border-ghost.--color-border-info.--color-border-danger.--color-border-success.--color-border-warning.--color-border-disabled.--color-ring-primary.--color-ring-secondary.--color-ring-inverse.--color-ring-info.--color-ring-danger.--color-ring-success.--color-ring-warning.--font-sans.--font-mono.--font-weight-normal.--font-weight-medium.--font-weight-semibold.--font-weight-bold.--font-text-xs-size.--font-text-sm-size.--font-text-md-size.--font-text-lg-size.--font-heading-xs-size.--font-heading-sm-size.--font-heading-md-size.--font-heading-lg-size.--font-heading-xl-size.--font-heading-2xl-size.--font-heading-3xl-size.--font-text-xs-line-height.--font-text-sm-line-height.--font-text-md-line-height.--font-text-lg-line-height.--font-heading-xs-line-height.--font-heading-sm-line-height.--font-heading-md-line-height.--font-heading-lg-line-height.--font-heading-xl-line-height.--font-heading-2xl-line-height.--font-heading-3xl-line-height.--border-radius-xs.--border-radius-sm.--border-radius-md.--border-radius-lg.--border-radius-xl.--border-radius-full.--border-width-regular.--shadow-hairline.--shadow-sm.--shadow-md.--shadow-lg".split("."), v = () => {
116
+ let e = getComputedStyle(document.documentElement), t = {};
117
+ for (let n of _) {
118
+ let r = e.getPropertyValue(n).trim();
119
+ r && (t[n] = r);
120
+ }
121
+ return t;
122
+ }, y = (e, { theme: t, mcpAppTheme: n, locale: r, mcpAppUserAgent: i }) => s(() => ({
123
+ theme: n ?? t,
124
+ locale: r,
125
+ timeZone: Intl.DateTimeFormat().resolvedOptions().timeZone,
126
+ userAgent: i ?? "ai-dial-chat",
127
+ platform: "web",
128
+ displayMode: e,
129
+ styles: { variables: v() }
130
+ }), [
131
+ n,
132
+ t,
133
+ r,
134
+ i,
135
+ e
136
+ ]), b = (t, n, r, i) => {
137
+ let a = y(t, i), o = s(() => async (t, r, i, a) => {
138
+ try {
139
+ return await n.callTool(t, r, i, a);
140
+ } catch (t) {
141
+ throw Error(await e(t) ?? `Tool call "${r}" failed`);
142
+ }
143
+ }, [n]);
144
+ return s(() => ({
145
+ hostContext: a,
146
+ sandboxUrl: r,
147
+ fetchResourceHtml: n.fetchResourceHtml,
148
+ callTool: o
149
+ }), [
150
+ a,
151
+ r,
152
+ n.fetchResourceHtml,
153
+ o
154
+ ]);
155
+ }, x = (e, t, s, l) => {
156
+ let { openCanvas: u, openCanvasLoading: d } = i(), { hostContext: h, sandboxUrl: g, fetchResourceHtml: _, callTool: v } = t, y = c(null), b = a(async (t, i, a, o = !1) => {
157
+ if (g == null) return !1;
158
+ l?.(), d(s.title, i);
159
+ try {
160
+ let r = f(a), c = async () => {
161
+ let [e, n] = await Promise.all([_(t.toolsetId, t.resourceUri), p(t, a, v)]);
162
+ return {
163
+ html: e,
164
+ toolResult: n
165
+ };
166
+ }, l, d;
167
+ return i != null && !o ? {html: l, toolResult: d} = await e.getOrFetch(i, r, c) : ({html: l, toolResult: d} = await c(), i != null && e.set(i, {
168
+ html: l,
169
+ toolResult: d
170
+ }, r)), u({
171
+ type: n.McpApp,
172
+ html: l,
173
+ sandboxUrl: g,
174
+ toolName: t.mcpToolName,
175
+ toolInput: a?.toolInput,
176
+ toolResult: d,
177
+ hostContext: h,
178
+ onToolCall: (e, n) => v(t.toolsetId, e, n, t.kind),
179
+ onReload: () => {
180
+ i != null && e.invalidate(i), y.current?.(t, i, a, !0);
181
+ }
182
+ }, s.title, i), !0;
183
+ } catch (e) {
184
+ let t = e instanceof m && e.status === 403;
185
+ return u({
186
+ type: n.Error,
187
+ errorType: t ? r.Forbidden : r.LoadFailed,
188
+ label: t ? s.forbiddenErrorLabel : s.loadErrorLabel
189
+ }, s.title, i), !1;
190
+ }
191
+ }, [
192
+ u,
193
+ d,
194
+ l,
195
+ g,
196
+ h,
197
+ _,
198
+ v,
199
+ e,
200
+ s
201
+ ]);
202
+ return o(() => {
203
+ y.current = b;
204
+ }, [b]), { openMcpAppCanvas: b };
205
+ };
206
+ //#endregion
207
+ export { m as a, g as i, b as n, h as o, y as r, x as t };