@epam/ai-dial-chat-hooks 1.2.0-dev.83 → 1.2.0-dev.85
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/map-skill-to-catalog-item.js +48 -48
- package/package.json +15 -15
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { formatCalendarDate as
|
|
1
|
+
import { stripSurroundingSlashes as e } from "../shared/string-utils.js";
|
|
2
|
+
import { formatCalendarDate as t } from "../shared/formatting.js";
|
|
3
3
|
import "../skill/skill.js";
|
|
4
|
-
import { SkillSource as
|
|
5
|
-
import { CatalogEntityType as
|
|
6
|
-
import { CatalogContentNodeType as
|
|
7
|
-
import { SkillMetadataItemDtoNodeTypeEnum as
|
|
4
|
+
import { SkillSource as n } from "../skill/skill-types.js";
|
|
5
|
+
import { CatalogEntityType as r, formatLastUsed as i } from "@epam/ai-dial-chat-shared";
|
|
6
|
+
import { CatalogContentNodeType as a } from "@epam/ai-dial-catalog";
|
|
7
|
+
import { SkillMetadataItemDtoNodeTypeEnum as o } from "@epam/ai-dial-chat-api-client";
|
|
8
8
|
//#region src/catalog/map-skill-to-catalog-item.ts
|
|
9
|
-
var
|
|
10
|
-
[
|
|
11
|
-
[
|
|
12
|
-
[
|
|
13
|
-
},
|
|
14
|
-
let s = o.has(e.url),
|
|
9
|
+
var s = {
|
|
10
|
+
[n.Personal]: "personal",
|
|
11
|
+
[n.SharedWithMe]: "shared",
|
|
12
|
+
[n.Public]: "public"
|
|
13
|
+
}, c = (e, t, n) => [n[s[t]], ...(e ?? "").split("/").filter(Boolean)], l = (e, { folderLabels: t, source: a, favoriteIds: o }) => {
|
|
14
|
+
let s = o.has(e.url), l = a === n.Public, u = a === n.Personal;
|
|
15
15
|
return {
|
|
16
16
|
id: e.url,
|
|
17
|
-
type:
|
|
17
|
+
type: r.Skill,
|
|
18
18
|
name: e.name,
|
|
19
19
|
description: e.description ?? "",
|
|
20
20
|
version: "",
|
|
21
|
-
lastUsed:
|
|
21
|
+
lastUsed: i(e.updatedAt),
|
|
22
22
|
createdAt: e.createdAt,
|
|
23
23
|
updatedAt: e.updatedAt,
|
|
24
24
|
isFeatured: !1,
|
|
@@ -27,11 +27,11 @@ var c = {
|
|
|
27
27
|
isUserFavorite: s,
|
|
28
28
|
isStarred: s,
|
|
29
29
|
isMyApp: u && (e.isMy ?? !0),
|
|
30
|
-
sharedWithMe: e.sharedWithMe ??
|
|
31
|
-
isEditable: !
|
|
32
|
-
folder:
|
|
30
|
+
sharedWithMe: e.sharedWithMe ?? a === n.SharedWithMe,
|
|
31
|
+
isEditable: !l && (e.canEdit ?? u),
|
|
32
|
+
folder: c(e.parentPath, a, t)
|
|
33
33
|
};
|
|
34
|
-
},
|
|
34
|
+
}, u = (e) => e.join(" · "), d = (e, t) => {
|
|
35
35
|
if (e == null) return null;
|
|
36
36
|
let n = [];
|
|
37
37
|
return e.whenToUse != null && n.push({
|
|
@@ -39,25 +39,25 @@ var c = {
|
|
|
39
39
|
value: e.whenToUse
|
|
40
40
|
}), e.allowedTools?.length && n.push({
|
|
41
41
|
label: t.allowedToolsLabel,
|
|
42
|
-
value:
|
|
42
|
+
value: u(e.allowedTools)
|
|
43
43
|
}), e.bundledResources?.length && n.push({
|
|
44
44
|
label: t.bundledResourcesLabel,
|
|
45
|
-
value:
|
|
45
|
+
value: u(e.bundledResources)
|
|
46
46
|
}), n.length === 0 ? null : {
|
|
47
47
|
title: t.specificationSectionTitle,
|
|
48
48
|
specs: n
|
|
49
49
|
};
|
|
50
|
-
},
|
|
51
|
-
let r =
|
|
52
|
-
return
|
|
53
|
-
let n = t
|
|
50
|
+
}, f = (e) => e.filter((e) => e.nodeType === o.Item), p = (t, n) => {
|
|
51
|
+
let r = e(n), i = r ? `${r}/files` : "files";
|
|
52
|
+
return f(t).find((t) => {
|
|
53
|
+
let n = e(t.path);
|
|
54
54
|
return n === "SKILL.md" || n === "files/SKILL.md" || n === `${i}/SKILL.md`;
|
|
55
55
|
})?.path ?? "SKILL.md";
|
|
56
|
-
},
|
|
57
|
-
let r = t
|
|
56
|
+
}, m = (t, n) => {
|
|
57
|
+
let r = e(t), i = e(n), a = i ? `${i}/files` : "files";
|
|
58
58
|
return r === "" || r === "files" || r === a ? null : r.startsWith(`${a}/`) ? r.slice(a.length + 1) : r.startsWith("files/") ? r.slice(6) : r;
|
|
59
|
-
},
|
|
60
|
-
let a = [], o =
|
|
59
|
+
}, h = (e, t) => m(e, t), g = (e, n, r, i) => {
|
|
60
|
+
let a = [], o = d(r, i);
|
|
61
61
|
o != null && a.push(o);
|
|
62
62
|
let s = [];
|
|
63
63
|
return e?.author && s.push({
|
|
@@ -65,26 +65,26 @@ var c = {
|
|
|
65
65
|
value: e.author
|
|
66
66
|
}), s.push({
|
|
67
67
|
label: i.updatedLabel,
|
|
68
|
-
value: e?.updatedAt ?
|
|
68
|
+
value: e?.updatedAt ? t(e.updatedAt) : ""
|
|
69
69
|
}), s.push({
|
|
70
70
|
label: i.fileCountLabel,
|
|
71
|
-
value: String(
|
|
71
|
+
value: String(f(n).length)
|
|
72
72
|
}), a.push({
|
|
73
73
|
title: i.detailsSectionTitle,
|
|
74
74
|
specs: s
|
|
75
75
|
}), { sections: a };
|
|
76
|
-
},
|
|
76
|
+
}, _ = (e, t, n) => {
|
|
77
77
|
if (e === "") return n;
|
|
78
78
|
let r = t.get(e);
|
|
79
79
|
if (r != null) return r.items;
|
|
80
|
-
let i = e.split("/"),
|
|
81
|
-
type:
|
|
80
|
+
let i = e.split("/"), o = _(i.slice(0, -1).join("/"), t, n), s = {
|
|
81
|
+
type: a.Folder,
|
|
82
82
|
id: e,
|
|
83
83
|
name: i[i.length - 1],
|
|
84
84
|
items: []
|
|
85
85
|
};
|
|
86
|
-
return t.set(e, s),
|
|
87
|
-
},
|
|
86
|
+
return t.set(e, s), o.push(s), s.items;
|
|
87
|
+
}, v = (e, t) => {
|
|
88
88
|
e.sort((e, n) => {
|
|
89
89
|
if (t) {
|
|
90
90
|
if (e.name === "SKILL.md") return -1;
|
|
@@ -92,32 +92,32 @@ var c = {
|
|
|
92
92
|
}
|
|
93
93
|
return e.name.localeCompare(n.name);
|
|
94
94
|
});
|
|
95
|
-
for (let t of e) t.type ===
|
|
96
|
-
},
|
|
95
|
+
for (let t of e) t.type === a.Folder && v(t.items, !1);
|
|
96
|
+
}, y = (e, t) => {
|
|
97
97
|
let n = /* @__PURE__ */ new Map(), r = [];
|
|
98
98
|
for (let i of e) {
|
|
99
|
-
let e =
|
|
99
|
+
let e = m(i.path, t);
|
|
100
100
|
if (e == null) continue;
|
|
101
|
-
if (i.nodeType ===
|
|
102
|
-
|
|
101
|
+
if (i.nodeType === o.Folder) {
|
|
102
|
+
_(e, n, r);
|
|
103
103
|
continue;
|
|
104
104
|
}
|
|
105
|
-
let
|
|
106
|
-
|
|
107
|
-
type:
|
|
105
|
+
let s = e.lastIndexOf("/");
|
|
106
|
+
_(s === -1 ? "" : e.slice(0, s), n, r).push({
|
|
107
|
+
type: a.File,
|
|
108
108
|
id: i.path,
|
|
109
109
|
name: i.name
|
|
110
110
|
});
|
|
111
111
|
}
|
|
112
|
-
return
|
|
113
|
-
},
|
|
112
|
+
return v(r, !0), r;
|
|
113
|
+
}, b = async (e) => {
|
|
114
114
|
let t = Number(e.headers.get("content-length"));
|
|
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
|
-
},
|
|
119
|
-
let t = await
|
|
118
|
+
}, x = async (e) => new Uint8Array(await e.arrayBuffer()), S = async (e) => {
|
|
119
|
+
let t = await b(e);
|
|
120
120
|
return t == null ? null : new TextDecoder().decode(t);
|
|
121
121
|
};
|
|
122
122
|
//#endregion
|
|
123
|
-
export {
|
|
123
|
+
export { y as buildSkillContentTree, g as buildSkillOverview, l as mapSkillToCatalogItem, b as readSkillFileBytes, x as readSkillFilePreviewBytes, S as readSkillManifest, h as resolveSkillFileDownloadPath, p as resolveSkillManifestFileId };
|
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.85",
|
|
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.85",
|
|
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.85",
|
|
119
|
+
"@epam/ai-dial-attachment-input": "1.2.0-dev.85",
|
|
120
|
+
"@epam/ai-dial-builder-form": "1.2.0-dev.85",
|
|
121
|
+
"@epam/ai-dial-catalog": "1.2.0-dev.85",
|
|
122
|
+
"@epam/ai-dial-chat-overlay": "1.2.0-dev.85",
|
|
123
|
+
"@epam/ai-dial-chat-shared": "1.2.0-dev.85",
|
|
124
|
+
"@epam/ai-dial-mcp-apps": "1.2.0-dev.85",
|
|
125
|
+
"@epam/ai-dial-publish-panel": "1.2.0-dev.85",
|
|
126
|
+
"@epam/ai-dial-quotations": "1.2.0-dev.85",
|
|
127
127
|
"@epam/ai-dial-react-file-manager": "^0.3.0-dev.2",
|
|
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.85",
|
|
129
|
+
"@epam/ai-dial-share": "1.2.0-dev.85",
|
|
130
|
+
"@epam/ai-dial-skill-editor": "1.2.0-dev.85",
|
|
131
|
+
"@epam/ai-dial-source-panel": "1.2.0-dev.85",
|
|
132
132
|
"@epam/ai-dial-ui-kit": "^0.15.0-dev.9",
|
|
133
133
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
134
134
|
"@epam/pdf-highlighter-kit": "^0.0.19",
|