@scalar/agent-chat 0.10.0 → 0.10.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.
@@ -1 +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,yCAAyC,CAAA;AAEzF,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;AA4E1C;;GAEG;AACH,eAAO,MAAM,kBAAkB;sBAQT,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;cACxC,MAAM;WACT;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,YAAY,EAAE,MAAM,CAAA;KACrB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kHA0EJ,CAAA"}
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,yCAAyC,CAAA;AAEzF,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;AA4E1C;;GAEG;AACH,eAAO,MAAM,kBAAkB;sBAQT,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;cACxC,MAAM;WACT;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,YAAY,EAAE,MAAM,CAAA;KACrB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kHAkFJ,CAAA"}
@@ -45,11 +45,8 @@ var p = n.safeFn(async ({ documentSettings: n, toolCallId: r, chat: a, proxyUrl:
45
45
  error: e("DOCUMENT_SETTINGS_COULD_NOT_BE_DETERMINED", { documentName: m })
46
46
  };
47
47
  let g = i(h.securitySchemes).reduce((e, t) => {
48
- if (t.in === "header") {
49
- let n = t.type === "basic" ? "Basic " : t.type === "bearer" ? "Bearer " : "";
50
- e.headers[t.name] = `${n}${t.type === "basic" ? o(t.value) : t.value}`;
51
- } else t.in === "query" ? e.queryParams.set(t.name, t.value) : t.in === "cookie" && (e.cookies[t.name] = t.value);
52
- return e;
48
+ let n = t.format === "basic" ? `Basic ${o(t.value)}` : t.format === "bearer" ? `Bearer ${t.value}` : t.value;
49
+ return t.in === "header" ? e.headers[t.name] = n : t.in === "query" ? e.queryParams.set(t.name, n) : t.in === "cookie" && (e.cookies[t.name] = n), e;
53
50
  }, {
54
51
  headers: {},
55
52
  queryParams: new URLSearchParams(),
@@ -1 +1 @@
1
- {"version":3,"file":"execute-request.js","names":[],"sources":["../../src/client-tools/execute-request.ts"],"sourcesContent":["import type { Chat } from '@ai-sdk/vue'\nimport { redirectToProxy } from '@scalar/helpers/url/redirect-to-proxy'\nimport type { SecuritySchemeObjectSecret } from '@scalar/workspace-store/request-example'\nimport { buildRequestSecurity, getResolvedUrl } from '@scalar/workspace-store/request-example'\nimport type { ServerObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport type { UIDataTypes, UIMessage } from 'ai'\nimport { encode as encodeBase64 } from 'js-base64'\nimport { n } from 'neverpanic'\nimport truncateJson from 'truncate-json'\n\nimport { EXECUTE_CLIENT_SIDE_REQUEST_TOOL_NAME } from '@/entities'\nimport { createError } from '@/entities/error/helpers'\nimport type { Tools } from '@/state/state'\n\n// The maximum number of bytes the requests response can be.\nconst MAX_RESPONSE_SIZE = 50_000\n\nconst getBody = n.safeFn(\n async (response: Response) => {\n const contentType = response.headers.get('content-type')\n\n if (contentType === 'application/json') {\n return { success: true, data: await response.json() }\n }\n\n return { success: true, data: await response.text() }\n },\n (originalError) => createError('FAILED_TO_PARSE_RESPONSE_BODY', { originalError }),\n)\n\nconst truncateResponse = (response: unknown) =>\n JSON.parse(truncateJson(JSON.stringify(response), MAX_RESPONSE_SIZE).jsonString)\n\n/* Result type wrapper for fetch */\nconst safeFetch = n.safeFn(\n async (url: string, init: RequestInit) => {\n const response = await fetch(url, init)\n\n const responseBodyResult = await getBody(response)\n\n if (!response.ok) {\n return {\n success: false,\n error: createError('REQUEST_NOT_OK', {\n status: response.status,\n url: response.url,\n responseBody: truncateResponse(responseBodyResult.success ? responseBodyResult.data : undefined),\n headers: Object.fromEntries(response.headers.entries()),\n }),\n }\n }\n\n if (!responseBodyResult.success) {\n return responseBodyResult\n }\n\n return {\n success: true,\n data: {\n status: response.status,\n responseBody: truncateResponse(responseBodyResult.data),\n headers: Object.fromEntries(response.headers.entries()),\n },\n }\n },\n (originalError) => createError('FAILED_TO_FETCH', { originalError }),\n)\n\nfunction createUrl({\n path,\n activeServer,\n proxyUrl,\n queryParams,\n}: {\n path: string\n activeServer: ServerObject | null\n proxyUrl: string\n queryParams: URLSearchParams\n}) {\n const resolvedUrl = getResolvedUrl({\n path,\n server: activeServer,\n urlParams: queryParams,\n })\n\n return redirectToProxy(proxyUrl, resolvedUrl)\n}\n\n/**\n * Executes an HTTP request with the specified options, including method, path, headers, and security schemes, and returns the processed response.\n */\nexport const executeRequestTool = n.safeFn(\n async ({\n documentSettings,\n toolCallId,\n chat,\n proxyUrl,\n input: { method, path, body, headers, documentName },\n }: {\n documentSettings: Record<\n string,\n { activeServer: ServerObject | null; securitySchemes: SecuritySchemeObjectSecret[] }\n >\n toolCallId: string\n chat: Chat<UIMessage<unknown, UIDataTypes, Tools>>\n proxyUrl: string\n input: {\n method: string\n path: string\n headers?: Record<string, string>\n body?: string\n documentName: string\n }\n }) => {\n const settings = documentSettings[documentName]\n\n if (!settings) {\n return {\n success: false,\n error: createError('DOCUMENT_SETTINGS_COULD_NOT_BE_DETERMINED', {\n documentName,\n }),\n }\n }\n\n const requestSecurityOptions = buildRequestSecurity(settings.securitySchemes)\n\n const requestSecurity = requestSecurityOptions.reduce<{\n headers: Record<string, string>\n queryParams: URLSearchParams\n cookies: Record<string, string>\n }>(\n (acc, securityOption) => {\n if (securityOption.in === 'header') {\n const prefix = securityOption.type === 'basic' ? 'Basic ' : securityOption.type === 'bearer' ? 'Bearer ' : ''\n\n acc.headers[securityOption.name] =\n `${prefix}${securityOption.type === 'basic' ? encodeBase64(securityOption.value) : securityOption.value}`\n } else if (securityOption.in === 'query') {\n acc.queryParams.set(securityOption.name, securityOption.value)\n } else if (securityOption.in === 'cookie') {\n acc.cookies[securityOption.name] = securityOption.value\n }\n\n return acc\n },\n {\n headers: {},\n queryParams: new URLSearchParams(),\n cookies: {},\n },\n )\n\n const cookieHeader = Object.entries(requestSecurity.cookies)\n .map(([name, value]) => `${name}=${value}`)\n .join('; ')\n\n const fetchOptions = {\n method,\n body,\n headers: {\n ...headers,\n ...requestSecurity.headers,\n Cookie: cookieHeader,\n },\n }\n\n const url = createUrl({\n path,\n activeServer: settings.activeServer,\n proxyUrl,\n queryParams: requestSecurity.queryParams,\n })\n\n const result = await safeFetch(url, fetchOptions)\n\n void chat.addToolOutput({\n tool: EXECUTE_CLIENT_SIDE_REQUEST_TOOL_NAME,\n toolCallId,\n output: result,\n state: 'output-available',\n })\n\n return result\n },\n (originalError) => createError('FAILED_TO_EXECUTE_REQUEST', originalError),\n)\n"],"mappings":";;;;;;;;AAeA,IAAM,IAAoB,KAEpB,IAAU,EAAE,OAChB,OAAO,MACe,EAAS,QAAQ,IAAI,eAAe,KAEpC,qBACX;CAAE,SAAS;CAAM,MAAM,MAAM,EAAS,MAAM;CAAE,GAGhD;CAAE,SAAS;CAAM,MAAM,MAAM,EAAS,MAAM;CAAE,GAEtD,MAAkB,EAAY,iCAAiC,EAAE,kBAAe,CAAC,CACnF,EAEK,KAAoB,MACxB,KAAK,MAAM,EAAa,KAAK,UAAU,EAAS,EAAE,EAAkB,CAAC,WAAW,EAG5E,IAAY,EAAE,OAClB,OAAO,GAAa,MAAsB;CACxC,IAAM,IAAW,MAAM,MAAM,GAAK,EAAK,EAEjC,IAAqB,MAAM,EAAQ,EAAS;AAkBlD,QAhBK,EAAS,KAYT,EAAmB,UAIjB;EACL,SAAS;EACT,MAAM;GACJ,QAAQ,EAAS;GACjB,cAAc,EAAiB,EAAmB,KAAK;GACvD,SAAS,OAAO,YAAY,EAAS,QAAQ,SAAS,CAAC;GACxD;EACF,GAVQ,IAZA;EACL,SAAS;EACT,OAAO,EAAY,kBAAkB;GACnC,QAAQ,EAAS;GACjB,KAAK,EAAS;GACd,cAAc,EAAiB,EAAmB,UAAU,EAAmB,OAAO,KAAA,EAAU;GAChG,SAAS,OAAO,YAAY,EAAS,QAAQ,SAAS,CAAC;GACxD,CA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A,QAAQ;EACR,OAAO;EACR,CAAC,EAEK;IAER,MAAkB,EAAY,6BAA6B,EAAc,CAC3E"}
1
+ {"version":3,"file":"execute-request.js","names":[],"sources":["../../src/client-tools/execute-request.ts"],"sourcesContent":["import type { Chat } from '@ai-sdk/vue'\nimport { redirectToProxy } from '@scalar/helpers/url/redirect-to-proxy'\nimport type { SecuritySchemeObjectSecret } from '@scalar/workspace-store/request-example'\nimport { buildRequestSecurity, getResolvedUrl } from '@scalar/workspace-store/request-example'\nimport type { ServerObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport type { UIDataTypes, UIMessage } from 'ai'\nimport { encode as encodeBase64 } from 'js-base64'\nimport { n } from 'neverpanic'\nimport truncateJson from 'truncate-json'\n\nimport { EXECUTE_CLIENT_SIDE_REQUEST_TOOL_NAME } from '@/entities'\nimport { createError } from '@/entities/error/helpers'\nimport type { Tools } from '@/state/state'\n\n// The maximum number of bytes the requests response can be.\nconst MAX_RESPONSE_SIZE = 50_000\n\nconst getBody = n.safeFn(\n async (response: Response) => {\n const contentType = response.headers.get('content-type')\n\n if (contentType === 'application/json') {\n return { success: true, data: await response.json() }\n }\n\n return { success: true, data: await response.text() }\n },\n (originalError) => createError('FAILED_TO_PARSE_RESPONSE_BODY', { originalError }),\n)\n\nconst truncateResponse = (response: unknown) =>\n JSON.parse(truncateJson(JSON.stringify(response), MAX_RESPONSE_SIZE).jsonString)\n\n/* Result type wrapper for fetch */\nconst safeFetch = n.safeFn(\n async (url: string, init: RequestInit) => {\n const response = await fetch(url, init)\n\n const responseBodyResult = await getBody(response)\n\n if (!response.ok) {\n return {\n success: false,\n error: createError('REQUEST_NOT_OK', {\n status: response.status,\n url: response.url,\n responseBody: truncateResponse(responseBodyResult.success ? responseBodyResult.data : undefined),\n headers: Object.fromEntries(response.headers.entries()),\n }),\n }\n }\n\n if (!responseBodyResult.success) {\n return responseBodyResult\n }\n\n return {\n success: true,\n data: {\n status: response.status,\n responseBody: truncateResponse(responseBodyResult.data),\n headers: Object.fromEntries(response.headers.entries()),\n },\n }\n },\n (originalError) => createError('FAILED_TO_FETCH', { originalError }),\n)\n\nfunction createUrl({\n path,\n activeServer,\n proxyUrl,\n queryParams,\n}: {\n path: string\n activeServer: ServerObject | null\n proxyUrl: string\n queryParams: URLSearchParams\n}) {\n const resolvedUrl = getResolvedUrl({\n path,\n server: activeServer,\n urlParams: queryParams,\n })\n\n return redirectToProxy(proxyUrl, resolvedUrl)\n}\n\n/**\n * Executes an HTTP request with the specified options, including method, path, headers, and security schemes, and returns the processed response.\n */\nexport const executeRequestTool = n.safeFn(\n async ({\n documentSettings,\n toolCallId,\n chat,\n proxyUrl,\n input: { method, path, body, headers, documentName },\n }: {\n documentSettings: Record<\n string,\n { activeServer: ServerObject | null; securitySchemes: SecuritySchemeObjectSecret[] }\n >\n toolCallId: string\n chat: Chat<UIMessage<unknown, UIDataTypes, Tools>>\n proxyUrl: string\n input: {\n method: string\n path: string\n headers?: Record<string, string>\n body?: string\n documentName: string\n }\n }) => {\n const settings = documentSettings[documentName]\n\n if (!settings) {\n return {\n success: false,\n error: createError('DOCUMENT_SETTINGS_COULD_NOT_BE_DETERMINED', {\n documentName,\n }),\n }\n }\n\n const requestSecurityOptions = buildRequestSecurity(settings.securitySchemes)\n\n const requestSecurity = requestSecurityOptions.reduce<{\n headers: Record<string, string>\n queryParams: URLSearchParams\n cookies: Record<string, string>\n }>(\n (acc, securityOption) => {\n /** Format the security value based on its authentication scheme. */\n const securityValue = (() => {\n if (securityOption.format === 'basic') {\n return `Basic ${encodeBase64(securityOption.value)}`\n }\n if (securityOption.format === 'bearer') {\n return `Bearer ${securityOption.value}`\n }\n return securityOption.value\n })()\n\n if (securityOption.in === 'header') {\n acc.headers[securityOption.name] = securityValue\n } else if (securityOption.in === 'query') {\n acc.queryParams.set(securityOption.name, securityValue)\n } else if (securityOption.in === 'cookie') {\n acc.cookies[securityOption.name] = securityValue\n }\n\n return acc\n },\n {\n headers: {},\n queryParams: new URLSearchParams(),\n cookies: {},\n },\n )\n\n const cookieHeader = Object.entries(requestSecurity.cookies)\n .map(([name, value]) => `${name}=${value}`)\n .join('; ')\n\n const fetchOptions = {\n method,\n body,\n headers: {\n ...headers,\n ...requestSecurity.headers,\n Cookie: cookieHeader,\n },\n }\n\n const url = createUrl({\n path,\n activeServer: settings.activeServer,\n proxyUrl,\n queryParams: requestSecurity.queryParams,\n })\n\n const result = await safeFetch(url, fetchOptions)\n\n void chat.addToolOutput({\n tool: EXECUTE_CLIENT_SIDE_REQUEST_TOOL_NAME,\n toolCallId,\n output: result,\n state: 'output-available',\n })\n\n return result\n },\n (originalError) => createError('FAILED_TO_EXECUTE_REQUEST', originalError),\n)\n"],"mappings":";;;;;;;;AAeA,IAAM,IAAoB,KAEpB,IAAU,EAAE,OAChB,OAAO,MACe,EAAS,QAAQ,IAAI,eAAe,KAEpC,qBACX;CAAE,SAAS;CAAM,MAAM,MAAM,EAAS,MAAM;CAAE,GAGhD;CAAE,SAAS;CAAM,MAAM,MAAM,EAAS,MAAM;CAAE,GAEtD,MAAkB,EAAY,iCAAiC,EAAE,kBAAe,CAAC,CACnF,EAEK,KAAoB,MACxB,KAAK,MAAM,EAAa,KAAK,UAAU,EAAS,EAAE,EAAkB,CAAC,WAAW,EAG5E,IAAY,EAAE,OAClB,OAAO,GAAa,MAAsB;CACxC,IAAM,IAAW,MAAM,MAAM,GAAK,EAAK,EAEjC,IAAqB,MAAM,EAAQ,EAAS;AAkBlD,QAhBK,EAAS,KAYT,EAAmB,UAIjB;EACL,SAAS;EACT,MAAM;GACJ,QAAQ,EAAS;GACjB,cAAc,EAAiB,EAAmB,KAAK;GACvD,SAAS,OAAO,YAAY,EAAS,QAAQ,SAAS,CAAC;GACxD;EACF,GAVQ,IAZA;EACL,SAAS;EACT,OAAO,EAAY,kBAAkB;GACnC,QAAQ,EAAS;GACjB,KAAK,EAAS;GACd,cAAc,EAAiB,EAAmB,UAAU,EAAmB,OAAO,KAAA,EAAU;GAChG,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MAAM;EACN;EACA,QAAQ;EACR,OAAO;EACR,CAAC,EAEK;IAER,MAAkB,EAAY,6BAA6B,EAAc,CAC3E"}
package/dist/package.json CHANGED
@@ -10,7 +10,7 @@
10
10
  "url": "git+https://github.com/scalar/scalar.git",
11
11
  "directory": "packages/agent-chat"
12
12
  },
13
- "version": "0.10.0",
13
+ "version": "0.10.2",
14
14
  "engines": {
15
15
  "node": ">=22"
16
16
  },
@@ -1 +1 @@
1
- {"version":3,"file":"Auth.vue.d.ts","sourceRoot":"","sources":["../../../src/views/Settings/Auth.vue"],"names":[],"mappings":"AAmGA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,6BAA6B,CAAA;AAC/E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uCAAuC,CAAA;AACtE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAMvE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2EAA2E,CAAA;AACnH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8DAA8D,CAAA;AAChG,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAA;AAMlF,KAAK,WAAW,GAAG;IACf,OAAO,EAAE,IAAI,CACX,4BAA4B,EAC5B,gBAAgB,GAAG,aAAa,GAAG,UAAU,CAC9C,CAAA;IACD,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,SAAS,CAAA;IACpB,QAAQ,EAAE,iBAAiB,GAAG,SAAS,CAAA;IACvC,QAAQ,EAAE,iBAAiB,CAAA;IAC3B,cAAc,EAAE,YAAY,GAAG,IAAI,CAAA;IACnC,WAAW,EAAE,kBAAkB,CAAA;CAChC,CAAC;AAmHJ,QAAA,MAAM,YAAY,kSAEhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
1
+ {"version":3,"file":"Auth.vue.d.ts","sourceRoot":"","sources":["../../../src/views/Settings/Auth.vue"],"names":[],"mappings":"AAqGA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,6BAA6B,CAAA;AAC/E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uCAAuC,CAAA;AACtE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAMvE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2EAA2E,CAAA;AACnH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8DAA8D,CAAA;AAChG,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAA;AAMlF,KAAK,WAAW,GAAG;IACf,OAAO,EAAE,IAAI,CACX,4BAA4B,EAC5B,gBAAgB,GAAG,aAAa,GAAG,UAAU,CAC9C,CAAA;IACD,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,SAAS,CAAA;IACpB,QAAQ,EAAE,iBAAiB,GAAG,SAAS,CAAA;IACvC,QAAQ,EAAE,iBAAiB,CAAA;IAC3B,cAAc,EAAE,YAAY,GAAG,IAAI,CAAA;IACnC,WAAW,EAAE,kBAAkB,CAAA;CAChC,CAAC;AAqHJ,QAAA,MAAM,YAAY,kSAEhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
@@ -1 +1 @@
1
- {"version":3,"file":"Auth.vue.js","names":[],"sources":["../../../src/views/Settings/Auth.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { AuthSelector } from '@scalar/api-client/v2/blocks/scalar-auth-selector-block'\nimport type { ApiReferenceConfigurationRaw } from '@scalar/types/api-reference'\nimport type { AuthStore } from '@scalar/workspace-store/entities/auth'\nimport type { WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport {\n getSecurityRequirements,\n getSelectedSecurity,\n mergeSecurity,\n} from '@scalar/workspace-store/request-example'\nimport type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments'\nimport type { ServerObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport type { WorkspaceDocument } from '@scalar/workspace-store/schemas/workspace'\nimport { useFocusWithin } from '@vueuse/core'\nimport { computed, shallowRef, watch } from 'vue'\n\nimport { useState } from '@/state/state'\n\nconst { document, name, environment, eventBus, options, authStore } =\n defineProps<{\n options: Pick<\n ApiReferenceConfigurationRaw,\n 'authentication' | 'persistAuth' | 'proxyUrl'\n >\n name: string\n authStore: AuthStore\n document: WorkspaceDocument | undefined\n eventBus: WorkspaceEventBus\n selectedServer: ServerObject | null\n environment: XScalarEnvironment\n }>()\n\nconst { workspaceStore } = useState()\n\n/** Compute what the security requirements should be for the document */\nconst securityRequirements = computed(() =>\n getSecurityRequirements(document?.security),\n)\n\n/** The selected security keys for the document */\nconst selectedSecurity = computed(() =>\n getSelectedSecurity(\n authStore.getAuthSelectedSchemas({\n type: 'document',\n documentName: name,\n }),\n undefined,\n securityRequirements.value,\n ),\n)\n\nconst focusRef = shallowRef()\nconst { focused } = useFocusWithin(focusRef)\n\n/** Merge the security schemes with the authentication config and the auth store */\nconst securitySchemes = computed(() =>\n mergeSecurity(\n document?.components?.securitySchemes ?? {},\n options.authentication?.securitySchemes,\n authStore,\n name,\n ),\n)\n\nwatch(focused, (isFocused) => {\n if (!isFocused) {\n return\n }\n\n workspaceStore.update('x-scalar-active-document', name)\n})\n</script>\n<template>\n <div\n ref=\"focusRef\"\n tabindex=\"0\">\n <AuthSelector\n v-if=\"Object.keys(securitySchemes).length\"\n :authStore\n :documentSlug=\"name\"\n :environment\n :eventBus\n isReadOnly\n isStatic\n layout=\"reference\"\n :meta=\"{ type: 'document' }\"\n :persistAuth=\"options.persistAuth\"\n :proxyUrl=\"options.proxyUrl ?? ''\"\n :securityRequirements\n :securitySchemes\n :selectedSecurity\n :server=\"selectedServer\"\n title=\"Authentication\" />\n </div>\n</template>\n"],"mappings":""}
1
+ {"version":3,"file":"Auth.vue.js","names":[],"sources":["../../../src/views/Settings/Auth.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { AuthSelector } from '@scalar/api-client/v2/blocks/scalar-auth-selector-block'\nimport type { ApiReferenceConfigurationRaw } from '@scalar/types/api-reference'\nimport type { AuthStore } from '@scalar/workspace-store/entities/auth'\nimport type { WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport {\n getSecurityRequirements,\n getSelectedSecurity,\n mergeSecurity,\n} from '@scalar/workspace-store/request-example'\nimport type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments'\nimport type { ServerObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport type { WorkspaceDocument } from '@scalar/workspace-store/schemas/workspace'\nimport { useFocusWithin } from '@vueuse/core'\nimport { computed, shallowRef, watch } from 'vue'\n\nimport { useState } from '@/state/state'\n\nconst { document, name, environment, eventBus, options, authStore } =\n defineProps<{\n options: Pick<\n ApiReferenceConfigurationRaw,\n 'authentication' | 'persistAuth' | 'proxyUrl'\n >\n name: string\n authStore: AuthStore\n document: WorkspaceDocument | undefined\n eventBus: WorkspaceEventBus\n selectedServer: ServerObject | null\n environment: XScalarEnvironment\n }>()\n\nconst { workspaceStore } = useState()\n\n/** Compute what the security requirements should be for the document */\nconst securityRequirements = computed(() =>\n getSecurityRequirements(document?.security),\n)\n\n/** Merge the security schemes with the authentication config and the auth store */\nconst securitySchemes = computed(() =>\n mergeSecurity(\n document?.components?.securitySchemes ?? {},\n options.authentication?.securitySchemes,\n authStore,\n name,\n ),\n)\n\n/** The selected security keys for the document */\nconst selectedSecurity = computed(() =>\n getSelectedSecurity(\n authStore.getAuthSelectedSchemas({\n type: 'document',\n documentName: name,\n }),\n undefined,\n securityRequirements.value,\n securitySchemes.value,\n options.authentication?.preferredSecurityScheme,\n ),\n)\n\nconst focusRef = shallowRef()\nconst { focused } = useFocusWithin(focusRef)\n\nwatch(focused, (isFocused) => {\n if (!isFocused) {\n return\n }\n\n workspaceStore.update('x-scalar-active-document', name)\n})\n</script>\n<template>\n <div\n ref=\"focusRef\"\n tabindex=\"0\">\n <AuthSelector\n v-if=\"Object.keys(securitySchemes).length\"\n :authStore\n :documentSlug=\"name\"\n :environment\n :eventBus\n isReadOnly\n isStatic\n layout=\"reference\"\n :meta=\"{ type: 'document' }\"\n :persistAuth=\"options.persistAuth\"\n :proxyUrl=\"options.proxyUrl ?? ''\"\n :securityRequirements\n :securitySchemes\n :selectedSecurity\n :server=\"selectedServer\"\n title=\"Authentication\" />\n </div>\n</template>\n"],"mappings":""}
@@ -16,17 +16,17 @@ var h = /* @__PURE__ */ a({
16
16
  environment: {}
17
17
  },
18
18
  setup(a) {
19
- let { workspaceStore: h } = e(), g = t(() => u(a.document?.security)), _ = t(() => d(a.authStore.getAuthSelectedSchemas({
19
+ let { workspaceStore: h } = e(), g = t(() => u(a.document?.security)), _ = t(() => f(a.document?.components?.securitySchemes ?? {}, a.options.authentication?.securitySchemes, a.authStore, a.name)), v = t(() => d(a.authStore.getAuthSelectedSchemas({
20
20
  type: "document",
21
21
  documentName: a.name
22
- }), void 0, g.value)), v = s(), { focused: y } = m(v), b = t(() => f(a.document?.components?.securitySchemes ?? {}, a.options.authentication?.securitySchemes, a.authStore, a.name));
23
- return l(y, (e) => {
22
+ }), void 0, g.value, _.value, a.options.authentication?.preferredSecurityScheme)), y = s(), { focused: b } = m(y);
23
+ return l(b, (e) => {
24
24
  e && h.update("x-scalar-active-document", a.name);
25
25
  }), (e, t) => (o(), i("div", {
26
26
  ref_key: "focusRef",
27
- ref: v,
27
+ ref: y,
28
28
  tabindex: "0"
29
- }, [Object.keys(b.value).length ? (o(), n(c(p), {
29
+ }, [Object.keys(_.value).length ? (o(), n(c(p), {
30
30
  key: 0,
31
31
  authStore: a.authStore,
32
32
  documentSlug: a.name,
@@ -39,8 +39,8 @@ var h = /* @__PURE__ */ a({
39
39
  persistAuth: a.options.persistAuth,
40
40
  proxyUrl: a.options.proxyUrl ?? "",
41
41
  securityRequirements: g.value,
42
- securitySchemes: b.value,
43
- selectedSecurity: _.value,
42
+ securitySchemes: _.value,
43
+ selectedSecurity: v.value,
44
44
  server: a.selectedServer,
45
45
  title: "Authentication"
46
46
  }, null, 8, [
@@ -1 +1 @@
1
- {"version":3,"file":"Auth.vue.script.js","names":[],"sources":["../../../src/views/Settings/Auth.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { AuthSelector } from '@scalar/api-client/v2/blocks/scalar-auth-selector-block'\nimport type { ApiReferenceConfigurationRaw } from '@scalar/types/api-reference'\nimport type { AuthStore } from '@scalar/workspace-store/entities/auth'\nimport type { WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport {\n getSecurityRequirements,\n getSelectedSecurity,\n mergeSecurity,\n} from '@scalar/workspace-store/request-example'\nimport type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments'\nimport type { ServerObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport type { WorkspaceDocument } from '@scalar/workspace-store/schemas/workspace'\nimport { useFocusWithin } from '@vueuse/core'\nimport { computed, shallowRef, watch } from 'vue'\n\nimport { useState } from '@/state/state'\n\nconst { document, name, environment, eventBus, options, authStore } =\n defineProps<{\n options: Pick<\n ApiReferenceConfigurationRaw,\n 'authentication' | 'persistAuth' | 'proxyUrl'\n >\n name: string\n authStore: AuthStore\n document: WorkspaceDocument | undefined\n eventBus: WorkspaceEventBus\n selectedServer: ServerObject | null\n environment: XScalarEnvironment\n }>()\n\nconst { workspaceStore } = useState()\n\n/** Compute what the security requirements should be for the document */\nconst securityRequirements = computed(() =>\n getSecurityRequirements(document?.security),\n)\n\n/** The selected security keys for the document */\nconst selectedSecurity = computed(() =>\n getSelectedSecurity(\n authStore.getAuthSelectedSchemas({\n type: 'document',\n documentName: name,\n }),\n undefined,\n securityRequirements.value,\n ),\n)\n\nconst focusRef = shallowRef()\nconst { focused } = useFocusWithin(focusRef)\n\n/** Merge the security schemes with the authentication config and the auth store */\nconst securitySchemes = computed(() =>\n mergeSecurity(\n document?.components?.securitySchemes ?? {},\n options.authentication?.securitySchemes,\n authStore,\n name,\n ),\n)\n\nwatch(focused, (isFocused) => {\n if (!isFocused) {\n return\n }\n\n workspaceStore.update('x-scalar-active-document', name)\n})\n</script>\n<template>\n <div\n ref=\"focusRef\"\n tabindex=\"0\">\n <AuthSelector\n v-if=\"Object.keys(securitySchemes).length\"\n :authStore\n :documentSlug=\"name\"\n :environment\n :eventBus\n isReadOnly\n isStatic\n layout=\"reference\"\n :meta=\"{ type: 'document' }\"\n :persistAuth=\"options.persistAuth\"\n :proxyUrl=\"options.proxyUrl ?? ''\"\n :securityRequirements\n :securitySchemes\n :selectedSecurity\n :server=\"selectedServer\"\n title=\"Authentication\" />\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;EAgCA,IAAM,EAAE,sBAAmB,GAAS,EAG9B,IAAuB,QAC3B,EAAwB,EAAA,UAAU,SAAS,CAC7C,EAGM,IAAmB,QACvB,EACE,EAAA,UAAU,uBAAuB;GAC/B,MAAM;GACN,cAAc,EAAA;GACf,CAAC,EACF,KAAA,GACA,EAAqB,MACtB,CACH,EAEM,IAAW,GAAW,EACtB,EAAE,eAAY,EAAe,EAAQ,EAGrC,IAAkB,QACtB,EACE,EAAA,UAAU,YAAY,mBAAmB,EAAE,EAC3C,EAAA,QAAQ,gBAAgB,iBACxB,EAAA,WACA,EAAA,KACD,CACH;SAEA,EAAM,IAAU,MAAc;AACvB,QAIL,EAAe,OAAO,4BAA4B,EAAA,KAAI;IACvD,kBAGC,EAoBM,OAAA;YAnBA;GAAJ,KAAI;GACJ,UAAS;MAED,OAAO,KAAK,EAAA,MAAe,CAAE,UAAA,GAAA,EADrC,EAgB2B,EAAA,EAAA,EAAA;;GAdxB,WAAA,EAAA;GACA,cAAc,EAAA;GACd,aAAA,EAAA;GACA,UAAA,EAAA;GACD,YAAA;GACA,UAAA;GACA,QAAO;GACN,MAAM,EAAA,MAAA,YAAoB;GAC1B,aAAa,EAAA,QAAQ;GACrB,UAAU,EAAA,QAAQ,YAAQ;GAC1B,sBAAA,EAAA;GACA,iBAAA,EAAA;GACA,kBAAA,EAAA;GACA,QAAQ,EAAA;GACT,OAAM"}
1
+ {"version":3,"file":"Auth.vue.script.js","names":[],"sources":["../../../src/views/Settings/Auth.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { AuthSelector } from '@scalar/api-client/v2/blocks/scalar-auth-selector-block'\nimport type { ApiReferenceConfigurationRaw } from '@scalar/types/api-reference'\nimport type { AuthStore } from '@scalar/workspace-store/entities/auth'\nimport type { WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport {\n getSecurityRequirements,\n getSelectedSecurity,\n mergeSecurity,\n} from '@scalar/workspace-store/request-example'\nimport type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments'\nimport type { ServerObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport type { WorkspaceDocument } from '@scalar/workspace-store/schemas/workspace'\nimport { useFocusWithin } from '@vueuse/core'\nimport { computed, shallowRef, watch } from 'vue'\n\nimport { useState } from '@/state/state'\n\nconst { document, name, environment, eventBus, options, authStore } =\n defineProps<{\n options: Pick<\n ApiReferenceConfigurationRaw,\n 'authentication' | 'persistAuth' | 'proxyUrl'\n >\n name: string\n authStore: AuthStore\n document: WorkspaceDocument | undefined\n eventBus: WorkspaceEventBus\n selectedServer: ServerObject | null\n environment: XScalarEnvironment\n }>()\n\nconst { workspaceStore } = useState()\n\n/** Compute what the security requirements should be for the document */\nconst securityRequirements = computed(() =>\n getSecurityRequirements(document?.security),\n)\n\n/** Merge the security schemes with the authentication config and the auth store */\nconst securitySchemes = computed(() =>\n mergeSecurity(\n document?.components?.securitySchemes ?? {},\n options.authentication?.securitySchemes,\n authStore,\n name,\n ),\n)\n\n/** The selected security keys for the document */\nconst selectedSecurity = computed(() =>\n getSelectedSecurity(\n authStore.getAuthSelectedSchemas({\n type: 'document',\n documentName: name,\n }),\n undefined,\n securityRequirements.value,\n securitySchemes.value,\n options.authentication?.preferredSecurityScheme,\n ),\n)\n\nconst focusRef = shallowRef()\nconst { focused } = useFocusWithin(focusRef)\n\nwatch(focused, (isFocused) => {\n if (!isFocused) {\n return\n }\n\n workspaceStore.update('x-scalar-active-document', name)\n})\n</script>\n<template>\n <div\n ref=\"focusRef\"\n tabindex=\"0\">\n <AuthSelector\n v-if=\"Object.keys(securitySchemes).length\"\n :authStore\n :documentSlug=\"name\"\n :environment\n :eventBus\n isReadOnly\n isStatic\n layout=\"reference\"\n :meta=\"{ type: 'document' }\"\n :persistAuth=\"options.persistAuth\"\n :proxyUrl=\"options.proxyUrl ?? ''\"\n :securityRequirements\n :securitySchemes\n :selectedSecurity\n :server=\"selectedServer\"\n title=\"Authentication\" />\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;EAgCA,IAAM,EAAE,sBAAmB,GAAS,EAG9B,IAAuB,QAC3B,EAAwB,EAAA,UAAU,SAAS,CAC7C,EAGM,IAAkB,QACtB,EACE,EAAA,UAAU,YAAY,mBAAmB,EAAE,EAC3C,EAAA,QAAQ,gBAAgB,iBACxB,EAAA,WACA,EAAA,KACD,CACH,EAGM,IAAmB,QACvB,EACE,EAAA,UAAU,uBAAuB;GAC/B,MAAM;GACN,cAAc,EAAA;GACf,CAAC,EACF,KAAA,GACA,EAAqB,OACrB,EAAgB,OAChB,EAAA,QAAQ,gBAAgB,wBACzB,CACH,EAEM,IAAW,GAAW,EACtB,EAAE,eAAY,EAAe,EAAQ;SAE3C,EAAM,IAAU,MAAc;AACvB,QAIL,EAAe,OAAO,4BAA4B,EAAA,KAAI;IACvD,kBAGC,EAoBM,OAAA;YAnBA;GAAJ,KAAI;GACJ,UAAS;MAED,OAAO,KAAK,EAAA,MAAe,CAAE,UAAA,GAAA,EADrC,EAgB2B,EAAA,EAAA,EAAA;;GAdxB,WAAA,EAAA;GACA,cAAc,EAAA;GACd,aAAA,EAAA;GACA,UAAA,EAAA;GACD,YAAA;GACA,UAAA;GACA,QAAO;GACN,MAAM,EAAA,MAAA,YAAoB;GAC1B,aAAa,EAAA,QAAQ;GACrB,UAAU,EAAA,QAAQ,YAAQ;GAC1B,sBAAA,EAAA;GACA,iBAAA,EAAA;GACA,kBAAA,EAAA;GACA,QAAQ,EAAA;GACT,OAAM"}
package/package.json CHANGED
@@ -10,7 +10,7 @@
10
10
  "url": "git+https://github.com/scalar/scalar.git",
11
11
  "directory": "packages/agent-chat"
12
12
  },
13
- "version": "0.10.0",
13
+ "version": "0.10.2",
14
14
  "engines": {
15
15
  "node": ">=22"
16
16
  },
@@ -51,16 +51,16 @@
51
51
  "vue": "^3.5.30",
52
52
  "whatwg-mimetype": "4.0.0",
53
53
  "zod": "^4.3.5",
54
- "@scalar/api-client": "2.40.0",
54
+ "@scalar/api-client": "2.42.0",
55
55
  "@scalar/helpers": "0.4.3",
56
- "@scalar/components": "0.21.3",
57
56
  "@scalar/icons": "0.7.2",
57
+ "@scalar/components": "0.21.3",
58
58
  "@scalar/json-magic": "0.12.5",
59
59
  "@scalar/openapi-types": "0.7.0",
60
60
  "@scalar/themes": "0.15.2",
61
+ "@scalar/types": "0.8.0",
61
62
  "@scalar/use-toasts": "0.10.1",
62
- "@scalar/types": "0.7.6",
63
- "@scalar/workspace-store": "0.43.0"
63
+ "@scalar/workspace-store": "0.44.0"
64
64
  },
65
65
  "devDependencies": {
66
66
  "@tailwindcss/vite": "^4.2.0",