@epam/ai-dial-chat-hooks 1.3.0-dev.142 → 1.3.0-dev.149
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/conversation/conversation-transfer/attachment-refs.d.ts +10 -2
- package/conversation/conversation-transfer/attachment-refs.d.ts.map +1 -1
- package/conversation/conversation-transfer/attachment-refs.js +31 -9
- package/conversation/conversation-transfer/export-conversation.d.ts +5 -1
- package/conversation/conversation-transfer/export-conversation.d.ts.map +1 -1
- package/conversation/conversation-transfer/export-conversation.js +19 -18
- package/conversation/conversation-transfer/import-conversation.d.ts +11 -6
- package/conversation/conversation-transfer/import-conversation.d.ts.map +1 -1
- package/conversation/conversation-transfer/import-conversation.js +63 -66
- package/conversation/create-chat-stream-api.d.ts +3 -2
- package/conversation/create-chat-stream-api.d.ts.map +1 -1
- package/conversation/create-chat-stream-api.js +1 -1
- package/conversation/useConversationExport/useConversationExport.js +52 -52
- package/package.json +16 -16
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Conversation } from '@epam/ai-dial-chat-shared';
|
|
1
|
+
import { Annotation, Conversation } from '@epam/ai-dial-chat-shared';
|
|
2
2
|
/**
|
|
3
3
|
* The reference fields shared by every attachment shape a conversation can
|
|
4
4
|
* carry — `MessageAttachment` on a message or a stage, and
|
|
@@ -27,13 +27,21 @@ export declare const splitFileIdAnchor: (url: string) => {
|
|
|
27
27
|
fileId: string;
|
|
28
28
|
anchor: string;
|
|
29
29
|
};
|
|
30
|
+
/**
|
|
31
|
+
* Applies `mapAnnotation` to every readable entry of the citation pool,
|
|
32
|
+
* keeping unreadable entries and every other `customViewState` key as they
|
|
33
|
+
* are. Returns `conversation` itself when no entry changed, so a caller can
|
|
34
|
+
* tell by identity that the pool needed no work.
|
|
35
|
+
*/
|
|
36
|
+
export declare const mapAnnotationPool: (conversation: Conversation, mapAnnotation: (annotation: Annotation) => Annotation) => Conversation;
|
|
30
37
|
/** A unique DIAL file reference found in a conversation's messages. */
|
|
31
38
|
export interface AttachmentRef {
|
|
32
39
|
fileId: string;
|
|
33
40
|
}
|
|
34
41
|
/**
|
|
35
42
|
* Collects unique attachment references across all messages — message
|
|
36
|
-
* attachments, stage attachments, and citation source documents —
|
|
43
|
+
* attachments, stage attachments, and citation source documents — and the
|
|
44
|
+
* conversation-level citation pool, with any
|
|
37
45
|
* `#…` anchor stripped. The same file can be referenced more than once (by a
|
|
38
46
|
* later turn, by a stage and the message it belongs to, or by several
|
|
39
47
|
* citations), so dedupe by file id and process it only once.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attachment-refs.d.ts","sourceRoot":"","sources":["../../../src/conversation/conversation-transfer/attachment-refs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"attachment-refs.d.ts","sourceRoot":"","sources":["../../../src/conversation/conversation-transfer/attachment-refs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAK1E;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IAClC,sFAAsF;IACtF,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,yDAAyD;IACzD,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,oCAAoC;IACpC,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAeD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,iBAAiB,GAC5B,KAAK,MAAM,KACV;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CASlC,CAAC;AAqBF;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,GAC5B,cAAc,YAAY,EAC1B,eAAe,CAAC,UAAU,EAAE,UAAU,KAAK,UAAU,KACpD,YAgBF,CAAC;AAEF,uEAAuE;AACvE,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,CAAC;CAChB;AAgDD;;;;;;;GAOG;AACH,eAAO,MAAM,qBAAqB,GAChC,cAAc,YAAY,KACzB,aAAa,EAef,CAAC"}
|
|
@@ -10,7 +10,25 @@ var e = (e) => e.startsWith("files/"), t = /^#[\w.=%-]*$/, n = (e) => {
|
|
|
10
10
|
fileId: e.slice(0, n),
|
|
11
11
|
anchor: t.test(r) ? r : ""
|
|
12
12
|
};
|
|
13
|
-
}, r = (e,
|
|
13
|
+
}, r = (e) => typeof e == "object" && !!e, i = (e) => {
|
|
14
|
+
let t = e.customViewState?.annotations;
|
|
15
|
+
return Array.isArray(t) ? t.filter(r) : [];
|
|
16
|
+
}, a = (e, t) => {
|
|
17
|
+
let n = e.customViewState, i = n?.annotations;
|
|
18
|
+
if (!Array.isArray(i)) return e;
|
|
19
|
+
let a = !1, o = i.map((e) => {
|
|
20
|
+
if (!r(e)) return e;
|
|
21
|
+
let n = t(e);
|
|
22
|
+
return n !== e && (a = !0), n;
|
|
23
|
+
});
|
|
24
|
+
return a ? {
|
|
25
|
+
...e,
|
|
26
|
+
customViewState: {
|
|
27
|
+
...n,
|
|
28
|
+
annotations: o
|
|
29
|
+
}
|
|
30
|
+
} : e;
|
|
31
|
+
}, o = (e, t) => {
|
|
14
32
|
for (let n of e.messages) {
|
|
15
33
|
let e = n.custom_content;
|
|
16
34
|
if (e) {
|
|
@@ -22,15 +40,19 @@ var e = (e) => e.startsWith("files/"), t = /^#[\w.=%-]*$/, n = (e) => {
|
|
|
22
40
|
}
|
|
23
41
|
}
|
|
24
42
|
}
|
|
25
|
-
|
|
26
|
-
|
|
43
|
+
for (let n of i(e)) {
|
|
44
|
+
let e = n.body?.source?.attachment;
|
|
45
|
+
e && t(e);
|
|
46
|
+
}
|
|
47
|
+
}, s = (t) => {
|
|
48
|
+
let r = /* @__PURE__ */ new Set(), i = (t) => {
|
|
27
49
|
if (t == null) return;
|
|
28
|
-
let { fileId:
|
|
29
|
-
e(
|
|
50
|
+
let { fileId: i } = n(t);
|
|
51
|
+
e(i) && r.add(i);
|
|
30
52
|
};
|
|
31
|
-
return
|
|
32
|
-
|
|
33
|
-
}), Array.from(
|
|
53
|
+
return o(t, (e) => {
|
|
54
|
+
i(e.url), i(e.reference_url);
|
|
55
|
+
}), Array.from(r, (e) => ({ fileId: e }));
|
|
34
56
|
};
|
|
35
57
|
//#endregion
|
|
36
|
-
export {
|
|
58
|
+
export { s as collectAttachmentRefs, a as mapAnnotationPool, n as splitFileIdAnchor };
|
|
@@ -2,7 +2,11 @@ import { Conversation, ExportFolder, ExportFormat } from '@epam/ai-dial-chat-sha
|
|
|
2
2
|
import { ExportFileNameKind } from './types';
|
|
3
3
|
/** Placeholder app name used in every export file name — this branch has no app display-name config yet. */
|
|
4
4
|
export declare const EXPORT_APP_NAME = "ai_dial";
|
|
5
|
-
/**
|
|
5
|
+
/**
|
|
6
|
+
* Returns the conversation with every message-, stage- and citation-level
|
|
7
|
+
* attachment reference removed, including the source documents of the
|
|
8
|
+
* conversation-level citation pool.
|
|
9
|
+
*/
|
|
6
10
|
export declare const stripConversationAttachments: (conversation: Conversation) => Conversation;
|
|
7
11
|
export declare const buildExportEnvelope: (conversations: Conversation[], folders?: ExportFolder[]) => ExportFormat;
|
|
8
12
|
export declare const serializeExportEnvelope: (envelope: ExportFormat) => Blob;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"export-conversation.d.ts","sourceRoot":"","sources":["../../../src/conversation/conversation-transfer/export-conversation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,YAAY,EACZ,YAAY,EACZ,YAAY,EAGb,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"export-conversation.d.ts","sourceRoot":"","sources":["../../../src/conversation/conversation-transfer/export-conversation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,YAAY,EACZ,YAAY,EACZ,YAAY,EAGb,MAAM,2BAA2B,CAAC;AAGnC,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAE7C,4GAA4G;AAC5G,eAAO,MAAM,eAAe,YAAY,CAAC;AA8CzC;;;;GAIG;AACH,eAAO,MAAM,4BAA4B,GACvC,cAAc,YAAY,KACzB,YAOA,CAAC;AAEJ,eAAO,MAAM,mBAAmB,GAC9B,eAAe,YAAY,EAAE,EAC7B,UAAS,YAAY,EAAO,KAC3B,YAID,CAAC;AAEH,eAAO,MAAM,uBAAuB,GAAI,UAAU,YAAY,KAAG,IACY,CAAC;AAQ9E,eAAO,MAAM,mBAAmB,GAC9B,MAAM,kBAAkB,EACxB,SAAS,MAAM,EACf,OAAM,IAAiB,KACtB,MACyE,CAAC"}
|
|
@@ -1,22 +1,23 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { mapAnnotationPool as e } from "./attachment-refs.js";
|
|
2
|
+
import { formatDateYMD as t } from "./date.js";
|
|
3
|
+
import { ExportFileNameKind as n } from "./types.js";
|
|
3
4
|
//#region src/conversation/conversation-transfer/export-conversation.ts
|
|
4
|
-
var
|
|
5
|
+
var r = "ai_dial", i = (e) => e.map(({ attachments: e, ...t }) => t), a = (e) => {
|
|
5
6
|
if (e.body?.source == null) return e;
|
|
6
7
|
let { source: t, ...n } = e.body;
|
|
7
8
|
return {
|
|
8
9
|
...e,
|
|
9
10
|
body: n
|
|
10
11
|
};
|
|
11
|
-
}
|
|
12
|
+
}, o = (e) => e.map(a), s = (e) => {
|
|
12
13
|
let t = e.custom_content;
|
|
13
14
|
if (!t) return e;
|
|
14
|
-
let { attachments: n, stages:
|
|
15
|
-
if (n == null &&
|
|
15
|
+
let { attachments: n, stages: r, annotations: a, ...s } = t;
|
|
16
|
+
if (n == null && r == null && a == null) return e;
|
|
16
17
|
let c = {
|
|
17
18
|
...s,
|
|
18
|
-
...
|
|
19
|
-
...
|
|
19
|
+
...r ? { stages: i(r) } : {},
|
|
20
|
+
...a ? { annotations: o(a) } : {}
|
|
20
21
|
};
|
|
21
22
|
if (Object.keys(c).length > 0) return {
|
|
22
23
|
...e,
|
|
@@ -24,17 +25,17 @@ var n = "ai_dial", r = (e) => e.map(({ attachments: e, ...t }) => t), i = (e) =>
|
|
|
24
25
|
};
|
|
25
26
|
let { custom_content: l, ...u } = e;
|
|
26
27
|
return u;
|
|
27
|
-
},
|
|
28
|
-
...
|
|
29
|
-
messages:
|
|
30
|
-
}),
|
|
28
|
+
}, c = (t) => e({
|
|
29
|
+
...t,
|
|
30
|
+
messages: t.messages.map(s)
|
|
31
|
+
}, a), l = (e, t = []) => ({
|
|
31
32
|
version: 5,
|
|
32
33
|
history: e,
|
|
33
34
|
folders: t
|
|
34
|
-
}),
|
|
35
|
-
[
|
|
36
|
-
[
|
|
37
|
-
[
|
|
38
|
-
},
|
|
35
|
+
}), u = (e) => new Blob([JSON.stringify(e, null, 2)], { type: "application/json" }), d = {
|
|
36
|
+
[n.SingleConversation]: "json",
|
|
37
|
+
[n.SingleConversationWithAttachments]: "dial",
|
|
38
|
+
[n.AllConversationsHistory]: "json"
|
|
39
|
+
}, f = (e, n, r = /* @__PURE__ */ new Date()) => `${t(r)}_${n}_${e}.${d[e]}`;
|
|
39
40
|
//#endregion
|
|
40
|
-
export {
|
|
41
|
+
export { r as EXPORT_APP_NAME, l as buildExportEnvelope, f as buildExportFileName, u as serializeExportEnvelope, c as stripConversationAttachments };
|
|
@@ -52,12 +52,13 @@ export interface RewrittenAttachmentTarget {
|
|
|
52
52
|
title?: string;
|
|
53
53
|
}
|
|
54
54
|
/**
|
|
55
|
-
* Rewrites every attachment reference a
|
|
56
|
-
* `custom_content.attachments`, the attachments of each
|
|
57
|
-
* the source document of each citation
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
55
|
+
* Rewrites every attachment reference a conversation carries — each
|
|
56
|
+
* message's own `custom_content.attachments`, the attachments of each
|
|
57
|
+
* execution stage, the source document of each citation, and the source
|
|
58
|
+
* document of each entry in the conversation-level citation pool — from an
|
|
59
|
+
* old file id to its new uploaded location, and its `title` when the target
|
|
60
|
+
* carries a renamed one. References not present in `targetMap` are left
|
|
61
|
+
* untouched (immutable — returns a new conversation).
|
|
61
62
|
*/
|
|
62
63
|
export declare const rewriteAttachmentUrls: (conversation: Conversation, targetMap: Map<string, RewrittenAttachmentTarget>) => Conversation;
|
|
63
64
|
/**
|
|
@@ -72,6 +73,10 @@ export declare const rewriteAttachmentUrls: (conversation: Conversation, targetM
|
|
|
72
73
|
* user shared with the importing user is dropped too: nothing here can tell
|
|
73
74
|
* it apart from one they never had access to.
|
|
74
75
|
*
|
|
76
|
+
* The conversation-level citation pool is covered as well: a message
|
|
77
|
+
* citation stripped of its source would otherwise resolve its `<cit>` from
|
|
78
|
+
* the pool's copy, which still names the foreign file.
|
|
79
|
+
*
|
|
75
80
|
* Returns the conversation (unchanged when nothing was foreign) and the name
|
|
76
81
|
* of every dropped file, for the skipped-attachment warning.
|
|
77
82
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"import-conversation.d.ts","sourceRoot":"","sources":["../../../src/conversation/conversation-transfer/import-conversation.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAEV,YAAY,EAEZ,YAAY,EAGb,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"import-conversation.d.ts","sourceRoot":"","sources":["../../../src/conversation/conversation-transfer/import-conversation.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAEV,YAAY,EAEZ,YAAY,EAGb,MAAM,2BAA2B,CAAC;AAOnC,OAAO,KAAK,EACV,mBAAmB,EACnB,mBAAmB,EACpB,MAAM,qBAAqB,CAAC;AAG7B,oFAAoF;AACpF,qBAAa,4BAA6B,SAAQ,KAAK;gBACzC,OAAO,EAAE,MAAM;CAI5B;AAOD;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,GAAI,MAAM,MAAM,KAAG,YA2BlD,CAAC;AAgGF,MAAM,WAAW,qBAAqB;IACpC,wGAAwG;IACxG,YAAY,EAAE,YAAY,CAAC;IAC3B,0DA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E,CAAA;CA2B3D,CAAC"}
|
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
import { collectAttachmentRefs as e,
|
|
2
|
-
import { resolveDialFileBucketAndPath as
|
|
3
|
-
import { PUBLIC_BUCKET as
|
|
1
|
+
import { collectAttachmentRefs as e, mapAnnotationPool as t, splitFileIdAnchor as n } from "./attachment-refs.js";
|
|
2
|
+
import { resolveDialFileBucketAndPath as r } from "./dial-file-resolve.js";
|
|
3
|
+
import { PUBLIC_BUCKET as i, generateUUID as a, sanitizeConversationName as o, stripTrailingDots as s, truncateToUtf8Bytes as c } from "@epam/ai-dial-chat-shared";
|
|
4
4
|
//#region src/conversation/conversation-transfer/import-conversation.ts
|
|
5
|
-
var
|
|
5
|
+
var l = class extends Error {
|
|
6
6
|
constructor(e) {
|
|
7
7
|
super(e), this.name = "UnsupportedImportFormatError";
|
|
8
8
|
}
|
|
9
|
-
},
|
|
9
|
+
}, u = (e) => typeof e == "object" && !!e, d = 5, f = (e) => {
|
|
10
10
|
let t;
|
|
11
11
|
try {
|
|
12
12
|
t = JSON.parse(e);
|
|
13
13
|
} catch {
|
|
14
|
-
throw new
|
|
14
|
+
throw new l("Import file is not valid JSON");
|
|
15
15
|
}
|
|
16
|
-
if (!
|
|
16
|
+
if (!u(t) || t.version !== d || !Array.isArray(t.history)) throw new l("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: d,
|
|
20
20
|
history: t.history,
|
|
21
21
|
folders: n
|
|
22
22
|
};
|
|
23
|
-
},
|
|
24
|
-
let t = e.replace(/\r\n|\r/g, "\n").split("\n").map((e) =>
|
|
25
|
-
return
|
|
26
|
-
},
|
|
27
|
-
let r = e.split(
|
|
28
|
-
if (r.length < 2) return [e,
|
|
29
|
-
let
|
|
23
|
+
}, p = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i, m = "__", h = 255, g = "applications", _ = /[-+]/, v = /^\d+$/, y = (e) => e ? e.split(_)[0].split(".").every((e) => v.test(e)) : !1, b = (e) => {
|
|
24
|
+
let t = e.replace(/\r\n|\r/g, "\n").split("\n").map((e) => o(e).trim()).filter(Boolean)[0] ?? "";
|
|
25
|
+
return s(c(t, h)).trimEnd();
|
|
26
|
+
}, x = (e, t, n) => {
|
|
27
|
+
let r = e.split(m);
|
|
28
|
+
if (r.length < 2) return [e, a()].join(m);
|
|
29
|
+
let i = n && y(r[1]) ? r.slice(0, 2) : r.slice(0, 1), o = i.length > 1 ? p.test(r[r.length - 1]) : r.length >= 3, s = r.slice(i.length, o ? -1 : void 0).join(m);
|
|
30
30
|
return [
|
|
31
|
-
...
|
|
31
|
+
...i,
|
|
32
32
|
t || s,
|
|
33
|
-
|
|
34
|
-
].join(
|
|
35
|
-
},
|
|
36
|
-
let n =
|
|
33
|
+
a()
|
|
34
|
+
].join(m);
|
|
35
|
+
}, S = "conversations/", C = (e) => e.startsWith(S) ? e.slice(14) : e, w = (e, t) => {
|
|
36
|
+
let n = C(e.id), r = n.split("/"), i = C(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 = b(e.name), f = x(l, d, u[0] === g), p = [...u, f].join("/"), m = o.length ? `${t}/${o.join("/")}` : t;
|
|
37
37
|
return {
|
|
38
38
|
conversation: {
|
|
39
39
|
...e,
|
|
@@ -43,18 +43,18 @@ var c = class extends Error {
|
|
|
43
43
|
},
|
|
44
44
|
subPath: p
|
|
45
45
|
};
|
|
46
|
-
},
|
|
47
|
-
let t =
|
|
46
|
+
}, T = (e) => {
|
|
47
|
+
let t = C(e.folderId).split("/").filter(Boolean).slice(1);
|
|
48
48
|
return t.length ? t.join(" / ") : void 0;
|
|
49
|
-
},
|
|
49
|
+
}, E = (e) => e.map((e) => `"${e}"`).join(", "), D = (e, t) => {
|
|
50
50
|
if (!e) return;
|
|
51
|
-
let { fileId: r, anchor: i } =
|
|
51
|
+
let { fileId: r, anchor: i } = n(e), a = t.get(r);
|
|
52
52
|
if (a != null) return {
|
|
53
53
|
...a,
|
|
54
54
|
url: `${a.url}${i}`
|
|
55
55
|
};
|
|
56
|
-
},
|
|
57
|
-
let n =
|
|
56
|
+
}, O = (e, t) => {
|
|
57
|
+
let n = D(e.url, t), r = D(e.reference_url, t);
|
|
58
58
|
if (n == null && r == null) return;
|
|
59
59
|
let i = n?.title ?? r?.title;
|
|
60
60
|
return {
|
|
@@ -62,19 +62,19 @@ var c = class extends Error {
|
|
|
62
62
|
...r == null ? {} : { reference_url: r.url },
|
|
63
63
|
...i == null ? {} : { title: i }
|
|
64
64
|
};
|
|
65
|
-
},
|
|
65
|
+
}, k = (e, t) => e.map((e) => e.attachments?.length ? {
|
|
66
66
|
...e,
|
|
67
67
|
attachments: e.attachments.map((e) => {
|
|
68
|
-
let n =
|
|
68
|
+
let n = O(e, t);
|
|
69
69
|
return n ? {
|
|
70
70
|
...e,
|
|
71
71
|
...n
|
|
72
72
|
} : e;
|
|
73
73
|
})
|
|
74
|
-
} : e),
|
|
74
|
+
} : e), A = (e, t) => {
|
|
75
75
|
let n = e.body?.source;
|
|
76
76
|
if (n?.attachment == null) return e;
|
|
77
|
-
let r =
|
|
77
|
+
let r = O(n.attachment, t);
|
|
78
78
|
return r == null ? e : {
|
|
79
79
|
...e,
|
|
80
80
|
body: {
|
|
@@ -88,7 +88,7 @@ var c = class extends Error {
|
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
90
|
};
|
|
91
|
-
}
|
|
91
|
+
}, j = (e, t) => e.map((e) => A(e, t)), M = (e, t) => ({
|
|
92
92
|
...e,
|
|
93
93
|
messages: e.messages.map((e) => {
|
|
94
94
|
let n = e.custom_content;
|
|
@@ -99,31 +99,31 @@ var c = class extends Error {
|
|
|
99
99
|
custom_content: {
|
|
100
100
|
...n,
|
|
101
101
|
...r?.length ? { attachments: r.map((e) => {
|
|
102
|
-
let n =
|
|
102
|
+
let n = O(e, t);
|
|
103
103
|
return n ? {
|
|
104
104
|
...e,
|
|
105
105
|
...n
|
|
106
106
|
} : e;
|
|
107
107
|
}) } : {},
|
|
108
|
-
...i?.length ? { stages:
|
|
109
|
-
...a?.length ? { annotations:
|
|
108
|
+
...i?.length ? { stages: k(i, t) } : {},
|
|
109
|
+
...a?.length ? { annotations: j(a, t) } : {}
|
|
110
110
|
}
|
|
111
111
|
};
|
|
112
112
|
})
|
|
113
|
-
}),
|
|
113
|
+
}), N = (e, n) => t(M(e, n), (e) => A(e, n)), P = (e, t) => {
|
|
114
114
|
if (!e) return;
|
|
115
|
-
let a = n(
|
|
116
|
-
if (a && a.bucket !==
|
|
117
|
-
},
|
|
118
|
-
let r =
|
|
115
|
+
let a = r(n(e).fileId);
|
|
116
|
+
if (a && a.bucket !== t && a.bucket !== i) return a.path.split("/").pop() || a.path;
|
|
117
|
+
}, F = (e, t, n) => e.flatMap((e) => {
|
|
118
|
+
let r = P(e.url, t);
|
|
119
119
|
if (r != null) return n.push(r), [];
|
|
120
|
-
let i =
|
|
120
|
+
let i = P(e.reference_url, t);
|
|
121
121
|
if (i == null) return [e];
|
|
122
122
|
n.push(i);
|
|
123
123
|
let { reference_url: a, reference_type: o, ...s } = e;
|
|
124
124
|
return s.url == null && s.data == null ? [] : [s];
|
|
125
|
-
}),
|
|
126
|
-
let r = e.body, i =
|
|
125
|
+
}), I = (e, t, n) => {
|
|
126
|
+
let r = e.body, i = P(r?.source?.attachment?.url, t);
|
|
127
127
|
if (r == null || i == null) return e;
|
|
128
128
|
n.push(i);
|
|
129
129
|
let { source: a, ...o } = r;
|
|
@@ -131,43 +131,40 @@ var c = class extends Error {
|
|
|
131
131
|
...e,
|
|
132
132
|
body: o
|
|
133
133
|
};
|
|
134
|
-
}
|
|
135
|
-
let
|
|
136
|
-
let
|
|
137
|
-
if (!
|
|
138
|
-
let { attachments: i, stages: a, annotations: o } =
|
|
134
|
+
}, L = (e, t, n) => e.map((e) => I(e, t, n)), R = (e, n) => {
|
|
135
|
+
let r = [], i = e.messages.map((e) => {
|
|
136
|
+
let t = e.custom_content;
|
|
137
|
+
if (!t) return e;
|
|
138
|
+
let { attachments: i, stages: a, annotations: o } = t;
|
|
139
139
|
return !i?.length && !a?.length && !o?.length ? e : {
|
|
140
140
|
...e,
|
|
141
141
|
custom_content: {
|
|
142
|
-
...
|
|
143
|
-
...i?.length ? { attachments:
|
|
142
|
+
...t,
|
|
143
|
+
...i?.length ? { attachments: F(i, n, r) } : {},
|
|
144
144
|
...a?.length ? { stages: a.map((e) => e.attachments?.length ? {
|
|
145
145
|
...e,
|
|
146
|
-
attachments:
|
|
146
|
+
attachments: F(e.attachments, n, r)
|
|
147
147
|
} : e) } : {},
|
|
148
|
-
...o?.length ? { annotations:
|
|
148
|
+
...o?.length ? { annotations: L(o, n, r) } : {}
|
|
149
149
|
}
|
|
150
150
|
};
|
|
151
|
-
})
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
droppedNames:
|
|
158
|
-
} : {
|
|
159
|
-
conversation: e,
|
|
160
|
-
droppedNames: n
|
|
151
|
+
}), a = r.length ? {
|
|
152
|
+
...e,
|
|
153
|
+
messages: i
|
|
154
|
+
} : e;
|
|
155
|
+
return {
|
|
156
|
+
conversation: t(a, (e) => I(e, n, r)),
|
|
157
|
+
droppedNames: r
|
|
161
158
|
};
|
|
162
|
-
},
|
|
159
|
+
}, z = (e) => e.split("/").pop() || e, B = (t, n, i) => {
|
|
163
160
|
let a = [], o = [];
|
|
164
161
|
for (let s of e(t)) {
|
|
165
|
-
let e =
|
|
162
|
+
let e = r(s.fileId);
|
|
166
163
|
if (!e) {
|
|
167
|
-
o.push(
|
|
164
|
+
o.push(z(s.fileId));
|
|
168
165
|
continue;
|
|
169
166
|
}
|
|
170
|
-
let t = e.path.split("/").pop() ?? e.path, c =
|
|
167
|
+
let t = e.path.split("/").pop() ?? e.path, c = n.get(e.path);
|
|
171
168
|
c ? a.push({
|
|
172
169
|
fileId: s.fileId,
|
|
173
170
|
bytes: c,
|
|
@@ -181,4 +178,4 @@ var c = class extends Error {
|
|
|
181
178
|
};
|
|
182
179
|
};
|
|
183
180
|
//#endregion
|
|
184
|
-
export {
|
|
181
|
+
export { l as UnsupportedImportFormatError, R as dropForeignAttachmentRefs, E as formatQuotedNameList, T as getFolderBreadcrumb, f as parseImportEnvelope, B as planAttachmentUploads, w as rebaseConversationId, N as rewriteAttachmentUrls };
|
|
@@ -27,8 +27,9 @@ export declare class GenerationConflictError extends Error {
|
|
|
27
27
|
}
|
|
28
28
|
/**
|
|
29
29
|
* Reported through `onError` when DIAL Core itself signals a failure with an
|
|
30
|
-
* in-band `{ error: { message } }` SSE chunk. Its `message`
|
|
31
|
-
* intended for the user
|
|
30
|
+
* in-band `{ error: { message, display_message? } }` SSE chunk. Its `message`
|
|
31
|
+
* is upstream text intended for the user — the chunk's `display_message` when
|
|
32
|
+
* present, else its `message` — unlike a transport failure (failed `fetch`, non-OK
|
|
32
33
|
* status, broken stream), whose message is technical detail. A custom
|
|
33
34
|
* transport raises this for any user-facing upstream error text.
|
|
34
35
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-chat-stream-api.d.ts","sourceRoot":"","sources":["../../src/conversation/create-chat-stream-api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AAC/E,OAAO,KAAK,EACV,oBAAoB,EACpB,WAAW,EACZ,MAAM,2BAA2B,CAAC;AAOnC,mFAAmF;AACnF,eAAO,MAAM,4CAA4C,0IACgF,CAAC;AAE1I,yFAAyF;AACzF,qBAAa,0BAA2B,SAAQ,KAAK;IACnD,MAAM,CAAC,QAAQ,CAAC,IAAI,8BAA8B;IAElD,iFAAiF;IACjF,QAAQ,C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AAuB,KAC5B,aAoKF,CAAC"}
|
|
@@ -48,7 +48,7 @@ var e = { "Content-Type": "application/json" }, t = 409, n = "The response could
|
|
|
48
48
|
if (a !== "[DONE]") try {
|
|
49
49
|
let e = JSON.parse(a);
|
|
50
50
|
if (e.error) {
|
|
51
|
-
n(e.error.type === r.type ? new r(f(e.error)) : new o(e.error.message));
|
|
51
|
+
n(e.error.type === r.type ? new r(f(e.error)) : new o(e.error.display_message ?? e.error.message));
|
|
52
52
|
return;
|
|
53
53
|
}
|
|
54
54
|
t(e);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { collectAttachmentRefs as e } from "../conversation-transfer/attachment-refs.js";
|
|
2
|
+
import { ConversationExportMode as t, ConversationTransferWarningCode as n, ExportFileNameKind as r } from "../conversation-transfer/types.js";
|
|
3
|
+
import { EXPORT_APP_NAME as i, buildExportEnvelope as a, buildExportFileName as o, serializeExportEnvelope as s, stripConversationAttachments as c } from "../conversation-transfer/export-conversation.js";
|
|
4
4
|
import { resolveDialFileBucketAndPath as l } from "../conversation-transfer/dial-file-resolve.js";
|
|
5
5
|
import { runWithConcurrency as u } from "../conversation-transfer/async.js";
|
|
6
6
|
import { ConversationTransferKind as d, ConversationTransferPhase as f, buildTransferProgress as p } from "../conversation-transfer/progress.js";
|
|
@@ -29,7 +29,7 @@ var S = 5, C = 536870912, w = 429, T = 5, E = 2e3, D = (e) => e instanceof x &&
|
|
|
29
29
|
if (n.aborted || !D(e) || r >= T) throw e;
|
|
30
30
|
await k(O(e, r), n);
|
|
31
31
|
}
|
|
32
|
-
}, j = (e) => !e.sharedWithMe && !e.publishedWithMe, M = (e) => e instanceof RangeError, N = (
|
|
32
|
+
}, j = (e) => !e.sharedWithMe && !e.publishedWithMe, M = (e) => e instanceof RangeError, N = (e) => e === t.WithoutAttachments ? d.ExportSingle : d.ExportSingleWithAttachments, P = ({ conversationsApi: x, filesApi: w, normalizeConversationPath: T, classifyTransferError: E = () => ({}), resolveErrorTraceId: D = async () => void 0, maxArchiveBytes: O = C, onSuccess: k, onWarning: P, onError: F }) => {
|
|
33
33
|
let I = m(), L = b(async (e, t, n) => {
|
|
34
34
|
let r = !1, i = !1, a = 0, o = () => {
|
|
35
35
|
a += 1, n(a, e.length);
|
|
@@ -61,44 +61,44 @@ var S = 5, C = 536870912, w = 429, T = 5, E = 2e3, D = (e) => e instanceof x &&
|
|
|
61
61
|
anySkipped: !t.aborted && !i && r,
|
|
62
62
|
isUnauthorized: !t.aborted && i
|
|
63
63
|
};
|
|
64
|
-
}, [E, w]), R = b(async (
|
|
64
|
+
}, [E, w]), R = b(async (r, i, o, l, u, d) => {
|
|
65
65
|
let m = N(l), _;
|
|
66
66
|
try {
|
|
67
|
-
_ = await A(x, T(
|
|
67
|
+
_ = await A(x, T(i), d);
|
|
68
68
|
} catch (e) {
|
|
69
69
|
if (d.aborted) return;
|
|
70
70
|
if (E(e).isUnauthorized) F?.({
|
|
71
|
-
jobId:
|
|
71
|
+
jobId: r,
|
|
72
72
|
code: g.Unauthorized
|
|
73
|
-
}), I.failJob(
|
|
73
|
+
}), I.failJob(r, g.Unauthorized);
|
|
74
74
|
else {
|
|
75
75
|
let t = await D(e);
|
|
76
76
|
F?.({
|
|
77
|
-
jobId:
|
|
77
|
+
jobId: r,
|
|
78
78
|
code: g.Unknown,
|
|
79
|
-
titles: [
|
|
79
|
+
titles: [o],
|
|
80
80
|
traceId: t
|
|
81
|
-
}), I.failJob(
|
|
81
|
+
}), I.failJob(r, g.Unknown);
|
|
82
82
|
}
|
|
83
83
|
console.error("Failed to fetch conversation for export", e);
|
|
84
84
|
return;
|
|
85
85
|
}
|
|
86
86
|
if (!d.aborted) {
|
|
87
|
-
I.setJobProgress(
|
|
87
|
+
I.setJobProgress(r, p({
|
|
88
88
|
kind: m,
|
|
89
89
|
phase: f.Prepare
|
|
90
90
|
}));
|
|
91
91
|
try {
|
|
92
|
-
if (l ===
|
|
93
|
-
let e =
|
|
92
|
+
if (l === t.WithoutAttachments) {
|
|
93
|
+
let e = a([c(_)], []), t = s(e);
|
|
94
94
|
y(t, u), k?.({
|
|
95
|
-
jobId:
|
|
96
|
-
titles: [
|
|
97
|
-
}), I.succeedJob(
|
|
95
|
+
jobId: r,
|
|
96
|
+
titles: [o]
|
|
97
|
+
}), I.succeedJob(r);
|
|
98
98
|
return;
|
|
99
99
|
}
|
|
100
|
-
let
|
|
101
|
-
I.setJobProgress(
|
|
100
|
+
let i = e(_), { entries: b, anySkipped: x, isUnauthorized: S } = await L(i, d, (e, t) => {
|
|
101
|
+
I.setJobProgress(r, p({
|
|
102
102
|
kind: m,
|
|
103
103
|
phase: f.Transfer,
|
|
104
104
|
completed: e,
|
|
@@ -112,43 +112,43 @@ var S = 5, C = 536870912, w = 429, T = 5, E = 2e3, D = (e) => e instanceof x &&
|
|
|
112
112
|
if (d.aborted) return;
|
|
113
113
|
if (S) {
|
|
114
114
|
F?.({
|
|
115
|
-
jobId:
|
|
115
|
+
jobId: r,
|
|
116
116
|
code: g.Unauthorized
|
|
117
|
-
}), I.failJob(
|
|
117
|
+
}), I.failJob(r, g.Unauthorized);
|
|
118
118
|
return;
|
|
119
119
|
}
|
|
120
|
-
I.setJobProgress(
|
|
120
|
+
I.setJobProgress(r, p({
|
|
121
121
|
kind: m,
|
|
122
122
|
phase: f.Transfer,
|
|
123
|
-
completed:
|
|
124
|
-
total:
|
|
123
|
+
completed: i.length,
|
|
124
|
+
total: i.length
|
|
125
125
|
}));
|
|
126
126
|
let C = b.reduce((e, t) => e + t.data.byteLength, 0);
|
|
127
127
|
if (C > O) {
|
|
128
128
|
F?.({
|
|
129
|
-
jobId:
|
|
129
|
+
jobId: r,
|
|
130
130
|
code: g.FileTooLarge,
|
|
131
|
-
titles: [
|
|
132
|
-
}), I.failJob(
|
|
131
|
+
titles: [o]
|
|
132
|
+
}), I.failJob(r, g.FileTooLarge), console.error(`Refused to build an export archive of ${C} bytes: over the ${O}-byte limit`);
|
|
133
133
|
return;
|
|
134
134
|
}
|
|
135
|
-
let w =
|
|
135
|
+
let w = a([_], []), { blob: T, skippedPaths: E } = h(w, b), D = x || E.length > 0;
|
|
136
136
|
D && P?.({
|
|
137
|
-
jobId:
|
|
138
|
-
code:
|
|
137
|
+
jobId: r,
|
|
138
|
+
code: n.AttachmentSkipped
|
|
139
139
|
}), y(T, u), k?.({
|
|
140
|
-
jobId:
|
|
141
|
-
titles: [
|
|
142
|
-
}), D ? I.warnJob(
|
|
140
|
+
jobId: r,
|
|
141
|
+
titles: [o]
|
|
142
|
+
}), D ? I.warnJob(r, n.AttachmentSkipped) : I.succeedJob(r);
|
|
143
143
|
} catch (e) {
|
|
144
144
|
if (d.aborted) return;
|
|
145
|
-
let t = M(e) ? g.FileTooLarge : g.Unknown,
|
|
145
|
+
let t = M(e) ? g.FileTooLarge : g.Unknown, n = await D(e);
|
|
146
146
|
F?.({
|
|
147
|
-
jobId:
|
|
147
|
+
jobId: r,
|
|
148
148
|
code: t,
|
|
149
|
-
titles: [
|
|
150
|
-
traceId:
|
|
151
|
-
}), I.failJob(
|
|
149
|
+
titles: [o],
|
|
150
|
+
traceId: n
|
|
151
|
+
}), I.failJob(r, t), console.error("Failed to build conversation export archive", e);
|
|
152
152
|
}
|
|
153
153
|
}
|
|
154
154
|
}, [
|
|
@@ -162,19 +162,19 @@ var S = 5, C = 536870912, w = 429, T = 5, E = 2e3, D = (e) => e instanceof x &&
|
|
|
162
162
|
P,
|
|
163
163
|
I,
|
|
164
164
|
D
|
|
165
|
-
]), z = b((
|
|
166
|
-
let s = a
|
|
165
|
+
]), z = b((e, n, a) => {
|
|
166
|
+
let s = o(a === t.WithoutAttachments ? r.SingleConversation : r.SingleConversationWithAttachments, i), c = I.addJob({
|
|
167
167
|
kind: _.Single,
|
|
168
|
-
title:
|
|
168
|
+
title: n
|
|
169
169
|
}, s);
|
|
170
|
-
return I.startJob(c, (
|
|
170
|
+
return I.startJob(c, (t) => R(c, e, n, a, s, t));
|
|
171
171
|
}, [I, R]), B = b(async (e, t, n) => {
|
|
172
|
-
let r = d.ExportAll,
|
|
172
|
+
let r = d.ExportAll, i = [], o;
|
|
173
173
|
do {
|
|
174
174
|
if (n.aborted) return;
|
|
175
175
|
let t;
|
|
176
176
|
try {
|
|
177
|
-
t = await x.listConversations({ nextToken:
|
|
177
|
+
t = await x.listConversations({ nextToken: o }, { signal: n });
|
|
178
178
|
} catch (t) {
|
|
179
179
|
if (n.aborted) return;
|
|
180
180
|
if (E(t).isUnauthorized) F?.({
|
|
@@ -192,17 +192,17 @@ var S = 5, C = 536870912, w = 429, T = 5, E = 2e3, D = (e) => e instanceof x &&
|
|
|
192
192
|
console.error("Failed to list conversations for export", t);
|
|
193
193
|
return;
|
|
194
194
|
}
|
|
195
|
-
|
|
195
|
+
i.push(...t.items.filter(j).map((e) => ({
|
|
196
196
|
id: e.id,
|
|
197
197
|
title: e.title
|
|
198
|
-
}))),
|
|
199
|
-
} while (
|
|
198
|
+
}))), o = t.nextToken;
|
|
199
|
+
} while (o);
|
|
200
200
|
I.setJobProgress(e, p({
|
|
201
201
|
kind: r,
|
|
202
202
|
phase: f.Prepare
|
|
203
203
|
}));
|
|
204
204
|
let l = [];
|
|
205
|
-
for (let t of
|
|
205
|
+
for (let t of i) {
|
|
206
206
|
if (n.aborted) return;
|
|
207
207
|
try {
|
|
208
208
|
let e = await A(x, T(t.id), n);
|
|
@@ -239,16 +239,16 @@ var S = 5, C = 536870912, w = 429, T = 5, E = 2e3, D = (e) => e instanceof x &&
|
|
|
239
239
|
kind: r,
|
|
240
240
|
phase: f.Transfer,
|
|
241
241
|
completed: l.length,
|
|
242
|
-
total:
|
|
242
|
+
total: i.length
|
|
243
243
|
}, {
|
|
244
244
|
completed: l.length,
|
|
245
|
-
total:
|
|
245
|
+
total: i.length,
|
|
246
246
|
kind: v.Conversation
|
|
247
247
|
}));
|
|
248
248
|
}
|
|
249
249
|
}
|
|
250
250
|
if (!n.aborted) try {
|
|
251
|
-
let n =
|
|
251
|
+
let n = a(l.map(c), []), r = s(n);
|
|
252
252
|
y(r, t), k?.({ jobId: e }), I.succeedJob(e);
|
|
253
253
|
} catch (t) {
|
|
254
254
|
let n = M(t) ? g.FileTooLarge : g.Unknown, r = await D(t);
|
|
@@ -267,7 +267,7 @@ var S = 5, C = 536870912, w = 429, T = 5, E = 2e3, D = (e) => e instanceof x &&
|
|
|
267
267
|
I,
|
|
268
268
|
D
|
|
269
269
|
]), V = b(() => {
|
|
270
|
-
let e =
|
|
270
|
+
let e = o(r.AllConversationsHistory, i), t = I.addJob({ kind: _.All }, e);
|
|
271
271
|
return I.startJob(t, (n) => B(t, e, n));
|
|
272
272
|
}, [I, B]);
|
|
273
273
|
return {
|
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.
|
|
4
|
+
"version": "1.3.0-dev.149",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "./index.js",
|
|
@@ -121,7 +121,7 @@
|
|
|
121
121
|
}
|
|
122
122
|
},
|
|
123
123
|
"dependencies": {
|
|
124
|
-
"@epam/ai-dial-chat-api-client": "1.3.0-dev.
|
|
124
|
+
"@epam/ai-dial-chat-api-client": "1.3.0-dev.149",
|
|
125
125
|
"dompurify": "3.4.16",
|
|
126
126
|
"fflate": "^0.8.3",
|
|
127
127
|
"lru-cache": "^10.4.3",
|
|
@@ -130,22 +130,22 @@
|
|
|
130
130
|
},
|
|
131
131
|
"peerDependencies": {
|
|
132
132
|
"react": "^19.2.8",
|
|
133
|
-
"@epam/ai-dial-attachment-canvas": "1.3.0-dev.
|
|
134
|
-
"@epam/ai-dial-attachment-input": "1.3.0-dev.
|
|
135
|
-
"@epam/ai-dial-catalog": "1.3.0-dev.
|
|
136
|
-
"@epam/ai-dial-chat-overlay": "1.3.0-dev.
|
|
137
|
-
"@epam/ai-dial-chat-shared": "1.3.0-dev.
|
|
138
|
-
"@epam/ai-dial-conversation-input": "1.3.0-dev.
|
|
139
|
-
"@epam/ai-dial-mcp-apps": "1.3.0-dev.
|
|
140
|
-
"@epam/ai-dial-publish-panel": "1.3.0-dev.
|
|
141
|
-
"@epam/ai-dial-quotations": "1.3.0-dev.
|
|
133
|
+
"@epam/ai-dial-attachment-canvas": "1.3.0-dev.149",
|
|
134
|
+
"@epam/ai-dial-attachment-input": "1.3.0-dev.149",
|
|
135
|
+
"@epam/ai-dial-catalog": "1.3.0-dev.149",
|
|
136
|
+
"@epam/ai-dial-chat-overlay": "1.3.0-dev.149",
|
|
137
|
+
"@epam/ai-dial-chat-shared": "1.3.0-dev.149",
|
|
138
|
+
"@epam/ai-dial-conversation-input": "1.3.0-dev.149",
|
|
139
|
+
"@epam/ai-dial-mcp-apps": "1.3.0-dev.149",
|
|
140
|
+
"@epam/ai-dial-publish-panel": "1.3.0-dev.149",
|
|
141
|
+
"@epam/ai-dial-quotations": "1.3.0-dev.149",
|
|
142
142
|
"@epam/ai-dial-react-file-manager": "^0.4.0-dev.11",
|
|
143
|
-
"@epam/ai-dial-scheduled-tasks": "1.3.0-dev.
|
|
144
|
-
"@epam/ai-dial-share": "1.3.0-dev.
|
|
145
|
-
"@epam/ai-dial-skill-editor": "1.3.0-dev.
|
|
146
|
-
"@epam/ai-dial-source-panel": "1.3.0-dev.
|
|
143
|
+
"@epam/ai-dial-scheduled-tasks": "1.3.0-dev.149",
|
|
144
|
+
"@epam/ai-dial-share": "1.3.0-dev.149",
|
|
145
|
+
"@epam/ai-dial-skill-editor": "1.3.0-dev.149",
|
|
146
|
+
"@epam/ai-dial-source-panel": "1.3.0-dev.149",
|
|
147
147
|
"@epam/ai-dial-ui-kit": "^0.16.0-dev.22",
|
|
148
|
-
"@epam/ai-dial-usage-dashboard": "1.3.0-dev.
|
|
148
|
+
"@epam/ai-dial-usage-dashboard": "1.3.0-dev.149",
|
|
149
149
|
"@modelcontextprotocol/sdk": "^1.32.1",
|
|
150
150
|
"@epam/pdf-highlighter-kit": "^0.0.19",
|
|
151
151
|
"@mcp-ui/client": "^7.1.1"
|