@epam/ai-dial-chat-hooks 1.2.0-dev.155 → 1.2.0-dev.159
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-deployment-to-catalog-item.js +34 -34
- package/catalog/publish.js +4 -4
- package/catalog.d.ts +5 -1
- package/conversation/conversation-transfer/export-conversation.js +24 -16
- package/conversation/conversation-transfer/import-conversation.js +80 -31
- package/conversation/useConversationExport/useConversationExport.js +9 -9
- package/conversation/useConversationImport/useConversationImport.js +123 -121
- package/conversation-transfer.d.ts +2 -1
- package/index.d.ts +7 -2
- package/oauth/toolset-id.js +3 -2
- package/package.json +16 -16
- package/skill/skill-types.js +8 -7
|
@@ -2,52 +2,52 @@ import { safeDecodeURIComponent as e } from "../shared/string-utils.js";
|
|
|
2
2
|
import { isPublicToolsetId as t } from "../oauth/toolset-id.js";
|
|
3
3
|
import { resolveLocalizedText as n } from "../shared/locale.js";
|
|
4
4
|
import { mapEntityDetailsToCatalogDetails as r } from "./map-entity-details-to-catalog.js";
|
|
5
|
-
import { CatalogEntityType as i,
|
|
6
|
-
import { CredentialStatus as
|
|
5
|
+
import { CatalogEntityType as i, PUBLIC_BUCKET as a, formatLastUsed as o } from "@epam/ai-dial-chat-shared";
|
|
6
|
+
import { CredentialStatus as s, ToolsetAuthenticationType as c } from "@epam/ai-dial-catalog";
|
|
7
7
|
//#region src/catalog/map-deployment-to-catalog-item.ts
|
|
8
|
-
var
|
|
9
|
-
NONE:
|
|
10
|
-
API_KEY:
|
|
11
|
-
OAUTH:
|
|
12
|
-
},
|
|
13
|
-
SIGNED_IN:
|
|
14
|
-
SIGNED_OUT:
|
|
15
|
-
FAILED:
|
|
16
|
-
},
|
|
8
|
+
var l = {
|
|
9
|
+
NONE: c.None,
|
|
10
|
+
API_KEY: c.ApiKey,
|
|
11
|
+
OAUTH: c.OAuth
|
|
12
|
+
}, u = {
|
|
13
|
+
SIGNED_IN: s.SignedIn,
|
|
14
|
+
SIGNED_OUT: s.SignedOut,
|
|
15
|
+
FAILED: s.Failed
|
|
16
|
+
}, d = (e, n, r) => {
|
|
17
17
|
if (n == null) return;
|
|
18
|
-
let i = t(e), a = n.userLevelAuthStatus ?
|
|
18
|
+
let i = t(e), a = n.userLevelAuthStatus ? u[n.userLevelAuthStatus] : void 0, o = n.globalAuthStatus ? u[n.globalAuthStatus] : void 0;
|
|
19
19
|
return {
|
|
20
|
-
authenticationType: !r && i && a !==
|
|
20
|
+
authenticationType: !r && i && a !== s.SignedIn && o === s.SignedIn ? c.None : l[n.authenticationType],
|
|
21
21
|
userStatus: a,
|
|
22
|
-
globalStatus:
|
|
22
|
+
globalStatus: o,
|
|
23
23
|
isPublic: i,
|
|
24
24
|
isManageableByAdmin: r && i,
|
|
25
25
|
apiKeyHeader: n.apiKeyHeader
|
|
26
26
|
};
|
|
27
|
-
},
|
|
27
|
+
}, f = {
|
|
28
28
|
model: i.Model,
|
|
29
29
|
toolset: i.Toolset,
|
|
30
30
|
application: i.Agent
|
|
31
|
-
},
|
|
31
|
+
}, p = "applications/", m = "toolsets/", h = (t, n) => (t.startsWith(n) ? t.slice(n.length) : t).split("/").filter(Boolean).map(e), g = (e, t) => {
|
|
32
32
|
if (e.isMy) return [t.personal];
|
|
33
|
-
let n = h(e.applicationFolder ?? "",
|
|
34
|
-
return e.sharedWithMe ? [t.shared, ...n.slice(1)] : n.length === 0 && e.type?.toLowerCase() === "application" ? [t.public] : n[0]?.toLowerCase() ===
|
|
33
|
+
let n = h(e.applicationFolder ?? "", p);
|
|
34
|
+
return e.sharedWithMe ? [t.shared, ...n.slice(1)] : n.length === 0 && e.type?.toLowerCase() === "application" ? [t.public] : n[0]?.toLowerCase() === a ? [t.public, ...n.slice(1)] : n;
|
|
35
35
|
}, _ = (e, t) => {
|
|
36
36
|
if (e.isMy && t != null) return [t.personal];
|
|
37
37
|
let n = e.toolset || e.id;
|
|
38
|
-
if (!n.startsWith(
|
|
39
|
-
let r = h(n,
|
|
40
|
-
return e.sharedWithMe && t != null ? [t.shared, ...r.slice(1)] : r[0]?.toLowerCase() ===
|
|
41
|
-
}, v = (e, { favoriteIds: t = /* @__PURE__ */ new Set(), entityDetails:
|
|
42
|
-
let m = n(e.displayName, u,
|
|
38
|
+
if (!n.startsWith(m)) return t == null ? [] : e.sharedWithMe ? [t.shared] : n.length > 0 && !n.includes("/") ? [t.public] : [];
|
|
39
|
+
let r = h(n, m).slice(0, -1);
|
|
40
|
+
return e.sharedWithMe && t != null ? [t.shared, ...r.slice(1)] : r[0]?.toLowerCase() === a && t != null ? [t.public, ...r.slice(1)] : r.slice(1);
|
|
41
|
+
}, v = (e, { favoriteIds: t = /* @__PURE__ */ new Set(), entityDetails: a, folderLabels: s, editableSchemaIds: c = [], isCustomAppsEditable: l = !1, activeLocale: u, primaryLocale: d, resolveIconUrl: p }) => {
|
|
42
|
+
let m = n(e.displayName, u, d) || e.id, h = (e.type ?? "").toLowerCase();
|
|
43
43
|
return {
|
|
44
44
|
id: e.id,
|
|
45
|
-
type:
|
|
45
|
+
type: f[h] ?? i.Model,
|
|
46
46
|
name: m,
|
|
47
|
-
description: n(e.description, u,
|
|
47
|
+
description: n(e.description, u, d),
|
|
48
48
|
iconUrl: p(e.iconUrl),
|
|
49
49
|
version: e.displayVersion ?? "",
|
|
50
|
-
lastUsed:
|
|
50
|
+
lastUsed: o(e.updatedAt),
|
|
51
51
|
updatedAt: e.updatedAt,
|
|
52
52
|
createdAt: e.createdAt,
|
|
53
53
|
isFeatured: e.isFeatured ?? !1,
|
|
@@ -59,20 +59,20 @@ var c = {
|
|
|
59
59
|
sharedWithMe: e.sharedWithMe ?? !1,
|
|
60
60
|
isEditable: (!!e.isMy || !!e.canEdit) && (c.length > 0 && c.includes(e.applicationTypeSchemaId ?? "") || l && !e.applicationTypeSchemaId && h === "application"),
|
|
61
61
|
folder: g(e, s),
|
|
62
|
-
details:
|
|
62
|
+
details: a == null ? void 0 : r(a),
|
|
63
63
|
supportsMcp: e.features?.mcp === !0,
|
|
64
64
|
supportsChat: e.interfaces == null || e.interfaces.includes("chat")
|
|
65
65
|
};
|
|
66
|
-
}, y = (e, { favoriteIds: t = /* @__PURE__ */ new Set(), isAdmin: r = !1, folderLabels:
|
|
67
|
-
let
|
|
66
|
+
}, y = (e, { favoriteIds: t = /* @__PURE__ */ new Set(), isAdmin: r = !1, folderLabels: a, activeLocale: s, primaryLocale: c, resolveIconUrl: l }) => {
|
|
67
|
+
let u = n(e.displayName, s, c) || e.toolset || e.reference || e.id, f = e.allowedTools ?? [];
|
|
68
68
|
return {
|
|
69
69
|
id: e.id,
|
|
70
70
|
type: i.Toolset,
|
|
71
|
-
name:
|
|
71
|
+
name: u,
|
|
72
72
|
description: n(e.description, s, c),
|
|
73
73
|
iconUrl: l(e.iconUrl),
|
|
74
74
|
version: e.displayVersion ?? "",
|
|
75
|
-
lastUsed:
|
|
75
|
+
lastUsed: o(e.updatedAt),
|
|
76
76
|
updatedAt: e.updatedAt,
|
|
77
77
|
createdAt: e.createdAt,
|
|
78
78
|
isFeatured: !1,
|
|
@@ -83,10 +83,10 @@ var c = {
|
|
|
83
83
|
isMyApp: e.isMy ?? !1,
|
|
84
84
|
sharedWithMe: e.sharedWithMe ?? !1,
|
|
85
85
|
isEditable: !!(e.isMy || e.canEdit),
|
|
86
|
-
folder: _(e,
|
|
87
|
-
credentials:
|
|
86
|
+
folder: _(e, a),
|
|
87
|
+
credentials: d(e.id, e.authSettings, r),
|
|
88
88
|
details: f.length > 0 ? { tools: { tools: f.map((e) => ({ name: e })) } } : void 0
|
|
89
89
|
};
|
|
90
90
|
};
|
|
91
91
|
//#endregion
|
|
92
|
-
export { v as mapDeploymentToCatalogItem,
|
|
92
|
+
export { v as mapDeploymentToCatalogItem, d as mapDeploymentToolsetCredentials, y as mapToolsetToCatalogItem, g as resolveDeploymentFolder };
|
package/catalog/publish.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
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
13
|
folderPath: e.folderPath.split("/").filter(Boolean),
|
|
@@ -17,4 +17,4 @@ var n = {
|
|
|
17
17
|
folderPath: e.folderPath.split("/").filter(Boolean)
|
|
18
18
|
});
|
|
19
19
|
//#endregion
|
|
20
|
-
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 };
|
package/catalog.d.ts
CHANGED
|
@@ -646,7 +646,11 @@ declare enum PromptSource {
|
|
|
646
646
|
Public = "public"
|
|
647
647
|
}
|
|
648
648
|
|
|
649
|
-
/**
|
|
649
|
+
/**
|
|
650
|
+
* DIAL Core bucket holding organisation-wide skills.
|
|
651
|
+
*
|
|
652
|
+
* @deprecated Use `PUBLIC_BUCKET` from `@epam/ai-dial-chat-shared`.
|
|
653
|
+
*/
|
|
650
654
|
export declare const PUBLIC_SKILL_BUCKET = "public";
|
|
651
655
|
|
|
652
656
|
/** The DIAL publish API surface produced by {@link createPublishApiClient}. */
|
|
@@ -1,32 +1,40 @@
|
|
|
1
1
|
import { formatDateYMD as e } from "./date.js";
|
|
2
2
|
import { ExportFileNameKind as t } from "./types.js";
|
|
3
3
|
//#region src/conversation/conversation-transfer/export-conversation.ts
|
|
4
|
-
var n = "ai_dial", r = (e) => e.map(({ attachments: e, ...t }) => t), i = (e) => {
|
|
4
|
+
var n = "ai_dial", r = (e) => e.map(({ attachments: e, ...t }) => t), i = (e) => e.map((e) => {
|
|
5
|
+
if (e.body?.source == null) return e;
|
|
6
|
+
let { source: t, ...n } = e.body;
|
|
7
|
+
return {
|
|
8
|
+
...e,
|
|
9
|
+
body: n
|
|
10
|
+
};
|
|
11
|
+
}), a = (e) => {
|
|
5
12
|
let t = e.custom_content;
|
|
6
13
|
if (!t) return e;
|
|
7
|
-
let { attachments: n, stages:
|
|
8
|
-
if (n == null &&
|
|
9
|
-
let
|
|
10
|
-
...
|
|
11
|
-
...
|
|
14
|
+
let { attachments: n, stages: a, annotations: o, ...s } = t;
|
|
15
|
+
if (n == null && a == null && o == null) return e;
|
|
16
|
+
let c = {
|
|
17
|
+
...s,
|
|
18
|
+
...a ? { stages: r(a) } : {},
|
|
19
|
+
...o ? { annotations: i(o) } : {}
|
|
12
20
|
};
|
|
13
|
-
if (Object.keys(
|
|
21
|
+
if (Object.keys(c).length > 0) return {
|
|
14
22
|
...e,
|
|
15
|
-
custom_content:
|
|
23
|
+
custom_content: c
|
|
16
24
|
};
|
|
17
|
-
let { custom_content:
|
|
18
|
-
return
|
|
19
|
-
},
|
|
25
|
+
let { custom_content: l, ...u } = e;
|
|
26
|
+
return u;
|
|
27
|
+
}, o = (e) => ({
|
|
20
28
|
...e,
|
|
21
|
-
messages: e.messages.map(
|
|
22
|
-
}),
|
|
29
|
+
messages: e.messages.map(a)
|
|
30
|
+
}), s = (e, t = []) => ({
|
|
23
31
|
version: 5,
|
|
24
32
|
history: e,
|
|
25
33
|
folders: t
|
|
26
|
-
}),
|
|
34
|
+
}), c = (e) => new Blob([JSON.stringify(e, null, 2)], { type: "application/json" }), l = {
|
|
27
35
|
[t.SingleConversation]: "json",
|
|
28
36
|
[t.SingleConversationWithAttachments]: "dial",
|
|
29
37
|
[t.AllConversationsHistory]: "json"
|
|
30
|
-
},
|
|
38
|
+
}, u = (t, n, r = /* @__PURE__ */ new Date()) => `${e(r)}_${n}_${t}.${l[t]}`;
|
|
31
39
|
//#endregion
|
|
32
|
-
export { n as EXPORT_APP_NAME,
|
|
40
|
+
export { n as EXPORT_APP_NAME, s as buildExportEnvelope, u as buildExportFileName, c as serializeExportEnvelope, o as stripConversationAttachments };
|
|
@@ -1,57 +1,57 @@
|
|
|
1
1
|
import { collectAttachmentRefs as e, splitFileIdAnchor as t } from "./attachment-refs.js";
|
|
2
2
|
import { resolveDialFileBucketAndPath as n } from "./dial-file-resolve.js";
|
|
3
|
-
import {
|
|
3
|
+
import { PUBLIC_BUCKET as r, generateUUID as i, sanitizeConversationName as a, stripTrailingDots as o, truncateToUtf8Bytes as s } from "@epam/ai-dial-chat-shared";
|
|
4
4
|
//#region src/conversation/conversation-transfer/import-conversation.ts
|
|
5
|
-
var
|
|
5
|
+
var c = class extends Error {
|
|
6
6
|
constructor(e) {
|
|
7
7
|
super(e), this.name = "UnsupportedImportFormatError";
|
|
8
8
|
}
|
|
9
|
-
},
|
|
9
|
+
}, l = (e) => typeof e == "object" && !!e, u = 5, d = (e) => {
|
|
10
10
|
let t;
|
|
11
11
|
try {
|
|
12
12
|
t = JSON.parse(e);
|
|
13
13
|
} catch {
|
|
14
|
-
throw new
|
|
14
|
+
throw new c("Import file is not valid JSON");
|
|
15
15
|
}
|
|
16
|
-
if (!
|
|
16
|
+
if (!l(t) || t.version !== u || !Array.isArray(t.history)) throw new c("Import file is not a supported export format");
|
|
17
17
|
let n = Array.isArray(t.folders) ? t.folders : [];
|
|
18
18
|
return {
|
|
19
|
-
version:
|
|
19
|
+
version: u,
|
|
20
20
|
history: t.history,
|
|
21
21
|
folders: n
|
|
22
22
|
};
|
|
23
|
-
},
|
|
24
|
-
let
|
|
25
|
-
if (
|
|
26
|
-
let a = n &&
|
|
23
|
+
}, f = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i, p = "__", m = 255, h = "applications", g = /[-+]/, _ = /^\d+$/, v = (e) => e ? e.split(g)[0].split(".").every((e) => _.test(e)) : !1, y = (e) => o(s(e.replace(/\r\n|\r/g, "\n").split("\n").map((e) => a(e).trim()).filter(Boolean)[0] ?? "", m)).trimEnd(), b = (e, t, n) => {
|
|
24
|
+
let r = e.split(p);
|
|
25
|
+
if (r.length < 2) return [e, i()].join(p);
|
|
26
|
+
let a = n && v(r[1]) ? r.slice(0, 2) : r.slice(0, 1), o = a.length > 1 ? f.test(r[r.length - 1]) : r.length >= 3, s = r.slice(a.length, o ? -1 : void 0).join(p);
|
|
27
27
|
return [
|
|
28
28
|
...a,
|
|
29
29
|
t || s,
|
|
30
|
-
|
|
31
|
-
].join(
|
|
32
|
-
},
|
|
33
|
-
let n =
|
|
30
|
+
i()
|
|
31
|
+
].join(p);
|
|
32
|
+
}, x = "conversations/", S = (e) => e.startsWith(x) ? e.slice(14) : e, C = (e, t) => {
|
|
33
|
+
let n = S(e.id), r = n.split("/"), i = S(e.folderId), a = r[0], o = i.startsWith(`${a}/`) ? i.slice(a.length + 1).split("/").filter(Boolean) : [], s = r.slice(1).slice(o.length), c = s.slice(0, -1), l = s.at(-1) ?? r.at(-1) ?? n, u = [...o, ...c], d = y(e.name), f = b(l, d, u[0] === h), p = [...u, f].join("/"), m = o.length ? `${t}/${o.join("/")}` : t;
|
|
34
34
|
return {
|
|
35
35
|
conversation: {
|
|
36
36
|
...e,
|
|
37
37
|
...d ? { name: d } : {},
|
|
38
38
|
id: `${t}/${p}`,
|
|
39
|
-
folderId:
|
|
39
|
+
folderId: m
|
|
40
40
|
},
|
|
41
41
|
subPath: p
|
|
42
42
|
};
|
|
43
|
-
},
|
|
44
|
-
let t =
|
|
43
|
+
}, w = (e) => {
|
|
44
|
+
let t = S(e.folderId).split("/").filter(Boolean).slice(1);
|
|
45
45
|
return t.length ? t.join(" / ") : void 0;
|
|
46
|
-
},
|
|
46
|
+
}, T = (e) => e.map((e) => `"${e}"`).join(", "), E = (e, n) => {
|
|
47
47
|
if (!e) return;
|
|
48
48
|
let { fileId: r, anchor: i } = t(e), a = n.get(r);
|
|
49
49
|
if (a != null) return {
|
|
50
50
|
...a,
|
|
51
51
|
url: `${a.url}${i}`
|
|
52
52
|
};
|
|
53
|
-
},
|
|
54
|
-
let n =
|
|
53
|
+
}, D = (e, t) => {
|
|
54
|
+
let n = E(e.url, t), r = E(e.reference_url, t);
|
|
55
55
|
if (n == null && r == null) return;
|
|
56
56
|
let i = n?.title ?? r?.title;
|
|
57
57
|
return {
|
|
@@ -59,19 +59,19 @@ var s = class extends Error {
|
|
|
59
59
|
...r == null ? {} : { reference_url: r.url },
|
|
60
60
|
...i == null ? {} : { title: i }
|
|
61
61
|
};
|
|
62
|
-
},
|
|
62
|
+
}, O = (e, t) => e.map((e) => e.attachments?.length ? {
|
|
63
63
|
...e,
|
|
64
64
|
attachments: e.attachments.map((e) => {
|
|
65
|
-
let n =
|
|
65
|
+
let n = D(e, t);
|
|
66
66
|
return n ? {
|
|
67
67
|
...e,
|
|
68
68
|
...n
|
|
69
69
|
} : e;
|
|
70
70
|
})
|
|
71
|
-
} : e),
|
|
71
|
+
} : e), k = (e, t) => e.map((e) => {
|
|
72
72
|
let n = e.body?.source;
|
|
73
73
|
if (n?.attachment == null) return e;
|
|
74
|
-
let r =
|
|
74
|
+
let r = D(n.attachment, t);
|
|
75
75
|
return r == null ? e : {
|
|
76
76
|
...e,
|
|
77
77
|
body: {
|
|
@@ -85,7 +85,7 @@ var s = class extends Error {
|
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
87
|
};
|
|
88
|
-
}),
|
|
88
|
+
}), A = (e, t) => ({
|
|
89
89
|
...e,
|
|
90
90
|
messages: e.messages.map((e) => {
|
|
91
91
|
let n = e.custom_content;
|
|
@@ -96,23 +96,72 @@ var s = class extends Error {
|
|
|
96
96
|
custom_content: {
|
|
97
97
|
...n,
|
|
98
98
|
...r?.length ? { attachments: r.map((e) => {
|
|
99
|
-
let n =
|
|
99
|
+
let n = D(e, t);
|
|
100
100
|
return n ? {
|
|
101
101
|
...e,
|
|
102
102
|
...n
|
|
103
103
|
} : e;
|
|
104
104
|
}) } : {},
|
|
105
|
-
...i?.length ? { stages:
|
|
106
|
-
...a?.length ? { annotations:
|
|
105
|
+
...i?.length ? { stages: O(i, t) } : {},
|
|
106
|
+
...a?.length ? { annotations: k(a, t) } : {}
|
|
107
107
|
}
|
|
108
108
|
};
|
|
109
109
|
})
|
|
110
|
-
}),
|
|
110
|
+
}), j = (e, i) => {
|
|
111
|
+
if (!e) return;
|
|
112
|
+
let a = n(t(e).fileId);
|
|
113
|
+
if (!(!a || a.bucket === i || a.bucket === r)) return a.path.split("/").pop() || a.path;
|
|
114
|
+
}, M = (e, t, n) => e.flatMap((e) => {
|
|
115
|
+
let r = j(e.url, t);
|
|
116
|
+
if (r != null) return n.push(r), [];
|
|
117
|
+
let i = j(e.reference_url, t);
|
|
118
|
+
if (i == null) return [e];
|
|
119
|
+
n.push(i);
|
|
120
|
+
let { reference_url: a, reference_type: o, ...s } = e;
|
|
121
|
+
return s.url == null && s.data == null ? [] : [s];
|
|
122
|
+
}), N = (e, t, n) => e.map((e) => {
|
|
123
|
+
let r = e.body, i = j(r?.source?.attachment?.url, t);
|
|
124
|
+
if (r == null || i == null) return e;
|
|
125
|
+
n.push(i);
|
|
126
|
+
let { source: a, ...o } = r;
|
|
127
|
+
return {
|
|
128
|
+
...e,
|
|
129
|
+
body: o
|
|
130
|
+
};
|
|
131
|
+
}), P = (e, t) => {
|
|
132
|
+
let n = [], r = e.messages.map((e) => {
|
|
133
|
+
let r = e.custom_content;
|
|
134
|
+
if (!r) return e;
|
|
135
|
+
let { attachments: i, stages: a, annotations: o } = r;
|
|
136
|
+
return !i?.length && !a?.length && !o?.length ? e : {
|
|
137
|
+
...e,
|
|
138
|
+
custom_content: {
|
|
139
|
+
...r,
|
|
140
|
+
...i?.length ? { attachments: M(i, t, n) } : {},
|
|
141
|
+
...a?.length ? { stages: a.map((e) => e.attachments?.length ? {
|
|
142
|
+
...e,
|
|
143
|
+
attachments: M(e.attachments, t, n)
|
|
144
|
+
} : e) } : {},
|
|
145
|
+
...o?.length ? { annotations: N(o, t, n) } : {}
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
});
|
|
149
|
+
return n.length ? {
|
|
150
|
+
conversation: {
|
|
151
|
+
...e,
|
|
152
|
+
messages: r
|
|
153
|
+
},
|
|
154
|
+
droppedNames: n
|
|
155
|
+
} : {
|
|
156
|
+
conversation: e,
|
|
157
|
+
droppedNames: n
|
|
158
|
+
};
|
|
159
|
+
}, F = (e) => e.split("/").pop() || e, I = (t, r, i) => {
|
|
111
160
|
let a = [], o = [];
|
|
112
161
|
for (let s of e(t)) {
|
|
113
162
|
let e = n(s.fileId);
|
|
114
163
|
if (!e) {
|
|
115
|
-
o.push(
|
|
164
|
+
o.push(F(s.fileId));
|
|
116
165
|
continue;
|
|
117
166
|
}
|
|
118
167
|
let t = e.path.split("/").pop() ?? e.path, c = r.get(e.path);
|
|
@@ -133,4 +182,4 @@ var s = class extends Error {
|
|
|
133
182
|
};
|
|
134
183
|
};
|
|
135
184
|
//#endregion
|
|
136
|
-
export {
|
|
185
|
+
export { c as UnsupportedImportFormatError, P as dropForeignAttachmentRefs, T as formatQuotedNameList, w as getFolderBreadcrumb, d as parseImportEnvelope, I as planAttachmentUploads, C as rebaseConversationId, A as rewriteAttachmentUrls };
|
|
@@ -171,12 +171,12 @@ var S = 5, C = 512 * 1024 * 1024, w = 429, T = 5, E = 2e3, D = (e) => e instance
|
|
|
171
171
|
}, s);
|
|
172
172
|
return I.startJob(c, (e) => R(c, t, i, o, s, e));
|
|
173
173
|
}, [I, R]), B = b(async (e, t, n) => {
|
|
174
|
-
let r = d.ExportAll, a = [],
|
|
174
|
+
let r = d.ExportAll, a = [], c;
|
|
175
175
|
do {
|
|
176
176
|
if (n.aborted) return;
|
|
177
177
|
let t;
|
|
178
178
|
try {
|
|
179
|
-
t = await x.listConversations({ nextToken:
|
|
179
|
+
t = await x.listConversations({ nextToken: c }, { signal: n });
|
|
180
180
|
} catch (t) {
|
|
181
181
|
if (n.aborted) return;
|
|
182
182
|
if (E(t).isUnauthorized) F?.({
|
|
@@ -197,18 +197,18 @@ var S = 5, C = 512 * 1024 * 1024, w = 429, T = 5, E = 2e3, D = (e) => e instance
|
|
|
197
197
|
a.push(...t.items.filter(j).map((e) => ({
|
|
198
198
|
id: e.id,
|
|
199
199
|
title: e.title
|
|
200
|
-
}))),
|
|
201
|
-
} while (
|
|
200
|
+
}))), c = t.nextToken;
|
|
201
|
+
} while (c);
|
|
202
202
|
I.setJobProgress(e, p({
|
|
203
203
|
kind: r,
|
|
204
204
|
phase: f.Prepare
|
|
205
205
|
}));
|
|
206
|
-
let
|
|
206
|
+
let l = [];
|
|
207
207
|
for (let t of a) {
|
|
208
208
|
if (n.aborted) return;
|
|
209
209
|
try {
|
|
210
210
|
let e = await A(x, T(t.id), n);
|
|
211
|
-
|
|
211
|
+
l.push(e);
|
|
212
212
|
} catch (r) {
|
|
213
213
|
if (n.aborted) return;
|
|
214
214
|
let i = E(r);
|
|
@@ -240,17 +240,17 @@ var S = 5, C = 512 * 1024 * 1024, w = 429, T = 5, E = 2e3, D = (e) => e instance
|
|
|
240
240
|
I.setJobProgress(e, p({
|
|
241
241
|
kind: r,
|
|
242
242
|
phase: f.Transfer,
|
|
243
|
-
completed:
|
|
243
|
+
completed: l.length,
|
|
244
244
|
total: a.length
|
|
245
245
|
}, {
|
|
246
|
-
completed:
|
|
246
|
+
completed: l.length,
|
|
247
247
|
total: a.length,
|
|
248
248
|
kind: v.Conversation
|
|
249
249
|
}));
|
|
250
250
|
}
|
|
251
251
|
}
|
|
252
252
|
if (!n.aborted) try {
|
|
253
|
-
y(o(i(
|
|
253
|
+
y(o(i(l.map(s), [])), t), k?.({ jobId: e }), I.succeedJob(e);
|
|
254
254
|
} catch (t) {
|
|
255
255
|
let n = M(t) ? g.FileTooLarge : g.Unknown, r = await D(t);
|
|
256
256
|
F?.({
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { formatDateYM as e } from "../conversation-transfer/date.js";
|
|
2
2
|
import { ConversationTransferWarningCode as t } from "../conversation-transfer/types.js";
|
|
3
|
-
import { UnsupportedImportFormatError as n,
|
|
4
|
-
import { createUploadPathAllocator as
|
|
5
|
-
import { runWithConcurrency as
|
|
6
|
-
import { ConversationTransferKind as
|
|
7
|
-
import { useConversationTransferQueue as
|
|
8
|
-
import { parseDialArchive as
|
|
9
|
-
import { ConversationTransferErrorCode as
|
|
10
|
-
import { useCallback as
|
|
3
|
+
import { UnsupportedImportFormatError as n, dropForeignAttachmentRefs as r, getFolderBreadcrumb as i, parseImportEnvelope as a, planAttachmentUploads as o, rebaseConversationId as s, rewriteAttachmentUrls as c } from "../conversation-transfer/import-conversation.js";
|
|
4
|
+
import { createUploadPathAllocator as l } from "../conversation-transfer/build-upload-path.js";
|
|
5
|
+
import { runWithConcurrency as u } from "../conversation-transfer/async.js";
|
|
6
|
+
import { ConversationTransferKind as d, ConversationTransferPhase as f, buildTransferProgress as p } from "../conversation-transfer/progress.js";
|
|
7
|
+
import { useConversationTransferQueue as m } from "../conversation-transfer/queue.js";
|
|
8
|
+
import { parseDialArchive as h } from "../conversation-transfer/zip-import.js";
|
|
9
|
+
import { ConversationTransferErrorCode as g, ConversationTransferSubjectKind as _, ConversationTransferUnitKind as v, generateUUID as y } from "@epam/ai-dial-chat-shared";
|
|
10
|
+
import { useCallback as b } from "react";
|
|
11
11
|
//#region src/conversation/useConversationImport/useConversationImport.ts
|
|
12
|
-
var
|
|
12
|
+
var x = 5, S = 5, C = (e) => /\.(dial|zip)$/i.test(e.name), w = (e) => new Promise((t, n) => {
|
|
13
13
|
let r = new FileReader();
|
|
14
14
|
r.onload = () => t(r.result), r.onerror = () => n(r.error), r.readAsText(e);
|
|
15
|
-
}),
|
|
16
|
-
if (
|
|
17
|
-
let { envelope: t, attachments: n } = await
|
|
15
|
+
}), T = async (e) => {
|
|
16
|
+
if (C(e)) {
|
|
17
|
+
let { envelope: t, attachments: n } = await h(e);
|
|
18
18
|
return {
|
|
19
19
|
history: t.history,
|
|
20
20
|
attachments: n,
|
|
@@ -22,15 +22,15 @@ var b = 5, x = 5, S = (e) => /\.(dial|zip)$/i.test(e.name), C = (e) => new Promi
|
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
24
|
return {
|
|
25
|
-
history:
|
|
25
|
+
history: a(await w(e)).history,
|
|
26
26
|
attachments: /* @__PURE__ */ new Map(),
|
|
27
27
|
isArchive: !1
|
|
28
28
|
};
|
|
29
|
-
},
|
|
30
|
-
let { plan:
|
|
29
|
+
}, E = async (e, t, n, r, i, a, s, c) => {
|
|
30
|
+
let { plan: l, skippedNames: d } = o(e, t, r), f = !1, p = await u(l, x, async (e) => {
|
|
31
31
|
if (c.aborted || f) return;
|
|
32
32
|
let t = e.allocated;
|
|
33
|
-
for (let
|
|
33
|
+
for (let o = 0; o <= S; o += 1) try {
|
|
34
34
|
let r = new File([new Uint8Array(e.bytes)], t.fileName), a = await i.uploadFile({
|
|
35
35
|
bucket: n,
|
|
36
36
|
path: t.path,
|
|
@@ -45,11 +45,11 @@ var b = 5, x = 5, S = (e) => /\.(dial|zip)$/i.test(e.name), C = (e) => new Promi
|
|
|
45
45
|
};
|
|
46
46
|
} catch (n) {
|
|
47
47
|
if (c.aborted) return;
|
|
48
|
-
if (
|
|
48
|
+
if (a(n)) {
|
|
49
49
|
f = !0;
|
|
50
50
|
return;
|
|
51
51
|
}
|
|
52
|
-
if (!(typeof n == "object" && n && "response" in n && n.response?.status === 409) ||
|
|
52
|
+
if (!(typeof n == "object" && n && "response" in n && n.response?.status === 409) || o === S) return s(), {
|
|
53
53
|
kind: "skipped",
|
|
54
54
|
name: e.originalFileName
|
|
55
55
|
};
|
|
@@ -69,171 +69,173 @@ var b = 5, x = 5, S = (e) => /\.(dial|zip)$/i.test(e.name), C = (e) => new Promi
|
|
|
69
69
|
skippedNames: c.aborted || f ? [] : h,
|
|
70
70
|
isUnauthorized: !c.aborted && f
|
|
71
71
|
};
|
|
72
|
-
},
|
|
73
|
-
let
|
|
74
|
-
if (!
|
|
75
|
-
|
|
72
|
+
}, D = ({ conversationsApi: a, filesApi: o, bucket: u, onImported: h, classifyTransferError: x = () => ({}), resolveErrorTraceId: S = async () => void 0, onSuccess: C, onWarning: w, onError: D }) => {
|
|
73
|
+
let O = m(), k = b(async (n, i, m) => {
|
|
74
|
+
if (!u) {
|
|
75
|
+
D?.({
|
|
76
76
|
jobId: n,
|
|
77
|
-
code:
|
|
78
|
-
}),
|
|
77
|
+
code: g.MissingBucket
|
|
78
|
+
}), O.failJob(n, g.MissingBucket);
|
|
79
79
|
return;
|
|
80
80
|
}
|
|
81
|
-
let
|
|
82
|
-
|
|
83
|
-
kind:
|
|
84
|
-
phase:
|
|
85
|
-
completed:
|
|
86
|
-
total:
|
|
81
|
+
let _ = d.Import, y = i.attachments.size, b = 0, T = () => {
|
|
82
|
+
b += 1, O.setJobProgress(n, p({
|
|
83
|
+
kind: _,
|
|
84
|
+
phase: f.Transfer,
|
|
85
|
+
completed: b,
|
|
86
|
+
total: y
|
|
87
87
|
}, {
|
|
88
|
-
completed: Math.min(
|
|
89
|
-
total:
|
|
90
|
-
kind:
|
|
88
|
+
completed: Math.min(b, y),
|
|
89
|
+
total: y,
|
|
90
|
+
kind: v.Attachment
|
|
91
91
|
}));
|
|
92
|
-
},
|
|
93
|
-
|
|
94
|
-
kind:
|
|
95
|
-
phase:
|
|
92
|
+
}, k = (e) => {
|
|
93
|
+
O.setJobProgress(n, p({
|
|
94
|
+
kind: _,
|
|
95
|
+
phase: f.Finalize,
|
|
96
96
|
completed: e,
|
|
97
|
-
total:
|
|
97
|
+
total: i.history.length
|
|
98
98
|
}, {
|
|
99
99
|
completed: e,
|
|
100
|
-
total:
|
|
101
|
-
kind:
|
|
100
|
+
total: i.history.length,
|
|
101
|
+
kind: v.Conversation
|
|
102
102
|
}));
|
|
103
|
-
},
|
|
104
|
-
if (
|
|
105
|
-
let t = `uploads/${e(
|
|
103
|
+
}, A = [], j = [], M = /* @__PURE__ */ new Set(), N = !1, P, F = /* @__PURE__ */ new Date(), I = (e) => !!x(e).isUnauthorized, L;
|
|
104
|
+
if (i.isArchive) {
|
|
105
|
+
let t = `uploads/${e(F)}`, r = [];
|
|
106
106
|
try {
|
|
107
|
-
r = (await
|
|
108
|
-
bucket:
|
|
107
|
+
r = (await o.listFiles({
|
|
108
|
+
bucket: u,
|
|
109
109
|
path: t
|
|
110
|
-
}, { signal:
|
|
110
|
+
}, { signal: m })).items.map((e) => e.name);
|
|
111
111
|
} catch (e) {
|
|
112
|
-
if (
|
|
113
|
-
if (
|
|
114
|
-
|
|
112
|
+
if (m.aborted) return;
|
|
113
|
+
if (I(e)) {
|
|
114
|
+
D?.({
|
|
115
115
|
jobId: n,
|
|
116
|
-
code:
|
|
117
|
-
}),
|
|
116
|
+
code: g.Unauthorized
|
|
117
|
+
}), O.failJob(n, g.Unauthorized);
|
|
118
118
|
return;
|
|
119
119
|
}
|
|
120
120
|
console.error("Failed to list the upload folder for attachment name disambiguation", e);
|
|
121
121
|
}
|
|
122
|
-
|
|
123
|
-
date:
|
|
122
|
+
L = l({
|
|
123
|
+
date: F,
|
|
124
124
|
existingNames: r
|
|
125
125
|
});
|
|
126
126
|
}
|
|
127
|
-
|
|
128
|
-
kind:
|
|
129
|
-
phase:
|
|
130
|
-
})),
|
|
131
|
-
kind:
|
|
132
|
-
phase:
|
|
127
|
+
O.setJobProgress(n, p({
|
|
128
|
+
kind: _,
|
|
129
|
+
phase: f.Prepare
|
|
130
|
+
})), y === 0 && O.setJobProgress(n, p({
|
|
131
|
+
kind: _,
|
|
132
|
+
phase: f.Transfer
|
|
133
133
|
}));
|
|
134
|
-
for (let e of
|
|
135
|
-
if (
|
|
136
|
-
if (
|
|
134
|
+
for (let e of i.history) {
|
|
135
|
+
if (m.aborted) return;
|
|
136
|
+
if (N) break;
|
|
137
137
|
try {
|
|
138
138
|
let t = /* @__PURE__ */ new Map();
|
|
139
|
-
if (
|
|
140
|
-
let n = await
|
|
141
|
-
if (
|
|
139
|
+
if (i.isArchive && L) {
|
|
140
|
+
let n = await E(e, i.attachments, u, L, o, I, T, m);
|
|
141
|
+
if (m.aborted) return;
|
|
142
142
|
if (n.isUnauthorized) {
|
|
143
|
-
|
|
143
|
+
N = !0;
|
|
144
144
|
break;
|
|
145
145
|
}
|
|
146
|
-
for (let e of n.skippedNames)
|
|
146
|
+
for (let e of n.skippedNames) M.add(e);
|
|
147
147
|
t = n.targetMap;
|
|
148
148
|
}
|
|
149
|
-
let { conversation: n,
|
|
150
|
-
|
|
151
|
-
|
|
149
|
+
let { conversation: n, droppedNames: l } = r(c(e, t), u);
|
|
150
|
+
for (let e of l) M.add(e);
|
|
151
|
+
let { conversation: d, subPath: f } = s(n, u);
|
|
152
|
+
if (await a.saveConversation({
|
|
153
|
+
path: f,
|
|
152
154
|
saveConversationBodyDto: { conversation: {
|
|
153
|
-
...
|
|
155
|
+
...d,
|
|
154
156
|
llmNamingDone: !0
|
|
155
157
|
} }
|
|
156
|
-
}, { signal:
|
|
157
|
-
|
|
158
|
+
}, { signal: m }), m.aborted) return;
|
|
159
|
+
A.push(d.name);
|
|
158
160
|
} catch (t) {
|
|
159
|
-
if (
|
|
160
|
-
if (
|
|
161
|
-
|
|
161
|
+
if (m.aborted) return;
|
|
162
|
+
if (I(t)) {
|
|
163
|
+
N = !0;
|
|
162
164
|
break;
|
|
163
165
|
}
|
|
164
|
-
|
|
166
|
+
j.push(e.name), P === void 0 && (P = await S(t)), console.error("Failed to import a conversation", t);
|
|
165
167
|
}
|
|
166
|
-
|
|
168
|
+
k(A.length + j.length);
|
|
167
169
|
}
|
|
168
|
-
if (!
|
|
169
|
-
if (
|
|
170
|
-
|
|
170
|
+
if (!m.aborted) {
|
|
171
|
+
if (N) {
|
|
172
|
+
D?.({
|
|
171
173
|
jobId: n,
|
|
172
|
-
code:
|
|
173
|
-
}),
|
|
174
|
+
code: g.Unauthorized
|
|
175
|
+
}), O.failJob(n, g.Unauthorized);
|
|
174
176
|
return;
|
|
175
177
|
}
|
|
176
|
-
if (
|
|
178
|
+
if (A.length > 0) {
|
|
177
179
|
try {
|
|
178
|
-
await
|
|
180
|
+
await h?.();
|
|
179
181
|
} catch {}
|
|
180
|
-
|
|
182
|
+
C?.({
|
|
181
183
|
jobId: n,
|
|
182
|
-
titles:
|
|
184
|
+
titles: A
|
|
183
185
|
});
|
|
184
186
|
}
|
|
185
|
-
|
|
187
|
+
j.length > 0 && D?.({
|
|
186
188
|
jobId: n,
|
|
187
|
-
code:
|
|
188
|
-
titles:
|
|
189
|
-
traceId:
|
|
190
|
-
}),
|
|
189
|
+
code: g.Unknown,
|
|
190
|
+
titles: j,
|
|
191
|
+
traceId: P
|
|
192
|
+
}), M.size > 0 && w?.({
|
|
191
193
|
jobId: n,
|
|
192
194
|
code: t.AttachmentSkipped,
|
|
193
|
-
names: [...
|
|
194
|
-
}),
|
|
195
|
+
names: [...M]
|
|
196
|
+
}), j.length > 0 ? O.failJob(n, g.Unknown) : M.size > 0 ? O.warnJob(n, t.AttachmentSkipped, [...M]) : O.succeedJob(n);
|
|
195
197
|
}
|
|
196
198
|
}, [
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
i,
|
|
199
|
+
u,
|
|
200
|
+
x,
|
|
200
201
|
a,
|
|
201
|
-
|
|
202
|
-
m,
|
|
203
|
-
S,
|
|
204
|
-
C,
|
|
202
|
+
o,
|
|
205
203
|
D,
|
|
206
|
-
|
|
207
|
-
|
|
204
|
+
h,
|
|
205
|
+
C,
|
|
206
|
+
w,
|
|
207
|
+
O,
|
|
208
|
+
S
|
|
209
|
+
]), A = b(async (e) => {
|
|
208
210
|
let t;
|
|
209
211
|
try {
|
|
210
|
-
t = await
|
|
212
|
+
t = await T(e);
|
|
211
213
|
} catch (e) {
|
|
212
|
-
|
|
213
|
-
jobId:
|
|
214
|
-
code:
|
|
214
|
+
D?.({
|
|
215
|
+
jobId: y(),
|
|
216
|
+
code: g.UnsupportedFormat
|
|
215
217
|
}), e instanceof n || console.error("Failed to parse import file", e);
|
|
216
218
|
return;
|
|
217
219
|
}
|
|
218
|
-
let
|
|
219
|
-
kind:
|
|
220
|
+
let r = t.history.length > 1, a = t.history[0], o = r ? { kind: _.All } : {
|
|
221
|
+
kind: _.Single,
|
|
220
222
|
title: a?.name ?? e.name,
|
|
221
|
-
sourceBreadcrumb: a ?
|
|
222
|
-
}, s =
|
|
223
|
-
return
|
|
223
|
+
sourceBreadcrumb: a ? i(a) : void 0
|
|
224
|
+
}, s = O.addJob(o, e.name);
|
|
225
|
+
return O.startJob(s, (e) => k(s, t, e));
|
|
224
226
|
}, [
|
|
225
|
-
E,
|
|
226
227
|
D,
|
|
227
|
-
O
|
|
228
|
+
O,
|
|
229
|
+
k
|
|
228
230
|
]);
|
|
229
231
|
return {
|
|
230
|
-
jobs:
|
|
231
|
-
importConversations:
|
|
232
|
-
cancelJob:
|
|
233
|
-
dismissJob:
|
|
234
|
-
retryJob:
|
|
235
|
-
dismissAll:
|
|
232
|
+
jobs: O.jobs,
|
|
233
|
+
importConversations: A,
|
|
234
|
+
cancelJob: O.cancelJob,
|
|
235
|
+
dismissJob: O.dismissJob,
|
|
236
|
+
retryJob: O.retryJob,
|
|
237
|
+
dismissAll: O.dismissAll
|
|
236
238
|
};
|
|
237
239
|
};
|
|
238
240
|
//#endregion
|
|
239
|
-
export {
|
|
241
|
+
export { D as useConversationImport };
|
|
@@ -139,7 +139,8 @@ export declare interface UseConversationExportResult {
|
|
|
139
139
|
* `.dial`/`.zip`, v5 envelope, old- or new-chat origin) once per file, then
|
|
140
140
|
* re-uploads any archive attachments to `uploads/<YYYY-MM>/` —
|
|
141
141
|
* disambiguating a name collision with a ` (n)` suffix instead of rejecting
|
|
142
|
-
* it — rewrites attachment references (and renamed titles),
|
|
142
|
+
* it — rewrites attachment references (and renamed titles), drops any
|
|
143
|
+
* reference still pointing into another user's bucket, regenerates each
|
|
143
144
|
* conversation's id/path with a fresh UUID (collision-free save, no replace
|
|
144
145
|
* dialog), and persists every conversation through the injected
|
|
145
146
|
* `conversationsApi`. One job per imported file, not per conversation.
|
package/index.d.ts
CHANGED
|
@@ -3027,7 +3027,11 @@ export declare enum PromptSource {
|
|
|
3027
3027
|
Public = "public"
|
|
3028
3028
|
}
|
|
3029
3029
|
|
|
3030
|
-
/**
|
|
3030
|
+
/**
|
|
3031
|
+
* DIAL Core bucket holding organisation-wide skills.
|
|
3032
|
+
*
|
|
3033
|
+
* @deprecated Use `PUBLIC_BUCKET` from `@epam/ai-dial-chat-shared`.
|
|
3034
|
+
*/
|
|
3031
3035
|
export declare const PUBLIC_SKILL_BUCKET = "public";
|
|
3032
3036
|
|
|
3033
3037
|
/** The DIAL publish API surface produced by {@link createPublishApiClient}. */
|
|
@@ -4829,7 +4833,8 @@ export declare interface UseConversationHandlersResult {
|
|
|
4829
4833
|
* `.dial`/`.zip`, v5 envelope, old- or new-chat origin) once per file, then
|
|
4830
4834
|
* re-uploads any archive attachments to `uploads/<YYYY-MM>/` —
|
|
4831
4835
|
* disambiguating a name collision with a ` (n)` suffix instead of rejecting
|
|
4832
|
-
* it — rewrites attachment references (and renamed titles),
|
|
4836
|
+
* it — rewrites attachment references (and renamed titles), drops any
|
|
4837
|
+
* reference still pointing into another user's bucket, regenerates each
|
|
4833
4838
|
* conversation's id/path with a fresh UUID (collision-free save, no replace
|
|
4834
4839
|
* dialog), and persists every conversation through the injected
|
|
4835
4840
|
* `conversationsApi`. One job per imported file, not per conversation.
|
package/oauth/toolset-id.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import { PUBLIC_BUCKET as e } from "@epam/ai-dial-chat-shared";
|
|
1
2
|
//#region src/oauth/toolset-id.ts
|
|
2
|
-
var
|
|
3
|
+
var t = "toolsets/", n = (e) => e.split("/").map((e) => encodeURIComponent(e)).join("/"), r = (e) => e.split("/").map((e) => {
|
|
3
4
|
try {
|
|
4
5
|
return decodeURIComponent(e);
|
|
5
6
|
} catch {
|
|
6
7
|
return e;
|
|
7
8
|
}
|
|
8
|
-
}).join("/"), i = (n) => n.startsWith(
|
|
9
|
+
}).join("/"), i = (n) => n.startsWith(t) ? n.slice(9).split("/")[0] === e : !1;
|
|
9
10
|
//#endregion
|
|
10
11
|
export { r as decodeToolsetId, n as encodeToolsetId, i as isPublicToolsetId };
|
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.159",
|
|
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.
|
|
114
|
+
"@epam/ai-dial-chat-api-client": "1.2.0-dev.159",
|
|
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.
|
|
124
|
-
"@epam/ai-dial-attachment-input": "1.2.0-dev.
|
|
125
|
-
"@epam/ai-dial-builder-form": "1.2.0-dev.
|
|
126
|
-
"@epam/ai-dial-catalog": "1.2.0-dev.
|
|
127
|
-
"@epam/ai-dial-chat-overlay": "1.2.0-dev.
|
|
128
|
-
"@epam/ai-dial-chat-shared": "1.2.0-dev.
|
|
129
|
-
"@epam/ai-dial-mcp-apps": "1.2.0-dev.
|
|
130
|
-
"@epam/ai-dial-publish-panel": "1.2.0-dev.
|
|
131
|
-
"@epam/ai-dial-quotations": "1.2.0-dev.
|
|
123
|
+
"@epam/ai-dial-attachment-canvas": "1.2.0-dev.159",
|
|
124
|
+
"@epam/ai-dial-attachment-input": "1.2.0-dev.159",
|
|
125
|
+
"@epam/ai-dial-builder-form": "1.2.0-dev.159",
|
|
126
|
+
"@epam/ai-dial-catalog": "1.2.0-dev.159",
|
|
127
|
+
"@epam/ai-dial-chat-overlay": "1.2.0-dev.159",
|
|
128
|
+
"@epam/ai-dial-chat-shared": "1.2.0-dev.159",
|
|
129
|
+
"@epam/ai-dial-mcp-apps": "1.2.0-dev.159",
|
|
130
|
+
"@epam/ai-dial-publish-panel": "1.2.0-dev.159",
|
|
131
|
+
"@epam/ai-dial-quotations": "1.2.0-dev.159",
|
|
132
132
|
"@epam/ai-dial-react-file-manager": "^0.3.0-dev.7",
|
|
133
|
-
"@epam/ai-dial-scheduled-tasks": "1.2.0-dev.
|
|
134
|
-
"@epam/ai-dial-share": "1.2.0-dev.
|
|
135
|
-
"@epam/ai-dial-skill-editor": "1.2.0-dev.
|
|
136
|
-
"@epam/ai-dial-source-panel": "1.2.0-dev.
|
|
133
|
+
"@epam/ai-dial-scheduled-tasks": "1.2.0-dev.159",
|
|
134
|
+
"@epam/ai-dial-share": "1.2.0-dev.159",
|
|
135
|
+
"@epam/ai-dial-skill-editor": "1.2.0-dev.159",
|
|
136
|
+
"@epam/ai-dial-source-panel": "1.2.0-dev.159",
|
|
137
137
|
"@epam/ai-dial-ui-kit": "^0.15.0-dev.19",
|
|
138
|
-
"@epam/ai-dial-usage-dashboard": "1.2.0-dev.
|
|
138
|
+
"@epam/ai-dial-usage-dashboard": "1.2.0-dev.159",
|
|
139
139
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
140
140
|
"@epam/pdf-highlighter-kit": "^0.0.19",
|
|
141
141
|
"@mcp-ui/client": "^7.1.1"
|
package/skill/skill-types.js
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
|
+
import { PUBLIC_BUCKET as e } from "@epam/ai-dial-chat-shared";
|
|
1
2
|
//#region src/skill/skill-types.ts
|
|
2
|
-
var
|
|
3
|
+
var t = /* @__PURE__ */ function(e) {
|
|
3
4
|
return e.Personal = "personal", e.SharedWithMe = "sharedWithMe", e.Public = "public", e;
|
|
4
|
-
}({}),
|
|
5
|
-
if (!e.startsWith(
|
|
6
|
-
let t = e.slice(7),
|
|
7
|
-
if (
|
|
8
|
-
let i = t.slice(0,
|
|
5
|
+
}({}), n = e, r = "skills/", i = 256 * 1024, a = 1e3, o = 10, s = (e) => {
|
|
6
|
+
if (!e.startsWith(r)) return null;
|
|
7
|
+
let t = e.slice(7), n = t.indexOf("/");
|
|
8
|
+
if (n <= 0) return null;
|
|
9
|
+
let i = t.slice(0, n), a = t.slice(n + 1);
|
|
9
10
|
return i === "" || a === "" ? null : {
|
|
10
11
|
bucket: i,
|
|
11
12
|
path: a
|
|
12
13
|
};
|
|
13
14
|
};
|
|
14
15
|
//#endregion
|
|
15
|
-
export {
|
|
16
|
+
export { n as PUBLIC_SKILL_BUCKET, o as SKILL_LISTING_MAX_PAGES, a as SKILL_LISTING_PAGE_SIZE, i as SKILL_MANIFEST_MAX_BYTES, t as SkillSource, s as parseSkillResourceUrl };
|