@scalar/agent-chat 0.9.8 → 0.9.10
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/dist/App.vue.d.ts +6 -6
- package/dist/api.d.ts +8 -8
- package/dist/client-tools/execute-request.d.ts +7 -7
- package/dist/components/ErrorMessage.vue.d.ts +1 -1
- package/dist/components/RequestPreview.vue.d.ts +1 -1
- package/dist/components/ResponseBody/ResponseBody.vue.d.ts +1 -1
- package/dist/components/ResponseBody/ResponseBodyPreview.vue.d.ts +1 -1
- package/dist/components/UploadSection.vue.d.ts +1 -1
- package/dist/entities/error/helpers.d.ts +1 -1
- package/dist/entities/index.d.ts +9 -9
- package/dist/entities/index.js +2 -23
- package/dist/entities/tools/execute-request.d.ts +1 -1
- package/dist/entities-NWeuOkBB.js +28 -0
- package/dist/entities-NWeuOkBB.js.map +1 -0
- package/dist/hooks/use-chat-approvals.d.ts +1 -1
- package/dist/hooks/use-search.d.ts +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2064 -3
- package/dist/index.js.map +1 -0
- package/dist/package.json +3 -5
- package/dist/registry/add-documents-to-store.d.ts +5 -5
- package/dist/state/state.d.ts +7 -7
- package/dist/style.css +2 -1
- package/dist/views/Chat/Messages/AskForAuthentication.vue.d.ts +2 -2
- package/dist/views/Chat/Messages/ExecuteRequestTool.vue.d.ts +2 -2
- package/dist/views/Chat/Messages/GetMiniOpenAPIDocTool.vue.d.ts +2 -2
- package/dist/views/Chat/Messages/GetOpenAPISpecsSummary.vue.d.ts +2 -2
- package/package.json +15 -17
- package/dist/App.vue.js +0 -43
- package/dist/App.vue2.js +0 -4
- package/dist/Chat.vue.js +0 -55
- package/dist/Chat.vue2.js +0 -4
- package/dist/_virtual/_plugin-vue_export-helper.js +0 -9
- package/dist/api.js +0 -99
- package/dist/client-tools/execute-request.js +0 -98
- package/dist/components/ActionsDropdown.vue.js +0 -7
- package/dist/components/ActionsDropdown.vue2.js +0 -50
- package/dist/components/ApprovalSection.vue.js +0 -7
- package/dist/components/ApprovalSection.vue2.js +0 -33
- package/dist/components/AuthenticationProvided.vue.js +0 -13
- package/dist/components/AuthenticationRequired.vue.js +0 -13
- package/dist/components/AutosendPaused.vue.js +0 -13
- package/dist/components/BuildingRequest.vue.js +0 -24
- package/dist/components/ContextItem.vue.js +0 -7
- package/dist/components/ContextItem.vue2.js +0 -19
- package/dist/components/ErrorMessage.vue.js +0 -7
- package/dist/components/ErrorMessage.vue2.js +0 -25
- package/dist/components/FreeMessagesInfoSection.vue.js +0 -7
- package/dist/components/FreeMessagesInfoSection.vue2.js +0 -51
- package/dist/components/LoadingMiniOpenAPIDoc.vue.js +0 -14
- package/dist/components/LoadingOpenAPISpecsSummary.vue.js +0 -14
- package/dist/components/Logo.vue.js +0 -23
- package/dist/components/PaymentSection.vue.js +0 -7
- package/dist/components/PaymentSection.vue2.js +0 -30
- package/dist/components/RequestApproved.vue.js +0 -13
- package/dist/components/RequestFailed.vue.js +0 -24
- package/dist/components/RequestPreview.vue.js +0 -7
- package/dist/components/RequestPreview.vue2.js +0 -129
- package/dist/components/RequestRejected.vue.js +0 -22
- package/dist/components/RequestSuccess.vue.js +0 -13
- package/dist/components/ResponseBody/ResponseBody.vue.js +0 -41
- package/dist/components/ResponseBody/ResponseBody.vue2.js +0 -4
- package/dist/components/ResponseBody/ResponseBodyInfo.vue.js +0 -14
- package/dist/components/ResponseBody/ResponseBodyPreview.vue.js +0 -7
- package/dist/components/ResponseBody/ResponseBodyPreview.vue2.js +0 -65
- package/dist/components/ResponseBody/ResponseBodyRaw.vue.js +0 -20
- package/dist/components/ResponseBody/ResponseBodyRaw.vue2.js +0 -4
- package/dist/components/ResponseBody/ResponseBodyToggle.vue.js +0 -26
- package/dist/components/ResponseBody/ResponseBodyToggle.vue2.js +0 -4
- package/dist/components/ResponseBody/helpers/media-types.js +0 -129
- package/dist/components/ResponseBody/helpers/process-response-body.js +0 -33
- package/dist/components/SearchPopover.vue.js +0 -7
- package/dist/components/SearchPopover.vue2.js +0 -67
- package/dist/components/Selector.vue.js +0 -67
- package/dist/components/Selector.vue2.js +0 -4
- package/dist/components/SendingRequest.vue.js +0 -24
- package/dist/components/ServerSelector.vue.js +0 -63
- package/dist/components/ServerSelector.vue2.js +0 -4
- package/dist/components/UploadSection.vue.js +0 -7
- package/dist/components/UploadSection.vue2.js +0 -61
- package/dist/consts/urls.js +0 -10
- package/dist/entities/error/constants.js +0 -6
- package/dist/entities/error/helpers.js +0 -9
- package/dist/entities/prompt/constants.js +0 -4
- package/dist/entities/registry/document.js +0 -12
- package/dist/entities/tools/ask-for-authentication.js +0 -8
- package/dist/entities/tools/constants.js +0 -4
- package/dist/entities/tools/execute-request.js +0 -12
- package/dist/entities/tools/get-mini-openapi-spec.js +0 -8
- package/dist/entities/tools/get-openapi-spec-summary.js +0 -4
- package/dist/helpers.js +0 -67
- package/dist/hooks/use-agent-key-documents.js +0 -21
- package/dist/hooks/use-chat-approvals.js +0 -35
- package/dist/hooks/use-chat-error.js +0 -23
- package/dist/hooks/use-chat-pending-client-tool-parts.js +0 -12
- package/dist/hooks/use-chat-scroll.js +0 -16
- package/dist/hooks/use-curated-documents.js +0 -12
- package/dist/hooks/use-search.js +0 -21
- package/dist/hooks/use-signup-link.js +0 -12
- package/dist/hooks/use-term-and-conditions.js +0 -15
- package/dist/hooks/use-upload-tmp-document.js +0 -94
- package/dist/plugins/persistance.js +0 -23
- package/dist/registry/add-documents-to-store.js +0 -44
- package/dist/registry/create-document-name.js +0 -6
- package/dist/state/state.js +0 -200
- package/dist/views/Catalog/Catalog.vue.js +0 -8
- package/dist/views/Catalog/Catalog.vue2.js +0 -70
- package/dist/views/Chat/Chat.vue.js +0 -7
- package/dist/views/Chat/Chat.vue2.js +0 -78
- package/dist/views/Chat/Messages/AskForAuthentication.vue.js +0 -7
- package/dist/views/Chat/Messages/AskForAuthentication.vue2.js +0 -91
- package/dist/views/Chat/Messages/ExecuteRequestTool.vue.js +0 -7
- package/dist/views/Chat/Messages/ExecuteRequestTool.vue2.js +0 -24
- package/dist/views/Chat/Messages/GetMiniOpenAPIDocTool.vue.js +0 -7
- package/dist/views/Chat/Messages/GetMiniOpenAPIDocTool.vue2.js +0 -56
- package/dist/views/Chat/Messages/GetOpenAPISpecsSummary.vue.js +0 -26
- package/dist/views/Chat/Messages/GetOpenAPISpecsSummary.vue2.js +0 -4
- package/dist/views/Chat/Messages/Text.vue.js +0 -16
- package/dist/views/Chat/Messages/Text.vue2.js +0 -4
- package/dist/views/Layout.vue.js +0 -7
- package/dist/views/Layout.vue2.js +0 -25
- package/dist/views/PromptForm.vue.js +0 -7
- package/dist/views/PromptForm.vue2.js +0 -254
- package/dist/views/Settings/Auth.vue.js +0 -67
- package/dist/views/Settings/Auth.vue2.js +0 -4
- package/dist/views/Settings/DocSettings.vue.js +0 -7
- package/dist/views/Settings/DocSettings.vue2.js +0 -49
- package/dist/views/Settings/Settings.vue.js +0 -8
- package/dist/views/Settings/Settings.vue2.js +0 -79
- package/dist/views/Start.vue.js +0 -7
- package/dist/views/Start.vue2.js +0 -43
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { defineComponent as i, computed as u, createElementBlock as t, openBlock as o, normalizeClass as p, createCommentVNode as n, createVNode as s, unref as a, createTextVNode as d, toDisplayString as g } from "vue";
|
|
2
|
-
import { useLoadingState as m, ScalarLoading as S } from "@scalar/components";
|
|
3
|
-
import { ScalarIconCheck as y, ScalarIconXCircle as x } from "@scalar/icons";
|
|
4
|
-
const f = {
|
|
5
|
-
key: 0,
|
|
6
|
-
class: "flex items-center gap-1.5"
|
|
7
|
-
}, k = {
|
|
8
|
-
key: 0,
|
|
9
|
-
class: "uploadText"
|
|
10
|
-
}, h = {
|
|
11
|
-
key: 1,
|
|
12
|
-
class: "uploadText"
|
|
13
|
-
}, I = {
|
|
14
|
-
key: 2,
|
|
15
|
-
class: "uploadText"
|
|
16
|
-
}, T = {
|
|
17
|
-
key: 1,
|
|
18
|
-
class: "uploadText flex items-center gap-1.5"
|
|
19
|
-
}, C = {
|
|
20
|
-
key: 2,
|
|
21
|
-
class: "uploadText flex items-center gap-1.5"
|
|
22
|
-
}, v = /* @__PURE__ */ i({
|
|
23
|
-
__name: "UploadSection",
|
|
24
|
-
props: {
|
|
25
|
-
uploadState: {}
|
|
26
|
-
},
|
|
27
|
-
setup(e) {
|
|
28
|
-
const c = m(), r = u(
|
|
29
|
-
() => ["uploading", "processing", "loading"].includes(e.uploadState.type)
|
|
30
|
-
);
|
|
31
|
-
return (L, l) => (o(), t("div", {
|
|
32
|
-
class: p(["uploadSection", {
|
|
33
|
-
error: e.uploadState.type === "error",
|
|
34
|
-
done: e.uploadState.type === "done"
|
|
35
|
-
}])
|
|
36
|
-
}, [
|
|
37
|
-
r.value ? (o(), t("div", f, [
|
|
38
|
-
s(a(S), {
|
|
39
|
-
class: "text-blue",
|
|
40
|
-
loader: {
|
|
41
|
-
...a(c),
|
|
42
|
-
isLoading: !0
|
|
43
|
-
},
|
|
44
|
-
size: "lg"
|
|
45
|
-
}, null, 8, ["loader"]),
|
|
46
|
-
e.uploadState.type === "loading" ? (o(), t("strong", k, " Loading OpenAPI document… ")) : e.uploadState.type === "processing" ? (o(), t("strong", h, " Processing OpenAPI document… ")) : (o(), t("strong", I, " Uploading OpenAPI document… "))
|
|
47
|
-
])) : n("", !0),
|
|
48
|
-
e.uploadState.type === "done" ? (o(), t("strong", T, [
|
|
49
|
-
s(a(y), { class: "icon text-green" }),
|
|
50
|
-
l[0] || (l[0] = d(" Your OpenAPI document has been processed successfully. ", -1))
|
|
51
|
-
])) : n("", !0),
|
|
52
|
-
e.uploadState.type === "error" ? (o(), t("strong", C, [
|
|
53
|
-
s(a(x), { class: "icon text-red" }),
|
|
54
|
-
d(" " + g(e.uploadState.error), 1)
|
|
55
|
-
])) : n("", !0)
|
|
56
|
-
], 2));
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
export {
|
|
60
|
-
v as default
|
|
61
|
-
};
|
package/dist/consts/urls.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
const t = {
|
|
2
|
-
DEFAULT_PROXY_URL: "https://proxy.scalar.com",
|
|
3
|
-
PRIVACY_POLICY: "https://scalar.com/legal/privacy-policy",
|
|
4
|
-
TERMS_AND_CONDITIONS: "https://scalar.com/legal/terms-and-conditions",
|
|
5
|
-
AGENT_SCALAR_DOCUMENTATION: "https://scalar.com/products/agent/getting-started",
|
|
6
|
-
PROXY_SOURCE_CODE: "https://github.com/scalar/scalar/tree/main/projects/proxy-scalar-com"
|
|
7
|
-
};
|
|
8
|
-
export {
|
|
9
|
-
t as URLS
|
|
10
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { z as t } from "zod";
|
|
2
|
-
const o = "execute-request", n = t.object({
|
|
3
|
-
method: t.string(),
|
|
4
|
-
path: t.string(),
|
|
5
|
-
headers: t.record(t.string(), t.string()).optional(),
|
|
6
|
-
body: t.string().optional(),
|
|
7
|
-
documentIdentifier: t.string()
|
|
8
|
-
});
|
|
9
|
-
export {
|
|
10
|
-
o as EXECUTE_CLIENT_SIDE_REQUEST_TOOL_NAME,
|
|
11
|
-
n as executeClientSideRequestToolInputSchema
|
|
12
|
-
};
|
package/dist/helpers.js
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { mergeSecurity as c } from "@scalar/api-client/v2/blocks/scalar-auth-selector-block";
|
|
2
|
-
import { getSelectedServer as n } from "@scalar/api-client/v2/features/operation";
|
|
3
|
-
import { getServers as a } from "@scalar/api-client/v2/helpers";
|
|
4
|
-
import { safeLocalStorage as u, REFERENCE_LS_KEYS as i } from "@scalar/helpers/object/local-storage";
|
|
5
|
-
import { AuthSchema as m } from "@scalar/workspace-store/entities/auth";
|
|
6
|
-
import { coerceValue as S } from "@scalar/workspace-store/schemas/typebox-coerce";
|
|
7
|
-
function A(e) {
|
|
8
|
-
return Object.values(e.paths ?? {}).flatMap((t) => Object.values(t ?? {}));
|
|
9
|
-
}
|
|
10
|
-
function g(e, t, r) {
|
|
11
|
-
return Object.values(c(t?.components?.securitySchemes, {}, r, e));
|
|
12
|
-
}
|
|
13
|
-
function E(e) {
|
|
14
|
-
return Object.fromEntries(
|
|
15
|
-
Object.entries(e.workspace.documents).map(([t, r]) => {
|
|
16
|
-
const s = a(r.servers, {
|
|
17
|
-
documentUrl: r?.["x-scalar-original-source-url"]
|
|
18
|
-
});
|
|
19
|
-
return [
|
|
20
|
-
t,
|
|
21
|
-
{
|
|
22
|
-
activeServer: n(s, r["x-scalar-selected-server"]),
|
|
23
|
-
securitySchemes: g(t, r, e.auth)
|
|
24
|
-
}
|
|
25
|
-
];
|
|
26
|
-
})
|
|
27
|
-
);
|
|
28
|
-
}
|
|
29
|
-
const o = u(), h = () => {
|
|
30
|
-
const e = (t) => `${i.AUTH}-${t}`;
|
|
31
|
-
return {
|
|
32
|
-
/**
|
|
33
|
-
* Retrieves and coerces the authentication schemes stored in local storage.
|
|
34
|
-
*/
|
|
35
|
-
getAuth: (t) => {
|
|
36
|
-
const r = JSON.parse(o.getItem(e(t)) ?? "{}");
|
|
37
|
-
return S(m, r);
|
|
38
|
-
},
|
|
39
|
-
/**
|
|
40
|
-
* Stores the authentication schemes in local storage.
|
|
41
|
-
* @param value The Auth object to stringify and store.
|
|
42
|
-
*/
|
|
43
|
-
setAuth: (t, r) => {
|
|
44
|
-
o.setItem(e(t), JSON.stringify(r));
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
}, b = ({
|
|
48
|
-
documentName: e,
|
|
49
|
-
workspaceStore: t
|
|
50
|
-
}) => {
|
|
51
|
-
const s = h().getAuth(e);
|
|
52
|
-
t.auth.load({ [e]: s });
|
|
53
|
-
};
|
|
54
|
-
function j(e) {
|
|
55
|
-
try {
|
|
56
|
-
return JSON.parse(e);
|
|
57
|
-
} catch {
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
export {
|
|
62
|
-
h as authStorage,
|
|
63
|
-
E as createDocumentSettings,
|
|
64
|
-
A as getOperations,
|
|
65
|
-
b as restoreAuthSecretsFromStorage,
|
|
66
|
-
j as safeParseJson
|
|
67
|
-
};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { useToasts as c } from "@scalar/use-toasts";
|
|
2
|
-
import { onMounted as m } from "vue";
|
|
3
|
-
import { useState as i } from "../state/state.js";
|
|
4
|
-
function l() {
|
|
5
|
-
const { api: t, addDocument: o, mode: n, getAgentKey: s } = i(), { toast: r } = c();
|
|
6
|
-
m(async () => {
|
|
7
|
-
if (n !== "full" || !s)
|
|
8
|
-
return;
|
|
9
|
-
const e = await t.getKeyDocuments();
|
|
10
|
-
if (!e.success) {
|
|
11
|
-
r("Failed to fetch your OpenAPI document. The Agent key may be invalid.", "error");
|
|
12
|
-
return;
|
|
13
|
-
}
|
|
14
|
-
e.data.documents.forEach(
|
|
15
|
-
({ namespace: u, slug: a }) => o({ namespace: u, slug: a, removable: !1 })
|
|
16
|
-
);
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
export {
|
|
20
|
-
l as useAgentKeyDocuments
|
|
21
|
-
};
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { computed as p } from "vue";
|
|
2
|
-
import { executeRequestTool as i } from "../client-tools/execute-request.js";
|
|
3
|
-
import { createDocumentSettings as n } from "../helpers.js";
|
|
4
|
-
import { useState as m } from "../state/state.js";
|
|
5
|
-
import { EXECUTE_CLIENT_SIDE_REQUEST_TOOL_NAME as s } from "../entities/tools/execute-request.js";
|
|
6
|
-
function a(t) {
|
|
7
|
-
return t.type === `tool-${s}` && t.state === "input-available" && t.input?.method?.toLowerCase() !== "get";
|
|
8
|
-
}
|
|
9
|
-
function E() {
|
|
10
|
-
const t = m(), r = p(() => t.chat.messages.filter((e) => e.parts.some(a)).flatMap((e) => e.parts).filter(a));
|
|
11
|
-
async function u(e) {
|
|
12
|
-
const l = r.value.map(async (o) => {
|
|
13
|
-
if (!e)
|
|
14
|
-
return await t.chat.addToolOutput({
|
|
15
|
-
tool: s,
|
|
16
|
-
toolCallId: o.toolCallId,
|
|
17
|
-
state: "output-error",
|
|
18
|
-
errorText: "The user denied the request."
|
|
19
|
-
});
|
|
20
|
-
await i({
|
|
21
|
-
documentSettings: n(t.workspaceStore),
|
|
22
|
-
proxyUrl: t.proxyUrl.value,
|
|
23
|
-
input: o.input,
|
|
24
|
-
toolCallId: o.toolCallId,
|
|
25
|
-
chat: t.chat
|
|
26
|
-
});
|
|
27
|
-
});
|
|
28
|
-
await Promise.all(l);
|
|
29
|
-
}
|
|
30
|
-
return { approvalRequiredParts: r, respondToRequestApprovals: u };
|
|
31
|
-
}
|
|
32
|
-
export {
|
|
33
|
-
a as requestPartRequiresApproval,
|
|
34
|
-
E as useRequestApprovals
|
|
35
|
-
};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { computed as t } from "vue";
|
|
2
|
-
import { z as r } from "zod/mini";
|
|
3
|
-
import { safeParseJson as a } from "../helpers.js";
|
|
4
|
-
import { useState as n } from "../state/state.js";
|
|
5
|
-
const m = r.object({
|
|
6
|
-
message: r.string(),
|
|
7
|
-
code: r.string(),
|
|
8
|
-
status: r.optional(r.number())
|
|
9
|
-
});
|
|
10
|
-
function p() {
|
|
11
|
-
const { chat: e } = n();
|
|
12
|
-
return t(() => {
|
|
13
|
-
if (!e.error) return;
|
|
14
|
-
const o = a(e.error.message), s = m.safeParse(o);
|
|
15
|
-
return !o || !s.success ? {
|
|
16
|
-
message: e.error.message,
|
|
17
|
-
code: "UNKNOWN_ERROR"
|
|
18
|
-
} : s.data;
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
export {
|
|
22
|
-
p as useChatError
|
|
23
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { computed as o } from "vue";
|
|
2
|
-
import { useState as r } from "../state/state.js";
|
|
3
|
-
function n(t) {
|
|
4
|
-
return t.type.startsWith("tool") && t.state === "input-available";
|
|
5
|
-
}
|
|
6
|
-
function l() {
|
|
7
|
-
const t = r();
|
|
8
|
-
return { pendingClientToolParts: o(() => t.chat.messages.filter((e) => e.parts.some(n)).flatMap((e) => e.parts).filter(n)) };
|
|
9
|
-
}
|
|
10
|
-
export {
|
|
11
|
-
l as useChatPendingClientToolParts
|
|
12
|
-
};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { watch as r, nextTick as s } from "vue";
|
|
2
|
-
import { useState as n } from "../state/state.js";
|
|
3
|
-
function u() {
|
|
4
|
-
const e = n();
|
|
5
|
-
function o(a) {
|
|
6
|
-
const t = a?.parts.at(-1);
|
|
7
|
-
if (t && t.type === "text")
|
|
8
|
-
return t.text;
|
|
9
|
-
}
|
|
10
|
-
r([() => e.chat.status, () => o(e.chat.lastMessage)], async () => {
|
|
11
|
-
await s(), window.scrollTo(0, document.body.scrollHeight);
|
|
12
|
-
});
|
|
13
|
-
}
|
|
14
|
-
export {
|
|
15
|
-
u as useChatScroll
|
|
16
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { onMounted as s } from "vue";
|
|
2
|
-
import { useState as o } from "../state/state.js";
|
|
3
|
-
function r() {
|
|
4
|
-
const { api: e, curatedDocuments: u } = o();
|
|
5
|
-
s(async () => {
|
|
6
|
-
const t = await e.getCuratedDocuments();
|
|
7
|
-
t.success && (u.value = t.data.results);
|
|
8
|
-
});
|
|
9
|
-
}
|
|
10
|
-
export {
|
|
11
|
-
r as useCuratedDocuments
|
|
12
|
-
};
|
package/dist/hooks/use-search.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { useDebounceFn as a } from "@vueuse/core";
|
|
2
|
-
import { ref as u, computed as f } from "vue";
|
|
3
|
-
import { useState as i } from "../state/state.js";
|
|
4
|
-
function h() {
|
|
5
|
-
const { api: c } = i(), s = u(""), t = a(async (e) => {
|
|
6
|
-
const o = await c.search(e);
|
|
7
|
-
o.success && (r.value = o.data.results);
|
|
8
|
-
}, 200), n = f({
|
|
9
|
-
get: () => s.value,
|
|
10
|
-
set: (e) => {
|
|
11
|
-
t(e), s.value = e;
|
|
12
|
-
}
|
|
13
|
-
}), r = u([]);
|
|
14
|
-
return t(""), {
|
|
15
|
-
query: n,
|
|
16
|
-
results: r
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
export {
|
|
20
|
-
h as useSearch
|
|
21
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { computed as u } from "vue";
|
|
2
|
-
import { useState as i } from "../state/state.js";
|
|
3
|
-
function s() {
|
|
4
|
-
const { dashboardUrl: o, mode: t, uploadedTmpDocumentUrl: n } = i(), e = u(() => t === "full" ? o : n.value ? `${o}/register?flow=oss-agent&docUrl=${n.value}` : o);
|
|
5
|
-
function r() {
|
|
6
|
-
window.location.assign(e.value);
|
|
7
|
-
}
|
|
8
|
-
return { signupLink: e, navigateToSignup: r };
|
|
9
|
-
}
|
|
10
|
-
export {
|
|
11
|
-
s as useSignupLink
|
|
12
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { ref as r, onMounted as a } from "vue";
|
|
2
|
-
const t = "scalar/agent-terms-accepted";
|
|
3
|
-
function n() {
|
|
4
|
-
const e = r(!1);
|
|
5
|
-
a(() => {
|
|
6
|
-
e.value = localStorage.getItem(t) === "true";
|
|
7
|
-
});
|
|
8
|
-
function o() {
|
|
9
|
-
e.value = !0, localStorage.setItem(t, "true");
|
|
10
|
-
}
|
|
11
|
-
return { accepted: e, accept: o };
|
|
12
|
-
}
|
|
13
|
-
export {
|
|
14
|
-
n as useTermsAndConditions
|
|
15
|
-
};
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import { redirectToProxy as d } from "@scalar/helpers/url/redirect-to-proxy";
|
|
2
|
-
import { ref as g } from "vue";
|
|
3
|
-
import { z as r } from "zod/mini";
|
|
4
|
-
import { useState as f } from "../state/state.js";
|
|
5
|
-
const S = 5e3, a = "scalar-tmp-doc";
|
|
6
|
-
function y({ namespace: t, slug: e }) {
|
|
7
|
-
localStorage.setItem(a, JSON.stringify({ namespace: t, slug: e }));
|
|
8
|
-
}
|
|
9
|
-
function b() {
|
|
10
|
-
const t = localStorage.getItem(a);
|
|
11
|
-
if (t)
|
|
12
|
-
return r.object({
|
|
13
|
-
namespace: r.string(),
|
|
14
|
-
slug: r.string()
|
|
15
|
-
}).parse(JSON.parse(t));
|
|
16
|
-
}
|
|
17
|
-
function U() {
|
|
18
|
-
localStorage.getItem(a) && localStorage.removeItem(a);
|
|
19
|
-
}
|
|
20
|
-
function h() {
|
|
21
|
-
const t = f(), e = g();
|
|
22
|
-
function c(n) {
|
|
23
|
-
const s = `${t.baseUrl}${n}`;
|
|
24
|
-
return d(t.proxyUrl.value, s);
|
|
25
|
-
}
|
|
26
|
-
async function l(n, s = !1) {
|
|
27
|
-
try {
|
|
28
|
-
e.value = {
|
|
29
|
-
type: "uploading"
|
|
30
|
-
};
|
|
31
|
-
const u = await fetch(c(`/core/share/upload/apis${s ? "?source=agent" : ""}`), {
|
|
32
|
-
method: "POST",
|
|
33
|
-
headers: {
|
|
34
|
-
"Content-Type": "application/json"
|
|
35
|
-
},
|
|
36
|
-
body: JSON.stringify({ document: n })
|
|
37
|
-
});
|
|
38
|
-
if (!u.ok) {
|
|
39
|
-
e.value = {
|
|
40
|
-
type: "error",
|
|
41
|
-
error: "Failed to upload your OpenAPI document."
|
|
42
|
-
};
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
const p = await u.json(), { success: m, data: o } = r.object({ url: r.string(), namespace: r.string(), slug: r.string() }).safeParse(p);
|
|
46
|
-
if (!m) {
|
|
47
|
-
e.value = {
|
|
48
|
-
type: "error",
|
|
49
|
-
error: "Failed to process document."
|
|
50
|
-
};
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
e.value = {
|
|
54
|
-
type: "processing"
|
|
55
|
-
};
|
|
56
|
-
const i = await fetch(
|
|
57
|
-
c(`/vector/registry/embeddings/${o.namespace}/${o.slug}`),
|
|
58
|
-
{
|
|
59
|
-
method: "GET"
|
|
60
|
-
}
|
|
61
|
-
);
|
|
62
|
-
if (y({
|
|
63
|
-
namespace: o.namespace,
|
|
64
|
-
slug: o.slug
|
|
65
|
-
}), await t.addDocument({
|
|
66
|
-
namespace: o.namespace,
|
|
67
|
-
slug: o.slug,
|
|
68
|
-
removable: !1,
|
|
69
|
-
tmp: !0
|
|
70
|
-
}), !i.ok) {
|
|
71
|
-
e.value = {
|
|
72
|
-
type: "error",
|
|
73
|
-
error: "Failed to embed document."
|
|
74
|
-
};
|
|
75
|
-
return;
|
|
76
|
-
}
|
|
77
|
-
return e.value = { type: "done" }, t.uploadedTmpDocumentUrl.value = o.url, setTimeout(() => {
|
|
78
|
-
e.value = void 0;
|
|
79
|
-
}, S), o;
|
|
80
|
-
} catch {
|
|
81
|
-
e.value = { type: "error", error: "Failed to upload your OpenAPI document." };
|
|
82
|
-
return;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
return {
|
|
86
|
-
uploadTempDocument: l,
|
|
87
|
-
uploadState: e
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
export {
|
|
91
|
-
b as getTmpDocFromLocalStorage,
|
|
92
|
-
U as removeTmpDocFromLocalStorage,
|
|
93
|
-
h as useUploadTmpDocument
|
|
94
|
-
};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { debounce as c } from "@scalar/helpers/general/debounce";
|
|
2
|
-
import { authStorage as s } from "../helpers.js";
|
|
3
|
-
const h = ({
|
|
4
|
-
debounceDelay: o = 500,
|
|
5
|
-
maxWait: r = 1e4,
|
|
6
|
-
persistAuth: e = !1
|
|
7
|
-
}) => {
|
|
8
|
-
const { execute: n } = c({ delay: o, maxWait: r }), u = s(), a = () => typeof e == "function" ? e() : e;
|
|
9
|
-
return {
|
|
10
|
-
hooks: {
|
|
11
|
-
/**
|
|
12
|
-
* Handles all workspace state change events.
|
|
13
|
-
* Each write is debounced by a key to prevent frequent writes for the same entity.
|
|
14
|
-
*/
|
|
15
|
-
onWorkspaceStateChanges(t) {
|
|
16
|
-
a() && t.type === "auth" && n("auth", () => u.setAuth(t.documentName, t.value));
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
};
|
|
21
|
-
export {
|
|
22
|
-
h as persistencePlugin
|
|
23
|
-
};
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { bundle as f } from "@scalar/json-magic/bundle";
|
|
2
|
-
import { fetchUrls as l } from "@scalar/json-magic/bundle/plugins/browser";
|
|
3
|
-
import { n as p } from "neverpanic";
|
|
4
|
-
import { restoreAuthSecretsFromStorage as D } from "../helpers.js";
|
|
5
|
-
import { createDocumentName as h } from "./create-document-name.js";
|
|
6
|
-
import { createError as N } from "../entities/error/helpers.js";
|
|
7
|
-
const _ = p.safeFn(
|
|
8
|
-
async ({
|
|
9
|
-
namespace: t,
|
|
10
|
-
slug: r,
|
|
11
|
-
workspaceStore: o,
|
|
12
|
-
registryDocuments: m,
|
|
13
|
-
registryUrl: n,
|
|
14
|
-
config: c,
|
|
15
|
-
api: u,
|
|
16
|
-
removable: s
|
|
17
|
-
}) => {
|
|
18
|
-
const e = await u.getDocument({
|
|
19
|
-
namespace: t,
|
|
20
|
-
slug: r
|
|
21
|
-
});
|
|
22
|
-
if (!e.success)
|
|
23
|
-
return e;
|
|
24
|
-
m.value.push({ ...e.data, removable: s });
|
|
25
|
-
const i = new URL(`/@${t}/apis/${r}/latest`, n), d = await f(i.toString(), {
|
|
26
|
-
plugins: [l()],
|
|
27
|
-
treeShake: !1
|
|
28
|
-
}), a = h(t, r);
|
|
29
|
-
return await o.addDocument(
|
|
30
|
-
{
|
|
31
|
-
name: a,
|
|
32
|
-
document: d
|
|
33
|
-
},
|
|
34
|
-
c
|
|
35
|
-
), o.update("x-scalar-active-document", a), D({ documentName: a, workspaceStore: o }), {
|
|
36
|
-
success: !0,
|
|
37
|
-
data: e.data
|
|
38
|
-
};
|
|
39
|
-
},
|
|
40
|
-
(t) => N("UNABLE_TO_LOAD_DOCUMENT", t)
|
|
41
|
-
);
|
|
42
|
-
export {
|
|
43
|
-
_ as loadDocument
|
|
44
|
-
};
|