@epam/ai-dial-chat-hooks 1.2.0-dev.148 → 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.
@@ -4,7 +4,7 @@ import { getModelIdFromConversationId as n } from "../get-model-id-from-conversa
4
4
  import { FilterTab as r } from "@epam/ai-dial-chat-shared";
5
5
  import { useMemo as i } from "react";
6
6
  //#region src/conversation/useConversationPanelItems/useConversationPanelItems.ts
7
- var a = (e) => e.sharedWithMe ? r.Shared : e.publishedWithMe ? r.Organization : r.MyChats, o = ({ items: r, deployments: o, isDeploymentsLoading: s, toPanelConversationId: c, resolveIconUrl: l, resolveIconTooltip: u, resolveHref: d, resolveTaskBadge: f }) => i(() => r.map((r) => {
7
+ var a = (e) => e.sharedWithMe ? r.Shared : e.publishedWithMe ? r.Organization : r.MyChats, o = ({ items: r, deployments: o, isDeploymentsLoading: s, toPanelConversationId: c, resolveIconUrl: l, resolveIconTooltip: u, resolveHref: d, resolveTaskPresentation: f }) => i(() => r.map((r) => {
8
8
  let i = c(r.id), p = n(r.id), m = p ? t(o, p) : void 0, h = p ? e(p.split("/").pop() ?? p) : "", g = f?.(r);
9
9
  return {
10
10
  id: i,
@@ -16,8 +16,7 @@ var a = (e) => e.sharedWithMe ? r.Shared : e.publishedWithMe ? r.Organization :
16
16
  source: a(r),
17
17
  href: d(i),
18
18
  ...g == null ? {} : {
19
- showTaskBadge: !0,
20
- taskBadgeLabel: g.label,
19
+ leadingIcon: g.leadingIcon,
21
20
  isUnread: g.isUnread
22
21
  }
23
22
  };
package/conversation.d.ts CHANGED
@@ -1006,9 +1006,8 @@ export declare interface UseConversationLookupMapsParams {
1006
1006
  * panel's item contract. All app-specific concerns (icon URL resolution,
1007
1007
  * route generation, id normalisation) are injected via resolver callbacks.
1008
1008
  */
1009
- export declare const useConversationPanelItems: ({ items, deployments, isDeploymentsLoading, toPanelConversationId, resolveIconUrl, resolveIconTooltip, resolveHref, resolveTaskBadge, }: UseConversationPanelItemsParams) => {
1010
- showTaskBadge?: boolean | undefined;
1011
- taskBadgeLabel?: string | undefined;
1009
+ export declare const useConversationPanelItems: ({ items, deployments, isDeploymentsLoading, toPanelConversationId, resolveIconUrl, resolveIconTooltip, resolveHref, resolveTaskPresentation, }: UseConversationPanelItemsParams) => {
1010
+ leadingIcon?: ReactNode;
1012
1011
  isUnread?: boolean | undefined;
1013
1012
  id: string;
1014
1013
  title: string;
@@ -1044,11 +1043,12 @@ export declare interface UseConversationPanelItemsResolvers {
1044
1043
  /** Resolves the href to navigate to when the conversation row is clicked. */
1045
1044
  resolveHref: (panelConversationId: string) => string;
1046
1045
  /**
1047
- * Returns badge metadata for a scheduled-task conversation, or `undefined`
1048
- * when the item should not show a task badge.
1046
+ * Returns the row presentation for a scheduled-task conversation — a
1047
+ * host-rendered leading icon that replaces the deployment avatar, and the
1048
+ * unread flag — or `undefined` for an ordinary conversation.
1049
1049
  */
1050
- resolveTaskBadge?: (item: ConversationListItemDto) => {
1051
- label: string;
1050
+ resolveTaskPresentation?: (item: ConversationListItemDto) => {
1051
+ leadingIcon?: ReactNode;
1052
1052
  isUnread: boolean;
1053
1053
  } | undefined;
1054
1054
  }
package/index.d.ts CHANGED
@@ -4900,9 +4900,8 @@ export declare interface UseConversationLookupMapsParams {
4900
4900
  * panel's item contract. All app-specific concerns (icon URL resolution,
4901
4901
  * route generation, id normalisation) are injected via resolver callbacks.
4902
4902
  */
4903
- export declare const useConversationPanelItems: ({ items, deployments, isDeploymentsLoading, toPanelConversationId, resolveIconUrl, resolveIconTooltip, resolveHref, resolveTaskBadge, }: UseConversationPanelItemsParams) => {
4904
- showTaskBadge?: boolean | undefined;
4905
- taskBadgeLabel?: string | undefined;
4903
+ export declare const useConversationPanelItems: ({ items, deployments, isDeploymentsLoading, toPanelConversationId, resolveIconUrl, resolveIconTooltip, resolveHref, resolveTaskPresentation, }: UseConversationPanelItemsParams) => {
4904
+ leadingIcon?: ReactNode;
4906
4905
  isUnread?: boolean | undefined;
4907
4906
  id: string;
4908
4907
  title: string;
@@ -4938,11 +4937,12 @@ export declare interface UseConversationPanelItemsResolvers {
4938
4937
  /** Resolves the href to navigate to when the conversation row is clicked. */
4939
4938
  resolveHref: (panelConversationId: string) => string;
4940
4939
  /**
4941
- * Returns badge metadata for a scheduled-task conversation, or `undefined`
4942
- * when the item should not show a task badge.
4940
+ * Returns the row presentation for a scheduled-task conversation — a
4941
+ * host-rendered leading icon that replaces the deployment avatar, and the
4942
+ * unread flag — or `undefined` for an ordinary conversation.
4943
4943
  */
4944
- resolveTaskBadge?: (item: ConversationListItemDto) => {
4945
- label: string;
4944
+ resolveTaskPresentation?: (item: ConversationListItemDto) => {
4945
+ leadingIcon?: ReactNode;
4946
4946
  isUnread: boolean;
4947
4947
  } | undefined;
4948
4948
  }
@@ -6079,7 +6079,7 @@ export declare interface UseSkillEditorLoadResult {
6079
6079
  * `client.createSkill`/`client.updateSkill`, and mapping the resulting
6080
6080
  * success/error/conflict outcomes to presentable state.
6081
6081
  */
6082
- export declare const useSkillEditorSubmit: ({ bucket, isEditMode, files, filesContentRef, frontmatterRef, loadedPathRef, etagRef, returnUrl, refetchSkills, client, messages, onNavigate, onNotify, }: UseSkillEditorSubmitParams) => UseSkillEditorSubmitResult;
6082
+ export declare const useSkillEditorSubmit: ({ bucket, isEditMode, files, filesContentRef, frontmatterRef, loadedPathRef, etagRef, returnUrl, getCreateReturnUrl, refetchSkills, client, messages, onNavigate, onNotify, }: UseSkillEditorSubmitParams) => UseSkillEditorSubmitResult;
6083
6083
 
6084
6084
  /** Parameters accepted by {@link useSkillEditorSubmit}. */
6085
6085
  export declare interface UseSkillEditorSubmitParams {
@@ -6099,6 +6099,8 @@ export declare interface UseSkillEditorSubmitParams {
6099
6099
  etagRef: React.MutableRefObject<string | undefined>;
6100
6100
  /** Where to navigate on a successful save. */
6101
6101
  returnUrl: string;
6102
+ /** Resolves the destination after creation from the normalized skill path. Defaults to `returnUrl`. */
6103
+ getCreateReturnUrl?: (path: string) => string;
6102
6104
  /** Refetches the host's skill listing after a successful save. */
6103
6105
  refetchSkills: () => Promise<void>;
6104
6106
  /** Already-configured create/update operations. */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@epam/ai-dial-chat-hooks",
3
3
  "description": "Framework-level React hooks extracted from AI DIAL Chat for building custom chat interfaces",
4
- "version": "1.2.0-dev.148",
4
+ "version": "1.2.0-dev.152",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
7
7
  "main": "./index.js",
@@ -111,7 +111,7 @@
111
111
  }
112
112
  },
113
113
  "dependencies": {
114
- "@epam/ai-dial-chat-api-client": "1.2.0-dev.148",
114
+ "@epam/ai-dial-chat-api-client": "1.2.0-dev.152",
115
115
  "dompurify": "3.4.15",
116
116
  "fflate": "^0.8.3",
117
117
  "lru-cache": "^10.4.3",
@@ -120,22 +120,22 @@
120
120
  },
121
121
  "peerDependencies": {
122
122
  "react": "^19.2.8",
123
- "@epam/ai-dial-attachment-canvas": "1.2.0-dev.148",
124
- "@epam/ai-dial-attachment-input": "1.2.0-dev.148",
125
- "@epam/ai-dial-builder-form": "1.2.0-dev.148",
126
- "@epam/ai-dial-catalog": "1.2.0-dev.148",
127
- "@epam/ai-dial-chat-overlay": "1.2.0-dev.148",
128
- "@epam/ai-dial-chat-shared": "1.2.0-dev.148",
129
- "@epam/ai-dial-mcp-apps": "1.2.0-dev.148",
130
- "@epam/ai-dial-publish-panel": "1.2.0-dev.148",
131
- "@epam/ai-dial-quotations": "1.2.0-dev.148",
132
- "@epam/ai-dial-react-file-manager": "^0.3.0-dev.4",
133
- "@epam/ai-dial-scheduled-tasks": "1.2.0-dev.148",
134
- "@epam/ai-dial-share": "1.2.0-dev.148",
135
- "@epam/ai-dial-skill-editor": "1.2.0-dev.148",
136
- "@epam/ai-dial-source-panel": "1.2.0-dev.148",
137
- "@epam/ai-dial-ui-kit": "^0.15.0-dev.18",
138
- "@epam/ai-dial-usage-dashboard": "1.2.0-dev.148",
123
+ "@epam/ai-dial-attachment-canvas": "1.2.0-dev.152",
124
+ "@epam/ai-dial-attachment-input": "1.2.0-dev.152",
125
+ "@epam/ai-dial-builder-form": "1.2.0-dev.152",
126
+ "@epam/ai-dial-catalog": "1.2.0-dev.152",
127
+ "@epam/ai-dial-chat-overlay": "1.2.0-dev.152",
128
+ "@epam/ai-dial-chat-shared": "1.2.0-dev.152",
129
+ "@epam/ai-dial-mcp-apps": "1.2.0-dev.152",
130
+ "@epam/ai-dial-publish-panel": "1.2.0-dev.152",
131
+ "@epam/ai-dial-quotations": "1.2.0-dev.152",
132
+ "@epam/ai-dial-react-file-manager": "^0.3.0-dev.7",
133
+ "@epam/ai-dial-scheduled-tasks": "1.2.0-dev.152",
134
+ "@epam/ai-dial-share": "1.2.0-dev.152",
135
+ "@epam/ai-dial-skill-editor": "1.2.0-dev.152",
136
+ "@epam/ai-dial-source-panel": "1.2.0-dev.152",
137
+ "@epam/ai-dial-ui-kit": "^0.15.0-dev.19",
138
+ "@epam/ai-dial-usage-dashboard": "1.2.0-dev.152",
139
139
  "@modelcontextprotocol/sdk": "^1.29.0",
140
140
  "@epam/pdf-highlighter-kit": "^0.0.19",
141
141
  "@mcp-ui/client": "^7.1.1"
@@ -6,43 +6,43 @@ import { NotificationVariant as u } from "@epam/ai-dial-ui-kit";
6
6
  var d = (e, t) => JSON.stringify({
7
7
  values: e,
8
8
  files: [...t].sort((e, t) => e.path.localeCompare(t.path))
9
- }), f = ({ bucket: f, isEditMode: p, files: m, filesContentRef: h, frontmatterRef: g, loadedPathRef: _, etagRef: v, returnUrl: y, refetchSkills: b, client: x, messages: S, onNavigate: C, onNotify: w }) => {
10
- let [T, E] = l({}), [D, O] = l(), [k, A] = l(!1), [j, M] = l(), [N, P] = l("idle"), F = c(null), I = c(null), L = s(async (n) => {
9
+ }), f = ({ bucket: f, isEditMode: p, files: m, filesContentRef: h, frontmatterRef: g, loadedPathRef: _, etagRef: v, returnUrl: y, getCreateReturnUrl: b, refetchSkills: x, client: S, messages: C, onNavigate: w, onNotify: T }) => {
10
+ let [E, D] = l({}), [O, k] = l(), [A, j] = l(!1), [M, N] = l(), [P, F] = l("idle"), I = c(null), L = c(null), R = s(async (n) => {
11
11
  switch (t(n)) {
12
12
  case 409:
13
- E({ name: S.nameConflict });
13
+ D({ name: C.nameConflict });
14
14
  return;
15
15
  case 412:
16
- E({ name: S.nameConflict });
16
+ D({ name: C.nameConflict });
17
17
  return;
18
18
  case 413:
19
- O(S.archiveTooLarge);
19
+ k(C.archiveTooLarge);
20
20
  return;
21
21
  case 503:
22
- O(S.serviceUnavailable), A(!0);
22
+ k(C.serviceUnavailable), j(!0);
23
23
  return;
24
24
  case 400: {
25
25
  let { message: t } = await e(n);
26
- O(t ?? S.pathInvalid);
26
+ k(t ?? C.pathInvalid);
27
27
  return;
28
28
  }
29
29
  default: {
30
30
  let { traceId: t } = await e(n);
31
- O(S.saveError), w({
31
+ k(C.saveError), T({
32
32
  variant: u.Error,
33
- message: S.saveError,
33
+ message: C.saveError,
34
34
  requestId: t
35
35
  });
36
36
  }
37
37
  }
38
- }, [S, w]), R = s(async (e) => {
38
+ }, [C, T]), z = s(async (e) => {
39
39
  let t = a(e.name);
40
40
  if (!t || !i(t)) {
41
- E({ name: S.nameInvalid });
41
+ D({ name: C.nameInvalid });
42
42
  return;
43
43
  }
44
- let o = d(e, m), s = F.current, c = s != null && s.fingerprint === o, l = t, p, _, v;
45
- c ? {skillManifest: p, filePaths: _, files: v} = s : (p = r(g.current, t, e.description, e.instructions), {filePaths: _, files: v} = n(m, h.current)), P("submitting"), F.current = {
44
+ let o = d(e, m), s = I.current, c = s != null && s.fingerprint === o, l = t, p, _, v;
45
+ c ? {skillManifest: p, filePaths: _, files: v} = s : (p = r(g.current, t, e.description, e.instructions), {filePaths: _, files: v} = n(m, h.current)), F("submitting"), I.current = {
46
46
  fingerprint: o,
47
47
  bucket: f,
48
48
  path: l,
@@ -51,46 +51,47 @@ var d = (e, t) => JSON.stringify({
51
51
  files: v
52
52
  };
53
53
  try {
54
- await x.createSkill(f, l, p, _, v), await b(), P("success"), w({
54
+ await S.createSkill(f, l, p, _, v), await x(), F("success"), T({
55
55
  variant: u.Success,
56
- title: S.saveSuccessTitle,
57
- message: S.createSuccess(t)
58
- }), C(y);
56
+ title: C.saveSuccessTitle,
57
+ message: C.createSuccess(t)
58
+ }), w(b?.(l) ?? y);
59
59
  } catch (e) {
60
- P("failure"), await L(e);
60
+ F("failure"), await R(e);
61
61
  }
62
62
  }, [
63
63
  f,
64
64
  m,
65
65
  h,
66
66
  g,
67
+ C,
67
68
  S,
68
- x,
69
+ T,
69
70
  w,
70
- C,
71
71
  y,
72
72
  b,
73
- L
74
- ]), z = s(async (e) => {
73
+ x,
74
+ R
75
+ ]), B = s(async (e) => {
75
76
  let i = _.current, a = v.current;
76
77
  if (!i || !a) {
77
- O(S.saveError);
78
+ k(C.saveError);
78
79
  return;
79
80
  }
80
81
  let o = r(g.current, e.name, e.description, e.instructions), { filePaths: s, files: c } = n(m, h.current);
81
- P("submitting");
82
+ F("submitting");
82
83
  try {
83
- v.current = (await x.updateSkill(f, i, o, s, c, a)).etag ?? a, await b(), P("success"), w({
84
+ v.current = (await S.updateSkill(f, i, o, s, c, a)).etag ?? a, await x(), F("success"), T({
84
85
  variant: u.Success,
85
- title: S.updateSuccessTitle,
86
- message: S.updateSuccess(e.name)
87
- }), C(y);
86
+ title: C.updateSuccessTitle,
87
+ message: C.updateSuccess(e.name)
88
+ }), w(y);
88
89
  } catch (e) {
89
- if (P("failure"), t(e) === 412) {
90
- M({ message: S.conflictMessage });
90
+ if (F("failure"), t(e) === 412) {
91
+ N({ message: C.conflictMessage });
91
92
  return;
92
93
  }
93
- await L(e);
94
+ await R(e);
94
95
  }
95
96
  }, [
96
97
  f,
@@ -99,53 +100,53 @@ var d = (e, t) => JSON.stringify({
99
100
  g,
100
101
  _,
101
102
  v,
103
+ C,
102
104
  S,
103
- x,
105
+ T,
104
106
  w,
105
- C,
106
107
  y,
107
- b,
108
- L
109
- ]), B = s((e) => {
108
+ x,
109
+ R
110
+ ]), V = s((e) => {
110
111
  let t = o(e.instructions);
111
- E((e) => {
112
- if (t === (e.instructions === S.instructionsFrontmatter)) return e;
112
+ D((e) => {
113
+ if (t === (e.instructions === C.instructionsFrontmatter)) return e;
113
114
  if (t) return {
114
115
  ...e,
115
- instructions: S.instructionsFrontmatter
116
+ instructions: C.instructionsFrontmatter
116
117
  };
117
118
  let n = { ...e };
118
119
  return delete n.instructions, n;
119
120
  });
120
- }, [S]), V = s(async (e) => {
121
- if (N === "submitting" || !f) return;
121
+ }, [C]), H = s(async (e) => {
122
+ if (P === "submitting" || !f) return;
122
123
  let t = {};
123
- if (e.name.trim() || (t.name = S.required), e.description.trim() || (t.description = S.required), e.instructions.trim() ? o(e.instructions) && (t.instructions = S.instructionsFrontmatter) : t.instructions = S.required, Object.keys(t).length > 0) {
124
- E(t);
124
+ if (e.name.trim() || (t.name = C.required), e.description.trim() || (t.description = C.required), e.instructions.trim() ? o(e.instructions) && (t.instructions = C.instructionsFrontmatter) : t.instructions = C.required, Object.keys(t).length > 0) {
125
+ D(t);
125
126
  return;
126
127
  }
127
- E({}), O(void 0), A(!1), M(void 0), I.current = e, p ? await z(e) : await R(e);
128
+ D({}), k(void 0), j(!1), N(void 0), L.current = e, p ? await B(e) : await z(e);
128
129
  }, [
129
- N,
130
+ P,
130
131
  f,
131
- S,
132
+ C,
132
133
  p,
133
- z,
134
- R
134
+ B,
135
+ z
135
136
  ]);
136
137
  return {
137
- phase: N,
138
- errors: T,
139
- submitError: D,
140
- isSubmitErrorRetryable: k,
138
+ phase: P,
139
+ errors: E,
140
+ submitError: O,
141
+ isSubmitErrorRetryable: A,
141
142
  retrySubmit: s(() => {
142
- let e = I.current;
143
- e != null && V(e);
144
- }, [V]),
145
- conflict: j,
146
- clearConflict: () => M(void 0),
147
- handleSubmit: V,
148
- handleValuesChange: B
143
+ let e = L.current;
144
+ e != null && H(e);
145
+ }, [H]),
146
+ conflict: M,
147
+ clearConflict: () => N(void 0),
148
+ handleSubmit: H,
149
+ handleValuesChange: V
149
150
  };
150
151
  };
151
152
  //#endregion
package/skill-editor.d.ts CHANGED
@@ -494,7 +494,7 @@ export declare interface UseSkillEditorLoadResult {
494
494
  * `client.createSkill`/`client.updateSkill`, and mapping the resulting
495
495
  * success/error/conflict outcomes to presentable state.
496
496
  */
497
- export declare const useSkillEditorSubmit: ({ bucket, isEditMode, files, filesContentRef, frontmatterRef, loadedPathRef, etagRef, returnUrl, refetchSkills, client, messages, onNavigate, onNotify, }: UseSkillEditorSubmitParams) => UseSkillEditorSubmitResult;
497
+ export declare const useSkillEditorSubmit: ({ bucket, isEditMode, files, filesContentRef, frontmatterRef, loadedPathRef, etagRef, returnUrl, getCreateReturnUrl, refetchSkills, client, messages, onNavigate, onNotify, }: UseSkillEditorSubmitParams) => UseSkillEditorSubmitResult;
498
498
 
499
499
  /** Parameters accepted by {@link useSkillEditorSubmit}. */
500
500
  export declare interface UseSkillEditorSubmitParams {
@@ -514,6 +514,8 @@ export declare interface UseSkillEditorSubmitParams {
514
514
  etagRef: React.MutableRefObject<string | undefined>;
515
515
  /** Where to navigate on a successful save. */
516
516
  returnUrl: string;
517
+ /** Resolves the destination after creation from the normalized skill path. Defaults to `returnUrl`. */
518
+ getCreateReturnUrl?: (path: string) => string;
517
519
  /** Refetches the host's skill listing after a successful save. */
518
520
  refetchSkills: () => Promise<void>;
519
521
  /** Already-configured create/update operations. */