@epam/ai-dial-chat-hooks 1.1.0-dev.422 → 1.1.0-dev.426

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.
Files changed (178) hide show
  1. package/{api-error-DuLNy43N.js → api-error/api-error.js} +1 -1
  2. package/api-transport/create-csrf-middleware.js +21 -0
  3. package/api-transport/create-unauthorized-middleware.js +41 -0
  4. package/attachment/useAttachmentAction/useAttachmentAction.js +74 -0
  5. package/attachment/useAttachmentValidation/useAttachmentValidation.js +35 -0
  6. package/attachments.js +3 -2
  7. package/catalog/catalog-derivations.js +10 -0
  8. package/catalog/catalog-primary-action.js +21 -0
  9. package/catalog/create-publish-api.js +27 -0
  10. package/catalog/deployment-endpoint-url.js +34 -0
  11. package/{deployment-id-CxWgJTs9.js → catalog/deployment-id.js} +1 -1
  12. package/catalog/entity-details.js +6 -0
  13. package/catalog/map-deployment-limits-to-catalog.js +73 -0
  14. package/catalog/map-deployment-limits-to-input.js +14 -0
  15. package/catalog/map-deployment-to-catalog-item.js +92 -0
  16. package/catalog/map-entity-details-to-catalog.js +350 -0
  17. package/catalog/map-prompt-to-catalog-item.js +49 -0
  18. package/catalog/map-skill-to-catalog-item.js +123 -0
  19. package/catalog/mcp-endpoint-url.js +26 -0
  20. package/catalog/publish.js +18 -0
  21. package/catalog/useCatalogEditNavigation/useCatalogEditNavigation.js +109 -0
  22. package/catalog/useCatalogItemDetails.js +101 -0
  23. package/catalog/useCatalogToolsetCredentials/useCatalogToolsetCredentials.js +146 -0
  24. package/catalog/useFavoriteEntitiesState/useFavoriteEntitiesState.js +50 -0
  25. package/catalog/usePublishFolders/usePublishFolders.js +72 -0
  26. package/catalog.js +22 -3
  27. package/conversation/announcement-message.js +42 -0
  28. package/conversation/conversation-transfer/async.js +18 -0
  29. package/conversation/conversation-transfer/attachment-refs.js +11 -0
  30. package/conversation/conversation-transfer/build-upload-path.js +27 -0
  31. package/{date-BeuD8G79.js → conversation/conversation-transfer/date.js} +1 -1
  32. package/conversation/conversation-transfer/dial-file-resolve.js +18 -0
  33. package/conversation/conversation-transfer/export-conversation.js +32 -0
  34. package/conversation/conversation-transfer/import-conversation.js +93 -0
  35. package/conversation/conversation-transfer/progress.js +39 -0
  36. package/conversation/conversation-transfer/queue.js +84 -0
  37. package/conversation/conversation-transfer/types.js +9 -0
  38. package/conversation/conversation-transfer/zip-export.js +19 -0
  39. package/conversation/conversation-transfer/zip-import.js +29 -0
  40. package/conversation/create-chat-stream-api.js +96 -0
  41. package/conversation/deriveConversationRowActionState/deriveConversationRowActionState.js +14 -0
  42. package/conversation/display-name-watch.js +5 -0
  43. package/conversation/footer-message.js +23 -0
  44. package/conversation/get-model-id-from-conversation-id.js +14 -0
  45. package/conversation/greeting.js +7 -0
  46. package/conversation/message-factory.js +19 -0
  47. package/conversation/message-utils.js +13 -0
  48. package/conversation/overlay-messages.js +8 -0
  49. package/conversation/quick-app-conversation-starters.js +29 -0
  50. package/conversation/starter-option.js +27 -0
  51. package/conversation/useActiveConversationSync/useActiveConversationSync.js +19 -0
  52. package/conversation/useAsyncConfirmDialog/useAsyncConfirmDialog.js +39 -0
  53. package/conversation/useAttachmentUpload/useAttachmentUpload.js +33 -0
  54. package/conversation/useConversationExport/useConversationExport.js +285 -0
  55. package/conversation/useConversationHandlers/attachment-to-dto.js +13 -0
  56. package/conversation/useConversationHandlers/message-factory.js +21 -0
  57. package/conversation/useConversationHandlers/message-utils.js +8 -0
  58. package/conversation/useConversationHandlers/starter-option.js +11 -0
  59. package/conversation/useConversationHandlers/useConversationHandlers.js +263 -0
  60. package/conversation/useConversationImport/useConversationImport.js +239 -0
  61. package/conversation/useConversationLookupMaps/useConversationLookupMaps.js +11 -0
  62. package/conversation/useConversationPanelItems/useConversationPanelItems.js +35 -0
  63. package/{useConversationScroll-CliIMnjP.js → conversation/useConversationScroll/useConversationScroll.js} +1 -1
  64. package/conversation/useConversationStream/apply-chunk.js +78 -0
  65. package/conversation/useConversationStream/buffered-generation.js +18 -0
  66. package/conversation/useConversationStream/conversation-path.js +8 -0
  67. package/conversation/useConversationStream/generation-resume.js +126 -0
  68. package/conversation/useConversationStream/useConversationStream.js +148 -0
  69. package/conversation/useImportFilePicker/useImportFilePicker.js +20 -0
  70. package/conversation/useTranscribeAudio/audio-transcription-error.js +12 -0
  71. package/conversation/useTranscribeAudio/transcription-retry.js +38 -0
  72. package/conversation/useTranscribeAudio/useTranscribeAudio.js +41 -0
  73. package/{useConversationSources-DKaKvjXZ.js → conversation-sources/useConversationSources/useConversationSources.js} +1 -1
  74. package/conversation-sources.js +1 -1
  75. package/conversation-transfer.js +7 -3
  76. package/conversation.d.ts +66 -0
  77. package/conversation.js +31 -2
  78. package/file-manager.d.ts +3 -4
  79. package/file-manager.js +28 -3
  80. package/files/annotation.js +15 -0
  81. package/files/attachment-canvas.js +218 -0
  82. package/files/attachment-dto-to-display.js +15 -0
  83. package/files/attachment-types.js +16 -0
  84. package/files/create-files-api.js +40 -0
  85. package/files/create-upload-file-with-progress.js +42 -0
  86. package/files/dial-file-manager-copy-move.util.js +55 -0
  87. package/files/dial-file-manager-mapping.util.js +140 -0
  88. package/files/dial-file-manager-path.util.js +72 -0
  89. package/files/dial-file-manager.model.js +25 -0
  90. package/files/dial-file-manager.types.js +10 -0
  91. package/files/dial-file-to-attachment.js +37 -0
  92. package/files/dial-file.js +30 -0
  93. package/files/dial-files-api.js +6 -0
  94. package/files/download-destination.js +6 -0
  95. package/files/file-manager-variant.js +11 -0
  96. package/files/file-name.js +19 -0
  97. package/files/prepare-download-destination.js +24 -0
  98. package/files/resolve-dial-file-api-path.js +33 -0
  99. package/files/source-content.js +37 -0
  100. package/files/useDialFileListing/useDialFileListing.js +295 -0
  101. package/files/useDialFileManager/useDialFileManager.js +146 -0
  102. package/files/useDialFileManagerTabConfig/useDialFileManagerTabConfig.js +23 -0
  103. package/files/useDialFileMetadata/useDialFileMetadata.js +42 -0
  104. package/files/useDialFileMutations/useDialFileMutations.js +359 -0
  105. package/files/useDialFileSharing/useDialFileSharing.js +70 -0
  106. package/files/useDialFileUploadBatch/useDialFileUploadBatch.js +156 -0
  107. package/index.d.ts +69 -4
  108. package/index.js +134 -28
  109. package/mcp-apps/mcp-apps-api-client.js +48 -0
  110. package/mcp-apps/useMcpAppHostAdapter/useMcpAppHostAdapter.js +26 -0
  111. package/mcp-apps/useMcpAppHostContext/useMcpAppHostContext.js +26 -0
  112. package/mcp-apps/useMcpAppTools/useMcpAppTools.js +71 -0
  113. package/mcp-apps/useOpenMcpAppCanvas/useOpenMcpAppCanvas.js +58 -0
  114. package/mcp-apps.js +6 -2
  115. package/oauth/authorize-url.js +12 -0
  116. package/oauth/handshake.js +65 -0
  117. package/oauth/popup.js +29 -0
  118. package/oauth/toolset-id.js +10 -0
  119. package/oauth/types.js +24 -0
  120. package/oauth/useOAuthCallbackCompletion/useOAuthCallbackCompletion.js +94 -0
  121. package/oauth/useToolsetLogin/useToolsetLogin.js +73 -0
  122. package/oauth.js +9 -3
  123. package/package.json +35 -23
  124. package/prompt/export-prompt.js +28 -0
  125. package/prompt/prompt-resource.js +15 -0
  126. package/prompt/prompt.js +12 -0
  127. package/prompt/usePromptsState/usePromptsState.js +42 -0
  128. package/scheduled-task/scheduled-task-mapping.js +6 -0
  129. package/{scheduled-task-trigger-D9RZCk52.js → scheduled-task/scheduled-task-trigger.js} +39 -40
  130. package/scheduled-tasks.js +3 -2
  131. package/scroll-anchoring.js +1 -1
  132. package/shared/application-schema.js +4 -0
  133. package/shared/browser-timezone.js +10 -0
  134. package/{cron-weekday-B4w29eAC.js → shared/cron-weekday.js} +1 -1
  135. package/shared/custom-apps.js +30 -0
  136. package/shared/external-services.js +18 -0
  137. package/{formatting-CZyyxBG3.js → shared/formatting.js} +1 -1
  138. package/{prompt-resource-Bt1I-8ri.js → shared/locale.js} +2 -13
  139. package/{string-utils-iBi2Y55C.js → shared/string-utils.js} +1 -1
  140. package/shared/toolset-login-events.js +13 -0
  141. package/sharing.js +3 -3
  142. package/skill/skill-file-batch-validation.js +48 -0
  143. package/skill/skill-file-preview.js +15 -0
  144. package/skill/skill-manifest.js +70 -0
  145. package/skill/skill-types.js +15 -0
  146. package/skill/skill.js +48 -0
  147. package/skill/useSkillEditorLoad.js +103 -0
  148. package/skill/useSkillEditorSubmit.js +135 -0
  149. package/skill/useSkillFileActions.js +99 -0
  150. package/skill/useSkillFilePreview.js +29 -0
  151. package/{useSkillsState-BoLlwmzb.js → skill/useSkillsState/useSkillsState.js} +1 -1
  152. package/skill-editor.js +8 -3
  153. package/skills-state.js +1 -1
  154. package/source-content.d.ts +29 -0
  155. package/source-content.js +2 -0
  156. package/usage/useUsageData/useUsageData.js +32 -0
  157. package/useChatSettingsFormConfig/useChatSettingsFormConfig.js +74 -0
  158. package/{usePanelMaxWidth-BEZYuqF9.js → usePageFileDrag/usePageFileDrag.js} +1 -11
  159. package/usePanelMaxWidth/usePanelMaxWidth.js +8 -0
  160. package/{useShareLink-xkiaxATt.js → useShareLink/useShareLink.js} +1 -1
  161. package/{useShareRecipientsCount-BgwCLKY0.js → useShareRecipientsCount/useShareRecipientsCount.js} +1 -1
  162. package/useToolsMenu/useToolsMenu.js +50 -0
  163. package/useViewportWidth/useViewportWidth.js +12 -0
  164. package/utils.js +17 -7
  165. package/viewport-layout.js +4 -2
  166. package/attachment-types-AAoN9E95.js +0 -7760
  167. package/browser-Btsa0Lmr.js +0 -607
  168. package/skill-manifest-CeG6-WSK.js +0 -4056
  169. package/useAttachmentValidation-CkMTd5lA.js +0 -102
  170. package/useConversationImport-CDRs7JF1.js +0 -826
  171. package/useDialFileManagerTabConfig-CjI46lMo.js +0 -2291
  172. package/useOAuthCallbackCompletion-CvyTKLER.js +0 -93
  173. package/useOpenMcpAppCanvas-C7-AMseH.js +0 -207
  174. package/useSkillFileActions-B-VaGD20.js +0 -373
  175. package/useSkillFilePreview-B5o1n_0F.js +0 -1244
  176. package/useToolsMenu-zURpMEn1.js +0 -1882
  177. package/useToolsetLogin-B05m134e.js +0 -195
  178. package/useUsageData-D7BxloKZ.js +0 -201
@@ -0,0 +1,350 @@
1
+ import { AuthenticationType as e } from "./entity-details.js";
2
+ import { isPublicToolsetId as t } from "../oauth/toolset-id.js";
3
+ import { formatCalendarDate as n } from "../shared/formatting.js";
4
+ import { formatUnitPrice as r } from "@epam/ai-dial-chat-shared";
5
+ import { mimeTypesToExtensionLabels as i } from "@epam/ai-dial-attachment-input";
6
+ import { CredentialStatus as a, ToolsetAuthenticationType as o } from "@epam/ai-dial-catalog";
7
+ //#region src/catalog/map-entity-details-to-catalog.ts
8
+ var s = (e) => e >= 1e6 ? `${e / 1e6}M tokens` : e >= 1e3 ? `${e / 1e3}K tokens` : `${e} tokens`, c = (e) => {
9
+ let t = /^(\d{4})-(\d{2})-(\d{2})$/.exec(e);
10
+ if (t == null) return e;
11
+ let [, r, i, a] = t, o = Number(r), s = Number(i) - 1, c = Number(a), l = new Date(o, s, c);
12
+ return l.getFullYear() !== o || l.getMonth() !== s || l.getDate() !== c ? e : n(l.getTime());
13
+ }, l = "unit", u = (e) => {
14
+ let t = [];
15
+ if (e.capabilities != null) {
16
+ let { capabilities: n } = e, r = [];
17
+ n.hasTools != null && r.push({
18
+ label: "Tools",
19
+ value: n.hasTools
20
+ }), n.hasParallelToolCalls != null && r.push({
21
+ label: "Parallel tool calls",
22
+ value: n.hasParallelToolCalls
23
+ }), n.reasoningEfforts?.length && r.push({
24
+ label: "Reasoning efforts",
25
+ value: n.reasoningEfforts.join(" · ")
26
+ }), r.length > 0 && t.push({
27
+ title: "Capabilities",
28
+ specs: r
29
+ });
30
+ }
31
+ if (e.specification != null) {
32
+ let { specification: r } = e, a = [];
33
+ r.provider != null && a.push({
34
+ label: "Provider",
35
+ value: r.provider
36
+ }), r.vendor != null && a.push({
37
+ label: "Vendor",
38
+ value: r.vendor
39
+ }), r.license != null && a.push({
40
+ label: "License",
41
+ value: r.license
42
+ }), r.knowledgeCutoffDate != null && a.push({
43
+ label: "Knowledge cutoff date",
44
+ value: c(r.knowledgeCutoffDate)
45
+ }), r.parameters != null && a.push({
46
+ label: "Parameters",
47
+ value: r.parameters
48
+ }), r.hostedBy != null && a.push({
49
+ label: "Hosted by",
50
+ value: r.hostedBy
51
+ }), r.createdAt != null && a.push({
52
+ label: "Release date",
53
+ value: n(r.createdAt)
54
+ }), r.contextWindowTokens != null && a.push({
55
+ label: "Context window",
56
+ value: s(r.contextWindowTokens)
57
+ }), r.maxOutputTokens != null && a.push({
58
+ label: "Max output tokens",
59
+ value: s(r.maxOutputTokens)
60
+ }), r.inputTypes?.length && a.push({
61
+ label: "Input modalities",
62
+ value: i(r.inputTypes)
63
+ }), a.length > 0 && t.push({
64
+ title: "Specification",
65
+ specs: a
66
+ });
67
+ }
68
+ let r = h(e.pricing), a = g(e);
69
+ return {
70
+ overview: t.length > 0 ? { sections: t } : void 0,
71
+ pricing: r,
72
+ api: a
73
+ };
74
+ }, d = {
75
+ prompt: "Input tokens",
76
+ completion: "Output tokens",
77
+ cache_read: "Cached input",
78
+ cacheRead: "Cached input",
79
+ cache_write: "Cached write",
80
+ cacheWrite: "Cached write"
81
+ }, f = [
82
+ "prompt",
83
+ "completion",
84
+ "cache_read",
85
+ "cacheRead",
86
+ "cache_write",
87
+ "cacheWrite"
88
+ ], p = (e) => {
89
+ let t = f.indexOf(e);
90
+ return t === -1 ? f.length : t;
91
+ }, m = (e) => {
92
+ let t = d[e];
93
+ if (t != null) return t;
94
+ let n = e.replace(/([a-z\d])([A-Z])/g, "$1 $2").replace(/[_-]+/g, " ").trim().toLowerCase();
95
+ return n === "" ? e : ` ${n.charAt(0).toUpperCase()}${n.slice(1)}`;
96
+ }, h = (e) => {
97
+ if (e == null) return;
98
+ let t = [...e.prices ?? []].sort((e, t) => p(e.key) - p(t.key)).map(({ key: e, price: t }) => ({
99
+ label: m(e),
100
+ price: t
101
+ }));
102
+ if (t.length !== 0) return { prices: t };
103
+ }, g = (e) => {
104
+ let { api: t } = e;
105
+ if (t?.modelId != null) return { resource: { modelId: t.modelId } };
106
+ }, _ = (e) => {
107
+ let t = [];
108
+ if (e.specification != null) {
109
+ let { specification: r } = e, i = [];
110
+ r.provider != null && i.push({
111
+ label: "Provider",
112
+ value: r.provider
113
+ }), r.vendor != null && i.push({
114
+ label: "Vendor",
115
+ value: r.vendor
116
+ }), r.license != null && i.push({
117
+ label: "License",
118
+ value: r.license
119
+ }), r.knowledgeCutoffDate != null && i.push({
120
+ label: "Knowledge cutoff date",
121
+ value: c(r.knowledgeCutoffDate)
122
+ }), r.parameters != null && i.push({
123
+ label: "Parameters",
124
+ value: r.parameters
125
+ }), r.hostedBy != null && i.push({
126
+ label: "Hosted by",
127
+ value: r.hostedBy
128
+ }), r.createdAt != null && i.push({
129
+ label: "Release date",
130
+ value: n(r.createdAt)
131
+ }), r.routes?.length && i.push({
132
+ label: "Routes",
133
+ value: r.routes.join(" · ")
134
+ }), i.length > 0 && t.push({
135
+ title: "Specification",
136
+ specs: i
137
+ });
138
+ }
139
+ if (e.capabilities != null) {
140
+ let { capabilities: n } = e, r = [];
141
+ n.hasTools != null && r.push({
142
+ label: "Tools",
143
+ value: n.hasTools
144
+ }), n.hasParallelToolCalls != null && r.push({
145
+ label: "Parallel tool calls",
146
+ value: n.hasParallelToolCalls
147
+ }), n.hasConfiguration != null && r.push({
148
+ label: "Configuration schema",
149
+ value: n.hasConfiguration
150
+ }), r.length > 0 && t.push({
151
+ title: "Capabilities",
152
+ specs: r
153
+ });
154
+ }
155
+ if (e.configuration != null) {
156
+ let { configuration: n } = e, r = [];
157
+ n.inputAttachmentTypes?.length && r.push({
158
+ label: "Input attachments",
159
+ value: i(n.inputAttachmentTypes)
160
+ }), r.length > 0 && t.push({
161
+ title: "Configuration",
162
+ specs: r
163
+ });
164
+ }
165
+ return { overview: t.length > 0 ? { sections: t } : void 0 };
166
+ }, v = {
167
+ [e.None]: o.None,
168
+ [e.ApiKey]: o.ApiKey,
169
+ [e.OAuth]: o.OAuth
170
+ }, y = {
171
+ SIGNED_IN: a.SignedIn,
172
+ SIGNED_OUT: a.SignedOut,
173
+ FAILED: a.Failed
174
+ }, b = (n, r, i) => {
175
+ let a = v[r.specification?.authentication ?? e.None];
176
+ if (a == null) return;
177
+ let { userLevel: o, global: s } = r.specification?.authStatus ?? {}, c = t(n);
178
+ return {
179
+ authenticationType: a,
180
+ userStatus: o ? y[o] : void 0,
181
+ globalStatus: s ? y[s] : void 0,
182
+ isPublic: c,
183
+ isManageableByAdmin: i && c,
184
+ apiKeyHeader: r.specification?.authStatus?.apiKeyHeader
185
+ };
186
+ }, x = (e) => {
187
+ let t = e?.permissions?.length ? e.permissions : e?.allTools;
188
+ if (t?.length) return { tools: t.map((e) => ({ name: e })) };
189
+ }, S = (e) => {
190
+ let t = [];
191
+ if (e.specification != null) {
192
+ let { specification: r } = e, i = [];
193
+ r.authentication != null && i.push({
194
+ label: "Authentication",
195
+ value: r.authentication
196
+ }), r.provider != null && i.push({
197
+ label: "Provider",
198
+ value: r.provider
199
+ }), r.vendor != null && i.push({
200
+ label: "Vendor",
201
+ value: r.vendor
202
+ }), r.license != null && i.push({
203
+ label: "License",
204
+ value: r.license
205
+ }), r.knowledgeCutoffDate != null && i.push({
206
+ label: "Knowledge cutoff date",
207
+ value: c(r.knowledgeCutoffDate)
208
+ }), r.parameters != null && i.push({
209
+ label: "Parameters",
210
+ value: r.parameters
211
+ }), r.hostedBy != null && i.push({
212
+ label: "Hosted by",
213
+ value: r.hostedBy
214
+ }), r.createdAt != null && i.push({
215
+ label: "Release date",
216
+ value: n(r.createdAt)
217
+ }), r.authStatus?.scopesSupported?.length && i.push({
218
+ label: "OAuth scopes",
219
+ value: r.authStatus.scopesSupported.join(" · ")
220
+ }), r.authStatus?.authorizationEndpoint != null && i.push({
221
+ label: "Authorization endpoint",
222
+ value: r.authStatus.authorizationEndpoint
223
+ }), r.authStatus?.tokenEndpoint != null && i.push({
224
+ label: "Token endpoint",
225
+ value: r.authStatus.tokenEndpoint
226
+ }), i.length > 0 && t.push({
227
+ title: "Specification",
228
+ specs: i
229
+ });
230
+ }
231
+ return {
232
+ overview: t.length > 0 ? { sections: t } : void 0,
233
+ tools: x(e.specification)
234
+ };
235
+ }, C = (e) => {
236
+ switch (e.type) {
237
+ case "MODEL": return u(e.data);
238
+ case "AGENT": return _(e.data);
239
+ case "TOOLSET": return S(e.data);
240
+ }
241
+ }, w = (e) => {
242
+ if (e != null) return {
243
+ hasTools: e.tools,
244
+ hasMcp: e.mcp,
245
+ hasCaching: e.cache,
246
+ hasParallelToolCalls: e.parallelToolCalls,
247
+ hasUrlAttachments: e.urlAttachments,
248
+ hasFolderAttachments: e.folderAttachments,
249
+ hasSeed: e.seed,
250
+ hasSystemPrompt: e.systemPrompt,
251
+ hasResume: e.allowResume,
252
+ hasConfiguration: e.hasConfigurationSchema,
253
+ hasChatCompletion: e.chatCompletion,
254
+ hasResponsesApi: e.responsesApi,
255
+ reasoningEfforts: e.reasoningEfforts
256
+ };
257
+ }, T = (e) => {
258
+ if (e == null) return;
259
+ let { unit: t } = e, n = Object.entries(e).flatMap(([e, n]) => {
260
+ if (e === l || typeof n != "string" || n.trim() === "") return [];
261
+ let i = r(n, t);
262
+ return i == null ? [] : [{
263
+ key: e,
264
+ price: i
265
+ }];
266
+ });
267
+ return n.length > 0 ? { prices: n } : void 0;
268
+ }, E = (e) => {
269
+ let { limits: t, pricing: n, features: r, catalogProperties: i, owner: a, inputAttachmentTypes: o, defaultMaxTokens: s, createdAt: c } = e.modelDetails ?? {}, l = t != null || i != null || a != null || c != null || (o?.length ?? 0) > 0;
270
+ return {
271
+ type: "MODEL",
272
+ data: {
273
+ capabilities: w(r),
274
+ specification: l ? {
275
+ provider: i?.provider,
276
+ vendor: i?.vendor,
277
+ license: i?.license,
278
+ knowledgeCutoffDate: i?.knowledgeCutoffDate,
279
+ parameters: i?.parameters,
280
+ contextWindowTokens: t?.maxTotalTokens,
281
+ maxOutputTokens: t?.maxCompletionTokens ?? s,
282
+ inputTypes: o,
283
+ hostedBy: a,
284
+ createdAt: c
285
+ } : void 0,
286
+ pricing: T(n),
287
+ api: { modelId: e.id }
288
+ }
289
+ };
290
+ }, D = (e) => {
291
+ let { routes: t, owner: n, inputAttachmentTypes: r, features: i, catalogProperties: a, createdAt: o } = e.applicationDetails ?? {}, s = a != null || n != null || o != null || (t?.length ?? 0) > 0;
292
+ return {
293
+ type: "AGENT",
294
+ data: {
295
+ capabilities: w(i),
296
+ specification: s ? {
297
+ provider: a?.provider,
298
+ vendor: a?.vendor,
299
+ license: a?.license,
300
+ knowledgeCutoffDate: a?.knowledgeCutoffDate,
301
+ parameters: a?.parameters,
302
+ hostedBy: n,
303
+ createdAt: o,
304
+ routes: t
305
+ } : void 0,
306
+ configuration: r?.length ? { inputAttachmentTypes: r } : void 0
307
+ }
308
+ };
309
+ }, O = (t) => t === e.None || t === e.ApiKey || t === e.OAuth, k = (e) => {
310
+ if (e == null) return;
311
+ let { globalAuthStatus: t, appLevelAuthStatus: n, userLevelAuthStatus: r, scopesSupported: i, authorizationEndpoint: a, tokenEndpoint: o, apiKeyHeader: s } = e;
312
+ if (!(t == null && n == null && r == null && a == null && o == null && s == null && !i?.length)) return {
313
+ global: t,
314
+ appLevel: n,
315
+ userLevel: r,
316
+ scopesSupported: i,
317
+ authorizationEndpoint: a,
318
+ tokenEndpoint: o,
319
+ apiKeyHeader: s
320
+ };
321
+ }, A = (e) => {
322
+ let t = e.toolsetDetails, n = t?.authSettings?.authenticationType;
323
+ return {
324
+ type: "TOOLSET",
325
+ data: {
326
+ capabilities: w(t?.features),
327
+ specification: t == null ? void 0 : {
328
+ authentication: O(n) ? n : void 0,
329
+ provider: t.catalogProperties?.provider,
330
+ vendor: t.catalogProperties?.vendor,
331
+ license: t.catalogProperties?.license,
332
+ knowledgeCutoffDate: t.catalogProperties?.knowledgeCutoffDate,
333
+ parameters: t.catalogProperties?.parameters,
334
+ permissions: t.allowedTools,
335
+ allTools: t.allToolNames,
336
+ hostedBy: t.owner,
337
+ createdAt: t.createdAt,
338
+ authStatus: k(t.authSettings)
339
+ }
340
+ }
341
+ };
342
+ }, j = (e) => {
343
+ switch (e.type) {
344
+ case "model": return E(e);
345
+ case "application": return D(e);
346
+ case "toolset": return A(e);
347
+ }
348
+ };
349
+ //#endregion
350
+ export { j as mapDeploymentDetailsDtoToEntityDetails, C as mapEntityDetailsToCatalogDetails, b as mapToolsetCredentials };
@@ -0,0 +1,49 @@
1
+ import { safeDecodeURIComponent as e } from "../shared/string-utils.js";
2
+ import { formatCalendarDate as t } from "../shared/formatting.js";
3
+ import { PromptSource as n } from "../prompt/prompt-resource.js";
4
+ import { CatalogEntityType as r, formatLastUsed as i } from "@epam/ai-dial-chat-shared";
5
+ //#region src/catalog/map-prompt-to-catalog-item.ts
6
+ var a = {
7
+ [n.Personal]: "personal",
8
+ [n.SharedWithMe]: "shared",
9
+ [n.Public]: "public"
10
+ }, o = (t, n, r) => [r[a[n]], ...t.split("/").filter(Boolean).map(e)], s = (e, n) => {
11
+ let r = [];
12
+ return e.author && r.push({
13
+ label: n.authorLabel,
14
+ value: e.author
15
+ }), r.push({
16
+ label: n.updatedLabel,
17
+ value: t(e.updatedAt)
18
+ }), { sections: [{
19
+ title: n.sectionTitle,
20
+ specs: r
21
+ }] };
22
+ }, c = (e) => !e.isMyApp && !e.sharedWithMe, l = (e, { folderLabels: t, overviewLabels: a, source: c, favoriteIds: l }) => {
23
+ let u = c === n.Personal, d = e.id, f = l.has(d);
24
+ return {
25
+ id: d,
26
+ type: r.Prompt,
27
+ name: e.name,
28
+ description: e.description ?? "",
29
+ version: "",
30
+ lastUsed: i(e.updatedAt),
31
+ createdAt: e.createdAt,
32
+ updatedAt: e.updatedAt,
33
+ isFeatured: !1,
34
+ isHidden: !1,
35
+ topics: [],
36
+ isUserFavorite: f,
37
+ isStarred: f,
38
+ isMyApp: e.isMy ?? u,
39
+ sharedWithMe: e.sharedWithMe ?? c === n.SharedWithMe,
40
+ isEditable: c !== n.Public && (e.canEdit ?? u),
41
+ folder: o(e.folderId, c, t),
42
+ details: {
43
+ ...e.content ? { promptContent: { content: e.content } } : void 0,
44
+ overview: s(e, a)
45
+ }
46
+ };
47
+ };
48
+ //#endregion
49
+ export { s as buildPromptOverview, c as isOrganisationPromptItem, l as mapPromptToCatalogItem };
@@ -0,0 +1,123 @@
1
+ import { safeDecodeURIComponent as e, stripSurroundingSlashes as t } from "../shared/string-utils.js";
2
+ import { formatCalendarDate as n } from "../shared/formatting.js";
3
+ import "../skill/skill.js";
4
+ import { SkillSource as r } from "../skill/skill-types.js";
5
+ import { CatalogEntityType as i, formatLastUsed as a } from "@epam/ai-dial-chat-shared";
6
+ import { CatalogContentNodeType as o } from "@epam/ai-dial-catalog";
7
+ import { SkillMetadataItemDtoNodeTypeEnum as s } from "@epam/ai-dial-chat-api-client";
8
+ //#region src/catalog/map-skill-to-catalog-item.ts
9
+ var c = {
10
+ [r.Personal]: "personal",
11
+ [r.SharedWithMe]: "shared",
12
+ [r.Public]: "public"
13
+ }, l = (t, n, r) => [r[c[n]], ...(t ?? "").split("/").filter(Boolean).map(e)], u = (e, { folderLabels: t, source: n, favoriteIds: o }) => {
14
+ let s = o.has(e.url), c = n === r.Public, u = n === r.Personal;
15
+ return {
16
+ id: e.url,
17
+ type: i.Skill,
18
+ name: e.name,
19
+ description: "",
20
+ version: "",
21
+ lastUsed: a(e.updatedAt),
22
+ createdAt: e.createdAt,
23
+ updatedAt: e.updatedAt,
24
+ isFeatured: !1,
25
+ isHidden: !1,
26
+ topics: [],
27
+ isUserFavorite: s,
28
+ isStarred: s,
29
+ isMyApp: u && (e.isMy ?? !0),
30
+ sharedWithMe: e.sharedWithMe ?? n === r.SharedWithMe,
31
+ isEditable: !c && (e.canEdit ?? u),
32
+ folder: l(e.parentPath, n, t)
33
+ };
34
+ }, d = (e) => e.join(" · "), f = (e, t) => {
35
+ if (e == null) return null;
36
+ let n = [];
37
+ return e.whenToUse != null && n.push({
38
+ label: t.whenToUseLabel,
39
+ value: e.whenToUse
40
+ }), e.allowedTools?.length && n.push({
41
+ label: t.allowedToolsLabel,
42
+ value: d(e.allowedTools)
43
+ }), e.bundledResources?.length && n.push({
44
+ label: t.bundledResourcesLabel,
45
+ value: d(e.bundledResources)
46
+ }), n.length === 0 ? null : {
47
+ title: t.specificationSectionTitle,
48
+ specs: n
49
+ };
50
+ }, p = (e) => e.filter((e) => e.nodeType === s.Item), m = (e, n) => {
51
+ let r = t(n), i = r ? `${r}/files` : "files";
52
+ return p(e).find((e) => {
53
+ let n = t(e.path);
54
+ return n === "SKILL.md" || n === "files/SKILL.md" || n === `${i}/SKILL.md`;
55
+ })?.path ?? "SKILL.md";
56
+ }, h = (e, n) => {
57
+ let r = t(e), i = t(n), a = i ? `${i}/files` : "files";
58
+ return r === "" || r === "files" || r === a ? null : r.startsWith(`${a}/`) ? r.slice(a.length + 1) : r.startsWith("files/") ? r.slice(6) : r;
59
+ }, g = (e, t) => h(e, t), _ = (e, t, r, i) => {
60
+ let a = [], o = f(r, i);
61
+ o != null && a.push(o);
62
+ let s = [];
63
+ return e?.author && s.push({
64
+ label: i.authorLabel,
65
+ value: e.author
66
+ }), s.push({
67
+ label: i.updatedLabel,
68
+ value: e?.updatedAt ? n(e.updatedAt) : ""
69
+ }), s.push({
70
+ label: i.fileCountLabel,
71
+ value: String(p(t).length)
72
+ }), a.push({
73
+ title: i.detailsSectionTitle,
74
+ specs: s
75
+ }), { sections: a };
76
+ }, v = (e, t, n) => {
77
+ if (e === "") return n;
78
+ let r = t.get(e);
79
+ if (r != null) return r.items;
80
+ let i = e.split("/"), a = v(i.slice(0, -1).join("/"), t, n), s = {
81
+ type: o.Folder,
82
+ id: e,
83
+ name: i[i.length - 1],
84
+ items: []
85
+ };
86
+ return t.set(e, s), a.push(s), s.items;
87
+ }, y = (e, t) => {
88
+ e.sort((e, n) => {
89
+ if (t) {
90
+ if (e.name === "SKILL.md") return -1;
91
+ if (n.name === "SKILL.md") return 1;
92
+ }
93
+ return e.name.localeCompare(n.name);
94
+ });
95
+ for (let t of e) t.type === o.Folder && y(t.items, !1);
96
+ }, b = (e, t) => {
97
+ let n = /* @__PURE__ */ new Map(), r = [];
98
+ for (let i of e) {
99
+ let e = h(i.path, t);
100
+ if (e == null) continue;
101
+ if (i.nodeType === s.Folder) {
102
+ v(e, n, r);
103
+ continue;
104
+ }
105
+ let a = e.lastIndexOf("/");
106
+ v(a === -1 ? "" : e.slice(0, a), n, r).push({
107
+ type: o.File,
108
+ id: i.path,
109
+ name: i.name
110
+ });
111
+ }
112
+ return y(r, !0), r;
113
+ }, x = async (e) => {
114
+ let t = Number(e.headers.get("content-length"));
115
+ if (Number.isFinite(t) && t > 262144) return null;
116
+ let n = await e.arrayBuffer();
117
+ return n.byteLength > 262144 ? null : new Uint8Array(n);
118
+ }, S = async (e) => {
119
+ let t = await x(e);
120
+ return t == null ? null : new TextDecoder().decode(t);
121
+ };
122
+ //#endregion
123
+ export { b as buildSkillContentTree, _ as buildSkillOverview, u as mapSkillToCatalogItem, x as readSkillFileBytes, S as readSkillManifest, g as resolveSkillFileDownloadPath, m as resolveSkillManifestFileId };
@@ -0,0 +1,26 @@
1
+ import { CatalogEntityType as e } from "@epam/ai-dial-chat-shared";
2
+ import { CodeLanguage as t } from "@epam/ai-dial-catalog";
3
+ //#region src/catalog/mcp-endpoint-url.ts
4
+ var n = /* @__PURE__ */ function(e) {
5
+ return e.Toolset = "toolset", e.Application = "application", e;
6
+ }({}), r = (e) => {
7
+ try {
8
+ return decodeURIComponent(e);
9
+ } catch {
10
+ return e;
11
+ }
12
+ }, i = (e) => e.split("/").map((e) => encodeURIComponent(r(e))).join("/"), a = (e) => e.endsWith("/") ? e.slice(0, -1) : e, o = (e, t) => `${a(e)}/v1/toolset/${i(t)}/mcp`, s = (e, t) => `${a(e)}/v1/deployments/${i(t)}/mcp`, c = {
13
+ toolset: o,
14
+ application: s
15
+ }, l = (t, n) => t === e.Toolset ? "toolset" : t === e.Agent && n === !0 ? "application" : null, u = (e, n, r) => {
16
+ let i = c[r](e, n);
17
+ return {
18
+ resource: { endpointUrl: i },
19
+ snippets: [{
20
+ language: t.Curl,
21
+ code: `curl -X POST ${i} \\\n -H 'Content-Type: application/json' \\\n -H 'Api-Key: <key>' \\\n -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'`
22
+ }]
23
+ };
24
+ };
25
+ //#endregion
26
+ export { n as McpResourceKind, s as buildApplicationMcpUrl, u as buildConnectApi, o as buildToolsetMcpUrl, l as resolveMcpResourceKind };
@@ -0,0 +1,18 @@
1
+ import { CatalogEntityType as e } from "@epam/ai-dial-chat-shared";
2
+ //#region src/catalog/publish.ts
3
+ var t = {
4
+ [e.Model]: "model",
5
+ [e.Toolset]: "toolset",
6
+ [e.Agent]: "application",
7
+ [e.Prompt]: "prompt",
8
+ [e.Skill]: "skill"
9
+ }, n = (e) => t[e], r = (e) => ({
10
+ version: e.version,
11
+ publishedAt: Date.parse(e.publishedAt),
12
+ folderPath: e.folderPath.split("/").filter(Boolean)
13
+ }), i = (e) => ({
14
+ publishedAt: Date.parse(e.publishedAt),
15
+ folderPath: e.folderPath.split("/").filter(Boolean)
16
+ });
17
+ //#endregion
18
+ export { i as mapPublishConversationResultDto, r as mapPublishHistoryEntryDto, n as toPublishEntityType };
@@ -0,0 +1,109 @@
1
+ import { getApiErrorDetails as e } from "../../api-error/api-error.js";
2
+ import { findDeploymentByIdOrReference as t } from "../deployment-id.js";
3
+ import { parseSkillResourceUrl as n } from "../../skill/skill-types.js";
4
+ import { CatalogEntityType as r } from "@epam/ai-dial-chat-shared";
5
+ import { useCallback as i, useMemo as a } from "react";
6
+ //#region src/catalog/useCatalogEditNavigation/useCatalogEditNavigation.ts
7
+ var o = ({ deployments: o, isCustomAppsEnabled: s, isSchemaAppsEnabled: c, isHideCustomAppCreationEnabled: l, isToolsetsEnabled: u, isPromptsEnabled: d, quickAppSchemaId: f, urls: p, onNavigate: m, deletePrompt: h, deleteToolset: g, deleteSkill: _, deleteApplication: v, refetchPrompts: y, refetchToolsets: b, refetchSkills: x, refetchDeployments: S, onDeleteSuccess: C, labels: w, onNotify: T, triggerSkillArchivePicker: E }) => ({
8
+ handleEdit: i((e) => {
9
+ if (e.type === r.Prompt) {
10
+ m(p.buildPromptEditUrl(e.id));
11
+ return;
12
+ }
13
+ if (e.type === r.Skill) {
14
+ m(p.buildSkillEditUrl(e.id));
15
+ return;
16
+ }
17
+ if (e.type === r.Toolset) {
18
+ m(p.buildToolsetEditUrl(e.id));
19
+ return;
20
+ }
21
+ let n = t(o, e.id);
22
+ if (s && n != null && !n.applicationTypeSchemaId) {
23
+ m(p.buildCustomAppEditUrl(e.id));
24
+ return;
25
+ }
26
+ f && m(p.buildQuickAppEditUrl(f, e.id));
27
+ }, [
28
+ o,
29
+ s,
30
+ f,
31
+ m,
32
+ p
33
+ ]),
34
+ handleDelete: i(async (t) => {
35
+ try {
36
+ if (t.type === r.Prompt) await h(t.id), await y();
37
+ else if (t.type === r.Toolset) await g(t.id), await b();
38
+ else if (t.type === r.Skill) {
39
+ let e = n(t.id);
40
+ if (e == null) throw Error(`Invalid skill resource url: ${t.id}`);
41
+ await _(e.bucket, e.path), await x();
42
+ } else await v(t.id), await S();
43
+ C(t);
44
+ } catch (t) {
45
+ let { traceId: n } = await e(t);
46
+ throw T({
47
+ message: w.deleteError,
48
+ requestId: n
49
+ }), t;
50
+ }
51
+ }, [
52
+ h,
53
+ g,
54
+ _,
55
+ v,
56
+ b,
57
+ S,
58
+ y,
59
+ x,
60
+ C,
61
+ w,
62
+ T
63
+ ]),
64
+ createOptions: a(() => {
65
+ let e = [];
66
+ return f && c && !l && e.push({
67
+ key: "quick-app",
68
+ label: w.createQuickApp,
69
+ onClick: () => m(p.buildQuickAppCreateUrl(f))
70
+ }), u && e.push({
71
+ key: "toolset",
72
+ label: w.createToolset,
73
+ onClick: () => m(p.buildToolsetCreateUrl())
74
+ }), s && !l && e.push({
75
+ key: "custom-app",
76
+ label: w.createCustomApp,
77
+ onClick: () => m(p.buildCustomAppCreateUrl())
78
+ }), e.push({
79
+ key: "skill",
80
+ label: w.createSkill,
81
+ children: [{
82
+ key: "skill-write-instructions",
83
+ label: w.createSkillWriteInstructions,
84
+ onClick: () => m(p.buildSkillCreateUrl())
85
+ }, {
86
+ key: "skill-upload",
87
+ label: w.createSkillUpload,
88
+ onClick: E
89
+ }]
90
+ }), d && e.push({
91
+ key: "prompt",
92
+ label: w.createPrompt,
93
+ onClick: () => m(p.buildPromptCreateUrl())
94
+ }), e;
95
+ }, [
96
+ f,
97
+ m,
98
+ p,
99
+ d,
100
+ w,
101
+ c,
102
+ l,
103
+ u,
104
+ s,
105
+ E
106
+ ])
107
+ });
108
+ //#endregion
109
+ export { o as useCatalogEditNavigation };