@scalar/agent-chat 0.4.7 → 0.5.2

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 (80) 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/FreeMessagesInfoSection.vue.d.ts.map +1 -1
  15. package/dist/components/FreeMessagesInfoSection.vue.js +2 -2
  16. package/dist/components/FreeMessagesInfoSection.vue2.js +19 -19
  17. package/dist/components/RequestPreview.vue.d.ts +3 -3
  18. package/dist/components/RequestPreview.vue.d.ts.map +1 -1
  19. package/dist/components/RequestPreview.vue.js +2 -2
  20. package/dist/components/RequestPreview.vue2.js +31 -31
  21. package/dist/entities/index.d.ts +1 -1
  22. package/dist/entities/index.d.ts.map +1 -1
  23. package/dist/entities/index.js +16 -16
  24. package/dist/entities/registry/document.d.ts +1 -0
  25. package/dist/entities/registry/document.d.ts.map +1 -1
  26. package/dist/entities/tools/execute-request.d.ts +27 -34
  27. package/dist/entities/tools/execute-request.d.ts.map +1 -1
  28. package/dist/entities/tools/execute-request.js +5 -4
  29. package/dist/helpers.d.ts +36 -275
  30. package/dist/helpers.d.ts.map +1 -1
  31. package/dist/helpers.js +44 -86
  32. package/dist/hooks/use-chat-approvals.d.ts +17 -10
  33. package/dist/hooks/use-chat-approvals.d.ts.map +1 -1
  34. package/dist/hooks/use-chat-approvals.js +28 -15
  35. package/dist/hooks/use-search.d.ts +2 -0
  36. package/dist/hooks/use-search.d.ts.map +1 -1
  37. package/dist/index.d.ts +1 -0
  38. package/dist/index.d.ts.map +1 -1
  39. package/dist/package.json +2 -1
  40. package/dist/plugins/persistance.d.ts +16 -0
  41. package/dist/plugins/persistance.d.ts.map +1 -0
  42. package/dist/plugins/persistance.js +23 -0
  43. package/dist/state/state.d.ts +16 -5
  44. package/dist/state/state.d.ts.map +1 -1
  45. package/dist/state/state.js +148 -101
  46. package/dist/style.css +1 -1
  47. package/dist/views/Catalog/Catalog.vue.d.ts +7 -0
  48. package/dist/views/Catalog/Catalog.vue.d.ts.map +1 -0
  49. package/dist/views/Catalog/Catalog.vue.js +8 -0
  50. package/dist/views/Catalog/Catalog.vue2.js +70 -0
  51. package/dist/views/Chat/Chat.vue.d.ts +2 -0
  52. package/dist/views/Chat/Chat.vue.d.ts.map +1 -1
  53. package/dist/views/Chat/Chat.vue.js +1 -1
  54. package/dist/views/Chat/Chat.vue2.js +36 -35
  55. package/dist/views/Chat/Messages/AskForAuthentication.vue.d.ts.map +1 -1
  56. package/dist/views/Chat/Messages/AskForAuthentication.vue.js +2 -2
  57. package/dist/views/Chat/Messages/AskForAuthentication.vue2.js +50 -52
  58. package/dist/views/Chat/Messages/ExecuteRequestTool.vue.d.ts +2 -2
  59. package/dist/views/Chat/Messages/ExecuteRequestTool.vue.d.ts.map +1 -1
  60. package/dist/views/Chat/Messages/ExecuteRequestTool.vue.js +2 -2
  61. package/dist/views/Chat/Messages/ExecuteRequestTool.vue2.js +8 -7
  62. package/dist/views/Layout.vue.d.ts +2 -0
  63. package/dist/views/Layout.vue.d.ts.map +1 -1
  64. package/dist/views/Layout.vue.js +2 -2
  65. package/dist/views/Layout.vue2.js +16 -14
  66. package/dist/views/PromptForm.vue.d.ts +2 -0
  67. package/dist/views/PromptForm.vue.d.ts.map +1 -1
  68. package/dist/views/PromptForm.vue.js +1 -1
  69. package/dist/views/PromptForm.vue2.js +112 -99
  70. package/dist/views/Settings/Auth.vue.d.ts +2 -2
  71. package/dist/views/Settings/Auth.vue.d.ts.map +1 -1
  72. package/dist/views/Settings/Auth.vue.js +32 -32
  73. package/dist/views/Settings/DocSettings.vue.d.ts.map +1 -1
  74. package/dist/views/Settings/DocSettings.vue.js +1 -1
  75. package/dist/views/Settings/DocSettings.vue2.js +22 -21
  76. package/dist/views/Start.vue.d.ts +2 -0
  77. package/dist/views/Start.vue.d.ts.map +1 -1
  78. package/dist/views/Start.vue.js +2 -2
  79. package/dist/views/Start.vue2.js +22 -21
  80. package/package.json +9 -8
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 +1 @@
1
- {"version":3,"file":"FreeMessagesInfoSection.vue.d.ts","sourceRoot":"","sources":["../../src/components/FreeMessagesInfoSection.vue"],"names":[],"mappings":";AAkQA,wBAKG"}
1
+ {"version":3,"file":"FreeMessagesInfoSection.vue.d.ts","sourceRoot":"","sources":["../../src/components/FreeMessagesInfoSection.vue"],"names":[],"mappings":";AAqQA,wBAKG"}
@@ -1,7 +1,7 @@
1
1
  import o from "./FreeMessagesInfoSection.vue2.js";
2
2
  /* empty css */
3
3
  import e from "../_virtual/_plugin-vue_export-helper.js";
4
- const s = /* @__PURE__ */ e(o, [["__scopeId", "data-v-2f53f9bf"]]);
4
+ const a = /* @__PURE__ */ e(o, [["__scopeId", "data-v-593b8dcb"]]);
5
5
  export {
6
- s as default
6
+ a as default
7
7
  };
@@ -1,49 +1,49 @@
1
- import { defineComponent as u, ref as d, withDirectives as f, createElementBlock as p, openBlock as m, createElementVNode as e, createVNode as r, createTextVNode as g, unref as i, vShow as _ } from "vue";
2
- import { ScalarIconInfo as w, ScalarIconX as b } from "@scalar/icons";
1
+ import { defineComponent as u, ref as p, withDirectives as f, createElementBlock as m, openBlock as g, createElementVNode as e, createVNode as r, createTextVNode as _, unref as c, vShow as w } from "vue";
2
+ import { ScalarIconInfo as b, ScalarIconX as h } from "@scalar/icons";
3
3
  import { useState as v } from "../state/state.js";
4
- const h = { class: "freeMessagesInfoSection" }, x = { class: "infoText flex items-center gap-1.5" }, I = { class: "actionsContainer" }, k = /* @__PURE__ */ u({
4
+ const S = { class: "freeMessagesInfoSection" }, x = { class: "infoText flex items-center gap-1.5" }, I = { class: "actionsContainer" }, M = /* @__PURE__ */ u({
5
5
  __name: "FreeMessagesInfoSection",
6
- setup(S) {
7
- const t = d(!1), { dashboardUrl: o, mode: s, uploadedTmpDocumentUrl: n } = v();
8
- function c() {
9
- s === "full" && window.location.replace(o), s === "preview" && window.location.replace(
10
- n.value ? `${o}/register?flow=oss-agent&docUrl=${n.value}` : o
6
+ setup(k) {
7
+ const o = p(!1), { dashboardUrl: t, mode: n, uploadedTmpDocumentUrl: s } = v();
8
+ function l() {
9
+ window.open("https://scalar.com/products/agent/getting-started", "_blank"), n === "full" && window.location.replace(t), n === "preview" && window.location.replace(
10
+ s.value ? `${t}/register?flow=oss-agent&docUrl=${s.value}` : t
11
11
  );
12
12
  }
13
- function l() {
14
- t.value = !0;
13
+ function i() {
14
+ o.value = !0;
15
15
  }
16
- return (y, a) => f((m(), p("div", h, [
16
+ return (d, a) => f((g(), m("div", S, [
17
17
  e("strong", x, [
18
- r(i(w), {
18
+ r(c(b), {
19
19
  class: "text-blue size-4",
20
20
  weight: "bold"
21
21
  }),
22
- a[0] || (a[0] = g(" You get 10 free messages, you can upgrade at anytime to get more for your API. ", -1))
22
+ a[0] || (a[0] = _(" Get an API Key to enable Agent Scalar for your docs. ", -1))
23
23
  ]),
24
24
  e("div", I, [
25
25
  e("button", {
26
26
  class: "actionButton upgradeButton",
27
27
  type: "button",
28
- onClick: c
29
- }, " Upgrade "),
28
+ onClick: l
29
+ }, " Learn More "),
30
30
  e("button", {
31
31
  "aria-label": "Close",
32
32
  class: "closeButton",
33
33
  type: "button",
34
- onClick: l
34
+ onClick: i
35
35
  }, [
36
- r(i(b), {
36
+ r(c(h), {
37
37
  class: "size-4",
38
38
  weight: "bold"
39
39
  })
40
40
  ])
41
41
  ])
42
42
  ], 512)), [
43
- [_, !t.value]
43
+ [w, !o.value]
44
44
  ]);
45
45
  }
46
46
  });
47
47
  export {
48
- k as default
48
+ M as default
49
49
  };
@@ -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 f = /* @__PURE__ */ t(o, [["__scopeId", "data-v-8a65af01"]]);
5
5
  export {
6
- m as default
6
+ f as default
7
7
  };