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

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/conversation.js CHANGED
@@ -1,2 +1,2 @@
1
- import { A as e, B as t, C as n, D as r, E as i, F as a, H as o, I as s, L as c, M as l, N as u, O as d, P as f, R as p, S as m, T as h, V as g, _, a as v, b as y, c as b, d as x, f as S, g as C, h as w, i as T, j as E, k as D, l as O, m as k, n as A, o as j, p as M, r as N, s as P, t as F, u as I, v as L, w as R, x as z, y as B, z as V } from "./useToolsMenu-DLd2C4uO.js";
1
+ import { A as e, B as t, C as n, D as r, E as i, F as a, H as o, I as s, L as c, M as l, N as u, O as d, P as f, R as p, S as m, T as h, V as g, _, a as v, b as y, c as b, d as x, f as S, g as C, h as w, i as T, j as E, k as D, l as O, m as k, n as A, o as j, p as M, r as N, s as P, t as F, u as I, v as L, w as R, x as z, y as B, z as V } from "./useToolsMenu-zURpMEn1.js";
2
2
  export { S as attachmentToDto, M as attachmentsToDtos, p as buildAnnouncementSignature, c as createChatStreamApi, E as createDeploymentChangedMessage, x as createMessagePair, z as deriveConversationRowActionState, f as formatAppVersion, j as getConversationPath, C as getConversationSource, i as getLastDeploymentId, r as getLastUserMessageToolConfiguration, u as getModelIdFromConversationId, R as getQuickAppConversationStarters, P as getStarterConversationText, m as getStarterPopulateText, b as getStarterSubmitText, n as getStartersFromSchema, l as getTimeOfDayGreeting, O as hasActiveToolConfig, V as hasAnnouncementContent, t as hasStructuredAnnouncement, T as isAwaitingGenerationResume, I as isMessageChanged, d as isMessageStreaming, D as messageHasStages, e as normalizeResponseFormat, g as sanitizeAnnouncementHtml, o as sanitizeAnnouncementMessageHtml, a as sanitizeFooterHtml, s as shouldWatchForDisplayNameUpdate, h as toOverlayMessages, y as useActiveConversationSync, B as useAsyncConfirmDialog, k as useAttachmentUpload, A as useChatSettingsFormConfig, v as useConversationHandlers, L as useConversationLookupMaps, _ as useConversationPanelItems, N as useConversationStream, w as useImportFilePicker, F as useToolsMenu };
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
@@ -11,7 +11,7 @@ import { C as at, S as ot, T as st, _ as ct, a as lt, b as ut, c as dt, d as ft,
11
11
  import { a as At, c as jt, i as Mt, n as Nt, o as Pt, r as Ft, s as It, t as Lt } from "./prompt-resource-Bt1I-8ri.js";
12
12
  import { n as Rt, t as zt } from "./formatting-CZyyxBG3.js";
13
13
  import { a as Bt, c as Vt, d as Ht, f as Ut, h as Wt, i as Gt, l as Kt, m as qt, n as Jt, o as Yt, p as Xt, r as Zt, s as Qt, t as $t, u as en } from "./skill-manifest-CCX8s4nn.js";
14
- import { A as tn, B as nn, C as rn, D as an, E as on, F as sn, H as cn, I as ln, L as un, M as dn, N as fn, O as pn, P as mn, R as hn, S as gn, T as _n, V as vn, _ as yn, a as bn, b as xn, c as Sn, d as Cn, f as wn, g as Tn, h as En, i as Dn, j as On, k as kn, l as An, m as jn, n as Mn, o as Nn, p as Pn, r as Fn, s as In, t as Ln, u as Rn, v as zn, w as Bn, x as Vn, y as Hn, z as Un } from "./useToolsMenu-DLd2C4uO.js";
14
+ import { A as tn, B as nn, C as rn, D as an, E as on, F as sn, H as cn, I as ln, L as un, M as dn, N as fn, O as pn, P as mn, R as hn, S as gn, T as _n, V as vn, _ as yn, a as bn, b as xn, c as Sn, d as Cn, f as wn, g as Tn, h as En, i as Dn, j as On, k as kn, l as An, m as jn, n as Mn, o as Nn, p as Pn, r as Fn, s as In, t as Ln, u as Rn, v as zn, w as Bn, x as Vn, y as Hn, z as Un } from "./useToolsMenu-zURpMEn1.js";
15
15
  import { t as Wn } from "./useOAuthCallbackCompletion-CvyTKLER.js";
16
16
  import { i as Gn, n as Kn, r as qn, t as Jn } from "./scheduled-task-trigger-D9RZCk52.js";
17
17
  import { n as Yn, t as Xn } from "./cron-weekday-B4w29eAC.js";
@@ -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,9 +1,16 @@
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.411",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
7
+ "sideEffects": [
8
+ "./index.js",
9
+ "./oauth.js",
10
+ "./file-manager.js",
11
+ "./useToolsetLogin-*.js",
12
+ "./useDialFileManagerTabConfig-*.js"
13
+ ],
7
14
  "main": "./index.js",
8
15
  "module": "./index.js",
9
16
  "types": "./index.d.ts",
@@ -83,25 +90,32 @@
83
90
  "types": "./utils.d.ts",
84
91
  "import": "./utils.js",
85
92
  "default": "./utils.js"
93
+ },
94
+ "./mcp-apps": {
95
+ "types": "./mcp-apps.d.ts",
96
+ "import": "./mcp-apps.js",
97
+ "default": "./mcp-apps.js"
86
98
  }
87
99
  },
88
100
  "peerDependencies": {
89
101
  "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",
102
+ "@epam/ai-dial-attachment-canvas": "1.1.0-dev.411",
103
+ "@epam/ai-dial-attachment-input": "1.1.0-dev.411",
104
+ "@epam/ai-dial-catalog": "1.1.0-dev.411",
105
+ "@epam/ai-dial-chat-api-client": "1.1.0-dev.411",
106
+ "@epam/ai-dial-chat-overlay": "1.1.0-dev.411",
107
+ "@epam/ai-dial-chat-shared": "1.1.0-dev.411",
108
+ "@epam/ai-dial-deployment-creation-form": "1.1.0-dev.411",
109
+ "@epam/ai-dial-mcp-apps": "1.1.0-dev.411",
110
+ "@epam/ai-dial-publish-panel": "1.1.0-dev.411",
111
+ "@epam/ai-dial-quotations": "1.1.0-dev.411",
99
112
  "@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",
113
+ "@epam/ai-dial-scheduled-tasks": "1.1.0-dev.411",
114
+ "@epam/ai-dial-share": "1.1.0-dev.411",
115
+ "@epam/ai-dial-skill-editor": "1.1.0-dev.411",
116
+ "@epam/ai-dial-source-panel": "1.1.0-dev.411",
104
117
  "@epam/ai-dial-ui-kit": "*",
118
+ "@modelcontextprotocol/sdk": "^1.27.1",
105
119
  "@epam/pdf-highlighter-kit": ">=0.0.14"
106
120
  },
107
121
  "peerDependenciesMeta": {
@@ -126,6 +140,9 @@
126
140
  "@epam/ai-dial-deployment-creation-form": {
127
141
  "optional": true
128
142
  },
143
+ "@epam/ai-dial-mcp-apps": {
144
+ "optional": true
145
+ },
129
146
  "@epam/ai-dial-publish-panel": {
130
147
  "optional": true
131
148
  },
@@ -150,17 +167,16 @@
150
167
  "@epam/ai-dial-ui-kit": {
151
168
  "optional": true
152
169
  },
170
+ "@mcp-ui/client": {
171
+ "optional": true
172
+ },
173
+ "@modelcontextprotocol/sdk": {
174
+ "optional": true
175
+ },
153
176
  "@epam/pdf-highlighter-kit": {
154
177
  "optional": true
155
178
  }
156
179
  },
157
- "sideEffects": [
158
- "./index.js",
159
- "./oauth.js",
160
- "./file-manager.js",
161
- "./useToolsetLogin-*.js",
162
- "./useDialFileManagerTabConfig-*.js"
163
- ],
164
180
  "repository": {
165
181
  "type": "git",
166
182
  "url": "git+https://github.com/epam/ai-dial-chat.git",
@@ -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 };
@@ -1424,10 +1424,17 @@ var rt = (e) => et.sanitize(e, tt), it = (e) => et.sanitize(e, nt), at = (e) =>
1424
1424
  pendingStarterContext: C,
1425
1425
  setPendingStarterContext: w
1426
1426
  };
1427
- }, qt = (e, t) => {
1427
+ }, qt = (e) => {
1428
+ let t = e.target?.selector;
1429
+ return t?.type === "html_tag" ? t.id : void 0;
1430
+ }, Jt = (e, t) => {
1431
+ if (e.index != null && t.index != null) return e.index === t.index;
1432
+ let n = qt(e), r = qt(t);
1433
+ return n != null && n === r;
1434
+ }, Yt = (e, t) => {
1428
1435
  let n = [...e];
1429
1436
  for (let e of t) {
1430
- let t = n.findIndex((t) => t.index === e.index);
1437
+ let t = n.findIndex((t) => Jt(t, e));
1431
1438
  if (t >= 0) {
1432
1439
  let r = n[t];
1433
1440
  n[t] = {
@@ -1443,7 +1450,7 @@ var rt = (e) => et.sanitize(e, tt), it = (e) => et.sanitize(e, nt), at = (e) =>
1443
1450
  } else n.push(e);
1444
1451
  }
1445
1452
  return n;
1446
- }, Jt = (e, t) => {
1453
+ }, Xt = (e, t) => {
1447
1454
  let n = [...e];
1448
1455
  for (let e of t) {
1449
1456
  let t = e.index == null ? -1 : n.findIndex((t) => t.index === e.index);
@@ -1455,7 +1462,7 @@ var rt = (e) => et.sanitize(e, tt), it = (e) => et.sanitize(e, nt), at = (e) =>
1455
1462
  } : n.push(e);
1456
1463
  }
1457
1464
  return n;
1458
- }, Yt = (e, t) => {
1465
+ }, Zt = (e, t) => {
1459
1466
  let n = [...e];
1460
1467
  for (let e of t) {
1461
1468
  let t = n.findIndex((t) => t.index === e.index);
@@ -1464,14 +1471,14 @@ var rt = (e) => et.sanitize(e, tt), it = (e) => et.sanitize(e, nt), at = (e) =>
1464
1471
  ...e,
1465
1472
  name: (n[t].name ?? "") + (e.name ?? ""),
1466
1473
  content: (n[t].content ?? "") + (e.content ?? "") || void 0,
1467
- attachments: e.attachments?.length ? Jt(n[t].attachments ?? [], e.attachments) : n[t].attachments
1474
+ attachments: e.attachments?.length ? Xt(n[t].attachments ?? [], e.attachments) : n[t].attachments
1468
1475
  } : n.push({
1469
1476
  ...e,
1470
1477
  name: e.name ?? ""
1471
1478
  });
1472
1479
  }
1473
1480
  return n;
1474
- }, Xt = (e, t, n) => {
1481
+ }, Qt = (e, t, n) => {
1475
1482
  let r = n.choices[0]?.delta, i = r?.content ?? "", a = r?.custom_content?.form_schema, o = r?.custom_content?.attachments, s = r?.custom_content?.stages, c = r?.custom_content?.annotations, l = r?.custom_fields?.annotations, u = r?.custom_content?.state, f = !!i || !!a || !!o?.length || !!s?.length || !!c?.length || !!l?.length || !!u, p = r?.responseId ?? (f ? n.id : void 0);
1476
1483
  return !f && !p ? null : e.map((e, n) => {
1477
1484
  if (n !== t) return e;
@@ -1484,33 +1491,33 @@ var rt = (e) => et.sanitize(e, tt), it = (e) => et.sanitize(e, nt), at = (e) =>
1484
1491
  ...e.custom_content,
1485
1492
  ...a && { form_schema: a },
1486
1493
  ...o?.length && { attachments: r },
1487
- ...s?.length && { stages: Yt(e.custom_content?.stages ?? [], s) },
1488
- ...m.length && { annotations: qt(e.custom_content?.annotations ?? [], m) },
1494
+ ...s?.length && { stages: Zt(e.custom_content?.stages ?? [], s) },
1495
+ ...m.length && { annotations: Yt(e.custom_content?.annotations ?? [], m) },
1489
1496
  ...u && { state: u }
1490
1497
  } }
1491
1498
  };
1492
1499
  });
1493
- }, Zt = (e, t) => ({
1500
+ }, $t = (e, t) => ({
1494
1501
  ...e,
1495
1502
  ...t,
1496
1503
  ...(e.custom_content || t.custom_content) && { custom_content: {
1497
1504
  ...e.custom_content,
1498
1505
  ...t.custom_content
1499
1506
  } }
1500
- }), Qt = (e, t) => {
1507
+ }), en = (e, t) => {
1501
1508
  if (t.messageIndex > e.messages.length) return e;
1502
1509
  let n = [...e.messages];
1503
- return t.messageIndex === n.length ? n.push(t.message) : n[t.messageIndex] = Zt(n[t.messageIndex], t.message), {
1510
+ return t.messageIndex === n.length ? n.push(t.message) : n[t.messageIndex] = $t(n[t.messageIndex], t.message), {
1504
1511
  ...e,
1505
1512
  messages: n
1506
1513
  };
1507
- }, $t = (e) => {
1514
+ }, tn = (e) => {
1508
1515
  let t = e.custom_content;
1509
1516
  return !!e.content || e.responseId != null || !!t?.attachments?.length || !!t?.stages?.length || !!t?.annotations?.length || !!t?.form_schema || t?.state != null;
1510
- }, en = (e) => {
1517
+ }, Z = (e) => {
1511
1518
  let t = e.messages[e.messages.length - 1];
1512
- return !!t && t.role === o.Assistant && !$t(t) && t.streamErrorMessage == null && !t.wasStoppedByUser;
1513
- }, tn = 300 * 1e3, Z = "awaiting-resume", nn = async (e, t) => {
1519
+ return !!t && t.role === o.Assistant && !tn(t) && t.streamErrorMessage == null && !t.wasStoppedByUser;
1520
+ }, nn = 300 * 1e3, Q = "awaiting-resume", rn = async (e, t) => {
1514
1521
  let n = e.getReader(), r = new TextDecoder(), i = "";
1515
1522
  try {
1516
1523
  for (;;) {
@@ -1539,8 +1546,8 @@ var rt = (e) => et.sanitize(e, tt), it = (e) => et.sanitize(e, nt), at = (e) =>
1539
1546
  } catch {} finally {
1540
1547
  n.releaseLock();
1541
1548
  }
1542
- }, Q = ({ transport: t, setConversation: n, conversationRef: r, resumingPathsRef: i, bufferedGenerationsRef: a, addStreamingPath: o, removeStreamingPath: s, isPathDisplayed: c }) => (l, u) => {
1543
- if (!en(u)) return;
1549
+ }, an = ({ transport: t, setConversation: n, conversationRef: r, resumingPathsRef: i, bufferedGenerationsRef: a, addStreamingPath: o, removeStreamingPath: s, isPathDisplayed: c }) => (l, u) => {
1550
+ if (!Z(u)) return;
1544
1551
  let d = X(l);
1545
1552
  if (i.current.has(d)) return;
1546
1553
  i.current.add(d), o(d);
@@ -1554,26 +1561,26 @@ var rt = (e) => et.sanitize(e, tt), it = (e) => et.sanitize(e, nt), at = (e) =>
1554
1561
  }
1555
1562
  }, h = (e) => {
1556
1563
  let t = {
1557
- generationId: Z,
1564
+ generationId: Q,
1558
1565
  messageIndex: f,
1559
1566
  message: e
1560
1567
  };
1561
1568
  a.current.set(d, t), c(d) && n((e) => {
1562
1569
  if (!e) return e;
1563
- let n = Qt(e, t);
1570
+ let n = en(e, t);
1564
1571
  return r.current = n, n;
1565
1572
  });
1566
1573
  }, g = (e) => {
1567
1574
  let t = a.current.get(d);
1568
- if (t?.generationId === Z) {
1569
- let n = Xt([t.message], 0, e);
1575
+ if (t?.generationId === Q) {
1576
+ let n = Qt([t.message], 0, e);
1570
1577
  n && (t.message = n[0]);
1571
1578
  }
1572
1579
  c(d) && n((e) => {
1573
1580
  if (!e) return e;
1574
1581
  let t = a.current.get(d);
1575
- if (t?.generationId !== Z) return e;
1576
- let n = Qt(e, t);
1582
+ if (t?.generationId !== Q) return e;
1583
+ let n = en(e, t);
1577
1584
  return r.current = n, n;
1578
1585
  });
1579
1586
  }, _ = async () => {
@@ -1586,13 +1593,13 @@ var rt = (e) => et.sanitize(e, tt), it = (e) => et.sanitize(e, nt), at = (e) =>
1586
1593
  }
1587
1594
  let i = !1, a = window.setTimeout(() => {
1588
1595
  n.abort();
1589
- }, tn);
1596
+ }, nn);
1590
1597
  try {
1591
- await nn(r, async (n) => {
1598
+ await rn(r, async (n) => {
1592
1599
  if (n?.action !== "UPDATE") return !1;
1593
1600
  try {
1594
1601
  let n = await t.getConversation(e(l));
1595
- if (!en(n)) return p(n), i = !0, !0;
1602
+ if (!Z(n)) return p(n), i = !0, !0;
1596
1603
  } catch {}
1597
1604
  return !1;
1598
1605
  });
@@ -1608,7 +1615,7 @@ var rt = (e) => et.sanitize(e, tt), it = (e) => et.sanitize(e, nt), at = (e) =>
1608
1615
  return !1;
1609
1616
  }
1610
1617
  let r = !1;
1611
- return await nn(n, (e) => {
1618
+ return await rn(n, (e) => {
1612
1619
  switch (e.type) {
1613
1620
  case "snapshot": return h(e.message), !1;
1614
1621
  case "chunk": return g(e.chunk), !1;
@@ -1621,7 +1628,7 @@ var rt = (e) => et.sanitize(e, tt), it = (e) => et.sanitize(e, nt), at = (e) =>
1621
1628
  (async () => {
1622
1629
  await v() || await _();
1623
1630
  })();
1624
- }, rn = 2e4, an = ({ conversationId: t, state: { setConversation: n, conversationRef: r }, transport: i, generation: { startGeneration: a, completeGeneration: o }, channel: s, overlay: c, onStopError: u }) => {
1631
+ }, on = 2e4, sn = ({ conversationId: t, state: { setConversation: n, conversationRef: r }, transport: i, generation: { startGeneration: a, completeGeneration: o }, channel: s, overlay: c, onStopError: u }) => {
1625
1632
  let [d, m] = _(() => /* @__PURE__ */ new Set()), [y, b] = _(null), x = g(null), S = g(null), C = g(/* @__PURE__ */ new Set()), w = g(/* @__PURE__ */ new Map()), ee = g(/* @__PURE__ */ new Set()), T = g(t);
1626
1633
  p(() => {
1627
1634
  T.current = t;
@@ -1655,15 +1662,15 @@ var rt = (e) => et.sanitize(e, tt), it = (e) => et.sanitize(e, nt), at = (e) =>
1655
1662
  if (x.current !== g) return;
1656
1663
  let t = w.current.get(_);
1657
1664
  if (t?.generationId === g) {
1658
- let n = Xt([t.message], 0, e);
1665
+ let n = Qt([t.message], 0, e);
1659
1666
  n && (t.message = n[0]);
1660
1667
  }
1661
1668
  E(_) && n((t) => {
1662
1669
  if (!t) return t;
1663
1670
  let n = w.current.get(_), i;
1664
- if (n?.generationId === g) i = Qt(t, n);
1671
+ if (n?.generationId === g) i = en(t, n);
1665
1672
  else {
1666
- let n = Xt(t.messages, d, e);
1673
+ let n = Qt(t.messages, d, e);
1667
1674
  if (!n) return t;
1668
1675
  i = {
1669
1676
  ...t,
@@ -1684,7 +1691,7 @@ var rt = (e) => et.sanitize(e, tt), it = (e) => et.sanitize(e, nt), at = (e) =>
1684
1691
  let t = w.current.get(_), i = t?.generationId === g ? t : void 0;
1685
1692
  i && w.current.delete(_), O(_), x.current === g && (x.current = null, S.current = null, b(null)), o(_, g), s?.notifyGenerationSettled?.(), E(_) && n((t) => {
1686
1693
  if (!t) return t;
1687
- let n = i?.generationId === g ? Qt(t, i) : t, a = {
1694
+ let n = i?.generationId === g ? en(t, i) : t, a = {
1688
1695
  ...n,
1689
1696
  messages: n.messages.map((t, n) => n === d ? {
1690
1697
  ...t,
@@ -1697,7 +1704,7 @@ var rt = (e) => et.sanitize(e, tt), it = (e) => et.sanitize(e, nt), at = (e) =>
1697
1704
  };
1698
1705
  (async () => {
1699
1706
  try {
1700
- let e = s?.channelId ?? await s?.waitForChannel(rn) ?? void 0;
1707
+ let e = s?.channelId ?? await s?.waitForChannel(on) ?? void 0;
1701
1708
  i.streamCompletion(_, u, f, k, p, g, h, y, e);
1702
1709
  } catch (e) {
1703
1710
  k.onError(e instanceof Error ? e : Error(String(e)));
@@ -1717,7 +1724,7 @@ var rt = (e) => et.sanitize(e, tt), it = (e) => et.sanitize(e, nt), at = (e) =>
1717
1724
  i
1718
1725
  ]), A = f((e, t) => {
1719
1726
  let n = X(e), r = w.current.get(n);
1720
- return r ? Qt(t, r) : t;
1727
+ return r ? en(t, r) : t;
1721
1728
  }, []), te = f(() => {
1722
1729
  let e = x.current;
1723
1730
  if (!e || !t) return;
@@ -1734,7 +1741,7 @@ var rt = (e) => et.sanitize(e, tt), it = (e) => et.sanitize(e, nt), at = (e) =>
1734
1741
  u,
1735
1742
  c,
1736
1743
  i
1737
- ]), ne = h(() => Q({
1744
+ ]), ne = h(() => an({
1738
1745
  transport: i,
1739
1746
  setConversation: n,
1740
1747
  conversationRef: r,
@@ -1757,7 +1764,7 @@ var rt = (e) => et.sanitize(e, tt), it = (e) => et.sanitize(e, nt), at = (e) =>
1757
1764
  isStreaming: re,
1758
1765
  canStopStreaming: j != null && y === j
1759
1766
  };
1760
- }, on = {
1767
+ }, cn = {
1761
1768
  settings: "Settings",
1762
1769
  savedNotification: "Chat settings have been saved",
1763
1770
  responseFormatLabel: "Response format",
@@ -1773,11 +1780,11 @@ var rt = (e) => et.sanitize(e, tt), it = (e) => et.sanitize(e, nt), at = (e) =>
1773
1780
  temperatureHint: "Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.",
1774
1781
  saveLabel: "Apply changes",
1775
1782
  saveDisabledTooltip: "Please select a response format"
1776
- }, sn = (e) => (e ?? "").toLowerCase().replace(/[^a-z]/g, "") === "plaintext" ? s.PlainText : s.Markdown, cn = (e) => {
1783
+ }, ln = (e) => (e ?? "").toLowerCase().replace(/[^a-z]/g, "") === "plaintext" ? s.PlainText : s.Markdown, un = (e) => {
1777
1784
  let t = h(() => ({
1778
- ...on,
1785
+ ...cn,
1779
1786
  ...e.labels
1780
- }), [e.labels]), { onSaved: n } = e, r = e.mode === "local" ? e.values.responseFormat : sn(e.conversation.responseFormat), i = e.mode === "local" ? e.values.systemPrompt : e.conversation.prompt ?? "", a = e.mode === "local" ? e.values.temperature : e.conversation.temperature ?? .5, o = f((t) => {
1787
+ }), [e.labels]), { onSaved: n } = e, r = e.mode === "local" ? e.values.responseFormat : ln(e.conversation.responseFormat), i = e.mode === "local" ? e.values.systemPrompt : e.conversation.prompt ?? "", a = e.mode === "local" ? e.values.temperature : e.conversation.temperature ?? .5, o = f((t) => {
1781
1788
  e.mode === "local" ? e.onValuesChange({
1782
1789
  responseFormat: t.responseFormat ?? e.values.responseFormat,
1783
1790
  systemPrompt: t.systemPrompt ?? e.values.systemPrompt,
@@ -1825,18 +1832,18 @@ var rt = (e) => et.sanitize(e, tt), it = (e) => et.sanitize(e, nt), at = (e) =>
1825
1832
  i,
1826
1833
  a
1827
1834
  ]);
1828
- }, ln = (e) => e.type === "boolean" || e.type == null && typeof e.default == "boolean", un = (e) => {
1835
+ }, dn = (e) => e.type === "boolean" || e.type == null && typeof e.default == "boolean", fn = (e) => {
1829
1836
  let t = e.replace(/[_-]+/g, " ").trim();
1830
1837
  return t.length === 0 ? e : t.charAt(0).toUpperCase() + t.slice(1);
1831
- }, dn = (e) => {
1838
+ }, pn = (e) => {
1832
1839
  let t = e?.properties;
1833
- return t == null ? [] : Object.entries(t).filter(([, e]) => ln(e)).map(([e, t]) => ({
1840
+ return t == null ? [] : Object.entries(t).filter(([, e]) => dn(e)).map(([e, t]) => ({
1834
1841
  id: e,
1835
- label: typeof t.title == "string" && t.title.length > 0 ? t.title : un(e),
1842
+ label: typeof t.title == "string" && t.title.length > 0 ? t.title : fn(e),
1836
1843
  defaultValue: t.default === !0
1837
1844
  }));
1838
- }, fn = (e) => {
1839
- let { selectedItemId: t, selectedDeploymentConfiguration: n, toolIcon: r } = e, i = h(() => dn(n), [n]), a = h(() => Object.fromEntries(i.map(({ id: e, defaultValue: t }) => [e, t])), [i]), [o, s] = _(a), c = JSON.stringify(a), l = g(a);
1845
+ }, $ = (e) => {
1846
+ let { selectedItemId: t, selectedDeploymentConfiguration: n, toolIcon: r } = e, i = h(() => pn(n), [n]), a = h(() => Object.fromEntries(i.map(({ id: e, defaultValue: t }) => [e, t])), [i]), [o, s] = _(a), c = JSON.stringify(a), l = g(a);
1840
1847
  l.current = a, p(() => {
1841
1848
  s(l.current);
1842
1849
  }, [t, c]);
@@ -1872,4 +1879,4 @@ var rt = (e) => et.sanitize(e, tt), it = (e) => et.sanitize(e, nt), at = (e) =>
1872
1879
  };
1873
1880
  };
1874
1881
  //#endregion
1875
- export { Ct as A, ot as B, Ot as C, St as D, bt as E, W as F, it as H, lt as I, U as L, _t as M, gt as N, yt as O, dt as P, st as R, J as S, wt as T, rt as V, Pt as _, Kt as a, At as b, Gt as c, Vt as d, zt as f, Nt as g, Y as h, en as i, vt as j, xt as k, Ht as l, Rt as m, cn as n, X as o, Bt as p, an as r, Wt as s, fn as t, Ut as u, Mt as v, Dt as w, kt as x, jt as y, V as z };
1882
+ export { Ct as A, ot as B, Ot as C, St as D, bt as E, W as F, it as H, lt as I, U as L, _t as M, gt as N, yt as O, dt as P, st as R, J as S, wt as T, rt as V, Pt as _, Kt as a, At as b, Gt as c, Vt as d, zt as f, Nt as g, Y as h, Z as i, vt as j, xt as k, Ht as l, Rt as m, un as n, X as o, Bt as p, sn as r, Wt as s, $ as t, Ut as u, Mt as v, Dt as w, kt as x, jt as y, V as z };