@epam/ai-dial-chat-hooks 1.1.0-dev.445 → 1.1.0-dev.456
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/useConversationHandlers/message-utils.js +8 -8
- package/conversation/useConversationHandlers/useConversationHandlers.js +37 -33
- package/conversation.d.ts +14 -6
- package/files/dial-file-manager-path.util.js +30 -30
- package/files/file-name.js +8 -4
- package/index.d.ts +17 -6
- package/index.js +133 -133
- package/package.json +15 -15
- package/shared/string-utils.js +11 -2
- package/skill/skill.js +1 -1
- package/skill/useSkillEditorLoad.js +49 -49
- package/utils.d.ts +3 -0
- package/utils.js +14 -14
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { MessageRole as e } from "@epam/ai-dial-chat-shared";
|
|
2
2
|
//#region src/conversation/useConversationHandlers/message-utils.ts
|
|
3
|
-
var t = (e) => e != null && Object.keys(e).length > 0, n = (e, t, n, r) => {
|
|
4
|
-
if (t !== e.content ||
|
|
5
|
-
let
|
|
6
|
-
return
|
|
7
|
-
},
|
|
8
|
-
let
|
|
9
|
-
return
|
|
3
|
+
var t = (e) => e != null && Object.keys(e).length > 0, n = (e, t) => (e?.length ?? 0) === (t?.length ?? 0) ? (e ?? []).some((e, n) => e.url !== t?.[n]?.url) : !0, r = (e, t, r, i, a) => {
|
|
4
|
+
if (t !== e.content || i.length > 0) return !0;
|
|
5
|
+
let o = e.custom_content?.attachments?.length ?? 0;
|
|
6
|
+
return r.length === o ? a != null && n(e.custom_content?.skills, a) : !0;
|
|
7
|
+
}, i = (t) => t == null || t.role !== e.Assistant || !!t.wasStoppedByUser || t.streamErrorMessage != null, a = (e, t, n, a, o, s) => {
|
|
8
|
+
let c = e[t];
|
|
9
|
+
return c ? r(c, n, a, o, s) || i(e[t + 1]) : !1;
|
|
10
10
|
};
|
|
11
11
|
//#endregion
|
|
12
|
-
export { t as hasActiveToolConfig,
|
|
12
|
+
export { t as hasActiveToolConfig, i as isAnswerIncomplete, r as isMessageChanged, a as shouldRerunGenerationOnEdit };
|
|
@@ -13,24 +13,25 @@ var p = ({ conversation: p, conversationId: m, bucket: h, isStreaming: g, startS
|
|
|
13
13
|
filesApi: b,
|
|
14
14
|
bucket: h,
|
|
15
15
|
onNetworkError: T
|
|
16
|
-
}), P = u(async (e, i) => {
|
|
16
|
+
}), P = u(async (e, i, a) => {
|
|
17
17
|
if (!m || !p) return;
|
|
18
|
-
let
|
|
19
|
-
...
|
|
20
|
-
...
|
|
21
|
-
|
|
18
|
+
let o = t(i), s = r(E), c = o?.length || s || a?.length ? {
|
|
19
|
+
...o?.length ? { attachments: o } : {},
|
|
20
|
+
...s ? { configuration_value: E } : {},
|
|
21
|
+
...a?.length ? { skills: a } : {}
|
|
22
|
+
} : void 0, u = C(), { userMessage: d, assistantMessage: h } = n(e, c, u);
|
|
22
23
|
v((e) => {
|
|
23
24
|
if (!e) return e;
|
|
24
25
|
let t = {
|
|
25
26
|
...e,
|
|
26
27
|
messages: [
|
|
27
28
|
...e.messages,
|
|
28
|
-
|
|
29
|
-
|
|
29
|
+
d,
|
|
30
|
+
h
|
|
30
31
|
]
|
|
31
32
|
};
|
|
32
33
|
return y.current = t, t;
|
|
33
|
-
}), _(m, e, p.messages.length + 1,
|
|
34
|
+
}), _(m, e, p.messages.length + 1, u, c, l(), f.Append);
|
|
34
35
|
}, [
|
|
35
36
|
p,
|
|
36
37
|
m,
|
|
@@ -206,43 +207,46 @@ var p = ({ conversation: p, conversationId: m, bucket: h, isStreaming: g, startS
|
|
|
206
207
|
return n.delete(e), n;
|
|
207
208
|
});
|
|
208
209
|
}, []),
|
|
209
|
-
handleEditMessage: u(async (e, n, r, a) => {
|
|
210
|
+
handleEditMessage: u(async (e, n, r, a, o) => {
|
|
210
211
|
if (g || !m || !p) return;
|
|
211
|
-
let
|
|
212
|
-
if (
|
|
213
|
-
let
|
|
214
|
-
if (!i(p.messages,
|
|
212
|
+
let s = e;
|
|
213
|
+
if (s === -1 || p.messages[s].role !== c.User) return;
|
|
214
|
+
let u = p.messages[s];
|
|
215
|
+
if (!i(p.messages, s, n, r, a, o)) {
|
|
215
216
|
A((e) => {
|
|
216
217
|
let t = new Set(e);
|
|
217
|
-
return t.delete(
|
|
218
|
+
return t.delete(s), t;
|
|
218
219
|
});
|
|
219
220
|
return;
|
|
220
221
|
}
|
|
221
|
-
let
|
|
222
|
+
let d = t(a), h = new Set(r.map((e) => e.id)), b = [...(u.custom_content?.attachments ?? []).filter((e) => {
|
|
222
223
|
let t = e.url ?? e.data ?? e.title;
|
|
223
|
-
return
|
|
224
|
-
}), ...
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
...
|
|
224
|
+
return h.has(t);
|
|
225
|
+
}), ...d ?? []], { attachments: x, skills: S, ...w } = u.custom_content ?? {}, T = o ?? S, E;
|
|
226
|
+
E = b.length > 0 || T?.length ? {
|
|
227
|
+
...w,
|
|
228
|
+
...b.length > 0 ? { attachments: b } : {},
|
|
229
|
+
...T?.length ? { skills: T } : {}
|
|
230
|
+
} : Object.keys(w).length > 0 ? w : void 0;
|
|
231
|
+
let D = {
|
|
232
|
+
...u,
|
|
229
233
|
content: n,
|
|
230
|
-
custom_content:
|
|
231
|
-
},
|
|
234
|
+
custom_content: E
|
|
235
|
+
}, O = Date.now(), k = {
|
|
232
236
|
role: c.Assistant,
|
|
233
237
|
content: "",
|
|
234
|
-
timestamp: new Date(
|
|
235
|
-
},
|
|
236
|
-
...p.messages.slice(0,
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
],
|
|
238
|
+
timestamp: new Date(O).toISOString()
|
|
239
|
+
}, j = [
|
|
240
|
+
...p.messages.slice(0, s),
|
|
241
|
+
D,
|
|
242
|
+
k
|
|
243
|
+
], M = {
|
|
240
244
|
...p,
|
|
241
|
-
messages:
|
|
245
|
+
messages: j
|
|
242
246
|
};
|
|
243
|
-
y.current =
|
|
244
|
-
let
|
|
245
|
-
_(m, n,
|
|
247
|
+
y.current = M, v(M);
|
|
248
|
+
let N = C();
|
|
249
|
+
_(m, n, j.length - 1, N, E, l(), f.Edit), A(/* @__PURE__ */ new Set());
|
|
246
250
|
}, [
|
|
247
251
|
p,
|
|
248
252
|
m,
|
package/conversation.d.ts
CHANGED
|
@@ -20,6 +20,7 @@ import { PublishHistoryEntry } from '@epam/ai-dial-publish-panel';
|
|
|
20
20
|
import { RateApi } from '@epam/ai-dial-chat-api-client';
|
|
21
21
|
import { ReactNode } from 'react';
|
|
22
22
|
import { RefObject } from 'react';
|
|
23
|
+
import { RequestSkill } from '@epam/ai-dial-chat-shared';
|
|
23
24
|
import { ResponseFormat } from '@epam/ai-dial-chat-shared';
|
|
24
25
|
import { SendCompletionDtoModeEnum } from '@epam/ai-dial-chat-api-client';
|
|
25
26
|
import { SetStateAction } from 'react';
|
|
@@ -506,15 +507,20 @@ export declare const isAnswerIncomplete: (answer: Message | undefined) => boolea
|
|
|
506
507
|
export declare const isAwaitingGenerationResume: (conversation: Conversation) => boolean;
|
|
507
508
|
|
|
508
509
|
/**
|
|
509
|
-
* Returns `true` when the edited text or
|
|
510
|
-
* original message, meaning a regeneration is needed.
|
|
510
|
+
* Returns `true` when the edited text, attachment list, or skills list differs
|
|
511
|
+
* from the original message, meaning a regeneration is needed.
|
|
512
|
+
*
|
|
513
|
+
* `skills` is the skills state the edit will write: `undefined` leaves the
|
|
514
|
+
* original skills out of the comparison (nothing about them changes), while an
|
|
515
|
+
* array — including an empty one — is compared against the original.
|
|
511
516
|
*
|
|
512
517
|
* @param originalMessage - The unmodified message stored in the conversation.
|
|
513
518
|
* @param newText - The text the user submitted from the edit area.
|
|
514
519
|
* @param keptDisplayAttachments - Attachments the user kept (not removed).
|
|
515
520
|
* @param newAttachments - Brand-new attachments the user added during editing.
|
|
521
|
+
* @param skills - The skills the edited message will carry, or `undefined` to leave them unchanged.
|
|
516
522
|
*/
|
|
517
|
-
export declare const isMessageChanged: (originalMessage: Message, newText: string, keptDisplayAttachments: DisplayAttachment[], newAttachments: Attachment[]) => boolean;
|
|
523
|
+
export declare const isMessageChanged: (originalMessage: Message, newText: string, keptDisplayAttachments: DisplayAttachment[], newAttachments: Attachment[], skills?: RequestSkill[]) => boolean;
|
|
518
524
|
|
|
519
525
|
/**
|
|
520
526
|
* Returns `true` when `message` is the actively-streaming assistant response.
|
|
@@ -611,8 +617,10 @@ export declare const sanitizeFooterHtml: (html: string) => string;
|
|
|
611
617
|
* its answer never completed — after stopping a generation the user submits
|
|
612
618
|
* the same message precisely to get a full answer, so treating that as "no
|
|
613
619
|
* change" would leave the conversation stuck with the partial one.
|
|
620
|
+
*
|
|
621
|
+
* @param skills - The skills the edited message will carry, or `undefined` to leave them unchanged — see {@link isMessageChanged}.
|
|
614
622
|
*/
|
|
615
|
-
export declare const shouldRerunGenerationOnEdit: (messages: Message[], messageIndex: number, newText: string, keptDisplayAttachments: DisplayAttachment[], newAttachments: Attachment[]) => boolean;
|
|
623
|
+
export declare const shouldRerunGenerationOnEdit: (messages: Message[], messageIndex: number, newText: string, keptDisplayAttachments: DisplayAttachment[], newAttachments: Attachment[], skills?: RequestSkill[]) => boolean;
|
|
616
624
|
|
|
617
625
|
/** True when the first user/assistant exchange is complete and LLM naming may still run. */
|
|
618
626
|
export declare const shouldWatchForDisplayNameUpdate: (conversation: Conversation) => boolean;
|
|
@@ -795,7 +803,7 @@ export declare interface UseConversationHandlersParams {
|
|
|
795
803
|
|
|
796
804
|
/** Return value of {@link useConversationHandlers}. */
|
|
797
805
|
export declare interface UseConversationHandlersResult {
|
|
798
|
-
handleSend: (message: string, attachments: Attachment[]) => Promise<void>;
|
|
806
|
+
handleSend: (message: string, attachments: Attachment[], skills?: RequestSkill[]) => Promise<void>;
|
|
799
807
|
handleUploadAttachment: (attachment: Attachment) => Promise<UploadedAttachmentResult>;
|
|
800
808
|
handleRegenerateMessage: (messageIndex: number) => void;
|
|
801
809
|
handleDeleteMessage: (messageIndex: number) => void;
|
|
@@ -805,7 +813,7 @@ export declare interface UseConversationHandlersResult {
|
|
|
805
813
|
handleConfirmStarter: () => void;
|
|
806
814
|
handleStartEdit: (messageIndex: number) => void;
|
|
807
815
|
handleCancelEdit: (messageIndex: number) => void;
|
|
808
|
-
handleEditMessage: (messageIndex: number, text: string, keptDisplayAttachments: DisplayAttachment[], newAttachments: Attachment[]) => Promise<void>;
|
|
816
|
+
handleEditMessage: (messageIndex: number, text: string, keptDisplayAttachments: DisplayAttachment[], newAttachments: Attachment[], skills?: RequestSkill[]) => Promise<void>;
|
|
809
817
|
editingMessageIndexes: Set<number>;
|
|
810
818
|
pendingDeleteIndex: number | null;
|
|
811
819
|
setPendingDeleteIndex: (index: number | null) => void;
|
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
import { safeDecodeURI as e } from "../shared/string-utils.js";
|
|
2
|
-
import { PATH_SEPARATOR_REGEXP as
|
|
3
|
-
import { DialFileManagerActionProfile as
|
|
4
|
-
import { DialFileNodeType as
|
|
1
|
+
import { safeDecodeURI as e, stripTrailingSlashes as t } from "../shared/string-utils.js";
|
|
2
|
+
import { PATH_SEPARATOR_REGEXP as n } from "./dial-file-manager.model.js";
|
|
3
|
+
import { DialFileManagerActionProfile as r } from "./file-manager-variant.js";
|
|
4
|
+
import { DialFileNodeType as i, DialFilePermission as a } from "@epam/ai-dial-react-file-manager";
|
|
5
5
|
//#region src/files/dial-file-manager-path.util.ts
|
|
6
|
-
var
|
|
7
|
-
if (
|
|
8
|
-
if (
|
|
9
|
-
|
|
10
|
-
let r =
|
|
11
|
-
return
|
|
12
|
-
},
|
|
6
|
+
var o = (e, t) => {
|
|
7
|
+
if (n.test(e)) return !0;
|
|
8
|
+
if (t == null) return !1;
|
|
9
|
+
t.lastIndex = 0;
|
|
10
|
+
let r = t.test(e);
|
|
11
|
+
return t.lastIndex = 0, r;
|
|
12
|
+
}, s = (e) => t(e) || "/", c = (e, t) => {
|
|
13
13
|
let n = e.split("/").filter(Boolean);
|
|
14
14
|
return n[n.length - 1] ?? t;
|
|
15
|
-
},
|
|
16
|
-
let n =
|
|
17
|
-
for (let
|
|
18
|
-
if (
|
|
19
|
-
if (
|
|
20
|
-
let e =
|
|
15
|
+
}, l = (e, t) => s(e || `/${t}`).replace(/^\/+/, "") || t, u = (e, t) => {
|
|
16
|
+
let n = s(t);
|
|
17
|
+
for (let r of e) {
|
|
18
|
+
if (r.nodeType !== i.FOLDER) continue;
|
|
19
|
+
if (s(r.path) === n) return r;
|
|
20
|
+
let e = u(r.items ?? [], t);
|
|
21
21
|
if (e) return e;
|
|
22
22
|
}
|
|
23
|
-
},
|
|
23
|
+
}, d = (e) => e?.permissions?.includes(a.WRITE) ?? !1, f = (e, t) => {
|
|
24
24
|
for (let n of e) {
|
|
25
25
|
if (n.path === t || n.id === t) return n;
|
|
26
|
-
let e =
|
|
26
|
+
let e = f(n.items ?? [], t);
|
|
27
27
|
if (e) return e;
|
|
28
28
|
}
|
|
29
|
-
},
|
|
29
|
+
}, p = (e) => {
|
|
30
30
|
switch (e) {
|
|
31
|
-
case
|
|
32
|
-
case
|
|
33
|
-
case
|
|
31
|
+
case r.Attach: return !1;
|
|
32
|
+
case r.Browse:
|
|
33
|
+
case r.Full: return !0;
|
|
34
34
|
default: throw Error(`Unhandled actionProfile: ${String(e)}`);
|
|
35
35
|
}
|
|
36
|
-
},
|
|
36
|
+
}, m = (e) => e === r.Full, h = (e, t) => {
|
|
37
37
|
let n = e.replace(/\/$/, ""), r = n.lastIndexOf("/");
|
|
38
38
|
if (r <= 0) {
|
|
39
39
|
let e = r === 0 ? n.slice(1) : n;
|
|
@@ -46,13 +46,13 @@ var a = (e, n) => {
|
|
|
46
46
|
parentVirtualPath: n.slice(0, r),
|
|
47
47
|
name: n.slice(r + 1)
|
|
48
48
|
};
|
|
49
|
-
},
|
|
49
|
+
}, g = (e, t) => {
|
|
50
50
|
let n = `files/${t}/`;
|
|
51
51
|
return e.startsWith(n) ? e.slice(n.length) : e;
|
|
52
|
-
},
|
|
53
|
-
let i = t.
|
|
52
|
+
}, _ = (t, n, r) => {
|
|
53
|
+
let i = t.split("/").filter(Boolean).map(e).join("/"), a = i ? `/${n}/${i}` : `/${n}`;
|
|
54
54
|
return r ? `${a}/` : a;
|
|
55
|
-
},
|
|
55
|
+
}, v = (e, t, n) => {
|
|
56
56
|
if (!e) return {
|
|
57
57
|
bucket: n,
|
|
58
58
|
path: e
|
|
@@ -62,11 +62,11 @@ var a = (e, n) => {
|
|
|
62
62
|
bucket: n,
|
|
63
63
|
path: e
|
|
64
64
|
};
|
|
65
|
-
let o =
|
|
65
|
+
let o = g(a.dialCorePath, a.bucket), s = r === -1 ? "" : e.slice(r + 1);
|
|
66
66
|
return {
|
|
67
67
|
bucket: a.bucket,
|
|
68
68
|
path: o + s
|
|
69
69
|
};
|
|
70
70
|
};
|
|
71
71
|
//#endregion
|
|
72
|
-
export {
|
|
72
|
+
export { _ as buildSharedItemVirtualPath, g as dialCorePathToRelative, f as findDialFileByPath, u as findFolderByVirtualPath, l as formatOperationFolderName, c as getVirtualPathName, d as hasDialFileWritePermission, o as hasForbiddenNameSymbols, p as isCopyMoveDuplicateAllowed, m as isShareActionsAllowed, s as normalizeVirtualPath, h as parseNewFolderVirtualPath, v as resolveOwnerCoords };
|
package/files/file-name.js
CHANGED
|
@@ -11,9 +11,13 @@ var r = (e) => {
|
|
|
11
11
|
if (e(n) <= i) return n;
|
|
12
12
|
let { base: a, extension: o } = r(n), s = i - e(o);
|
|
13
13
|
return s <= 0 ? t(n, i) : `${t(a, s)}${o}`;
|
|
14
|
-
}, a = (e) => {
|
|
15
|
-
let
|
|
16
|
-
|
|
14
|
+
}, a = /[.\s]/, o = (e) => {
|
|
15
|
+
let t = e.length;
|
|
16
|
+
for (; t > 0 && a.test(e[t - 1]);) --t;
|
|
17
|
+
return e.slice(0, t);
|
|
18
|
+
}, s = (e) => {
|
|
19
|
+
let { base: t, extension: a } = r(e), s = o(t.replace(new RegExp(n.source, "g"), "_"));
|
|
20
|
+
return s === "" ? e : i(`${s}${a}`);
|
|
17
21
|
};
|
|
18
22
|
//#endregion
|
|
19
|
-
export {
|
|
23
|
+
export { s as sanitizeFileName, r as splitFileNameExtension, i as trimFileNameToByteLimit };
|
package/index.d.ts
CHANGED
|
@@ -105,6 +105,7 @@ import { ReactNode } from 'react';
|
|
|
105
105
|
import { RefObject } from 'react';
|
|
106
106
|
import { RenameFilesResponseDto } from '@epam/ai-dial-chat-api-client';
|
|
107
107
|
import { RenameItemDto } from '@epam/ai-dial-chat-api-client';
|
|
108
|
+
import { RequestSkill } from '@epam/ai-dial-chat-shared';
|
|
108
109
|
import { ResponseFormat } from '@epam/ai-dial-chat-shared';
|
|
109
110
|
import { RevokeAccessItemDto } from '@epam/ai-dial-chat-api-client';
|
|
110
111
|
import { RevokeAccessResponseDto } from '@epam/ai-dial-chat-api-client';
|
|
@@ -1911,15 +1912,20 @@ export declare const isDownloadableAttachment: (attachment: DisplayAttachment) =
|
|
|
1911
1912
|
export declare const isExternalSourcePreviewable: (contentType: string, url: string) => boolean;
|
|
1912
1913
|
|
|
1913
1914
|
/**
|
|
1914
|
-
* Returns `true` when the edited text or
|
|
1915
|
-
* original message, meaning a regeneration is needed.
|
|
1915
|
+
* Returns `true` when the edited text, attachment list, or skills list differs
|
|
1916
|
+
* from the original message, meaning a regeneration is needed.
|
|
1917
|
+
*
|
|
1918
|
+
* `skills` is the skills state the edit will write: `undefined` leaves the
|
|
1919
|
+
* original skills out of the comparison (nothing about them changes), while an
|
|
1920
|
+
* array — including an empty one — is compared against the original.
|
|
1916
1921
|
*
|
|
1917
1922
|
* @param originalMessage - The unmodified message stored in the conversation.
|
|
1918
1923
|
* @param newText - The text the user submitted from the edit area.
|
|
1919
1924
|
* @param keptDisplayAttachments - Attachments the user kept (not removed).
|
|
1920
1925
|
* @param newAttachments - Brand-new attachments the user added during editing.
|
|
1926
|
+
* @param skills - The skills the edited message will carry, or `undefined` to leave them unchanged.
|
|
1921
1927
|
*/
|
|
1922
|
-
export declare const isMessageChanged: (originalMessage: Message, newText: string, keptDisplayAttachments: DisplayAttachment[], newAttachments: Attachment[]) => boolean;
|
|
1928
|
+
export declare const isMessageChanged: (originalMessage: Message, newText: string, keptDisplayAttachments: DisplayAttachment[], newAttachments: Attachment[], skills?: RequestSkill[]) => boolean;
|
|
1923
1929
|
|
|
1924
1930
|
/**
|
|
1925
1931
|
* Returns `true` when `message` is the actively-streaming assistant response.
|
|
@@ -3067,8 +3073,10 @@ export declare interface SharedRootMeta {
|
|
|
3067
3073
|
* its answer never completed — after stopping a generation the user submits
|
|
3068
3074
|
* the same message precisely to get a full answer, so treating that as "no
|
|
3069
3075
|
* change" would leave the conversation stuck with the partial one.
|
|
3076
|
+
*
|
|
3077
|
+
* @param skills - The skills the edited message will carry, or `undefined` to leave them unchanged — see {@link isMessageChanged}.
|
|
3070
3078
|
*/
|
|
3071
|
-
export declare const shouldRerunGenerationOnEdit: (messages: Message[], messageIndex: number, newText: string, keptDisplayAttachments: DisplayAttachment[], newAttachments: Attachment[]) => boolean;
|
|
3079
|
+
export declare const shouldRerunGenerationOnEdit: (messages: Message[], messageIndex: number, newText: string, keptDisplayAttachments: DisplayAttachment[], newAttachments: Attachment[], skills?: RequestSkill[]) => boolean;
|
|
3072
3080
|
|
|
3073
3081
|
/** True when the first user/assistant exchange is complete and LLM naming may still run. */
|
|
3074
3082
|
export declare const shouldWatchForDisplayNameUpdate: (conversation: Conversation) => boolean;
|
|
@@ -3396,6 +3404,9 @@ export declare interface StreamCompletionOptions {
|
|
|
3396
3404
|
/** Strips leading and trailing slashes from a path segment. */
|
|
3397
3405
|
export declare const stripSurroundingSlashes: (path: string) => string;
|
|
3398
3406
|
|
|
3407
|
+
/** Strips trailing slashes from a path segment. */
|
|
3408
|
+
export declare const stripTrailingSlashes: (path: string) => string;
|
|
3409
|
+
|
|
3399
3410
|
declare type SubmitPhase = 'idle' | 'submitting' | 'success' | 'failure';
|
|
3400
3411
|
|
|
3401
3412
|
export declare const subscribeToolsetLoginSuccess: <T>(listener: (detail: ToolsetLoginSuccessDetail<T>) => void) => (() => void);
|
|
@@ -4173,7 +4184,7 @@ export declare interface UseConversationHandlersParams {
|
|
|
4173
4184
|
|
|
4174
4185
|
/** Return value of {@link useConversationHandlers}. */
|
|
4175
4186
|
export declare interface UseConversationHandlersResult {
|
|
4176
|
-
handleSend: (message: string, attachments: Attachment[]) => Promise<void>;
|
|
4187
|
+
handleSend: (message: string, attachments: Attachment[], skills?: RequestSkill[]) => Promise<void>;
|
|
4177
4188
|
handleUploadAttachment: (attachment: Attachment) => Promise<UploadedAttachmentResult>;
|
|
4178
4189
|
handleRegenerateMessage: (messageIndex: number) => void;
|
|
4179
4190
|
handleDeleteMessage: (messageIndex: number) => void;
|
|
@@ -4183,7 +4194,7 @@ export declare interface UseConversationHandlersResult {
|
|
|
4183
4194
|
handleConfirmStarter: () => void;
|
|
4184
4195
|
handleStartEdit: (messageIndex: number) => void;
|
|
4185
4196
|
handleCancelEdit: (messageIndex: number) => void;
|
|
4186
|
-
handleEditMessage: (messageIndex: number, text: string, keptDisplayAttachments: DisplayAttachment[], newAttachments: Attachment[]) => Promise<void>;
|
|
4197
|
+
handleEditMessage: (messageIndex: number, text: string, keptDisplayAttachments: DisplayAttachment[], newAttachments: Attachment[], skills?: RequestSkill[]) => Promise<void>;
|
|
4187
4198
|
editingMessageIndexes: Set<number>;
|
|
4188
4199
|
pendingDeleteIndex: number | null;
|
|
4189
4200
|
setPendingDeleteIndex: (index: number | null) => void;
|
package/index.js
CHANGED
|
@@ -1,136 +1,136 @@
|
|
|
1
1
|
import { getApiErrorDetails as e, getApiErrorMessage as t, getApiErrorStatus as n, isConversationNotFoundError as r } from "./api-error/api-error.js";
|
|
2
2
|
import { createCsrfMiddleware as i } from "./api-transport/create-csrf-middleware.js";
|
|
3
3
|
import { createUnauthorizedMiddleware as a } from "./api-transport/create-unauthorized-middleware.js";
|
|
4
|
-
import { includesIgnoreCase as o, safeDecodeURI as s, safeDecodeURIComponent as c, stripSurroundingSlashes as l } from "./shared/string-utils.js";
|
|
5
|
-
import { isDialFileId as
|
|
6
|
-
import { downloadAttachment as
|
|
7
|
-
import { isDialFileAcceptType as
|
|
8
|
-
import { AttachmentValidationErrorReason as
|
|
9
|
-
import { formatDateYM as
|
|
10
|
-
import { ConversationExportMode as
|
|
11
|
-
import { EXPORT_APP_NAME as
|
|
12
|
-
import { formatQuotedNameList as
|
|
13
|
-
import { createPublishApiClient as
|
|
14
|
-
import { buildChatCompletionsUrl as
|
|
15
|
-
import { encodeDeploymentId as
|
|
16
|
-
import { AuthenticationType as
|
|
17
|
-
import { mapDeploymentLimitsDtoToCatalogLimits as
|
|
18
|
-
import { mapDeploymentLimitsToInput as
|
|
19
|
-
import { decodeToolsetId as
|
|
20
|
-
import { appendLocaleCode as
|
|
21
|
-
import { formatCalendarDate as
|
|
22
|
-
import { mapDeploymentDetailsDtoToEntityDetails as
|
|
23
|
-
import { mapDeploymentToCatalogItem as
|
|
24
|
-
import { PromptSource as
|
|
25
|
-
import { buildPromptOverview as
|
|
26
|
-
import { SKILL_FILE_UPLOAD_MAX_BYTES as
|
|
27
|
-
import { PUBLIC_SKILL_BUCKET as
|
|
28
|
-
import { buildSkillContentTree as
|
|
29
|
-
import { McpResourceKind as
|
|
30
|
-
import { getPublicCatalogEntityFolderPath as
|
|
31
|
-
import { deriveAvailableTabIds as
|
|
32
|
-
import { CatalogPrimaryActionType as
|
|
33
|
-
import { useCatalogEditNavigation as
|
|
34
|
-
import { parseSkillManifestDocument as
|
|
35
|
-
import { fetchSkillDescription as
|
|
36
|
-
import { useCatalogItemDetails as
|
|
37
|
-
import { OAuthResourceKind as
|
|
38
|
-
import { emitToolsetLoginSuccess as
|
|
39
|
-
import { getToolsetOAuthChannelName as
|
|
40
|
-
import { buildToolsetAuthorizeUrl as
|
|
41
|
-
import { initiateOAuthLogin as
|
|
42
|
-
import { ToolsetLoginOutcomeType as
|
|
43
|
-
import { useCatalogToolsetCredentials as
|
|
44
|
-
import { useSkillDetailsPanelData as
|
|
45
|
-
import { FavoriteEntityType as
|
|
46
|
-
import { usePublishFolders as
|
|
47
|
-
import { buildAnnouncementSignature as
|
|
48
|
-
import { DEFAULT_GENERATION_CONFLICT_MESSAGE as
|
|
49
|
-
import { shouldWatchForDisplayNameUpdate as
|
|
50
|
-
import { formatAppVersion as
|
|
51
|
-
import { getModelIdFromConversationId as
|
|
52
|
-
import { getTimeOfDayGreeting as
|
|
53
|
-
import { createDeploymentChangedMessage as
|
|
54
|
-
import { getLastDeploymentId as
|
|
55
|
-
import { toOverlayMessages as
|
|
56
|
-
import { getQuickAppConversationStarters as
|
|
57
|
-
import { getStarterPopulateText as
|
|
58
|
-
import { useOAuthCallbackCompletion as
|
|
59
|
-
import { buildPromptExportEnvelope as
|
|
60
|
-
import { PROMPT_CONTENT_MAX_LENGTH as
|
|
61
|
-
import { usePromptsState as
|
|
62
|
-
import { UnsupportedTriggerReason as
|
|
63
|
-
import { apSchedulerDayToJsDay as
|
|
64
|
-
import { mapFormValuesToCreateBody as
|
|
65
|
-
import { validateSkillFileBatch as
|
|
66
|
-
import { skillFileToAttachment as
|
|
67
|
-
import { SkillEditorLoadState as
|
|
68
|
-
import { useSkillEditorSubmit as
|
|
69
|
-
import { useSkillFileActions as
|
|
70
|
-
import { SkillPreviewErrorKind as
|
|
71
|
-
import { useSkillsState as
|
|
72
|
-
import { RecipientsCountStatus as
|
|
73
|
-
import { deriveConversationRowActionState as
|
|
74
|
-
import { useActiveConversationSync as
|
|
75
|
-
import { useAsyncConfirmDialog as
|
|
76
|
-
import { useConversationLookupMaps as
|
|
77
|
-
import { getConversationSource as
|
|
78
|
-
import { useImportFilePicker as
|
|
79
|
-
import { sanitizeFileName as
|
|
80
|
-
import { useAttachmentUpload as
|
|
81
|
-
import { AudioTranscriptionError as
|
|
82
|
-
import { useTranscribeAudio as
|
|
83
|
-
import { DEFAULT_MAX_ARCHIVE_BYTES as
|
|
84
|
-
import { attachmentToDto as
|
|
85
|
-
import { createMessagePair as
|
|
86
|
-
import { hasActiveToolConfig as
|
|
87
|
-
import { getStarterConversationText as
|
|
88
|
-
import { getConversationPath as
|
|
89
|
-
import { useConversationHandlers as
|
|
90
|
-
import { useConversationImport as
|
|
91
|
-
import { useConversationScroll as
|
|
92
|
-
import { isAwaitingGenerationResume as
|
|
93
|
-
import { useConversationStream as
|
|
94
|
-
import { useConversationSources as
|
|
95
|
-
import { DialFilesApiUploadMode as
|
|
96
|
-
import { FileManagerNotificationReason as
|
|
97
|
-
import { COLUMNS_WITHOUT_AUTHOR as
|
|
98
|
-
import { DialFileManagerActionProfile as
|
|
99
|
-
import { buildSharedItemVirtualPath as
|
|
100
|
-
import { getParentFolderPath as
|
|
101
|
-
import { prepareCopyItems as
|
|
102
|
-
import { buildFromCache as
|
|
103
|
-
import { createFilesApiClient as
|
|
104
|
-
import { createUploadFileWithProgress as
|
|
105
|
-
import { openAnnotationAttachment as
|
|
106
|
-
import { annotationToOoxmlCanvasContent as
|
|
107
|
-
import { getUrlFileName as
|
|
108
|
-
import { annotationToDisplayAttachment as
|
|
109
|
-
import { dialFileToAttachment as
|
|
110
|
-
import { DownloadDestinationType as
|
|
111
|
-
import { prepareDownloadDestination as
|
|
112
|
-
import { useDialFileListing as
|
|
113
|
-
import { useDialFileMetadata as
|
|
114
|
-
import { useDialFileMutations as
|
|
115
|
-
import { useDialFileSharing as
|
|
116
|
-
import { useDialFileUploadBatch as
|
|
117
|
-
import { useDialFileManager as
|
|
118
|
-
import { useDialFileManagerTabConfig as
|
|
119
|
-
import { isCustomAppSchema as
|
|
120
|
-
import { getBrowserTimezone as
|
|
121
|
-
import { isValidAbsoluteUrl as
|
|
122
|
-
import { buildExternalServiceScopeId as
|
|
123
|
-
import { useChatSettingsFormConfig as
|
|
124
|
-
import { usePageFileDrag as
|
|
125
|
-
import { useViewportWidth as
|
|
126
|
-
import { usePanelMaxWidth as
|
|
127
|
-
import { useShareLink as
|
|
128
|
-
import { useToolsMenu as
|
|
129
|
-
import { useUsageData as
|
|
130
|
-
import { McpAppResourceFetchError as
|
|
131
|
-
import { useMcpAppTools as
|
|
132
|
-
import { useMcpAppHostContext as
|
|
133
|
-
import { useMcpAppHostAdapter as
|
|
134
|
-
import { useOpenMcpAppCanvas as
|
|
135
|
-
import { useGridEditingScroll as
|
|
136
|
-
export {
|
|
4
|
+
import { includesIgnoreCase as o, safeDecodeURI as s, safeDecodeURIComponent as c, stripSurroundingSlashes as l, stripTrailingSlashes as u } from "./shared/string-utils.js";
|
|
5
|
+
import { isDialFileId as d, resolveDialFileBucketAndPath as f, resolveRelativeDialFilePath as p } from "./files/dial-file.js";
|
|
6
|
+
import { downloadAttachment as m, isDownloadableAttachment as h, useAttachmentAction as g } from "./attachment/useAttachmentAction/useAttachmentAction.js";
|
|
7
|
+
import { isDialFileAcceptType as _, mimeTypesToAttachmentExtensionLabels as v, mimeTypesToDialFileAcceptTypes as y, mimeTypesToFileAccept as b } from "./files/attachment-types.js";
|
|
8
|
+
import { AttachmentValidationErrorReason as x, useAttachmentValidation as S } from "./attachment/useAttachmentValidation/useAttachmentValidation.js";
|
|
9
|
+
import { formatDateYM as C, formatDateYMD as w } from "./conversation/conversation-transfer/date.js";
|
|
10
|
+
import { ConversationExportMode as T, ConversationTransferErrorCode as E, ConversationTransferWarningCode as D, ExportFileNameKind as O } from "./conversation/conversation-transfer/types.js";
|
|
11
|
+
import { EXPORT_APP_NAME as k } from "./conversation/conversation-transfer/export-conversation.js";
|
|
12
|
+
import { formatQuotedNameList as A } from "./conversation/conversation-transfer/import-conversation.js";
|
|
13
|
+
import { createPublishApiClient as j, toPublishRuleDto as M } from "./catalog/create-publish-api.js";
|
|
14
|
+
import { buildChatCompletionsUrl as N, buildDeploymentConnectApi as P, buildResponsesUrl as F } from "./catalog/deployment-endpoint-url.js";
|
|
15
|
+
import { encodeDeploymentId as I, findDeploymentByIdOrReference as L } from "./catalog/deployment-id.js";
|
|
16
|
+
import { AuthenticationType as R } from "./catalog/entity-details.js";
|
|
17
|
+
import { mapDeploymentLimitsDtoToCatalogLimits as z } from "./catalog/map-deployment-limits-to-catalog.js";
|
|
18
|
+
import { mapDeploymentLimitsToInput as B } from "./catalog/map-deployment-limits-to-input.js";
|
|
19
|
+
import { decodeToolsetId as V, encodeToolsetId as H, isPublicToolsetId as U } from "./oauth/toolset-id.js";
|
|
20
|
+
import { appendLocaleCode as W, buildAdditionalLocaleOptions as G, composeLocalePayload as K, decomposeLocalizedFields as q, resolveLocalizedText as J, toBaseLocale as Y } from "./shared/locale.js";
|
|
21
|
+
import { formatCalendarDate as X, padTwoDigits as Z } from "./shared/formatting.js";
|
|
22
|
+
import { mapDeploymentDetailsDtoToEntityDetails as Q, mapEntityDetailsToCatalogDetails as $, mapToolsetCredentials as ee } from "./catalog/map-entity-details-to-catalog.js";
|
|
23
|
+
import { mapDeploymentToCatalogItem as te, mapDeploymentToolsetCredentials as ne, mapToolsetToCatalogItem as re, resolveDeploymentFolder as ie } from "./catalog/map-deployment-to-catalog-item.js";
|
|
24
|
+
import { PromptSource as ae, parsePromptResourceUrl as oe } from "./prompt/prompt-resource.js";
|
|
25
|
+
import { buildPromptOverview as se, isOrganisationPromptItem as ce, mapPromptToCatalogItem as le } from "./catalog/map-prompt-to-catalog-item.js";
|
|
26
|
+
import { SKILL_FILE_UPLOAD_MAX_BYTES as ue, SKILL_MANIFEST_FILE as de, SKILL_UPLOAD_MAX_FILES as fe, SKILL_UPLOAD_MAX_TOTAL_BYTES as pe, buildSkillFilesPayload as me, buildSkillManifest as he, buildSkillManifestForSubmit as ge, buildSkillManifestFromFrontmatter as _e, isValidSkillRelativePath as ve, nameFromPath as ye, normalizeSkillName as be, parseSkillManifest as xe, skillFileBytesToBlob as Se, unpackSkillArchive as Ce } from "./skill/skill.js";
|
|
27
|
+
import { PUBLIC_SKILL_BUCKET as we, SKILL_LISTING_MAX_PAGES as Te, SKILL_LISTING_PAGE_SIZE as Ee, SKILL_MANIFEST_MAX_BYTES as De, SkillSource as Oe, parseSkillResourceUrl as ke } from "./skill/skill-types.js";
|
|
28
|
+
import { buildSkillContentTree as Ae, buildSkillOverview as je, mapSkillToCatalogItem as Me, readSkillFileBytes as Ne, readSkillManifest as Pe, resolveSkillFileDownloadPath as Fe, resolveSkillManifestFileId as Ie } from "./catalog/map-skill-to-catalog-item.js";
|
|
29
|
+
import { McpResourceKind as Le, buildApplicationMcpUrl as Re, buildConnectApi as ze, buildToolsetMcpUrl as Be, resolveMcpResourceKind as Ve } from "./catalog/mcp-endpoint-url.js";
|
|
30
|
+
import { getPublicCatalogEntityFolderPath as He, isPublicCatalogEntityId as Ue, mapPublishConversationResultDto as We, mapPublishHistoryEntryDto as Ge, toPublishEntityType as Ke } from "./catalog/publish.js";
|
|
31
|
+
import { deriveAvailableTabIds as qe, deriveFavoriteItems as Je, filterCatalogItemsBySelector as Ye, filterHiddenOwnedItems as Xe, reconcileFilterTopics as Ze } from "./catalog/catalog-derivations.js";
|
|
32
|
+
import { CatalogPrimaryActionType as Qe, resolveCatalogPrimaryAction as $e } from "./catalog/catalog-primary-action.js";
|
|
33
|
+
import { useCatalogEditNavigation as et } from "./catalog/useCatalogEditNavigation/useCatalogEditNavigation.js";
|
|
34
|
+
import { parseSkillManifestDocument as tt } from "./skill/skill-manifest.js";
|
|
35
|
+
import { fetchSkillDescription as nt, useSkillItemDetails as rt } from "./catalog/useSkillItemDetails.js";
|
|
36
|
+
import { useCatalogItemDetails as it } from "./catalog/useCatalogItemDetails.js";
|
|
37
|
+
import { OAuthResourceKind as at, TOOLSET_REDIRECT_STATE_KEY as ot, ToolsetAuthStatus as st, ToolsetAuthTypes as ct, ToolsetCredentialsLevel as lt, ToolsetOAuthCallbackQuery as ut, ToolsetOAuthChannelControlType as dt, ToolsetOAuthFailureReason as ft, ToolsetOAuthInitiationResultType as pt, ToolsetOAuthResultType as mt, WithLogin as ht } from "./oauth/types.js";
|
|
38
|
+
import { emitToolsetLoginSuccess as gt, subscribeToolsetLoginSuccess as _t } from "./shared/toolset-login-events.js";
|
|
39
|
+
import { getToolsetOAuthChannelName as vt, waitForToolsetOAuthResult as yt } from "./oauth/handshake.js";
|
|
40
|
+
import { buildToolsetAuthorizeUrl as bt, getToolsetRedirectUri as xt } from "./oauth/authorize-url.js";
|
|
41
|
+
import { initiateOAuthLogin as St, navigateToolsetOAuthPopup as Ct, openToolsetOAuthPopup as wt } from "./oauth/popup.js";
|
|
42
|
+
import { ToolsetLoginOutcomeType as Tt, useToolsetLogin as Et } from "./oauth/useToolsetLogin/useToolsetLogin.js";
|
|
43
|
+
import { useCatalogToolsetCredentials as Dt } from "./catalog/useCatalogToolsetCredentials/useCatalogToolsetCredentials.js";
|
|
44
|
+
import { useSkillDetailsPanelData as Ot } from "./catalog/useSkillDetailsPanelData/useSkillDetailsPanelData.js";
|
|
45
|
+
import { FavoriteEntityType as kt, useFavoriteEntitiesState as At } from "./catalog/useFavoriteEntitiesState/useFavoriteEntitiesState.js";
|
|
46
|
+
import { usePublishFolders as jt } from "./catalog/usePublishFolders/usePublishFolders.js";
|
|
47
|
+
import { buildAnnouncementSignature as Mt, hasAnnouncementContent as Nt, hasStructuredAnnouncement as Pt, sanitizeAnnouncementHtml as Ft, sanitizeAnnouncementMessageHtml as It } from "./conversation/announcement-message.js";
|
|
48
|
+
import { DEFAULT_GENERATION_CONFLICT_MESSAGE as Lt, GenerationConflictError as Rt, createChatStreamApi as zt } from "./conversation/create-chat-stream-api.js";
|
|
49
|
+
import { shouldWatchForDisplayNameUpdate as Bt } from "./conversation/display-name-watch.js";
|
|
50
|
+
import { formatAppVersion as Vt, sanitizeFooterHtml as Ht } from "./conversation/footer-message.js";
|
|
51
|
+
import { getModelIdFromConversationId as Ut } from "./conversation/get-model-id-from-conversation-id.js";
|
|
52
|
+
import { getTimeOfDayGreeting as Wt } from "./conversation/greeting.js";
|
|
53
|
+
import { createDeploymentChangedMessage as Gt } from "./conversation/message-factory.js";
|
|
54
|
+
import { getLastDeploymentId as Kt, getLastUserMessageToolConfiguration as qt, isMessageStreaming as Jt, messageHasStages as Yt, normalizeResponseFormat as Xt } from "./conversation/message-utils.js";
|
|
55
|
+
import { toOverlayMessages as Zt } from "./conversation/overlay-messages.js";
|
|
56
|
+
import { getQuickAppConversationStarters as Qt } from "./conversation/quick-app-conversation-starters.js";
|
|
57
|
+
import { getStarterPopulateText as $t, getStartersFromSchema as en } from "./conversation/starter-option.js";
|
|
58
|
+
import { useOAuthCallbackCompletion as tn } from "./oauth/useOAuthCallbackCompletion/useOAuthCallbackCompletion.js";
|
|
59
|
+
import { buildPromptExportEnvelope as nn, buildPromptExportFileName as rn, serializePromptExport as an } from "./prompt/export-prompt.js";
|
|
60
|
+
import { PROMPT_CONTENT_MAX_LENGTH as on, PROMPT_COUNTER_ANNOUNCE_THRESHOLD as sn, PROMPT_DESCRIPTION_MAX_LENGTH as cn, PROMPT_NAME_MAX_LENGTH as ln, PromptFieldError as un, buildPromptPath as dn, getRemainingCharacters as fn, validatePromptContent as pn, validatePromptDescription as mn, validatePromptName as hn } from "./prompt/prompt.js";
|
|
61
|
+
import { usePromptsState as gn } from "./prompt/usePromptsState/usePromptsState.js";
|
|
62
|
+
import { UnsupportedTriggerReason as _n } from "./scheduled-task/scheduled-task-mapping.js";
|
|
63
|
+
import { apSchedulerDayToJsDay as vn, jsDayToApSchedulerDay as yn } from "./shared/cron-weekday.js";
|
|
64
|
+
import { mapFormValuesToCreateBody as bn, mapFormValuesToUpdateBody as xn, mapScheduledTaskDtoToFormValues as Sn } from "./scheduled-task/scheduled-task-trigger.js";
|
|
65
|
+
import { validateSkillFileBatch as Cn } from "./skill/skill-file-batch-validation.js";
|
|
66
|
+
import { skillFileToAttachment as wn } from "./skill/skill-file-preview.js";
|
|
67
|
+
import { SkillEditorLoadState as Tn, useSkillEditorLoad as En } from "./skill/useSkillEditorLoad.js";
|
|
68
|
+
import { useSkillEditorSubmit as Dn } from "./skill/useSkillEditorSubmit.js";
|
|
69
|
+
import { useSkillFileActions as On } from "./skill/useSkillFileActions.js";
|
|
70
|
+
import { SkillPreviewErrorKind as kn, useSkillFilePreview as An } from "./skill/useSkillFilePreview.js";
|
|
71
|
+
import { useSkillsState as jn } from "./skill/useSkillsState/useSkillsState.js";
|
|
72
|
+
import { RecipientsCountStatus as Mn, useShareRecipientsCount as Nn } from "./useShareRecipientsCount/useShareRecipientsCount.js";
|
|
73
|
+
import { deriveConversationRowActionState as Pn } from "./conversation/deriveConversationRowActionState/deriveConversationRowActionState.js";
|
|
74
|
+
import { useActiveConversationSync as Fn } from "./conversation/useActiveConversationSync/useActiveConversationSync.js";
|
|
75
|
+
import { useAsyncConfirmDialog as In } from "./conversation/useAsyncConfirmDialog/useAsyncConfirmDialog.js";
|
|
76
|
+
import { useConversationLookupMaps as Ln } from "./conversation/useConversationLookupMaps/useConversationLookupMaps.js";
|
|
77
|
+
import { getConversationSource as Rn, useConversationPanelItems as zn } from "./conversation/useConversationPanelItems/useConversationPanelItems.js";
|
|
78
|
+
import { useImportFilePicker as Bn } from "./conversation/useImportFilePicker/useImportFilePicker.js";
|
|
79
|
+
import { sanitizeFileName as Vn, splitFileNameExtension as Hn, trimFileNameToByteLimit as Un } from "./files/file-name.js";
|
|
80
|
+
import { useAttachmentUpload as Wn } from "./conversation/useAttachmentUpload/useAttachmentUpload.js";
|
|
81
|
+
import { AudioTranscriptionError as Gn, AudioTranscriptionErrorReason as Kn } from "./conversation/useTranscribeAudio/audio-transcription-error.js";
|
|
82
|
+
import { useTranscribeAudio as qn } from "./conversation/useTranscribeAudio/useTranscribeAudio.js";
|
|
83
|
+
import { DEFAULT_MAX_ARCHIVE_BYTES as Jn, useConversationExport as Yn } from "./conversation/useConversationExport/useConversationExport.js";
|
|
84
|
+
import { attachmentToDto as Xn, attachmentsToDtos as Zn } from "./conversation/useConversationHandlers/attachment-to-dto.js";
|
|
85
|
+
import { createMessagePair as Qn } from "./conversation/useConversationHandlers/message-factory.js";
|
|
86
|
+
import { hasActiveToolConfig as $n, isAnswerIncomplete as er, isMessageChanged as tr, shouldRerunGenerationOnEdit as nr } from "./conversation/useConversationHandlers/message-utils.js";
|
|
87
|
+
import { getStarterConversationText as rr, getStarterDisplayText as ir, getStarterSubmitText as ar } from "./conversation/useConversationHandlers/starter-option.js";
|
|
88
|
+
import { getConversationPath as or } from "./conversation/useConversationStream/conversation-path.js";
|
|
89
|
+
import { useConversationHandlers as sr } from "./conversation/useConversationHandlers/useConversationHandlers.js";
|
|
90
|
+
import { useConversationImport as cr } from "./conversation/useConversationImport/useConversationImport.js";
|
|
91
|
+
import { useConversationScroll as lr } from "./conversation/useConversationScroll/useConversationScroll.js";
|
|
92
|
+
import { isAwaitingGenerationResume as ur } from "./conversation/useConversationStream/generation-resume.js";
|
|
93
|
+
import { useConversationStream as dr } from "./conversation/useConversationStream/useConversationStream.js";
|
|
94
|
+
import { useConversationSources as fr } from "./conversation-sources/useConversationSources/useConversationSources.js";
|
|
95
|
+
import { DialFilesApiUploadMode as pr } from "./files/dial-files-api.js";
|
|
96
|
+
import { FileManagerNotificationReason as mr, FileNameValidationErrorReason as hr, FileOperationKind as gr } from "./files/dial-file-manager.types.js";
|
|
97
|
+
import { COLUMNS_WITHOUT_AUTHOR as _r, COLUMNS_WITH_AUTHOR as vr, CORE_PERMISSION_MAP as yr, DATE_OPTIONS as br, PATH_SEPARATOR_REGEXP as xr, RESERVED_MARKER_NAME as Sr, UPLOAD_CONCURRENCY as Cr } from "./files/dial-file-manager.model.js";
|
|
98
|
+
import { DialFileManagerActionProfile as wr, DialFileManagerVariant as Tr, deriveActionProfile as Er } from "./files/file-manager-variant.js";
|
|
99
|
+
import { buildSharedItemVirtualPath as Dr, dialCorePathToRelative as Or, findDialFileByPath as kr, findFolderByVirtualPath as Ar, formatOperationFolderName as jr, getVirtualPathName as Mr, hasDialFileWritePermission as Nr, hasForbiddenNameSymbols as Pr, isCopyMoveDuplicateAllowed as Fr, isShareActionsAllowed as Ir, normalizeVirtualPath as Lr, parseNewFolderVirtualPath as Rr, resolveOwnerCoords as zr } from "./files/dial-file-manager-path.util.js";
|
|
100
|
+
import { getParentFolderPath as Br, resolveDialFileApiPath as Vr, virtualPathToApiPath as Hr } from "./files/resolve-dial-file-api-path.js";
|
|
101
|
+
import { prepareCopyItems as Ur, prepareMoveRenameItems as Wr } from "./files/dial-file-manager-copy-move.util.js";
|
|
102
|
+
import { buildFromCache as Gr, fetchByTab as Kr, fetchForSearch as qr, findFirstSuccessfulCopyMoveItem as Jr, mapCorePermissions as Yr, mapFileMetadataToDialFile as Xr, mapSearchItem as Zr, mergeCreatedFolderIntoCache as Qr, updateEntry as $r } from "./files/dial-file-manager-mapping.util.js";
|
|
103
|
+
import { createFilesApiClient as ei } from "./files/create-files-api.js";
|
|
104
|
+
import { createUploadFileWithProgress as ti } from "./files/create-upload-file-with-progress.js";
|
|
105
|
+
import { openAnnotationAttachment as ni } from "./files/annotation.js";
|
|
106
|
+
import { annotationToOoxmlCanvasContent as ri, annotationToPdfCanvasContent as ii, clearAttachmentCache as ai, hasAttachmentTextSource as oi, referenceAttachmentToPdfCanvasContent as si, resolveCodeCanvasContent as ci, resolveHtmlCanvasContent as li, resolveImageCanvasContent as ui, resolveJsonCanvasContent as di, resolveMarkdownCanvasContent as fi, resolveOoxmlCanvasContent as pi, resolvePdfCanvasContent as mi, resolveTextCanvasContent as hi, resolveVisualizerCanvasContent as gi } from "./files/attachment-canvas.js";
|
|
107
|
+
import { getUrlFileName as _i, isExternalSourcePreviewable as vi, resolveExternalSourceContentType as yi } from "./files/source-content.js";
|
|
108
|
+
import { annotationToDisplayAttachment as bi, attachmentDtoToDisplayAttachment as xi, attachmentDtosToDisplayAttachments as Si } from "./files/attachment-dto-to-display.js";
|
|
109
|
+
import { dialFileToAttachment as Ci, dialFilesToAttachments as wi, dialFolderPathToAttachment as Ti } from "./files/dial-file-to-attachment.js";
|
|
110
|
+
import { DownloadDestinationType as Ei } from "./files/download-destination.js";
|
|
111
|
+
import { prepareDownloadDestination as Di } from "./files/prepare-download-destination.js";
|
|
112
|
+
import { useDialFileListing as Oi } from "./files/useDialFileListing/useDialFileListing.js";
|
|
113
|
+
import { useDialFileMetadata as ki } from "./files/useDialFileMetadata/useDialFileMetadata.js";
|
|
114
|
+
import { useDialFileMutations as Ai } from "./files/useDialFileMutations/useDialFileMutations.js";
|
|
115
|
+
import { useDialFileSharing as ji } from "./files/useDialFileSharing/useDialFileSharing.js";
|
|
116
|
+
import { useDialFileUploadBatch as Mi } from "./files/useDialFileUploadBatch/useDialFileUploadBatch.js";
|
|
117
|
+
import { useDialFileManager as Ni } from "./files/useDialFileManager/useDialFileManager.js";
|
|
118
|
+
import { useDialFileManagerTabConfig as Pi } from "./files/useDialFileManagerTabConfig/useDialFileManagerTabConfig.js";
|
|
119
|
+
import { isCustomAppSchema as Fi, isQuickAppSchema as Ii } from "./shared/application-schema.js";
|
|
120
|
+
import { getBrowserTimezone as Li } from "./shared/browser-timezone.js";
|
|
121
|
+
import { isValidAbsoluteUrl as Ri, isValidFeaturesData as zi, parseFeaturesData as Bi } from "./shared/custom-apps.js";
|
|
122
|
+
import { buildExternalServiceScopeId as Vi, getExternalServiceFallbackName as Hi, parseExternalServiceUrl as Ui } from "./shared/external-services.js";
|
|
123
|
+
import { useChatSettingsFormConfig as Wi } from "./useChatSettingsFormConfig/useChatSettingsFormConfig.js";
|
|
124
|
+
import { usePageFileDrag as Gi } from "./usePageFileDrag/usePageFileDrag.js";
|
|
125
|
+
import { useViewportWidth as Ki } from "./useViewportWidth/useViewportWidth.js";
|
|
126
|
+
import { usePanelMaxWidth as qi } from "./usePanelMaxWidth/usePanelMaxWidth.js";
|
|
127
|
+
import { useShareLink as Ji } from "./useShareLink/useShareLink.js";
|
|
128
|
+
import { useToolsMenu as Yi } from "./useToolsMenu/useToolsMenu.js";
|
|
129
|
+
import { useUsageData as Xi } from "./usage/useUsageData/useUsageData.js";
|
|
130
|
+
import { McpAppResourceFetchError as Zi, createMcpAppsApiClient as Qi } from "./mcp-apps/mcp-apps-api-client.js";
|
|
131
|
+
import { useMcpAppTools as $i } from "./mcp-apps/useMcpAppTools/useMcpAppTools.js";
|
|
132
|
+
import { useMcpAppHostContext as ea } from "./mcp-apps/useMcpAppHostContext/useMcpAppHostContext.js";
|
|
133
|
+
import { useMcpAppHostAdapter as ta } from "./mcp-apps/useMcpAppHostAdapter/useMcpAppHostAdapter.js";
|
|
134
|
+
import { useOpenMcpAppCanvas as na } from "./mcp-apps/useOpenMcpAppCanvas/useOpenMcpAppCanvas.js";
|
|
135
|
+
import { useGridEditingScroll as ra } from "@epam/ai-dial-chat-shared";
|
|
136
|
+
export { x as AttachmentValidationErrorReason, Gn as AudioTranscriptionError, Kn as AudioTranscriptionErrorReason, R as AuthenticationType, _r as COLUMNS_WITHOUT_AUTHOR, vr as COLUMNS_WITH_AUTHOR, yr as CORE_PERMISSION_MAP, Qe as CatalogPrimaryActionType, T as ConversationExportMode, E as ConversationTransferErrorCode, D as ConversationTransferWarningCode, br as DATE_OPTIONS, Lt as DEFAULT_GENERATION_CONFLICT_MESSAGE, Jn as DEFAULT_MAX_ARCHIVE_BYTES, wr as DialFileManagerActionProfile, Tr as DialFileManagerVariant, pr as DialFilesApiUploadMode, Ei as DownloadDestinationType, k as EXPORT_APP_NAME, O as ExportFileNameKind, kt as FavoriteEntityType, mr as FileManagerNotificationReason, hr as FileNameValidationErrorReason, gr as FileOperationKind, Rt as GenerationConflictError, Zi as McpAppResourceFetchError, Le as McpResourceKind, at as OAuthResourceKind, xr as PATH_SEPARATOR_REGEXP, on as PROMPT_CONTENT_MAX_LENGTH, sn as PROMPT_COUNTER_ANNOUNCE_THRESHOLD, cn as PROMPT_DESCRIPTION_MAX_LENGTH, ln as PROMPT_NAME_MAX_LENGTH, we as PUBLIC_SKILL_BUCKET, un as PromptFieldError, ae as PromptSource, Sr as RESERVED_MARKER_NAME, Mn as RecipientsCountStatus, ue as SKILL_FILE_UPLOAD_MAX_BYTES, Te as SKILL_LISTING_MAX_PAGES, Ee as SKILL_LISTING_PAGE_SIZE, de as SKILL_MANIFEST_FILE, De as SKILL_MANIFEST_MAX_BYTES, fe as SKILL_UPLOAD_MAX_FILES, pe as SKILL_UPLOAD_MAX_TOTAL_BYTES, Tn as SkillEditorLoadState, kn as SkillPreviewErrorKind, Oe as SkillSource, ot as TOOLSET_REDIRECT_STATE_KEY, st as ToolsetAuthStatus, ct as ToolsetAuthTypes, lt as ToolsetCredentialsLevel, Tt as ToolsetLoginOutcomeType, ut as ToolsetOAuthCallbackQuery, dt as ToolsetOAuthChannelControlType, ft as ToolsetOAuthFailureReason, pt as ToolsetOAuthInitiationResultType, mt as ToolsetOAuthResultType, Cr as UPLOAD_CONCURRENCY, _n as UnsupportedTriggerReason, ht as WithLogin, bi as annotationToDisplayAttachment, ri as annotationToOoxmlCanvasContent, ii as annotationToPdfCanvasContent, vn as apSchedulerDayToJsDay, W as appendLocaleCode, xi as attachmentDtoToDisplayAttachment, Si as attachmentDtosToDisplayAttachments, Xn as attachmentToDto, Zn as attachmentsToDtos, G as buildAdditionalLocaleOptions, Mt as buildAnnouncementSignature, Re as buildApplicationMcpUrl, N as buildChatCompletionsUrl, ze as buildConnectApi, P as buildDeploymentConnectApi, Vi as buildExternalServiceScopeId, Gr as buildFromCache, nn as buildPromptExportEnvelope, rn as buildPromptExportFileName, se as buildPromptOverview, dn as buildPromptPath, F as buildResponsesUrl, Dr as buildSharedItemVirtualPath, Ae as buildSkillContentTree, me as buildSkillFilesPayload, he as buildSkillManifest, ge as buildSkillManifestForSubmit, _e as buildSkillManifestFromFrontmatter, je as buildSkillOverview, bt as buildToolsetAuthorizeUrl, Be as buildToolsetMcpUrl, ai as clearAttachmentCache, K as composeLocalePayload, zt as createChatStreamApi, i as createCsrfMiddleware, Gt as createDeploymentChangedMessage, ei as createFilesApiClient, Qi as createMcpAppsApiClient, Qn as createMessagePair, j as createPublishApiClient, a as createUnauthorizedMiddleware, ti as createUploadFileWithProgress, V as decodeToolsetId, q as decomposeLocalizedFields, Er as deriveActionProfile, qe as deriveAvailableTabIds, Pn as deriveConversationRowActionState, Je as deriveFavoriteItems, Or as dialCorePathToRelative, Ci as dialFileToAttachment, wi as dialFilesToAttachments, Ti as dialFolderPathToAttachment, m as downloadAttachment, gt as emitToolsetLoginSuccess, I as encodeDeploymentId, H as encodeToolsetId, Kr as fetchByTab, qr as fetchForSearch, nt as fetchSkillDescription, Ye as filterCatalogItemsBySelector, Xe as filterHiddenOwnedItems, L as findDeploymentByIdOrReference, kr as findDialFileByPath, Jr as findFirstSuccessfulCopyMoveItem, Ar as findFolderByVirtualPath, Vt as formatAppVersion, X as formatCalendarDate, C as formatDateYM, w as formatDateYMD, jr as formatOperationFolderName, A as formatQuotedNameList, e as getApiErrorDetails, t as getApiErrorMessage, n as getApiErrorStatus, Li as getBrowserTimezone, or as getConversationPath, Rn as getConversationSource, Hi as getExternalServiceFallbackName, Kt as getLastDeploymentId, qt as getLastUserMessageToolConfiguration, Ut as getModelIdFromConversationId, Br as getParentFolderPath, He as getPublicCatalogEntityFolderPath, Qt as getQuickAppConversationStarters, fn as getRemainingCharacters, rr as getStarterConversationText, ir as getStarterDisplayText, $t as getStarterPopulateText, ar as getStarterSubmitText, en as getStartersFromSchema, Wt as getTimeOfDayGreeting, vt as getToolsetOAuthChannelName, xt as getToolsetRedirectUri, _i as getUrlFileName, Mr as getVirtualPathName, $n as hasActiveToolConfig, Nt as hasAnnouncementContent, oi as hasAttachmentTextSource, Nr as hasDialFileWritePermission, Pr as hasForbiddenNameSymbols, Pt as hasStructuredAnnouncement, o as includesIgnoreCase, St as initiateOAuthLogin, er as isAnswerIncomplete, ur as isAwaitingGenerationResume, r as isConversationNotFoundError, Fr as isCopyMoveDuplicateAllowed, Fi as isCustomAppSchema, _ as isDialFileAcceptType, d as isDialFileId, h as isDownloadableAttachment, vi as isExternalSourcePreviewable, tr as isMessageChanged, Jt as isMessageStreaming, ce as isOrganisationPromptItem, Ue as isPublicCatalogEntityId, U as isPublicToolsetId, Ii as isQuickAppSchema, Ir as isShareActionsAllowed, Ri as isValidAbsoluteUrl, zi as isValidFeaturesData, ve as isValidSkillRelativePath, yn as jsDayToApSchedulerDay, Yr as mapCorePermissions, Q as mapDeploymentDetailsDtoToEntityDetails, z as mapDeploymentLimitsDtoToCatalogLimits, B as mapDeploymentLimitsToInput, te as mapDeploymentToCatalogItem, ne as mapDeploymentToolsetCredentials, $ as mapEntityDetailsToCatalogDetails, Xr as mapFileMetadataToDialFile, bn as mapFormValuesToCreateBody, xn as mapFormValuesToUpdateBody, le as mapPromptToCatalogItem, We as mapPublishConversationResultDto, Ge as mapPublishHistoryEntryDto, Sn as mapScheduledTaskDtoToFormValues, Zr as mapSearchItem, Me as mapSkillToCatalogItem, ee as mapToolsetCredentials, re as mapToolsetToCatalogItem, Qr as mergeCreatedFolderIntoCache, Yt as messageHasStages, v as mimeTypesToAttachmentExtensionLabels, y as mimeTypesToDialFileAcceptTypes, b as mimeTypesToFileAccept, ye as nameFromPath, Ct as navigateToolsetOAuthPopup, Xt as normalizeResponseFormat, be as normalizeSkillName, Lr as normalizeVirtualPath, ni as openAnnotationAttachment, wt as openToolsetOAuthPopup, Z as padTwoDigits, Ui as parseExternalServiceUrl, Bi as parseFeaturesData, Rr as parseNewFolderVirtualPath, oe as parsePromptResourceUrl, xe as parseSkillManifest, tt as parseSkillManifestDocument, ke as parseSkillResourceUrl, Ur as prepareCopyItems, Di as prepareDownloadDestination, Wr as prepareMoveRenameItems, Ne as readSkillFileBytes, Pe as readSkillManifest, Ze as reconcileFilterTopics, si as referenceAttachmentToPdfCanvasContent, $e as resolveCatalogPrimaryAction, ci as resolveCodeCanvasContent, ie as resolveDeploymentFolder, Vr as resolveDialFileApiPath, f as resolveDialFileBucketAndPath, yi as resolveExternalSourceContentType, li as resolveHtmlCanvasContent, ui as resolveImageCanvasContent, di as resolveJsonCanvasContent, J as resolveLocalizedText, fi as resolveMarkdownCanvasContent, Ve as resolveMcpResourceKind, pi as resolveOoxmlCanvasContent, zr as resolveOwnerCoords, mi as resolvePdfCanvasContent, p as resolveRelativeDialFilePath, Fe as resolveSkillFileDownloadPath, Ie as resolveSkillManifestFileId, hi as resolveTextCanvasContent, gi as resolveVisualizerCanvasContent, s as safeDecodeURI, c as safeDecodeURIComponent, Ft as sanitizeAnnouncementHtml, It as sanitizeAnnouncementMessageHtml, Vn as sanitizeFileName, Ht as sanitizeFooterHtml, an as serializePromptExport, nr as shouldRerunGenerationOnEdit, Bt as shouldWatchForDisplayNameUpdate, Se as skillFileBytesToBlob, wn as skillFileToAttachment, Hn as splitFileNameExtension, l as stripSurroundingSlashes, u as stripTrailingSlashes, _t as subscribeToolsetLoginSuccess, Y as toBaseLocale, Zt as toOverlayMessages, Ke as toPublishEntityType, M as toPublishRuleDto, Un as trimFileNameToByteLimit, Ce as unpackSkillArchive, $r as updateEntry, Fn as useActiveConversationSync, In as useAsyncConfirmDialog, g as useAttachmentAction, Wn as useAttachmentUpload, S as useAttachmentValidation, et as useCatalogEditNavigation, it as useCatalogItemDetails, Dt as useCatalogToolsetCredentials, Wi as useChatSettingsFormConfig, Yn as useConversationExport, sr as useConversationHandlers, cr as useConversationImport, Ln as useConversationLookupMaps, zn as useConversationPanelItems, lr as useConversationScroll, fr as useConversationSources, dr as useConversationStream, Oi as useDialFileListing, Ni as useDialFileManager, Pi as useDialFileManagerTabConfig, ki as useDialFileMetadata, Ai as useDialFileMutations, ji as useDialFileSharing, Mi as useDialFileUploadBatch, At as useFavoriteEntitiesState, ra as useGridEditingScroll, Bn as useImportFilePicker, ta as useMcpAppHostAdapter, ea as useMcpAppHostContext, $i as useMcpAppTools, tn as useOAuthCallbackCompletion, na as useOpenMcpAppCanvas, Gi as usePageFileDrag, qi as usePanelMaxWidth, gn as usePromptsState, jt as usePublishFolders, Ji as useShareLink, Nn as useShareRecipientsCount, Ot as useSkillDetailsPanelData, En as useSkillEditorLoad, Dn as useSkillEditorSubmit, On as useSkillFileActions, An as useSkillFilePreview, rt as useSkillItemDetails, jn as useSkillsState, Yi as useToolsMenu, Et as useToolsetLogin, qn as useTranscribeAudio, Xi as useUsageData, Ki as useViewportWidth, pn as validatePromptContent, mn as validatePromptDescription, hn as validatePromptName, Cn as validateSkillFileBatch, Hr as virtualPathToApiPath, yt as waitForToolsetOAuthResult };
|
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.1.0-dev.
|
|
4
|
+
"version": "1.1.0-dev.456",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "./index.js",
|
|
@@ -104,21 +104,21 @@
|
|
|
104
104
|
},
|
|
105
105
|
"peerDependencies": {
|
|
106
106
|
"react": "^19.2.6",
|
|
107
|
-
"@epam/ai-dial-attachment-canvas": "1.1.0-dev.
|
|
108
|
-
"@epam/ai-dial-attachment-input": "1.1.0-dev.
|
|
109
|
-
"@epam/ai-dial-catalog": "1.1.0-dev.
|
|
110
|
-
"@epam/ai-dial-chat-api-client": "1.1.0-dev.
|
|
111
|
-
"@epam/ai-dial-chat-overlay": "1.1.0-dev.
|
|
112
|
-
"@epam/ai-dial-chat-shared": "1.1.0-dev.
|
|
113
|
-
"@epam/ai-dial-deployment-creation-form": "1.1.0-dev.
|
|
114
|
-
"@epam/ai-dial-mcp-apps": "1.1.0-dev.
|
|
115
|
-
"@epam/ai-dial-publish-panel": "1.1.0-dev.
|
|
116
|
-
"@epam/ai-dial-quotations": "1.1.0-dev.
|
|
107
|
+
"@epam/ai-dial-attachment-canvas": "1.1.0-dev.456",
|
|
108
|
+
"@epam/ai-dial-attachment-input": "1.1.0-dev.456",
|
|
109
|
+
"@epam/ai-dial-catalog": "1.1.0-dev.456",
|
|
110
|
+
"@epam/ai-dial-chat-api-client": "1.1.0-dev.456",
|
|
111
|
+
"@epam/ai-dial-chat-overlay": "1.1.0-dev.456",
|
|
112
|
+
"@epam/ai-dial-chat-shared": "1.1.0-dev.456",
|
|
113
|
+
"@epam/ai-dial-deployment-creation-form": "1.1.0-dev.456",
|
|
114
|
+
"@epam/ai-dial-mcp-apps": "1.1.0-dev.456",
|
|
115
|
+
"@epam/ai-dial-publish-panel": "1.1.0-dev.456",
|
|
116
|
+
"@epam/ai-dial-quotations": "1.1.0-dev.456",
|
|
117
117
|
"@epam/ai-dial-react-file-manager": "*",
|
|
118
|
-
"@epam/ai-dial-scheduled-tasks": "1.1.0-dev.
|
|
119
|
-
"@epam/ai-dial-share": "1.1.0-dev.
|
|
120
|
-
"@epam/ai-dial-skill-editor": "1.1.0-dev.
|
|
121
|
-
"@epam/ai-dial-source-panel": "1.1.0-dev.
|
|
118
|
+
"@epam/ai-dial-scheduled-tasks": "1.1.0-dev.456",
|
|
119
|
+
"@epam/ai-dial-share": "1.1.0-dev.456",
|
|
120
|
+
"@epam/ai-dial-skill-editor": "1.1.0-dev.456",
|
|
121
|
+
"@epam/ai-dial-source-panel": "1.1.0-dev.456",
|
|
122
122
|
"@epam/ai-dial-ui-kit": "*",
|
|
123
123
|
"@modelcontextprotocol/sdk": "^1.27.1",
|
|
124
124
|
"@epam/pdf-highlighter-kit": ">=0.0.14",
|
package/shared/string-utils.js
CHANGED
|
@@ -5,6 +5,15 @@ var e = (e, t) => e.toLowerCase().includes(t.toLowerCase()), t = (e) => {
|
|
|
5
5
|
} catch {
|
|
6
6
|
return e;
|
|
7
7
|
}
|
|
8
|
-
}, n = t, r = (e) =>
|
|
8
|
+
}, n = t, r = (e) => {
|
|
9
|
+
let t = e.length;
|
|
10
|
+
for (; t > 0 && e[t - 1] === "/";) --t;
|
|
11
|
+
return e.slice(0, t);
|
|
12
|
+
}, i = (e) => {
|
|
13
|
+
let t = 0, n = e.length;
|
|
14
|
+
for (; t < n && e[t] === "/";) t += 1;
|
|
15
|
+
for (; n > t && e[n - 1] === "/";) --n;
|
|
16
|
+
return e.slice(t, n);
|
|
17
|
+
};
|
|
9
18
|
//#endregion
|
|
10
|
-
export { e as includesIgnoreCase, t as safeDecodeURI, n as safeDecodeURIComponent,
|
|
19
|
+
export { e as includesIgnoreCase, t as safeDecodeURI, n as safeDecodeURIComponent, i as stripSurroundingSlashes, r as stripTrailingSlashes };
|
package/skill/skill.js
CHANGED
|
@@ -6,7 +6,7 @@ var i = "SKILL.md", a = 1048576, o = 16777216, s = 100, c = new Set([".dial-reso
|
|
|
6
6
|
if (e === "" || e.startsWith("/") || u.test(e) || e.includes("\\") || d.test(e)) return !1;
|
|
7
7
|
let t = e.split("/");
|
|
8
8
|
return !(t.some((e) => e === "" || e === "." || e === "..") || t.some((e) => c.has(e)) || l.has(t[0]));
|
|
9
|
-
}, p = (e) => e.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(
|
|
9
|
+
}, p = (e) => e.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-/, "").replace(/-$/, ""), m = ({ name: e, description: t, instructions: n }) => `---\n${r({
|
|
10
10
|
name: e,
|
|
11
11
|
description: t
|
|
12
12
|
}).trimEnd()}\n---\n\n${n}`, h = (e, t, n, i) => `---\n${r({
|
|
@@ -1,93 +1,93 @@
|
|
|
1
1
|
import { getApiErrorStatus as e } from "../api-error/api-error.js";
|
|
2
|
-
import { stripSurroundingSlashes as t } from "../shared/string-utils.js";
|
|
3
|
-
import { SKILL_MANIFEST_FILE as
|
|
4
|
-
import { useEffect as
|
|
5
|
-
import { SkillFileNodeKind as
|
|
2
|
+
import { stripSurroundingSlashes as t, stripTrailingSlashes as n } from "../shared/string-utils.js";
|
|
3
|
+
import { SKILL_MANIFEST_FILE as r, nameFromPath as i, parseSkillManifest as a, unpackSkillArchive as o } from "./skill.js";
|
|
4
|
+
import { useEffect as s, useRef as c, useState as l } from "react";
|
|
5
|
+
import { SkillFileNodeKind as u } from "@epam/ai-dial-skill-editor";
|
|
6
6
|
//#region src/skill/useSkillEditorLoad.ts
|
|
7
|
-
var
|
|
7
|
+
var d = /* @__PURE__ */ function(e) {
|
|
8
8
|
return e.Loading = "loading", e.Loaded = "loaded", e.Error = "error", e.Forbidden = "forbidden", e.NotFound = "not-found", e;
|
|
9
|
-
}({}),
|
|
10
|
-
let
|
|
11
|
-
return
|
|
12
|
-
},
|
|
9
|
+
}({}), f = class extends Error {}, p = (e, r) => {
|
|
10
|
+
let i = e.parentPath ? t(e.parentPath) : "", a = `${n(r)}/files`;
|
|
11
|
+
return i === a ? e.name : i.startsWith(`${a}/`) ? `${i.slice(a.length + 1)}/${e.name}` : i === "files" ? e.name : i.startsWith("files/") ? `${i.slice(6)}/${e.name}` : null;
|
|
12
|
+
}, m = async (e, t, n) => {
|
|
13
13
|
let r = await e.downloadSkill(t, n), i = r.headers.get("etag");
|
|
14
|
-
if (!i) throw new
|
|
14
|
+
if (!i) throw new f("Skill ETag is missing");
|
|
15
15
|
try {
|
|
16
|
-
let e = await r.arrayBuffer(), { manifestText: t, files: n } =
|
|
16
|
+
let e = await r.arrayBuffer(), { manifestText: t, files: n } = o(new Uint8Array(e));
|
|
17
17
|
return {
|
|
18
18
|
etag: i,
|
|
19
19
|
manifestText: t,
|
|
20
20
|
files: n
|
|
21
21
|
};
|
|
22
22
|
} catch {
|
|
23
|
-
throw new
|
|
23
|
+
throw new f("Skill ZIP is invalid");
|
|
24
24
|
}
|
|
25
|
-
},
|
|
26
|
-
let [i, a] = await Promise.all([e.downloadSkillFile(t,
|
|
25
|
+
}, h = async (e, t, n) => {
|
|
26
|
+
let [i, a] = await Promise.all([e.downloadSkillFile(t, n, r), e.listSkillFiles({
|
|
27
27
|
bucket: t,
|
|
28
|
-
path:
|
|
28
|
+
path: n,
|
|
29
29
|
filePath: "",
|
|
30
30
|
recursive: !0
|
|
31
|
-
})]), o = a.items.find((e) => e.nodeType === "item" &&
|
|
31
|
+
})]), o = a.items.find((e) => e.nodeType === "item" && p(e, n) === "SKILL.md"), s = i.headers.get("etag") ?? o?.etag;
|
|
32
32
|
if (!s) throw Error("Skill ETag is missing");
|
|
33
33
|
let c = a.items.filter((e) => e.nodeType === "item").map((e) => ({
|
|
34
34
|
item: e,
|
|
35
|
-
path:
|
|
36
|
-
})).filter((e) => e.path != null && e.path !== "SKILL.md"), l = await Promise.all(c.map(async ({ path:
|
|
37
|
-
let i = await e.downloadSkillFile(t,
|
|
38
|
-
return [
|
|
35
|
+
path: p(e, n)
|
|
36
|
+
})).filter((e) => e.path != null && e.path !== "SKILL.md"), l = await Promise.all(c.map(async ({ path: r }) => {
|
|
37
|
+
let i = await e.downloadSkillFile(t, n, r);
|
|
38
|
+
return [r, new Uint8Array(await i.arrayBuffer())];
|
|
39
39
|
}));
|
|
40
40
|
return {
|
|
41
41
|
etag: s,
|
|
42
42
|
manifestText: await i.text(),
|
|
43
43
|
files: new Map(l)
|
|
44
44
|
};
|
|
45
|
-
},
|
|
46
|
-
let [
|
|
47
|
-
return
|
|
45
|
+
}, g = ({ isEditMode: t, bucket: n, skillPath: r, client: o }) => {
|
|
46
|
+
let [d, p] = l(t ? "loading" : "loaded"), [g, _] = l(0), [v, y] = l(), b = c(void 0), x = c({}), S = c(void 0), [C, w] = l([]), T = c(/* @__PURE__ */ new Map());
|
|
47
|
+
return s(() => {
|
|
48
48
|
if (!t || !n) return;
|
|
49
|
-
if (
|
|
50
|
-
|
|
49
|
+
if (r == null) {
|
|
50
|
+
p("error");
|
|
51
51
|
return;
|
|
52
52
|
}
|
|
53
|
-
let
|
|
54
|
-
return
|
|
55
|
-
if (await Promise.resolve(), !
|
|
53
|
+
let s = !1;
|
|
54
|
+
return p("loading"), (async () => {
|
|
55
|
+
if (await Promise.resolve(), !s) try {
|
|
56
56
|
let t;
|
|
57
57
|
try {
|
|
58
|
-
t = await
|
|
59
|
-
} catch (
|
|
60
|
-
let
|
|
61
|
-
if (!(
|
|
62
|
-
t = await
|
|
58
|
+
t = await m(o, n, r);
|
|
59
|
+
} catch (i) {
|
|
60
|
+
let a = e(i);
|
|
61
|
+
if (!(i instanceof f) && a !== 400) throw i;
|
|
62
|
+
t = await h(o, n, r);
|
|
63
63
|
}
|
|
64
|
-
let { frontmatter:
|
|
65
|
-
if (
|
|
66
|
-
b.current = t.etag, x.current =
|
|
64
|
+
let { frontmatter: c, instructions: l } = a(t.manifestText);
|
|
65
|
+
if (s) return;
|
|
66
|
+
b.current = t.etag, x.current = c, S.current = r, T.current = new Map([...t.files].map(([e, t]) => [e, { bytes: t }])), w([...t.files.keys()].map((e) => ({
|
|
67
67
|
path: e,
|
|
68
|
-
name:
|
|
69
|
-
kind:
|
|
68
|
+
name: i(e),
|
|
69
|
+
kind: u.File
|
|
70
70
|
}))), y({
|
|
71
|
-
name: typeof
|
|
72
|
-
description: typeof
|
|
73
|
-
instructions:
|
|
74
|
-
}),
|
|
71
|
+
name: typeof c.name == "string" ? c.name : "",
|
|
72
|
+
description: typeof c.description == "string" ? c.description : "",
|
|
73
|
+
instructions: l
|
|
74
|
+
}), p("loaded");
|
|
75
75
|
} catch (t) {
|
|
76
|
-
if (
|
|
76
|
+
if (s) return;
|
|
77
77
|
let n = e(t);
|
|
78
|
-
|
|
78
|
+
p(n === 403 ? "forbidden" : n === 404 ? "not-found" : "error");
|
|
79
79
|
}
|
|
80
80
|
})(), () => {
|
|
81
|
-
|
|
81
|
+
s = !0;
|
|
82
82
|
};
|
|
83
83
|
}, [
|
|
84
84
|
t,
|
|
85
85
|
n,
|
|
86
|
-
|
|
86
|
+
r,
|
|
87
87
|
g,
|
|
88
|
-
|
|
88
|
+
o
|
|
89
89
|
]), {
|
|
90
|
-
loadState:
|
|
90
|
+
loadState: d,
|
|
91
91
|
loadedValues: v,
|
|
92
92
|
setLoadedValues: y,
|
|
93
93
|
files: C,
|
|
@@ -100,4 +100,4 @@ var u = /* @__PURE__ */ function(e) {
|
|
|
100
100
|
};
|
|
101
101
|
};
|
|
102
102
|
//#endregion
|
|
103
|
-
export {
|
|
103
|
+
export { d as SkillEditorLoadState, g as useSkillEditorLoad };
|
package/utils.d.ts
CHANGED
|
@@ -297,6 +297,9 @@ export declare const serializePromptExport: (envelope: PromptExportFormat) => Bl
|
|
|
297
297
|
/** Strips leading and trailing slashes from a path segment. */
|
|
298
298
|
export declare const stripSurroundingSlashes: (path: string) => string;
|
|
299
299
|
|
|
300
|
+
/** Strips trailing slashes from a path segment. */
|
|
301
|
+
export declare const stripTrailingSlashes: (path: string) => string;
|
|
302
|
+
|
|
300
303
|
/** Lowercased base language of a BCP-47 tag, e.g. `'en-US'` -> `'en'`. */
|
|
301
304
|
export declare const toBaseLocale: (locale: string) => string;
|
|
302
305
|
|
package/utils.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { getApiErrorDetails as e, getApiErrorMessage as t, getApiErrorStatus as n, isConversationNotFoundError as r } from "./api-error/api-error.js";
|
|
2
2
|
import { createCsrfMiddleware as i } from "./api-transport/create-csrf-middleware.js";
|
|
3
3
|
import { createUnauthorizedMiddleware as a } from "./api-transport/create-unauthorized-middleware.js";
|
|
4
|
-
import { includesIgnoreCase as o, safeDecodeURI as s, safeDecodeURIComponent as c, stripSurroundingSlashes as l } from "./shared/string-utils.js";
|
|
5
|
-
import { appendLocaleCode as
|
|
6
|
-
import { formatCalendarDate as
|
|
7
|
-
import { PromptSource as
|
|
8
|
-
import { buildPromptExportEnvelope as
|
|
9
|
-
import { PROMPT_CONTENT_MAX_LENGTH as
|
|
10
|
-
import { usePromptsState as
|
|
11
|
-
import { apSchedulerDayToJsDay as
|
|
12
|
-
import { isCustomAppSchema as
|
|
13
|
-
import { getBrowserTimezone as
|
|
14
|
-
import { isValidAbsoluteUrl as
|
|
15
|
-
import { buildExternalServiceScopeId as
|
|
16
|
-
import { useUsageData as
|
|
17
|
-
export {
|
|
4
|
+
import { includesIgnoreCase as o, safeDecodeURI as s, safeDecodeURIComponent as c, stripSurroundingSlashes as l, stripTrailingSlashes as u } from "./shared/string-utils.js";
|
|
5
|
+
import { appendLocaleCode as d, buildAdditionalLocaleOptions as f, composeLocalePayload as p, decomposeLocalizedFields as m, resolveLocalizedText as h, toBaseLocale as g } from "./shared/locale.js";
|
|
6
|
+
import { formatCalendarDate as _, padTwoDigits as v } from "./shared/formatting.js";
|
|
7
|
+
import { PromptSource as y, parsePromptResourceUrl as b } from "./prompt/prompt-resource.js";
|
|
8
|
+
import { buildPromptExportEnvelope as x, buildPromptExportFileName as S, serializePromptExport as C } from "./prompt/export-prompt.js";
|
|
9
|
+
import { PROMPT_CONTENT_MAX_LENGTH as w, PROMPT_COUNTER_ANNOUNCE_THRESHOLD as T, PROMPT_DESCRIPTION_MAX_LENGTH as E, PROMPT_NAME_MAX_LENGTH as D, PromptFieldError as O, buildPromptPath as k, getRemainingCharacters as A, validatePromptContent as j, validatePromptDescription as M, validatePromptName as N } from "./prompt/prompt.js";
|
|
10
|
+
import { usePromptsState as P } from "./prompt/usePromptsState/usePromptsState.js";
|
|
11
|
+
import { apSchedulerDayToJsDay as F, jsDayToApSchedulerDay as I } from "./shared/cron-weekday.js";
|
|
12
|
+
import { isCustomAppSchema as L, isQuickAppSchema as R } from "./shared/application-schema.js";
|
|
13
|
+
import { getBrowserTimezone as z } from "./shared/browser-timezone.js";
|
|
14
|
+
import { isValidAbsoluteUrl as B, isValidFeaturesData as V, parseFeaturesData as H } from "./shared/custom-apps.js";
|
|
15
|
+
import { buildExternalServiceScopeId as U, getExternalServiceFallbackName as W, parseExternalServiceUrl as G } from "./shared/external-services.js";
|
|
16
|
+
import { useUsageData as K } from "./usage/useUsageData/useUsageData.js";
|
|
17
|
+
export { w as PROMPT_CONTENT_MAX_LENGTH, T as PROMPT_COUNTER_ANNOUNCE_THRESHOLD, E as PROMPT_DESCRIPTION_MAX_LENGTH, D as PROMPT_NAME_MAX_LENGTH, O as PromptFieldError, y as PromptSource, F as apSchedulerDayToJsDay, d as appendLocaleCode, f as buildAdditionalLocaleOptions, U as buildExternalServiceScopeId, x as buildPromptExportEnvelope, S as buildPromptExportFileName, k as buildPromptPath, p as composeLocalePayload, i as createCsrfMiddleware, a as createUnauthorizedMiddleware, m as decomposeLocalizedFields, _ as formatCalendarDate, e as getApiErrorDetails, t as getApiErrorMessage, n as getApiErrorStatus, z as getBrowserTimezone, W as getExternalServiceFallbackName, A as getRemainingCharacters, o as includesIgnoreCase, r as isConversationNotFoundError, L as isCustomAppSchema, R as isQuickAppSchema, B as isValidAbsoluteUrl, V as isValidFeaturesData, I as jsDayToApSchedulerDay, v as padTwoDigits, G as parseExternalServiceUrl, H as parseFeaturesData, b as parsePromptResourceUrl, h as resolveLocalizedText, s as safeDecodeURI, c as safeDecodeURIComponent, C as serializePromptExport, l as stripSurroundingSlashes, u as stripTrailingSlashes, g as toBaseLocale, P as usePromptsState, K as useUsageData, j as validatePromptContent, M as validatePromptDescription, N as validatePromptName };
|