@epam/ai-dial-chat-hooks 1.2.0-dev.28 → 1.2.0-dev.284
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/api-error/api-error.js +7 -4
- package/attachment/useAttachmentValidation/useAttachmentValidation.js +26 -19
- package/attachments.d.ts +10 -4
- package/catalog/catalog-derivations.js +1 -1
- package/catalog/deployment-id.js +8 -2
- package/catalog/map-deployment-limits-to-catalog.js +16 -24
- package/catalog/map-deployment-limits-to-input.js +81 -9
- package/catalog/map-deployment-to-catalog-item.js +34 -34
- package/catalog/map-entity-details-to-catalog.js +7 -0
- package/catalog/map-skill-to-catalog-item.js +55 -48
- package/catalog/publish.js +6 -5
- package/catalog/useApplicationCredentials/useApplicationCredentials.js +39 -0
- package/catalog/useCatalogEditNavigation/useCatalogEditNavigation.js +122 -101
- package/catalog/usePublishFolders/usePublishFolders.js +1 -1
- package/catalog/useSkillDetailsPanelData/useSkillDetailsPanelData.js +39 -39
- package/catalog/useSkillItemDetails.js +17 -13
- package/catalog.d.ts +139 -34
- package/catalog.js +23 -22
- package/conversation/conversation-transfer/export-conversation.js +24 -16
- package/conversation/conversation-transfer/import-conversation.js +80 -31
- package/conversation/conversation-transfer/queue.js +8 -5
- package/conversation/create-chat-stream-api.js +85 -49
- package/conversation/message-utils.js +44 -2
- package/conversation/stage.js +27 -0
- package/conversation/useActiveConversationSync/useActiveConversationSync.js +7 -8
- package/conversation/useConversationExport/useConversationExport.js +9 -9
- package/conversation/useConversationHandlers/useConversationHandlers.js +73 -57
- package/conversation/useConversationImport/useConversationImport.js +123 -121
- package/conversation/useConversationPanelItems/useConversationPanelItems.js +50 -32
- package/conversation/useConversationScroll/useConversationScroll.js +68 -64
- package/conversation/useConversationStream/apply-chunk.js +1 -1
- package/conversation/useConversationStream/frame-scheduler.js +39 -0
- package/conversation/useConversationStream/generation-resume.js +122 -64
- package/conversation/useConversationStream/useConversationStream.js +265 -116
- package/conversation/useMessageSelectionReply/useMessageSelectionReply.js +189 -0
- package/conversation-sources/useConversationSources/useConversationSources.js +31 -24
- package/conversation-sources.d.ts +1 -1
- package/conversation-transfer.d.ts +2 -1
- package/conversation.d.ts +295 -17
- package/conversation.js +32 -29
- package/file-manager-canvas.d.ts +53 -5
- package/file-manager.d.ts +156 -26
- package/file-manager.js +25 -23
- package/files/attachment-canvas.js +74 -40
- package/files/attachment-types.js +14 -13
- package/files/dial-file-manager-mapping.util.js +2 -1
- package/files/dial-file-manager-path.util.js +23 -1
- package/files/dial-file-manager.model.js +23 -19
- package/files/dial-file-manager.types.js +3 -3
- package/files/useDialFileListing/useDialFileListing.js +139 -127
- package/files/useDialFileManager/useDialFileManager.js +132 -128
- package/files/useDialFileManagerSections/useDialFileManagerSections.js +155 -0
- package/files/useDialFileManagerTabConfig/useDialFileManagerTabConfig.js +20 -19
- package/files/useDialFileMutations/useDialFileMutations.js +33 -32
- package/files/useDialFileUploadBatch/useDialFileUploadBatch.js +117 -110
- package/files/useFileAttachmentPicker/useFileAttachmentPicker.js +49 -0
- package/index.d.ts +1178 -112
- package/index.js +136 -122
- package/mcp-apps/useMcpAppHostAdapter/useMcpAppHostAdapter.js +7 -5
- package/mcp-apps/useMcpAppHostContext/useMcpAppHostContext.js +1 -1
- package/mcp-apps/useMcpAppTools/useMcpAppTools.js +1 -1
- package/mcp-apps/useOpenMcpAppCanvas/useOpenMcpAppCanvas.js +25 -23
- package/mcp-apps.d.ts +8 -6
- package/oauth/toolset-id.js +5 -3
- package/oauth/useToolsetLogin/useToolsetLogin.js +8 -8
- package/oauth.d.ts +32 -0
- package/oauth.js +9 -9
- package/package.json +26 -21
- package/scheduled-task/scheduled-task-description.js +81 -0
- package/scheduled-task/scheduled-task-preparation.js +24 -0
- package/scheduled-task/scheduled-task-trigger.js +74 -71
- package/scheduled-task/scheduled-tasks-api-client.js +19 -0
- package/scheduled-task/use-scheduled-task-runs.js +194 -0
- package/scheduled-task/use-scheduled-tasks.js +93 -0
- package/scheduled-tasks.d.ts +197 -3
- package/scheduled-tasks.js +7 -2
- package/shared/application-schema.js +5 -2
- package/shared/cron-day-of-month.js +13 -0
- package/skill/skill-archive.js +19 -0
- package/skill/skill-types.js +8 -7
- package/skill/skill.js +53 -27
- package/skill/useSkillArchiveImport/useSkillArchiveImport.js +79 -0
- package/skill/useSkillEditorLoad.js +65 -59
- package/skill/useSkillEditorSubmit.js +108 -84
- package/skill/useSkillFileActions.js +70 -58
- package/skill-editor.d.ts +160 -8
- package/skill-editor.js +9 -8
- package/usage/map-usage-data-to-dashboard.js +66 -0
- package/usage/map-user-usage-to-model-limits.js +202 -0
- package/usage.d.ts +125 -0
- package/usage.js +3 -0
- package/usePageFileDrag/usePageFileDrag.js +3 -3
- package/utils.d.ts +26 -6
- package/utils.js +10 -10
|
@@ -1,24 +1,27 @@
|
|
|
1
1
|
import { safeDecodeURIComponent as e, stripSurroundingSlashes as t } from "../shared/string-utils.js";
|
|
2
2
|
import { formatCalendarDate as n } from "../shared/formatting.js";
|
|
3
|
-
import "../skill/skill.js";
|
|
4
|
-
import { SkillSource as
|
|
5
|
-
import { CatalogEntityType as
|
|
6
|
-
import { CatalogContentNodeType as
|
|
7
|
-
import { SkillMetadataItemDtoNodeTypeEnum as
|
|
3
|
+
import { SKILL_FOLDER_MARKER as r } from "../skill/skill.js";
|
|
4
|
+
import { SkillSource as i } from "../skill/skill-types.js";
|
|
5
|
+
import { CatalogEntityType as a, formatLastUsed as o } from "@epam/ai-dial-chat-shared";
|
|
6
|
+
import { CatalogContentNodeType as s } from "@epam/ai-dial-catalog";
|
|
7
|
+
import { SkillMetadataItemDtoNodeTypeEnum as c } 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
|
|
9
|
+
var l = {
|
|
10
|
+
[i.Personal]: "personal",
|
|
11
|
+
[i.SharedWithMe]: "shared",
|
|
12
|
+
[i.Public]: "public"
|
|
13
|
+
}, u = (t, n) => {
|
|
14
|
+
let r = (n ?? "").split("/").filter(Boolean), i = t.split("/").filter(Boolean).slice(2, -1);
|
|
15
|
+
return i.length === r.length ? i.map(e) : r;
|
|
16
|
+
}, d = (e, t, n) => [n[l[t]], ...u(e.url, e.parentPath)], f = (e, { folderLabels: t, source: n, favoriteIds: r }) => {
|
|
17
|
+
let s = r.has(e.url), c = n === i.Public, l = n === i.Personal;
|
|
15
18
|
return {
|
|
16
19
|
id: e.url,
|
|
17
|
-
type:
|
|
20
|
+
type: a.Skill,
|
|
18
21
|
name: e.name,
|
|
19
22
|
description: e.description ?? "",
|
|
20
23
|
version: "",
|
|
21
|
-
lastUsed:
|
|
24
|
+
lastUsed: o(e.updatedAt),
|
|
22
25
|
createdAt: e.createdAt,
|
|
23
26
|
updatedAt: e.updatedAt,
|
|
24
27
|
isFeatured: !1,
|
|
@@ -26,12 +29,12 @@ var c = {
|
|
|
26
29
|
topics: [],
|
|
27
30
|
isUserFavorite: s,
|
|
28
31
|
isStarred: s,
|
|
29
|
-
isMyApp:
|
|
30
|
-
sharedWithMe: e.sharedWithMe ?? n ===
|
|
31
|
-
isEditable: !c && (e.canEdit ??
|
|
32
|
-
folder:
|
|
32
|
+
isMyApp: l && (e.isMy ?? !0),
|
|
33
|
+
sharedWithMe: e.sharedWithMe ?? n === i.SharedWithMe,
|
|
34
|
+
isEditable: !c && (e.canEdit ?? l),
|
|
35
|
+
folder: d(e, n, t)
|
|
33
36
|
};
|
|
34
|
-
},
|
|
37
|
+
}, p = (e) => e.join(" · "), m = (e, t) => {
|
|
35
38
|
if (e == null) return null;
|
|
36
39
|
let n = [];
|
|
37
40
|
return e.whenToUse != null && n.push({
|
|
@@ -39,25 +42,25 @@ var c = {
|
|
|
39
42
|
value: e.whenToUse
|
|
40
43
|
}), e.allowedTools?.length && n.push({
|
|
41
44
|
label: t.allowedToolsLabel,
|
|
42
|
-
value:
|
|
45
|
+
value: p(e.allowedTools)
|
|
43
46
|
}), e.bundledResources?.length && n.push({
|
|
44
47
|
label: t.bundledResourcesLabel,
|
|
45
|
-
value:
|
|
48
|
+
value: p(e.bundledResources)
|
|
46
49
|
}), n.length === 0 ? null : {
|
|
47
50
|
title: t.specificationSectionTitle,
|
|
48
51
|
specs: n
|
|
49
52
|
};
|
|
50
|
-
},
|
|
53
|
+
}, h = (e) => e.filter((e) => e.nodeType === c.Item), g = (e, n) => {
|
|
51
54
|
let r = t(n), i = r ? `${r}/files` : "files";
|
|
52
|
-
return
|
|
55
|
+
return h(e).find((e) => {
|
|
53
56
|
let n = t(e.path);
|
|
54
57
|
return n === "SKILL.md" || n === "files/SKILL.md" || n === `${i}/SKILL.md`;
|
|
55
58
|
})?.path ?? "SKILL.md";
|
|
56
|
-
},
|
|
59
|
+
}, _ = (e, n) => {
|
|
57
60
|
let r = t(e), i = t(n), a = i ? `${i}/files` : "files";
|
|
58
61
|
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 =
|
|
62
|
+
}, v = (e, t) => _(e, t), y = (e, t, r, i) => {
|
|
63
|
+
let a = [], o = m(r, i);
|
|
61
64
|
o != null && a.push(o);
|
|
62
65
|
let s = [];
|
|
63
66
|
return e?.author && s.push({
|
|
@@ -68,23 +71,23 @@ var c = {
|
|
|
68
71
|
value: e?.updatedAt ? n(e.updatedAt) : ""
|
|
69
72
|
}), s.push({
|
|
70
73
|
label: i.fileCountLabel,
|
|
71
|
-
value: String(
|
|
74
|
+
value: String(h(t).length)
|
|
72
75
|
}), a.push({
|
|
73
76
|
title: i.detailsSectionTitle,
|
|
74
77
|
specs: s
|
|
75
78
|
}), { sections: a };
|
|
76
|
-
},
|
|
79
|
+
}, b = (e, t, n) => {
|
|
77
80
|
if (e === "") return n;
|
|
78
81
|
let r = t.get(e);
|
|
79
82
|
if (r != null) return r.items;
|
|
80
|
-
let i = e.split("/"), a =
|
|
81
|
-
type:
|
|
83
|
+
let i = e.split("/"), a = b(i.slice(0, -1).join("/"), t, n), o = {
|
|
84
|
+
type: s.Folder,
|
|
82
85
|
id: e,
|
|
83
86
|
name: i[i.length - 1],
|
|
84
87
|
items: []
|
|
85
88
|
};
|
|
86
|
-
return t.set(e,
|
|
87
|
-
},
|
|
89
|
+
return t.set(e, o), a.push(o), o.items;
|
|
90
|
+
}, x = (e, t) => {
|
|
88
91
|
e.sort((e, n) => {
|
|
89
92
|
if (t) {
|
|
90
93
|
if (e.name === "SKILL.md") return -1;
|
|
@@ -92,32 +95,36 @@ var c = {
|
|
|
92
95
|
}
|
|
93
96
|
return e.name.localeCompare(n.name);
|
|
94
97
|
});
|
|
95
|
-
for (let t of e) t.type ===
|
|
96
|
-
},
|
|
97
|
-
let n = /* @__PURE__ */ new Map(),
|
|
98
|
-
for (let
|
|
99
|
-
let e =
|
|
98
|
+
for (let t of e) t.type === s.Folder && x(t.items, !1);
|
|
99
|
+
}, S = (e, t) => {
|
|
100
|
+
let n = /* @__PURE__ */ new Map(), i = [];
|
|
101
|
+
for (let a of e) {
|
|
102
|
+
let e = _(a.path, t);
|
|
100
103
|
if (e == null) continue;
|
|
101
|
-
if (
|
|
102
|
-
|
|
104
|
+
if (a.nodeType === c.Folder) {
|
|
105
|
+
b(e, n, i);
|
|
103
106
|
continue;
|
|
104
107
|
}
|
|
105
|
-
let
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
108
|
+
let o = e.lastIndexOf("/"), l = o === -1 ? "" : e.slice(0, o);
|
|
109
|
+
if (a.name === r) {
|
|
110
|
+
b(l, n, i);
|
|
111
|
+
continue;
|
|
112
|
+
}
|
|
113
|
+
b(l, n, i).push({
|
|
114
|
+
type: s.File,
|
|
115
|
+
id: a.path,
|
|
116
|
+
name: a.name
|
|
110
117
|
});
|
|
111
118
|
}
|
|
112
|
-
return
|
|
113
|
-
},
|
|
119
|
+
return x(i, !0), i;
|
|
120
|
+
}, C = async (e) => {
|
|
114
121
|
let t = Number(e.headers.get("content-length"));
|
|
115
122
|
if (Number.isFinite(t) && t > 262144) return null;
|
|
116
123
|
let n = await e.arrayBuffer();
|
|
117
124
|
return n.byteLength > 262144 ? null : new Uint8Array(n);
|
|
118
|
-
},
|
|
119
|
-
let t = await
|
|
125
|
+
}, w = async (e) => new Uint8Array(await e.arrayBuffer()), T = async (e) => {
|
|
126
|
+
let t = await C(e);
|
|
120
127
|
return t == null ? null : new TextDecoder().decode(t);
|
|
121
128
|
};
|
|
122
129
|
//#endregion
|
|
123
|
-
export {
|
|
130
|
+
export { S as buildSkillContentTree, y as buildSkillOverview, f as mapSkillToCatalogItem, C as readSkillFileBytes, w as readSkillFilePreviewBytes, T as readSkillManifest, v as resolveSkillFileDownloadPath, g as resolveSkillManifestFileId };
|
package/catalog/publish.js
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
import { safeDecodeURIComponent as e } from "../shared/string-utils.js";
|
|
2
|
-
import { CatalogEntityType as t } from "@epam/ai-dial-chat-shared";
|
|
2
|
+
import { CatalogEntityType as t, PUBLIC_BUCKET as n } from "@epam/ai-dial-chat-shared";
|
|
3
3
|
//#region src/catalog/publish.ts
|
|
4
|
-
var
|
|
4
|
+
var r = {
|
|
5
5
|
[t.Model]: "model",
|
|
6
6
|
[t.Toolset]: "toolset",
|
|
7
7
|
[t.Agent]: "application",
|
|
8
8
|
[t.Prompt]: "prompt",
|
|
9
9
|
[t.Skill]: "skill"
|
|
10
|
-
},
|
|
10
|
+
}, i = (e) => r[e], a = (e) => e.split("/")[1] === n, 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)
|
|
17
18
|
});
|
|
18
19
|
//#endregion
|
|
19
|
-
export { o as getPublicCatalogEntityFolderPath, a as isPublicCatalogEntityId, c as mapPublishConversationResultDto, s as mapPublishHistoryEntryDto,
|
|
20
|
+
export { o as getPublicCatalogEntityFolderPath, a as isPublicCatalogEntityId, c as mapPublishConversationResultDto, s as mapPublishHistoryEntryDto, i as toPublishEntityType };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { useCallback as e, useEffect as t, useRef as n, useState as r } from "react";
|
|
2
|
+
//#region src/catalog/useApplicationCredentials/useApplicationCredentials.ts
|
|
3
|
+
var i = ({ appId: i, externalServicesClient: a, offlineCredentialsClient: o }) => {
|
|
4
|
+
let [s, c] = r([]), [l, u] = r(!1), [d, f] = r(!0), [p, m] = r(!1), h = n(0), g = n(null), _ = e(async () => {
|
|
5
|
+
if (g.current !== i) return;
|
|
6
|
+
let e = ++h.current;
|
|
7
|
+
f(!0), m(!1);
|
|
8
|
+
try {
|
|
9
|
+
let t = await a.listExternalServices({ appId: i });
|
|
10
|
+
if (h.current !== e) return;
|
|
11
|
+
let n = t.some((e) => e.authenticationType === "DIAL_NATIVE") ? await o.getOfflineCredentials() : void 0;
|
|
12
|
+
if (h.current !== e) return;
|
|
13
|
+
c(t.filter((e) => e.authenticationType !== "NONE")), u(n?.connected ?? !1);
|
|
14
|
+
} catch {
|
|
15
|
+
h.current === e && m(!0);
|
|
16
|
+
} finally {
|
|
17
|
+
h.current === e && f(!1);
|
|
18
|
+
}
|
|
19
|
+
}, [
|
|
20
|
+
i,
|
|
21
|
+
a,
|
|
22
|
+
o
|
|
23
|
+
]), v = e(() => {
|
|
24
|
+
g.current = null, h.current++;
|
|
25
|
+
}, []);
|
|
26
|
+
return t(() => (g.current = i, c([]), f(!0), u(!1), _(), v), [
|
|
27
|
+
i,
|
|
28
|
+
_,
|
|
29
|
+
v
|
|
30
|
+
]), {
|
|
31
|
+
services: s,
|
|
32
|
+
isOfflineConnected: l,
|
|
33
|
+
isLoading: d,
|
|
34
|
+
hasError: p,
|
|
35
|
+
refresh: _
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
//#endregion
|
|
39
|
+
export { i as useApplicationCredentials };
|
|
@@ -1,109 +1,130 @@
|
|
|
1
1
|
import { getApiErrorDetails as e } from "../../api-error/api-error.js";
|
|
2
2
|
import { findDeploymentByIdOrReference as t } from "../deployment-id.js";
|
|
3
3
|
import { parseSkillResourceUrl as n } from "../../skill/skill-types.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { getRunnerSchemas as r, isQuickAppSchema as i } from "../../shared/application-schema.js";
|
|
5
|
+
import { CatalogEntityType as a } from "@epam/ai-dial-chat-shared";
|
|
6
|
+
import { useCallback as o, useMemo as s, useState as c } from "react";
|
|
6
7
|
//#region src/catalog/useCatalogEditNavigation/useCatalogEditNavigation.ts
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
if (
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
label
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
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 = [{
|
|
82
89
|
key: "skill-write-instructions",
|
|
83
|
-
label:
|
|
84
|
-
onClick: () =>
|
|
90
|
+
label: D.createSkillWriteInstructions,
|
|
91
|
+
onClick: () => _(g.buildSkillCreateUrl())
|
|
85
92
|
}, {
|
|
86
93
|
key: "skill-upload",
|
|
87
|
-
label:
|
|
88
|
-
onClick:
|
|
89
|
-
}]
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
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({
|
|
102
|
+
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
|
+
])
|
|
127
|
+
};
|
|
128
|
+
};
|
|
108
129
|
//#endregion
|
|
109
|
-
export {
|
|
130
|
+
export { l as useCatalogEditNavigation };
|
|
@@ -48,7 +48,7 @@ var c = "Production", l = 50, u = (e, t, n) => {
|
|
|
48
48
|
return b((e) => e.includes(n) ? e : [...e, n]), Promise.resolve();
|
|
49
49
|
}, []), T = e((e) => {
|
|
50
50
|
let t = s(e), n = Array.isArray(d) ? d : [];
|
|
51
|
-
!t || n
|
|
51
|
+
!t || n[0] === t || f?.([t, ...n.filter((e) => e !== t)].slice(0, l));
|
|
52
52
|
}, [d, f]), E = e((e) => !e.includes(c), []);
|
|
53
53
|
return {
|
|
54
54
|
folderItems: n(() => {
|
|
@@ -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,
|