@epam/ai-dial-chat-hooks 1.1.0-dev.423 → 1.1.0-dev.426
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-DuLNy43N.js → api-error/api-error.js} +1 -1
- package/api-transport/create-csrf-middleware.js +21 -0
- package/api-transport/create-unauthorized-middleware.js +41 -0
- package/attachment/useAttachmentAction/useAttachmentAction.js +74 -0
- package/attachment/useAttachmentValidation/useAttachmentValidation.js +35 -0
- package/attachments.js +3 -2
- package/catalog/catalog-derivations.js +10 -0
- package/catalog/catalog-primary-action.js +21 -0
- package/catalog/create-publish-api.js +27 -0
- package/catalog/deployment-endpoint-url.js +34 -0
- package/{deployment-id-CxWgJTs9.js → catalog/deployment-id.js} +1 -1
- package/catalog/entity-details.js +6 -0
- package/catalog/map-deployment-limits-to-catalog.js +73 -0
- package/catalog/map-deployment-limits-to-input.js +14 -0
- package/catalog/map-deployment-to-catalog-item.js +92 -0
- package/catalog/map-entity-details-to-catalog.js +350 -0
- package/catalog/map-prompt-to-catalog-item.js +49 -0
- package/catalog/map-skill-to-catalog-item.js +123 -0
- package/catalog/mcp-endpoint-url.js +26 -0
- package/catalog/publish.js +18 -0
- package/catalog/useCatalogEditNavigation/useCatalogEditNavigation.js +109 -0
- package/catalog/useCatalogItemDetails.js +101 -0
- package/catalog/useCatalogToolsetCredentials/useCatalogToolsetCredentials.js +146 -0
- package/catalog/useFavoriteEntitiesState/useFavoriteEntitiesState.js +50 -0
- package/catalog/usePublishFolders/usePublishFolders.js +72 -0
- package/catalog.js +22 -3
- package/conversation/announcement-message.js +42 -0
- package/conversation/conversation-transfer/async.js +18 -0
- package/conversation/conversation-transfer/attachment-refs.js +11 -0
- package/conversation/conversation-transfer/build-upload-path.js +27 -0
- package/{date-BeuD8G79.js → conversation/conversation-transfer/date.js} +1 -1
- package/conversation/conversation-transfer/dial-file-resolve.js +18 -0
- package/conversation/conversation-transfer/export-conversation.js +32 -0
- package/conversation/conversation-transfer/import-conversation.js +93 -0
- package/conversation/conversation-transfer/progress.js +39 -0
- package/conversation/conversation-transfer/queue.js +84 -0
- package/conversation/conversation-transfer/types.js +9 -0
- package/conversation/conversation-transfer/zip-export.js +19 -0
- package/conversation/conversation-transfer/zip-import.js +29 -0
- package/conversation/create-chat-stream-api.js +96 -0
- package/conversation/deriveConversationRowActionState/deriveConversationRowActionState.js +14 -0
- package/conversation/display-name-watch.js +5 -0
- package/conversation/footer-message.js +23 -0
- package/conversation/get-model-id-from-conversation-id.js +14 -0
- package/conversation/greeting.js +7 -0
- package/conversation/message-factory.js +19 -0
- package/conversation/message-utils.js +13 -0
- package/conversation/overlay-messages.js +8 -0
- package/conversation/quick-app-conversation-starters.js +29 -0
- package/conversation/starter-option.js +27 -0
- package/conversation/useActiveConversationSync/useActiveConversationSync.js +19 -0
- package/conversation/useAsyncConfirmDialog/useAsyncConfirmDialog.js +39 -0
- package/conversation/useAttachmentUpload/useAttachmentUpload.js +33 -0
- package/conversation/useConversationExport/useConversationExport.js +285 -0
- package/conversation/useConversationHandlers/attachment-to-dto.js +13 -0
- package/conversation/useConversationHandlers/message-factory.js +21 -0
- package/conversation/useConversationHandlers/message-utils.js +8 -0
- package/conversation/useConversationHandlers/starter-option.js +11 -0
- package/conversation/useConversationHandlers/useConversationHandlers.js +263 -0
- package/conversation/useConversationImport/useConversationImport.js +239 -0
- package/conversation/useConversationLookupMaps/useConversationLookupMaps.js +11 -0
- package/conversation/useConversationPanelItems/useConversationPanelItems.js +35 -0
- package/{useConversationScroll-CliIMnjP.js → conversation/useConversationScroll/useConversationScroll.js} +1 -1
- package/conversation/useConversationStream/apply-chunk.js +78 -0
- package/conversation/useConversationStream/buffered-generation.js +18 -0
- package/conversation/useConversationStream/conversation-path.js +8 -0
- package/conversation/useConversationStream/generation-resume.js +126 -0
- package/conversation/useConversationStream/useConversationStream.js +148 -0
- package/conversation/useImportFilePicker/useImportFilePicker.js +20 -0
- package/conversation/useTranscribeAudio/audio-transcription-error.js +12 -0
- package/conversation/useTranscribeAudio/transcription-retry.js +38 -0
- package/conversation/useTranscribeAudio/useTranscribeAudio.js +41 -0
- package/{useConversationSources-DKaKvjXZ.js → conversation-sources/useConversationSources/useConversationSources.js} +1 -1
- package/conversation-sources.js +1 -1
- package/conversation-transfer.js +7 -3
- package/conversation.d.ts +66 -0
- package/conversation.js +31 -2
- package/file-manager.d.ts +3 -4
- package/file-manager.js +28 -3
- package/files/annotation.js +15 -0
- package/files/attachment-canvas.js +218 -0
- package/files/attachment-dto-to-display.js +15 -0
- package/files/attachment-types.js +16 -0
- package/files/create-files-api.js +40 -0
- package/files/create-upload-file-with-progress.js +42 -0
- package/files/dial-file-manager-copy-move.util.js +55 -0
- package/files/dial-file-manager-mapping.util.js +140 -0
- package/files/dial-file-manager-path.util.js +72 -0
- package/files/dial-file-manager.model.js +25 -0
- package/files/dial-file-manager.types.js +10 -0
- package/files/dial-file-to-attachment.js +37 -0
- package/files/dial-file.js +30 -0
- package/files/dial-files-api.js +6 -0
- package/files/download-destination.js +6 -0
- package/files/file-manager-variant.js +11 -0
- package/files/file-name.js +19 -0
- package/files/prepare-download-destination.js +24 -0
- package/files/resolve-dial-file-api-path.js +33 -0
- package/files/source-content.js +37 -0
- package/files/useDialFileListing/useDialFileListing.js +295 -0
- package/files/useDialFileManager/useDialFileManager.js +146 -0
- package/files/useDialFileManagerTabConfig/useDialFileManagerTabConfig.js +23 -0
- package/files/useDialFileMetadata/useDialFileMetadata.js +42 -0
- package/files/useDialFileMutations/useDialFileMutations.js +359 -0
- package/files/useDialFileSharing/useDialFileSharing.js +70 -0
- package/files/useDialFileUploadBatch/useDialFileUploadBatch.js +156 -0
- package/index.d.ts +69 -4
- package/index.js +134 -28
- package/mcp-apps/mcp-apps-api-client.js +48 -0
- package/mcp-apps/useMcpAppHostAdapter/useMcpAppHostAdapter.js +26 -0
- package/mcp-apps/useMcpAppHostContext/useMcpAppHostContext.js +26 -0
- package/mcp-apps/useMcpAppTools/useMcpAppTools.js +71 -0
- package/mcp-apps/useOpenMcpAppCanvas/useOpenMcpAppCanvas.js +58 -0
- package/mcp-apps.js +6 -2
- package/oauth/authorize-url.js +12 -0
- package/oauth/handshake.js +65 -0
- package/oauth/popup.js +29 -0
- package/oauth/toolset-id.js +10 -0
- package/oauth/types.js +24 -0
- package/oauth/useOAuthCallbackCompletion/useOAuthCallbackCompletion.js +94 -0
- package/oauth/useToolsetLogin/useToolsetLogin.js +73 -0
- package/oauth.js +9 -3
- package/package.json +35 -23
- package/prompt/export-prompt.js +28 -0
- package/prompt/prompt-resource.js +15 -0
- package/prompt/prompt.js +12 -0
- package/prompt/usePromptsState/usePromptsState.js +42 -0
- package/scheduled-task/scheduled-task-mapping.js +6 -0
- package/{scheduled-task-trigger-D9RZCk52.js → scheduled-task/scheduled-task-trigger.js} +39 -40
- package/scheduled-tasks.js +3 -2
- package/scroll-anchoring.js +1 -1
- package/shared/application-schema.js +4 -0
- package/shared/browser-timezone.js +10 -0
- package/{cron-weekday-B4w29eAC.js → shared/cron-weekday.js} +1 -1
- package/shared/custom-apps.js +30 -0
- package/shared/external-services.js +18 -0
- package/{formatting-CZyyxBG3.js → shared/formatting.js} +1 -1
- package/{prompt-resource-Bt1I-8ri.js → shared/locale.js} +2 -13
- package/{string-utils-iBi2Y55C.js → shared/string-utils.js} +1 -1
- package/shared/toolset-login-events.js +13 -0
- package/sharing.js +3 -3
- package/skill/skill-file-batch-validation.js +48 -0
- package/skill/skill-file-preview.js +15 -0
- package/skill/skill-manifest.js +70 -0
- package/skill/skill-types.js +15 -0
- package/skill/skill.js +48 -0
- package/skill/useSkillEditorLoad.js +103 -0
- package/skill/useSkillEditorSubmit.js +135 -0
- package/skill/useSkillFileActions.js +99 -0
- package/skill/useSkillFilePreview.js +29 -0
- package/{useSkillsState-BoLlwmzb.js → skill/useSkillsState/useSkillsState.js} +1 -1
- package/skill-editor.js +8 -3
- package/skills-state.js +1 -1
- package/source-content.d.ts +29 -0
- package/source-content.js +2 -0
- package/usage/useUsageData/useUsageData.js +32 -0
- package/useChatSettingsFormConfig/useChatSettingsFormConfig.js +74 -0
- package/{usePanelMaxWidth-BEZYuqF9.js → usePageFileDrag/usePageFileDrag.js} +1 -11
- package/usePanelMaxWidth/usePanelMaxWidth.js +8 -0
- package/{useShareLink-xkiaxATt.js → useShareLink/useShareLink.js} +1 -1
- package/{useShareRecipientsCount-BgwCLKY0.js → useShareRecipientsCount/useShareRecipientsCount.js} +1 -1
- package/useToolsMenu/useToolsMenu.js +50 -0
- package/useViewportWidth/useViewportWidth.js +12 -0
- package/utils.js +17 -7
- package/viewport-layout.js +4 -2
- package/attachment-types-AAoN9E95.js +0 -7760
- package/browser-Btsa0Lmr.js +0 -607
- package/skill-manifest-CeG6-WSK.js +0 -4056
- package/useAttachmentValidation-CkMTd5lA.js +0 -102
- package/useConversationImport-CDRs7JF1.js +0 -826
- package/useDialFileManagerTabConfig-CjI46lMo.js +0 -2291
- package/useOAuthCallbackCompletion-CvyTKLER.js +0 -93
- package/useOpenMcpAppCanvas-C7-AMseH.js +0 -207
- package/useSkillFileActions-B-VaGD20.js +0 -373
- package/useSkillFilePreview-B5o1n_0F.js +0 -1244
- package/useToolsMenu-zURpMEn1.js +0 -1882
- package/useToolsetLogin-B05m134e.js +0 -195
- package/useUsageData-D7BxloKZ.js +0 -201
|
@@ -1,1244 +0,0 @@
|
|
|
1
|
-
import { t as e } from "./api-error-DuLNy43N.js";
|
|
2
|
-
import { i as t, r as n } from "./string-utils-iBi2Y55C.js";
|
|
3
|
-
import { n as r } from "./deployment-id-CxWgJTs9.js";
|
|
4
|
-
import { T as i, g as a, h as o, n as s, t as c } from "./useToolsetLogin-B05m134e.js";
|
|
5
|
-
import { n as l, s as u, t as d } from "./prompt-resource-Bt1I-8ri.js";
|
|
6
|
-
import { t as f } from "./formatting-CZyyxBG3.js";
|
|
7
|
-
import { r as p, t as m } from "./skill-manifest-CeG6-WSK.js";
|
|
8
|
-
import { CatalogEntityType as h, extractPromptParams as g, formatCost as _, formatLastUsed as v, formatUnitPrice as y } from "@epam/ai-dial-chat-shared";
|
|
9
|
-
import { useCallback as b, useEffect as x, useMemo as S, useRef as C, useState as w } from "react";
|
|
10
|
-
import { mimeTypesToExtensionLabels as T } from "@epam/ai-dial-attachment-input";
|
|
11
|
-
import { CatalogContentNodeType as E, CatalogLimitStatus as D, CodeLanguage as O, CredentialStatus as k, CredentialsLevel as A, ToolsetAuthenticationType as j } from "@epam/ai-dial-catalog";
|
|
12
|
-
import { ListFilesItemDtoNodeTypeEnum as ee, SkillMetadataItemDtoNodeTypeEnum as te } from "@epam/ai-dial-chat-api-client";
|
|
13
|
-
import { NotificationVariant as M } from "@epam/ai-dial-ui-kit";
|
|
14
|
-
import { fromFolderPathKey as ne, mergeFolderPaths as re, toFolderPathKey as ie } from "@epam/ai-dial-publish-panel";
|
|
15
|
-
//#region src/catalog/create-publish-api.ts
|
|
16
|
-
var ae = (e) => ({
|
|
17
|
-
source: e.source,
|
|
18
|
-
targets: e.targets,
|
|
19
|
-
function: e.function
|
|
20
|
-
}), oe = (e) => ({
|
|
21
|
-
publishCatalogEntity: (t, n, r) => e.publishCatalogEntity({
|
|
22
|
-
entityType: t,
|
|
23
|
-
entityId: n,
|
|
24
|
-
publishCatalogEntityDto: r
|
|
25
|
-
}),
|
|
26
|
-
unpublishCatalogEntity: (t, n, r) => e.unpublishCatalogEntity({
|
|
27
|
-
entityType: t,
|
|
28
|
-
entityId: n,
|
|
29
|
-
unpublishCatalogEntityDto: r
|
|
30
|
-
}),
|
|
31
|
-
getCatalogPublishHistory: (t, n) => e.getCatalogPublishHistory({
|
|
32
|
-
entityType: t,
|
|
33
|
-
entityId: n
|
|
34
|
-
}),
|
|
35
|
-
getPublishRules: async (t) => (await e.getPublishRules({ folderPath: t })).rules.map(({ function: e, ...t }) => ({
|
|
36
|
-
...t,
|
|
37
|
-
function: e
|
|
38
|
-
}))
|
|
39
|
-
}), se = (e) => e.endsWith("/") ? e.slice(0, -1) : e, ce = (e) => e.split("/").map((e) => encodeURIComponent(n(e))).join("/"), le = (e) => e.split("/").map(n).join("/"), ue = (e, t) => `${se(e)}/openai/deployments/${ce(t)}/chat/completions`, de = (e) => `${se(e)}/openai/v1/responses`, fe = (e, t, { hasChatCompletion: n, hasResponsesApi: r }) => {
|
|
40
|
-
let i = [];
|
|
41
|
-
if (n) {
|
|
42
|
-
let n = ue(e, t);
|
|
43
|
-
i.push({
|
|
44
|
-
label: "Chat Completions",
|
|
45
|
-
url: n,
|
|
46
|
-
snippets: [{
|
|
47
|
-
language: O.Curl,
|
|
48
|
-
code: `curl -X POST '${n}?api-version=<api-version>' \\\n -H 'Content-Type: application/json' \\\n -H 'Api-Key: <key>' \\\n -d '{"messages":[{"role":"user","content":"Hello"}]}'`
|
|
49
|
-
}]
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
if (r) {
|
|
53
|
-
let n = de(e);
|
|
54
|
-
i.push({
|
|
55
|
-
label: "Responses",
|
|
56
|
-
url: n,
|
|
57
|
-
snippets: [{
|
|
58
|
-
language: O.Curl,
|
|
59
|
-
code: `curl -X POST '${n}' \\\n -H 'Content-Type: application/json' \\\n -H 'Api-Key: <key>' \\\n -d '{"model":"${t}","input":"Hello"}'`
|
|
60
|
-
}]
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
if (i.length !== 0) return {
|
|
64
|
-
resource: { modelId: le(t) },
|
|
65
|
-
endpoints: i
|
|
66
|
-
};
|
|
67
|
-
}, N = /* @__PURE__ */ function(e) {
|
|
68
|
-
return e.None = "NONE", e.ApiKey = "API_KEY", e.OAuth = "OAUTH", e;
|
|
69
|
-
}({}), pe = [
|
|
70
|
-
{
|
|
71
|
-
key: "dayTokenStats",
|
|
72
|
-
labelField: "tokensPerDay",
|
|
73
|
-
costKey: "dayCostStats"
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
key: "weekTokenStats",
|
|
77
|
-
labelField: "tokensPerWeek",
|
|
78
|
-
costKey: "weekCostStats"
|
|
79
|
-
},
|
|
80
|
-
{
|
|
81
|
-
key: "monthTokenStats",
|
|
82
|
-
labelField: "tokensPerMonth",
|
|
83
|
-
costKey: "monthCostStats"
|
|
84
|
-
}
|
|
85
|
-
], me = 2 ** 53 - 1, he = .75, ge = [1e6, 1e3], P = new Intl.NumberFormat(void 0, {
|
|
86
|
-
notation: "compact",
|
|
87
|
-
maximumFractionDigits: 1
|
|
88
|
-
}), F = new Intl.NumberFormat(void 0, { maximumFractionDigits: 2 }), _e = (e) => {
|
|
89
|
-
let t = ge.find((t) => Math.abs(e) >= t);
|
|
90
|
-
return t == null ? e : Math.trunc(e / t * 10) / 10 * t;
|
|
91
|
-
}, ve = (e) => e != null && Number.isFinite(e.total) && Number.isFinite(e.used) && e.total > 0, I = (e) => e >= me, ye = (e) => e != null && Number.isFinite(e.total) && Number.isFinite(e.used), be = (e, t) => {
|
|
92
|
-
if (ye(e)) return t.formatSpentCaption(_(Math.max(0, e.used)));
|
|
93
|
-
}, xe = (e, t, n, r) => {
|
|
94
|
-
let i = Math.max(0, e.used), a = e.total, o = P.format(_e(i)), s = P.format(a), c = F.format(i), l = F.format(a), u = I(a);
|
|
95
|
-
return {
|
|
96
|
-
label: t,
|
|
97
|
-
used: i,
|
|
98
|
-
total: a,
|
|
99
|
-
captionLabel: n,
|
|
100
|
-
...u ? {
|
|
101
|
-
isUnlimited: !0,
|
|
102
|
-
noteLabel: r.followsCostLimit
|
|
103
|
-
} : {
|
|
104
|
-
usedLabel: o,
|
|
105
|
-
totalLabel: s
|
|
106
|
-
},
|
|
107
|
-
valueLabel: u ? o : r.formatValueLabel(o, s),
|
|
108
|
-
ariaLabel: u ? r.formatFollowsCostLimitAriaLabel({
|
|
109
|
-
label: t,
|
|
110
|
-
used: c
|
|
111
|
-
}) : r.formatProgressAriaLabel({
|
|
112
|
-
label: t,
|
|
113
|
-
used: c,
|
|
114
|
-
total: l
|
|
115
|
-
})
|
|
116
|
-
};
|
|
117
|
-
}, Se = (e) => I(e.total) ? 0 : Math.max(e.used, 0) / e.total, Ce = (e) => e.reduce((e, t) => {
|
|
118
|
-
let n = Se(t);
|
|
119
|
-
return n >= 1 ? D.LimitReached : n >= he && e !== D.LimitReached ? D.RunningLow : e;
|
|
120
|
-
}, void 0), L = (e, t) => {
|
|
121
|
-
if (e == null) return;
|
|
122
|
-
let n = [], r = pe.flatMap((r) => {
|
|
123
|
-
let i = e[r.key];
|
|
124
|
-
if (!ve(i)) return [];
|
|
125
|
-
n.push(i);
|
|
126
|
-
let a = be(e[r.costKey], t);
|
|
127
|
-
return [xe(i, t[r.labelField], a, t)];
|
|
128
|
-
});
|
|
129
|
-
return r.length > 0 ? {
|
|
130
|
-
groups: [{
|
|
131
|
-
label: t.tokenGroup,
|
|
132
|
-
rows: r
|
|
133
|
-
}],
|
|
134
|
-
status: Ce(n)
|
|
135
|
-
} : void 0;
|
|
136
|
-
}, we = (e) => {
|
|
137
|
-
let t = e?.monthTokenStats;
|
|
138
|
-
if (t == null || !Number.isFinite(t.total) || !Number.isFinite(t.used) || t.total <= 0 || t.total >= 2 ** 53 - 1) return;
|
|
139
|
-
let n = Math.max(0, t.used);
|
|
140
|
-
return {
|
|
141
|
-
used: n,
|
|
142
|
-
total: t.total,
|
|
143
|
-
remaining: Math.max(0, t.total - n),
|
|
144
|
-
usedPercent: Math.min(100, Math.round(n / t.total * 100))
|
|
145
|
-
};
|
|
146
|
-
}, R = (e) => e >= 1e6 ? `${e / 1e6}M tokens` : e >= 1e3 ? `${e / 1e3}K tokens` : `${e} tokens`, z = (e) => {
|
|
147
|
-
let t = /^(\d{4})-(\d{2})-(\d{2})$/.exec(e);
|
|
148
|
-
if (t == null) return e;
|
|
149
|
-
let [, n, r, i] = t, a = Number(n), o = Number(r) - 1, s = Number(i), c = new Date(a, o, s);
|
|
150
|
-
return c.getFullYear() !== a || c.getMonth() !== o || c.getDate() !== s ? e : f(c.getTime());
|
|
151
|
-
}, Te = "unit", Ee = (e) => {
|
|
152
|
-
let t = [];
|
|
153
|
-
if (e.capabilities != null) {
|
|
154
|
-
let { capabilities: n } = e, r = [];
|
|
155
|
-
n.hasTools != null && r.push({
|
|
156
|
-
label: "Tools",
|
|
157
|
-
value: n.hasTools
|
|
158
|
-
}), n.hasParallelToolCalls != null && r.push({
|
|
159
|
-
label: "Parallel tool calls",
|
|
160
|
-
value: n.hasParallelToolCalls
|
|
161
|
-
}), n.reasoningEfforts?.length && r.push({
|
|
162
|
-
label: "Reasoning efforts",
|
|
163
|
-
value: n.reasoningEfforts.join(" · ")
|
|
164
|
-
}), r.length > 0 && t.push({
|
|
165
|
-
title: "Capabilities",
|
|
166
|
-
specs: r
|
|
167
|
-
});
|
|
168
|
-
}
|
|
169
|
-
if (e.specification != null) {
|
|
170
|
-
let { specification: n } = e, r = [];
|
|
171
|
-
n.provider != null && r.push({
|
|
172
|
-
label: "Provider",
|
|
173
|
-
value: n.provider
|
|
174
|
-
}), n.vendor != null && r.push({
|
|
175
|
-
label: "Vendor",
|
|
176
|
-
value: n.vendor
|
|
177
|
-
}), n.license != null && r.push({
|
|
178
|
-
label: "License",
|
|
179
|
-
value: n.license
|
|
180
|
-
}), n.knowledgeCutoffDate != null && r.push({
|
|
181
|
-
label: "Knowledge cutoff date",
|
|
182
|
-
value: z(n.knowledgeCutoffDate)
|
|
183
|
-
}), n.parameters != null && r.push({
|
|
184
|
-
label: "Parameters",
|
|
185
|
-
value: n.parameters
|
|
186
|
-
}), n.hostedBy != null && r.push({
|
|
187
|
-
label: "Hosted by",
|
|
188
|
-
value: n.hostedBy
|
|
189
|
-
}), n.createdAt != null && r.push({
|
|
190
|
-
label: "Release date",
|
|
191
|
-
value: f(n.createdAt)
|
|
192
|
-
}), n.contextWindowTokens != null && r.push({
|
|
193
|
-
label: "Context window",
|
|
194
|
-
value: R(n.contextWindowTokens)
|
|
195
|
-
}), n.maxOutputTokens != null && r.push({
|
|
196
|
-
label: "Max output tokens",
|
|
197
|
-
value: R(n.maxOutputTokens)
|
|
198
|
-
}), n.inputTypes?.length && r.push({
|
|
199
|
-
label: "Input modalities",
|
|
200
|
-
value: T(n.inputTypes)
|
|
201
|
-
}), r.length > 0 && t.push({
|
|
202
|
-
title: "Specification",
|
|
203
|
-
specs: r
|
|
204
|
-
});
|
|
205
|
-
}
|
|
206
|
-
let n = ke(e.pricing), r = Ae(e);
|
|
207
|
-
return {
|
|
208
|
-
overview: t.length > 0 ? { sections: t } : void 0,
|
|
209
|
-
pricing: n,
|
|
210
|
-
api: r
|
|
211
|
-
};
|
|
212
|
-
}, De = {
|
|
213
|
-
prompt: "Input tokens",
|
|
214
|
-
completion: "Output tokens",
|
|
215
|
-
cache_read: "Cached input",
|
|
216
|
-
cacheRead: "Cached input",
|
|
217
|
-
cache_write: "Cached write",
|
|
218
|
-
cacheWrite: "Cached write"
|
|
219
|
-
}, B = [
|
|
220
|
-
"prompt",
|
|
221
|
-
"completion",
|
|
222
|
-
"cache_read",
|
|
223
|
-
"cacheRead",
|
|
224
|
-
"cache_write",
|
|
225
|
-
"cacheWrite"
|
|
226
|
-
], V = (e) => {
|
|
227
|
-
let t = B.indexOf(e);
|
|
228
|
-
return t === -1 ? B.length : t;
|
|
229
|
-
}, Oe = (e) => {
|
|
230
|
-
let t = De[e];
|
|
231
|
-
if (t != null) return t;
|
|
232
|
-
let n = e.replace(/([a-z\d])([A-Z])/g, "$1 $2").replace(/[_-]+/g, " ").trim().toLowerCase();
|
|
233
|
-
return n === "" ? e : ` ${n.charAt(0).toUpperCase()}${n.slice(1)}`;
|
|
234
|
-
}, ke = (e) => {
|
|
235
|
-
if (e == null) return;
|
|
236
|
-
let t = [...e.prices ?? []].sort((e, t) => V(e.key) - V(t.key)).map(({ key: e, price: t }) => ({
|
|
237
|
-
label: Oe(e),
|
|
238
|
-
price: t
|
|
239
|
-
}));
|
|
240
|
-
if (t.length !== 0) return { prices: t };
|
|
241
|
-
}, Ae = (e) => {
|
|
242
|
-
let { api: t } = e;
|
|
243
|
-
if (t?.modelId != null) return { resource: { modelId: t.modelId } };
|
|
244
|
-
}, je = (e) => {
|
|
245
|
-
let t = [];
|
|
246
|
-
if (e.specification != null) {
|
|
247
|
-
let { specification: n } = e, r = [];
|
|
248
|
-
n.provider != null && r.push({
|
|
249
|
-
label: "Provider",
|
|
250
|
-
value: n.provider
|
|
251
|
-
}), n.vendor != null && r.push({
|
|
252
|
-
label: "Vendor",
|
|
253
|
-
value: n.vendor
|
|
254
|
-
}), n.license != null && r.push({
|
|
255
|
-
label: "License",
|
|
256
|
-
value: n.license
|
|
257
|
-
}), n.knowledgeCutoffDate != null && r.push({
|
|
258
|
-
label: "Knowledge cutoff date",
|
|
259
|
-
value: z(n.knowledgeCutoffDate)
|
|
260
|
-
}), n.parameters != null && r.push({
|
|
261
|
-
label: "Parameters",
|
|
262
|
-
value: n.parameters
|
|
263
|
-
}), n.hostedBy != null && r.push({
|
|
264
|
-
label: "Hosted by",
|
|
265
|
-
value: n.hostedBy
|
|
266
|
-
}), n.createdAt != null && r.push({
|
|
267
|
-
label: "Release date",
|
|
268
|
-
value: f(n.createdAt)
|
|
269
|
-
}), n.routes?.length && r.push({
|
|
270
|
-
label: "Routes",
|
|
271
|
-
value: n.routes.join(" · ")
|
|
272
|
-
}), r.length > 0 && t.push({
|
|
273
|
-
title: "Specification",
|
|
274
|
-
specs: r
|
|
275
|
-
});
|
|
276
|
-
}
|
|
277
|
-
if (e.capabilities != null) {
|
|
278
|
-
let { capabilities: n } = e, r = [];
|
|
279
|
-
n.hasTools != null && r.push({
|
|
280
|
-
label: "Tools",
|
|
281
|
-
value: n.hasTools
|
|
282
|
-
}), n.hasParallelToolCalls != null && r.push({
|
|
283
|
-
label: "Parallel tool calls",
|
|
284
|
-
value: n.hasParallelToolCalls
|
|
285
|
-
}), n.hasConfiguration != null && r.push({
|
|
286
|
-
label: "Configuration schema",
|
|
287
|
-
value: n.hasConfiguration
|
|
288
|
-
}), r.length > 0 && t.push({
|
|
289
|
-
title: "Capabilities",
|
|
290
|
-
specs: r
|
|
291
|
-
});
|
|
292
|
-
}
|
|
293
|
-
if (e.configuration != null) {
|
|
294
|
-
let { configuration: n } = e, r = [];
|
|
295
|
-
n.inputAttachmentTypes?.length && r.push({
|
|
296
|
-
label: "Input attachments",
|
|
297
|
-
value: T(n.inputAttachmentTypes)
|
|
298
|
-
}), r.length > 0 && t.push({
|
|
299
|
-
title: "Configuration",
|
|
300
|
-
specs: r
|
|
301
|
-
});
|
|
302
|
-
}
|
|
303
|
-
return { overview: t.length > 0 ? { sections: t } : void 0 };
|
|
304
|
-
}, Me = {
|
|
305
|
-
[N.None]: j.None,
|
|
306
|
-
[N.ApiKey]: j.ApiKey,
|
|
307
|
-
[N.OAuth]: j.OAuth
|
|
308
|
-
}, H = {
|
|
309
|
-
SIGNED_IN: k.SignedIn,
|
|
310
|
-
SIGNED_OUT: k.SignedOut,
|
|
311
|
-
FAILED: k.Failed
|
|
312
|
-
}, Ne = (e, t, n) => {
|
|
313
|
-
let r = Me[t.specification?.authentication ?? N.None];
|
|
314
|
-
if (r == null) return;
|
|
315
|
-
let { userLevel: a, global: o } = t.specification?.authStatus ?? {}, s = i(e);
|
|
316
|
-
return {
|
|
317
|
-
authenticationType: r,
|
|
318
|
-
userStatus: a ? H[a] : void 0,
|
|
319
|
-
globalStatus: o ? H[o] : void 0,
|
|
320
|
-
isPublic: s,
|
|
321
|
-
isManageableByAdmin: n && s,
|
|
322
|
-
apiKeyHeader: t.specification?.authStatus?.apiKeyHeader
|
|
323
|
-
};
|
|
324
|
-
}, Pe = (e) => {
|
|
325
|
-
let t = e?.permissions?.length ? e.permissions : e?.allTools;
|
|
326
|
-
if (t?.length) return { tools: t.map((e) => ({ name: e })) };
|
|
327
|
-
}, Fe = (e) => {
|
|
328
|
-
let t = [];
|
|
329
|
-
if (e.specification != null) {
|
|
330
|
-
let { specification: n } = e, r = [];
|
|
331
|
-
n.authentication != null && r.push({
|
|
332
|
-
label: "Authentication",
|
|
333
|
-
value: n.authentication
|
|
334
|
-
}), n.provider != null && r.push({
|
|
335
|
-
label: "Provider",
|
|
336
|
-
value: n.provider
|
|
337
|
-
}), n.vendor != null && r.push({
|
|
338
|
-
label: "Vendor",
|
|
339
|
-
value: n.vendor
|
|
340
|
-
}), n.license != null && r.push({
|
|
341
|
-
label: "License",
|
|
342
|
-
value: n.license
|
|
343
|
-
}), n.knowledgeCutoffDate != null && r.push({
|
|
344
|
-
label: "Knowledge cutoff date",
|
|
345
|
-
value: z(n.knowledgeCutoffDate)
|
|
346
|
-
}), n.parameters != null && r.push({
|
|
347
|
-
label: "Parameters",
|
|
348
|
-
value: n.parameters
|
|
349
|
-
}), n.hostedBy != null && r.push({
|
|
350
|
-
label: "Hosted by",
|
|
351
|
-
value: n.hostedBy
|
|
352
|
-
}), n.createdAt != null && r.push({
|
|
353
|
-
label: "Release date",
|
|
354
|
-
value: f(n.createdAt)
|
|
355
|
-
}), n.authStatus?.scopesSupported?.length && r.push({
|
|
356
|
-
label: "OAuth scopes",
|
|
357
|
-
value: n.authStatus.scopesSupported.join(" · ")
|
|
358
|
-
}), n.authStatus?.authorizationEndpoint != null && r.push({
|
|
359
|
-
label: "Authorization endpoint",
|
|
360
|
-
value: n.authStatus.authorizationEndpoint
|
|
361
|
-
}), n.authStatus?.tokenEndpoint != null && r.push({
|
|
362
|
-
label: "Token endpoint",
|
|
363
|
-
value: n.authStatus.tokenEndpoint
|
|
364
|
-
}), r.length > 0 && t.push({
|
|
365
|
-
title: "Specification",
|
|
366
|
-
specs: r
|
|
367
|
-
});
|
|
368
|
-
}
|
|
369
|
-
return {
|
|
370
|
-
overview: t.length > 0 ? { sections: t } : void 0,
|
|
371
|
-
tools: Pe(e.specification)
|
|
372
|
-
};
|
|
373
|
-
}, U = (e) => {
|
|
374
|
-
switch (e.type) {
|
|
375
|
-
case "MODEL": return Ee(e.data);
|
|
376
|
-
case "AGENT": return je(e.data);
|
|
377
|
-
case "TOOLSET": return Fe(e.data);
|
|
378
|
-
}
|
|
379
|
-
}, W = (e) => {
|
|
380
|
-
if (e != null) return {
|
|
381
|
-
hasTools: e.tools,
|
|
382
|
-
hasMcp: e.mcp,
|
|
383
|
-
hasCaching: e.cache,
|
|
384
|
-
hasParallelToolCalls: e.parallelToolCalls,
|
|
385
|
-
hasUrlAttachments: e.urlAttachments,
|
|
386
|
-
hasFolderAttachments: e.folderAttachments,
|
|
387
|
-
hasSeed: e.seed,
|
|
388
|
-
hasSystemPrompt: e.systemPrompt,
|
|
389
|
-
hasResume: e.allowResume,
|
|
390
|
-
hasConfiguration: e.hasConfigurationSchema,
|
|
391
|
-
hasChatCompletion: e.chatCompletion,
|
|
392
|
-
hasResponsesApi: e.responsesApi,
|
|
393
|
-
reasoningEfforts: e.reasoningEfforts
|
|
394
|
-
};
|
|
395
|
-
}, Ie = (e) => {
|
|
396
|
-
if (e == null) return;
|
|
397
|
-
let { unit: t } = e, n = Object.entries(e).flatMap(([e, n]) => {
|
|
398
|
-
if (e === Te || typeof n != "string" || n.trim() === "") return [];
|
|
399
|
-
let r = y(n, t);
|
|
400
|
-
return r == null ? [] : [{
|
|
401
|
-
key: e,
|
|
402
|
-
price: r
|
|
403
|
-
}];
|
|
404
|
-
});
|
|
405
|
-
return n.length > 0 ? { prices: n } : void 0;
|
|
406
|
-
}, Le = (e) => {
|
|
407
|
-
let { limits: t, pricing: n, features: r, catalogProperties: i, owner: a, inputAttachmentTypes: o, defaultMaxTokens: s, createdAt: c } = e.modelDetails ?? {}, l = t != null || i != null || a != null || c != null || (o?.length ?? 0) > 0;
|
|
408
|
-
return {
|
|
409
|
-
type: "MODEL",
|
|
410
|
-
data: {
|
|
411
|
-
capabilities: W(r),
|
|
412
|
-
specification: l ? {
|
|
413
|
-
provider: i?.provider,
|
|
414
|
-
vendor: i?.vendor,
|
|
415
|
-
license: i?.license,
|
|
416
|
-
knowledgeCutoffDate: i?.knowledgeCutoffDate,
|
|
417
|
-
parameters: i?.parameters,
|
|
418
|
-
contextWindowTokens: t?.maxTotalTokens,
|
|
419
|
-
maxOutputTokens: t?.maxCompletionTokens ?? s,
|
|
420
|
-
inputTypes: o,
|
|
421
|
-
hostedBy: a,
|
|
422
|
-
createdAt: c
|
|
423
|
-
} : void 0,
|
|
424
|
-
pricing: Ie(n),
|
|
425
|
-
api: { modelId: e.id }
|
|
426
|
-
}
|
|
427
|
-
};
|
|
428
|
-
}, Re = (e) => {
|
|
429
|
-
let { routes: t, owner: n, inputAttachmentTypes: r, features: i, catalogProperties: a, createdAt: o } = e.applicationDetails ?? {}, s = a != null || n != null || o != null || (t?.length ?? 0) > 0;
|
|
430
|
-
return {
|
|
431
|
-
type: "AGENT",
|
|
432
|
-
data: {
|
|
433
|
-
capabilities: W(i),
|
|
434
|
-
specification: s ? {
|
|
435
|
-
provider: a?.provider,
|
|
436
|
-
vendor: a?.vendor,
|
|
437
|
-
license: a?.license,
|
|
438
|
-
knowledgeCutoffDate: a?.knowledgeCutoffDate,
|
|
439
|
-
parameters: a?.parameters,
|
|
440
|
-
hostedBy: n,
|
|
441
|
-
createdAt: o,
|
|
442
|
-
routes: t
|
|
443
|
-
} : void 0,
|
|
444
|
-
configuration: r?.length ? { inputAttachmentTypes: r } : void 0
|
|
445
|
-
}
|
|
446
|
-
};
|
|
447
|
-
}, ze = (e) => e === N.None || e === N.ApiKey || e === N.OAuth, Be = (e) => {
|
|
448
|
-
if (e == null) return;
|
|
449
|
-
let { globalAuthStatus: t, appLevelAuthStatus: n, userLevelAuthStatus: r, scopesSupported: i, authorizationEndpoint: a, tokenEndpoint: o, apiKeyHeader: s } = e;
|
|
450
|
-
if (!(t == null && n == null && r == null && a == null && o == null && s == null && !i?.length)) return {
|
|
451
|
-
global: t,
|
|
452
|
-
appLevel: n,
|
|
453
|
-
userLevel: r,
|
|
454
|
-
scopesSupported: i,
|
|
455
|
-
authorizationEndpoint: a,
|
|
456
|
-
tokenEndpoint: o,
|
|
457
|
-
apiKeyHeader: s
|
|
458
|
-
};
|
|
459
|
-
}, Ve = (e) => {
|
|
460
|
-
let t = e.toolsetDetails, n = t?.authSettings?.authenticationType;
|
|
461
|
-
return {
|
|
462
|
-
type: "TOOLSET",
|
|
463
|
-
data: {
|
|
464
|
-
capabilities: W(t?.features),
|
|
465
|
-
specification: t == null ? void 0 : {
|
|
466
|
-
authentication: ze(n) ? n : void 0,
|
|
467
|
-
provider: t.catalogProperties?.provider,
|
|
468
|
-
vendor: t.catalogProperties?.vendor,
|
|
469
|
-
license: t.catalogProperties?.license,
|
|
470
|
-
knowledgeCutoffDate: t.catalogProperties?.knowledgeCutoffDate,
|
|
471
|
-
parameters: t.catalogProperties?.parameters,
|
|
472
|
-
permissions: t.allowedTools,
|
|
473
|
-
allTools: t.allToolNames,
|
|
474
|
-
hostedBy: t.owner,
|
|
475
|
-
createdAt: t.createdAt,
|
|
476
|
-
authStatus: Be(t.authSettings)
|
|
477
|
-
}
|
|
478
|
-
}
|
|
479
|
-
};
|
|
480
|
-
}, He = (e) => {
|
|
481
|
-
switch (e.type) {
|
|
482
|
-
case "model": return Le(e);
|
|
483
|
-
case "application": return Re(e);
|
|
484
|
-
case "toolset": return Ve(e);
|
|
485
|
-
}
|
|
486
|
-
}, Ue = {
|
|
487
|
-
NONE: j.None,
|
|
488
|
-
API_KEY: j.ApiKey,
|
|
489
|
-
OAUTH: j.OAuth
|
|
490
|
-
}, We = {
|
|
491
|
-
SIGNED_IN: k.SignedIn,
|
|
492
|
-
SIGNED_OUT: k.SignedOut,
|
|
493
|
-
FAILED: k.Failed
|
|
494
|
-
}, Ge = (e, t, n) => {
|
|
495
|
-
if (t == null) return;
|
|
496
|
-
let r = i(e), a = t.userLevelAuthStatus ? We[t.userLevelAuthStatus] : void 0, o = t.globalAuthStatus ? We[t.globalAuthStatus] : void 0;
|
|
497
|
-
return {
|
|
498
|
-
authenticationType: !n && r && a !== k.SignedIn && o === k.SignedIn ? j.None : Ue[t.authenticationType],
|
|
499
|
-
userStatus: a,
|
|
500
|
-
globalStatus: o,
|
|
501
|
-
isPublic: r,
|
|
502
|
-
isManageableByAdmin: n && r,
|
|
503
|
-
apiKeyHeader: t.apiKeyHeader
|
|
504
|
-
};
|
|
505
|
-
}, Ke = {
|
|
506
|
-
model: h.Model,
|
|
507
|
-
toolset: h.Toolset,
|
|
508
|
-
application: h.Agent
|
|
509
|
-
}, qe = "applications/", Je = "toolsets/", G = "public", Ye = (e, t) => (e.startsWith(t) ? e.slice(t.length) : e).split("/").filter(Boolean).map(n), Xe = (e, t) => {
|
|
510
|
-
if (e.isMy) return [t.personal];
|
|
511
|
-
let n = Ye(e.applicationFolder ?? "", qe);
|
|
512
|
-
return e.sharedWithMe ? [t.shared, ...n.slice(1)] : n[0]?.toLowerCase() === G ? [t.public, ...n.slice(1)] : n;
|
|
513
|
-
}, Ze = (e, t) => {
|
|
514
|
-
if (e.isMy && t != null) return [t.personal];
|
|
515
|
-
let n = e.toolset || e.id;
|
|
516
|
-
if (!n.startsWith(Je)) return [];
|
|
517
|
-
let r = Ye(n, Je).slice(0, -1);
|
|
518
|
-
return e.sharedWithMe && t != null ? [t.shared, ...r.slice(1)] : r[0]?.toLowerCase() === G && t != null ? [t.public, ...r.slice(1)] : r.slice(1);
|
|
519
|
-
}, Qe = (e, { favoriteIds: t = /* @__PURE__ */ new Set(), entityDetails: n, folderLabels: r, editableSchemaIds: i = [], isCustomAppsEditable: a = !1, activeLocale: o, primaryLocale: s, resolveIconUrl: c }) => {
|
|
520
|
-
let l = u(e.displayName, o, s) || e.id, d = (e.type ?? "").toLowerCase();
|
|
521
|
-
return {
|
|
522
|
-
id: e.id,
|
|
523
|
-
type: Ke[d] ?? h.Model,
|
|
524
|
-
name: l,
|
|
525
|
-
description: u(e.description, o, s),
|
|
526
|
-
iconUrl: c(e.iconUrl),
|
|
527
|
-
version: e.displayVersion ?? "",
|
|
528
|
-
lastUsed: v(e.updatedAt),
|
|
529
|
-
updatedAt: e.updatedAt,
|
|
530
|
-
createdAt: e.createdAt,
|
|
531
|
-
isFeatured: e.isFeatured ?? !1,
|
|
532
|
-
isHidden: e.isHidden ?? !1,
|
|
533
|
-
topics: e.topics ?? [],
|
|
534
|
-
isUserFavorite: t.has(e.id),
|
|
535
|
-
isStarred: t.has(e.id),
|
|
536
|
-
isMyApp: e.isMy ?? !1,
|
|
537
|
-
sharedWithMe: e.sharedWithMe ?? !1,
|
|
538
|
-
isEditable: (!!e.isMy || !!e.canEdit) && (i.length > 0 && i.includes(e.applicationTypeSchemaId ?? "") || a && !e.applicationTypeSchemaId && d === "application"),
|
|
539
|
-
folder: Xe(e, r),
|
|
540
|
-
details: n == null ? void 0 : U(n),
|
|
541
|
-
supportsMcp: e.features?.mcp === !0,
|
|
542
|
-
supportsChat: e.interfaces == null || e.interfaces.includes("chat")
|
|
543
|
-
};
|
|
544
|
-
}, $e = (e, { favoriteIds: t = /* @__PURE__ */ new Set(), isAdmin: n = !1, folderLabels: r, activeLocale: i, primaryLocale: a, resolveIconUrl: o }) => {
|
|
545
|
-
let s = u(e.displayName, i, a) || e.toolset || e.reference || e.id, c = e.allowedTools ?? [];
|
|
546
|
-
return {
|
|
547
|
-
id: e.id,
|
|
548
|
-
type: h.Toolset,
|
|
549
|
-
name: s,
|
|
550
|
-
description: u(e.description, i, a),
|
|
551
|
-
iconUrl: o(e.iconUrl),
|
|
552
|
-
version: e.displayVersion ?? "",
|
|
553
|
-
lastUsed: v(e.updatedAt),
|
|
554
|
-
updatedAt: e.updatedAt,
|
|
555
|
-
createdAt: e.createdAt,
|
|
556
|
-
isFeatured: !1,
|
|
557
|
-
isHidden: !1,
|
|
558
|
-
topics: e.descriptionKeywords ?? [],
|
|
559
|
-
isUserFavorite: t.has(e.id),
|
|
560
|
-
isStarred: t.has(e.id),
|
|
561
|
-
isMyApp: e.isMy ?? !1,
|
|
562
|
-
sharedWithMe: e.sharedWithMe ?? !1,
|
|
563
|
-
isEditable: !!(e.isMy || e.canEdit),
|
|
564
|
-
folder: Ze(e, r),
|
|
565
|
-
credentials: Ge(e.id, e.authSettings, n),
|
|
566
|
-
details: c.length > 0 ? { tools: { tools: c.map((e) => ({ name: e })) } } : void 0
|
|
567
|
-
};
|
|
568
|
-
}, et = {
|
|
569
|
-
[d.Personal]: "personal",
|
|
570
|
-
[d.SharedWithMe]: "shared",
|
|
571
|
-
[d.Public]: "public"
|
|
572
|
-
}, tt = (e, t, r) => [r[et[t]], ...e.split("/").filter(Boolean).map(n)], K = (e, t) => {
|
|
573
|
-
let n = [];
|
|
574
|
-
return e.author && n.push({
|
|
575
|
-
label: t.authorLabel,
|
|
576
|
-
value: e.author
|
|
577
|
-
}), n.push({
|
|
578
|
-
label: t.updatedLabel,
|
|
579
|
-
value: f(e.updatedAt)
|
|
580
|
-
}), { sections: [{
|
|
581
|
-
title: t.sectionTitle,
|
|
582
|
-
specs: n
|
|
583
|
-
}] };
|
|
584
|
-
}, nt = (e) => !e.isMyApp && !e.sharedWithMe, rt = (e, { folderLabels: t, overviewLabels: n, source: r, favoriteIds: i }) => {
|
|
585
|
-
let a = r === d.Personal, o = e.id, s = i.has(o);
|
|
586
|
-
return {
|
|
587
|
-
id: o,
|
|
588
|
-
type: h.Prompt,
|
|
589
|
-
name: e.name,
|
|
590
|
-
description: e.description ?? "",
|
|
591
|
-
version: "",
|
|
592
|
-
lastUsed: v(e.updatedAt),
|
|
593
|
-
createdAt: e.createdAt,
|
|
594
|
-
updatedAt: e.updatedAt,
|
|
595
|
-
isFeatured: !1,
|
|
596
|
-
isHidden: !1,
|
|
597
|
-
topics: [],
|
|
598
|
-
isUserFavorite: s,
|
|
599
|
-
isStarred: s,
|
|
600
|
-
isMyApp: e.isMy ?? a,
|
|
601
|
-
sharedWithMe: e.sharedWithMe ?? r === d.SharedWithMe,
|
|
602
|
-
isEditable: r !== d.Public && (e.canEdit ?? a),
|
|
603
|
-
folder: tt(e.folderId, r, t),
|
|
604
|
-
details: {
|
|
605
|
-
...e.content ? { promptContent: { content: e.content } } : void 0,
|
|
606
|
-
overview: K(e, n)
|
|
607
|
-
}
|
|
608
|
-
};
|
|
609
|
-
}, q = /* @__PURE__ */ function(e) {
|
|
610
|
-
return e.Personal = "personal", e.SharedWithMe = "sharedWithMe", e.Public = "public", e;
|
|
611
|
-
}({}), it = "public", at = "skills/", ot = 256 * 1024, st = 1e3, ct = 10, J = (e) => {
|
|
612
|
-
if (!e.startsWith(at)) return null;
|
|
613
|
-
let t = e.slice(7), n = t.indexOf("/");
|
|
614
|
-
if (n <= 0) return null;
|
|
615
|
-
let r = t.slice(0, n), i = t.slice(n + 1);
|
|
616
|
-
return r === "" || i === "" ? null : {
|
|
617
|
-
bucket: r,
|
|
618
|
-
path: i
|
|
619
|
-
};
|
|
620
|
-
}, lt = {
|
|
621
|
-
[q.Personal]: "personal",
|
|
622
|
-
[q.SharedWithMe]: "shared",
|
|
623
|
-
[q.Public]: "public"
|
|
624
|
-
}, ut = (e, t, r) => [r[lt[t]], ...(e ?? "").split("/").filter(Boolean).map(n)], dt = (e, { folderLabels: t, source: n, favoriteIds: r }) => {
|
|
625
|
-
let i = r.has(e.url), a = n === q.Public, o = n === q.Personal;
|
|
626
|
-
return {
|
|
627
|
-
id: e.url,
|
|
628
|
-
type: h.Skill,
|
|
629
|
-
name: e.name,
|
|
630
|
-
description: "",
|
|
631
|
-
version: "",
|
|
632
|
-
lastUsed: v(e.updatedAt),
|
|
633
|
-
createdAt: e.createdAt,
|
|
634
|
-
updatedAt: e.updatedAt,
|
|
635
|
-
isFeatured: !1,
|
|
636
|
-
isHidden: !1,
|
|
637
|
-
topics: [],
|
|
638
|
-
isUserFavorite: i,
|
|
639
|
-
isStarred: i,
|
|
640
|
-
isMyApp: o && (e.isMy ?? !0),
|
|
641
|
-
sharedWithMe: e.sharedWithMe ?? n === q.SharedWithMe,
|
|
642
|
-
isEditable: !a && (e.canEdit ?? o),
|
|
643
|
-
folder: ut(e.parentPath, n, t)
|
|
644
|
-
};
|
|
645
|
-
}, ft = (e) => e.join(" · "), pt = (e, t) => {
|
|
646
|
-
if (e == null) return null;
|
|
647
|
-
let n = [];
|
|
648
|
-
return e.whenToUse != null && n.push({
|
|
649
|
-
label: t.whenToUseLabel,
|
|
650
|
-
value: e.whenToUse
|
|
651
|
-
}), e.allowedTools?.length && n.push({
|
|
652
|
-
label: t.allowedToolsLabel,
|
|
653
|
-
value: ft(e.allowedTools)
|
|
654
|
-
}), e.bundledResources?.length && n.push({
|
|
655
|
-
label: t.bundledResourcesLabel,
|
|
656
|
-
value: ft(e.bundledResources)
|
|
657
|
-
}), n.length === 0 ? null : {
|
|
658
|
-
title: t.specificationSectionTitle,
|
|
659
|
-
specs: n
|
|
660
|
-
};
|
|
661
|
-
}, mt = (e) => e.filter((e) => e.nodeType === te.Item), ht = (e, n) => {
|
|
662
|
-
let r = t(n), i = r ? `${r}/files` : "files";
|
|
663
|
-
return mt(e).find((e) => {
|
|
664
|
-
let n = t(e.path);
|
|
665
|
-
return n === "SKILL.md" || n === "files/SKILL.md" || n === `${i}/SKILL.md`;
|
|
666
|
-
})?.path ?? "SKILL.md";
|
|
667
|
-
}, gt = (e, n) => {
|
|
668
|
-
let r = t(e), i = t(n), a = i ? `${i}/files` : "files";
|
|
669
|
-
return r === "" || r === "files" || r === a ? null : r.startsWith(`${a}/`) ? r.slice(a.length + 1) : r.startsWith("files/") ? r.slice(6) : r;
|
|
670
|
-
}, Y = (e, t) => gt(e, t), _t = (e, t, n, r) => {
|
|
671
|
-
let i = [], a = pt(n, r);
|
|
672
|
-
a != null && i.push(a);
|
|
673
|
-
let o = [];
|
|
674
|
-
return e?.author && o.push({
|
|
675
|
-
label: r.authorLabel,
|
|
676
|
-
value: e.author
|
|
677
|
-
}), o.push({
|
|
678
|
-
label: r.updatedLabel,
|
|
679
|
-
value: e?.updatedAt ? f(e.updatedAt) : ""
|
|
680
|
-
}), o.push({
|
|
681
|
-
label: r.fileCountLabel,
|
|
682
|
-
value: String(mt(t).length)
|
|
683
|
-
}), i.push({
|
|
684
|
-
title: r.detailsSectionTitle,
|
|
685
|
-
specs: o
|
|
686
|
-
}), { sections: i };
|
|
687
|
-
}, X = (e, t, n) => {
|
|
688
|
-
if (e === "") return n;
|
|
689
|
-
let r = t.get(e);
|
|
690
|
-
if (r != null) return r.items;
|
|
691
|
-
let i = e.split("/"), a = X(i.slice(0, -1).join("/"), t, n), o = {
|
|
692
|
-
type: E.Folder,
|
|
693
|
-
id: e,
|
|
694
|
-
name: i[i.length - 1],
|
|
695
|
-
items: []
|
|
696
|
-
};
|
|
697
|
-
return t.set(e, o), a.push(o), o.items;
|
|
698
|
-
}, vt = (e, t) => {
|
|
699
|
-
e.sort((e, n) => {
|
|
700
|
-
if (t) {
|
|
701
|
-
if (e.name === "SKILL.md") return -1;
|
|
702
|
-
if (n.name === "SKILL.md") return 1;
|
|
703
|
-
}
|
|
704
|
-
return e.name.localeCompare(n.name);
|
|
705
|
-
});
|
|
706
|
-
for (let t of e) t.type === E.Folder && vt(t.items, !1);
|
|
707
|
-
}, yt = (e, t) => {
|
|
708
|
-
let n = /* @__PURE__ */ new Map(), r = [];
|
|
709
|
-
for (let i of e) {
|
|
710
|
-
let e = gt(i.path, t);
|
|
711
|
-
if (e == null) continue;
|
|
712
|
-
if (i.nodeType === te.Folder) {
|
|
713
|
-
X(e, n, r);
|
|
714
|
-
continue;
|
|
715
|
-
}
|
|
716
|
-
let a = e.lastIndexOf("/");
|
|
717
|
-
X(a === -1 ? "" : e.slice(0, a), n, r).push({
|
|
718
|
-
type: E.File,
|
|
719
|
-
id: i.path,
|
|
720
|
-
name: i.name
|
|
721
|
-
});
|
|
722
|
-
}
|
|
723
|
-
return vt(r, !0), r;
|
|
724
|
-
}, Z = async (e) => {
|
|
725
|
-
let t = Number(e.headers.get("content-length"));
|
|
726
|
-
if (Number.isFinite(t) && t > 262144) return null;
|
|
727
|
-
let n = await e.arrayBuffer();
|
|
728
|
-
return n.byteLength > 262144 ? null : new Uint8Array(n);
|
|
729
|
-
}, Q = async (e) => {
|
|
730
|
-
let t = await Z(e);
|
|
731
|
-
return t == null ? null : new TextDecoder().decode(t);
|
|
732
|
-
}, bt = /* @__PURE__ */ function(e) {
|
|
733
|
-
return e.Toolset = "toolset", e.Application = "application", e;
|
|
734
|
-
}({}), xt = (e) => {
|
|
735
|
-
try {
|
|
736
|
-
return decodeURIComponent(e);
|
|
737
|
-
} catch {
|
|
738
|
-
return e;
|
|
739
|
-
}
|
|
740
|
-
}, St = (e) => e.split("/").map((e) => encodeURIComponent(xt(e))).join("/"), Ct = (e) => e.endsWith("/") ? e.slice(0, -1) : e, wt = (e, t) => `${Ct(e)}/v1/toolset/${St(t)}/mcp`, Tt = (e, t) => `${Ct(e)}/v1/deployments/${St(t)}/mcp`, Et = {
|
|
741
|
-
toolset: wt,
|
|
742
|
-
application: Tt
|
|
743
|
-
}, Dt = (e, t) => e === h.Toolset ? "toolset" : e === h.Agent && t === !0 ? "application" : null, Ot = (e, t, n) => {
|
|
744
|
-
let r = Et[n](e, t);
|
|
745
|
-
return {
|
|
746
|
-
resource: { endpointUrl: r },
|
|
747
|
-
snippets: [{
|
|
748
|
-
language: O.Curl,
|
|
749
|
-
code: `curl -X POST ${r} \\\n -H 'Content-Type: application/json' \\\n -H 'Api-Key: <key>' \\\n -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'`
|
|
750
|
-
}]
|
|
751
|
-
};
|
|
752
|
-
}, kt = {
|
|
753
|
-
[h.Model]: "model",
|
|
754
|
-
[h.Toolset]: "toolset",
|
|
755
|
-
[h.Agent]: "application",
|
|
756
|
-
[h.Prompt]: "prompt",
|
|
757
|
-
[h.Skill]: "skill"
|
|
758
|
-
}, At = (e) => kt[e], jt = (e) => ({
|
|
759
|
-
version: e.version,
|
|
760
|
-
publishedAt: Date.parse(e.publishedAt),
|
|
761
|
-
folderPath: e.folderPath.split("/").filter(Boolean)
|
|
762
|
-
}), Mt = (e) => ({
|
|
763
|
-
publishedAt: Date.parse(e.publishedAt),
|
|
764
|
-
folderPath: e.folderPath.split("/").filter(Boolean)
|
|
765
|
-
}), Nt = (e, t) => e.filter((e) => t.has(e.type)), Pt = (e, t) => t ? e.filter((e) => !e.isMyApp) : [...e], Ft = (e) => e.filter((e) => e.isUserFavorite), It = (e, t) => {
|
|
766
|
-
let n = new Set(e.map((e) => e.type));
|
|
767
|
-
return t.filter((e) => n.has(e));
|
|
768
|
-
}, Lt = (e, t) => {
|
|
769
|
-
let n = new Set(t.flatMap((e) => e.topics));
|
|
770
|
-
return new Set(Array.from(e).filter((e) => n.has(e)));
|
|
771
|
-
}, Rt = /* @__PURE__ */ function(e) {
|
|
772
|
-
return e.Deployment = "deployment", e.Prompt = "prompt", e;
|
|
773
|
-
}({}), zt = async (e, t) => {
|
|
774
|
-
if (e.type !== h.Prompt) return {
|
|
775
|
-
kind: "deployment",
|
|
776
|
-
id: e.id
|
|
777
|
-
};
|
|
778
|
-
let n = e.details?.promptContent?.content;
|
|
779
|
-
return n ??= (await t(e)).content, {
|
|
780
|
-
kind: "prompt",
|
|
781
|
-
id: e.id,
|
|
782
|
-
name: e.name,
|
|
783
|
-
description: e.description,
|
|
784
|
-
content: n,
|
|
785
|
-
hasParameters: g(n).length > 0
|
|
786
|
-
};
|
|
787
|
-
}, Bt = ({ deployments: t, isCustomAppsEnabled: n, isSchemaAppsEnabled: i, isHideCustomAppCreationEnabled: a, isToolsetsEnabled: o, isPromptsEnabled: s, quickAppSchemaId: c, urls: l, onNavigate: u, deletePrompt: d, deleteToolset: f, deleteSkill: p, deleteApplication: m, refetchPrompts: g, refetchToolsets: _, refetchSkills: v, refetchDeployments: y, onDeleteSuccess: x, labels: C, onNotify: w, triggerSkillArchivePicker: T }) => ({
|
|
788
|
-
handleEdit: b((e) => {
|
|
789
|
-
if (e.type === h.Prompt) {
|
|
790
|
-
u(l.buildPromptEditUrl(e.id));
|
|
791
|
-
return;
|
|
792
|
-
}
|
|
793
|
-
if (e.type === h.Skill) {
|
|
794
|
-
u(l.buildSkillEditUrl(e.id));
|
|
795
|
-
return;
|
|
796
|
-
}
|
|
797
|
-
if (e.type === h.Toolset) {
|
|
798
|
-
u(l.buildToolsetEditUrl(e.id));
|
|
799
|
-
return;
|
|
800
|
-
}
|
|
801
|
-
let i = r(t, e.id);
|
|
802
|
-
if (n && i != null && !i.applicationTypeSchemaId) {
|
|
803
|
-
u(l.buildCustomAppEditUrl(e.id));
|
|
804
|
-
return;
|
|
805
|
-
}
|
|
806
|
-
c && u(l.buildQuickAppEditUrl(c, e.id));
|
|
807
|
-
}, [
|
|
808
|
-
t,
|
|
809
|
-
n,
|
|
810
|
-
c,
|
|
811
|
-
u,
|
|
812
|
-
l
|
|
813
|
-
]),
|
|
814
|
-
handleDelete: b(async (t) => {
|
|
815
|
-
try {
|
|
816
|
-
if (t.type === h.Prompt) await d(t.id), await g();
|
|
817
|
-
else if (t.type === h.Toolset) await f(t.id), await _();
|
|
818
|
-
else if (t.type === h.Skill) {
|
|
819
|
-
let e = J(t.id);
|
|
820
|
-
if (e == null) throw Error(`Invalid skill resource url: ${t.id}`);
|
|
821
|
-
await p(e.bucket, e.path), await v();
|
|
822
|
-
} else await m(t.id), await y();
|
|
823
|
-
x(t);
|
|
824
|
-
} catch (t) {
|
|
825
|
-
let { traceId: n } = await e(t);
|
|
826
|
-
throw w({
|
|
827
|
-
message: C.deleteError,
|
|
828
|
-
requestId: n
|
|
829
|
-
}), t;
|
|
830
|
-
}
|
|
831
|
-
}, [
|
|
832
|
-
d,
|
|
833
|
-
f,
|
|
834
|
-
p,
|
|
835
|
-
m,
|
|
836
|
-
_,
|
|
837
|
-
y,
|
|
838
|
-
g,
|
|
839
|
-
v,
|
|
840
|
-
x,
|
|
841
|
-
C,
|
|
842
|
-
w
|
|
843
|
-
]),
|
|
844
|
-
createOptions: S(() => {
|
|
845
|
-
let e = [];
|
|
846
|
-
return c && i && !a && e.push({
|
|
847
|
-
key: "quick-app",
|
|
848
|
-
label: C.createQuickApp,
|
|
849
|
-
onClick: () => u(l.buildQuickAppCreateUrl(c))
|
|
850
|
-
}), o && e.push({
|
|
851
|
-
key: "toolset",
|
|
852
|
-
label: C.createToolset,
|
|
853
|
-
onClick: () => u(l.buildToolsetCreateUrl())
|
|
854
|
-
}), n && !a && e.push({
|
|
855
|
-
key: "custom-app",
|
|
856
|
-
label: C.createCustomApp,
|
|
857
|
-
onClick: () => u(l.buildCustomAppCreateUrl())
|
|
858
|
-
}), e.push({
|
|
859
|
-
key: "skill",
|
|
860
|
-
label: C.createSkill,
|
|
861
|
-
children: [{
|
|
862
|
-
key: "skill-write-instructions",
|
|
863
|
-
label: C.createSkillWriteInstructions,
|
|
864
|
-
onClick: () => u(l.buildSkillCreateUrl())
|
|
865
|
-
}, {
|
|
866
|
-
key: "skill-upload",
|
|
867
|
-
label: C.createSkillUpload,
|
|
868
|
-
onClick: T
|
|
869
|
-
}]
|
|
870
|
-
}), s && e.push({
|
|
871
|
-
key: "prompt",
|
|
872
|
-
label: C.createPrompt,
|
|
873
|
-
onClick: () => u(l.buildPromptCreateUrl())
|
|
874
|
-
}), e;
|
|
875
|
-
}, [
|
|
876
|
-
c,
|
|
877
|
-
u,
|
|
878
|
-
l,
|
|
879
|
-
s,
|
|
880
|
-
C,
|
|
881
|
-
i,
|
|
882
|
-
a,
|
|
883
|
-
o,
|
|
884
|
-
n,
|
|
885
|
-
T
|
|
886
|
-
])
|
|
887
|
-
}), Vt = (e) => (t) => {
|
|
888
|
-
if (!nt(t)) return e.getPrompt(t.id);
|
|
889
|
-
let n = l(t.id);
|
|
890
|
-
return e.getPublicPrompt(n?.path ?? t.id);
|
|
891
|
-
}, Ht = ({ api: e, skills: t, isAdmin: n, dialCoreExternalUrl: r, skillOverviewLabels: i, promptOverviewLabels: a, deploymentLimitsLabels: o }) => {
|
|
892
|
-
let s = C(null);
|
|
893
|
-
return {
|
|
894
|
-
onFetchDetails: b(async (c) => {
|
|
895
|
-
if (c.type === h.Prompt) try {
|
|
896
|
-
let t = await Vt(e)(c);
|
|
897
|
-
return {
|
|
898
|
-
promptContent: { content: t.content },
|
|
899
|
-
overview: K(t, a)
|
|
900
|
-
};
|
|
901
|
-
} catch {
|
|
902
|
-
return;
|
|
903
|
-
}
|
|
904
|
-
if (c.type === h.Skill) {
|
|
905
|
-
let n = J(c.id);
|
|
906
|
-
if (n == null) return;
|
|
907
|
-
let { bucket: r, path: a } = n;
|
|
908
|
-
s.current = n;
|
|
909
|
-
let [o, l] = await Promise.allSettled([e.downloadSkillFile(r, a, p).then(Q), e.listSkillFiles({
|
|
910
|
-
bucket: r,
|
|
911
|
-
path: a,
|
|
912
|
-
filePath: "",
|
|
913
|
-
recursive: !0
|
|
914
|
-
})]), u = o.status === "fulfilled" && o.value != null ? m(o.value) : void 0, d = t.find((e) => e.url === c.id), f = l.status === "fulfilled" ? _t(d, l.value.items, u?.about, i) : void 0, h = l.status === "fulfilled" ? yt(l.value.items, a) : [], g = l.status === "fulfilled" ? ht(l.value.items, a) : p;
|
|
915
|
-
return u == null && f == null ? void 0 : {
|
|
916
|
-
...u == null ? {} : { promptContent: {
|
|
917
|
-
content: u.body,
|
|
918
|
-
...u.description == null ? {} : { description: u.description },
|
|
919
|
-
files: h,
|
|
920
|
-
selectedFileId: g
|
|
921
|
-
} },
|
|
922
|
-
...f == null ? {} : { overview: f }
|
|
923
|
-
};
|
|
924
|
-
}
|
|
925
|
-
try {
|
|
926
|
-
let t = c.type === h.Model ? e.getDeploymentLimits(c.id).catch(() => void 0) : Promise.resolve(void 0), [i, a] = await Promise.all([e.getDeploymentDetails(c.id), t]), s = He(i), l = U(s), u = Dt(c.type, c.supportsMcp), d = s.type === "MODEL" || s.type === "AGENT" ? fe(r ?? "", c.id, {
|
|
927
|
-
hasChatCompletion: s.data.capabilities?.hasChatCompletion,
|
|
928
|
-
hasResponsesApi: s.data.capabilities?.hasResponsesApi
|
|
929
|
-
}) : void 0;
|
|
930
|
-
return {
|
|
931
|
-
...l,
|
|
932
|
-
api: u == null ? d ?? l.api : Ot(r ?? "", c.id, u),
|
|
933
|
-
limits: L(a, o),
|
|
934
|
-
credentials: s.type === "TOOLSET" ? Ne(c.id, s.data, n) : void 0
|
|
935
|
-
};
|
|
936
|
-
} catch {
|
|
937
|
-
return;
|
|
938
|
-
}
|
|
939
|
-
}, [
|
|
940
|
-
e,
|
|
941
|
-
n,
|
|
942
|
-
o,
|
|
943
|
-
r,
|
|
944
|
-
t,
|
|
945
|
-
a,
|
|
946
|
-
i
|
|
947
|
-
]),
|
|
948
|
-
onLoadContentFile: b(async (t) => {
|
|
949
|
-
let n = s.current;
|
|
950
|
-
if (n == null) return;
|
|
951
|
-
let r = Y(t, n.path);
|
|
952
|
-
if (r == null) return;
|
|
953
|
-
let i = await Q(await e.downloadSkillFile(n.bucket, n.path, r));
|
|
954
|
-
if (i != null) return r === "SKILL.md" ? m(i).body : i;
|
|
955
|
-
}, [e]),
|
|
956
|
-
onLoadSkillDetailsFile: b(async (t) => {
|
|
957
|
-
let n = s.current;
|
|
958
|
-
if (n == null) throw Error("No skill details are open");
|
|
959
|
-
let r = Y(t, n.path);
|
|
960
|
-
if (r == null) throw Error("A folder cannot be previewed");
|
|
961
|
-
let i = await e.downloadSkillFile(n.bucket, n.path, r);
|
|
962
|
-
if (!i.ok) throw Object.assign(/* @__PURE__ */ Error(`File preview failed with status ${i.status}`), { status: i.status });
|
|
963
|
-
let a = await Z(i);
|
|
964
|
-
if (a == null) throw Error("File exceeds the preview size limit");
|
|
965
|
-
let o = i.headers.get("content-type")?.split(";")[0].trim() || void 0;
|
|
966
|
-
return {
|
|
967
|
-
bytes: a,
|
|
968
|
-
mimeType: o === "application/octet-stream" ? void 0 : o
|
|
969
|
-
};
|
|
970
|
-
}, [e])
|
|
971
|
-
};
|
|
972
|
-
}, $ = (e, t, n) => e === A.User ? n.user : t ? n.org : n.global, Ut = (e) => {
|
|
973
|
-
switch (e) {
|
|
974
|
-
case j.ApiKey: return o.ApiKey;
|
|
975
|
-
case j.OAuth: return o.OAuth;
|
|
976
|
-
case j.None:
|
|
977
|
-
case void 0: return o.None;
|
|
978
|
-
}
|
|
979
|
-
}, Wt = ({ isAdmin: t, toolsets: n, refetchToolsets: r, callbackPath: i, loginToolset: o, logoutToolset: l, getToolset: u, labels: d, onNotify: f }) => {
|
|
980
|
-
let p = b((e, t) => t === A.User ? e.credentials?.userStatus : e.credentials?.globalStatus, []), m = b((e, n) => {
|
|
981
|
-
let r = t && !!e.credentials?.isPublic;
|
|
982
|
-
if (e.credentials?.authenticationType === j.ApiKey) {
|
|
983
|
-
let t = $(n, r, d.apiKeyAddedSuccess);
|
|
984
|
-
f({
|
|
985
|
-
variant: M.Success,
|
|
986
|
-
title: d.apiKeyAddedSuccessTitle,
|
|
987
|
-
message: t({
|
|
988
|
-
name: e.name,
|
|
989
|
-
version: e.version
|
|
990
|
-
})
|
|
991
|
-
});
|
|
992
|
-
return;
|
|
993
|
-
}
|
|
994
|
-
let i = $(n, r, d.loginSuccess);
|
|
995
|
-
f({
|
|
996
|
-
variant: M.Success,
|
|
997
|
-
title: d.loginSuccessTitle,
|
|
998
|
-
message: i({
|
|
999
|
-
name: e.name,
|
|
1000
|
-
version: e.version
|
|
1001
|
-
})
|
|
1002
|
-
});
|
|
1003
|
-
}, [
|
|
1004
|
-
t,
|
|
1005
|
-
d,
|
|
1006
|
-
f
|
|
1007
|
-
]), h = b((e, n) => {
|
|
1008
|
-
let r = t && !!e.credentials?.isPublic;
|
|
1009
|
-
if (e.credentials?.authenticationType === j.ApiKey) {
|
|
1010
|
-
let t = $(n, r, d.apiKeyDeletedSuccess);
|
|
1011
|
-
f({
|
|
1012
|
-
variant: M.Success,
|
|
1013
|
-
title: d.apiKeyDeletedSuccessTitle,
|
|
1014
|
-
message: t({
|
|
1015
|
-
name: e.name,
|
|
1016
|
-
version: e.version
|
|
1017
|
-
})
|
|
1018
|
-
});
|
|
1019
|
-
return;
|
|
1020
|
-
}
|
|
1021
|
-
let i = $(n, r, d.logoutSuccess);
|
|
1022
|
-
f({
|
|
1023
|
-
variant: M.Success,
|
|
1024
|
-
title: d.logoutSuccessTitle,
|
|
1025
|
-
message: i({
|
|
1026
|
-
name: e.name,
|
|
1027
|
-
version: e.version
|
|
1028
|
-
})
|
|
1029
|
-
});
|
|
1030
|
-
}, [
|
|
1031
|
-
t,
|
|
1032
|
-
d,
|
|
1033
|
-
f
|
|
1034
|
-
]), { login: g } = s({
|
|
1035
|
-
callbackPath: i,
|
|
1036
|
-
loginToolset: o,
|
|
1037
|
-
logoutToolset: l,
|
|
1038
|
-
getToolset: u
|
|
1039
|
-
});
|
|
1040
|
-
return {
|
|
1041
|
-
handleLogin: b(async (e, t) => {
|
|
1042
|
-
let i = e.credentials?.authenticationType, o = t.level === A.User ? a.User : a.Global, s = n.find((t) => t.id === e.id);
|
|
1043
|
-
switch ((await g({
|
|
1044
|
-
toolsetId: e.id,
|
|
1045
|
-
credentialsLevel: o,
|
|
1046
|
-
authenticationType: Ut(i),
|
|
1047
|
-
apiKey: t.apiKey,
|
|
1048
|
-
oauthSettings: {
|
|
1049
|
-
clientId: s?.authSettings?.clientId,
|
|
1050
|
-
authorizationEndpoint: s?.authSettings?.authorizationEndpoint,
|
|
1051
|
-
scopes: s?.authSettings?.scopesSupported,
|
|
1052
|
-
codeChallenge: s?.authSettings?.codeChallenge,
|
|
1053
|
-
codeChallengeMethod: s?.authSettings?.codeChallengeMethod
|
|
1054
|
-
},
|
|
1055
|
-
isCurrentlyFailed: p(e, t.level) === k.Failed
|
|
1056
|
-
})).type) {
|
|
1057
|
-
case c.Success:
|
|
1058
|
-
m(e, t.level), await r();
|
|
1059
|
-
return;
|
|
1060
|
-
case c.PopupBlocked:
|
|
1061
|
-
f({
|
|
1062
|
-
variant: M.Error,
|
|
1063
|
-
message: d.popupBlockedError
|
|
1064
|
-
});
|
|
1065
|
-
return;
|
|
1066
|
-
case c.Failure:
|
|
1067
|
-
f({
|
|
1068
|
-
variant: M.Error,
|
|
1069
|
-
message: d.loginFailedError
|
|
1070
|
-
});
|
|
1071
|
-
return;
|
|
1072
|
-
case c.Cancelled: return;
|
|
1073
|
-
}
|
|
1074
|
-
}, [
|
|
1075
|
-
n,
|
|
1076
|
-
d,
|
|
1077
|
-
f,
|
|
1078
|
-
p,
|
|
1079
|
-
m,
|
|
1080
|
-
r,
|
|
1081
|
-
g
|
|
1082
|
-
]),
|
|
1083
|
-
handleLogout: b(async (t, n) => {
|
|
1084
|
-
let i = n.level === A.User ? a.User : a.Global;
|
|
1085
|
-
try {
|
|
1086
|
-
let e = {
|
|
1087
|
-
url: t.id,
|
|
1088
|
-
credentialsLevel: i,
|
|
1089
|
-
authenticationType: t.credentials?.authenticationType
|
|
1090
|
-
};
|
|
1091
|
-
await l(t.id, e), h(t, n.level), await r();
|
|
1092
|
-
} catch (t) {
|
|
1093
|
-
let { traceId: n } = await e(t);
|
|
1094
|
-
f({
|
|
1095
|
-
variant: M.Error,
|
|
1096
|
-
message: d.logoutFailedError,
|
|
1097
|
-
requestId: n
|
|
1098
|
-
});
|
|
1099
|
-
}
|
|
1100
|
-
}, [
|
|
1101
|
-
l,
|
|
1102
|
-
d,
|
|
1103
|
-
f,
|
|
1104
|
-
h,
|
|
1105
|
-
r
|
|
1106
|
-
])
|
|
1107
|
-
};
|
|
1108
|
-
}, Gt = /* @__PURE__ */ function(e) {
|
|
1109
|
-
return e.Deployment = "deployment", e.Toolset = "toolset", e.Prompt = "prompt", e.Skill = "skill", e;
|
|
1110
|
-
}({}), Kt = ({ loadFavorites: e, updateFavorite: t }) => {
|
|
1111
|
-
let [n, r] = w(/* @__PURE__ */ new Set()), [i, a] = w(!0);
|
|
1112
|
-
x(() => {
|
|
1113
|
-
let t = { value: !1 };
|
|
1114
|
-
return (async () => {
|
|
1115
|
-
try {
|
|
1116
|
-
let n = await e();
|
|
1117
|
-
t.value || r(new Set([
|
|
1118
|
-
...n.deployments,
|
|
1119
|
-
...n.toolsets,
|
|
1120
|
-
...n.prompts,
|
|
1121
|
-
...n.skills
|
|
1122
|
-
]));
|
|
1123
|
-
} catch {} finally {
|
|
1124
|
-
t.value || a(!1);
|
|
1125
|
-
}
|
|
1126
|
-
})(), () => {
|
|
1127
|
-
t.value = !0;
|
|
1128
|
-
};
|
|
1129
|
-
}, [e]);
|
|
1130
|
-
let o = b(async (e, n, i = "deployment") => {
|
|
1131
|
-
r((t) => {
|
|
1132
|
-
let r = new Set(t);
|
|
1133
|
-
return n ? r.add(e) : r.delete(e), r;
|
|
1134
|
-
});
|
|
1135
|
-
try {
|
|
1136
|
-
await t(e, n, i);
|
|
1137
|
-
} catch (t) {
|
|
1138
|
-
throw r((t) => {
|
|
1139
|
-
let r = new Set(t);
|
|
1140
|
-
return n ? r.delete(e) : r.add(e), r;
|
|
1141
|
-
}), t;
|
|
1142
|
-
}
|
|
1143
|
-
}, [t]);
|
|
1144
|
-
return S(() => ({
|
|
1145
|
-
favoriteIds: n,
|
|
1146
|
-
isLoading: i,
|
|
1147
|
-
toggleFavorite: o
|
|
1148
|
-
}), [
|
|
1149
|
-
n,
|
|
1150
|
-
i,
|
|
1151
|
-
o
|
|
1152
|
-
]);
|
|
1153
|
-
}, qt = "Production", Jt = 50, Yt = (e, t, n) => {
|
|
1154
|
-
let r = e.get(t);
|
|
1155
|
-
return r == null ? [] : r.filter((e) => e.nodeType === ee.Folder).map((r) => {
|
|
1156
|
-
let i = r.name, a = [...n, i], o = `${t}${r.name}/`;
|
|
1157
|
-
return {
|
|
1158
|
-
path: a,
|
|
1159
|
-
name: i,
|
|
1160
|
-
children: e.has(o) ? Yt(e, o, a) : void 0
|
|
1161
|
-
};
|
|
1162
|
-
});
|
|
1163
|
-
}, Xt = ({ listPublicFiles: e, rememberedFolderKeys: t, onRememberedFolderKeysChange: n }) => {
|
|
1164
|
-
let [r, i] = w(() => /* @__PURE__ */ new Map()), [a, o] = w(() => /* @__PURE__ */ new Set()), [s, c] = w(() => /* @__PURE__ */ new Set()), [l, u] = w([]), d = S(() => {
|
|
1165
|
-
let e = /* @__PURE__ */ new Set();
|
|
1166
|
-
return a.forEach((t) => {
|
|
1167
|
-
let n = t ? `${t}/` : "";
|
|
1168
|
-
r.has(n) && e.add(t);
|
|
1169
|
-
}), e;
|
|
1170
|
-
}, [a, r]), f = b(async (t) => {
|
|
1171
|
-
c((e) => new Set(e).add(t));
|
|
1172
|
-
try {
|
|
1173
|
-
let { items: n } = await e({ path: t || void 0 });
|
|
1174
|
-
i((e) => new Map(e).set(t, n));
|
|
1175
|
-
} finally {
|
|
1176
|
-
c((e) => {
|
|
1177
|
-
let n = new Set(e);
|
|
1178
|
-
return n.delete(t), n;
|
|
1179
|
-
});
|
|
1180
|
-
}
|
|
1181
|
-
}, [e]);
|
|
1182
|
-
x(() => {
|
|
1183
|
-
f("");
|
|
1184
|
-
}, []);
|
|
1185
|
-
let p = b((e) => {
|
|
1186
|
-
o(e), e.forEach((e) => {
|
|
1187
|
-
let t = `${e}/`;
|
|
1188
|
-
!r.has(t) && !s.has(t) && f(t);
|
|
1189
|
-
});
|
|
1190
|
-
}, [
|
|
1191
|
-
r,
|
|
1192
|
-
s,
|
|
1193
|
-
f
|
|
1194
|
-
]), m = b((e, t) => {
|
|
1195
|
-
let n = ie([...e, t]);
|
|
1196
|
-
return u((e) => e.includes(n) ? e : [...e, n]), Promise.resolve();
|
|
1197
|
-
}, []), h = b((e) => {
|
|
1198
|
-
let r = ie(e), i = Array.isArray(t) ? t : [];
|
|
1199
|
-
!r || i.includes(r) || n?.([r, ...i].slice(0, Jt));
|
|
1200
|
-
}, [t, n]), g = b((e) => !e.includes(qt), []);
|
|
1201
|
-
return {
|
|
1202
|
-
folderItems: S(() => {
|
|
1203
|
-
let e = Array.isArray(t) ? t.filter((e) => typeof e == "string") : [];
|
|
1204
|
-
return re(Yt(r, "", []), [...e.map(ne), ...l.map(ne)]);
|
|
1205
|
-
}, [
|
|
1206
|
-
r,
|
|
1207
|
-
t,
|
|
1208
|
-
l
|
|
1209
|
-
]),
|
|
1210
|
-
expandedPaths: a,
|
|
1211
|
-
loadedPaths: d,
|
|
1212
|
-
loadingPaths: s,
|
|
1213
|
-
onExpandedPathsChange: p,
|
|
1214
|
-
onCreatePublishFolder: m,
|
|
1215
|
-
rememberPublishFolder: h,
|
|
1216
|
-
hasPublishWriteAccess: g
|
|
1217
|
-
};
|
|
1218
|
-
}, Zt = /* @__PURE__ */ function(e) {
|
|
1219
|
-
return e.Forbidden = "forbidden", e.Generic = "generic", e;
|
|
1220
|
-
}({}), Qt = ({ fileId: e, onLoadFile: t }) => {
|
|
1221
|
-
let [n, r] = w(!1), [i, a] = w(null), [o, s] = w(null);
|
|
1222
|
-
return x(() => {
|
|
1223
|
-
let n = !1;
|
|
1224
|
-
return r(!0), a(null), s(null), (async () => {
|
|
1225
|
-
try {
|
|
1226
|
-
let i = await t(e);
|
|
1227
|
-
if (n) return;
|
|
1228
|
-
a(i), r(!1);
|
|
1229
|
-
} catch (e) {
|
|
1230
|
-
if (n) return;
|
|
1231
|
-
let t = e.status;
|
|
1232
|
-
s(t === 403 ? "forbidden" : "generic"), r(!1);
|
|
1233
|
-
}
|
|
1234
|
-
})(), () => {
|
|
1235
|
-
n = !0;
|
|
1236
|
-
};
|
|
1237
|
-
}, [e, t]), {
|
|
1238
|
-
isLoading: n,
|
|
1239
|
-
content: i,
|
|
1240
|
-
error: o
|
|
1241
|
-
};
|
|
1242
|
-
};
|
|
1243
|
-
//#endregion
|
|
1244
|
-
export { oe as $, ht as A, Qe as B, Dt as C, Z as D, dt as E, q as F, U as G, $e as H, J as I, L as J, Ne as K, K as L, ct as M, st as N, Q as O, ot as P, de as Q, nt as R, wt as S, _t as T, Xe as U, Ge as V, He as W, ue as X, N as Y, fe as Z, jt as _, Kt as a, Tt as b, Bt as c, It as d, ae as et, Ft as f, Mt as g, Lt as h, Gt as i, it as j, Y as k, Rt as l, Pt as m, Qt as n, Wt as o, Nt as p, we as q, Xt as r, Ht as s, Zt as t, zt as u, At as v, yt as w, Ot as x, bt as y, rt as z };
|