@epam/ai-dial-chat-hooks 1.2.0-dev.6 → 1.2.0-dev.69

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 (32) hide show
  1. package/attachment/useAttachmentValidation/useAttachmentValidation.js +26 -19
  2. package/attachments.d.ts +10 -4
  3. package/catalog/map-deployment-to-catalog-item.js +2 -2
  4. package/catalog/map-skill-to-catalog-item.js +2 -2
  5. package/catalog/publish.js +2 -1
  6. package/catalog/useSkillDetailsPanelData/useSkillDetailsPanelData.js +39 -39
  7. package/catalog/useSkillItemDetails.js +19 -17
  8. package/catalog.d.ts +38 -5
  9. package/catalog.js +14 -14
  10. package/conversation/conversation-transfer/queue.js +8 -5
  11. package/conversation/stage.js +23 -0
  12. package/conversation/useAttachmentUpload/useAttachmentUpload.js +12 -5
  13. package/conversation/useConversationHandlers/useConversationHandlers.js +13 -17
  14. package/conversation/useConversationImport/useConversationImport.js +1 -1
  15. package/conversation/useConversationStream/apply-chunk.js +1 -1
  16. package/conversation/useConversationStream/useConversationStream.js +5 -1
  17. package/conversation-overlay.d.ts +7 -0
  18. package/conversation-overlay.js +2 -0
  19. package/conversation.d.ts +108 -5
  20. package/conversation.js +24 -23
  21. package/file-manager-canvas.d.ts +398 -0
  22. package/file-manager-canvas.js +2 -0
  23. package/file-manager.d.ts +0 -325
  24. package/file-manager.js +14 -15
  25. package/files/attachment-canvas.js +51 -13
  26. package/index.d.ts +238 -22
  27. package/index.js +111 -109
  28. package/mcp-apps/useMcpAppHostAdapter/useMcpAppHostAdapter.js +7 -5
  29. package/mcp-apps/useMcpAppHostContext/useMcpAppHostContext.js +1 -1
  30. package/mcp-apps/useOpenMcpAppCanvas/useOpenMcpAppCanvas.js +25 -23
  31. package/mcp-apps.d.ts +8 -6
  32. package/package.json +28 -18
@@ -4,31 +4,38 @@ import { useCallback as n, useEffect as r, useMemo as i, useRef as a } from "rea
4
4
  import { isMimeTypeAllowed as o, mimeTypesToExtensionLabels as s } from "@epam/ai-dial-attachment-input";
5
5
  //#region src/attachment/useAttachmentValidation/useAttachmentValidation.ts
6
6
  var c = 100, l = /* @__PURE__ */ function(e) {
7
- return e.NoTypesAllowed = "noTypesAllowed", e.UnsupportedType = "unsupportedType", e;
8
- }({}), u = ({ allowedMimeTypes: l, onValidationError: u, debounceMs: d = c }) => {
9
- let f = a(l);
10
- (f.current.length !== l.length || f.current.some((e, t) => e !== l[t])) && (f.current = l);
11
- let p = f.current, m = p.length > 0, h = i(() => e(p), [p]), g = a(null);
7
+ return e.NoTypesAllowed = "noTypesAllowed", e.UnsupportedType = "unsupportedType", e.FileTooLarge = "fileTooLarge", e;
8
+ }({}), u = ({ allowedMimeTypes: l, maxFileSizeBytes: u, onValidationError: d, debounceMs: f = c }) => {
9
+ let p = a(l);
10
+ (p.current.length !== l.length || p.current.some((e, t) => e !== l[t])) && (p.current = l);
11
+ let m = p.current, h = m.length > 0, g = i(() => e(m), [m]), _ = a(null), v = a(null);
12
12
  return r(() => () => {
13
- g.current != null && clearTimeout(g.current);
13
+ _.current != null && clearTimeout(_.current), v.current != null && clearTimeout(v.current);
14
14
  }, []), {
15
- inputAttachmentTypes: p,
16
- isAttachmentsAllowed: m,
15
+ inputAttachmentTypes: m,
16
+ isAttachmentsAllowed: h,
17
17
  validateAttachment: n((e) => {
18
- if (!o(e.contentType, p)) return g.current != null && clearTimeout(g.current), g.current = setTimeout(() => {
19
- let e = p.length === 0;
20
- u?.({
18
+ if (!o(e.contentType, m)) return _.current != null && clearTimeout(_.current), _.current = setTimeout(() => {
19
+ let e = m.length === 0;
20
+ d?.({
21
21
  reason: e ? "noTypesAllowed" : "unsupportedType",
22
- allowedMimeTypes: p,
23
- ...e ? {} : { formats: s(p) }
24
- }), g.current = null;
25
- }, d), t.UnsupportedType;
22
+ allowedMimeTypes: m,
23
+ ...e ? {} : { formats: s(m) }
24
+ }), _.current = null;
25
+ }, f), t.UnsupportedType;
26
+ if (u != null && e.file.size > u) return v.current != null && clearTimeout(v.current), v.current = setTimeout(() => {
27
+ d?.({
28
+ reason: "fileTooLarge",
29
+ maxFileSizeBytes: u
30
+ }), v.current = null;
31
+ }, f), t.FileTooLarge;
26
32
  }, [
27
- p,
28
- d,
29
- u
33
+ m,
34
+ u,
35
+ f,
36
+ d
30
37
  ]),
31
- fileAccept: h
38
+ fileAccept: g
32
39
  };
33
40
  };
34
41
  //#endregion
package/attachments.d.ts CHANGED
@@ -6,10 +6,12 @@ import { DisplayAttachment } from '@epam/ai-dial-chat-shared';
6
6
  export declare interface AttachmentValidationErrorEvent {
7
7
  /** Why the attachment(s) were rejected. */
8
8
  reason: AttachmentValidationErrorReason;
9
- /** The resolved MIME types the caller currently allows (possibly empty). */
10
- allowedMimeTypes: string[];
9
+ /** The resolved MIME types the caller currently allows (possibly empty). Present only when `reason` is `NoTypesAllowed` or `UnsupportedType`. */
10
+ allowedMimeTypes?: string[];
11
11
  /** Already-formatted, non-translated extension list (e.g. ".png, .jpg"), present only when `reason` is `UnsupportedType`. */
12
12
  formats?: string;
13
+ /** The size limit, in bytes, that was exceeded. Present only when `reason` is `FileTooLarge`. */
14
+ maxFileSizeBytes?: number;
13
15
  }
14
16
 
15
17
  /** Reason a rejected attachment failed validation. */
@@ -17,7 +19,9 @@ export declare enum AttachmentValidationErrorReason {
17
19
  /** No MIME types are allowed at all — attachments are disabled entirely. */
18
20
  NoTypesAllowed = "noTypesAllowed",
19
21
  /** The attachment's content type is not among the allowed MIME types. */
20
- UnsupportedType = "unsupportedType"
22
+ UnsupportedType = "unsupportedType",
23
+ /** The attachment's file size exceeds `maxFileSizeBytes`. */
24
+ FileTooLarge = "fileTooLarge"
21
25
  }
22
26
 
23
27
  /**
@@ -61,12 +65,14 @@ export declare interface UseAttachmentActionResult {
61
65
  * MIME types, debouncing a burst of rejected files into a single
62
66
  * `onValidationError` call rather than firing one per file.
63
67
  */
64
- export declare const useAttachmentValidation: ({ allowedMimeTypes, onValidationError, debounceMs, }: UseAttachmentValidationParams) => UseAttachmentValidationResult;
68
+ export declare const useAttachmentValidation: ({ allowedMimeTypes, maxFileSizeBytes, onValidationError, debounceMs, }: UseAttachmentValidationParams) => UseAttachmentValidationResult;
65
69
 
66
70
  /** Parameters for {@link useAttachmentValidation}. */
67
71
  export declare interface UseAttachmentValidationParams {
68
72
  /** Resolved MIME types currently allowed for attachments. */
69
73
  allowedMimeTypes: string[];
74
+ /** Maximum attachment file size, in bytes. When omitted, no file is rejected for size. */
75
+ maxFileSizeBytes?: number;
70
76
  /** Called with a structured event when a rejected attachment is reported, at most once per debounce window. */
71
77
  onValidationError?: (event: AttachmentValidationErrorEvent) => void;
72
78
  /** Debounce window, in ms, before firing `onValidationError` for a rejected file. Defaults to `100`. */
@@ -31,11 +31,11 @@ var c = {
31
31
  }, f = "applications/", p = "toolsets/", m = "public", h = (t, n) => (t.startsWith(n) ? t.slice(n.length) : t).split("/").filter(Boolean).map(e), g = (e, t) => {
32
32
  if (e.isMy) return [t.personal];
33
33
  let n = h(e.applicationFolder ?? "", f);
34
- return e.sharedWithMe ? [t.shared, ...n.slice(1)] : n[0]?.toLowerCase() === m ? [t.public, ...n.slice(1)] : n;
34
+ return e.sharedWithMe ? [t.shared, ...n.slice(1)] : n.length === 0 && e.type?.toLowerCase() === "application" ? [t.public] : n[0]?.toLowerCase() === m ? [t.public, ...n.slice(1)] : n;
35
35
  }, _ = (e, t) => {
36
36
  if (e.isMy && t != null) return [t.personal];
37
37
  let n = e.toolset || e.id;
38
- if (!n.startsWith(p)) return [];
38
+ if (!n.startsWith(p)) return t == null ? [] : e.sharedWithMe ? [t.shared] : n.length > 0 && !n.includes("/") ? [t.public] : [];
39
39
  let r = h(n, p).slice(0, -1);
40
40
  return e.sharedWithMe && t != null ? [t.shared, ...r.slice(1)] : r[0]?.toLowerCase() === m && t != null ? [t.public, ...r.slice(1)] : r.slice(1);
41
41
  }, v = (e, { favoriteIds: t = /* @__PURE__ */ new Set(), entityDetails: o, folderLabels: s, editableSchemaIds: c = [], isCustomAppsEditable: l = !1, activeLocale: u, primaryLocale: f, resolveIconUrl: p }) => {
@@ -115,9 +115,9 @@ var c = {
115
115
  if (Number.isFinite(t) && t > 262144) return null;
116
116
  let n = await e.arrayBuffer();
117
117
  return n.byteLength > 262144 ? null : new Uint8Array(n);
118
- }, S = async (e) => {
118
+ }, S = async (e) => new Uint8Array(await e.arrayBuffer()), C = async (e) => {
119
119
  let t = await x(e);
120
120
  return t == null ? null : new TextDecoder().decode(t);
121
121
  };
122
122
  //#endregion
123
- export { b as buildSkillContentTree, _ as buildSkillOverview, u as mapSkillToCatalogItem, x as readSkillFileBytes, S as readSkillManifest, g as resolveSkillFileDownloadPath, m as resolveSkillManifestFileId };
123
+ export { b as buildSkillContentTree, _ as buildSkillOverview, u as mapSkillToCatalogItem, x as readSkillFileBytes, S as readSkillFilePreviewBytes, C as readSkillManifest, g as resolveSkillFileDownloadPath, m as resolveSkillManifestFileId };
@@ -10,7 +10,8 @@ var n = {
10
10
  }, r = (e) => n[e], i = "public", a = (e) => e.split("/")[1] === i, o = (t) => a(t) ? t.split("/").slice(2, -1).map(e) : [], s = (e) => ({
11
11
  version: e.version,
12
12
  publishedAt: Date.parse(e.publishedAt),
13
- folderPath: e.folderPath.split("/").filter(Boolean)
13
+ folderPath: e.folderPath.split("/").filter(Boolean),
14
+ publishCredentials: e.publishCredentials
14
15
  }), c = (e) => ({
15
16
  publishedAt: Date.parse(e.publishedAt),
16
17
  folderPath: e.folderPath.split("/").filter(Boolean)
@@ -1,59 +1,59 @@
1
1
  import { SkillSource as e } from "../../skill/skill-types.js";
2
2
  import { mapSkillToCatalogItem as t } from "../map-skill-to-catalog-item.js";
3
3
  import { useSkillItemDetails as n } from "../useSkillItemDetails.js";
4
- import { useEffect as r, useMemo as i, useState as a } from "react";
4
+ import { useEffect as r, useMemo as i, useRef as a, useState as o } from "react";
5
5
  //#region src/catalog/useSkillDetailsPanelData/useSkillDetailsPanelData.ts
6
- var o = ({ api: o, skills: s, sharedWithMe: c, publicSkills: l, skillId: u, folderLabels: d, skillOverviewLabels: f, favoriteIds: p }) => {
7
- let m = i(() => [
8
- ...s,
9
- ...c ?? [],
10
- ...l ?? []
6
+ var s = ({ api: s, skills: c, sharedWithMe: l, publicSkills: u, skillId: d, folderLabels: f, skillOverviewLabels: p, favoriteIds: m }) => {
7
+ let h = i(() => [
8
+ ...c,
9
+ ...l ?? [],
10
+ ...u ?? []
11
11
  ], [
12
- s,
13
- c,
14
- l
15
- ]), { onFetchSkillDetails: h, onLoadSkillDetailsFile: g } = n({
16
- api: o,
17
- skills: m,
18
- skillOverviewLabels: f
19
- }), _ = i(() => m.find((e) => e.url === u) ?? null, [m, u]), v = i(() => s.some((e) => e.url === u) ? e.Personal : c?.some((e) => e.url === u) ? e.SharedWithMe : e.Public, [
20
- s,
21
12
  c,
13
+ l,
22
14
  u
23
- ]), y = i(() => _ == null ? null : t(_, {
24
- folderLabels: d,
25
- source: v,
26
- favoriteIds: p
15
+ ]), { onFetchSkillDetails: g, onLoadSkillDetailsFile: _ } = n({
16
+ api: s,
17
+ skills: h,
18
+ skillOverviewLabels: p
19
+ }), v = i(() => h.find((e) => e.url === d) ?? null, [h, d]), y = i(() => c.some((e) => e.url === d) ? e.Personal : l?.some((e) => e.url === d) ? e.SharedWithMe : e.Public, [
20
+ c,
21
+ l,
22
+ d
23
+ ]), b = i(() => v == null ? null : t(v, {
24
+ folderLabels: f,
25
+ source: y,
26
+ favoriteIds: m
27
27
  }), [
28
- _,
29
28
  v,
30
- d,
31
- p
32
- ]), [b, x] = a(null), [S, C] = a(!1);
29
+ y,
30
+ f,
31
+ m
32
+ ]), [x, S] = o(null), [C, w] = o(!1), T = a(0);
33
33
  return r(() => {
34
- if (y == null) return;
35
- C(!0), x(null);
36
- let e = !1;
37
- return h(y).then((t) => {
38
- e || (x(t ?? null), C(!1));
34
+ if (b == null) return;
35
+ w(!0), S(null);
36
+ let e = !1, t = ++T.current;
37
+ return g(b).then((n) => {
38
+ e || T.current !== t || (S(n ?? null), w(!1));
39
39
  }), () => {
40
40
  e = !0;
41
41
  };
42
- }, [y?.id]), {
42
+ }, [b?.id]), {
43
43
  detailsPanelItem: i(() => {
44
- if (y == null) return null;
45
- if (b == null) return y;
46
- let { credentials: e, ...t } = b;
44
+ if (b == null) return null;
45
+ if (x == null) return b;
46
+ let { credentials: e, ...t } = x;
47
47
  return {
48
- ...y,
48
+ ...b,
49
49
  details: t,
50
- credentials: e ?? y.credentials
50
+ credentials: e ?? b.credentials
51
51
  };
52
- }, [y, b]),
53
- isDetailsLoading: S,
54
- isStarred: y != null && p.has(y.id),
55
- onLoadSkillDetailsFile: g
52
+ }, [b, x]),
53
+ isDetailsLoading: C,
54
+ isStarred: b != null && m.has(b.id),
55
+ onLoadSkillDetailsFile: _
56
56
  };
57
57
  };
58
58
  //#endregion
59
- export { o as useSkillDetailsPanelData };
59
+ export { s as useSkillDetailsPanelData };
@@ -1,6 +1,6 @@
1
1
  import { SKILL_MANIFEST_FILE as e } from "../skill/skill.js";
2
2
  import { parseSkillResourceUrl as t } from "../skill/skill-types.js";
3
- import { buildSkillContentTree as n, buildSkillOverview as r, readSkillFileBytes as i, readSkillManifest as a, resolveSkillFileDownloadPath as o, resolveSkillManifestFileId as s } from "./map-skill-to-catalog-item.js";
3
+ import { buildSkillContentTree as n, buildSkillOverview as r, readSkillFilePreviewBytes as i, readSkillManifest as a, resolveSkillFileDownloadPath as o, resolveSkillManifestFileId as s } from "./map-skill-to-catalog-item.js";
4
4
  import { parseSkillManifestDocument as c } from "../skill/skill-manifest.js";
5
5
  import { useCallback as l, useRef as u } from "react";
6
6
  //#region src/catalog/useSkillItemDetails.ts
@@ -12,20 +12,24 @@ var d = ({ api: d, skills: f, skillOverviewLabels: p }) => {
12
12
  if (o == null) return;
13
13
  let { bucket: l, path: u } = o;
14
14
  m.current = o;
15
- let [h, g] = await Promise.allSettled([d.downloadSkillFile(l, u, e).then(a), d.listSkillFiles({
16
- bucket: l,
17
- path: u,
18
- filePath: "",
19
- recursive: !0
20
- })]), _ = h.status === "fulfilled" && h.value != null ? c(h.value) : void 0, v = f.find((e) => e.url === i.id), y = g.status === "fulfilled" ? r(v, g.value.items, _?.about, p) : void 0, b = g.status === "fulfilled" ? n(g.value.items, u) : [], x = g.status === "fulfilled" ? s(g.value.items, u) : e;
21
- if (!(_ == null && y == null)) return {
22
- ..._ == null ? {} : { promptContent: {
23
- content: _.body,
24
- ..._.description == null ? {} : { description: _.description },
25
- files: b,
26
- selectedFileId: x
15
+ let [h, g, _] = await Promise.allSettled([
16
+ d.downloadSkillFile(l, u, e).then(a),
17
+ d.listSkillFiles({
18
+ bucket: l,
19
+ path: u,
20
+ filePath: "",
21
+ recursive: !0
22
+ }),
23
+ d.getSkillMetadata(l, u)
24
+ ]), v = h.status === "fulfilled" && h.value != null ? c(h.value) : void 0, y = _.status === "fulfilled" ? _.value : f.find((e) => e.url === i.id), b = g.status === "fulfilled" ? r(y, g.value.items, v?.about, p) : void 0, x = g.status === "fulfilled" ? n(g.value.items, u) : [], S = g.status === "fulfilled" ? s(g.value.items, u) : e;
25
+ if (!(v == null && b == null)) return {
26
+ ...v == null ? {} : { promptContent: {
27
+ content: v.body,
28
+ ...v.description == null ? {} : { description: v.description },
29
+ files: x,
30
+ selectedFileId: S
27
31
  } },
28
- ...y == null ? {} : { overview: y }
32
+ ...b == null ? {} : { overview: b }
29
33
  };
30
34
  }, [
31
35
  d,
@@ -47,9 +51,7 @@ var d = ({ api: d, skills: f, skillOverviewLabels: p }) => {
47
51
  if (n == null) throw Error("A folder cannot be previewed");
48
52
  let r = await d.downloadSkillFile(t.bucket, t.path, n);
49
53
  if (!r.ok) throw Object.assign(/* @__PURE__ */ Error(`File preview failed with status ${r.status}`), { status: r.status });
50
- let a = await i(r);
51
- if (a == null) throw Error("File exceeds the preview size limit");
52
- let s = r.headers.get("content-type")?.split(";")[0].trim() || void 0;
54
+ let a = await i(r), s = r.headers.get("content-type")?.split(";")[0].trim() || void 0;
53
55
  return {
54
56
  bytes: a,
55
57
  mimeType: s === "application/octet-stream" ? void 0 : s
package/catalog.d.ts CHANGED
@@ -132,6 +132,13 @@ export declare const buildSkillContentTree: (files: SkillMetadataItemDto[], skil
132
132
  * authored it, when it last changed, and its file inventory. Grouping folders
133
133
  * in the file listing are excluded from both the count and the rows. Sizes are
134
134
  * not shown — the skill metadata carries no content-length field.
135
+ *
136
+ * `skill` is the authoritative `getSkillMetadata` response when that request
137
+ * fulfilled; the caller falls back to the catalog listing entry only when it
138
+ * rejected (`useSkillItemDetails`'s `onFetchSkillDetails`). Either way, this
139
+ * function never fills a gap in one source from the other — an absent
140
+ * `author` omits the row and an absent `updatedAt` leaves the updated row's
141
+ * value empty, exactly as `skill` carries it.
135
142
  */
136
143
  export declare const buildSkillOverview: (skill: SkillMetadataItemDto | undefined, files: SkillMetadataItemDto[], about: SkillAboutDetails | undefined, labels: SkillOverviewLabels) => CatalogItemOverview;
137
144
 
@@ -652,6 +659,24 @@ export declare interface PublishApiClient {
652
659
  */
653
660
  export declare const readSkillFileBytes: (response: Response) => Promise<Uint8Array | null>;
654
661
 
662
+ /**
663
+ * Reads a skill file response as raw bytes with no size ceiling, for the
664
+ * supporting-file **preview** path.
665
+ *
666
+ * Previews are user-initiated, one file at a time, and a realistic binary
667
+ * (a PDF, an image) routinely exceeds `SKILL_MANIFEST_MAX_BYTES` — a cap
668
+ * sized for `SKILL.md` frontmatter, not for binaries — so applying that cap
669
+ * here rejected virtually every real PDF before it was ever decoded. This
670
+ * reader therefore never returns `null`: file size is not a failure class on
671
+ * the preview path.
672
+ *
673
+ * `readSkillFileBytes` and `readSkillManifest` keep their
674
+ * `SKILL_MANIFEST_MAX_BYTES` ceiling, because they feed the manifest parse
675
+ * and the textual Content-tab read, where an oversized body must never be
676
+ * decoded into a string.
677
+ */
678
+ export declare const readSkillFilePreviewBytes: (response: Response) => Promise<Uint8Array>;
679
+
655
680
  /**
656
681
  * Reads a skill manifest response as text, or `null` when the body is larger
657
682
  * than `SKILL_MANIFEST_MAX_BYTES`. The size is checked before decoding, so an
@@ -681,7 +706,8 @@ export declare const reconcileFilterTopics: (persistedTopics: ReadonlySet<string
681
706
  */
682
707
  export declare const resolveCatalogPrimaryAction: (item: CatalogItem, fetchPrompt: (item: CatalogItem) => Promise<PromptResponseDto>) => Promise<CatalogPrimaryActionResult>;
683
708
 
684
- export declare const resolveDeploymentFolder: (deployment: Pick<DeploymentItemDto, "isMy" | "sharedWithMe" | "applicationFolder">, labels: DeploymentFolderLabels) => string[];
709
+ /** Resolves a deployment's display folder, including organization applications without a folder path. */
710
+ export declare const resolveDeploymentFolder: (deployment: Pick<DeploymentItemDto, "isMy" | "sharedWithMe" | "applicationFolder"> & Partial<Pick<DeploymentItemDto, "type">>, labels: DeploymentFolderLabels) => string[];
685
711
 
686
712
  /** Returns the MCP resource kind a catalog item's Connect endpoint belongs to, or `null` when the item exposes no MCP endpoint. */
687
713
  export declare const resolveMcpResourceKind: (type: CatalogEntityType, supportsMcp?: boolean) => McpResourceKind | null;
@@ -738,6 +764,12 @@ export declare interface SkillDetailsApi {
738
764
  limit?: number;
739
765
  recursive?: boolean;
740
766
  }, signal?: AbortSignal): Promise<SkillFileListResponseDto>;
767
+ /**
768
+ * Fetches a single skill's own authoritative metadata (`author`,
769
+ * `updatedAt`, and the rest of `SkillMetadataItemDto`) — not the catalog
770
+ * listing entry, which may be sparse for a shared skill.
771
+ */
772
+ getSkillMetadata(bucket: string, path: string, signal?: AbortSignal): Promise<SkillMetadataItemDto>;
741
773
  }
742
774
 
743
775
  /** A skill's parsed manifest details. */
@@ -1199,10 +1231,11 @@ export declare interface UseSkillFilePreviewResult {
1199
1231
 
1200
1232
  /**
1201
1233
  * Headless hook that encapsulates skill detail fetching: manifest download and
1202
- * parse, package file listing, overview construction, and in-package file
1203
- * loads. `useCatalogItemDetails` delegates its skill branch here; hosts that
1204
- * only surface skill details consume this hook directly, without the
1205
- * deployment and prompt ports the full catalog pipeline requires.
1234
+ * parse, package file listing, authoritative metadata fetching, overview
1235
+ * construction, and in-package file loads. `useCatalogItemDetails` delegates
1236
+ * its skill branch here; hosts that only surface skill details consume this
1237
+ * hook directly, without the deployment and prompt ports the full catalog
1238
+ * pipeline requires.
1206
1239
  */
1207
1240
  export declare const useSkillItemDetails: ({ api, skills, skillOverviewLabels, }: UseSkillItemDetailsOptions) => UseSkillItemDetailsResult;
1208
1241
 
package/catalog.js CHANGED
@@ -8,17 +8,17 @@ import { mapDeploymentDetailsDtoToEntityDetails as u, mapEntityDetailsToCatalogD
8
8
  import { mapDeploymentToCatalogItem as p, mapDeploymentToolsetCredentials as m, mapToolsetToCatalogItem as h, resolveDeploymentFolder as g } from "./catalog/map-deployment-to-catalog-item.js";
9
9
  import { buildPromptOverview as _, isOrganisationPromptItem as v, mapPromptToCatalogItem as y } from "./catalog/map-prompt-to-catalog-item.js";
10
10
  import { PUBLIC_SKILL_BUCKET as b, SKILL_LISTING_MAX_PAGES as x, SKILL_LISTING_PAGE_SIZE as S, SKILL_MANIFEST_MAX_BYTES as C, SkillSource as w, parseSkillResourceUrl as T } from "./skill/skill-types.js";
11
- import { buildSkillContentTree as E, buildSkillOverview as D, mapSkillToCatalogItem as O, readSkillFileBytes as k, readSkillManifest as A, resolveSkillFileDownloadPath as j, resolveSkillManifestFileId as M } from "./catalog/map-skill-to-catalog-item.js";
12
- import { McpResourceKind as N, buildApplicationMcpUrl as P, buildConnectApi as F, buildToolsetMcpUrl as I, resolveMcpResourceKind as L } from "./catalog/mcp-endpoint-url.js";
13
- import { getPublicCatalogEntityFolderPath as R, isPublicCatalogEntityId as z, mapPublishConversationResultDto as B, mapPublishHistoryEntryDto as V, toPublishEntityType as H } from "./catalog/publish.js";
14
- import { deriveAvailableTabIds as U, deriveFavoriteItems as W, filterCatalogItemsBySelector as G, filterHiddenOwnedItems as K, reconcileFilterTopics as q } from "./catalog/catalog-derivations.js";
15
- import { CatalogPrimaryActionType as J, resolveCatalogPrimaryAction as Y } from "./catalog/catalog-primary-action.js";
16
- import { useCatalogEditNavigation as X } from "./catalog/useCatalogEditNavigation/useCatalogEditNavigation.js";
17
- import { useSkillItemDetails as Z } from "./catalog/useSkillItemDetails.js";
18
- import { useCatalogItemDetails as Q } from "./catalog/useCatalogItemDetails.js";
19
- import { useCatalogToolsetCredentials as $ } from "./catalog/useCatalogToolsetCredentials/useCatalogToolsetCredentials.js";
20
- import { useSkillDetailsPanelData as ee } from "./catalog/useSkillDetailsPanelData/useSkillDetailsPanelData.js";
21
- import { FavoriteEntityType as te, useFavoriteEntitiesState as ne } from "./catalog/useFavoriteEntitiesState/useFavoriteEntitiesState.js";
22
- import { usePublishFolders as re } from "./catalog/usePublishFolders/usePublishFolders.js";
23
- import { SkillPreviewErrorKind as ie, useSkillFilePreview as ae } from "./skill/useSkillFilePreview.js";
24
- export { s as AuthenticationType, J as CatalogPrimaryActionType, te as FavoriteEntityType, N as McpResourceKind, b as PUBLIC_SKILL_BUCKET, x as SKILL_LISTING_MAX_PAGES, S as SKILL_LISTING_PAGE_SIZE, C as SKILL_MANIFEST_MAX_BYTES, ie as SkillPreviewErrorKind, w as SkillSource, P as buildApplicationMcpUrl, n as buildChatCompletionsUrl, F as buildConnectApi, r as buildDeploymentConnectApi, _ as buildPromptOverview, i as buildResponsesUrl, E as buildSkillContentTree, D as buildSkillOverview, I as buildToolsetMcpUrl, e as createPublishApiClient, U as deriveAvailableTabIds, W as deriveFavoriteItems, a as encodeDeploymentId, G as filterCatalogItemsBySelector, K as filterHiddenOwnedItems, o as findDeploymentByIdOrReference, R as getPublicCatalogEntityFolderPath, v as isOrganisationPromptItem, z as isPublicCatalogEntityId, u as mapDeploymentDetailsDtoToEntityDetails, c as mapDeploymentLimitsDtoToCatalogLimits, l as mapDeploymentLimitsToInput, p as mapDeploymentToCatalogItem, m as mapDeploymentToolsetCredentials, d as mapEntityDetailsToCatalogDetails, y as mapPromptToCatalogItem, B as mapPublishConversationResultDto, V as mapPublishHistoryEntryDto, O as mapSkillToCatalogItem, f as mapToolsetCredentials, h as mapToolsetToCatalogItem, T as parseSkillResourceUrl, k as readSkillFileBytes, A as readSkillManifest, q as reconcileFilterTopics, Y as resolveCatalogPrimaryAction, g as resolveDeploymentFolder, L as resolveMcpResourceKind, j as resolveSkillFileDownloadPath, M as resolveSkillManifestFileId, H as toPublishEntityType, t as toPublishRuleDto, X as useCatalogEditNavigation, Q as useCatalogItemDetails, $ as useCatalogToolsetCredentials, ne as useFavoriteEntitiesState, re as usePublishFolders, ee as useSkillDetailsPanelData, ae as useSkillFilePreview, Z as useSkillItemDetails };
11
+ import { buildSkillContentTree as E, buildSkillOverview as D, mapSkillToCatalogItem as O, readSkillFileBytes as k, readSkillFilePreviewBytes as A, readSkillManifest as j, resolveSkillFileDownloadPath as M, resolveSkillManifestFileId as N } from "./catalog/map-skill-to-catalog-item.js";
12
+ import { McpResourceKind as P, buildApplicationMcpUrl as F, buildConnectApi as I, buildToolsetMcpUrl as L, resolveMcpResourceKind as R } from "./catalog/mcp-endpoint-url.js";
13
+ import { getPublicCatalogEntityFolderPath as z, isPublicCatalogEntityId as B, mapPublishConversationResultDto as V, mapPublishHistoryEntryDto as H, toPublishEntityType as U } from "./catalog/publish.js";
14
+ import { deriveAvailableTabIds as W, deriveFavoriteItems as G, filterCatalogItemsBySelector as K, filterHiddenOwnedItems as q, reconcileFilterTopics as J } from "./catalog/catalog-derivations.js";
15
+ import { CatalogPrimaryActionType as Y, resolveCatalogPrimaryAction as X } from "./catalog/catalog-primary-action.js";
16
+ import { useCatalogEditNavigation as Z } from "./catalog/useCatalogEditNavigation/useCatalogEditNavigation.js";
17
+ import { useSkillItemDetails as Q } from "./catalog/useSkillItemDetails.js";
18
+ import { useCatalogItemDetails as $ } from "./catalog/useCatalogItemDetails.js";
19
+ import { useCatalogToolsetCredentials as ee } from "./catalog/useCatalogToolsetCredentials/useCatalogToolsetCredentials.js";
20
+ import { useSkillDetailsPanelData as te } from "./catalog/useSkillDetailsPanelData/useSkillDetailsPanelData.js";
21
+ import { FavoriteEntityType as ne, useFavoriteEntitiesState as re } from "./catalog/useFavoriteEntitiesState/useFavoriteEntitiesState.js";
22
+ import { usePublishFolders as ie } from "./catalog/usePublishFolders/usePublishFolders.js";
23
+ import { SkillPreviewErrorKind as ae, useSkillFilePreview as oe } from "./skill/useSkillFilePreview.js";
24
+ export { s as AuthenticationType, Y as CatalogPrimaryActionType, ne as FavoriteEntityType, P as McpResourceKind, b as PUBLIC_SKILL_BUCKET, x as SKILL_LISTING_MAX_PAGES, S as SKILL_LISTING_PAGE_SIZE, C as SKILL_MANIFEST_MAX_BYTES, ae as SkillPreviewErrorKind, w as SkillSource, F as buildApplicationMcpUrl, n as buildChatCompletionsUrl, I as buildConnectApi, r as buildDeploymentConnectApi, _ as buildPromptOverview, i as buildResponsesUrl, E as buildSkillContentTree, D as buildSkillOverview, L as buildToolsetMcpUrl, e as createPublishApiClient, W as deriveAvailableTabIds, G as deriveFavoriteItems, a as encodeDeploymentId, K as filterCatalogItemsBySelector, q as filterHiddenOwnedItems, o as findDeploymentByIdOrReference, z as getPublicCatalogEntityFolderPath, v as isOrganisationPromptItem, B as isPublicCatalogEntityId, u as mapDeploymentDetailsDtoToEntityDetails, c as mapDeploymentLimitsDtoToCatalogLimits, l as mapDeploymentLimitsToInput, p as mapDeploymentToCatalogItem, m as mapDeploymentToolsetCredentials, d as mapEntityDetailsToCatalogDetails, y as mapPromptToCatalogItem, V as mapPublishConversationResultDto, H as mapPublishHistoryEntryDto, O as mapSkillToCatalogItem, f as mapToolsetCredentials, h as mapToolsetToCatalogItem, T as parseSkillResourceUrl, k as readSkillFileBytes, A as readSkillFilePreviewBytes, j as readSkillManifest, J as reconcileFilterTopics, X as resolveCatalogPrimaryAction, g as resolveDeploymentFolder, R as resolveMcpResourceKind, M as resolveSkillFileDownloadPath, N as resolveSkillManifestFileId, U as toPublishEntityType, t as toPublishRuleDto, Z as useCatalogEditNavigation, $ as useCatalogItemDetails, ee as useCatalogToolsetCredentials, re as useFavoriteEntitiesState, ie as usePublishFolders, te as useSkillDetailsPanelData, oe as useSkillFilePreview, Q as useSkillItemDetails };
@@ -27,13 +27,14 @@ var o = () => {
27
27
  progress: { percent: 100 },
28
28
  errorCode: void 0
29
29
  });
30
- }, [u]), m = n((t, n) => {
31
- s((r) => r.map((r) => r.id !== t || r.status !== e.InProgress ? r : {
32
- ...r,
30
+ }, [u]), m = n((t, n, r) => {
31
+ s((i) => i.map((i) => i.id !== t || i.status !== e.InProgress ? i : {
32
+ ...i,
33
33
  status: e.Warning,
34
34
  progress: { percent: 100 },
35
35
  errorCode: void 0,
36
- warningCode: n
36
+ warningCode: n,
37
+ warningNames: r
37
38
  }));
38
39
  }, []), h = n((t, n) => {
39
40
  u(t, {
@@ -57,7 +58,9 @@ var o = () => {
57
58
  return l.current.set(t, () => (u(t, {
58
59
  status: e.InProgress,
59
60
  progress: { percent: 0 },
60
- errorCode: void 0
61
+ errorCode: void 0,
62
+ warningCode: void 0,
63
+ warningNames: void 0
61
64
  }), r())), r();
62
65
  }, [u]);
63
66
  return r(() => {
@@ -0,0 +1,23 @@
1
+ import { StageStatus as e } from "@epam/ai-dial-chat-shared";
2
+ //#region src/conversation/stage.ts
3
+ var t = (t) => t === e.Completed ? e.Completed : t === e.Failed ? e.Failed : null, n = (e) => ({
4
+ title: e.title ?? "",
5
+ ...e.index != null && { index: e.index },
6
+ ...e.type != null && { type: e.type },
7
+ ...e.data != null && { data: e.data },
8
+ ...e.url != null && { url: e.url },
9
+ ...e.reference_type != null && { reference_type: e.reference_type },
10
+ ...e.reference_url != null && { reference_url: e.reference_url }
11
+ }), r = (e) => ({
12
+ index: e.index ?? 0,
13
+ name: e.name ?? "",
14
+ status: t(e.status),
15
+ ...e.content != null && { content: e.content },
16
+ ...e.tag != null && { tag: e.tag },
17
+ ...e.attachments?.length && { attachments: e.attachments.map(n) }
18
+ }), i = (e) => {
19
+ let t = Array.isArray(e) ? e : e?.custom_content?.stages ?? e?.customContent?.stages;
20
+ if (t?.length) return t.map(r);
21
+ };
22
+ //#endregion
23
+ export { i as mapStages, r as toStage };
@@ -26,9 +26,16 @@ var o = 700, s = 5, c = (e) => t(e.split("/").filter(Boolean).pop() ?? "file").r
26
26
  })).url,
27
27
  name: a.fileName
28
28
  };
29
- } catch (t) {
30
- if (l(t)) {
29
+ } catch (c) {
30
+ if (l(c)) {
31
31
  if (i.markTaken(a.fileName), o < s) {
32
+ if (t.listFiles) try {
33
+ let e = await t.listFiles({
34
+ bucket: u,
35
+ path: a.path.slice(0, a.path.lastIndexOf("/"))
36
+ });
37
+ for (let t of e.items) i.markTaken(t.name);
38
+ } catch {}
32
39
  a = i.allocate(n);
33
40
  continue;
34
41
  }
@@ -38,10 +45,10 @@ var o = 700, s = 5, c = (e) => t(e.split("/").filter(Boolean).pop() ?? "file").r
38
45
  let e = p.current.splice(0);
39
46
  d?.(e), m.current = null;
40
47
  }, f);
41
- let n = t instanceof Error ? t : /* @__PURE__ */ Error("Network upload failed");
42
- throw n.errorReason = r.Network, n;
48
+ let t = c instanceof Error ? c : /* @__PURE__ */ Error("Network upload failed");
49
+ throw t.errorReason = r.Network, t;
43
50
  }
44
- throw t;
51
+ throw c;
45
52
  }
46
53
  }, [
47
54
  u,
@@ -44,23 +44,19 @@ var p = ({ conversation: p, conversationId: m, bucket: h, isStreaming: g, startS
44
44
  if (g || !m || !p || e === -1 || p.messages[e]?.role !== c.Assistant) return;
45
45
  let t = p.messages[e - 1];
46
46
  if (!t || t.role !== c.User) return;
47
- let n = C();
48
- v((t) => {
49
- if (!t) return t;
50
- let r = {
51
- ...t.messages[e],
52
- content: "",
53
- custom_content: void 0,
54
- wasStoppedByUser: void 0,
55
- stoppedWithoutContent: void 0,
56
- streamErrorMessage: void 0,
57
- deploymentId: n
58
- }, i = {
59
- ...t,
60
- messages: [...t.messages.slice(0, e), r]
61
- };
62
- return y.current = i, i;
63
- }), A((t) => new Set([...t].filter((t) => t < e))), _(m, t.content, e, n, t.custom_content, l(), f.Regenerate);
47
+ let n = C(), r = {
48
+ ...p.messages[e],
49
+ content: "",
50
+ custom_content: void 0,
51
+ wasStoppedByUser: void 0,
52
+ stoppedWithoutContent: void 0,
53
+ streamErrorMessage: void 0,
54
+ deploymentId: n
55
+ }, i = {
56
+ ...p,
57
+ messages: [...p.messages.slice(0, e), r]
58
+ };
59
+ y.current = i, v(i), A((t) => new Set([...t].filter((t) => t < e))), _(m, t.content, e, n, t.custom_content, l(), f.Regenerate);
64
60
  }, [
65
61
  p,
66
62
  m,
@@ -191,7 +191,7 @@ var b = 5, x = 5, S = (e) => /\.(dial|zip)$/i.test(e.name), C = (e) => new Promi
191
191
  jobId: n,
192
192
  code: t.AttachmentSkipped,
193
193
  names: [...j]
194
- }), A.length > 0 ? D.failJob(n, h.Unknown) : j.size > 0 ? D.warnJob(n, t.AttachmentSkipped) : D.succeedJob(n);
194
+ }), A.length > 0 ? D.failJob(n, h.Unknown) : j.size > 0 ? D.warnJob(n, t.AttachmentSkipped, [...j]) : D.succeedJob(n);
195
195
  }
196
196
  }, [
197
197
  l,
@@ -75,4 +75,4 @@ var t = (e) => {
75
75
  });
76
76
  };
77
77
  //#endregion
78
- export { o as applyChunkToMessages };
78
+ export { o as applyChunkToMessages, a as mergeStages };
@@ -86,7 +86,11 @@ var m = 2e4, h = ({ conversationId: h, state: { setConversation: g, conversation
86
86
  };
87
87
  (async () => {
88
88
  try {
89
- let e = x?.channelId ?? await x?.waitForChannel(m) ?? void 0;
89
+ let e = x?.channelId ?? await x?.waitForChannel(m) ?? void 0, t = N.current.has(h);
90
+ if (D.signal.aborted || E() || t) {
91
+ M.current.get(C)?.generationId === h && M.current.delete(C), E() || R(C), k.current === h && (k.current = null, A.current = null, O(null)), b(C, h), x?.notifyGenerationSettled?.(), t ? N.current.delete(h) : E() || S?.notifyGenerationEnd?.();
92
+ return;
93
+ }
90
94
  v.streamCompletion(C, o, l, F, u, h, f, T, e);
91
95
  } catch (e) {
92
96
  F.onError(e instanceof Error ? e : Error(String(e)));
@@ -0,0 +1,7 @@
1
+ import { Message } from '@epam/ai-dial-chat-shared';
2
+ import { OverlayChatMessage } from '@epam/ai-dial-chat-overlay';
3
+
4
+ /** Maps chat messages to the DIAL Chat Overlay protocol's message shape. */
5
+ export declare const toOverlayMessages: (messages: Message[]) => OverlayChatMessage[];
6
+
7
+ export { }
@@ -0,0 +1,2 @@
1
+ import { toOverlayMessages as e } from "./conversation/overlay-messages.js";
2
+ export { e as toOverlayMessages };