@epam/ai-dial-chat-hooks 1.2.0-dev.20 → 1.2.0-dev.201
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api-error/api-error.js +5 -4
- package/attachment/useAttachmentValidation/useAttachmentValidation.js +26 -19
- package/attachments.d.ts +10 -4
- package/catalog/catalog-derivations.js +1 -1
- package/catalog/deployment-id.js +8 -2
- package/catalog/map-deployment-limits-to-input.js +81 -9
- package/catalog/map-deployment-to-catalog-item.js +34 -34
- package/catalog/map-entity-details-to-catalog.js +7 -0
- package/catalog/map-skill-to-catalog-item.js +30 -27
- package/catalog/publish.js +6 -5
- package/catalog/useApplicationCredentials/useApplicationCredentials.js +39 -0
- package/catalog/useSkillDetailsPanelData/useSkillDetailsPanelData.js +39 -39
- package/catalog/useSkillItemDetails.js +17 -13
- package/catalog.d.ts +116 -20
- package/catalog.js +23 -22
- package/conversation/conversation-transfer/export-conversation.js +24 -16
- package/conversation/conversation-transfer/import-conversation.js +80 -31
- package/conversation/conversation-transfer/queue.js +8 -5
- package/conversation/create-chat-stream-api.js +85 -49
- package/conversation/message-utils.js +44 -2
- package/conversation/stage.js +23 -0
- package/conversation/useConversationExport/useConversationExport.js +9 -9
- package/conversation/useConversationImport/useConversationImport.js +123 -121
- package/conversation/useConversationPanelItems/useConversationPanelItems.js +2 -3
- package/conversation/useConversationScroll/useConversationScroll.js +68 -64
- package/conversation/useConversationStream/apply-chunk.js +1 -1
- package/conversation/useConversationStream/generation-resume.js +104 -63
- package/conversation/useConversationStream/useConversationStream.js +183 -108
- package/conversation/useMessageSelectionReply/useMessageSelectionReply.js +189 -0
- package/conversation-overlay.d.ts +7 -0
- package/conversation-overlay.js +2 -0
- package/conversation-sources/useConversationSources/useConversationSources.js +31 -24
- package/conversation-sources.d.ts +1 -1
- package/conversation-transfer.d.ts +2 -1
- package/conversation.d.ts +241 -13
- package/conversation.js +32 -30
- package/file-manager-canvas.d.ts +398 -0
- package/file-manager-canvas.js +2 -0
- package/file-manager.d.ts +153 -350
- package/file-manager.js +25 -24
- package/files/attachment-canvas.js +40 -1
- package/files/attachment-types.js +14 -13
- package/files/dial-file-manager-mapping.util.js +2 -1
- package/files/dial-file-manager-path.util.js +23 -1
- package/files/dial-file-manager.model.js +23 -19
- package/files/dial-file-manager.types.js +3 -3
- package/files/useDialFileListing/useDialFileListing.js +157 -145
- package/files/useDialFileManager/useDialFileManager.js +132 -128
- package/files/useDialFileManagerSections/useDialFileManagerSections.js +155 -0
- package/files/useDialFileManagerTabConfig/useDialFileManagerTabConfig.js +20 -19
- package/files/useDialFileMutations/useDialFileMutations.js +33 -32
- package/files/useDialFileUploadBatch/useDialFileUploadBatch.js +117 -110
- package/files/useFileAttachmentPicker/useFileAttachmentPicker.js +43 -0
- package/index.d.ts +1066 -81
- package/index.js +136 -122
- package/mcp-apps/useMcpAppHostAdapter/useMcpAppHostAdapter.js +7 -5
- package/mcp-apps/useMcpAppHostContext/useMcpAppHostContext.js +1 -1
- package/mcp-apps/useMcpAppTools/useMcpAppTools.js +1 -1
- package/mcp-apps/useOpenMcpAppCanvas/useOpenMcpAppCanvas.js +25 -23
- package/mcp-apps.d.ts +8 -6
- package/oauth/toolset-id.js +5 -3
- package/oauth/useToolsetLogin/useToolsetLogin.js +8 -8
- package/oauth.d.ts +32 -0
- package/oauth.js +9 -9
- package/package.json +36 -21
- package/scheduled-task/scheduled-task-description.js +77 -0
- package/scheduled-task/scheduled-task-preparation.js +24 -0
- package/scheduled-task/scheduled-task-trigger.js +7 -2
- package/scheduled-task/scheduled-tasks-api-client.js +19 -0
- package/scheduled-task/use-scheduled-task-runs.js +194 -0
- package/scheduled-task/use-scheduled-tasks.js +93 -0
- package/scheduled-tasks.d.ts +195 -3
- package/scheduled-tasks.js +7 -2
- package/skill/skill-archive.js +19 -0
- package/skill/skill-types.js +8 -7
- package/skill/skill.js +42 -27
- package/skill/useSkillArchiveImport/useSkillArchiveImport.js +75 -0
- package/skill/useSkillEditorLoad.js +29 -28
- package/skill/useSkillEditorSubmit.js +108 -84
- package/skill/useSkillFileActions.js +70 -58
- package/skill-editor.d.ts +131 -3
- package/skill-editor.js +9 -8
- package/usage/map-usage-data-to-dashboard.js +66 -0
- package/usage/map-user-usage-to-model-limits.js +202 -0
- package/usage.d.ts +125 -0
- package/usage.js +3 -0
- package/usePageFileDrag/usePageFileDrag.js +3 -3
- package/utils.d.ts +8 -6
package/api-error/api-error.js
CHANGED
|
@@ -26,19 +26,20 @@ var e = (e) => typeof e == "object" && !!e, t = (t) => {
|
|
|
26
26
|
}
|
|
27
27
|
return e instanceof Error && e.message ? e.message : null;
|
|
28
28
|
}, d = async (t) => {
|
|
29
|
-
let r = s(t), i = r?.status, a = null, c, l = !1;
|
|
29
|
+
let r = s(t), i = r?.status, a = null, c, l = !1, u;
|
|
30
30
|
if (r) try {
|
|
31
31
|
let t = await (typeof r.clone == "function" ? r.clone() : r).json();
|
|
32
|
-
a = n(t), e(t) && (c = o(t.traceparent));
|
|
32
|
+
a = n(t), e(t) && (u = typeof t.code == "string" ? t.code : void 0, c = o(t.traceparent));
|
|
33
33
|
} catch {
|
|
34
34
|
l = !0;
|
|
35
35
|
}
|
|
36
36
|
!l && a === null && t instanceof Error && t.message && (a = t.message);
|
|
37
|
-
let
|
|
37
|
+
let d = c ?? o(typeof r?.headers?.get == "function" ? r.headers.get("traceparent") : void 0);
|
|
38
38
|
return {
|
|
39
39
|
status: i,
|
|
40
40
|
message: a,
|
|
41
|
-
traceId:
|
|
41
|
+
traceId: d,
|
|
42
|
+
...u ? { code: u } : {}
|
|
42
43
|
};
|
|
43
44
|
};
|
|
44
45
|
//#endregion
|
|
@@ -4,31 +4,38 @@ import { useCallback as n, useEffect as r, useMemo as i, useRef as a } from "rea
|
|
|
4
4
|
import { isMimeTypeAllowed as o, mimeTypesToExtensionLabels as s } from "@epam/ai-dial-attachment-input";
|
|
5
5
|
//#region src/attachment/useAttachmentValidation/useAttachmentValidation.ts
|
|
6
6
|
var c = 100, l = /* @__PURE__ */ function(e) {
|
|
7
|
-
return e.NoTypesAllowed = "noTypesAllowed", e.UnsupportedType = "unsupportedType", e;
|
|
8
|
-
}({}), u = ({ allowedMimeTypes: l,
|
|
9
|
-
let
|
|
10
|
-
(
|
|
11
|
-
let
|
|
7
|
+
return e.NoTypesAllowed = "noTypesAllowed", e.UnsupportedType = "unsupportedType", e.FileTooLarge = "fileTooLarge", e;
|
|
8
|
+
}({}), u = ({ allowedMimeTypes: l, maxFileSizeBytes: u, onValidationError: d, debounceMs: f = c }) => {
|
|
9
|
+
let p = a(l);
|
|
10
|
+
(p.current.length !== l.length || p.current.some((e, t) => e !== l[t])) && (p.current = l);
|
|
11
|
+
let m = p.current, h = m.length > 0, g = i(() => e(m), [m]), _ = a(null), v = a(null);
|
|
12
12
|
return r(() => () => {
|
|
13
|
-
|
|
13
|
+
_.current != null && clearTimeout(_.current), v.current != null && clearTimeout(v.current);
|
|
14
14
|
}, []), {
|
|
15
|
-
inputAttachmentTypes:
|
|
16
|
-
isAttachmentsAllowed:
|
|
15
|
+
inputAttachmentTypes: m,
|
|
16
|
+
isAttachmentsAllowed: h,
|
|
17
17
|
validateAttachment: n((e) => {
|
|
18
|
-
if (!o(e.contentType,
|
|
19
|
-
let e =
|
|
20
|
-
|
|
18
|
+
if (!o(e.contentType, m)) return _.current != null && clearTimeout(_.current), _.current = setTimeout(() => {
|
|
19
|
+
let e = m.length === 0;
|
|
20
|
+
d?.({
|
|
21
21
|
reason: e ? "noTypesAllowed" : "unsupportedType",
|
|
22
|
-
allowedMimeTypes:
|
|
23
|
-
...e ? {} : { formats: s(
|
|
24
|
-
}),
|
|
25
|
-
},
|
|
22
|
+
allowedMimeTypes: m,
|
|
23
|
+
...e ? {} : { formats: s(m) }
|
|
24
|
+
}), _.current = null;
|
|
25
|
+
}, f), t.UnsupportedType;
|
|
26
|
+
if (u != null && e.file.size > u) return v.current != null && clearTimeout(v.current), v.current = setTimeout(() => {
|
|
27
|
+
d?.({
|
|
28
|
+
reason: "fileTooLarge",
|
|
29
|
+
maxFileSizeBytes: u
|
|
30
|
+
}), v.current = null;
|
|
31
|
+
}, f), t.FileTooLarge;
|
|
26
32
|
}, [
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
33
|
+
m,
|
|
34
|
+
u,
|
|
35
|
+
f,
|
|
36
|
+
d
|
|
30
37
|
]),
|
|
31
|
-
fileAccept:
|
|
38
|
+
fileAccept: g
|
|
32
39
|
};
|
|
33
40
|
};
|
|
34
41
|
//#endregion
|
package/attachments.d.ts
CHANGED
|
@@ -6,10 +6,12 @@ import { DisplayAttachment } from '@epam/ai-dial-chat-shared';
|
|
|
6
6
|
export declare interface AttachmentValidationErrorEvent {
|
|
7
7
|
/** Why the attachment(s) were rejected. */
|
|
8
8
|
reason: AttachmentValidationErrorReason;
|
|
9
|
-
/** The resolved MIME types the caller currently allows (possibly empty). */
|
|
10
|
-
allowedMimeTypes
|
|
9
|
+
/** The resolved MIME types the caller currently allows (possibly empty). Present only when `reason` is `NoTypesAllowed` or `UnsupportedType`. */
|
|
10
|
+
allowedMimeTypes?: string[];
|
|
11
11
|
/** Already-formatted, non-translated extension list (e.g. ".png, .jpg"), present only when `reason` is `UnsupportedType`. */
|
|
12
12
|
formats?: string;
|
|
13
|
+
/** The size limit, in bytes, that was exceeded. Present only when `reason` is `FileTooLarge`. */
|
|
14
|
+
maxFileSizeBytes?: number;
|
|
13
15
|
}
|
|
14
16
|
|
|
15
17
|
/** Reason a rejected attachment failed validation. */
|
|
@@ -17,7 +19,9 @@ export declare enum AttachmentValidationErrorReason {
|
|
|
17
19
|
/** No MIME types are allowed at all — attachments are disabled entirely. */
|
|
18
20
|
NoTypesAllowed = "noTypesAllowed",
|
|
19
21
|
/** The attachment's content type is not among the allowed MIME types. */
|
|
20
|
-
UnsupportedType = "unsupportedType"
|
|
22
|
+
UnsupportedType = "unsupportedType",
|
|
23
|
+
/** The attachment's file size exceeds `maxFileSizeBytes`. */
|
|
24
|
+
FileTooLarge = "fileTooLarge"
|
|
21
25
|
}
|
|
22
26
|
|
|
23
27
|
/**
|
|
@@ -61,12 +65,14 @@ export declare interface UseAttachmentActionResult {
|
|
|
61
65
|
* MIME types, debouncing a burst of rejected files into a single
|
|
62
66
|
* `onValidationError` call rather than firing one per file.
|
|
63
67
|
*/
|
|
64
|
-
export declare const useAttachmentValidation: ({ allowedMimeTypes, onValidationError, debounceMs, }: UseAttachmentValidationParams) => UseAttachmentValidationResult;
|
|
68
|
+
export declare const useAttachmentValidation: ({ allowedMimeTypes, maxFileSizeBytes, onValidationError, debounceMs, }: UseAttachmentValidationParams) => UseAttachmentValidationResult;
|
|
65
69
|
|
|
66
70
|
/** Parameters for {@link useAttachmentValidation}. */
|
|
67
71
|
export declare interface UseAttachmentValidationParams {
|
|
68
72
|
/** Resolved MIME types currently allowed for attachments. */
|
|
69
73
|
allowedMimeTypes: string[];
|
|
74
|
+
/** Maximum attachment file size, in bytes. When omitted, no file is rejected for size. */
|
|
75
|
+
maxFileSizeBytes?: number;
|
|
70
76
|
/** Called with a structured event when a rejected attachment is reported, at most once per debounce window. */
|
|
71
77
|
onValidationError?: (event: AttachmentValidationErrorEvent) => void;
|
|
72
78
|
/** Debounce window, in ms, before firing `onValidationError` for a rejected file. Defaults to `100`. */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//#region src/catalog/catalog-derivations.ts
|
|
2
|
-
var e = (e, t) => e.filter((e) => t.has(e.type)), t = (e, t) => t ? e.filter((e) => !e.isMyApp) : [...e], n = (e) => e.filter((e) => e.isUserFavorite), r = (e, t) => {
|
|
2
|
+
var e = (e, t) => e.filter((e) => t.has(e.type)), t = (e, t) => t ? e.filter((e) => !e.isMyApp) : [...e], n = (e) => e.filter((e) => e.isUserFavorite && !e.isHidden), r = (e, t) => {
|
|
3
3
|
let n = new Set(e.map((e) => e.type));
|
|
4
4
|
return t.filter((e) => n.has(e));
|
|
5
5
|
}, i = (e, t) => {
|
package/catalog/deployment-id.js
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
//#region src/catalog/deployment-id.ts
|
|
2
|
-
var e = (e) => e.split("/").map((e) => encodeURIComponent(e)).join("/"), t = (e
|
|
2
|
+
var e = (e) => e.split("/").map((e) => encodeURIComponent(e)).join("/"), t = (e) => e.split("/").map((e) => {
|
|
3
|
+
try {
|
|
4
|
+
return decodeURIComponent(e);
|
|
5
|
+
} catch {
|
|
6
|
+
return e;
|
|
7
|
+
}
|
|
8
|
+
}).join("/"), n = (n) => e(t(n)), r = (e, t) => {
|
|
3
9
|
if (t) return e.find((e) => e.id === t) ?? e.find((e) => e.reference === t);
|
|
4
10
|
};
|
|
5
11
|
//#endregion
|
|
6
|
-
export { e as encodeDeploymentId,
|
|
12
|
+
export { t as decodeDeploymentId, e as encodeDeploymentId, r as findDeploymentByIdOrReference, n as normalizeDeploymentId };
|
|
@@ -1,14 +1,86 @@
|
|
|
1
|
+
import { formatCost as e } from "@epam/ai-dial-chat-shared";
|
|
2
|
+
import { CatalogLimitStatus as t } from "@epam/ai-dial-catalog";
|
|
1
3
|
//#region src/catalog/map-deployment-limits-to-input.ts
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
var n = [
|
|
5
|
+
{
|
|
6
|
+
key: "dayTokenStats",
|
|
7
|
+
labelField: "periodDay"
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
key: "weekTokenStats",
|
|
11
|
+
labelField: "periodWeek"
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
key: "monthTokenStats",
|
|
15
|
+
labelField: "periodMonth"
|
|
16
|
+
}
|
|
17
|
+
], r = [
|
|
18
|
+
{
|
|
19
|
+
key: "dayCostStats",
|
|
20
|
+
labelField: "periodDay"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
key: "weekCostStats",
|
|
24
|
+
labelField: "periodWeek"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
key: "monthCostStats",
|
|
28
|
+
labelField: "periodMonth"
|
|
29
|
+
}
|
|
30
|
+
], i = 2 ** 53 - 1, a = .75, o = [1e6, 1e3], s = new Intl.NumberFormat(void 0, {
|
|
31
|
+
notation: "compact",
|
|
32
|
+
maximumFractionDigits: 1
|
|
33
|
+
}), c = new Intl.NumberFormat(void 0, { maximumFractionDigits: 2 }), l = (e) => {
|
|
34
|
+
let t = o.find((t) => Math.abs(e) >= t);
|
|
35
|
+
return t == null ? e : Math.trunc(e / t * 10) / 10 * t;
|
|
36
|
+
}, u = (e) => e != null && Number.isFinite(e.total) && Number.isFinite(e.used) && e.total > 0, d = (e) => e >= i, f = (e, t) => {
|
|
37
|
+
let n = t?.(e.resetsAt);
|
|
38
|
+
return n ? {
|
|
39
|
+
resetLabel: n.label,
|
|
40
|
+
resetIsoValue: n.isoValue,
|
|
41
|
+
resetAriaLabel: n.ariaLabel
|
|
42
|
+
} : {};
|
|
43
|
+
}, p = (e, t, n, r, i) => {
|
|
44
|
+
let a = Math.max(0, e.used), o = e.total, s = r.format(a), c = r.format(o);
|
|
6
45
|
return {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
46
|
+
label: t,
|
|
47
|
+
used: a,
|
|
48
|
+
total: o,
|
|
49
|
+
...f(e, i),
|
|
50
|
+
usedLabel: s,
|
|
51
|
+
totalLabel: c,
|
|
52
|
+
valueLabel: n.formatValueLabel(s, c),
|
|
53
|
+
ariaLabel: n.formatProgressAriaLabel({
|
|
54
|
+
label: t,
|
|
55
|
+
used: r.formatFull(a),
|
|
56
|
+
total: r.formatFull(o)
|
|
57
|
+
})
|
|
11
58
|
};
|
|
59
|
+
}, m = (e) => d(e.total) ? 0 : Math.max(e.used, 0) / e.total, h = (e) => m(e) >= a, g = (e) => e.reduce((e, n) => {
|
|
60
|
+
let r = m(n);
|
|
61
|
+
return r >= 1 ? t.LimitReached : r >= a && e !== t.LimitReached ? t.RunningLow : e;
|
|
62
|
+
}, void 0), _ = (e, t, n, r, i, a, o) => {
|
|
63
|
+
let s = t.flatMap((t) => {
|
|
64
|
+
let n = e[t.key];
|
|
65
|
+
return !u(n) || !h(n) ? [] : (o.push(n), [p(n, r[t.labelField], r, i, a)]);
|
|
66
|
+
});
|
|
67
|
+
return s.length > 0 ? {
|
|
68
|
+
label: n,
|
|
69
|
+
rows: s
|
|
70
|
+
} : void 0;
|
|
71
|
+
}, v = (t, i, a) => {
|
|
72
|
+
if (t == null) return;
|
|
73
|
+
let o = [], u = [_(t, n, i.tokenGroup, i, {
|
|
74
|
+
format: (e) => s.format(l(e)),
|
|
75
|
+
formatFull: (e) => c.format(e)
|
|
76
|
+
}, a, o), _(t, r, i.costGroup, i, {
|
|
77
|
+
format: e,
|
|
78
|
+
formatFull: e
|
|
79
|
+
}, a, o)].filter((e) => e != null);
|
|
80
|
+
return u.length > 0 ? {
|
|
81
|
+
groups: u,
|
|
82
|
+
status: g(o)
|
|
83
|
+
} : void 0;
|
|
12
84
|
};
|
|
13
85
|
//#endregion
|
|
14
|
-
export {
|
|
86
|
+
export { v as mapDeploymentLimitsToInput };
|
|
@@ -2,52 +2,52 @@ import { safeDecodeURIComponent as e } from "../shared/string-utils.js";
|
|
|
2
2
|
import { isPublicToolsetId as t } from "../oauth/toolset-id.js";
|
|
3
3
|
import { resolveLocalizedText as n } from "../shared/locale.js";
|
|
4
4
|
import { mapEntityDetailsToCatalogDetails as r } from "./map-entity-details-to-catalog.js";
|
|
5
|
-
import { CatalogEntityType as i,
|
|
6
|
-
import { CredentialStatus as
|
|
5
|
+
import { CatalogEntityType as i, PUBLIC_BUCKET as a, formatLastUsed as o } from "@epam/ai-dial-chat-shared";
|
|
6
|
+
import { CredentialStatus as s, ToolsetAuthenticationType as c } from "@epam/ai-dial-catalog";
|
|
7
7
|
//#region src/catalog/map-deployment-to-catalog-item.ts
|
|
8
|
-
var
|
|
9
|
-
NONE:
|
|
10
|
-
API_KEY:
|
|
11
|
-
OAUTH:
|
|
12
|
-
},
|
|
13
|
-
SIGNED_IN:
|
|
14
|
-
SIGNED_OUT:
|
|
15
|
-
FAILED:
|
|
16
|
-
},
|
|
8
|
+
var l = {
|
|
9
|
+
NONE: c.None,
|
|
10
|
+
API_KEY: c.ApiKey,
|
|
11
|
+
OAUTH: c.OAuth
|
|
12
|
+
}, u = {
|
|
13
|
+
SIGNED_IN: s.SignedIn,
|
|
14
|
+
SIGNED_OUT: s.SignedOut,
|
|
15
|
+
FAILED: s.Failed
|
|
16
|
+
}, d = (e, n, r) => {
|
|
17
17
|
if (n == null) return;
|
|
18
|
-
let i = t(e), a = n.userLevelAuthStatus ?
|
|
18
|
+
let i = t(e), a = n.userLevelAuthStatus ? u[n.userLevelAuthStatus] : void 0, o = n.globalAuthStatus ? u[n.globalAuthStatus] : void 0;
|
|
19
19
|
return {
|
|
20
|
-
authenticationType: !r && i && a !==
|
|
20
|
+
authenticationType: !r && i && a !== s.SignedIn && o === s.SignedIn ? c.None : l[n.authenticationType],
|
|
21
21
|
userStatus: a,
|
|
22
|
-
globalStatus:
|
|
22
|
+
globalStatus: o,
|
|
23
23
|
isPublic: i,
|
|
24
24
|
isManageableByAdmin: r && i,
|
|
25
25
|
apiKeyHeader: n.apiKeyHeader
|
|
26
26
|
};
|
|
27
|
-
},
|
|
27
|
+
}, f = {
|
|
28
28
|
model: i.Model,
|
|
29
29
|
toolset: i.Toolset,
|
|
30
30
|
application: i.Agent
|
|
31
|
-
},
|
|
31
|
+
}, p = "applications/", m = "toolsets/", h = (t, n) => (t.startsWith(n) ? t.slice(n.length) : t).split("/").filter(Boolean).map(e), g = (e, t) => {
|
|
32
32
|
if (e.isMy) return [t.personal];
|
|
33
|
-
let n = h(e.applicationFolder ?? "",
|
|
34
|
-
return e.sharedWithMe ? [t.shared, ...n.slice(1)] : n[0]?.toLowerCase() ===
|
|
33
|
+
let n = h(e.applicationFolder ?? "", p);
|
|
34
|
+
return e.sharedWithMe ? [t.shared, ...n.slice(1)] : n.length === 0 && e.type?.toLowerCase() === "application" ? [t.public] : n[0]?.toLowerCase() === a ? [t.public, ...n.slice(1)] : n;
|
|
35
35
|
}, _ = (e, t) => {
|
|
36
36
|
if (e.isMy && t != null) return [t.personal];
|
|
37
37
|
let n = e.toolset || e.id;
|
|
38
|
-
if (!n.startsWith(
|
|
39
|
-
let r = h(n,
|
|
40
|
-
return e.sharedWithMe && t != null ? [t.shared, ...r.slice(1)] : r[0]?.toLowerCase() ===
|
|
41
|
-
}, v = (e, { favoriteIds: t = /* @__PURE__ */ new Set(), entityDetails:
|
|
42
|
-
let m = n(e.displayName, u,
|
|
38
|
+
if (!n.startsWith(m)) return t == null ? [] : e.sharedWithMe ? [t.shared] : n.length > 0 && !n.includes("/") ? [t.public] : [];
|
|
39
|
+
let r = h(n, m).slice(0, -1);
|
|
40
|
+
return e.sharedWithMe && t != null ? [t.shared, ...r.slice(1)] : r[0]?.toLowerCase() === a && t != null ? [t.public, ...r.slice(1)] : r.slice(1);
|
|
41
|
+
}, v = (e, { favoriteIds: t = /* @__PURE__ */ new Set(), entityDetails: a, folderLabels: s, editableSchemaIds: c = [], isCustomAppsEditable: l = !1, activeLocale: u, primaryLocale: d, resolveIconUrl: p }) => {
|
|
42
|
+
let m = n(e.displayName, u, d) || e.id, h = (e.type ?? "").toLowerCase();
|
|
43
43
|
return {
|
|
44
44
|
id: e.id,
|
|
45
|
-
type:
|
|
45
|
+
type: f[h] ?? i.Model,
|
|
46
46
|
name: m,
|
|
47
|
-
description: n(e.description, u,
|
|
47
|
+
description: n(e.description, u, d),
|
|
48
48
|
iconUrl: p(e.iconUrl),
|
|
49
49
|
version: e.displayVersion ?? "",
|
|
50
|
-
lastUsed:
|
|
50
|
+
lastUsed: o(e.updatedAt),
|
|
51
51
|
updatedAt: e.updatedAt,
|
|
52
52
|
createdAt: e.createdAt,
|
|
53
53
|
isFeatured: e.isFeatured ?? !1,
|
|
@@ -59,20 +59,20 @@ var c = {
|
|
|
59
59
|
sharedWithMe: e.sharedWithMe ?? !1,
|
|
60
60
|
isEditable: (!!e.isMy || !!e.canEdit) && (c.length > 0 && c.includes(e.applicationTypeSchemaId ?? "") || l && !e.applicationTypeSchemaId && h === "application"),
|
|
61
61
|
folder: g(e, s),
|
|
62
|
-
details:
|
|
62
|
+
details: a == null ? void 0 : r(a),
|
|
63
63
|
supportsMcp: e.features?.mcp === !0,
|
|
64
64
|
supportsChat: e.interfaces == null || e.interfaces.includes("chat")
|
|
65
65
|
};
|
|
66
|
-
}, y = (e, { favoriteIds: t = /* @__PURE__ */ new Set(), isAdmin: r = !1, folderLabels:
|
|
67
|
-
let
|
|
66
|
+
}, y = (e, { favoriteIds: t = /* @__PURE__ */ new Set(), isAdmin: r = !1, folderLabels: a, activeLocale: s, primaryLocale: c, resolveIconUrl: l }) => {
|
|
67
|
+
let u = n(e.displayName, s, c) || e.toolset || e.reference || e.id, f = e.allowedTools ?? [];
|
|
68
68
|
return {
|
|
69
69
|
id: e.id,
|
|
70
70
|
type: i.Toolset,
|
|
71
|
-
name:
|
|
71
|
+
name: u,
|
|
72
72
|
description: n(e.description, s, c),
|
|
73
73
|
iconUrl: l(e.iconUrl),
|
|
74
74
|
version: e.displayVersion ?? "",
|
|
75
|
-
lastUsed:
|
|
75
|
+
lastUsed: o(e.updatedAt),
|
|
76
76
|
updatedAt: e.updatedAt,
|
|
77
77
|
createdAt: e.createdAt,
|
|
78
78
|
isFeatured: !1,
|
|
@@ -83,10 +83,10 @@ var c = {
|
|
|
83
83
|
isMyApp: e.isMy ?? !1,
|
|
84
84
|
sharedWithMe: e.sharedWithMe ?? !1,
|
|
85
85
|
isEditable: !!(e.isMy || e.canEdit),
|
|
86
|
-
folder: _(e,
|
|
87
|
-
credentials:
|
|
86
|
+
folder: _(e, a),
|
|
87
|
+
credentials: d(e.id, e.authSettings, r),
|
|
88
88
|
details: f.length > 0 ? { tools: { tools: f.map((e) => ({ name: e })) } } : void 0
|
|
89
89
|
};
|
|
90
90
|
};
|
|
91
91
|
//#endregion
|
|
92
|
-
export { v as mapDeploymentToCatalogItem,
|
|
92
|
+
export { v as mapDeploymentToCatalogItem, d as mapDeploymentToolsetCredentials, y as mapToolsetToCatalogItem, g as resolveDeploymentFolder };
|
|
@@ -23,6 +23,9 @@ var s = (e) => e >= 1e6 ? `${e / 1e6}M tokens` : e >= 1e3 ? `${e / 1e3}K tokens`
|
|
|
23
23
|
}), n.reasoningEfforts?.length && r.push({
|
|
24
24
|
label: "Reasoning efforts",
|
|
25
25
|
value: n.reasoningEfforts.join(" · ")
|
|
26
|
+
}), n.hasSkills != null && r.push({
|
|
27
|
+
label: "Skills",
|
|
28
|
+
value: n.hasSkills
|
|
26
29
|
}), r.length > 0 && t.push({
|
|
27
30
|
title: "Capabilities",
|
|
28
31
|
specs: r
|
|
@@ -147,6 +150,9 @@ var s = (e) => e >= 1e6 ? `${e / 1e6}M tokens` : e >= 1e3 ? `${e / 1e3}K tokens`
|
|
|
147
150
|
}), n.hasConfiguration != null && r.push({
|
|
148
151
|
label: "Configuration schema",
|
|
149
152
|
value: n.hasConfiguration
|
|
153
|
+
}), n.hasSkills != null && r.push({
|
|
154
|
+
label: "Skills",
|
|
155
|
+
value: n.hasSkills
|
|
150
156
|
}), r.length > 0 && t.push({
|
|
151
157
|
title: "Capabilities",
|
|
152
158
|
specs: r
|
|
@@ -252,6 +258,7 @@ var s = (e) => e >= 1e6 ? `${e / 1e6}M tokens` : e >= 1e3 ? `${e / 1e3}K tokens`
|
|
|
252
258
|
hasConfiguration: e.hasConfigurationSchema,
|
|
253
259
|
hasChatCompletion: e.chatCompletion,
|
|
254
260
|
hasResponsesApi: e.responsesApi,
|
|
261
|
+
hasSkills: e.skillsSupported,
|
|
255
262
|
reasoningEfforts: e.reasoningEfforts
|
|
256
263
|
};
|
|
257
264
|
}, T = (e) => {
|
|
@@ -10,8 +10,11 @@ var c = {
|
|
|
10
10
|
[r.Personal]: "personal",
|
|
11
11
|
[r.SharedWithMe]: "shared",
|
|
12
12
|
[r.Public]: "public"
|
|
13
|
-
}, l = (t, n
|
|
14
|
-
let
|
|
13
|
+
}, l = (t, n) => {
|
|
14
|
+
let r = (n ?? "").split("/").filter(Boolean), i = t.split("/").filter(Boolean).slice(2, -1);
|
|
15
|
+
return i.length === r.length ? i.map(e) : r;
|
|
16
|
+
}, u = (e, t, n) => [n[c[t]], ...l(e.url, e.parentPath)], d = (e, { folderLabels: t, source: n, favoriteIds: o }) => {
|
|
17
|
+
let s = o.has(e.url), c = n === r.Public, l = n === r.Personal;
|
|
15
18
|
return {
|
|
16
19
|
id: e.url,
|
|
17
20
|
type: i.Skill,
|
|
@@ -26,12 +29,12 @@ var c = {
|
|
|
26
29
|
topics: [],
|
|
27
30
|
isUserFavorite: s,
|
|
28
31
|
isStarred: s,
|
|
29
|
-
isMyApp:
|
|
32
|
+
isMyApp: l && (e.isMy ?? !0),
|
|
30
33
|
sharedWithMe: e.sharedWithMe ?? n === r.SharedWithMe,
|
|
31
|
-
isEditable: !c && (e.canEdit ??
|
|
32
|
-
folder:
|
|
34
|
+
isEditable: !c && (e.canEdit ?? l),
|
|
35
|
+
folder: u(e, n, t)
|
|
33
36
|
};
|
|
34
|
-
},
|
|
37
|
+
}, f = (e) => e.join(" · "), p = (e, t) => {
|
|
35
38
|
if (e == null) return null;
|
|
36
39
|
let n = [];
|
|
37
40
|
return e.whenToUse != null && n.push({
|
|
@@ -39,25 +42,25 @@ var c = {
|
|
|
39
42
|
value: e.whenToUse
|
|
40
43
|
}), e.allowedTools?.length && n.push({
|
|
41
44
|
label: t.allowedToolsLabel,
|
|
42
|
-
value:
|
|
45
|
+
value: f(e.allowedTools)
|
|
43
46
|
}), e.bundledResources?.length && n.push({
|
|
44
47
|
label: t.bundledResourcesLabel,
|
|
45
|
-
value:
|
|
48
|
+
value: f(e.bundledResources)
|
|
46
49
|
}), n.length === 0 ? null : {
|
|
47
50
|
title: t.specificationSectionTitle,
|
|
48
51
|
specs: n
|
|
49
52
|
};
|
|
50
|
-
},
|
|
53
|
+
}, m = (e) => e.filter((e) => e.nodeType === s.Item), h = (e, n) => {
|
|
51
54
|
let r = t(n), i = r ? `${r}/files` : "files";
|
|
52
|
-
return
|
|
55
|
+
return m(e).find((e) => {
|
|
53
56
|
let n = t(e.path);
|
|
54
57
|
return n === "SKILL.md" || n === "files/SKILL.md" || n === `${i}/SKILL.md`;
|
|
55
58
|
})?.path ?? "SKILL.md";
|
|
56
|
-
},
|
|
59
|
+
}, g = (e, n) => {
|
|
57
60
|
let r = t(e), i = t(n), a = i ? `${i}/files` : "files";
|
|
58
61
|
return r === "" || r === "files" || r === a ? null : r.startsWith(`${a}/`) ? r.slice(a.length + 1) : r.startsWith("files/") ? r.slice(6) : r;
|
|
59
|
-
},
|
|
60
|
-
let a = [], o =
|
|
62
|
+
}, _ = (e, t) => g(e, t), v = (e, t, r, i) => {
|
|
63
|
+
let a = [], o = p(r, i);
|
|
61
64
|
o != null && a.push(o);
|
|
62
65
|
let s = [];
|
|
63
66
|
return e?.author && s.push({
|
|
@@ -68,23 +71,23 @@ var c = {
|
|
|
68
71
|
value: e?.updatedAt ? n(e.updatedAt) : ""
|
|
69
72
|
}), s.push({
|
|
70
73
|
label: i.fileCountLabel,
|
|
71
|
-
value: String(
|
|
74
|
+
value: String(m(t).length)
|
|
72
75
|
}), a.push({
|
|
73
76
|
title: i.detailsSectionTitle,
|
|
74
77
|
specs: s
|
|
75
78
|
}), { sections: a };
|
|
76
|
-
},
|
|
79
|
+
}, y = (e, t, n) => {
|
|
77
80
|
if (e === "") return n;
|
|
78
81
|
let r = t.get(e);
|
|
79
82
|
if (r != null) return r.items;
|
|
80
|
-
let i = e.split("/"), a =
|
|
83
|
+
let i = e.split("/"), a = y(i.slice(0, -1).join("/"), t, n), s = {
|
|
81
84
|
type: o.Folder,
|
|
82
85
|
id: e,
|
|
83
86
|
name: i[i.length - 1],
|
|
84
87
|
items: []
|
|
85
88
|
};
|
|
86
89
|
return t.set(e, s), a.push(s), s.items;
|
|
87
|
-
},
|
|
90
|
+
}, b = (e, t) => {
|
|
88
91
|
e.sort((e, n) => {
|
|
89
92
|
if (t) {
|
|
90
93
|
if (e.name === "SKILL.md") return -1;
|
|
@@ -92,32 +95,32 @@ var c = {
|
|
|
92
95
|
}
|
|
93
96
|
return e.name.localeCompare(n.name);
|
|
94
97
|
});
|
|
95
|
-
for (let t of e) t.type === o.Folder &&
|
|
96
|
-
},
|
|
98
|
+
for (let t of e) t.type === o.Folder && b(t.items, !1);
|
|
99
|
+
}, x = (e, t) => {
|
|
97
100
|
let n = /* @__PURE__ */ new Map(), r = [];
|
|
98
101
|
for (let i of e) {
|
|
99
|
-
let e =
|
|
102
|
+
let e = g(i.path, t);
|
|
100
103
|
if (e == null) continue;
|
|
101
104
|
if (i.nodeType === s.Folder) {
|
|
102
|
-
|
|
105
|
+
y(e, n, r);
|
|
103
106
|
continue;
|
|
104
107
|
}
|
|
105
108
|
let a = e.lastIndexOf("/");
|
|
106
|
-
|
|
109
|
+
y(a === -1 ? "" : e.slice(0, a), n, r).push({
|
|
107
110
|
type: o.File,
|
|
108
111
|
id: i.path,
|
|
109
112
|
name: i.name
|
|
110
113
|
});
|
|
111
114
|
}
|
|
112
|
-
return
|
|
113
|
-
},
|
|
115
|
+
return b(r, !0), r;
|
|
116
|
+
}, S = async (e) => {
|
|
114
117
|
let t = Number(e.headers.get("content-length"));
|
|
115
118
|
if (Number.isFinite(t) && t > 262144) return null;
|
|
116
119
|
let n = await e.arrayBuffer();
|
|
117
120
|
return n.byteLength > 262144 ? null : new Uint8Array(n);
|
|
118
|
-
},
|
|
119
|
-
let t = await
|
|
121
|
+
}, C = async (e) => new Uint8Array(await e.arrayBuffer()), w = async (e) => {
|
|
122
|
+
let t = await S(e);
|
|
120
123
|
return t == null ? null : new TextDecoder().decode(t);
|
|
121
124
|
};
|
|
122
125
|
//#endregion
|
|
123
|
-
export {
|
|
126
|
+
export { x as buildSkillContentTree, v as buildSkillOverview, d as mapSkillToCatalogItem, S as readSkillFileBytes, C as readSkillFilePreviewBytes, w as readSkillManifest, _ as resolveSkillFileDownloadPath, h as resolveSkillManifestFileId };
|
package/catalog/publish.js
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
import { safeDecodeURIComponent as e } from "../shared/string-utils.js";
|
|
2
|
-
import { CatalogEntityType as t } from "@epam/ai-dial-chat-shared";
|
|
2
|
+
import { CatalogEntityType as t, PUBLIC_BUCKET as n } from "@epam/ai-dial-chat-shared";
|
|
3
3
|
//#region src/catalog/publish.ts
|
|
4
|
-
var
|
|
4
|
+
var r = {
|
|
5
5
|
[t.Model]: "model",
|
|
6
6
|
[t.Toolset]: "toolset",
|
|
7
7
|
[t.Agent]: "application",
|
|
8
8
|
[t.Prompt]: "prompt",
|
|
9
9
|
[t.Skill]: "skill"
|
|
10
|
-
},
|
|
10
|
+
}, i = (e) => r[e], a = (e) => e.split("/")[1] === n, o = (t) => a(t) ? t.split("/").slice(2, -1).map(e) : [], s = (e) => ({
|
|
11
11
|
version: e.version,
|
|
12
12
|
publishedAt: Date.parse(e.publishedAt),
|
|
13
|
-
folderPath: e.folderPath.split("/").filter(Boolean)
|
|
13
|
+
folderPath: e.folderPath.split("/").filter(Boolean),
|
|
14
|
+
publishCredentials: e.publishCredentials
|
|
14
15
|
}), c = (e) => ({
|
|
15
16
|
publishedAt: Date.parse(e.publishedAt),
|
|
16
17
|
folderPath: e.folderPath.split("/").filter(Boolean)
|
|
17
18
|
});
|
|
18
19
|
//#endregion
|
|
19
|
-
export { o as getPublicCatalogEntityFolderPath, a as isPublicCatalogEntityId, c as mapPublishConversationResultDto, s as mapPublishHistoryEntryDto,
|
|
20
|
+
export { o as getPublicCatalogEntityFolderPath, a as isPublicCatalogEntityId, c as mapPublishConversationResultDto, s as mapPublishHistoryEntryDto, i as toPublishEntityType };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { useCallback as e, useEffect as t, useRef as n, useState as r } from "react";
|
|
2
|
+
//#region src/catalog/useApplicationCredentials/useApplicationCredentials.ts
|
|
3
|
+
var i = ({ appId: i, externalServicesClient: a, offlineCredentialsClient: o }) => {
|
|
4
|
+
let [s, c] = r([]), [l, u] = r(!1), [d, f] = r(!0), [p, m] = r(!1), h = n(0), g = n(null), _ = e(async () => {
|
|
5
|
+
if (g.current !== i) return;
|
|
6
|
+
let e = ++h.current;
|
|
7
|
+
f(!0), m(!1);
|
|
8
|
+
try {
|
|
9
|
+
let t = await a.listExternalServices({ appId: i });
|
|
10
|
+
if (h.current !== e) return;
|
|
11
|
+
let n = t.some((e) => e.authenticationType === "DIAL_NATIVE") ? await o.getOfflineCredentials() : void 0;
|
|
12
|
+
if (h.current !== e) return;
|
|
13
|
+
c(t.filter((e) => e.authenticationType !== "NONE")), u(n?.connected ?? !1);
|
|
14
|
+
} catch {
|
|
15
|
+
h.current === e && m(!0);
|
|
16
|
+
} finally {
|
|
17
|
+
h.current === e && f(!1);
|
|
18
|
+
}
|
|
19
|
+
}, [
|
|
20
|
+
i,
|
|
21
|
+
a,
|
|
22
|
+
o
|
|
23
|
+
]), v = e(() => {
|
|
24
|
+
g.current = null, h.current++;
|
|
25
|
+
}, []);
|
|
26
|
+
return t(() => (g.current = i, c([]), f(!0), u(!1), _(), v), [
|
|
27
|
+
i,
|
|
28
|
+
_,
|
|
29
|
+
v
|
|
30
|
+
]), {
|
|
31
|
+
services: s,
|
|
32
|
+
isOfflineConnected: l,
|
|
33
|
+
isLoading: d,
|
|
34
|
+
hasError: p,
|
|
35
|
+
refresh: _
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
//#endregion
|
|
39
|
+
export { i as useApplicationCredentials };
|