@epam/ai-dial-chat-hooks 1.1.0-dev.423 → 1.1.0-dev.430
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/{api-error-DuLNy43N.js → api-error/api-error.js} +1 -1
- package/api-transport/create-csrf-middleware.js +21 -0
- package/api-transport/create-unauthorized-middleware.js +41 -0
- package/attachment/useAttachmentAction/useAttachmentAction.js +74 -0
- package/attachment/useAttachmentValidation/useAttachmentValidation.js +35 -0
- package/attachments.js +3 -2
- package/catalog/catalog-derivations.js +10 -0
- package/catalog/catalog-primary-action.js +21 -0
- package/catalog/create-publish-api.js +27 -0
- package/catalog/deployment-endpoint-url.js +34 -0
- package/{deployment-id-CxWgJTs9.js → catalog/deployment-id.js} +1 -1
- package/catalog/entity-details.js +6 -0
- package/catalog/map-deployment-limits-to-catalog.js +73 -0
- package/catalog/map-deployment-limits-to-input.js +14 -0
- package/catalog/map-deployment-to-catalog-item.js +92 -0
- package/catalog/map-entity-details-to-catalog.js +350 -0
- package/catalog/map-prompt-to-catalog-item.js +49 -0
- package/catalog/map-skill-to-catalog-item.js +123 -0
- package/catalog/mcp-endpoint-url.js +26 -0
- package/catalog/publish.js +18 -0
- package/catalog/useCatalogEditNavigation/useCatalogEditNavigation.js +109 -0
- package/catalog/useCatalogItemDetails.js +101 -0
- package/catalog/useCatalogToolsetCredentials/useCatalogToolsetCredentials.js +146 -0
- package/catalog/useFavoriteEntitiesState/useFavoriteEntitiesState.js +50 -0
- package/catalog/usePublishFolders/usePublishFolders.js +72 -0
- package/catalog.js +22 -3
- package/conversation/announcement-message.js +42 -0
- package/conversation/conversation-transfer/async.js +18 -0
- package/conversation/conversation-transfer/attachment-refs.js +11 -0
- package/conversation/conversation-transfer/build-upload-path.js +27 -0
- package/{date-BeuD8G79.js → conversation/conversation-transfer/date.js} +1 -1
- package/conversation/conversation-transfer/dial-file-resolve.js +18 -0
- package/conversation/conversation-transfer/export-conversation.js +32 -0
- package/conversation/conversation-transfer/import-conversation.js +93 -0
- package/conversation/conversation-transfer/progress.js +39 -0
- package/conversation/conversation-transfer/queue.js +84 -0
- package/conversation/conversation-transfer/types.js +9 -0
- package/conversation/conversation-transfer/zip-export.js +19 -0
- package/conversation/conversation-transfer/zip-import.js +29 -0
- package/conversation/create-chat-stream-api.js +96 -0
- package/conversation/deriveConversationRowActionState/deriveConversationRowActionState.js +14 -0
- package/conversation/display-name-watch.js +5 -0
- package/conversation/footer-message.js +23 -0
- package/conversation/get-model-id-from-conversation-id.js +14 -0
- package/conversation/greeting.js +7 -0
- package/conversation/message-factory.js +19 -0
- package/conversation/message-utils.js +13 -0
- package/conversation/overlay-messages.js +8 -0
- package/conversation/quick-app-conversation-starters.js +29 -0
- package/conversation/starter-option.js +27 -0
- package/conversation/useActiveConversationSync/useActiveConversationSync.js +19 -0
- package/conversation/useAsyncConfirmDialog/useAsyncConfirmDialog.js +39 -0
- package/conversation/useAttachmentUpload/useAttachmentUpload.js +33 -0
- package/conversation/useConversationExport/useConversationExport.js +285 -0
- package/conversation/useConversationHandlers/attachment-to-dto.js +13 -0
- package/conversation/useConversationHandlers/message-factory.js +21 -0
- package/conversation/useConversationHandlers/message-utils.js +8 -0
- package/conversation/useConversationHandlers/starter-option.js +11 -0
- package/conversation/useConversationHandlers/useConversationHandlers.js +263 -0
- package/conversation/useConversationImport/useConversationImport.js +239 -0
- package/conversation/useConversationLookupMaps/useConversationLookupMaps.js +11 -0
- package/conversation/useConversationPanelItems/useConversationPanelItems.js +35 -0
- package/{useConversationScroll-CliIMnjP.js → conversation/useConversationScroll/useConversationScroll.js} +1 -1
- package/conversation/useConversationStream/apply-chunk.js +78 -0
- package/conversation/useConversationStream/buffered-generation.js +18 -0
- package/conversation/useConversationStream/conversation-path.js +8 -0
- package/conversation/useConversationStream/generation-resume.js +126 -0
- package/conversation/useConversationStream/useConversationStream.js +148 -0
- package/conversation/useImportFilePicker/useImportFilePicker.js +20 -0
- package/conversation/useTranscribeAudio/audio-transcription-error.js +12 -0
- package/conversation/useTranscribeAudio/transcription-retry.js +38 -0
- package/conversation/useTranscribeAudio/useTranscribeAudio.js +41 -0
- package/{useConversationSources-DKaKvjXZ.js → conversation-sources/useConversationSources/useConversationSources.js} +1 -1
- package/conversation-sources.js +1 -1
- package/conversation-transfer.js +7 -3
- package/conversation.d.ts +66 -0
- package/conversation.js +31 -2
- package/file-manager.d.ts +3 -4
- package/file-manager.js +28 -3
- package/files/annotation.js +15 -0
- package/files/attachment-canvas.js +218 -0
- package/files/attachment-dto-to-display.js +15 -0
- package/files/attachment-types.js +16 -0
- package/files/create-files-api.js +40 -0
- package/files/create-upload-file-with-progress.js +42 -0
- package/files/dial-file-manager-copy-move.util.js +55 -0
- package/files/dial-file-manager-mapping.util.js +140 -0
- package/files/dial-file-manager-path.util.js +72 -0
- package/files/dial-file-manager.model.js +25 -0
- package/files/dial-file-manager.types.js +10 -0
- package/files/dial-file-to-attachment.js +37 -0
- package/files/dial-file.js +30 -0
- package/files/dial-files-api.js +6 -0
- package/files/download-destination.js +6 -0
- package/files/file-manager-variant.js +11 -0
- package/files/file-name.js +19 -0
- package/files/prepare-download-destination.js +24 -0
- package/files/resolve-dial-file-api-path.js +33 -0
- package/files/source-content.js +37 -0
- package/files/useDialFileListing/useDialFileListing.js +295 -0
- package/files/useDialFileManager/useDialFileManager.js +146 -0
- package/files/useDialFileManagerTabConfig/useDialFileManagerTabConfig.js +23 -0
- package/files/useDialFileMetadata/useDialFileMetadata.js +42 -0
- package/files/useDialFileMutations/useDialFileMutations.js +359 -0
- package/files/useDialFileSharing/useDialFileSharing.js +70 -0
- package/files/useDialFileUploadBatch/useDialFileUploadBatch.js +156 -0
- package/index.d.ts +69 -4
- package/index.js +134 -28
- package/mcp-apps/mcp-apps-api-client.js +48 -0
- package/mcp-apps/useMcpAppHostAdapter/useMcpAppHostAdapter.js +26 -0
- package/mcp-apps/useMcpAppHostContext/useMcpAppHostContext.js +26 -0
- package/mcp-apps/useMcpAppTools/useMcpAppTools.js +71 -0
- package/mcp-apps/useOpenMcpAppCanvas/useOpenMcpAppCanvas.js +58 -0
- package/mcp-apps.js +6 -2
- package/oauth/authorize-url.js +12 -0
- package/oauth/handshake.js +65 -0
- package/oauth/popup.js +29 -0
- package/oauth/toolset-id.js +10 -0
- package/oauth/types.js +24 -0
- package/oauth/useOAuthCallbackCompletion/useOAuthCallbackCompletion.js +94 -0
- package/oauth/useToolsetLogin/useToolsetLogin.js +73 -0
- package/oauth.js +9 -3
- package/package.json +35 -23
- package/prompt/export-prompt.js +28 -0
- package/prompt/prompt-resource.js +15 -0
- package/prompt/prompt.js +12 -0
- package/prompt/usePromptsState/usePromptsState.js +42 -0
- package/scheduled-task/scheduled-task-mapping.js +6 -0
- package/{scheduled-task-trigger-D9RZCk52.js → scheduled-task/scheduled-task-trigger.js} +39 -40
- package/scheduled-tasks.js +3 -2
- package/scroll-anchoring.js +1 -1
- package/shared/application-schema.js +4 -0
- package/shared/browser-timezone.js +10 -0
- package/{cron-weekday-B4w29eAC.js → shared/cron-weekday.js} +1 -1
- package/shared/custom-apps.js +30 -0
- package/shared/external-services.js +18 -0
- package/{formatting-CZyyxBG3.js → shared/formatting.js} +1 -1
- package/{prompt-resource-Bt1I-8ri.js → shared/locale.js} +2 -13
- package/{string-utils-iBi2Y55C.js → shared/string-utils.js} +1 -1
- package/shared/toolset-login-events.js +13 -0
- package/sharing.js +3 -3
- package/skill/skill-file-batch-validation.js +48 -0
- package/skill/skill-file-preview.js +15 -0
- package/skill/skill-manifest.js +70 -0
- package/skill/skill-types.js +15 -0
- package/skill/skill.js +48 -0
- package/skill/useSkillEditorLoad.js +103 -0
- package/skill/useSkillEditorSubmit.js +135 -0
- package/skill/useSkillFileActions.js +99 -0
- package/skill/useSkillFilePreview.js +29 -0
- package/{useSkillsState-BoLlwmzb.js → skill/useSkillsState/useSkillsState.js} +1 -1
- package/skill-editor.js +8 -3
- package/skills-state.js +1 -1
- package/source-content.d.ts +29 -0
- package/source-content.js +2 -0
- package/usage/useUsageData/useUsageData.js +32 -0
- package/useChatSettingsFormConfig/useChatSettingsFormConfig.js +74 -0
- package/{usePanelMaxWidth-BEZYuqF9.js → usePageFileDrag/usePageFileDrag.js} +1 -11
- package/usePanelMaxWidth/usePanelMaxWidth.js +8 -0
- package/{useShareLink-xkiaxATt.js → useShareLink/useShareLink.js} +1 -1
- package/{useShareRecipientsCount-BgwCLKY0.js → useShareRecipientsCount/useShareRecipientsCount.js} +1 -1
- package/useToolsMenu/useToolsMenu.js +50 -0
- package/useViewportWidth/useViewportWidth.js +12 -0
- package/utils.js +17 -7
- package/viewport-layout.js +4 -2
- package/attachment-types-AAoN9E95.js +0 -7760
- package/browser-Btsa0Lmr.js +0 -607
- package/skill-manifest-CeG6-WSK.js +0 -4056
- package/useAttachmentValidation-CkMTd5lA.js +0 -102
- package/useConversationImport-CDRs7JF1.js +0 -826
- package/useDialFileManagerTabConfig-CjI46lMo.js +0 -2291
- package/useOAuthCallbackCompletion-CvyTKLER.js +0 -93
- package/useOpenMcpAppCanvas-C7-AMseH.js +0 -207
- package/useSkillFileActions-B-VaGD20.js +0 -373
- package/useSkillFilePreview-B5o1n_0F.js +0 -1244
- package/useToolsMenu-zURpMEn1.js +0 -1882
- package/useToolsetLogin-B05m134e.js +0 -195
- package/useUsageData-D7BxloKZ.js +0 -201
package/index.js
CHANGED
|
@@ -1,28 +1,134 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
|
|
1
|
+
import { getApiErrorDetails as e, getApiErrorMessage as t, getApiErrorStatus as n, isConversationNotFoundError as r } from "./api-error/api-error.js";
|
|
2
|
+
import { createCsrfMiddleware as i } from "./api-transport/create-csrf-middleware.js";
|
|
3
|
+
import { createUnauthorizedMiddleware as a } from "./api-transport/create-unauthorized-middleware.js";
|
|
4
|
+
import { includesIgnoreCase as o, safeDecodeURI as s, safeDecodeURIComponent as c, stripSurroundingSlashes as l } from "./shared/string-utils.js";
|
|
5
|
+
import { isDialFileId as u, resolveDialFileBucketAndPath as d, resolveRelativeDialFilePath as f } from "./files/dial-file.js";
|
|
6
|
+
import { downloadAttachment as p, isDownloadableAttachment as m, useAttachmentAction as h } from "./attachment/useAttachmentAction/useAttachmentAction.js";
|
|
7
|
+
import { isDialFileAcceptType as g, mimeTypesToAttachmentExtensionLabels as _, mimeTypesToDialFileAcceptTypes as v, mimeTypesToFileAccept as y } from "./files/attachment-types.js";
|
|
8
|
+
import { AttachmentValidationErrorReason as b, useAttachmentValidation as x } from "./attachment/useAttachmentValidation/useAttachmentValidation.js";
|
|
9
|
+
import { formatDateYM as S, formatDateYMD as C } from "./conversation/conversation-transfer/date.js";
|
|
10
|
+
import { ConversationExportMode as w, ConversationTransferErrorCode as T, ConversationTransferWarningCode as E, ExportFileNameKind as D } from "./conversation/conversation-transfer/types.js";
|
|
11
|
+
import { EXPORT_APP_NAME as O } from "./conversation/conversation-transfer/export-conversation.js";
|
|
12
|
+
import { formatQuotedNameList as k } from "./conversation/conversation-transfer/import-conversation.js";
|
|
13
|
+
import { createPublishApiClient as A, toPublishRuleDto as j } from "./catalog/create-publish-api.js";
|
|
14
|
+
import { buildChatCompletionsUrl as M, buildDeploymentConnectApi as N, buildResponsesUrl as P } from "./catalog/deployment-endpoint-url.js";
|
|
15
|
+
import { encodeDeploymentId as F, findDeploymentByIdOrReference as I } from "./catalog/deployment-id.js";
|
|
16
|
+
import { AuthenticationType as L } from "./catalog/entity-details.js";
|
|
17
|
+
import { mapDeploymentLimitsDtoToCatalogLimits as R } from "./catalog/map-deployment-limits-to-catalog.js";
|
|
18
|
+
import { mapDeploymentLimitsToInput as z } from "./catalog/map-deployment-limits-to-input.js";
|
|
19
|
+
import { decodeToolsetId as B, encodeToolsetId as V, isPublicToolsetId as H } from "./oauth/toolset-id.js";
|
|
20
|
+
import { appendLocaleCode as U, buildAdditionalLocaleOptions as W, composeLocalePayload as G, decomposeLocalizedFields as K, resolveLocalizedText as q, toBaseLocale as J } from "./shared/locale.js";
|
|
21
|
+
import { formatCalendarDate as Y, padTwoDigits as X } from "./shared/formatting.js";
|
|
22
|
+
import { mapDeploymentDetailsDtoToEntityDetails as Z, mapEntityDetailsToCatalogDetails as Q, mapToolsetCredentials as $ } from "./catalog/map-entity-details-to-catalog.js";
|
|
23
|
+
import { mapDeploymentToCatalogItem as ee, mapDeploymentToolsetCredentials as te, mapToolsetToCatalogItem as ne, resolveDeploymentFolder as re } from "./catalog/map-deployment-to-catalog-item.js";
|
|
24
|
+
import { PromptSource as ie, parsePromptResourceUrl as ae } from "./prompt/prompt-resource.js";
|
|
25
|
+
import { buildPromptOverview as oe, isOrganisationPromptItem as se, mapPromptToCatalogItem as ce } from "./catalog/map-prompt-to-catalog-item.js";
|
|
26
|
+
import { SKILL_FILE_UPLOAD_MAX_BYTES as le, SKILL_MANIFEST_FILE as ue, SKILL_UPLOAD_MAX_FILES as de, SKILL_UPLOAD_MAX_TOTAL_BYTES as fe, buildSkillFilesPayload as pe, buildSkillManifest as me, buildSkillManifestForSubmit as he, buildSkillManifestFromFrontmatter as ge, isValidSkillRelativePath as _e, nameFromPath as ve, normalizeSkillName as ye, parseSkillManifest as be, skillFileBytesToBlob as xe, unpackSkillArchive as Se } from "./skill/skill.js";
|
|
27
|
+
import { PUBLIC_SKILL_BUCKET as Ce, SKILL_LISTING_MAX_PAGES as we, SKILL_LISTING_PAGE_SIZE as Te, SKILL_MANIFEST_MAX_BYTES as Ee, SkillSource as De, parseSkillResourceUrl as Oe } from "./skill/skill-types.js";
|
|
28
|
+
import { buildSkillContentTree as ke, buildSkillOverview as Ae, mapSkillToCatalogItem as je, readSkillFileBytes as Me, readSkillManifest as Ne, resolveSkillFileDownloadPath as Pe, resolveSkillManifestFileId as Fe } from "./catalog/map-skill-to-catalog-item.js";
|
|
29
|
+
import { McpResourceKind as Ie, buildApplicationMcpUrl as Le, buildConnectApi as Re, buildToolsetMcpUrl as ze, resolveMcpResourceKind as Be } from "./catalog/mcp-endpoint-url.js";
|
|
30
|
+
import { mapPublishConversationResultDto as Ve, mapPublishHistoryEntryDto as He, toPublishEntityType as Ue } from "./catalog/publish.js";
|
|
31
|
+
import { deriveAvailableTabIds as We, deriveFavoriteItems as Ge, filterCatalogItemsBySelector as Ke, filterHiddenOwnedItems as qe, reconcileFilterTopics as Je } from "./catalog/catalog-derivations.js";
|
|
32
|
+
import { CatalogPrimaryActionType as Ye, resolveCatalogPrimaryAction as Xe } from "./catalog/catalog-primary-action.js";
|
|
33
|
+
import { useCatalogEditNavigation as Ze } from "./catalog/useCatalogEditNavigation/useCatalogEditNavigation.js";
|
|
34
|
+
import { parseSkillManifestDocument as Qe } from "./skill/skill-manifest.js";
|
|
35
|
+
import { useCatalogItemDetails as $e } from "./catalog/useCatalogItemDetails.js";
|
|
36
|
+
import { OAuthResourceKind as et, TOOLSET_REDIRECT_STATE_KEY as tt, ToolsetAuthStatus as nt, ToolsetAuthTypes as rt, ToolsetCredentialsLevel as it, ToolsetOAuthCallbackQuery as at, ToolsetOAuthChannelControlType as ot, ToolsetOAuthFailureReason as st, ToolsetOAuthInitiationResultType as ct, ToolsetOAuthResultType as lt, WithLogin as ut } from "./oauth/types.js";
|
|
37
|
+
import { emitToolsetLoginSuccess as dt, subscribeToolsetLoginSuccess as ft } from "./shared/toolset-login-events.js";
|
|
38
|
+
import { getToolsetOAuthChannelName as pt, waitForToolsetOAuthResult as mt } from "./oauth/handshake.js";
|
|
39
|
+
import { buildToolsetAuthorizeUrl as ht, getToolsetRedirectUri as gt } from "./oauth/authorize-url.js";
|
|
40
|
+
import { initiateOAuthLogin as _t, navigateToolsetOAuthPopup as vt, openToolsetOAuthPopup as yt } from "./oauth/popup.js";
|
|
41
|
+
import { ToolsetLoginOutcomeType as bt, useToolsetLogin as xt } from "./oauth/useToolsetLogin/useToolsetLogin.js";
|
|
42
|
+
import { useCatalogToolsetCredentials as St } from "./catalog/useCatalogToolsetCredentials/useCatalogToolsetCredentials.js";
|
|
43
|
+
import { FavoriteEntityType as Ct, useFavoriteEntitiesState as wt } from "./catalog/useFavoriteEntitiesState/useFavoriteEntitiesState.js";
|
|
44
|
+
import { usePublishFolders as Tt } from "./catalog/usePublishFolders/usePublishFolders.js";
|
|
45
|
+
import { buildAnnouncementSignature as Et, hasAnnouncementContent as Dt, hasStructuredAnnouncement as Ot, sanitizeAnnouncementHtml as kt, sanitizeAnnouncementMessageHtml as At } from "./conversation/announcement-message.js";
|
|
46
|
+
import { createChatStreamApi as jt } from "./conversation/create-chat-stream-api.js";
|
|
47
|
+
import { shouldWatchForDisplayNameUpdate as Mt } from "./conversation/display-name-watch.js";
|
|
48
|
+
import { formatAppVersion as Nt, sanitizeFooterHtml as Pt } from "./conversation/footer-message.js";
|
|
49
|
+
import { getModelIdFromConversationId as Ft } from "./conversation/get-model-id-from-conversation-id.js";
|
|
50
|
+
import { getTimeOfDayGreeting as It } from "./conversation/greeting.js";
|
|
51
|
+
import { createDeploymentChangedMessage as Lt } from "./conversation/message-factory.js";
|
|
52
|
+
import { getLastDeploymentId as Rt, getLastUserMessageToolConfiguration as zt, isMessageStreaming as Bt, messageHasStages as Vt, normalizeResponseFormat as Ht } from "./conversation/message-utils.js";
|
|
53
|
+
import { toOverlayMessages as Ut } from "./conversation/overlay-messages.js";
|
|
54
|
+
import { getQuickAppConversationStarters as Wt } from "./conversation/quick-app-conversation-starters.js";
|
|
55
|
+
import { getStarterPopulateText as Gt, getStartersFromSchema as Kt } from "./conversation/starter-option.js";
|
|
56
|
+
import { useOAuthCallbackCompletion as qt } from "./oauth/useOAuthCallbackCompletion/useOAuthCallbackCompletion.js";
|
|
57
|
+
import { buildPromptExportEnvelope as Jt, buildPromptExportFileName as Yt, serializePromptExport as Xt } from "./prompt/export-prompt.js";
|
|
58
|
+
import { PROMPT_CONTENT_MAX_LENGTH as Zt, PROMPT_COUNTER_ANNOUNCE_THRESHOLD as Qt, PROMPT_DESCRIPTION_MAX_LENGTH as $t, PROMPT_NAME_MAX_LENGTH as en, PromptFieldError as tn, buildPromptPath as nn, getRemainingCharacters as rn, validatePromptContent as an, validatePromptDescription as on, validatePromptName as sn } from "./prompt/prompt.js";
|
|
59
|
+
import { usePromptsState as cn } from "./prompt/usePromptsState/usePromptsState.js";
|
|
60
|
+
import { UnsupportedTriggerReason as ln } from "./scheduled-task/scheduled-task-mapping.js";
|
|
61
|
+
import { apSchedulerDayToJsDay as un, jsDayToApSchedulerDay as dn } from "./shared/cron-weekday.js";
|
|
62
|
+
import { mapFormValuesToCreateBody as fn, mapFormValuesToUpdateBody as pn, mapScheduledTaskDtoToFormValues as mn } from "./scheduled-task/scheduled-task-trigger.js";
|
|
63
|
+
import { validateSkillFileBatch as hn } from "./skill/skill-file-batch-validation.js";
|
|
64
|
+
import { skillFileToAttachment as gn } from "./skill/skill-file-preview.js";
|
|
65
|
+
import { SkillEditorLoadState as _n, useSkillEditorLoad as vn } from "./skill/useSkillEditorLoad.js";
|
|
66
|
+
import { useSkillEditorSubmit as yn } from "./skill/useSkillEditorSubmit.js";
|
|
67
|
+
import { useSkillFileActions as bn } from "./skill/useSkillFileActions.js";
|
|
68
|
+
import { SkillPreviewErrorKind as xn, useSkillFilePreview as Sn } from "./skill/useSkillFilePreview.js";
|
|
69
|
+
import { useSkillsState as Cn } from "./skill/useSkillsState/useSkillsState.js";
|
|
70
|
+
import { RecipientsCountStatus as wn, useShareRecipientsCount as Tn } from "./useShareRecipientsCount/useShareRecipientsCount.js";
|
|
71
|
+
import { deriveConversationRowActionState as En } from "./conversation/deriveConversationRowActionState/deriveConversationRowActionState.js";
|
|
72
|
+
import { useActiveConversationSync as Dn } from "./conversation/useActiveConversationSync/useActiveConversationSync.js";
|
|
73
|
+
import { useAsyncConfirmDialog as On } from "./conversation/useAsyncConfirmDialog/useAsyncConfirmDialog.js";
|
|
74
|
+
import { useConversationLookupMaps as kn } from "./conversation/useConversationLookupMaps/useConversationLookupMaps.js";
|
|
75
|
+
import { getConversationSource as An, useConversationPanelItems as jn } from "./conversation/useConversationPanelItems/useConversationPanelItems.js";
|
|
76
|
+
import { useImportFilePicker as Mn } from "./conversation/useImportFilePicker/useImportFilePicker.js";
|
|
77
|
+
import { useAttachmentUpload as Nn } from "./conversation/useAttachmentUpload/useAttachmentUpload.js";
|
|
78
|
+
import { AudioTranscriptionError as Pn, AudioTranscriptionErrorReason as Fn } from "./conversation/useTranscribeAudio/audio-transcription-error.js";
|
|
79
|
+
import { useTranscribeAudio as In } from "./conversation/useTranscribeAudio/useTranscribeAudio.js";
|
|
80
|
+
import { DEFAULT_MAX_ARCHIVE_BYTES as Ln, useConversationExport as Rn } from "./conversation/useConversationExport/useConversationExport.js";
|
|
81
|
+
import { attachmentToDto as zn, attachmentsToDtos as Bn } from "./conversation/useConversationHandlers/attachment-to-dto.js";
|
|
82
|
+
import { createMessagePair as Vn } from "./conversation/useConversationHandlers/message-factory.js";
|
|
83
|
+
import { hasActiveToolConfig as Hn, isMessageChanged as Un } from "./conversation/useConversationHandlers/message-utils.js";
|
|
84
|
+
import { getStarterConversationText as Wn, getStarterSubmitText as Gn } from "./conversation/useConversationHandlers/starter-option.js";
|
|
85
|
+
import { getConversationPath as Kn } from "./conversation/useConversationStream/conversation-path.js";
|
|
86
|
+
import { useConversationHandlers as qn } from "./conversation/useConversationHandlers/useConversationHandlers.js";
|
|
87
|
+
import { useConversationImport as Jn } from "./conversation/useConversationImport/useConversationImport.js";
|
|
88
|
+
import { useConversationScroll as Yn } from "./conversation/useConversationScroll/useConversationScroll.js";
|
|
89
|
+
import { isAwaitingGenerationResume as Xn } from "./conversation/useConversationStream/generation-resume.js";
|
|
90
|
+
import { useConversationStream as Zn } from "./conversation/useConversationStream/useConversationStream.js";
|
|
91
|
+
import { useConversationSources as Qn } from "./conversation-sources/useConversationSources/useConversationSources.js";
|
|
92
|
+
import { DialFilesApiUploadMode as $n } from "./files/dial-files-api.js";
|
|
93
|
+
import { FileManagerNotificationReason as er, FileNameValidationErrorReason as tr, FileOperationKind as nr } from "./files/dial-file-manager.types.js";
|
|
94
|
+
import { COLUMNS_WITHOUT_AUTHOR as rr, COLUMNS_WITH_AUTHOR as ir, CORE_PERMISSION_MAP as ar, DATE_OPTIONS as or, PATH_SEPARATOR_REGEXP as sr, RESERVED_MARKER_NAME as cr, UPLOAD_CONCURRENCY as lr } from "./files/dial-file-manager.model.js";
|
|
95
|
+
import { DialFileManagerActionProfile as ur, DialFileManagerVariant as dr, deriveActionProfile as fr } from "./files/file-manager-variant.js";
|
|
96
|
+
import { buildSharedItemVirtualPath as pr, dialCorePathToRelative as mr, findDialFileByPath as hr, findFolderByVirtualPath as gr, formatOperationFolderName as _r, getVirtualPathName as vr, hasDialFileWritePermission as yr, hasForbiddenNameSymbols as br, isCopyMoveDuplicateAllowed as xr, isShareActionsAllowed as Sr, normalizeVirtualPath as Cr, parseNewFolderVirtualPath as wr, resolveOwnerCoords as Tr } from "./files/dial-file-manager-path.util.js";
|
|
97
|
+
import { getParentFolderPath as Er, resolveDialFileApiPath as Dr, virtualPathToApiPath as Or } from "./files/resolve-dial-file-api-path.js";
|
|
98
|
+
import { prepareCopyItems as kr, prepareMoveRenameItems as Ar } from "./files/dial-file-manager-copy-move.util.js";
|
|
99
|
+
import { buildFromCache as jr, fetchByTab as Mr, fetchForSearch as Nr, findFirstSuccessfulCopyMoveItem as Pr, mapCorePermissions as Fr, mapFileMetadataToDialFile as Ir, mapSearchItem as Lr, mergeCreatedFolderIntoCache as Rr, updateEntry as zr } from "./files/dial-file-manager-mapping.util.js";
|
|
100
|
+
import { createFilesApiClient as Br } from "./files/create-files-api.js";
|
|
101
|
+
import { createUploadFileWithProgress as Vr } from "./files/create-upload-file-with-progress.js";
|
|
102
|
+
import { openAnnotationAttachment as Hr } from "./files/annotation.js";
|
|
103
|
+
import { annotationToPdfCanvasContent as Ur, clearAttachmentCache as Wr, hasAttachmentTextSource as Gr, referenceAttachmentToPdfCanvasContent as Kr, resolveCodeCanvasContent as qr, resolveHtmlCanvasContent as Jr, resolveImageCanvasContent as Yr, resolveJsonCanvasContent as Xr, resolveMarkdownCanvasContent as Zr, resolveOoxmlCanvasContent as Qr, resolvePdfCanvasContent as $r, resolveTextCanvasContent as ei, resolveVisualizerCanvasContent as ti } from "./files/attachment-canvas.js";
|
|
104
|
+
import { getUrlFileName as ni, isExternalSourcePreviewable as ri, resolveExternalSourceContentType as ii } from "./files/source-content.js";
|
|
105
|
+
import { annotationToDisplayAttachment as ai, attachmentDtoToDisplayAttachment as oi, attachmentDtosToDisplayAttachments as si } from "./files/attachment-dto-to-display.js";
|
|
106
|
+
import { dialFileToAttachment as ci, dialFilesToAttachments as li, dialFolderPathToAttachment as ui } from "./files/dial-file-to-attachment.js";
|
|
107
|
+
import { DownloadDestinationType as di } from "./files/download-destination.js";
|
|
108
|
+
import { prepareDownloadDestination as fi } from "./files/prepare-download-destination.js";
|
|
109
|
+
import { sanitizeFileName as pi, splitFileNameExtension as mi, trimFileNameToByteLimit as hi } from "./files/file-name.js";
|
|
110
|
+
import { useDialFileListing as gi } from "./files/useDialFileListing/useDialFileListing.js";
|
|
111
|
+
import { useDialFileMetadata as _i } from "./files/useDialFileMetadata/useDialFileMetadata.js";
|
|
112
|
+
import { useDialFileMutations as vi } from "./files/useDialFileMutations/useDialFileMutations.js";
|
|
113
|
+
import { useDialFileSharing as yi } from "./files/useDialFileSharing/useDialFileSharing.js";
|
|
114
|
+
import { useDialFileUploadBatch as bi } from "./files/useDialFileUploadBatch/useDialFileUploadBatch.js";
|
|
115
|
+
import { useDialFileManager as xi } from "./files/useDialFileManager/useDialFileManager.js";
|
|
116
|
+
import { useDialFileManagerTabConfig as Si } from "./files/useDialFileManagerTabConfig/useDialFileManagerTabConfig.js";
|
|
117
|
+
import { isCustomAppSchema as Ci, isQuickAppSchema as wi } from "./shared/application-schema.js";
|
|
118
|
+
import { getBrowserTimezone as Ti } from "./shared/browser-timezone.js";
|
|
119
|
+
import { isValidAbsoluteUrl as Ei, isValidFeaturesData as Di, parseFeaturesData as Oi } from "./shared/custom-apps.js";
|
|
120
|
+
import { buildExternalServiceScopeId as ki, getExternalServiceFallbackName as Ai, parseExternalServiceUrl as ji } from "./shared/external-services.js";
|
|
121
|
+
import { useChatSettingsFormConfig as Mi } from "./useChatSettingsFormConfig/useChatSettingsFormConfig.js";
|
|
122
|
+
import { usePageFileDrag as Ni } from "./usePageFileDrag/usePageFileDrag.js";
|
|
123
|
+
import { useViewportWidth as Pi } from "./useViewportWidth/useViewportWidth.js";
|
|
124
|
+
import { usePanelMaxWidth as Fi } from "./usePanelMaxWidth/usePanelMaxWidth.js";
|
|
125
|
+
import { useShareLink as Ii } from "./useShareLink/useShareLink.js";
|
|
126
|
+
import { useToolsMenu as Li } from "./useToolsMenu/useToolsMenu.js";
|
|
127
|
+
import { useUsageData as Ri } from "./usage/useUsageData/useUsageData.js";
|
|
128
|
+
import { McpAppResourceFetchError as zi, createMcpAppsApiClient as Bi } from "./mcp-apps/mcp-apps-api-client.js";
|
|
129
|
+
import { useMcpAppTools as Vi } from "./mcp-apps/useMcpAppTools/useMcpAppTools.js";
|
|
130
|
+
import { useMcpAppHostContext as Hi } from "./mcp-apps/useMcpAppHostContext/useMcpAppHostContext.js";
|
|
131
|
+
import { useMcpAppHostAdapter as Ui } from "./mcp-apps/useMcpAppHostAdapter/useMcpAppHostAdapter.js";
|
|
132
|
+
import { useOpenMcpAppCanvas as Wi } from "./mcp-apps/useOpenMcpAppCanvas/useOpenMcpAppCanvas.js";
|
|
133
|
+
import { useGridEditingScroll as Gi } from "@epam/ai-dial-chat-shared";
|
|
134
|
+
export { b as AttachmentValidationErrorReason, Pn as AudioTranscriptionError, Fn as AudioTranscriptionErrorReason, L as AuthenticationType, rr as COLUMNS_WITHOUT_AUTHOR, ir as COLUMNS_WITH_AUTHOR, ar as CORE_PERMISSION_MAP, Ye as CatalogPrimaryActionType, w as ConversationExportMode, T as ConversationTransferErrorCode, E as ConversationTransferWarningCode, or as DATE_OPTIONS, Ln as DEFAULT_MAX_ARCHIVE_BYTES, ur as DialFileManagerActionProfile, dr as DialFileManagerVariant, $n as DialFilesApiUploadMode, di as DownloadDestinationType, O as EXPORT_APP_NAME, D as ExportFileNameKind, Ct as FavoriteEntityType, er as FileManagerNotificationReason, tr as FileNameValidationErrorReason, nr as FileOperationKind, zi as McpAppResourceFetchError, Ie as McpResourceKind, et as OAuthResourceKind, sr as PATH_SEPARATOR_REGEXP, Zt as PROMPT_CONTENT_MAX_LENGTH, Qt as PROMPT_COUNTER_ANNOUNCE_THRESHOLD, $t as PROMPT_DESCRIPTION_MAX_LENGTH, en as PROMPT_NAME_MAX_LENGTH, Ce as PUBLIC_SKILL_BUCKET, tn as PromptFieldError, ie as PromptSource, cr as RESERVED_MARKER_NAME, wn as RecipientsCountStatus, le as SKILL_FILE_UPLOAD_MAX_BYTES, we as SKILL_LISTING_MAX_PAGES, Te as SKILL_LISTING_PAGE_SIZE, ue as SKILL_MANIFEST_FILE, Ee as SKILL_MANIFEST_MAX_BYTES, de as SKILL_UPLOAD_MAX_FILES, fe as SKILL_UPLOAD_MAX_TOTAL_BYTES, _n as SkillEditorLoadState, xn as SkillPreviewErrorKind, De as SkillSource, tt as TOOLSET_REDIRECT_STATE_KEY, nt as ToolsetAuthStatus, rt as ToolsetAuthTypes, it as ToolsetCredentialsLevel, bt as ToolsetLoginOutcomeType, at as ToolsetOAuthCallbackQuery, ot as ToolsetOAuthChannelControlType, st as ToolsetOAuthFailureReason, ct as ToolsetOAuthInitiationResultType, lt as ToolsetOAuthResultType, lr as UPLOAD_CONCURRENCY, ln as UnsupportedTriggerReason, ut as WithLogin, ai as annotationToDisplayAttachment, Ur as annotationToPdfCanvasContent, un as apSchedulerDayToJsDay, U as appendLocaleCode, oi as attachmentDtoToDisplayAttachment, si as attachmentDtosToDisplayAttachments, zn as attachmentToDto, Bn as attachmentsToDtos, W as buildAdditionalLocaleOptions, Et as buildAnnouncementSignature, Le as buildApplicationMcpUrl, M as buildChatCompletionsUrl, Re as buildConnectApi, N as buildDeploymentConnectApi, ki as buildExternalServiceScopeId, jr as buildFromCache, Jt as buildPromptExportEnvelope, Yt as buildPromptExportFileName, oe as buildPromptOverview, nn as buildPromptPath, P as buildResponsesUrl, pr as buildSharedItemVirtualPath, ke as buildSkillContentTree, pe as buildSkillFilesPayload, me as buildSkillManifest, he as buildSkillManifestForSubmit, ge as buildSkillManifestFromFrontmatter, Ae as buildSkillOverview, ht as buildToolsetAuthorizeUrl, ze as buildToolsetMcpUrl, Wr as clearAttachmentCache, G as composeLocalePayload, jt as createChatStreamApi, i as createCsrfMiddleware, Lt as createDeploymentChangedMessage, Br as createFilesApiClient, Bi as createMcpAppsApiClient, Vn as createMessagePair, A as createPublishApiClient, a as createUnauthorizedMiddleware, Vr as createUploadFileWithProgress, B as decodeToolsetId, K as decomposeLocalizedFields, fr as deriveActionProfile, We as deriveAvailableTabIds, En as deriveConversationRowActionState, Ge as deriveFavoriteItems, mr as dialCorePathToRelative, ci as dialFileToAttachment, li as dialFilesToAttachments, ui as dialFolderPathToAttachment, p as downloadAttachment, dt as emitToolsetLoginSuccess, F as encodeDeploymentId, V as encodeToolsetId, Mr as fetchByTab, Nr as fetchForSearch, Ke as filterCatalogItemsBySelector, qe as filterHiddenOwnedItems, I as findDeploymentByIdOrReference, hr as findDialFileByPath, Pr as findFirstSuccessfulCopyMoveItem, gr as findFolderByVirtualPath, Nt as formatAppVersion, Y as formatCalendarDate, S as formatDateYM, C as formatDateYMD, _r as formatOperationFolderName, k as formatQuotedNameList, e as getApiErrorDetails, t as getApiErrorMessage, n as getApiErrorStatus, Ti as getBrowserTimezone, Kn as getConversationPath, An as getConversationSource, Ai as getExternalServiceFallbackName, Rt as getLastDeploymentId, zt as getLastUserMessageToolConfiguration, Ft as getModelIdFromConversationId, Er as getParentFolderPath, Wt as getQuickAppConversationStarters, rn as getRemainingCharacters, Wn as getStarterConversationText, Gt as getStarterPopulateText, Gn as getStarterSubmitText, Kt as getStartersFromSchema, It as getTimeOfDayGreeting, pt as getToolsetOAuthChannelName, gt as getToolsetRedirectUri, ni as getUrlFileName, vr as getVirtualPathName, Hn as hasActiveToolConfig, Dt as hasAnnouncementContent, Gr as hasAttachmentTextSource, yr as hasDialFileWritePermission, br as hasForbiddenNameSymbols, Ot as hasStructuredAnnouncement, o as includesIgnoreCase, _t as initiateOAuthLogin, Xn as isAwaitingGenerationResume, r as isConversationNotFoundError, xr as isCopyMoveDuplicateAllowed, Ci as isCustomAppSchema, g as isDialFileAcceptType, u as isDialFileId, m as isDownloadableAttachment, ri as isExternalSourcePreviewable, Un as isMessageChanged, Bt as isMessageStreaming, se as isOrganisationPromptItem, H as isPublicToolsetId, wi as isQuickAppSchema, Sr as isShareActionsAllowed, Ei as isValidAbsoluteUrl, Di as isValidFeaturesData, _e as isValidSkillRelativePath, dn as jsDayToApSchedulerDay, Fr as mapCorePermissions, Z as mapDeploymentDetailsDtoToEntityDetails, R as mapDeploymentLimitsDtoToCatalogLimits, z as mapDeploymentLimitsToInput, ee as mapDeploymentToCatalogItem, te as mapDeploymentToolsetCredentials, Q as mapEntityDetailsToCatalogDetails, Ir as mapFileMetadataToDialFile, fn as mapFormValuesToCreateBody, pn as mapFormValuesToUpdateBody, ce as mapPromptToCatalogItem, Ve as mapPublishConversationResultDto, He as mapPublishHistoryEntryDto, mn as mapScheduledTaskDtoToFormValues, Lr as mapSearchItem, je as mapSkillToCatalogItem, $ as mapToolsetCredentials, ne as mapToolsetToCatalogItem, Rr as mergeCreatedFolderIntoCache, Vt as messageHasStages, _ as mimeTypesToAttachmentExtensionLabels, v as mimeTypesToDialFileAcceptTypes, y as mimeTypesToFileAccept, ve as nameFromPath, vt as navigateToolsetOAuthPopup, Ht as normalizeResponseFormat, ye as normalizeSkillName, Cr as normalizeVirtualPath, Hr as openAnnotationAttachment, yt as openToolsetOAuthPopup, X as padTwoDigits, ji as parseExternalServiceUrl, Oi as parseFeaturesData, wr as parseNewFolderVirtualPath, ae as parsePromptResourceUrl, be as parseSkillManifest, Qe as parseSkillManifestDocument, Oe as parseSkillResourceUrl, kr as prepareCopyItems, fi as prepareDownloadDestination, Ar as prepareMoveRenameItems, Me as readSkillFileBytes, Ne as readSkillManifest, Je as reconcileFilterTopics, Kr as referenceAttachmentToPdfCanvasContent, Xe as resolveCatalogPrimaryAction, qr as resolveCodeCanvasContent, re as resolveDeploymentFolder, Dr as resolveDialFileApiPath, d as resolveDialFileBucketAndPath, ii as resolveExternalSourceContentType, Jr as resolveHtmlCanvasContent, Yr as resolveImageCanvasContent, Xr as resolveJsonCanvasContent, q as resolveLocalizedText, Zr as resolveMarkdownCanvasContent, Be as resolveMcpResourceKind, Qr as resolveOoxmlCanvasContent, Tr as resolveOwnerCoords, $r as resolvePdfCanvasContent, f as resolveRelativeDialFilePath, Pe as resolveSkillFileDownloadPath, Fe as resolveSkillManifestFileId, ei as resolveTextCanvasContent, ti as resolveVisualizerCanvasContent, s as safeDecodeURI, c as safeDecodeURIComponent, kt as sanitizeAnnouncementHtml, At as sanitizeAnnouncementMessageHtml, pi as sanitizeFileName, Pt as sanitizeFooterHtml, Xt as serializePromptExport, Mt as shouldWatchForDisplayNameUpdate, xe as skillFileBytesToBlob, gn as skillFileToAttachment, mi as splitFileNameExtension, l as stripSurroundingSlashes, ft as subscribeToolsetLoginSuccess, J as toBaseLocale, Ut as toOverlayMessages, Ue as toPublishEntityType, j as toPublishRuleDto, hi as trimFileNameToByteLimit, Se as unpackSkillArchive, zr as updateEntry, Dn as useActiveConversationSync, On as useAsyncConfirmDialog, h as useAttachmentAction, Nn as useAttachmentUpload, x as useAttachmentValidation, Ze as useCatalogEditNavigation, $e as useCatalogItemDetails, St as useCatalogToolsetCredentials, Mi as useChatSettingsFormConfig, Rn as useConversationExport, qn as useConversationHandlers, Jn as useConversationImport, kn as useConversationLookupMaps, jn as useConversationPanelItems, Yn as useConversationScroll, Qn as useConversationSources, Zn as useConversationStream, gi as useDialFileListing, xi as useDialFileManager, Si as useDialFileManagerTabConfig, _i as useDialFileMetadata, vi as useDialFileMutations, yi as useDialFileSharing, bi as useDialFileUploadBatch, wt as useFavoriteEntitiesState, Gi as useGridEditingScroll, Mn as useImportFilePicker, Ui as useMcpAppHostAdapter, Hi as useMcpAppHostContext, Vi as useMcpAppTools, qt as useOAuthCallbackCompletion, Wi as useOpenMcpAppCanvas, Ni as usePageFileDrag, Fi as usePanelMaxWidth, cn as usePromptsState, Tt as usePublishFolders, Ii as useShareLink, Tn as useShareRecipientsCount, vn as useSkillEditorLoad, yn as useSkillEditorSubmit, bn as useSkillFileActions, Sn as useSkillFilePreview, Cn as useSkillsState, Li as useToolsMenu, xt as useToolsetLogin, In as useTranscribeAudio, Ri as useUsageData, Pi as useViewportWidth, an as validatePromptContent, on as validatePromptDescription, sn as validatePromptName, hn as validateSkillFileBatch, Or as virtualPathToApiPath, mt as waitForToolsetOAuthResult };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { safeDecodeURIComponent as e } from "../shared/string-utils.js";
|
|
2
|
+
import { ResponseError as t } from "@epam/ai-dial-chat-api-client";
|
|
3
|
+
//#region src/mcp-apps/mcp-apps-api-client.ts
|
|
4
|
+
var n = class extends Error {
|
|
5
|
+
status;
|
|
6
|
+
constructor(e) {
|
|
7
|
+
super(`Failed to fetch MCP app resource: HTTP ${e}`), this.status = e;
|
|
8
|
+
}
|
|
9
|
+
}, r = (r) => ({
|
|
10
|
+
fetchResourceHtml: async (i, a) => {
|
|
11
|
+
try {
|
|
12
|
+
let { raw: t } = await r.getToolsetMcpAppResourceRaw({
|
|
13
|
+
toolsetName: e(i),
|
|
14
|
+
resourceUri: a
|
|
15
|
+
});
|
|
16
|
+
return await t.text();
|
|
17
|
+
} catch (e) {
|
|
18
|
+
throw e instanceof t ? new n(e.response.status) : e;
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
callTool: async (t, n, i, a) => {
|
|
22
|
+
let { result: o } = await r.callToolsetMcpAppTool({
|
|
23
|
+
toolsetName: e(t),
|
|
24
|
+
mcpAppToolCallRequestDto: {
|
|
25
|
+
toolName: n,
|
|
26
|
+
arguments: i,
|
|
27
|
+
kind: a
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
return o;
|
|
31
|
+
},
|
|
32
|
+
listAppTools: async (t, n) => {
|
|
33
|
+
let { tools: i } = await r.listMcpAppTools({
|
|
34
|
+
deploymentId: e(t),
|
|
35
|
+
kind: n
|
|
36
|
+
});
|
|
37
|
+
return i;
|
|
38
|
+
},
|
|
39
|
+
listToolNames: async (t, n) => {
|
|
40
|
+
let { toolNames: i } = await r.listMcpToolNames({
|
|
41
|
+
deploymentId: e(t),
|
|
42
|
+
kind: n
|
|
43
|
+
});
|
|
44
|
+
return i;
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
//#endregion
|
|
48
|
+
export { n as McpAppResourceFetchError, r as createMcpAppsApiClient };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { getApiErrorMessage as e } from "../../api-error/api-error.js";
|
|
2
|
+
import { useMcpAppHostContext as t } from "../useMcpAppHostContext/useMcpAppHostContext.js";
|
|
3
|
+
import { useMemo as n } from "react";
|
|
4
|
+
//#region src/mcp-apps/useMcpAppHostAdapter/useMcpAppHostAdapter.ts
|
|
5
|
+
var r = (r, i, a, o) => {
|
|
6
|
+
let s = t(r, o), c = n(() => async (t, n, r, a) => {
|
|
7
|
+
try {
|
|
8
|
+
return await i.callTool(t, n, r, a);
|
|
9
|
+
} catch (t) {
|
|
10
|
+
throw Error(await e(t) ?? `Tool call "${n}" failed`);
|
|
11
|
+
}
|
|
12
|
+
}, [i]);
|
|
13
|
+
return n(() => ({
|
|
14
|
+
hostContext: s,
|
|
15
|
+
sandboxUrl: a,
|
|
16
|
+
fetchResourceHtml: i.fetchResourceHtml,
|
|
17
|
+
callTool: c
|
|
18
|
+
}), [
|
|
19
|
+
s,
|
|
20
|
+
a,
|
|
21
|
+
i.fetchResourceHtml,
|
|
22
|
+
c
|
|
23
|
+
]);
|
|
24
|
+
};
|
|
25
|
+
//#endregion
|
|
26
|
+
export { r as useMcpAppHostAdapter };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { useMemo as e } from "react";
|
|
2
|
+
//#region src/mcp-apps/useMcpAppHostContext/useMcpAppHostContext.ts
|
|
3
|
+
var t = /* @__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("."), n = () => {
|
|
4
|
+
let e = getComputedStyle(document.documentElement), n = {};
|
|
5
|
+
for (let r of t) {
|
|
6
|
+
let t = e.getPropertyValue(r).trim();
|
|
7
|
+
t && (n[r] = t);
|
|
8
|
+
}
|
|
9
|
+
return n;
|
|
10
|
+
}, r = (t, { theme: r, mcpAppTheme: i, locale: a, mcpAppUserAgent: o }) => e(() => ({
|
|
11
|
+
theme: i ?? r,
|
|
12
|
+
locale: a,
|
|
13
|
+
timeZone: Intl.DateTimeFormat().resolvedOptions().timeZone,
|
|
14
|
+
userAgent: o ?? "ai-dial-chat",
|
|
15
|
+
platform: "web",
|
|
16
|
+
displayMode: t,
|
|
17
|
+
styles: { variables: n() }
|
|
18
|
+
}), [
|
|
19
|
+
i,
|
|
20
|
+
r,
|
|
21
|
+
a,
|
|
22
|
+
o,
|
|
23
|
+
t
|
|
24
|
+
]);
|
|
25
|
+
//#endregion
|
|
26
|
+
export { r as useMcpAppHostContext };
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { useEffect as e, useMemo as t, useRef as n, useState as r } from "react";
|
|
2
|
+
import { collectToolCallNames as i } from "@epam/ai-dial-mcp-apps";
|
|
3
|
+
//#region src/mcp-apps/useMcpAppTools/useMcpAppTools.ts
|
|
4
|
+
var a = (a, o, s, c) => {
|
|
5
|
+
let [l, u] = r([]), [d, f] = r([]), p = n(/* @__PURE__ */ new Set());
|
|
6
|
+
e(() => {
|
|
7
|
+
if (p.current = /* @__PURE__ */ new Set(), f([]), o?.features?.mcp !== !0) {
|
|
8
|
+
u([]);
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
if (o.type !== "toolset" && o.type !== "application") {
|
|
12
|
+
u([]);
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
let e = o.id, t = o.type;
|
|
16
|
+
(async () => {
|
|
17
|
+
try {
|
|
18
|
+
u((await a.listAppTools(e, t)).map(({ resourceUri: n, toolName: r }) => ({
|
|
19
|
+
toolsetId: e,
|
|
20
|
+
resourceUri: n,
|
|
21
|
+
toolName: r,
|
|
22
|
+
mcpToolName: r,
|
|
23
|
+
kind: t,
|
|
24
|
+
discovery: "direct"
|
|
25
|
+
})));
|
|
26
|
+
} catch {
|
|
27
|
+
u([]);
|
|
28
|
+
}
|
|
29
|
+
})();
|
|
30
|
+
}, [
|
|
31
|
+
o?.id,
|
|
32
|
+
o?.type,
|
|
33
|
+
o?.features?.mcp,
|
|
34
|
+
a
|
|
35
|
+
]);
|
|
36
|
+
let m = t(() => i(s), [s]);
|
|
37
|
+
return e(() => {
|
|
38
|
+
if (m.size === 0) return;
|
|
39
|
+
let e = c.filter((e) => {
|
|
40
|
+
if (p.current.has(e.id)) return !1;
|
|
41
|
+
let t = `${e.displayName ?? e.id}_`;
|
|
42
|
+
return [...m].some((e) => e.startsWith(t));
|
|
43
|
+
});
|
|
44
|
+
if (e.length !== 0) {
|
|
45
|
+
for (let t of e) p.current.add(t.id);
|
|
46
|
+
(async () => {
|
|
47
|
+
let t = await Promise.all(e.map(async (e) => {
|
|
48
|
+
try {
|
|
49
|
+
return (await a.listAppTools(e.id, "toolset")).map(({ resourceUri: t, toolName: n }) => ({
|
|
50
|
+
toolsetId: e.id,
|
|
51
|
+
resourceUri: t,
|
|
52
|
+
toolName: `${e.displayName ?? e.id}_${n}`,
|
|
53
|
+
mcpToolName: n,
|
|
54
|
+
kind: "toolset",
|
|
55
|
+
discovery: "indirect"
|
|
56
|
+
}));
|
|
57
|
+
} catch {
|
|
58
|
+
return [];
|
|
59
|
+
}
|
|
60
|
+
}));
|
|
61
|
+
f((e) => [...e, ...t.flat()]);
|
|
62
|
+
})();
|
|
63
|
+
}
|
|
64
|
+
}, [
|
|
65
|
+
m,
|
|
66
|
+
c,
|
|
67
|
+
a
|
|
68
|
+
]), [...l, ...d];
|
|
69
|
+
};
|
|
70
|
+
//#endregion
|
|
71
|
+
export { a as useMcpAppTools };
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { McpAppResourceFetchError as e } from "../mcp-apps-api-client.js";
|
|
2
|
+
import { AttachmentContentType as t, AttachmentErrorType as n, useAttachmentCanvas as r } from "@epam/ai-dial-attachment-canvas";
|
|
3
|
+
import { useCallback as i, useEffect as a, useRef as o } from "react";
|
|
4
|
+
import { computeMcpAppSeedKey as s, resolveMcpAppToolResult as c } from "@epam/ai-dial-mcp-apps";
|
|
5
|
+
//#region src/mcp-apps/useOpenMcpAppCanvas/useOpenMcpAppCanvas.ts
|
|
6
|
+
var l = (l, u, d, f) => {
|
|
7
|
+
let { openCanvas: p, openCanvasLoading: m } = r(), { hostContext: h, sandboxUrl: g, fetchResourceHtml: _, callTool: v } = u, y = o(null), b = i(async (r, i, a, o = !1) => {
|
|
8
|
+
if (g == null) return !1;
|
|
9
|
+
f?.(), m(d.title, i);
|
|
10
|
+
try {
|
|
11
|
+
let e = s(a), n = async () => {
|
|
12
|
+
let [e, t] = await Promise.all([_(r.toolsetId, r.resourceUri), c(r, a, v)]);
|
|
13
|
+
return {
|
|
14
|
+
html: e,
|
|
15
|
+
toolResult: t
|
|
16
|
+
};
|
|
17
|
+
}, u, f;
|
|
18
|
+
return i != null && !o ? {html: u, toolResult: f} = await l.getOrFetch(i, e, n) : ({html: u, toolResult: f} = await n(), i != null && l.set(i, {
|
|
19
|
+
html: u,
|
|
20
|
+
toolResult: f
|
|
21
|
+
}, e)), p({
|
|
22
|
+
type: t.McpApp,
|
|
23
|
+
html: u,
|
|
24
|
+
sandboxUrl: g,
|
|
25
|
+
toolName: r.mcpToolName,
|
|
26
|
+
toolInput: a?.toolInput,
|
|
27
|
+
toolResult: f,
|
|
28
|
+
hostContext: h,
|
|
29
|
+
onToolCall: (e, t) => v(r.toolsetId, e, t, r.kind),
|
|
30
|
+
onReload: () => {
|
|
31
|
+
i != null && l.invalidate(i), y.current?.(r, i, a, !0);
|
|
32
|
+
}
|
|
33
|
+
}, d.title, i), !0;
|
|
34
|
+
} catch (r) {
|
|
35
|
+
let a = r instanceof e && r.status === 403;
|
|
36
|
+
return p({
|
|
37
|
+
type: t.Error,
|
|
38
|
+
errorType: a ? n.Forbidden : n.LoadFailed,
|
|
39
|
+
label: a ? d.forbiddenErrorLabel : d.loadErrorLabel
|
|
40
|
+
}, d.title, i), !1;
|
|
41
|
+
}
|
|
42
|
+
}, [
|
|
43
|
+
p,
|
|
44
|
+
m,
|
|
45
|
+
f,
|
|
46
|
+
g,
|
|
47
|
+
h,
|
|
48
|
+
_,
|
|
49
|
+
v,
|
|
50
|
+
l,
|
|
51
|
+
d
|
|
52
|
+
]);
|
|
53
|
+
return a(() => {
|
|
54
|
+
y.current = b;
|
|
55
|
+
}, [b]), { openMcpAppCanvas: b };
|
|
56
|
+
};
|
|
57
|
+
//#endregion
|
|
58
|
+
export { l as useOpenMcpAppCanvas };
|
package/mcp-apps.js
CHANGED
|
@@ -1,2 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { McpAppResourceFetchError as e, createMcpAppsApiClient as t } from "./mcp-apps/mcp-apps-api-client.js";
|
|
2
|
+
import { useMcpAppTools as n } from "./mcp-apps/useMcpAppTools/useMcpAppTools.js";
|
|
3
|
+
import { useMcpAppHostContext as r } from "./mcp-apps/useMcpAppHostContext/useMcpAppHostContext.js";
|
|
4
|
+
import { useMcpAppHostAdapter as i } from "./mcp-apps/useMcpAppHostAdapter/useMcpAppHostAdapter.js";
|
|
5
|
+
import { useOpenMcpAppCanvas as a } from "./mcp-apps/useOpenMcpAppCanvas/useOpenMcpAppCanvas.js";
|
|
6
|
+
export { e as McpAppResourceFetchError, t as createMcpAppsApiClient, i as useMcpAppHostAdapter, r as useMcpAppHostContext, n as useMcpAppTools, a as useOpenMcpAppCanvas };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
//#region src/oauth/authorize-url.ts
|
|
2
|
+
var e = (e) => `${window.location.origin}${e}`, t = (e) => e === "localhost" || e === "[::1]" || /^127(?:\.\d{1,3}){3}$/.test(e), n = (e) => e.protocol === "https:" ? !0 : e.protocol === "http:" && t(e.hostname), r = (e, t, r) => {
|
|
3
|
+
if (!e.authorizationEndpoint?.trim() || !e.clientId?.trim()) return null;
|
|
4
|
+
try {
|
|
5
|
+
let i = new URL(e.authorizationEndpoint.trim());
|
|
6
|
+
return n(i) ? (i.searchParams.set("response_type", "code"), i.searchParams.set("client_id", e.clientId.trim()), i.searchParams.set("redirect_uri", t), e.codeChallenge && i.searchParams.set("code_challenge", e.codeChallenge), e.codeChallengeMethod && i.searchParams.set("code_challenge_method", e.codeChallengeMethod), i.searchParams.set("state", r), e.scopes && e.scopes.length > 0 && i.searchParams.set("scope", e.scopes.join(" ")), i.toString()) : null;
|
|
7
|
+
} catch {
|
|
8
|
+
return null;
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
//#endregion
|
|
12
|
+
export { r as buildToolsetAuthorizeUrl, e as getToolsetRedirectUri };
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { ToolsetOAuthCallbackQuery as e, ToolsetOAuthChannelControlType as t, ToolsetOAuthFailureReason as n, ToolsetOAuthResultType as r } from "./types.js";
|
|
2
|
+
//#region src/oauth/handshake.ts
|
|
3
|
+
var i = "toolset-oauth-", a = (e) => `${i}${e}`, o = 300 * 1e3, s = 500, c = (e) => {
|
|
4
|
+
switch (e) {
|
|
5
|
+
case n.MissingCode:
|
|
6
|
+
case n.MissingRedirectState:
|
|
7
|
+
case n.StateMismatch:
|
|
8
|
+
case n.LoginRequestFailed: return e;
|
|
9
|
+
default: return n.LoginRequestFailed;
|
|
10
|
+
}
|
|
11
|
+
}, l = (e) => typeof e == "object" && !!e && "type" in e && (e.type === r.Success || e.type === r.Failure), u = (n, i, { toolsetId: u, credentialsLevel: d, callbackPath: f, timeoutMs: p = o, pollIntervalMs: m = s }) => new Promise((o) => {
|
|
12
|
+
let s, h = !1, g = () => {
|
|
13
|
+
let e = s;
|
|
14
|
+
s = void 0, e != null && setTimeout(() => e.close(), 0);
|
|
15
|
+
}, _ = (e) => {
|
|
16
|
+
h || (h = !0, clearInterval(x), clearTimeout(S), window.removeEventListener("focus", b), g(), o(e));
|
|
17
|
+
}, v = (e) => {
|
|
18
|
+
s?.postMessage({ type: t.ResultAcknowledged });
|
|
19
|
+
try {
|
|
20
|
+
n.close();
|
|
21
|
+
} catch {}
|
|
22
|
+
_(e);
|
|
23
|
+
}, y = () => {
|
|
24
|
+
try {
|
|
25
|
+
let t = new URL(n.location.href);
|
|
26
|
+
if (t.origin !== window.location.origin || t.pathname !== f) return null;
|
|
27
|
+
let i = t.searchParams.get(e.Result);
|
|
28
|
+
if (i === r.Success) return {
|
|
29
|
+
type: r.Success,
|
|
30
|
+
toolsetId: u,
|
|
31
|
+
credentialsLevel: d
|
|
32
|
+
};
|
|
33
|
+
if (i === r.Failure) return {
|
|
34
|
+
type: r.Failure,
|
|
35
|
+
reason: c(t.searchParams.get(e.FailureReason))
|
|
36
|
+
};
|
|
37
|
+
} catch {}
|
|
38
|
+
return null;
|
|
39
|
+
}, b = () => {
|
|
40
|
+
let e = y();
|
|
41
|
+
if (e != null) {
|
|
42
|
+
v(e);
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
n.closed && _({ type: r.Cancelled });
|
|
46
|
+
};
|
|
47
|
+
try {
|
|
48
|
+
s = new BroadcastChannel(a(i)), s.onmessage = (e) => {
|
|
49
|
+
l(e.data) && v(e.data);
|
|
50
|
+
};
|
|
51
|
+
} catch {}
|
|
52
|
+
window.addEventListener("focus", b);
|
|
53
|
+
let x = setInterval(() => {
|
|
54
|
+
let e = y();
|
|
55
|
+
if (e != null) {
|
|
56
|
+
v(e);
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
}, m), S = setTimeout(() => {
|
|
60
|
+
n.close(), _({ type: r.Cancelled });
|
|
61
|
+
}, p), C = y();
|
|
62
|
+
C != null && v(C);
|
|
63
|
+
});
|
|
64
|
+
//#endregion
|
|
65
|
+
export { a as getToolsetOAuthChannelName, u as waitForToolsetOAuthResult };
|
package/oauth/popup.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { OAuthResourceKind as e, TOOLSET_REDIRECT_STATE_KEY as t, ToolsetCredentialsLevel as n, ToolsetOAuthInitiationResultType as r } from "./types.js";
|
|
2
|
+
import { buildToolsetAuthorizeUrl as i, getToolsetRedirectUri as a } from "./authorize-url.js";
|
|
3
|
+
import { generateUUID as o } from "@epam/ai-dial-chat-shared";
|
|
4
|
+
//#region src/oauth/popup.ts
|
|
5
|
+
var s = (n, i, a, o, s, c, l = e.Toolset, u) => {
|
|
6
|
+
let d = {
|
|
7
|
+
toolsetId: o,
|
|
8
|
+
credentialsLevel: s,
|
|
9
|
+
redirectUri: c,
|
|
10
|
+
state: a,
|
|
11
|
+
resourceKind: l,
|
|
12
|
+
offlineUsageConsent: u
|
|
13
|
+
};
|
|
14
|
+
return n.sessionStorage.setItem(t, JSON.stringify(d)), n.opener = null, n.location.href = i, {
|
|
15
|
+
type: r.Started,
|
|
16
|
+
popup: n,
|
|
17
|
+
flowId: a
|
|
18
|
+
};
|
|
19
|
+
}, c = () => window.open("", "_blank"), l = (t, c, l, u, d = n.User, f = e.Toolset, p) => {
|
|
20
|
+
let m = a(u), h = o(), g = i(c, m, h);
|
|
21
|
+
return g ? s(t, g, h, l, d, m, f, p) : (t.close(), { type: r.InvalidConfig });
|
|
22
|
+
}, u = (t, l, u, d = n.User, f) => {
|
|
23
|
+
let p = a(u), m = o(), h = i(t, p, m);
|
|
24
|
+
if (!h) return { type: r.InvalidConfig };
|
|
25
|
+
let g = c();
|
|
26
|
+
return g ? s(g, h, m, l, d, p, e.Toolset, f) : { type: r.Blocked };
|
|
27
|
+
};
|
|
28
|
+
//#endregion
|
|
29
|
+
export { u as initiateOAuthLogin, l as navigateToolsetOAuthPopup, c as openToolsetOAuthPopup };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
//#region src/oauth/toolset-id.ts
|
|
2
|
+
var e = "toolsets/", t = "public", n = (e) => e.split("/").map((e) => encodeURIComponent(e)).join("/"), r = (e) => e.split("/").map((e) => {
|
|
3
|
+
try {
|
|
4
|
+
return decodeURIComponent(e);
|
|
5
|
+
} catch {
|
|
6
|
+
return e;
|
|
7
|
+
}
|
|
8
|
+
}).join("/"), i = (n) => n.startsWith(e) ? n.slice(9).split("/")[0] === t : !1;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { r as decodeToolsetId, n as encodeToolsetId, i as isPublicToolsetId };
|
package/oauth/types.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
//#region src/oauth/types.ts
|
|
2
|
+
var e = /* @__PURE__ */ function(e) {
|
|
3
|
+
return e.None = "NONE", e.ApiKey = "API_KEY", e.OAuth = "OAUTH", e;
|
|
4
|
+
}({}), t = /* @__PURE__ */ function(e) {
|
|
5
|
+
return e.SignedIn = "SIGNED_IN", e.SignedOut = "SIGNED_OUT", e.Failed = "FAILED", e;
|
|
6
|
+
}({}), n = /* @__PURE__ */ function(e) {
|
|
7
|
+
return e.Global = "GLOBAL", e.User = "USER", e.App = "APP", e;
|
|
8
|
+
}({}), r = /* @__PURE__ */ function(e) {
|
|
9
|
+
return e.WithLogin = "with-login", e.WithoutLogin = "without-login", e.WithConfig = "with-config", e;
|
|
10
|
+
}({}), i = /* @__PURE__ */ function(e) {
|
|
11
|
+
return e.Toolset = "toolset", e.ExternalService = "external-service", e.OfflineCredentials = "offline-credentials", e;
|
|
12
|
+
}({}), a = /* @__PURE__ */ function(e) {
|
|
13
|
+
return e.Started = "started", e.Blocked = "blocked", e.InvalidConfig = "invalid-config", e;
|
|
14
|
+
}({}), o = /* @__PURE__ */ function(e) {
|
|
15
|
+
return e.Success = "success", e.Failure = "failure", e.Cancelled = "cancelled", e;
|
|
16
|
+
}({}), s = /* @__PURE__ */ function(e) {
|
|
17
|
+
return e.MissingCode = "missing-code", e.MissingRedirectState = "missing-redirect-state", e.StateMismatch = "state-mismatch", e.LoginRequestFailed = "login-request-failed", e;
|
|
18
|
+
}({}), c = /* @__PURE__ */ function(e) {
|
|
19
|
+
return e.ResultAcknowledged = "result-acknowledged", e;
|
|
20
|
+
}({}), l = /* @__PURE__ */ function(e) {
|
|
21
|
+
return e.Result = "toolsetOAuthResult", e.FailureReason = "toolsetOAuthFailureReason", e;
|
|
22
|
+
}({}), u = "toolset-redirect-state";
|
|
23
|
+
//#endregion
|
|
24
|
+
export { i as OAuthResourceKind, u as TOOLSET_REDIRECT_STATE_KEY, t as ToolsetAuthStatus, e as ToolsetAuthTypes, n as ToolsetCredentialsLevel, l as ToolsetOAuthCallbackQuery, c as ToolsetOAuthChannelControlType, s as ToolsetOAuthFailureReason, a as ToolsetOAuthInitiationResultType, o as ToolsetOAuthResultType, r as WithLogin };
|