@epam/ai-dial-chat-hooks 1.3.0-dev.13 → 1.3.0-dev.16

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.
@@ -5,126 +5,143 @@ import { getRunnerSchemas as r, isQuickAppSchema as i } from "../../shared/appli
5
5
  import { CatalogEntityType as a } from "@epam/ai-dial-chat-shared";
6
6
  import { useCallback as o, useMemo as s, useState as c } from "react";
7
7
  //#region src/catalog/useCatalogEditNavigation/useCatalogEditNavigation.ts
8
- var l = ({ deployments: l, isCustomAppsEnabled: u, isSchemaAppsEnabled: d, isHideCustomAppCreationEnabled: f, isToolsetsEnabled: p, isPromptsEnabled: m, schemas: h, urls: g, onNavigate: _, deletePrompt: v, deleteToolset: y, deleteSkill: b, deleteApplication: x, refetchPrompts: S, refetchToolsets: C, refetchSkills: w, refetchDeployments: T, onDeleteSuccess: E, labels: D, onNotify: O, onSkillUploadClick: k }) => {
9
- let A = s(() => r(h), [h]), [j, M] = c(""), N = d && !f;
10
- return {
11
- handleEdit: o((e) => {
12
- if (e.type === a.Prompt) {
13
- _(g.buildPromptEditUrl(e.id));
14
- return;
15
- }
16
- if (e.type === a.Skill) {
17
- _(g.buildSkillEditUrl(e.id));
18
- return;
19
- }
20
- if (e.type === a.Toolset) {
21
- _(g.buildToolsetEditUrl(e.id));
22
- return;
23
- }
24
- let n = t(l, e.id);
25
- if (u && n != null && !n.applicationTypeSchemaId) {
26
- _(g.buildCustomAppEditUrl(e.id));
27
- return;
28
- }
29
- let r = A.find((e) => e.id === n?.applicationTypeSchemaId)?.id ?? A.find((e) => i(e))?.id;
30
- r && _(g.buildQuickAppEditUrl(r, e.id));
31
- }, [
32
- l,
33
- u,
34
- A,
35
- _,
36
- g
37
- ]),
38
- handleDelete: o(async (t) => {
39
- try {
40
- if (t.type === a.Prompt) await v(t.id), await S();
41
- else if (t.type === a.Toolset) await y(t.id), await C();
42
- else if (t.type === a.Skill) {
43
- let e = n(t.id);
44
- if (e == null) throw Error(`Invalid skill resource url: ${t.id}`);
45
- await b(e.bucket, e.path), await w();
46
- } else await x(t.id), await T();
47
- E(t);
48
- } catch (t) {
49
- let { traceId: n } = await e(t);
50
- throw O({
51
- message: D.deleteError,
52
- requestId: n
53
- }), t;
54
- }
55
- }, [
56
- v,
57
- y,
58
- b,
59
- x,
60
- C,
61
- T,
62
- S,
63
- w,
64
- E,
65
- D,
66
- O
67
- ]),
68
- createOptions: s(() => {
69
- let e = j.trim().toLocaleLowerCase(), t = (t) => !e || t.toLocaleLowerCase().includes(e), n = [];
70
- N && A.map((e) => ({
71
- id: e.id,
72
- label: e.displayName || e.id
73
- })).filter((e) => t(e.label)).forEach((e) => {
74
- n.push({
75
- key: `runner:${e.id}`,
76
- label: e.label,
77
- onClick: () => _(g.buildQuickAppCreateUrl(e.id))
78
- });
79
- }), p && t(D.createToolset) && n.push({
80
- key: "toolset",
81
- label: D.createToolset,
82
- onClick: () => _(g.buildToolsetCreateUrl())
83
- }), u && !f && t(D.createCustomApp) && n.push({
84
- key: "custom-app",
85
- label: D.createCustomApp,
86
- onClick: () => _(g.buildCustomAppCreateUrl())
87
- });
88
- let r = [{
89
- key: "skill-write-instructions",
90
- label: D.createSkillWriteInstructions,
91
- onClick: () => _(g.buildSkillCreateUrl())
92
- }, {
93
- key: "skill-upload",
94
- label: D.createSkillUpload,
95
- onClick: k
96
- }], i = t(D.createSkill) ? r : r.filter((e) => t(String(e.label)));
97
- return i.length > 0 && n.push({
98
- key: "skill",
99
- label: D.createSkill,
100
- children: i
101
- }), m && t(D.createPrompt) && n.push({
8
+ var l = (e) => [...e].sort((e, t) => String(e.label ?? "").localeCompare(String(t.label ?? ""), void 0, { sensitivity: "base" })), u = ({ deployments: u, isCustomAppsEnabled: d, isSchemaAppsEnabled: f, isHideCustomAppCreationEnabled: p, isToolsetsEnabled: m, isPromptsEnabled: h, schemas: g, urls: _, onNavigate: v, deletePrompt: y, deleteToolset: b, deleteSkill: x, deleteApplication: S, refetchPrompts: C, refetchToolsets: w, refetchSkills: T, refetchDeployments: E, onDeleteSuccess: D, labels: O, onNotify: k, onSkillUploadClick: A }) => {
9
+ let j = s(() => r(g), [g]), [M, N] = c(""), P = f && !p, F = o((e) => {
10
+ if (e.type === a.Prompt) {
11
+ v(_.buildPromptEditUrl(e.id));
12
+ return;
13
+ }
14
+ if (e.type === a.Skill) {
15
+ v(_.buildSkillEditUrl(e.id));
16
+ return;
17
+ }
18
+ if (e.type === a.Toolset) {
19
+ v(_.buildToolsetEditUrl(e.id));
20
+ return;
21
+ }
22
+ let n = t(u, e.id);
23
+ if (d && n != null && !n.applicationTypeSchemaId) {
24
+ v(_.buildCustomAppEditUrl(e.id));
25
+ return;
26
+ }
27
+ let r = j.find((e) => e.id === n?.applicationTypeSchemaId)?.id ?? j.find((e) => i(e))?.id;
28
+ r && v(_.buildQuickAppEditUrl(r, e.id));
29
+ }, [
30
+ u,
31
+ d,
32
+ j,
33
+ v,
34
+ _
35
+ ]), I = o(async (t) => {
36
+ try {
37
+ if (t.type === a.Prompt) await y(t.id), await C();
38
+ else if (t.type === a.Toolset) await b(t.id), await w();
39
+ else if (t.type === a.Skill) {
40
+ let e = n(t.id);
41
+ if (e == null) throw Error(`Invalid skill resource url: ${t.id}`);
42
+ await x(e.bucket, e.path), await T();
43
+ } else await S(t.id), await E();
44
+ D(t);
45
+ } catch (t) {
46
+ let { traceId: n } = await e(t);
47
+ throw k({
48
+ message: O.deleteError,
49
+ requestId: n
50
+ }), t;
51
+ }
52
+ }, [
53
+ y,
54
+ b,
55
+ x,
56
+ S,
57
+ w,
58
+ E,
59
+ C,
60
+ T,
61
+ D,
62
+ O,
63
+ k
64
+ ]), L = s(() => {
65
+ let e = M.trim().toLocaleLowerCase(), t = (t) => !e || t.toLocaleLowerCase().includes(e), n = P ? j.map((e) => ({
66
+ id: e.id,
67
+ label: e.displayName || e.id
68
+ })).filter((e) => t(e.label)).map((e) => ({
69
+ key: `runner:${e.id}`,
70
+ label: e.label,
71
+ onClick: () => v(_.buildQuickAppCreateUrl(e.id))
72
+ })) : [], r = m && t(O.createToolset) ? {
73
+ key: "toolset",
74
+ label: O.createToolset,
75
+ onClick: () => v(_.buildToolsetCreateUrl())
76
+ } : void 0, i = d && !p && t(O.createCustomApp) ? {
77
+ key: "custom-app",
78
+ label: O.createCustomApp,
79
+ onClick: () => v(_.buildCustomAppCreateUrl())
80
+ } : void 0, a = [{
81
+ key: "skill-write-instructions",
82
+ label: O.createSkillWriteInstructions,
83
+ onClick: () => v(_.buildSkillCreateUrl())
84
+ }, {
85
+ key: "skill-upload",
86
+ label: O.createSkillUpload,
87
+ onClick: A
88
+ }];
89
+ return {
90
+ runnerOptions: n,
91
+ toolsetOption: r,
92
+ customAppOption: i,
93
+ visibleSkillChildren: t(O.createSkill) ? a : a.filter((e) => t(String(e.label))),
94
+ promptOption: h && t(O.createPrompt) ? {
102
95
  key: "prompt",
103
- label: D.createPrompt,
104
- onClick: () => _(g.buildPromptCreateUrl())
105
- }), n.sort((e, t) => String(e.label ?? "").localeCompare(String(t.label ?? ""), void 0, { sensitivity: "base" }));
106
- }, [
107
- j,
108
- N,
109
- A,
110
- _,
111
- g,
112
- m,
113
- D,
114
- f,
115
- p,
116
- u,
117
- k
118
- ]),
119
- createSearch: s(() => N && A.length > 0 ? {
120
- value: j,
121
- onChange: M
122
- } : void 0, [
123
- N,
124
- A.length,
125
- j
126
- ])
96
+ label: O.createPrompt,
97
+ onClick: () => v(_.buildPromptCreateUrl())
98
+ } : void 0
99
+ };
100
+ }, [
101
+ M,
102
+ P,
103
+ j,
104
+ v,
105
+ _,
106
+ h,
107
+ O,
108
+ p,
109
+ m,
110
+ d,
111
+ A
112
+ ]), R = s(() => {
113
+ let { runnerOptions: e, toolsetOption: t, customAppOption: n, visibleSkillChildren: r, promptOption: i } = L, a = [...e];
114
+ return t && a.push(t), n && a.push(n), r.length > 0 && a.push({
115
+ key: "skill",
116
+ label: O.createSkill,
117
+ children: r
118
+ }), i && a.push(i), l(a);
119
+ }, [L, O.createSkill]), z = s(() => P && j.length > 0 ? {
120
+ value: M,
121
+ onChange: N
122
+ } : void 0, [
123
+ P,
124
+ j.length,
125
+ M
126
+ ]);
127
+ return {
128
+ handleEdit: F,
129
+ handleDelete: I,
130
+ createOptions: R,
131
+ createSearch: z,
132
+ createMenuByType: s(() => {
133
+ let { runnerOptions: e, toolsetOption: t, customAppOption: n, visibleSkillChildren: r, promptOption: i } = L;
134
+ return {
135
+ [a.Agent]: {
136
+ options: l(n ? [...e, n] : e),
137
+ search: z
138
+ },
139
+ [a.Toolset]: { options: t ? [t] : [] },
140
+ [a.Skill]: { options: r },
141
+ [a.Prompt]: { options: i ? [i] : [] }
142
+ };
143
+ }, [L, z])
127
144
  };
128
145
  };
129
146
  //#endregion
130
- export { l as useCatalogEditNavigation };
147
+ export { u as useCatalogEditNavigation };
package/catalog.d.ts CHANGED
@@ -10,6 +10,7 @@ import { CatalogItemDetailsFetchResult } from '@epam/ai-dial-catalog';
10
10
  import { CatalogItemLimits } from '@epam/ai-dial-catalog';
11
11
  import { CatalogItemOverview } from '@epam/ai-dial-catalog';
12
12
  import { CatalogItemTabData } from '@epam/ai-dial-catalog';
13
+ import { CatalogTabCreateMenu } from '@epam/ai-dial-catalog';
13
14
  import { CredentialsLevel } from '@epam/ai-dial-catalog';
14
15
  import { DeploymentDetailsDto } from '@epam/ai-dial-chat-api-client';
15
16
  import { DeploymentItemDto } from '@epam/ai-dial-chat-api-client';
@@ -1114,6 +1115,8 @@ export declare interface UseCatalogEditNavigationResult {
1114
1115
  createOptions: DropdownItem[];
1115
1116
  /** The Create menu's search field state, or `undefined` when no runner option is offered. */
1116
1117
  createSearch: CatalogCreateSearch | undefined;
1118
+ /** The Create menu narrowed to each entity type; models have no entry since they cannot be created. */
1119
+ createMenuByType: Partial<Record<CatalogEntityType, CatalogTabCreateMenu>>;
1117
1120
  }
1118
1121
 
1119
1122
  /**
package/index.d.ts CHANGED
@@ -20,6 +20,7 @@ import { CatalogItemDetailsFetchResult } from '@epam/ai-dial-catalog';
20
20
  import { CatalogItemLimits } from '@epam/ai-dial-catalog';
21
21
  import { CatalogItemOverview } from '@epam/ai-dial-catalog';
22
22
  import { CatalogItemTabData } from '@epam/ai-dial-catalog';
23
+ import { CatalogTabCreateMenu } from '@epam/ai-dial-catalog';
23
24
  import { ChangeEvent } from 'react';
24
25
  import { Conversation } from '@epam/ai-dial-chat-shared';
25
26
  import { ConversationListItemDto } from '@epam/ai-dial-chat-api-client';
@@ -4929,6 +4930,8 @@ export declare interface UseCatalogEditNavigationResult {
4929
4930
  createOptions: DropdownItem[];
4930
4931
  /** The Create menu's search field state, or `undefined` when no runner option is offered. */
4931
4932
  createSearch: CatalogCreateSearch | undefined;
4933
+ /** The Create menu narrowed to each entity type; models have no entry since they cannot be created. */
4934
+ createMenuByType: Partial<Record<CatalogEntityType, CatalogTabCreateMenu>>;
4932
4935
  }
4933
4936
 
4934
4937
  /**
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.3.0-dev.13",
4
+ "version": "1.3.0-dev.16",
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.3.0-dev.13",
114
+ "@epam/ai-dial-chat-api-client": "1.3.0-dev.16",
115
115
  "dompurify": "3.4.16",
116
116
  "fflate": "^0.8.3",
117
117
  "lru-cache": "^10.4.3",
@@ -120,21 +120,21 @@
120
120
  },
121
121
  "peerDependencies": {
122
122
  "react": "^19.2.8",
123
- "@epam/ai-dial-attachment-canvas": "1.3.0-dev.13",
124
- "@epam/ai-dial-attachment-input": "1.3.0-dev.13",
125
- "@epam/ai-dial-catalog": "1.3.0-dev.13",
126
- "@epam/ai-dial-chat-overlay": "1.3.0-dev.13",
127
- "@epam/ai-dial-chat-shared": "1.3.0-dev.13",
128
- "@epam/ai-dial-mcp-apps": "1.3.0-dev.13",
129
- "@epam/ai-dial-publish-panel": "1.3.0-dev.13",
130
- "@epam/ai-dial-quotations": "1.3.0-dev.13",
123
+ "@epam/ai-dial-attachment-canvas": "1.3.0-dev.16",
124
+ "@epam/ai-dial-attachment-input": "1.3.0-dev.16",
125
+ "@epam/ai-dial-catalog": "1.3.0-dev.16",
126
+ "@epam/ai-dial-chat-overlay": "1.3.0-dev.16",
127
+ "@epam/ai-dial-chat-shared": "1.3.0-dev.16",
128
+ "@epam/ai-dial-mcp-apps": "1.3.0-dev.16",
129
+ "@epam/ai-dial-publish-panel": "1.3.0-dev.16",
130
+ "@epam/ai-dial-quotations": "1.3.0-dev.16",
131
131
  "@epam/ai-dial-react-file-manager": "^0.3.0",
132
- "@epam/ai-dial-scheduled-tasks": "1.3.0-dev.13",
133
- "@epam/ai-dial-share": "1.3.0-dev.13",
134
- "@epam/ai-dial-skill-editor": "1.3.0-dev.13",
135
- "@epam/ai-dial-source-panel": "1.3.0-dev.13",
136
- "@epam/ai-dial-ui-kit": "^0.15.0",
137
- "@epam/ai-dial-usage-dashboard": "1.3.0-dev.13",
132
+ "@epam/ai-dial-scheduled-tasks": "1.3.0-dev.16",
133
+ "@epam/ai-dial-share": "1.3.0-dev.16",
134
+ "@epam/ai-dial-skill-editor": "1.3.0-dev.16",
135
+ "@epam/ai-dial-source-panel": "1.3.0-dev.16",
136
+ "@epam/ai-dial-ui-kit": "^0.15.1",
137
+ "@epam/ai-dial-usage-dashboard": "1.3.0-dev.16",
138
138
  "@modelcontextprotocol/sdk": "^1.32.1",
139
139
  "@epam/pdf-highlighter-kit": "^0.0.19",
140
140
  "@mcp-ui/client": "^7.1.1"