@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/helpers.d.ts CHANGED
@@ -1,14 +1,13 @@
1
1
  import type { OpenAPIV3_1 } from '@scalar/openapi-types';
2
2
  import type { WorkspaceStore } from '@scalar/workspace-store/client';
3
- import type { XScalarSelectedSecurity } from '@scalar/workspace-store/schemas/extensions/security/x-scalar-selected-security';
4
- import type { OperationObject, SecuritySchemeObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
5
- import { type SecuritySchemes } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
3
+ import { type Auth } from '@scalar/workspace-store/entities/auth';
4
+ import type { OperationObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
6
5
  export declare function getOperations(doc: Partial<OpenAPIV3_1.Document>): OperationObject[];
7
6
  /** Generate document settings from workspace store */
8
7
  export declare function createDocumentSettings(workspaceStore: WorkspaceStore): {
9
8
  [k: string]: {
10
9
  activeServer: import("@scalar/workspace-store/schemas/v3.1/strict/server").ServerObject | null;
11
- securitySchemes: SecuritySchemeObject[];
10
+ securitySchemes: import("@scalar/api-client/v2/blocks/scalar-auth-selector-block").SecuritySchemeObjectSecret[];
12
11
  };
13
12
  };
14
13
  /**
@@ -20,52 +19,26 @@ export declare const authStorage: () => {
20
19
  /**
21
20
  * Retrieves and coerces the authentication schemes stored in local storage.
22
21
  */
23
- getSchemas: (slug: string) => {
24
- [x: string]: ({
25
- description?: string | undefined;
26
- } & {
27
- 'x-scalar-secret-token': string;
28
- } & {
29
- type: "apiKey";
30
- in: "cookie" | "query" | "header";
31
- name: string;
32
- }) | ({
33
- description?: string | undefined;
34
- } & {
35
- 'x-scalar-secret-token': string;
36
- } & {
37
- 'x-scalar-secret-username': string;
38
- 'x-scalar-secret-password': string;
39
- } & {
40
- bearerFormat?: string | undefined;
41
- type: "http";
42
- scheme: "basic" | "bearer";
43
- }) | ({
44
- description?: string | undefined;
45
- } & {
46
- type: "oauth2";
47
- flows: {
22
+ getAuth: (slug: string) => {
23
+ secrets: {
24
+ [x: string]: ({
25
+ type: "apiKey";
26
+ } & {
27
+ 'x-scalar-secret-token': string;
28
+ }) | ({
29
+ type: "http";
30
+ } & {
31
+ 'x-scalar-secret-token': string;
32
+ } & {
33
+ 'x-scalar-secret-username': string;
34
+ 'x-scalar-secret-password': string;
35
+ }) | ({
36
+ type: "oauth2";
37
+ } & {
48
38
  password?: ({
49
- refreshUrl: string;
50
- scopes: {
51
- [x: string]: string;
52
- };
53
- } & {
54
39
  'x-scalar-secret-client-id': string;
55
40
  } & {
56
41
  'x-scalar-secret-token': string;
57
- } & {
58
- 'x-scalar-security-query'?: {
59
- [x: string]: string;
60
- } | undefined;
61
- } & {
62
- 'x-scalar-security-body'?: {
63
- [x: string]: string;
64
- } | undefined;
65
- } & {
66
- 'x-tokenName'?: string | undefined;
67
- } & {
68
- tokenUrl: string;
69
42
  } & {
70
43
  'x-scalar-secret-username': string;
71
44
  'x-scalar-secret-password': string;
@@ -75,266 +48,54 @@ export declare const authStorage: () => {
75
48
  'x-scalar-credentials-location'?: "header" | "body" | undefined;
76
49
  }) | undefined;
77
50
  implicit?: ({
78
- refreshUrl: string;
79
- scopes: {
80
- [x: string]: string;
81
- };
82
- } & {
83
51
  'x-scalar-secret-client-id': string;
84
52
  } & {
85
53
  'x-scalar-secret-token': string;
86
- } & {
87
- 'x-scalar-security-query'?: {
88
- [x: string]: string;
89
- } | undefined;
90
- } & {
91
- 'x-scalar-security-body'?: {
92
- [x: string]: string;
93
- } | undefined;
94
- } & {
95
- 'x-tokenName'?: string | undefined;
96
- } & {
97
- authorizationUrl: string;
98
54
  } & {
99
55
  'x-scalar-secret-redirect-uri': string;
100
56
  }) | undefined;
101
57
  clientCredentials?: ({
102
- refreshUrl: string;
103
- scopes: {
104
- [x: string]: string;
105
- };
106
- } & {
107
58
  'x-scalar-secret-client-id': string;
108
59
  } & {
109
60
  'x-scalar-secret-token': string;
110
- } & {
111
- 'x-scalar-security-query'?: {
112
- [x: string]: string;
113
- } | undefined;
114
- } & {
115
- 'x-scalar-security-body'?: {
116
- [x: string]: string;
117
- } | undefined;
118
- } & {
119
- 'x-tokenName'?: string | undefined;
120
- } & {
121
- tokenUrl: string;
122
61
  } & {
123
62
  'x-scalar-secret-client-secret': string;
124
63
  } & {
125
64
  'x-scalar-credentials-location'?: "header" | "body" | undefined;
126
65
  }) | undefined;
127
66
  authorizationCode?: ({
128
- refreshUrl: string;
129
- scopes: {
130
- [x: string]: string;
131
- };
132
- } & {
133
67
  'x-scalar-secret-client-id': string;
134
68
  } & {
135
69
  'x-scalar-secret-token': string;
136
- } & {
137
- 'x-scalar-security-query'?: {
138
- [x: string]: string;
139
- } | undefined;
140
- } & {
141
- 'x-scalar-security-body'?: {
142
- [x: string]: string;
143
- } | undefined;
144
- } & {
145
- 'x-tokenName'?: string | undefined;
146
- } & {
147
- authorizationUrl: string;
148
- tokenUrl: string;
149
70
  } & {
150
71
  'x-scalar-secret-client-secret': string;
151
72
  } & {
152
73
  'x-scalar-secret-redirect-uri': string;
153
- } & {
154
- 'x-usePkce': "SHA-256" | "plain" | "no";
155
74
  } & {
156
75
  'x-scalar-credentials-location'?: "header" | "body" | undefined;
157
76
  }) | undefined;
158
- };
159
- } & {
160
- 'x-default-scopes'?: string[] | undefined;
161
- }) | ({
162
- description?: string | undefined;
163
- } & {
164
- type: "openIdConnect";
165
- openIdConnectUrl: string;
166
- }) | ({
167
- description?: string | undefined;
168
- summary?: string | undefined;
169
- $ref: string;
170
- } & {
171
- $status?: "loading" | "error" | undefined;
172
- $global?: boolean | undefined;
173
- } & {
174
- '$ref-value': ({
175
- description?: string | undefined;
176
- } & {
177
- 'x-scalar-secret-token': string;
178
- } & {
179
- type: "apiKey";
180
- in: "cookie" | "query" | "header";
181
- name: string;
182
- }) | ({
183
- description?: string | undefined;
184
- } & {
185
- 'x-scalar-secret-token': string;
186
- } & {
187
- 'x-scalar-secret-username': string;
188
- 'x-scalar-secret-password': string;
189
- } & {
190
- bearerFormat?: string | undefined;
191
- type: "http";
192
- scheme: "basic" | "bearer";
193
- }) | ({
194
- description?: string | undefined;
195
- } & {
196
- type: "oauth2";
197
- flows: {
198
- password?: ({
199
- refreshUrl: string;
200
- scopes: {
201
- [x: string]: string;
202
- };
203
- } & {
204
- 'x-scalar-secret-client-id': string;
205
- } & {
206
- 'x-scalar-secret-token': string;
207
- } & {
208
- 'x-scalar-security-query'?: {
209
- [x: string]: string;
210
- } | undefined;
211
- } & {
212
- 'x-scalar-security-body'?: {
213
- [x: string]: string;
214
- } | undefined;
215
- } & {
216
- 'x-tokenName'?: string | undefined;
217
- } & {
218
- tokenUrl: string;
219
- } & {
220
- 'x-scalar-secret-username': string;
221
- 'x-scalar-secret-password': string;
222
- } & {
223
- 'x-scalar-secret-client-secret': string;
224
- } & {
225
- 'x-scalar-credentials-location'?: "header" | "body" | undefined;
226
- }) | undefined;
227
- implicit?: ({
228
- refreshUrl: string;
229
- scopes: {
230
- [x: string]: string;
231
- };
232
- } & {
233
- 'x-scalar-secret-client-id': string;
234
- } & {
235
- 'x-scalar-secret-token': string;
236
- } & {
237
- 'x-scalar-security-query'?: {
238
- [x: string]: string;
239
- } | undefined;
240
- } & {
241
- 'x-scalar-security-body'?: {
242
- [x: string]: string;
243
- } | undefined;
244
- } & {
245
- 'x-tokenName'?: string | undefined;
246
- } & {
247
- authorizationUrl: string;
248
- } & {
249
- 'x-scalar-secret-redirect-uri': string;
250
- }) | undefined;
251
- clientCredentials?: ({
252
- refreshUrl: string;
253
- scopes: {
254
- [x: string]: string;
255
- };
256
- } & {
257
- 'x-scalar-secret-client-id': string;
258
- } & {
259
- 'x-scalar-secret-token': string;
260
- } & {
261
- 'x-scalar-security-query'?: {
262
- [x: string]: string;
263
- } | undefined;
264
- } & {
265
- 'x-scalar-security-body'?: {
266
- [x: string]: string;
267
- } | undefined;
268
- } & {
269
- 'x-tokenName'?: string | undefined;
270
- } & {
271
- tokenUrl: string;
272
- } & {
273
- 'x-scalar-secret-client-secret': string;
274
- } & {
275
- 'x-scalar-credentials-location'?: "header" | "body" | undefined;
276
- }) | undefined;
277
- authorizationCode?: ({
278
- refreshUrl: string;
279
- scopes: {
280
- [x: string]: string;
281
- };
282
- } & {
283
- 'x-scalar-secret-client-id': string;
284
- } & {
285
- 'x-scalar-secret-token': string;
286
- } & {
287
- 'x-scalar-security-query'?: {
288
- [x: string]: string;
289
- } | undefined;
290
- } & {
291
- 'x-scalar-security-body'?: {
292
- [x: string]: string;
293
- } | undefined;
294
- } & {
295
- 'x-tokenName'?: string | undefined;
296
- } & {
297
- authorizationUrl: string;
298
- tokenUrl: string;
299
- } & {
300
- 'x-scalar-secret-client-secret': string;
301
- } & {
302
- 'x-scalar-secret-redirect-uri': string;
303
- } & {
304
- 'x-usePkce': "SHA-256" | "plain" | "no";
305
- } & {
306
- 'x-scalar-credentials-location'?: "header" | "body" | undefined;
307
- }) | undefined;
308
- };
309
- } & {
310
- 'x-default-scopes'?: string[] | undefined;
311
- }) | ({
312
- description?: string | undefined;
313
- } & {
314
- type: "openIdConnect";
315
- openIdConnectUrl: string;
316
77
  });
317
- });
78
+ };
79
+ selected: {
80
+ document?: {
81
+ selectedIndex: number;
82
+ selectedSchemes: {}[];
83
+ } | undefined;
84
+ path?: {
85
+ [x: string]: {
86
+ [x: string]: {
87
+ selectedIndex: number;
88
+ selectedSchemes: {}[];
89
+ };
90
+ };
91
+ } | undefined;
92
+ };
318
93
  };
319
94
  /**
320
95
  * Stores the authentication schemes in local storage.
321
- * @param value The SecuritySchemes object to stringify and store.
322
- */
323
- setSchemas: (slug: string, value: SecuritySchemes) => void;
324
- /**
325
- * Retrieves and coerces the selected authentication schemes stored in local storage.
326
- */
327
- getSelectedSchemes: (slug: string) => {
328
- 'x-scalar-selected-security'?: {
329
- selectedSchemes: {}[];
330
- selectedIndex: number;
331
- } | undefined;
332
- };
333
- /**
334
- * Stores the user's selected authentication schemes in local storage.
335
- * @param value The XScalarSelectedSecurity object to stringify and store.
96
+ * @param value The Auth object to stringify and store.
336
97
  */
337
- setSelectedSchemes: (slug: string, value: XScalarSelectedSecurity) => void;
98
+ setAuth: (slug: string, value: Auth) => void;
338
99
  };
339
100
  /**
340
101
  * Restores authentication secrets from local storage to the workspace store.
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACxD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA;AAGpE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,gFAAgF,CAAA;AAE7H,OAAO,KAAK,EACV,eAAe,EACf,oBAAoB,EACrB,MAAM,8DAA8D,CAAA;AACrE,OAAO,EACL,KAAK,eAAe,EAGrB,MAAM,8DAA8D,CAAA;AAErE,wBAAgB,aAAa,CAAC,GAAG,EAAE,OAAO,CAAC,WAAW,CAAC,QAAQ,CAAC,GACwB,eAAe,EAAE,CACxG;AAyBD,sDAAsD;AACtD,wBAAgB,sBAAsB,CAAC,cAAc,EAAE,cAAc;;;;;EAgBpE;AAKD;;;;GAIG;AACH,eAAO,MAAM,WAAW;IAYpB;;OAEG;uBACgB,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAIzB;;;OAGG;uBACgB,MAAM,SAAS,eAAe;IAGjD;;OAEG;+BACwB,MAAM;;;;;;IAIjC;;;OAGG;+BACwB,MAAM,SAAS,uBAAuB;CAIpE,CAAA;AAgDD;;;;;;;;GAQG;AACH,eAAO,MAAM,6BAA6B,GAAI,mCAG3C;IACD,YAAY,EAAE,MAAM,CAAA;IACpB,cAAc,EAAE,cAAc,CAAA;CAC/B,KAAG,IAuCH,CAAA;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,OAM1C;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,UAmB7C"}
1
+ {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACxD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA;AAEpE,OAAO,EAAE,KAAK,IAAI,EAAc,MAAM,uCAAuC,CAAA;AAG7E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8DAA8D,CAAA;AAEnG,wBAAgB,aAAa,CAAC,GAAG,EAAE,OAAO,CAAC,WAAW,CAAC,QAAQ,CAAC,GACwB,eAAe,EAAE,CACxG;AAOD,sDAAsD;AACtD,wBAAgB,sBAAsB,CAAC,cAAc,EAAE,cAAc;;;;;EAgBpE;AAKD;;;;GAIG;AACH,eAAO,MAAM,WAAW;IAMpB;;OAEG;oBACa,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAItB;;;OAGG;oBACa,MAAM,SAAS,IAAI;CAItC,CAAA;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,6BAA6B,GAAI,mCAG3C;IACD,YAAY,EAAE,MAAM,CAAA;IACpB,cAAc,EAAE,cAAc,CAAA;CAC/B,KAAG,IAIH,CAAA;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,OAM1C;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,UAmB7C"}
package/dist/helpers.js CHANGED
@@ -1,120 +1,78 @@
1
- import { getSelectedServer as O } from "@scalar/api-client/v2/features/operation";
2
- import { getServers as x } from "@scalar/api-client/v2/helpers";
3
- import { isObject as l } from "@scalar/helpers/object/is-object";
4
- import { REFERENCE_LS_KEYS as d, safeLocalStorage as v } from "@scalar/helpers/object/local-storage";
5
- import { getResolvedRef as h } from "@scalar/workspace-store/helpers/get-resolved-ref";
6
- import { coerceValue as y } from "@scalar/workspace-store/schemas/typebox-coerce";
7
- import { XScalarSelectedSecuritySchema as E, SecuritySchemesSchema as b } from "@scalar/workspace-store/schemas/v3.1/strict/openapi-document";
8
- function P(e) {
9
- return Object.values(e.paths ?? {}).flatMap((c) => Object.values(c ?? {}));
1
+ import { mergeSecurity as a } from "@scalar/api-client/v2/blocks/scalar-auth-selector-block";
2
+ import { getSelectedServer as c } from "@scalar/api-client/v2/features/operation";
3
+ import { getServers as n } 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 h } from "@scalar/workspace-store/schemas/typebox-coerce";
7
+ function U(t) {
8
+ return Object.values(t.paths ?? {}).flatMap((r) => Object.values(r ?? {}));
10
9
  }
11
- function j(e) {
12
- const s = (e["x-scalar-selected-security"]?.selectedSchemes ?? []).flatMap((r) => Object.keys(r)), t = e.components?.securitySchemes;
13
- return t ? s.reduce((r, n) => {
14
- const o = t[n];
15
- return o && r.push(h(o)), r;
16
- }, []) : [];
10
+ function p(t, r, e) {
11
+ return Object.values(a(r?.components?.securitySchemes, {}, e, t));
17
12
  }
18
- function C(e) {
13
+ function x(t) {
19
14
  return Object.fromEntries(
20
- Object.entries(e.workspace.documents).map(([c, s]) => {
21
- const t = x(s.servers, {
22
- documentUrl: s?.["x-scalar-original-source-url"]
15
+ Object.entries(t.workspace.documents).map(([r, e]) => {
16
+ const s = n(e.servers, {
17
+ documentUrl: e?.["x-scalar-original-source-url"]
23
18
  });
24
19
  return [
25
- c,
20
+ r,
26
21
  {
27
- activeServer: O(s, t),
28
- securitySchemes: j(s)
22
+ activeServer: c(e, s),
23
+ securitySchemes: p(r, e, t.auth)
29
24
  }
30
25
  ];
31
26
  })
32
27
  );
33
28
  }
34
- const m = v(), f = () => {
35
- const e = d.AUTH_SCHEMES, c = d.SELECTED_AUTH_SCHEMES, s = (t, r) => `${r}-${((o) => o === "schemas" ? e : c)(t)}`;
29
+ const o = u(), S = () => {
30
+ const t = (r) => `${i.AUTH}-${r}`;
36
31
  return {
37
32
  /**
38
33
  * Retrieves and coerces the authentication schemes stored in local storage.
39
34
  */
40
- getSchemas: (t) => {
41
- const r = JSON.parse(m.getItem(s("schemas", t)) ?? "{}");
42
- return y(b, r);
35
+ getAuth: (r) => {
36
+ const e = JSON.parse(o.getItem(t(r)) ?? "{}");
37
+ return h(m, e);
43
38
  },
44
39
  /**
45
40
  * Stores the authentication schemes in local storage.
46
- * @param value The SecuritySchemes object to stringify and store.
41
+ * @param value The Auth object to stringify and store.
47
42
  */
48
- setSchemas: (t, r) => {
49
- m.setItem(s("schemas", t), JSON.stringify(r));
50
- },
51
- /**
52
- * Retrieves and coerces the selected authentication schemes stored in local storage.
53
- */
54
- getSelectedSchemes: (t) => {
55
- const r = JSON.parse(m.getItem(s("selectedSchemes", t)) ?? "{}");
56
- return y(E, r);
57
- },
58
- /**
59
- * Stores the user's selected authentication schemes in local storage.
60
- * @param value The XScalarSelectedSecurity object to stringify and store.
61
- */
62
- setSelectedSchemes: (t, r) => {
63
- m.setItem(s("selectedSchemes", t), JSON.stringify(r));
43
+ setAuth: (r, e) => {
44
+ o.setItem(t(r), JSON.stringify(e));
64
45
  }
65
46
  };
66
- }, p = (e, c) => {
67
- if (!(!l(e) || !l(c)))
68
- for (const [s, t] of Object.entries(c)) {
69
- if (typeof t != "object") {
70
- e[s] = t;
71
- continue;
72
- }
73
- p(h(e[s]), t);
74
- }
75
- }, I = (e, c) => Object.keys(e).every((s) => c.has(s)), U = (e, c) => e >= c ? c - 1 : e, H = ({
76
- documentName: e,
77
- workspaceStore: c
47
+ }, A = ({
48
+ documentName: t,
49
+ workspaceStore: r
78
50
  }) => {
79
- const s = f().getSchemas(e), t = c.workspace.documents[e];
80
- if (!t)
81
- return;
82
- const n = f().getSelectedSchemes(e), o = new Set(Object.keys(t.components?.securitySchemes ?? {})), S = n["x-scalar-selected-security"]?.selectedSchemes?.filter((a) => I(a, o));
83
- if (!t["x-scalar-selected-security"] && S && S.length > 0) {
84
- const a = n["x-scalar-selected-security"]?.selectedIndex, i = U(a ?? 0, S.length);
85
- t["x-scalar-selected-security"] = {
86
- selectedIndex: i,
87
- selectedSchemes: S
88
- };
89
- }
90
- const g = t.components?.securitySchemes ?? {};
91
- for (const [a, i] of Object.entries(s)) {
92
- const u = h(g[a]);
93
- l(u) && p(u, i);
94
- }
51
+ const s = S().getAuth(t);
52
+ r.auth.load({ [t]: s });
95
53
  };
96
- function M(e) {
54
+ function E(t) {
97
55
  try {
98
- return JSON.parse(e);
56
+ return JSON.parse(t);
99
57
  } catch {
100
58
  return;
101
59
  }
102
60
  }
103
- function N(e) {
61
+ function b(t) {
104
62
  try {
105
- if (e.startsWith("/") || e.startsWith("http://localhost"))
106
- return e;
107
- const c = new URLSearchParams({ scalar_url: e });
108
- return new URL(`https://proxy.scalar.com/?${c}`).toString();
63
+ if (t.startsWith("/") || t.startsWith("http://localhost"))
64
+ return t;
65
+ const r = new URLSearchParams({ scalar_url: t });
66
+ return new URL(`https://proxy.scalar.com/?${r}`).toString();
109
67
  } catch {
110
- return console.error(`Invalid URL provided: ${e}`), e;
68
+ return console.error(`Invalid URL provided: ${t}`), t;
111
69
  }
112
70
  }
113
71
  export {
114
- f as authStorage,
115
- C as createDocumentSettings,
116
- P as getOperations,
117
- N as makeScalarProxyUrl,
118
- H as restoreAuthSecretsFromStorage,
119
- M as safeParseJson
72
+ S as authStorage,
73
+ x as createDocumentSettings,
74
+ U as getOperations,
75
+ b as makeScalarProxyUrl,
76
+ A as restoreAuthSecretsFromStorage,
77
+ E as safeParseJson
120
78
  };
@@ -1,24 +1,31 @@
1
- export declare function useChatApprovals(): {
2
- approvalRequestedParts: import("vue").ComputedRef<({
1
+ import type { ToolUIPart, UIMessagePart } from 'ai';
2
+ import { type Tools } from '../state/state.js';
3
+ type RequestToolPart = ToolUIPart & {
4
+ type: 'tool-execute-request';
5
+ state: 'input-available';
6
+ input: Tools['execute-request']['input'];
7
+ };
8
+ export declare function requestPartRequiresApproval(part: UIMessagePart<any, Tools>): part is RequestToolPart;
9
+ export declare function useRequestApprovals(): {
10
+ approvalRequiredParts: import("vue").ComputedRef<({
3
11
  type: `tool-${string}`;
4
12
  } & {
5
13
  toolCallId: string;
6
14
  title?: string;
7
15
  providerExecuted?: boolean;
8
16
  } & {
9
- state: "approval-requested";
17
+ state: "input-available";
10
18
  input: unknown;
11
19
  output?: never;
12
20
  errorText?: never;
13
21
  callProviderMetadata?: import("ai").ProviderMetadata;
14
- approval: {
15
- id: string;
16
- approved?: never;
17
- reason?: never;
18
- };
22
+ approval?: never;
19
23
  } & {
20
- state: "approval-requested";
24
+ type: "tool-execute-request";
25
+ state: "input-available";
26
+ input: Tools["execute-request"]["input"];
21
27
  })[]>;
22
- respondToToolCalls: (approved: boolean) => Promise<void>;
28
+ respondToRequestApprovals: (approved: boolean) => Promise<void>;
23
29
  };
30
+ export {};
24
31
  //# sourceMappingURL=use-chat-approvals.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-chat-approvals.d.ts","sourceRoot":"","sources":["../../src/hooks/use-chat-approvals.ts"],"names":[],"mappings":"AAWA,wBAAgB,gBAAgB;;;;;;;;;;;;;;;oBAuB648C,CAAC;kBAAuB,CAAC;;;eA7B/48C,oBAAoB;;mCAgB7B,OAAO;EAYpD"}
1
+ {"version":3,"file":"use-chat-approvals.d.ts","sourceRoot":"","sources":["../../src/hooks/use-chat-approvals.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,IAAI,CAAA;AAMnD,OAAO,EAAE,KAAK,KAAK,EAAY,MAAM,eAAe,CAAA;AAEpD,KAAK,eAAe,GAAG,UAAU,GAAG;IAClC,IAAI,EAAE,sBAAsB,CAAA;IAC5B,KAAK,EAAE,iBAAiB,CAAA;IACxB,KAAK,EAAE,KAAK,CAAC,iBAAiB,CAAC,CAAC,OAAO,CAAC,CAAA;CACzC,CAAA;AAED,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,aAAa,CAAC,GAAG,EAAE,KAAK,CAAC,GAAG,IAAI,IAAI,eAAe,CAMpG;AAED,wBAAgB,mBAAmB;;;;;;;;;;;;;;;cAb3B,sBAAsB;eACrB,iBAAiB;eACjB,KAAK,CAAC,iBAAiB,CAAC,CAAC,OAAO,CAAC;;0CAqBW,OAAO;EAuB3D"}
@@ -1,21 +1,34 @@
1
1
  import { computed as l } from "vue";
2
- import { useState as n } from "../state/state.js";
3
- function e(t) {
4
- return t.type.startsWith("tool") && t.state === "approval-requested";
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";
5
8
  }
6
- function c() {
7
- const t = n(), a = l(() => t.chat.messages.filter((o) => o.parts.some(e)).flatMap((o) => o.parts).filter(e));
8
- async function s(o) {
9
- const r = a.value.map(
10
- (p) => t.chat.addToolApprovalResponse({
11
- id: p.approval.id,
12
- approved: o
13
- })
14
- );
15
- await Promise.all(r);
9
+ function h() {
10
+ const t = m(), r = l(() => t.chat.messages.filter((e) => e.parts.some(a)).flatMap((e) => e.parts).filter(a));
11
+ async function u(e) {
12
+ const p = 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
+ input: o.input,
23
+ toolCallId: o.toolCallId,
24
+ chat: t.chat
25
+ });
26
+ });
27
+ await Promise.all(p);
16
28
  }
17
- return { approvalRequestedParts: a, respondToToolCalls: s };
29
+ return { approvalRequiredParts: r, respondToRequestApprovals: u };
18
30
  }
19
31
  export {
20
- c as useChatApprovals
32
+ a as requestPartRequiresApproval,
33
+ h as useRequestApprovals
21
34
  };
@@ -9,6 +9,7 @@ export declare function useSearch(): {
9
9
  logoUrl: string | null;
10
10
  slug: string;
11
11
  removable?: boolean | undefined;
12
+ searchEnabled?: boolean | undefined;
12
13
  }[], ApiMetadata[] | {
13
14
  id: string;
14
15
  title: string;
@@ -17,6 +18,7 @@ export declare function useSearch(): {
17
18
  logoUrl: string | null;
18
19
  slug: string;
19
20
  removable?: boolean | undefined;
21
+ searchEnabled?: boolean | undefined;
20
22
  }[]>;
21
23
  };
22
24
  //# sourceMappingURL=use-search.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-search.d.ts","sourceRoot":"","sources":["../../src/hooks/use-search.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAA;AAG/D,wBAAgB,SAAS;;;;;;;;;;;;;;;;;;;EAiCxB"}
1
+ {"version":3,"file":"use-search.d.ts","sourceRoot":"","sources":["../../src/hooks/use-search.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAA;AAG/D,wBAAgB,SAAS;;;;;;;;;;;;;;;;;;;;;EAiCxB"}