@scalar/agent-chat 0.4.8 → 0.5.3

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.
Files changed (77) hide show
  1. package/dist/App.vue.d.ts +56 -1
  2. package/dist/App.vue.d.ts.map +1 -1
  3. package/dist/App.vue.js +25 -20
  4. package/dist/Chat.vue.d.ts +5 -1
  5. package/dist/Chat.vue.d.ts.map +1 -1
  6. package/dist/Chat.vue.js +26 -22
  7. package/dist/client-tools/execute-request.d.ts +72 -0
  8. package/dist/client-tools/execute-request.d.ts.map +1 -0
  9. package/dist/client-tools/execute-request.js +92 -0
  10. package/dist/components/ActionsDropdown.vue.d.ts +17 -0
  11. package/dist/components/ActionsDropdown.vue.d.ts.map +1 -0
  12. package/dist/components/ActionsDropdown.vue.js +7 -0
  13. package/dist/components/ActionsDropdown.vue2.js +50 -0
  14. package/dist/components/RequestPreview.vue.d.ts +3 -3
  15. package/dist/components/RequestPreview.vue.d.ts.map +1 -1
  16. package/dist/components/RequestPreview.vue.js +1 -1
  17. package/dist/components/RequestPreview.vue2.js +31 -31
  18. package/dist/entities/index.d.ts +1 -1
  19. package/dist/entities/index.d.ts.map +1 -1
  20. package/dist/entities/index.js +16 -16
  21. package/dist/entities/registry/document.d.ts +1 -0
  22. package/dist/entities/registry/document.d.ts.map +1 -1
  23. package/dist/entities/tools/execute-request.d.ts +27 -34
  24. package/dist/entities/tools/execute-request.d.ts.map +1 -1
  25. package/dist/entities/tools/execute-request.js +5 -4
  26. package/dist/helpers.d.ts +36 -275
  27. package/dist/helpers.d.ts.map +1 -1
  28. package/dist/helpers.js +44 -86
  29. package/dist/hooks/use-chat-approvals.d.ts +17 -10
  30. package/dist/hooks/use-chat-approvals.d.ts.map +1 -1
  31. package/dist/hooks/use-chat-approvals.js +28 -15
  32. package/dist/hooks/use-search.d.ts +2 -0
  33. package/dist/hooks/use-search.d.ts.map +1 -1
  34. package/dist/index.d.ts +1 -0
  35. package/dist/index.d.ts.map +1 -1
  36. package/dist/package.json +2 -1
  37. package/dist/plugins/persistance.d.ts +16 -0
  38. package/dist/plugins/persistance.d.ts.map +1 -0
  39. package/dist/plugins/persistance.js +23 -0
  40. package/dist/state/state.d.ts +16 -5
  41. package/dist/state/state.d.ts.map +1 -1
  42. package/dist/state/state.js +148 -101
  43. package/dist/style.css +1 -1
  44. package/dist/views/Catalog/Catalog.vue.d.ts +7 -0
  45. package/dist/views/Catalog/Catalog.vue.d.ts.map +1 -0
  46. package/dist/views/Catalog/Catalog.vue.js +8 -0
  47. package/dist/views/Catalog/Catalog.vue2.js +70 -0
  48. package/dist/views/Chat/Chat.vue.d.ts +2 -0
  49. package/dist/views/Chat/Chat.vue.d.ts.map +1 -1
  50. package/dist/views/Chat/Chat.vue.js +2 -2
  51. package/dist/views/Chat/Chat.vue2.js +36 -35
  52. package/dist/views/Chat/Messages/AskForAuthentication.vue.d.ts.map +1 -1
  53. package/dist/views/Chat/Messages/AskForAuthentication.vue.js +2 -2
  54. package/dist/views/Chat/Messages/AskForAuthentication.vue2.js +50 -52
  55. package/dist/views/Chat/Messages/ExecuteRequestTool.vue.d.ts +2 -2
  56. package/dist/views/Chat/Messages/ExecuteRequestTool.vue.d.ts.map +1 -1
  57. package/dist/views/Chat/Messages/ExecuteRequestTool.vue.js +2 -2
  58. package/dist/views/Chat/Messages/ExecuteRequestTool.vue2.js +8 -7
  59. package/dist/views/Layout.vue.d.ts +2 -0
  60. package/dist/views/Layout.vue.d.ts.map +1 -1
  61. package/dist/views/Layout.vue.js +2 -2
  62. package/dist/views/Layout.vue2.js +16 -14
  63. package/dist/views/PromptForm.vue.d.ts +2 -0
  64. package/dist/views/PromptForm.vue.d.ts.map +1 -1
  65. package/dist/views/PromptForm.vue.js +1 -1
  66. package/dist/views/PromptForm.vue2.js +112 -99
  67. package/dist/views/Settings/Auth.vue.d.ts +2 -2
  68. package/dist/views/Settings/Auth.vue.d.ts.map +1 -1
  69. package/dist/views/Settings/Auth.vue.js +32 -32
  70. package/dist/views/Settings/DocSettings.vue.d.ts.map +1 -1
  71. package/dist/views/Settings/DocSettings.vue.js +1 -1
  72. package/dist/views/Settings/DocSettings.vue2.js +22 -21
  73. package/dist/views/Start.vue.d.ts +2 -0
  74. package/dist/views/Start.vue.d.ts.map +1 -1
  75. package/dist/views/Start.vue.js +2 -2
  76. package/dist/views/Start.vue2.js +22 -21
  77. package/package.json +8 -7
package/dist/App.vue.d.ts CHANGED
@@ -10,8 +10,63 @@ type __VLS_Props = {
10
10
  getAccessToken?: () => string;
11
11
  getAgentKey?: () => string;
12
12
  getActiveDocumentJson?: () => string;
13
+ isLoggedIn?: Ref<boolean>;
13
14
  prefilledMessage?: Ref<string>;
14
15
  };
15
- declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
16
+ declare const state: {
17
+ prompt: Ref<string>;
18
+ chat: import("@ai-sdk/vue").Chat<import("ai").UIMessage<unknown, import("ai").UIDataTypes, import("./state/state.js").Tools>>;
19
+ workspaceStore: import("@scalar/workspace-store/client").WorkspaceStore;
20
+ loading: import("vue").ComputedRef<boolean>;
21
+ settingsModal: import("@scalar/components").ModalState;
22
+ eventBus: import("@scalar/workspace-store/events").WorkspaceEventBus;
23
+ proxyUrl: Ref<string | undefined>;
24
+ config: import("vue").ComputedRef<import("@scalar/types/api-reference").ApiReferenceConfigurationRaw>;
25
+ registryUrl: string;
26
+ dashboardUrl: string;
27
+ baseUrl: string;
28
+ isLoggedIn?: Ref<boolean>;
29
+ registryDocuments: Ref<import("./entities/index.js").ApiMetadata[]>;
30
+ pendingDocuments: Ref<{
31
+ namespace: string;
32
+ slug: string;
33
+ }[]>;
34
+ mode: ChatMode;
35
+ terms: {
36
+ accepted: Ref<boolean>;
37
+ accept: () => void;
38
+ };
39
+ addDocument: (document: {
40
+ namespace: string;
41
+ slug: string;
42
+ removable?: boolean;
43
+ }) => Promise<void>;
44
+ addDocumentAsync: (document: {
45
+ namespace: string;
46
+ slug: string;
47
+ removable
48
+ /** @type {[typeof Chat, ]} */ ?: boolean;
49
+ }) => Promise<void>;
50
+ removeDocument: (document: {
51
+ namespace: string;
52
+ slug: string;
53
+ }) => void;
54
+ getAccessToken?: () => string;
55
+ getAgentKey?: () => string;
56
+ api: import("./api.js").Api;
57
+ uploadedTmpDocumentUrl: Ref<string | undefined>;
58
+ curatedDocuments: Ref<import("./entities/index.js").ApiMetadata[]>;
59
+ getActiveDocumentJson?: () => string;
60
+ };
61
+ export type ChatExposed = {
62
+ addDocumentAsync: typeof state.addDocumentAsync;
63
+ };
64
+ declare const _default: import("vue").DefineComponent<__VLS_Props, {
65
+ addDocumentAsync: typeof state.addDocumentAsync;
66
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
67
+ uploadApi: () => any;
68
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
69
+ onUploadApi?: (() => any) | undefined;
70
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
16
71
  export default _default;
17
72
  //# sourceMappingURL=App.vue.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"App.vue.d.ts","sourceRoot":"","sources":["../src/App.vue"],"names":[],"mappings":"AAoDA,OAAO,EAAW,KAAK,GAAG,EAAE,MAAM,KAAK,CAAA;AAGvC,OAAO,EAA6B,KAAK,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAChF,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,SAAS,CAAA;AAEvC,KAAK,WAAW,GAAG;IACjB,iBAAiB,EAAE,gBAAgB,EAAE,CAAA;IACrC,WAAW,EAAE,MAAM,CAAA;IACnB,YAAY,EAAE,MAAM,CAAA;IACpB,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,CAAC,EAAE,QAAQ,CAAA;IACf,cAAc,CAAC,EAAE,MAAM,MAAM,CAAA;IAC7B,WAAW,CAAC,EAAE,MAAM,MAAM,CAAA;IAC1B,qBAAqB,CAAC,EAAE,MAAM,MAAM,CAAA;IACpC,gBAAgB,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;CAC/B,CAAC;;AAmEF,wBAMG"}
1
+ {"version":3,"file":"App.vue.d.ts","sourceRoot":"","sources":["../src/App.vue"],"names":[],"mappings":"AAkEA,OAAO,EAAW,KAAK,GAAG,EAAE,MAAM,KAAK,CAAA;AAGvC,OAAO,EAA6B,KAAK,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAChF,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,SAAS,CAAA;AAEvC,KAAK,WAAW,GAAG;IACjB,iBAAiB,EAAE,gBAAgB,EAAE,CAAA;IACrC,WAAW,EAAE,MAAM,CAAA;IACnB,YAAY,EAAE,MAAM,CAAA;IACpB,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,CAAC,EAAE,QAAQ,CAAA;IACf,cAAc,CAAC,EAAE,MAAM,MAAM,CAAA;IAC7B,WAAW,CAAC,EAAE,MAAM,MAAM,CAAA;IAC1B,qBAAqB,CAAC,EAAE,MAAM,MAAM,CAAA;IACpC,UAAU,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC,CAAA;IACzB,gBAAgB,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;CAC/B,CAAC;AAmBF,QAAA,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;iBA+BV,CAAC;;;;;;QAIF,8BAA8B,CAAA,CAF7B;;;;;;;;;;;;CAtBC,CAAA;AAIF,MAAM,MAAM,WAAW,GAAG;IACxB,gBAAgB,EAAE,OAAO,KAAK,CAAC,gBAAgB,CAAA;CAChD,CAAA;;sBADmB,OAAO,KAAK,CAAC,gBAAgB;;;;;;AAyDjD,wBAQG"}
package/dist/App.vue.js CHANGED
@@ -1,7 +1,7 @@
1
- import { defineComponent as t, provide as r, createBlock as n, openBlock as c } from "vue";
2
- import o from "./Chat.vue.js";
3
- import { STATE_SYMBOL as s, createState as i } from "./state/state.js";
4
- const u = /* @__PURE__ */ t({
1
+ import { defineComponent as i, provide as r, createBlock as c, openBlock as a } from "vue";
2
+ import g from "./Chat.vue.js";
3
+ import { createState as d, STATE_SYMBOL as l } from "./state/state.js";
4
+ const f = /* @__PURE__ */ i({
5
5
  __name: "App",
6
6
  props: {
7
7
  registryDocuments: {},
@@ -12,25 +12,30 @@ const u = /* @__PURE__ */ t({
12
12
  getAccessToken: { type: Function },
13
13
  getAgentKey: { type: Function },
14
14
  getActiveDocumentJson: { type: Function },
15
+ isLoggedIn: {},
15
16
  prefilledMessage: {}
16
17
  },
17
- setup(e) {
18
- return r(
19
- s,
20
- i({
21
- getActiveDocumentJson: e.getActiveDocumentJson,
22
- initialRegistryDocuments: e.registryDocuments,
23
- prefilledMessageRef: e.prefilledMessage,
24
- registryUrl: e.registryUrl,
25
- baseUrl: e.baseUrl,
26
- mode: e.mode,
27
- getAccessToken: e.getAccessToken,
28
- getAgentKey: e.getAgentKey,
29
- dashboardUrl: e.dashboardUrl
30
- })
31
- ), (a, l) => (c(), n(o));
18
+ emits: ["uploadApi"],
19
+ setup(e, { expose: o }) {
20
+ const t = d({
21
+ getActiveDocumentJson: e.getActiveDocumentJson,
22
+ initialRegistryDocuments: e.registryDocuments,
23
+ prefilledMessageRef: e.prefilledMessage,
24
+ registryUrl: e.registryUrl,
25
+ baseUrl: e.baseUrl,
26
+ mode: e.mode,
27
+ getAccessToken: e.getAccessToken,
28
+ getAgentKey: e.getAgentKey,
29
+ isLoggedIn: e.isLoggedIn,
30
+ dashboardUrl: e.dashboardUrl
31
+ });
32
+ return r(l, t), o({
33
+ addDocumentAsync: t.addDocumentAsync
34
+ }), (s, n) => (a(), c(g, {
35
+ onUploadApi: n[0] || (n[0] = (m) => s.$emit("uploadApi"))
36
+ }));
32
37
  }
33
38
  });
34
39
  export {
35
- u as default
40
+ f as default
36
41
  };
@@ -1,3 +1,7 @@
1
- declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
1
+ declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
2
+ uploadApi: () => any;
3
+ }, string, import("vue").PublicProps, Readonly<{}> & Readonly<{
4
+ onUploadApi?: (() => any) | undefined;
5
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
2
6
  export default _default;
3
7
  //# sourceMappingURL=Chat.vue.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Chat.vue.d.ts","sourceRoot":"","sources":["../src/Chat.vue"],"names":[],"mappings":";AA+LA,wBAKG"}
1
+ {"version":3,"file":"Chat.vue.d.ts","sourceRoot":"","sources":["../src/Chat.vue"],"names":[],"mappings":";;;;;AAiNA,wBAMG"}
package/dist/Chat.vue.js CHANGED
@@ -1,47 +1,51 @@
1
- import { defineComponent as f, useTemplateRef as d, ref as g, onMounted as _, onBeforeUnmount as v, createElementBlock as S, openBlock as M, Fragment as h, createElementVNode as C, createVNode as n, unref as D } from "vue";
1
+ import { defineComponent as f, useTemplateRef as g, ref as v, onMounted as S, onBeforeUnmount as M, createElementBlock as _, openBlock as C, Fragment as A, createElementVNode as D, createVNode as a, unref as h } from "vue";
2
2
  import { createApiClientModal as w } from "@scalar/api-client/v2/features/modal";
3
3
  import { useAgentKeyDocuments as y } from "./hooks/use-agent-key-documents.js";
4
4
  import { useChatScroll as B } from "./hooks/use-chat-scroll.js";
5
5
  import { useCuratedDocuments as b } from "./hooks/use-curated-documents.js";
6
6
  import { getTmpDocFromLocalStorage as k } from "./hooks/use-upload-tmp-document.js";
7
7
  import { useState as x } from "./state/state.js";
8
- import A from "./views/Layout.vue.js";
9
- import E from "./views/Settings/Settings.vue.js";
10
- const F = { ref: "clientModal" }, H = /* @__PURE__ */ f({
8
+ import E from "./views/Layout.vue.js";
9
+ import F from "./views/Settings/Settings.vue.js";
10
+ const L = { ref: "clientModal" }, H = /* @__PURE__ */ f({
11
11
  __name: "Chat",
12
- setup(L) {
12
+ emits: ["uploadApi"],
13
+ setup(N) {
13
14
  const {
14
- chat: a,
15
+ chat: m,
15
16
  prompt: r,
16
- settingsModal: m,
17
- eventBus: l,
17
+ settingsModal: l,
18
+ eventBus: i,
18
19
  workspaceStore: u,
19
- config: c,
20
+ config: p,
20
21
  mode: s,
21
- addDocument: i
22
- } = x(), t = d("clientModal"), o = g(null);
23
- _(async () => {
22
+ addDocument: c
23
+ } = x(), t = g("clientModal"), o = v(null);
24
+ S(async () => {
24
25
  const e = k();
25
- s === "preview" && e && await i({
26
+ s === "preview" && e && await c({
26
27
  namespace: e.namespace,
27
28
  slug: e.slug,
28
29
  removable: !1
29
30
  }), t.value && (o.value = w({
30
31
  el: t.value,
31
- options: c,
32
- eventBus: l,
32
+ options: p,
33
+ eventBus: i,
33
34
  workspaceStore: u
34
35
  }));
35
- }), v(() => {
36
+ }), M(() => {
36
37
  o.value?.app.unmount();
37
38
  }), B(), y(), b();
38
- async function p() {
39
- await a.sendMessage({ text: r.value });
39
+ async function d() {
40
+ await m.sendMessage({ text: r.value });
40
41
  }
41
- return (e, N) => (M(), S(h, null, [
42
- C("div", F, null, 512),
43
- n(A, { onSubmit: p }),
44
- n(E, { modalState: D(m) }, null, 8, ["modalState"])
42
+ return (e, n) => (C(), _(A, null, [
43
+ D("div", L, null, 512),
44
+ a(E, {
45
+ onSubmit: d,
46
+ onUploadApi: n[0] || (n[0] = (R) => e.$emit("uploadApi"))
47
+ }),
48
+ a(F, { modalState: h(l) }, null, 8, ["modalState"])
45
49
  ], 64));
46
50
  }
47
51
  });
@@ -0,0 +1,72 @@
1
+ import type { Chat } from '@ai-sdk/vue';
2
+ import type { SecuritySchemeObjectSecret } from '@scalar/api-client/v2/blocks/scalar-auth-selector-block';
3
+ import type { ServerObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
4
+ import type { UIDataTypes, UIMessage } from 'ai';
5
+ import type { Tools } from '../state/state.js';
6
+ /**
7
+ * Executes an HTTP request with the specified options, including method, path, headers, and security schemes, and returns the processed response.
8
+ */
9
+ export declare const executeRequestTool: (args_0: {
10
+ documentSettings: Record<string, {
11
+ activeServer: ServerObject | null;
12
+ securitySchemes: SecuritySchemeObjectSecret[];
13
+ }>;
14
+ toolCallId: string;
15
+ chat: Chat<UIMessage<unknown, UIDataTypes, Tools>>;
16
+ input: {
17
+ method: string;
18
+ path: string;
19
+ headers?: Record<string, string>;
20
+ body?: string;
21
+ documentIdentifier: string;
22
+ };
23
+ }) => Promise<{
24
+ success: true;
25
+ data: never;
26
+ } | {
27
+ success: false;
28
+ error: import("../entities/index.js").AgentChatError<"FAILED_TO_PARSE_RESPONSE_BODY", {
29
+ originalError: unknown;
30
+ }>;
31
+ } | {
32
+ success: false;
33
+ error: import("../entities/index.js").AgentChatError<"REQUEST_NOT_OK", {
34
+ status: number;
35
+ url: string;
36
+ responseBody: any;
37
+ headers: {
38
+ [k: string]: string;
39
+ };
40
+ }>;
41
+ data?: undefined;
42
+ } | {
43
+ success: true;
44
+ data: {
45
+ status: number;
46
+ responseBody: any;
47
+ headers: {
48
+ [k: string]: string;
49
+ };
50
+ };
51
+ error?: undefined;
52
+ } | {
53
+ success: false;
54
+ error: import("../entities/index.js").AgentChatError<"FAILED_TO_FETCH", {
55
+ originalError: unknown;
56
+ }>;
57
+ } | {
58
+ success: false;
59
+ error: import("../entities/index.js").AgentChatError<"FAILED_TO_DETERMINE_DOCUMENT", {
60
+ namespace: string | undefined;
61
+ slug: string | undefined;
62
+ documentIdentifier: string;
63
+ }>;
64
+ } | {
65
+ success: false;
66
+ error: import("../entities/index.js").AgentChatError<"DOCUMENT_SETTINGS_COULD_NOT_BE_DETERMINED", {
67
+ documentName: string;
68
+ namespace: string;
69
+ slug: string;
70
+ }>;
71
+ }> | import("neverpanic").Result<never, import("../entities/index.js").AgentChatError<"FAILED_TO_EXECUTE_REQUEST", unknown>>;
72
+ //# sourceMappingURL=execute-request.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"execute-request.d.ts","sourceRoot":"","sources":["../../src/client-tools/execute-request.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AAEvC,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,yDAAyD,CAAA;AAEzG,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8DAA8D,CAAA;AAChG,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,IAAI,CAAA;AAOhD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AAsE1C;;GAEG;AACH,eAAO,MAAM,kBAAkB;sBAOT,MAAM,CACtB,MAAM,EACN;QAAE,YAAY,EAAE,YAAY,GAAG,IAAI,CAAC;QAAC,eAAe,EAAE,0BAA0B,EAAE,CAAA;KAAE,CACrF;gBACW,MAAM;UACZ,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,WAAW,EAAE,KAAK,CAAC,CAAC;WAC3C;QACL,MAAM,EAAE,MAAM,CAAA;QACd,IAAI,EAAE,MAAM,CAAA;QACZ,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;QAChC,IAAI,CAAC,EAAE,MAAM,CAAA;QACb,kBAAkB,EAAE,MAAM,CAAA;KAC3B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kHAqDJ,CAAA"}
@@ -0,0 +1,92 @@
1
+ import { buildRequestSecurity as S, getResolvedUrl as y } from "@scalar/api-client/v2/blocks/operation-block";
2
+ import { redirectToProxy as N } from "@scalar/helpers/url/redirect-to-proxy";
3
+ import { n as u } from "neverpanic";
4
+ import D from "truncate-json";
5
+ import { createError as o } from "../entities/error/helpers.js";
6
+ import { createDocumentName as R } from "../registry/create-document-name.js";
7
+ import { TOOL_NAMESPACE_SLUG_DELIMITER as h } from "../entities/tools/constants.js";
8
+ import { EXECUTE_CLIENT_SIDE_REQUEST_TOOL_NAME as U } from "../entities/tools/execute-request.js";
9
+ const v = 5e4, I = u.safeFn(
10
+ async (e) => e.headers.get("content-type") === "application/json" ? { success: !0, data: await e.json() } : { success: !0, data: await e.text() },
11
+ (e) => o("FAILED_TO_PARSE_RESPONSE_BODY", { originalError: e })
12
+ ), T = (e) => JSON.parse(D(JSON.stringify(e), v).jsonString), L = u.safeFn(
13
+ async (e, r) => {
14
+ const t = await fetch(e, r), s = await I(t);
15
+ return t.ok ? s.success ? {
16
+ success: !0,
17
+ data: {
18
+ status: t.status,
19
+ responseBody: T(s.data),
20
+ headers: Object.fromEntries(t.headers.entries())
21
+ }
22
+ } : s : {
23
+ success: !1,
24
+ error: o("REQUEST_NOT_OK", {
25
+ status: t.status,
26
+ url: t.url,
27
+ responseBody: T(s.success ? s.data : void 0),
28
+ headers: Object.fromEntries(t.headers.entries())
29
+ })
30
+ };
31
+ },
32
+ (e) => o("FAILED_TO_FETCH", { originalError: e })
33
+ );
34
+ function A({ path: e, activeServer: r }) {
35
+ const t = y({
36
+ path: e,
37
+ server: r,
38
+ pathVariables: {},
39
+ environment: {
40
+ color: "",
41
+ variables: []
42
+ }
43
+ });
44
+ return N("https://proxy.scalar.com", t);
45
+ }
46
+ const x = u.safeFn(
47
+ async ({
48
+ documentSettings: e,
49
+ toolCallId: r,
50
+ chat: t,
51
+ input: { method: s, path: l, body: f, headers: m, documentIdentifier: i }
52
+ }) => {
53
+ const [a, n] = i.split(h);
54
+ if (!a || !n)
55
+ return {
56
+ success: !1,
57
+ error: o("FAILED_TO_DETERMINE_DOCUMENT", { namespace: a, slug: n, documentIdentifier: i })
58
+ };
59
+ const E = R(a, n), c = e[E];
60
+ if (!c)
61
+ return {
62
+ success: !1,
63
+ error: o("DOCUMENT_SETTINGS_COULD_NOT_BE_DETERMINED", {
64
+ documentName: E,
65
+ namespace: a,
66
+ slug: n
67
+ })
68
+ };
69
+ const p = S(c.securitySchemes), O = {
70
+ method: s,
71
+ body: f,
72
+ ...p,
73
+ headers: {
74
+ ...m,
75
+ ...p.headers
76
+ }
77
+ }, d = A({
78
+ path: l,
79
+ activeServer: c.activeServer
80
+ }), _ = await L(d, O);
81
+ return t.addToolOutput({
82
+ tool: U,
83
+ toolCallId: r,
84
+ output: _,
85
+ state: "output-available"
86
+ }), _;
87
+ },
88
+ (e) => o("FAILED_TO_EXECUTE_REQUEST", e)
89
+ );
90
+ export {
91
+ x as executeRequestTool
92
+ };
@@ -0,0 +1,17 @@
1
+ declare var __VLS_5: {};
2
+ type __VLS_Slots = {} & {
3
+ default?: (props: typeof __VLS_5) => any;
4
+ };
5
+ declare const __VLS_component: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
6
+ uploadApi: () => any;
7
+ }, string, import("vue").PublicProps, Readonly<{}> & Readonly<{
8
+ onUploadApi?: (() => any) | undefined;
9
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
10
+ declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
11
+ export default _default;
12
+ type __VLS_WithSlots<T, S> = T & {
13
+ new (): {
14
+ $slots: S;
15
+ };
16
+ };
17
+ //# sourceMappingURL=ActionsDropdown.vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ActionsDropdown.vue.d.ts","sourceRoot":"","sources":["../../src/components/ActionsDropdown.vue"],"names":[],"mappings":"AAqKA,QAAA,IAAI,OAAO,IAAW,CAAE;AACxB,KAAK,WAAW,GAAG,EAAE,GACnB;IAAE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,OAAO,KAAK,GAAG,CAAA;CAAE,CAAC;AAwB/C,QAAA,MAAM,eAAe;;;;iFAMnB,CAAC;wBACkB,eAAe,CAAC,OAAO,eAAe,EAAE,WAAW,CAAC;AAAzE,wBAA0E;AAE1E,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
@@ -0,0 +1,7 @@
1
+ import o from "./ActionsDropdown.vue2.js";
2
+ /* empty css */
3
+ import t from "../_virtual/_plugin-vue_export-helper.js";
4
+ const s = /* @__PURE__ */ t(o, [["__scopeId", "data-v-2d142bb5"]]);
5
+ export {
6
+ s as default
7
+ };
@@ -0,0 +1,50 @@
1
+ import { defineComponent as p, createElementBlock as u, openBlock as n, Fragment as f, createVNode as t, createBlock as c, createCommentVNode as w, unref as e, withCtx as r, renderSlot as C, createElementVNode as d, createTextVNode as s } from "vue";
2
+ import { useModal as g, ScalarDropdown as k, ScalarDropdownItem as i } from "@scalar/components";
3
+ import { ScalarIconUpload as A, ScalarIconMagnifyingGlass as S } from "@scalar/icons";
4
+ import v from "../views/Catalog/Catalog.vue.js";
5
+ const _ = { class: "dropdown-item" }, x = { class: "dropdown-item" }, D = /* @__PURE__ */ p({
6
+ __name: "ActionsDropdown",
7
+ emits: ["uploadApi"],
8
+ setup(I) {
9
+ const a = g();
10
+ return (l, o) => (n(), u(f, null, [
11
+ t(e(k), { offset: { crossAxis: -5, mainAxis: 5 } }, {
12
+ items: r(() => [
13
+ t(e(i), {
14
+ onClick: o[0] || (o[0] = (m) => l.$emit("uploadApi"))
15
+ }, {
16
+ default: r(() => [
17
+ d("div", _, [
18
+ t(e(A)),
19
+ o[2] || (o[2] = s(" Upload API ", -1))
20
+ ])
21
+ ]),
22
+ _: 1
23
+ }),
24
+ t(e(i), {
25
+ onClick: o[1] || (o[1] = (m) => e(a).show())
26
+ }, {
27
+ default: r(() => [
28
+ d("div", x, [
29
+ t(e(S)),
30
+ o[3] || (o[3] = s(" Search Catalog ", -1))
31
+ ])
32
+ ]),
33
+ _: 1
34
+ })
35
+ ]),
36
+ default: r(() => [
37
+ C(l.$slots, "default", {}, void 0, !0)
38
+ ]),
39
+ _: 3
40
+ }),
41
+ e(a).open ? (n(), c(v, {
42
+ key: 0,
43
+ modal: e(a)
44
+ }, null, 8, ["modal"])) : w("", !0)
45
+ ], 64));
46
+ }
47
+ });
48
+ export {
49
+ D as default
50
+ };
@@ -1,8 +1,8 @@
1
1
  import { type DeepPartial } from 'ai';
2
- import type { ExecuteRequestToolInput, ExecuteRequestToolOutput } from '../entities/tools/execute-request.js';
2
+ import type { ExecuteClientSideRequestToolInput, ExecuteClientSideRequestToolOutput } from '../entities/tools/execute-request.js';
3
3
  type __VLS_Props = {
4
- request?: ExecuteRequestToolInput | DeepPartial<ExecuteRequestToolInput>;
5
- response?: ExecuteRequestToolOutput;
4
+ request?: ExecuteClientSideRequestToolInput | DeepPartial<ExecuteClientSideRequestToolInput>;
5
+ response?: ExecuteClientSideRequestToolOutput;
6
6
  state: 'requiresApproval' | 'sendingRequest' | 'requestSucceeded' | 'requestFailed' | 'approved' | 'rejected';
7
7
  };
8
8
  declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
@@ -1 +1 @@
1
- {"version":3,"file":"RequestPreview.vue.d.ts","sourceRoot":"","sources":["../../src/components/RequestPreview.vue"],"names":[],"mappings":"AAuQA,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,IAAI,CAAA;AAarC,OAAO,KAAK,EACV,uBAAuB,EACvB,wBAAwB,EACzB,MAAM,kCAAkC,CAAA;AAEzC,KAAK,WAAW,GAAG;IACjB,OAAO,CAAC,EAAE,uBAAuB,GAAG,WAAW,CAAC,uBAAuB,CAAC,CAAA;IACxE,QAAQ,CAAC,EAAE,wBAAwB,CAAA;IACnC,KAAK,EACD,kBAAkB,GAClB,gBAAgB,GAChB,kBAAkB,GAClB,eAAe,GACf,UAAU,GACV,UAAU,CAAA;CACf,CAAC;;AAiWF,wBAMG"}
1
+ {"version":3,"file":"RequestPreview.vue.d.ts","sourceRoot":"","sources":["../../src/components/RequestPreview.vue"],"names":[],"mappings":"AAyQA,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,IAAI,CAAA;AAarC,OAAO,KAAK,EACV,iCAAiC,EACjC,kCAAkC,EACnC,MAAM,kCAAkC,CAAA;AAEzC,KAAK,WAAW,GAAG;IACjB,OAAO,CAAC,EACJ,iCAAiC,GACjC,WAAW,CAAC,iCAAiC,CAAC,CAAA;IAClD,QAAQ,CAAC,EAAE,kCAAkC,CAAA;IAC7C,KAAK,EACD,kBAAkB,GAClB,gBAAgB,GAChB,kBAAkB,GAClB,eAAe,GACf,UAAU,GACV,UAAU,CAAA;CACf,CAAC;;AAiWF,wBAMG"}
@@ -1,7 +1,7 @@
1
1
  import o from "./RequestPreview.vue2.js";
2
2
  /* empty css */
3
3
  import t from "../_virtual/_plugin-vue_export-helper.js";
4
- const m = /* @__PURE__ */ t(o, [["__scopeId", "data-v-6942a0a6"]]);
4
+ const m = /* @__PURE__ */ t(o, [["__scopeId", "data-v-f4245586"]]);
5
5
  export {
6
6
  m as default
7
7
  };
@@ -1,4 +1,4 @@
1
- import { defineComponent as w, computed as i, ref as R, createElementBlock as n, openBlock as t, normalizeClass as S, createBlock as o, createCommentVNode as f, createElementVNode as l, createVNode as d, unref as a } from "vue";
1
+ import { defineComponent as w, computed as i, ref as R, createElementBlock as r, openBlock as t, normalizeClass as S, createBlock as o, createCommentVNode as f, createElementVNode as l, createVNode as d, unref as n } from "vue";
2
2
  import { ScalarCodeBlock as h } from "@scalar/components";
3
3
  import { ScalarIconCaretDown as g, ScalarIconCaretRight as q } from "@scalar/icons";
4
4
  import T from "./AutosendPaused.vue.js";
@@ -28,75 +28,75 @@ const I = {
28
28
  state: {}
29
29
  },
30
30
  setup(e) {
31
- const c = i(() => {
32
- if (e.response?.structuredContent.success)
31
+ const v = i(() => {
32
+ if (e.response?.success)
33
33
  return {
34
- data: e.response.structuredContent.data.responseBody,
35
- headers: e.response.structuredContent.data.headers
34
+ data: e.response.data.responseBody,
35
+ headers: e.response.data.headers
36
36
  };
37
- if (e.response?.structuredContent.error?.code === "REQUEST_NOT_OK")
37
+ if (e.response?.error?.code === "REQUEST_NOT_OK")
38
38
  return {
39
- data: e.response.structuredContent.error.detail.responseBody,
40
- headers: e.response.structuredContent.error.detail.headers
39
+ data: e.response.error.detail.responseBody,
40
+ headers: e.response.error.detail.headers
41
41
  };
42
- }), r = R(!1), v = i(() => e.state === "requestFailed" || e.state === "requiresApproval" ? !0 : r.value), C = i(
42
+ }), a = R(!1), c = i(() => e.state === "requestFailed" || e.state === "requiresApproval" ? !0 : a.value), k = i(
43
43
  () => E({
44
- data: c.value?.data,
45
- headers: c.value?.headers
44
+ data: v.value?.data,
45
+ headers: v.value?.headers
46
46
  })
47
47
  ), u = i(
48
- () => A(C.value.mimeType?.essence ?? "")
48
+ () => A(k.value.mimeType?.essence ?? "")
49
49
  ), y = R();
50
- function B(k) {
51
- y.value = k;
50
+ function B(C) {
51
+ y.value = C;
52
52
  }
53
53
  const p = i(() => y.value ? y.value : u.value?.raw && !u.value.preview ? "raw" : u.value?.preview ? "preview" : "raw");
54
- return (k, s) => (t(), n("div", {
54
+ return (C, s) => (t(), r("div", {
55
55
  class: S(["requestPreview", {
56
- open: v.value,
56
+ open: c.value,
57
57
  succeeded: e.state === "requestSucceeded"
58
58
  }])
59
59
  }, [
60
- e.state === "approved" ? (t(), o(b, { key: 0 })) : e.state === "requiresApproval" ? (t(), n("div", I, [
60
+ e.state === "approved" ? (t(), o(b, { key: 0 })) : e.state === "requiresApproval" ? (t(), r("div", I, [
61
61
  d(T)
62
- ])) : e.state === "sendingRequest" ? (t(), n("button", {
62
+ ])) : e.state === "sendingRequest" ? (t(), r("button", {
63
63
  key: 2,
64
64
  class: "toggleButton",
65
65
  type: "button",
66
- onClick: s[0] || (s[0] = (m) => r.value = !r.value)
66
+ onClick: s[0] || (s[0] = (m) => a.value = !a.value)
67
67
  }, [
68
68
  d(F),
69
- v.value ? (t(), o(a(g), { key: 0 })) : (t(), o(a(q), { key: 1 }))
70
- ])) : e.state === "requestSucceeded" ? (t(), n("button", {
69
+ c.value ? (t(), o(n(g), { key: 0 })) : (t(), o(n(q), { key: 1 }))
70
+ ])) : e.state === "requestSucceeded" ? (t(), r("button", {
71
71
  key: 3,
72
72
  class: "toggleButton",
73
73
  type: "button",
74
- onClick: s[1] || (s[1] = (m) => r.value = !r.value)
74
+ onClick: s[1] || (s[1] = (m) => a.value = !a.value)
75
75
  }, [
76
76
  d($),
77
- v.value ? (t(), o(a(g), { key: 0 })) : (t(), o(a(q), { key: 1 }))
78
- ])) : e.state === "rejected" ? (t(), n("button", {
77
+ c.value ? (t(), o(n(g), { key: 0 })) : (t(), o(n(q), { key: 1 }))
78
+ ])) : e.state === "rejected" ? (t(), r("button", {
79
79
  key: 4,
80
80
  class: "toggleButton",
81
81
  type: "button",
82
- onClick: s[2] || (s[2] = (m) => r.value = !r.value)
82
+ onClick: s[2] || (s[2] = (m) => a.value = !a.value)
83
83
  }, [
84
84
  d(N),
85
- v.value ? (t(), o(a(g), { key: 0 })) : (t(), o(a(q), { key: 1 }))
85
+ c.value ? (t(), o(n(g), { key: 0 })) : (t(), o(n(q), { key: 1 }))
86
86
  ])) : e.state === "requestFailed" ? (t(), o(V, { key: 5 })) : f("", !0),
87
87
  l("div", O, [
88
88
  l("div", P, [
89
- e.request ? (t(), n("div", x, [
89
+ e.request ? (t(), r("div", x, [
90
90
  s[4] || (s[4] = l("div", { class: "requestHeaderContainer" }, [
91
91
  l("h1", null, "Request")
92
92
  ], -1)),
93
- d(a(h), {
93
+ d(n(h), {
94
94
  class: "codeBlock",
95
95
  content: JSON.stringify(e.request, null, 2),
96
96
  lang: "json"
97
97
  }, null, 8, ["content"])
98
98
  ])) : f("", !0),
99
- c.value ? (t(), n("div", H, [
99
+ v.value ? (t(), r("div", H, [
100
100
  l("div", M, [
101
101
  s[5] || (s[5] = l("h1", null, "Response", -1)),
102
102
  u.value?.raw && u.value.preview ? (t(), o(D, {
@@ -107,10 +107,10 @@ const I = {
107
107
  }, null, 8, ["modelValue"])) : f("", !0)
108
108
  ]),
109
109
  d(j, {
110
- data: c.value.data,
110
+ data: v.value.data,
111
111
  display: p.value,
112
112
  mediaConfig: u.value,
113
- responseBody: C.value
113
+ responseBody: k.value
114
114
  }, null, 8, ["data", "display", "mediaConfig", "responseBody"])
115
115
  ])) : f("", !0)
116
116
  ])
@@ -4,7 +4,7 @@ export { MAX_PROMPT_SIZE } from './prompt/constants.js';
4
4
  export { type ApiMetadata, type DocumentSettings, type RegistryDocument, registryApiMetadata, } from './registry/document.js';
5
5
  export { ASK_FOR_AUTHENTICATION_TOOL_NAME, type AskForAuthenticationInput, askForAuthenticationInputSchema, } from './tools/ask-for-authentication.js';
6
6
  export { TOOL_NAMESPACE_SLUG_DELIMITER } from './tools/constants.js';
7
- export { EXECUTE_REQUEST_TOOL_NAME, type ExecuteRequestToolInput, type ExecuteRequestToolOutput, executeRequestToolInputSchema, } from './tools/execute-request.js';
7
+ export { EXECUTE_CLIENT_SIDE_REQUEST_TOOL_NAME, type ExecuteClientSideRequestToolInput, type ExecuteClientSideRequestToolOutput, executeClientSideRequestToolInputSchema, } from './tools/execute-request.js';
8
8
  export { GET_MINI_OPENAPI_SPEC_TOOL_NAME, type GetMiniOpenAPIDocToolInput, type GetMiniOpenAPIDocToolOutput, getMiniOpenAPIDocToolInputSchema, } from './tools/get-mini-openapi-spec.js';
9
9
  export { GET_OPENAPI_SPECS_SUMMARY_TOOL_NAME, type GetOpenAPISpecsSummaryToolOutput, } from './tools/get-openapi-spec-summary.js';
10
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/entities/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,cAAc,EACnB,eAAe,GAChB,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AACpD,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,mBAAmB,GACpB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EACL,gCAAgC,EAChC,KAAK,yBAAyB,EAC9B,+BAA+B,GAChC,MAAM,gCAAgC,CAAA;AACvC,OAAO,EAAE,6BAA6B,EAAE,MAAM,mBAAmB,CAAA;AACjE,OAAO,EACL,yBAAyB,EACzB,KAAK,uBAAuB,EAC5B,KAAK,wBAAwB,EAC7B,6BAA6B,GAC9B,MAAM,yBAAyB,CAAA;AAChC,OAAO,EACL,+BAA+B,EAC/B,KAAK,0BAA0B,EAC/B,KAAK,2BAA2B,EAChC,gCAAgC,GACjC,MAAM,+BAA+B,CAAA;AACtC,OAAO,EACL,mCAAmC,EACnC,KAAK,gCAAgC,GACtC,MAAM,kCAAkC,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/entities/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,cAAc,EACnB,eAAe,GAChB,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AACpD,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,mBAAmB,GACpB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EACL,gCAAgC,EAChC,KAAK,yBAAyB,EAC9B,+BAA+B,GAChC,MAAM,gCAAgC,CAAA;AACvC,OAAO,EAAE,6BAA6B,EAAE,MAAM,mBAAmB,CAAA;AACjE,OAAO,EACL,qCAAqC,EACrC,KAAK,iCAAiC,EACtC,KAAK,kCAAkC,EACvC,uCAAuC,GACxC,MAAM,yBAAyB,CAAA;AAChC,OAAO,EACL,+BAA+B,EAC/B,KAAK,0BAA0B,EAC/B,KAAK,2BAA2B,EAChC,gCAAgC,GACjC,MAAM,+BAA+B,CAAA;AACtC,OAAO,EACL,mCAAmC,EACnC,KAAK,gCAAgC,GACtC,MAAM,kCAAkC,CAAA"}