@epam/ai-dial-chat-hooks 1.2.0-dev.15 → 1.2.0-dev.152

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 (63) hide show
  1. package/api-error/api-error.js +5 -4
  2. package/attachment/useAttachmentValidation/useAttachmentValidation.js +26 -19
  3. package/attachments.d.ts +10 -4
  4. package/catalog/map-deployment-limits-to-input.js +81 -9
  5. package/catalog/map-deployment-to-catalog-item.js +2 -2
  6. package/catalog/map-skill-to-catalog-item.js +30 -27
  7. package/catalog/publish.js +2 -1
  8. package/catalog/useApplicationCredentials/useApplicationCredentials.js +39 -0
  9. package/catalog/useSkillDetailsPanelData/useSkillDetailsPanelData.js +39 -39
  10. package/catalog/useSkillItemDetails.js +17 -13
  11. package/catalog.d.ts +86 -19
  12. package/catalog.js +6 -5
  13. package/conversation/conversation-transfer/queue.js +8 -5
  14. package/conversation/create-chat-stream-api.js +30 -21
  15. package/conversation/stage.js +23 -0
  16. package/conversation/useAttachmentUpload/useAttachmentUpload.js +12 -5
  17. package/conversation/useConversationImport/useConversationImport.js +1 -1
  18. package/conversation/useConversationPanelItems/useConversationPanelItems.js +2 -3
  19. package/conversation/useConversationScroll/useConversationScroll.js +68 -64
  20. package/conversation/useConversationStream/apply-chunk.js +1 -1
  21. package/conversation/useConversationStream/generation-resume.js +75 -63
  22. package/conversation/useConversationStream/useConversationStream.js +145 -102
  23. package/conversation-overlay.d.ts +7 -0
  24. package/conversation-overlay.js +2 -0
  25. package/conversation-sources/useConversationSources/useConversationSources.js +31 -24
  26. package/conversation-sources.d.ts +1 -1
  27. package/conversation.d.ts +147 -15
  28. package/conversation.js +31 -30
  29. package/file-manager-canvas.d.ts +398 -0
  30. package/file-manager-canvas.js +2 -0
  31. package/file-manager.d.ts +71 -330
  32. package/file-manager.js +15 -15
  33. package/files/attachment-canvas.js +51 -13
  34. package/files/attachment-types.js +14 -13
  35. package/files/useDialFileManagerTabConfig/useDialFileManagerTabConfig.js +1 -5
  36. package/files/useFileAttachmentPicker/useFileAttachmentPicker.js +43 -0
  37. package/index.d.ts +784 -57
  38. package/index.js +123 -111
  39. package/mcp-apps/useMcpAppHostAdapter/useMcpAppHostAdapter.js +7 -5
  40. package/mcp-apps/useMcpAppHostContext/useMcpAppHostContext.js +1 -1
  41. package/mcp-apps/useMcpAppTools/useMcpAppTools.js +1 -1
  42. package/mcp-apps/useOpenMcpAppCanvas/useOpenMcpAppCanvas.js +25 -23
  43. package/mcp-apps.d.ts +8 -6
  44. package/package.json +37 -18
  45. package/scheduled-task/scheduled-task-description.js +77 -0
  46. package/scheduled-task/scheduled-task-preparation.js +24 -0
  47. package/scheduled-task/scheduled-task-trigger.js +7 -2
  48. package/scheduled-task/scheduled-tasks-api-client.js +19 -0
  49. package/scheduled-task/use-scheduled-task-runs.js +82 -0
  50. package/scheduled-task/use-scheduled-tasks.js +93 -0
  51. package/scheduled-tasks.d.ts +180 -3
  52. package/scheduled-tasks.js +7 -2
  53. package/skill/skill.js +10 -7
  54. package/skill/useSkillArchiveImport/useSkillArchiveImport.js +75 -0
  55. package/skill/useSkillEditorLoad.js +29 -28
  56. package/skill/useSkillEditorSubmit.js +93 -75
  57. package/skill-editor.d.ts +110 -1
  58. package/skill-editor.js +9 -8
  59. package/usage/map-usage-data-to-dashboard.js +66 -0
  60. package/usage/map-user-usage-to-model-limits.js +160 -0
  61. package/usage.d.ts +120 -0
  62. package/usage.js +3 -0
  63. package/utils.d.ts +3 -1
@@ -69,14 +69,14 @@ var g = (e, t) => URL.createObjectURL(s(e, t)), _ = (e) => {
69
69
  if (t.url != null && e(t.url)) return E(t.url);
70
70
  if (t.referenceUrl != null && e(t.referenceUrl)) return E(t.referenceUrl);
71
71
  }, O = async (e, t) => {
72
- if ("file" in e) return URL.createObjectURL(e.file);
73
- let n = t.resolveDialUrl(e);
74
- if (n != null) try {
75
- let r = await w(n, D(e) ?? "", t);
76
- return URL.createObjectURL(r);
72
+ let n = "file" in e ? e.file : void 0, r = n != null && n.size === 0, i = n != null && !r ? void 0 : t.resolveDialUrl(e);
73
+ if (n != null && i == null) return URL.createObjectURL(n);
74
+ if (i != null) try {
75
+ let n = await w(i, D(e) ?? "", t);
76
+ return URL.createObjectURL(n);
77
77
  } catch (e) {
78
78
  let t = e.status;
79
- return t == null ? y(n) : v(t, n);
79
+ return t == null ? y(i) : v(t, i);
80
80
  }
81
81
  if (e.previewUrl != null) return e.previewUrl;
82
82
  if (e.data != null) return g(e.data, e.contentType);
@@ -91,12 +91,11 @@ var g = (e, t) => URL.createObjectURL(s(e, t)), _ = (e) => {
91
91
  }
92
92
  if ("file" in e) return e.file.text();
93
93
  }, A = (e, t) => e.data != null || t.resolveDialUrl(e) != null || "file" in e, j = (e, n) => {
94
- if ("file" in e) return {
94
+ let r = "file" in e ? e.file : void 0, i = r != null && r.size === 0, a = r != null && !i ? void 0 : n.resolveDialUrl(e);
95
+ return r != null && a == null ? {
95
96
  type: t.Image,
96
- url: URL.createObjectURL(e.file)
97
- };
98
- let r = n.resolveDialUrl(e);
99
- return r == null ? e.previewUrl == null ? e.data == null ? null : {
97
+ url: URL.createObjectURL(r)
98
+ } : a == null ? e.previewUrl == null ? e.data == null ? null : {
100
99
  type: t.Image,
101
100
  url: g(e.data, e.contentType)
102
101
  } : {
@@ -104,7 +103,7 @@ var g = (e, t) => URL.createObjectURL(s(e, t)), _ = (e) => {
104
103
  url: e.previewUrl
105
104
  } : {
106
105
  type: t.Image,
107
- url: r
106
+ url: a
108
107
  };
109
108
  }, M = async (e, n) => {
110
109
  let r = await k(e, n);
@@ -151,6 +150,17 @@ var g = (e, t) => URL.createObjectURL(s(e, t)), _ = (e) => {
151
150
  };
152
151
  }, R = (e) => {
153
152
  switch (e.type) {
153
+ case "docx_text_anchor": return {
154
+ kind: i.DocxTableRow,
155
+ cells: e.cells,
156
+ occurrence: e.occurrence
157
+ };
158
+ case "pptx_text_anchor": return {
159
+ kind: i.PptxTableRow,
160
+ cells: e.cells,
161
+ occurrence: e.occurrence,
162
+ slide: e.slide
163
+ };
154
164
  case "docx_text_range": return {
155
165
  kind: i.DocxTextRange,
156
166
  story: e.story,
@@ -298,6 +308,34 @@ var g = (e, t) => URL.createObjectURL(s(e, t)), _ = (e) => {
298
308
  visualizerName: r.title,
299
309
  requestTimeout: r.requestTimeout
300
310
  };
311
+ }, q = (e, n, r, i) => {
312
+ let a = {
313
+ width: r.width,
314
+ height: r.height,
315
+ mobileHeight: r.mobileHeight,
316
+ themeId: i
317
+ }, o = [], s = [];
318
+ return e.forEach((e) => {
319
+ let t = n(e);
320
+ t != null && (s.push(e), o.push({
321
+ url: t,
322
+ mimeType: e.contentType,
323
+ visualizerData: { layout: a }
324
+ }));
325
+ }), o.length === 0 ? {
326
+ content: null,
327
+ resolved: []
328
+ } : {
329
+ content: {
330
+ type: t.GroupedVisualizer,
331
+ url: r.url,
332
+ attachments: o,
333
+ layout: a,
334
+ visualizerName: r.title,
335
+ requestTimeout: r.requestTimeout
336
+ },
337
+ resolved: s
338
+ };
301
339
  };
302
340
  //#endregion
303
- export { z as annotationToOoxmlCanvasContent, L as annotationToPdfCanvasContent, S as clearAttachmentCache, A as hasAttachmentTextSource, B as referenceAttachmentToPdfCanvasContent, F as resolveCodeCanvasContent, I as resolveHtmlCanvasContent, j as resolveImageCanvasContent, G as resolveJsonCanvasContent, N as resolveMarkdownCanvasContent, W as resolveOoxmlCanvasContent, U as resolvePdfCanvasContent, M as resolveTextCanvasContent, K as resolveVisualizerCanvasContent };
341
+ export { z as annotationToOoxmlCanvasContent, L as annotationToPdfCanvasContent, S as clearAttachmentCache, A as hasAttachmentTextSource, B as referenceAttachmentToPdfCanvasContent, F as resolveCodeCanvasContent, q as resolveGroupedVisualizerCanvasContent, I as resolveHtmlCanvasContent, j as resolveImageCanvasContent, G as resolveJsonCanvasContent, N as resolveMarkdownCanvasContent, W as resolveOoxmlCanvasContent, U as resolvePdfCanvasContent, M as resolveTextCanvasContent, K as resolveVisualizerCanvasContent };
@@ -1,16 +1,17 @@
1
- import { extension as e } from "mime-types";
1
+ import { normalizeMimeType as e } from "@epam/ai-dial-chat-shared";
2
+ import { extension as t } from "mime-types";
2
3
  //#region src/files/attachment-types.ts
3
- var t = "*/*", n = (e) => e.startsWith(".") || e.includes("/"), r = (e) => {
4
- if (e != null) return e.map((e) => e === "*" ? t : e).filter(n);
5
- }, i = (e) => {
6
- let n = r(e);
7
- if (!(n == null || n.length === 0) && !n.some((e) => e === t)) return n.join(",");
8
- }, a = (t) => t.map((t) => {
9
- if (t.endsWith("/*")) return t;
10
- let n = e(t);
11
- if (n !== !1) return `.${n}`;
12
- let r = t.split("/")[1];
13
- return r == null ? t : `.${r.toLowerCase()}`;
4
+ var n = "*/*", r = (e) => e.startsWith(".") || e.includes("/"), i = (t) => {
5
+ if (t != null) return t.map((t) => t === "*" ? n : t.startsWith(".") ? t : e(t)).filter(r);
6
+ }, a = (e) => {
7
+ let t = i(e);
8
+ if (!(t == null || t.length === 0) && !t.some((e) => e === n)) return t.join(",");
9
+ }, o = (n) => n.map((n) => {
10
+ if (n.endsWith("/*")) return n;
11
+ let r = e(n), i = t(r);
12
+ if (i !== !1) return `.${i}`;
13
+ let a = r.split("/")[1];
14
+ return a == null ? n : `.${a.toLowerCase()}`;
14
15
  }).join(", ");
15
16
  //#endregion
16
- export { n as isDialFileAcceptType, a as mimeTypesToAttachmentExtensionLabels, r as mimeTypesToDialFileAcceptTypes, i as mimeTypesToFileAccept };
17
+ export { r as isDialFileAcceptType, o as mimeTypesToAttachmentExtensionLabels, i as mimeTypesToDialFileAcceptTypes, a as mimeTypesToFileAccept };
@@ -6,11 +6,7 @@ var i = [
6
6
  r.Shared,
7
7
  r.Organization
8
8
  ], a = (a, o, s, c) => {
9
- let l = e((e) => c == null || c.includes(e), [c]), u = n(() => s?.filter((e) => l(e.id)).flatMap(({ id: e, label: t, disabled: n }) => typeof t == "string" ? [{
10
- id: e,
11
- label: t,
12
- disabled: n
13
- }] : []), [s, l]);
9
+ let l = e((e) => c == null || c.includes(e), [c]), u = n(() => s?.filter((e) => l(e.value)), [s, l]);
14
10
  return t(() => {
15
11
  l(a) || o(i.find((e) => l(e)) ?? r.MyFiles);
16
12
  }, [
@@ -0,0 +1,43 @@
1
+ import { mimeTypesToDialFileAcceptTypes as e } from "../attachment-types.js";
2
+ import { DialFileManagerVariant as t } from "../file-manager-variant.js";
3
+ import { useDialFileManager as n } from "../useDialFileManager/useDialFileManager.js";
4
+ import { useDialFileManagerTabConfig as r } from "../useDialFileManagerTabConfig/useDialFileManagerTabConfig.js";
5
+ import { isHiddenPath as i } from "@epam/ai-dial-chat-shared";
6
+ import { useCallback as a, useMemo as o, useState as s } from "react";
7
+ import { isMimeTypeAllowed as c } from "@epam/ai-dial-attachment-input";
8
+ import { DialFileManagerTabs as l, DialFileNodeType as u, useDialFileManagerTabs as d } from "@epam/ai-dial-react-file-manager";
9
+ //#region src/files/useFileAttachmentPicker/useFileAttachmentPicker.ts
10
+ var f = ({ fileManagerOptions: f, bucket: p, forbiddenSymbolsRegExp: m, tabLabels: h, allowedTabs: g, initialTab: _, allowedTypes: v, maxSelectableFileSize: y, canAttachFolders: b = !1 }) => {
11
+ let { activeTab: x, handleTabChange: S, tabs: C } = d(h, _), [w, T] = s(() => /* @__PURE__ */ new Set()), E = a((e) => {
12
+ T(new Set(e));
13
+ }, []), D = a((e) => {
14
+ T(/* @__PURE__ */ new Set()), S(e);
15
+ }, [S]), { tabs: O } = r(x, D, C, g), k = h[x] || h[l.MyFiles], A = n({
16
+ ...f,
17
+ bucket: p,
18
+ activeTab: x,
19
+ rootLabel: k,
20
+ variant: t.Attach,
21
+ forbiddenSymbolsRegExp: m
22
+ }), j = a((e) => v == null || v.length === 0 ? !0 : c(e, v), [v]);
23
+ return {
24
+ controller: A,
25
+ activeTab: x,
26
+ tabs: O,
27
+ onTabChange: D,
28
+ selectedPaths: w,
29
+ onSelectedPathsChange: E,
30
+ isRowSelectable: a((e) => {
31
+ let t = e.data;
32
+ return t == null || i(t.path) ? !1 : t.nodeType === u.FOLDER ? b : t.nodeType === u.ITEM ? !(t.contentType != null && !j(t.contentType) || y != null && t.contentLength != null && t.contentLength > y) : !1;
33
+ }, [
34
+ b,
35
+ j,
36
+ y
37
+ ]),
38
+ isFileTypeAllowed: j,
39
+ allowedFileTypes: o(() => e(v), [v])
40
+ };
41
+ };
42
+ //#endregion
43
+ export { f as useFileAttachmentPicker };