@epam/ai-dial-chat-hooks 1.2.0-dev.28 → 1.2.0-dev.34
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.
- package/catalog/useSkillDetailsPanelData/useSkillDetailsPanelData.js +39 -39
- package/catalog/useSkillItemDetails.js +17 -13
- package/catalog.d.ts +18 -4
- package/index.d.ts +18 -4
- package/package.json +15 -15
|
@@ -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,
|
|
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
|
|
7
|
-
let
|
|
8
|
-
...
|
|
9
|
-
...
|
|
10
|
-
...
|
|
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
|
-
]),
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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
|
-
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
y,
|
|
30
|
+
f,
|
|
31
|
+
m
|
|
32
|
+
]), [x, S] = o(null), [C, w] = o(!1), T = a(0);
|
|
33
33
|
return r(() => {
|
|
34
|
-
if (
|
|
35
|
-
|
|
36
|
-
let e = !1;
|
|
37
|
-
return
|
|
38
|
-
e || (
|
|
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
|
-
}, [
|
|
42
|
+
}, [b?.id]), {
|
|
43
43
|
detailsPanelItem: i(() => {
|
|
44
|
-
if (
|
|
45
|
-
if (
|
|
46
|
-
let { credentials: e, ...t } =
|
|
44
|
+
if (b == null) return null;
|
|
45
|
+
if (x == null) return b;
|
|
46
|
+
let { credentials: e, ...t } = x;
|
|
47
47
|
return {
|
|
48
|
-
...
|
|
48
|
+
...b,
|
|
49
49
|
details: t,
|
|
50
|
-
credentials: e ??
|
|
50
|
+
credentials: e ?? b.credentials
|
|
51
51
|
};
|
|
52
|
-
}, [
|
|
53
|
-
isDetailsLoading:
|
|
54
|
-
isStarred:
|
|
55
|
-
onLoadSkillDetailsFile:
|
|
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 {
|
|
59
|
+
export { s as useSkillDetailsPanelData };
|
|
@@ -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([
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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
|
-
...
|
|
32
|
+
...b == null ? {} : { overview: b }
|
|
29
33
|
};
|
|
30
34
|
}, [
|
|
31
35
|
d,
|
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
|
|
|
@@ -757,6 +764,12 @@ export declare interface SkillDetailsApi {
|
|
|
757
764
|
limit?: number;
|
|
758
765
|
recursive?: boolean;
|
|
759
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>;
|
|
760
773
|
}
|
|
761
774
|
|
|
762
775
|
/** A skill's parsed manifest details. */
|
|
@@ -1218,10 +1231,11 @@ export declare interface UseSkillFilePreviewResult {
|
|
|
1218
1231
|
|
|
1219
1232
|
/**
|
|
1220
1233
|
* Headless hook that encapsulates skill detail fetching: manifest download and
|
|
1221
|
-
* parse, package file listing,
|
|
1222
|
-
* loads. `useCatalogItemDetails` delegates
|
|
1223
|
-
* only surface skill details consume this
|
|
1224
|
-
* deployment and prompt ports the full catalog
|
|
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.
|
|
1225
1239
|
*/
|
|
1226
1240
|
export declare const useSkillItemDetails: ({ api, skills, skillOverviewLabels, }: UseSkillItemDetailsOptions) => UseSkillItemDetailsResult;
|
|
1227
1241
|
|
package/index.d.ts
CHANGED
|
@@ -525,6 +525,13 @@ export declare const buildSkillManifestFromFrontmatter: (baseFrontmatter: Record
|
|
|
525
525
|
* authored it, when it last changed, and its file inventory. Grouping folders
|
|
526
526
|
* in the file listing are excluded from both the count and the rows. Sizes are
|
|
527
527
|
* not shown — the skill metadata carries no content-length field.
|
|
528
|
+
*
|
|
529
|
+
* `skill` is the authoritative `getSkillMetadata` response when that request
|
|
530
|
+
* fulfilled; the caller falls back to the catalog listing entry only when it
|
|
531
|
+
* rejected (`useSkillItemDetails`'s `onFetchSkillDetails`). Either way, this
|
|
532
|
+
* function never fills a gap in one source from the other — an absent
|
|
533
|
+
* `author` omits the row and an absent `updatedAt` leaves the updated row's
|
|
534
|
+
* value empty, exactly as `skill` carries it.
|
|
528
535
|
*/
|
|
529
536
|
export declare const buildSkillOverview: (skill: SkillMetadataItemDto | undefined, files: SkillMetadataItemDto[], about: SkillAboutDetails | undefined, labels: SkillOverviewLabels) => CatalogItemOverview;
|
|
530
537
|
|
|
@@ -3234,6 +3241,12 @@ export declare interface SkillDetailsApi {
|
|
|
3234
3241
|
limit?: number;
|
|
3235
3242
|
recursive?: boolean;
|
|
3236
3243
|
}, signal?: AbortSignal): Promise<SkillFileListResponseDto>;
|
|
3244
|
+
/**
|
|
3245
|
+
* Fetches a single skill's own authoritative metadata (`author`,
|
|
3246
|
+
* `updatedAt`, and the rest of `SkillMetadataItemDto`) — not the catalog
|
|
3247
|
+
* listing entry, which may be sparse for a shared skill.
|
|
3248
|
+
*/
|
|
3249
|
+
getSkillMetadata(bucket: string, path: string, signal?: AbortSignal): Promise<SkillMetadataItemDto>;
|
|
3237
3250
|
}
|
|
3238
3251
|
|
|
3239
3252
|
/** Already-configured DIAL Core download operations `useSkillEditorLoad` needs. */
|
|
@@ -5532,10 +5545,11 @@ export declare interface UseSkillFilePreviewResult {
|
|
|
5532
5545
|
|
|
5533
5546
|
/**
|
|
5534
5547
|
* Headless hook that encapsulates skill detail fetching: manifest download and
|
|
5535
|
-
* parse, package file listing,
|
|
5536
|
-
* loads. `useCatalogItemDetails` delegates
|
|
5537
|
-
* only surface skill details consume this
|
|
5538
|
-
* deployment and prompt ports the full catalog
|
|
5548
|
+
* parse, package file listing, authoritative metadata fetching, overview
|
|
5549
|
+
* construction, and in-package file loads. `useCatalogItemDetails` delegates
|
|
5550
|
+
* its skill branch here; hosts that only surface skill details consume this
|
|
5551
|
+
* hook directly, without the deployment and prompt ports the full catalog
|
|
5552
|
+
* pipeline requires.
|
|
5539
5553
|
*/
|
|
5540
5554
|
export declare const useSkillItemDetails: ({ api, skills, skillOverviewLabels, }: UseSkillItemDetailsOptions) => UseSkillItemDetailsResult;
|
|
5541
5555
|
|
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.
|
|
4
|
+
"version": "1.2.0-dev.34",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "./index.js",
|
|
@@ -106,7 +106,7 @@
|
|
|
106
106
|
}
|
|
107
107
|
},
|
|
108
108
|
"dependencies": {
|
|
109
|
-
"@epam/ai-dial-chat-api-client": "1.2.0-dev.
|
|
109
|
+
"@epam/ai-dial-chat-api-client": "1.2.0-dev.34",
|
|
110
110
|
"dompurify": "3.4.15",
|
|
111
111
|
"fflate": "^0.8.3",
|
|
112
112
|
"lru-cache": "^10.4.3",
|
|
@@ -115,20 +115,20 @@
|
|
|
115
115
|
},
|
|
116
116
|
"peerDependencies": {
|
|
117
117
|
"react": "^19.2.8",
|
|
118
|
-
"@epam/ai-dial-attachment-canvas": "1.2.0-dev.
|
|
119
|
-
"@epam/ai-dial-attachment-input": "1.2.0-dev.
|
|
120
|
-
"@epam/ai-dial-builder-form": "1.2.0-dev.
|
|
121
|
-
"@epam/ai-dial-catalog": "1.2.0-dev.
|
|
122
|
-
"@epam/ai-dial-chat-overlay": "1.2.0-dev.
|
|
123
|
-
"@epam/ai-dial-chat-shared": "1.2.0-dev.
|
|
124
|
-
"@epam/ai-dial-mcp-apps": "1.2.0-dev.
|
|
125
|
-
"@epam/ai-dial-publish-panel": "1.2.0-dev.
|
|
126
|
-
"@epam/ai-dial-quotations": "1.2.0-dev.
|
|
118
|
+
"@epam/ai-dial-attachment-canvas": "1.2.0-dev.34",
|
|
119
|
+
"@epam/ai-dial-attachment-input": "1.2.0-dev.34",
|
|
120
|
+
"@epam/ai-dial-builder-form": "1.2.0-dev.34",
|
|
121
|
+
"@epam/ai-dial-catalog": "1.2.0-dev.34",
|
|
122
|
+
"@epam/ai-dial-chat-overlay": "1.2.0-dev.34",
|
|
123
|
+
"@epam/ai-dial-chat-shared": "1.2.0-dev.34",
|
|
124
|
+
"@epam/ai-dial-mcp-apps": "1.2.0-dev.34",
|
|
125
|
+
"@epam/ai-dial-publish-panel": "1.2.0-dev.34",
|
|
126
|
+
"@epam/ai-dial-quotations": "1.2.0-dev.34",
|
|
127
127
|
"@epam/ai-dial-react-file-manager": "^0.2.0",
|
|
128
|
-
"@epam/ai-dial-scheduled-tasks": "1.2.0-dev.
|
|
129
|
-
"@epam/ai-dial-share": "1.2.0-dev.
|
|
130
|
-
"@epam/ai-dial-skill-editor": "1.2.0-dev.
|
|
131
|
-
"@epam/ai-dial-source-panel": "1.2.0-dev.
|
|
128
|
+
"@epam/ai-dial-scheduled-tasks": "1.2.0-dev.34",
|
|
129
|
+
"@epam/ai-dial-share": "1.2.0-dev.34",
|
|
130
|
+
"@epam/ai-dial-skill-editor": "1.2.0-dev.34",
|
|
131
|
+
"@epam/ai-dial-source-panel": "1.2.0-dev.34",
|
|
132
132
|
"@epam/ai-dial-ui-kit": "^0.14.2",
|
|
133
133
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
134
134
|
"@epam/pdf-highlighter-kit": "^0.0.19",
|