@redocly/realm 0.136.0-next.4 → 0.136.0-next.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +26 -0
- package/dist/client/ErrorBoundary.js +1 -1
- package/dist/client/app/l10n/hooks/useTranslate.js +1 -1
- package/dist/client/app/l10n/initL10n.js +1 -1
- package/dist/client/templates/openapi-docs/helpers.d.ts +1 -1
- package/dist/client/templates/openapi-docs/helpers.js +2 -2
- package/dist/constants/common.d.ts +3 -0
- package/dist/constants/common.js +1 -1
- package/dist/server/config/env-config.d.ts +2 -4
- package/dist/server/config/env-schema.d.ts +5 -10
- package/dist/server/config/env-schemas/feature-flags.d.ts +4 -8
- package/dist/server/config/env-schemas/feature-flags.js +1 -1
- package/dist/server/constants/common.d.ts +2 -0
- package/dist/server/constants/common.js +1 -1
- package/dist/server/constants/entitlements.js +1 -1
- package/dist/server/plugins/config-parser/loaders/utils/read-and-validate-config.js +1 -1
- package/dist/server/plugins/markdown/search/create-render-tag-fn.d.ts +2 -1
- package/dist/server/plugins/markdown/search/create-render-tag-fn.js +1 -1
- package/dist/server/plugins/markdown/search/get-ai-search-documents.js +9 -9
- package/dist/server/plugins/mcp/codemode/tools/execute.js +1 -1
- package/dist/server/plugins/mcp/gateway-mcp/elicitation.d.ts +25 -0
- package/dist/server/plugins/mcp/gateway-mcp/elicitation.js +2 -0
- package/dist/server/plugins/mcp/gateway-mcp/eligibility.d.ts +4 -15
- package/dist/server/plugins/mcp/gateway-mcp/eligibility.js +1 -1
- package/dist/server/plugins/mcp/gateway-mcp/fetch/allowed-hosts.d.ts +8 -8
- package/dist/server/plugins/mcp/gateway-mcp/fetch/allowed-hosts.js +1 -1
- package/dist/server/plugins/mcp/gateway-mcp/fetch/fetch-bridge.d.ts +15 -1
- package/dist/server/plugins/mcp/gateway-mcp/fetch/fetch-bridge.js +1 -1
- package/dist/server/plugins/mcp/gateway-mcp/fetch/ssrf-blocklist.d.ts +10 -0
- package/dist/server/plugins/mcp/gateway-mcp/fetch/ssrf-blocklist.js +1 -0
- package/dist/server/plugins/mcp/gateway-mcp/fetch/ssrf-guard.d.ts +1 -1
- package/dist/server/plugins/mcp/gateway-mcp/fetch/ssrf-guard.js +1 -1
- package/dist/server/plugins/mcp/gateway-mcp/fetch/ssrf-safe-lookup.d.ts +11 -0
- package/dist/server/plugins/mcp/gateway-mcp/fetch/ssrf-safe-lookup.js +1 -0
- package/dist/server/plugins/mcp/gateway-mcp/fetch-capability.d.ts +8 -1
- package/dist/server/plugins/mcp/gateway-mcp/fetch-capability.js +1 -1
- package/dist/server/plugins/mcp/gateway-mcp/secret-store.d.ts +24 -0
- package/dist/server/plugins/mcp/gateway-mcp/secret-store.js +1 -0
- package/dist/server/plugins/mcp/gateway-mcp/upstream-auth-scheme.d.ts +18 -0
- package/dist/server/plugins/mcp/gateway-mcp/upstream-auth-scheme.js +1 -0
- package/dist/server/plugins/mcp/gateway-mcp/upstream-auth.d.ts +10 -0
- package/dist/server/plugins/mcp/gateway-mcp/upstream-auth.js +1 -0
- package/dist/server/plugins/mcp/handlers/docs-mcp-handler.js +1 -1
- package/dist/server/plugins/mcp/handlers/errors.d.ts +3 -3
- package/dist/server/plugins/mcp/handlers/errors.js +1 -1
- package/dist/server/plugins/mcp/handlers/handle-mcp-request.js +1 -1
- package/dist/server/plugins/mcp/handlers/mcp-credentials-handler.d.ts +5 -0
- package/dist/server/plugins/mcp/handlers/mcp-credentials-handler.js +101 -0
- package/dist/server/plugins/mcp/index.d.ts +1 -0
- package/dist/server/plugins/mcp/index.js +1 -1
- package/dist/server/plugins/mcp/servers/docs-server.d.ts +3 -2
- package/dist/server/plugins/mcp/servers/docs-server.js +1 -1
- package/dist/server/plugins/mcp/servers/mcp-server.d.ts +11 -2
- package/dist/server/plugins/mcp/servers/mcp-server.js +1 -1
- package/dist/server/plugins/mcp/servers/session-manager.d.ts +15 -0
- package/dist/server/plugins/mcp/servers/session-manager.js +1 -0
- package/dist/server/plugins/mcp/types.d.ts +6 -12
- package/dist/server/plugins/mcp/utils/jwt.d.ts +0 -9
- package/dist/server/plugins/mcp/utils/jwt.js +1 -1
- package/dist/server/plugins/mcp/utils/mode.d.ts +12 -2
- package/dist/server/plugins/mcp/utils/mode.js +1 -1
- package/dist/server/plugins/mcp/workers/execute-mcp-tool.js +1 -1
- package/dist/server/plugins/openapi-docs/search/get-ai-search-documents.js +16 -16
- package/dist/server/plugins/sso/index.js +1 -1
- package/dist/server/sandbox/types.d.ts +3 -2
- package/dist/server/sandbox/utils/execution-budget.d.ts +4 -3
- package/dist/server/sandbox/utils/execution-budget.js +1 -1
- package/dist/server/types/plugins/markdown.d.ts +2 -2
- package/dist/server/utils/crypto/constants.d.ts +5 -0
- package/dist/server/utils/crypto/constants.js +1 -0
- package/dist/server/utils/crypto/decrypt-aes-gcm.d.ts +6 -0
- package/dist/server/utils/crypto/decrypt-aes-gcm.js +1 -0
- package/dist/server/utils/crypto/decrypt-claim-value.d.ts +6 -0
- package/dist/server/utils/crypto/decrypt-claim-value.js +1 -0
- package/dist/server/utils/crypto/derive-key.d.ts +5 -0
- package/dist/server/utils/crypto/derive-key.js +1 -0
- package/dist/server/utils/crypto/encrypt-aes-gcm.d.ts +6 -0
- package/dist/server/utils/crypto/encrypt-aes-gcm.js +1 -0
- package/dist/server/utils/crypto/encrypt-claim-value.d.ts +6 -0
- package/dist/server/utils/crypto/encrypt-claim-value.js +1 -0
- package/dist/server/utils/l10n/get-build-translate-context.d.ts +7 -0
- package/dist/server/utils/l10n/get-build-translate-context.js +1 -0
- package/dist/server/utils/rbac.js +1 -1
- package/dist/server/web-server/auth.d.ts +33 -3
- package/dist/server/web-server/auth.js +3 -3
- package/dist/server/web-server/handle-api-route-request.js +1 -1
- package/dist/server/web-server/routes/api-routes/api-routes.js +1 -1
- package/dist/server/web-server/routes/auth.js +1 -1
- package/dist/server/web-server/routes/mcp-routes/mcp-oauth.d.ts +5 -2
- package/dist/server/web-server/routes/mcp-routes/mcp-oauth.js +1 -1
- package/dist/server/web-server/routes/mcp-routes/mcp-routes.js +1 -1
- package/dist/types/entitlements.d.ts +3 -1
- package/dist/utils/l10n/build-i18n-config.d.ts +24 -0
- package/dist/utils/l10n/build-i18n-config.js +1 -0
- package/dist/utils/l10n/create-translate.d.ts +19 -0
- package/dist/utils/l10n/create-translate.js +1 -0
- package/package.json +10 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# @redocly/realm
|
|
2
2
|
|
|
3
|
+
## 0.136.0-next.5
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- f7bb0ce633c: Added support for automatic access token refresh for the MCP server.
|
|
8
|
+
MCP clients keep long-running sessions alive without repeated browser logins.
|
|
9
|
+
- 339a4748440: Added `locale` and `translate` options to the `renderForLlms` tag render context, allowing custom Markdoc tags to localize their content in `llms.txt` and AI search output at build time.
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 12eed09e5b6: Fixed an issue in API docs where documented array items were not displayed in a nested indexed row.
|
|
14
|
+
- a8f19de21ab: Fixed security vulnerabilities `CVE-2026-59896`, `CVE-2026-59895`, and `CVE-2026-59897` by upgrading `hono` to version `4.12.27`.
|
|
15
|
+
- 50ec00284cd: Updated `@redocly/openapi-core` to version `2.40.0`.
|
|
16
|
+
- a8f19de21ab: Fixed security vulnerability `GHSA-c2j3-45gr-mqc4` by upgrading `dompurify` to version `3.4.12`.
|
|
17
|
+
- a8f19de21ab: Fixed security vulnerability `CVE-2026-59869` by upgrading `js-yaml` to version `4.3.0`.
|
|
18
|
+
- Updated dependencies [12eed09e5b6]
|
|
19
|
+
- Updated dependencies [50ec00284cd]
|
|
20
|
+
- Updated dependencies [a8f19de21ab]
|
|
21
|
+
- Updated dependencies [339a4748440]
|
|
22
|
+
- Updated dependencies [a8f19de21ab]
|
|
23
|
+
- @redocly/openapi-docs@3.24.0-next.5
|
|
24
|
+
- @redocly/theme@0.68.0-next.3
|
|
25
|
+
- @redocly/asyncapi-docs@1.13.0-next.5
|
|
26
|
+
- @redocly/graphql-docs@1.13.0-next.5
|
|
27
|
+
- @redocly/portal-plugin-mock-server@0.21.0-next.5
|
|
28
|
+
|
|
3
29
|
## 0.136.0-next.4
|
|
4
30
|
|
|
5
31
|
### Minor Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as s from"react";import{ErrorDetails as
|
|
1
|
+
import*as s from"react";import{getBaseDataAttributes as c}from"@redocly/theme/core/utils";import{ErrorDetails as i}from"./app/Error/ErrorDetails";import{telemetry as n}from"./app/telemetry/index.js";class l extends s.Component{constructor(r){super(r),this.state={error:void 0}}componentDidCatch(r,a){const{name:e,message:t}=r,o={name:e,message:t,stack:a.componentStack??void 0};this.setState({error:o}),n.sendClientErrorMessage([{...c("reactErrorBoundary","client"),message:`${e}: ${t}`,url:location.href}]),n.sendError(o,"ReactErrorBoundary"),process.env.NODE_ENV!=="production"&&console.log(r)}render(){return this.state.error&&process.env.NODE_ENV!=="production"?s.createElement(i,{error:this.state.error}):this.props.children}}export{l as ErrorBoundary};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import r from"i18next";import{useMemo as e}from"react";import{createTranslate as o}from"../../../../utils/l10n/create-translate.js";import{useL10n as n}from"./useL10n";const p=()=>{const{lang:t}=n();return{translate:e(()=>o(r.t),[t])}};export{p as useTranslate};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import o from"i18next";import{buildI18nConfig as a}from"../../../utils/l10n/build-i18n-config.js";async function c(i,n){const t=await a(i,n);await o.init(t)}export{c as initL10n};
|
|
@@ -13,6 +13,6 @@ export declare function joinWithSeparator(base?: string, path?: string, sep?: st
|
|
|
13
13
|
export declare function parsePartials(partials?: Record<string, any>): Record<string, Node[] | Node> | undefined;
|
|
14
14
|
export declare function usePatchedStore(storeJs: OpenAPIDocsStore, { markdown, baseSlug }: PageProps): OpenAPIDocsStore;
|
|
15
15
|
export declare function safeParseFunction(fnInput: EventFunctionInput): ((event: EventType) => void) | null;
|
|
16
|
-
export declare function mergeEvents(userFunction: ((event: EventType) => void) | null, telemetryEvent?: AsyncApiRealmUI.GetEventData<'
|
|
16
|
+
export declare function mergeEvents(userFunction: ((event: EventType) => void) | null, telemetryEvent?: AsyncApiRealmUI.GetEventData<'com.redocly.openapiDocs.interacted'>[0]['eventType']): (event: EventType) => void;
|
|
17
17
|
export {};
|
|
18
18
|
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{useMemo as f}from"react";import{components as
|
|
1
|
+
import{useMemo as f}from"react";import{components as g}from"@redocly-markdoc/components";import{schema as c}from"@redocly-markdoc/schema";import{Ast as d}from"@markdoc/markdoc";import{PageNavigation as h}from"@redocly/theme/components/PageNavigation/PageNavigation";import{tags as _,components as y}from"@redocly/theme/markdoc/default";import{Breadcrumbs as P}from"@redocly/theme/components/Breadcrumbs/Breadcrumbs";import{withPathPrefix as m,getBaseDataAttributes as w}from"@redocly/theme/core/utils";import{ServerRoutes as u}from"../../../constants/api.js";import{OPENAPI_DOCS_TEMPLATE_ID as S}from"../../../constants/common.js";import{isBrowser as O}from"../../../utils/env/is-browser.js";import*as v from"../../../markdoc/nodes/index.js";import C from"../../../markdoc/tags/index.js";import{normalizeCustomTags as T}from"../../../markdoc/helpers/normalize-custom-tags.js";import*as A from"../../app/markdoc/custom-components/index.js";import{usePageData as x,useSidebarSiblingsData as D}from"../../providers/page-data/hooks";import{telemetry as E}from"../../app/telemetry/index.js";import{getMockServerDocsConfig as R}from"./mock-server-config.js";function Z(o="",r="",t="/"){return o.endsWith(t)&&(o=o.slice(0,-t.length)),r.startsWith(t)&&(r=r.slice(t.length)),!o||!r?o+r:o+t+r}function b(o){if(o)return Object.entries(o).reduce((r,[t,n])=>(r[t]=d.fromJSON(JSON.stringify(n)),r),{})}function G(o,{markdown:r,baseSlug:t}){return f(()=>{const i=O();if(o.options.oAuth2RedirectURI=i?`${window.location.origin}${m(u.REPLAY_OAUTH2_CALLBACK)}`:void 0,o.options.routingBasePath=m(t),o.options.mockServer=R(o.options.mockServer,t),o.options.corsProxyUrl===void 0){const e=m(`${u.CORS_PROXY}/`);o.options.corsProxyUrl=i?new URL(e,window.location.origin).toString():e}o.options.scrollYOffset=i?parseInt(getComputedStyle(document.documentElement).getPropertyValue("--navbar-height"),10):0,o.options.markdocOptions={tags:{...C,..._,...T(c?.tags??{})},nodes:{...v,...c?.nodes??{}},functions:{...c?.functions??{}},components:{...A,...y,...g,...globalThis.__LOADER.markdocComponents},...r,partials:b(r?.partials)},o.options.unstable_hooks={...o.options.unstable_hooks,MiddlePanelFooter:()=>{const{templateId:e}=x()||{},{nextPage:s,prevPage:a}=D()||{};return e===S?null:h({nextPage:s,prevPage:a})},MiddlePanelHeader:()=>P({})};const l={codeSamplesLanguageSwitch:"samples_language_switch",codeSamplesCopy:"code_samples_copy",panelToggle:"panel_toggle",targetServerSwitch:"target_server_switch",tryItOpen:"try_it_toggle",tryItSent:"try_it_sent"},p={};for(const[e,s]of Object.entries(l)){const a=I(o.options.events?.[e]);p[e]=U(a,s)}return o.options.events=p,o},[o,r,t])}function I(o){if(typeof window>"u")return null;if(typeof o=="function")return o;if(typeof o!="string")return null;try{const r=o.trim();if(!r.match(/^(\([^)]*\)\s*=>\s*.+|[a-zA-Z_$][\w$]*\s*=>\s*.+)$/))throw new Error("Invalid function format. Only arrow functions allowed.");if(["eval","Function","constructor","prototype","__proto__","import","require","process","global","window","document"].some(i=>r.includes(i)))throw new Error("Function contains prohibited keywords");return new Function("event",`
|
|
2
2
|
'use strict';
|
|
3
3
|
const userFn = ${r};
|
|
4
4
|
return userFn(event);
|
|
5
|
-
`)}catch(r){return console.error("Function parsing error:",r),null}}function
|
|
5
|
+
`)}catch(r){return console.error("Function parsing error:",r),null}}function U(o,r){return t=>{if(o)try{o(t)}catch(n){console.error("User event handler error:",n)}if(r)try{E.sendOpenapiDocsMessage([{...w("openapiDocsInteraction","openapiDocs"),eventType:r,operationHttpVerb:t.operationHttpVerb,operationPath:t.operationPath,lang:"lang"in t?t.lang:void 0,action:t.action,state:"state"in t?t.state:void 0,serverUrl:"serverUrl"in t?t.serverUrl:void 0}])}catch{}}}export{Z as joinWithSeparator,U as mergeEvents,b as parsePartials,I as safeParseFunction,G as usePatchedStore};
|
|
@@ -3,6 +3,7 @@ export declare const AuthCookieNames: {
|
|
|
3
3
|
readonly AUTHORIZATION: 'authorization';
|
|
4
4
|
readonly IDP_ID_TOKEN: 'idp_id_token';
|
|
5
5
|
readonly IDP_ACCESS_TOKEN: 'idp_access_token';
|
|
6
|
+
readonly IDP_REFRESH_TOKEN: 'idp_refresh_token';
|
|
6
7
|
readonly FEDERATED_ACCESS_TOKEN: 'federated_access_token';
|
|
7
8
|
readonly FEDERATED_ID_TOKEN: 'federated_id_token';
|
|
8
9
|
};
|
|
@@ -103,6 +104,8 @@ export declare const FEATURE: {
|
|
|
103
104
|
readonly aiSearchLimit: 'aiSearchLimit';
|
|
104
105
|
readonly kvStorageLimit: 'kvStorageLimit';
|
|
105
106
|
readonly mcp: 'mcp';
|
|
107
|
+
readonly mcpGateway: 'mcpGateway';
|
|
108
|
+
readonly mcpMode: 'mcpMode';
|
|
106
109
|
readonly banner: 'banner';
|
|
107
110
|
};
|
|
108
111
|
//# sourceMappingURL=common.d.ts.map
|
package/dist/constants/common.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a={AUTHORIZATION:"authorization",IDP_ID_TOKEN:"idp_id_token",IDP_ACCESS_TOKEN:"idp_access_token",FEDERATED_ACCESS_TOKEN:"federated_access_token",FEDERATED_ID_TOKEN:"federated_id_token"},n="post_logout",_="openapi_docs",E="asyncapi_docs",p="graphql_docs",
|
|
1
|
+
const a={AUTHORIZATION:"authorization",IDP_ID_TOKEN:"idp_id_token",IDP_ACCESS_TOKEN:"idp_access_token",IDP_REFRESH_TOKEN:"idp_refresh_token",FEDERATED_ACCESS_TOKEN:"federated_access_token",FEDERATED_ID_TOKEN:"federated_id_token"},n="post_logout",_="openapi_docs",E="asyncapi_docs",p="graphql_docs",i="/_spec-gql",A="markdoc",S="tags",c="*",O={[c]:"read"},d=["openid","email"],L=1440*60,I=720*60*60,T="anonymous",R="authenticated",l="**",C="Reunite",x="translations.yaml",P="redocly.yaml",D="@redocly/theme",N="@theme",m="@skills",U="SKILL.md",u="/.well-known/agent-skills",g="/.well-known/agent-card.json",M="/a2a",h="/.well-known/mcp/server-card.json",F="/app-data.json",k="/eject-component";var t;(function(o){o.BUILD="build",o.DEVELOP="develop",o.PREPARE="prepare"})(t||(t={}));var e;(function(o){o.RATING="rating",o.SENTIMENT="sentiment",o.COMMENT="comment",o.MOOD="mood",o.PROBLEM="problem",o.SCALE="scale"})(e||(e={}));var r;(function(o){o.AI_SEARCH="aiSearch"})(r||(r={}));const b="/login",G="/invite",v={AUTH0_PASS:"/auth/auth0-pass"},H={NotExist:"ENOENT"},y="default_locale",K="sidebar-",w="PUBLIC_",B="branch.",f=["BROKEN_LINK","MARKDOC","RESOLVE"],V=["logo","navbar","products","footer","sidebar","scripts","links","feedback","search","aiAssistant","colorMode","palette","navigation","codeSnippet","markdown","openapi","graphql","analytics","userMenu","versionPicker","breadcrumbs","catalog","entitiesCatalog","scorecard","scorecards","scorecardClassic","mcp","banner"],s="redocly_category",j="redocly_product",q="redocly_version",X="redocly_teams",Q=s,W={asyncapi:"asyncapi",apiFunctions:"apiFunctions",reactPages:"reactPages",catalog:"catalog",catalogClassic:"catalogClassic",lint:"lint",scorecard:"scorecard",scorecards:"scorecards",l10n:"l10n",openapi:"openapi",graphql:"graphql",markdown:"markdown",devOnboarding:"devOnboarding",seo:"seo",redirects:"redirects",customPlugins:"customPlugins",themeEjecting:"themeEjecting",products:"products",breadcrumbs:"breadcrumbs",mockServer:"mockServer",sso:"sso",rbac:"rbac",analytics:"analytics",removeAttribution:"removeAttribution",advancedSearch:"advancedSearch",soap:"soap",ssoDirect:"ssoDirect",codeWalkthrough:"codeWalkthrough",aiSearchLimit:"aiSearchLimit",kvStorageLimit:"kvStorageLimit",mcp:"mcp",mcpGateway:"mcpGateway",mcpMode:"mcpMode",banner:"banner"};export{M as A2A_SLUG,g as AGENT_CARD_SLUG,u as AGENT_SKILLS_BASE,E as ASYNC_API_DOCS_TEMPLATE_ID,a as AuthCookieNames,B as BRANCH_ENV_PREFIX,P as CONFIG_FILE_NAME,A as CUSTOM_MARKDOC_OPTIONS_PATH,S as CUSTOM_MARKDOC_TAGS_PATH,T as DEFAULT_ANONYMOUS_VISITOR_TEAM,R as DEFAULT_AUTHENTICATED_TEAM,L as DEFAULT_COOKIE_EXPIRATION,y as DEFAULT_LOCALE_PLACEHOLDER,l as DEFAULT_RBAC_SCOPE,C as DEFAULT_SSO_IDP_TITLE,D as DEFAULT_THEME_NAME,b as DEV_LOGIN_SLUG,k as EJECT_COMPONENT_URL,v as ExternalRoutes,W as FEATURE,e as FEEDBACK_TYPES,H as FsErrors,F as GLOBAL_DATA_URL,i as GRAPHQL_SPEC_SLUG,p as GRAPHQL_TEMPLATE_ID,G as INVITE_SLUG,f as MARKDOC_ERROR_TYPES,h as MCP_SERVER_CARD_SLUG,_ as OPENAPI_DOCS_TEMPLATE_ID,I as POST_LOGOUT_COOKIE_EXPIRATION,n as POST_LOGOUT_COOKIE_NAME,w as PUBLIC_ENV_PREFIX,O as PUBLIC_RBAC_SCOPE_ITEM,c as RBAC_ALL_OTHER_TEAMS,d as REQUIRED_OIDC_SCOPES,r as RbacFeatures,s as SEARCH_CATEGORY_FIELD,Q as SEARCH_GROUP_FACET_FIELD,j as SEARCH_PRODUCT_FIELD,X as SEARCH_RBAC_FIELD,q as SEARCH_VERSION_FIELD,K as SIDEBAR_PREFIX,x as TRANSLATIONS_FILE_NAME,V as UI_ACCESSIBLE_CONFIG_PROPS,m as USER_SKILLS_ALIAS,U as USER_SKILL_FILENAME,N as USER_THEME_ALIAS,t as cliCommandNames};
|
|
@@ -52,9 +52,8 @@ declare function loadEnvConfig(): {
|
|
|
52
52
|
REDOCLY_EXP_LLMSTXT_AGENT_FEEDBACK_ENABLED?: boolean | undefined;
|
|
53
53
|
REDOCLY_EXP_LLMSTXT_AGENT_FEEDBACK_URL?: string | undefined;
|
|
54
54
|
REDOCLY_EXP_LLMSTXT_AGENT_ENDPOINT?: string | undefined;
|
|
55
|
-
REDOCLY_EXP_MCP_CODE_MODE_ENABLED?: boolean | undefined;
|
|
56
|
-
REDOCLY_EXP_MCP_GATEWAY_SERVER_ENABLED?: boolean | undefined;
|
|
57
55
|
REDOCLY_DISABLE_API_FUNCTION_SANDBOX?: boolean | undefined;
|
|
56
|
+
REDOCLY_EXP_MCP_ELICITATION_ENABLED?: boolean | undefined;
|
|
58
57
|
SEARCH_DEV_REINIT?: string | undefined;
|
|
59
58
|
SEARCH_DEV_DEBUG: boolean;
|
|
60
59
|
TYPESENSE_API_URL?: string | undefined;
|
|
@@ -134,9 +133,8 @@ export declare const envConfig: {
|
|
|
134
133
|
REDOCLY_EXP_LLMSTXT_AGENT_FEEDBACK_ENABLED?: boolean | undefined;
|
|
135
134
|
REDOCLY_EXP_LLMSTXT_AGENT_FEEDBACK_URL?: string | undefined;
|
|
136
135
|
REDOCLY_EXP_LLMSTXT_AGENT_ENDPOINT?: string | undefined;
|
|
137
|
-
REDOCLY_EXP_MCP_CODE_MODE_ENABLED?: boolean | undefined;
|
|
138
|
-
REDOCLY_EXP_MCP_GATEWAY_SERVER_ENABLED?: boolean | undefined;
|
|
139
136
|
REDOCLY_DISABLE_API_FUNCTION_SANDBOX?: boolean | undefined;
|
|
137
|
+
REDOCLY_EXP_MCP_ELICITATION_ENABLED?: boolean | undefined;
|
|
140
138
|
SEARCH_DEV_REINIT?: string | undefined;
|
|
141
139
|
SEARCH_DEV_DEBUG: boolean;
|
|
142
140
|
TYPESENSE_API_URL?: string | undefined;
|
|
@@ -56,9 +56,8 @@ export declare const envSchema: z.ZodEffects<z.ZodObject<{
|
|
|
56
56
|
REDOCLY_EXP_LLMSTXT_AGENT_FEEDBACK_ENABLED: z.ZodEffects<z.ZodOptional<z.ZodEnum<["true", "false"]>>, boolean | undefined, "false" | "true" | undefined>;
|
|
57
57
|
REDOCLY_EXP_LLMSTXT_AGENT_FEEDBACK_URL: z.ZodOptional<z.ZodString>;
|
|
58
58
|
REDOCLY_EXP_LLMSTXT_AGENT_ENDPOINT: z.ZodOptional<z.ZodString>;
|
|
59
|
-
REDOCLY_EXP_MCP_CODE_MODE_ENABLED: z.ZodEffects<z.ZodOptional<z.ZodEnum<["true", "false"]>>, boolean | undefined, "false" | "true" | undefined>;
|
|
60
|
-
REDOCLY_EXP_MCP_GATEWAY_SERVER_ENABLED: z.ZodEffects<z.ZodOptional<z.ZodEnum<["true", "false"]>>, boolean | undefined, "false" | "true" | undefined>;
|
|
61
59
|
REDOCLY_DISABLE_API_FUNCTION_SANDBOX: z.ZodEffects<z.ZodOptional<z.ZodEnum<["true", "false"]>>, boolean | undefined, "false" | "true" | undefined>;
|
|
60
|
+
REDOCLY_EXP_MCP_ELICITATION_ENABLED: z.ZodEffects<z.ZodOptional<z.ZodEnum<["true", "false"]>>, boolean | undefined, "false" | "true" | undefined>;
|
|
62
61
|
} & {
|
|
63
62
|
SEARCH_DEV_REINIT: z.ZodOptional<z.ZodString>;
|
|
64
63
|
SEARCH_DEV_DEBUG: z.ZodEffects<z.ZodDefault<z.ZodEnum<["true", "false"]>>, boolean, "false" | "true" | undefined>;
|
|
@@ -135,9 +134,8 @@ export declare const envSchema: z.ZodEffects<z.ZodObject<{
|
|
|
135
134
|
REDOCLY_EXP_LLMSTXT_AGENT_FEEDBACK_ENABLED?: boolean | undefined;
|
|
136
135
|
REDOCLY_EXP_LLMSTXT_AGENT_FEEDBACK_URL?: string | undefined;
|
|
137
136
|
REDOCLY_EXP_LLMSTXT_AGENT_ENDPOINT?: string | undefined;
|
|
138
|
-
REDOCLY_EXP_MCP_CODE_MODE_ENABLED?: boolean | undefined;
|
|
139
|
-
REDOCLY_EXP_MCP_GATEWAY_SERVER_ENABLED?: boolean | undefined;
|
|
140
137
|
REDOCLY_DISABLE_API_FUNCTION_SANDBOX?: boolean | undefined;
|
|
138
|
+
REDOCLY_EXP_MCP_ELICITATION_ENABLED?: boolean | undefined;
|
|
141
139
|
SEARCH_DEV_REINIT?: string | undefined;
|
|
142
140
|
SEARCH_DEV_DEBUG: boolean;
|
|
143
141
|
TYPESENSE_API_URL?: string | undefined;
|
|
@@ -207,9 +205,8 @@ export declare const envSchema: z.ZodEffects<z.ZodObject<{
|
|
|
207
205
|
REDOCLY_EXP_LLMSTXT_AGENT_FEEDBACK_ENABLED?: "false" | "true" | undefined;
|
|
208
206
|
REDOCLY_EXP_LLMSTXT_AGENT_FEEDBACK_URL?: string | undefined;
|
|
209
207
|
REDOCLY_EXP_LLMSTXT_AGENT_ENDPOINT?: string | undefined;
|
|
210
|
-
REDOCLY_EXP_MCP_CODE_MODE_ENABLED?: "false" | "true" | undefined;
|
|
211
|
-
REDOCLY_EXP_MCP_GATEWAY_SERVER_ENABLED?: "false" | "true" | undefined;
|
|
212
208
|
REDOCLY_DISABLE_API_FUNCTION_SANDBOX?: "false" | "true" | undefined;
|
|
209
|
+
REDOCLY_EXP_MCP_ELICITATION_ENABLED?: "false" | "true" | undefined;
|
|
213
210
|
SEARCH_DEV_REINIT?: string | undefined;
|
|
214
211
|
SEARCH_DEV_DEBUG?: "false" | "true" | undefined;
|
|
215
212
|
TYPESENSE_API_URL?: string | undefined;
|
|
@@ -279,9 +276,8 @@ export declare const envSchema: z.ZodEffects<z.ZodObject<{
|
|
|
279
276
|
REDOCLY_EXP_LLMSTXT_AGENT_FEEDBACK_ENABLED?: boolean | undefined;
|
|
280
277
|
REDOCLY_EXP_LLMSTXT_AGENT_FEEDBACK_URL?: string | undefined;
|
|
281
278
|
REDOCLY_EXP_LLMSTXT_AGENT_ENDPOINT?: string | undefined;
|
|
282
|
-
REDOCLY_EXP_MCP_CODE_MODE_ENABLED?: boolean | undefined;
|
|
283
|
-
REDOCLY_EXP_MCP_GATEWAY_SERVER_ENABLED?: boolean | undefined;
|
|
284
279
|
REDOCLY_DISABLE_API_FUNCTION_SANDBOX?: boolean | undefined;
|
|
280
|
+
REDOCLY_EXP_MCP_ELICITATION_ENABLED?: boolean | undefined;
|
|
285
281
|
SEARCH_DEV_REINIT?: string | undefined;
|
|
286
282
|
SEARCH_DEV_DEBUG: boolean;
|
|
287
283
|
TYPESENSE_API_URL?: string | undefined;
|
|
@@ -351,9 +347,8 @@ export declare const envSchema: z.ZodEffects<z.ZodObject<{
|
|
|
351
347
|
REDOCLY_EXP_LLMSTXT_AGENT_FEEDBACK_ENABLED?: "false" | "true" | undefined;
|
|
352
348
|
REDOCLY_EXP_LLMSTXT_AGENT_FEEDBACK_URL?: string | undefined;
|
|
353
349
|
REDOCLY_EXP_LLMSTXT_AGENT_ENDPOINT?: string | undefined;
|
|
354
|
-
REDOCLY_EXP_MCP_CODE_MODE_ENABLED?: "false" | "true" | undefined;
|
|
355
|
-
REDOCLY_EXP_MCP_GATEWAY_SERVER_ENABLED?: "false" | "true" | undefined;
|
|
356
350
|
REDOCLY_DISABLE_API_FUNCTION_SANDBOX?: "false" | "true" | undefined;
|
|
351
|
+
REDOCLY_EXP_MCP_ELICITATION_ENABLED?: "false" | "true" | undefined;
|
|
357
352
|
SEARCH_DEV_REINIT?: string | undefined;
|
|
358
353
|
SEARCH_DEV_DEBUG?: "false" | "true" | undefined;
|
|
359
354
|
TYPESENSE_API_URL?: string | undefined;
|
|
@@ -15,12 +15,10 @@ export declare const featureFlagsSchema: z.ZodObject<{
|
|
|
15
15
|
REDOCLY_EXP_LLMSTXT_AGENT_FEEDBACK_URL: z.ZodOptional<z.ZodString>;
|
|
16
16
|
/** (Optional) API endpoint for the agent feedback endpoint;**/
|
|
17
17
|
REDOCLY_EXP_LLMSTXT_AGENT_ENDPOINT: z.ZodOptional<z.ZodString>;
|
|
18
|
-
/** Experimental: serve the Docs MCP server in codemode (a single `execute` tool). */
|
|
19
|
-
REDOCLY_EXP_MCP_CODE_MODE_ENABLED: z.ZodEffects<z.ZodOptional<z.ZodEnum<["true", "false"]>>, boolean | undefined, "false" | "true" | undefined>;
|
|
20
|
-
/** Experimental: give the docs MCP `execute` sandbox a guarded `fetch` that can call gateway-eligible APIs. */
|
|
21
|
-
REDOCLY_EXP_MCP_GATEWAY_SERVER_ENABLED: z.ZodEffects<z.ZodOptional<z.ZodEnum<["true", "false"]>>, boolean | undefined, "false" | "true" | undefined>;
|
|
22
18
|
/** Escape hatch: disables the Node Permission Model sandbox on API function and MCP tool worker processes (hosted Reunite environments only). */
|
|
23
19
|
REDOCLY_DISABLE_API_FUNCTION_SANDBOX: z.ZodEffects<z.ZodOptional<z.ZodEnum<["true", "false"]>>, boolean | undefined, "false" | "true" | undefined>;
|
|
20
|
+
/** Experimental: prompt for upstream API credentials via URL-mode elicitation. Requires the gateway capability. */
|
|
21
|
+
REDOCLY_EXP_MCP_ELICITATION_ENABLED: z.ZodEffects<z.ZodOptional<z.ZodEnum<["true", "false"]>>, boolean | undefined, "false" | "true" | undefined>;
|
|
24
22
|
}, "strip", z.ZodTypeAny, {
|
|
25
23
|
NEW_CATALOG_ENABLED?: boolean | undefined;
|
|
26
24
|
NEW_SCORECARDS_ENABLED?: boolean | undefined;
|
|
@@ -31,9 +29,8 @@ export declare const featureFlagsSchema: z.ZodObject<{
|
|
|
31
29
|
REDOCLY_EXP_LLMSTXT_AGENT_FEEDBACK_ENABLED?: boolean | undefined;
|
|
32
30
|
REDOCLY_EXP_LLMSTXT_AGENT_FEEDBACK_URL?: string | undefined;
|
|
33
31
|
REDOCLY_EXP_LLMSTXT_AGENT_ENDPOINT?: string | undefined;
|
|
34
|
-
REDOCLY_EXP_MCP_CODE_MODE_ENABLED?: boolean | undefined;
|
|
35
|
-
REDOCLY_EXP_MCP_GATEWAY_SERVER_ENABLED?: boolean | undefined;
|
|
36
32
|
REDOCLY_DISABLE_API_FUNCTION_SANDBOX?: boolean | undefined;
|
|
33
|
+
REDOCLY_EXP_MCP_ELICITATION_ENABLED?: boolean | undefined;
|
|
37
34
|
}, {
|
|
38
35
|
NEW_CATALOG_ENABLED?: "false" | "true" | undefined;
|
|
39
36
|
NEW_SCORECARDS_ENABLED?: "false" | "true" | undefined;
|
|
@@ -44,8 +41,7 @@ export declare const featureFlagsSchema: z.ZodObject<{
|
|
|
44
41
|
REDOCLY_EXP_LLMSTXT_AGENT_FEEDBACK_ENABLED?: "false" | "true" | undefined;
|
|
45
42
|
REDOCLY_EXP_LLMSTXT_AGENT_FEEDBACK_URL?: string | undefined;
|
|
46
43
|
REDOCLY_EXP_LLMSTXT_AGENT_ENDPOINT?: string | undefined;
|
|
47
|
-
REDOCLY_EXP_MCP_CODE_MODE_ENABLED?: "false" | "true" | undefined;
|
|
48
|
-
REDOCLY_EXP_MCP_GATEWAY_SERVER_ENABLED?: "false" | "true" | undefined;
|
|
49
44
|
REDOCLY_DISABLE_API_FUNCTION_SANDBOX?: "false" | "true" | undefined;
|
|
45
|
+
REDOCLY_EXP_MCP_ELICITATION_ENABLED?: "false" | "true" | undefined;
|
|
50
46
|
}>;
|
|
51
47
|
//# sourceMappingURL=feature-flags.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{z as _}from"zod";import{envBooleanStringOptional as E}from"../../utils/envs/env-boolean-string.js";const
|
|
1
|
+
import{z as _}from"zod";import{envBooleanStringOptional as E}from"../../utils/envs/env-boolean-string.js";const N=_.object({NEW_CATALOG_ENABLED:E(),NEW_SCORECARDS_ENABLED:E(),ENABLE_COMMENTS:_.string().optional(),REDOCLY_EXP_DISABLE_MD_VALIDATION:E(),ENABLE_SOURCE_MAPS:E(),PLAN_GATES:_.string().optional(),REDOCLY_EXP_LLMSTXT_AGENT_FEEDBACK_ENABLED:E(),REDOCLY_EXP_LLMSTXT_AGENT_FEEDBACK_URL:_.string().optional(),REDOCLY_EXP_LLMSTXT_AGENT_ENDPOINT:_.string().optional(),REDOCLY_DISABLE_API_FUNCTION_SANDBOX:E(),REDOCLY_EXP_MCP_ELICITATION_ENABLED:E()});export{N as featureFlagsSchema};
|
|
@@ -11,6 +11,8 @@ export declare const DEFAULT_THEME_PLUGIN_PATH = "@redocly/theme/plugin.js";
|
|
|
11
11
|
export declare const STYLES_FILE = "styles.css";
|
|
12
12
|
export declare const DEFAULT_PROJECT_PLUGIN_PATHS: string[];
|
|
13
13
|
export declare const JWT_SECRET_KEY: string;
|
|
14
|
+
export declare const MCP_ACCESS_TOKEN_TTL_SEC: number;
|
|
15
|
+
export declare const MCP_REFRESH_SESSION_LIFETIME_SEC: number;
|
|
14
16
|
export declare const I18N_DIR_NAME = "@i18n";
|
|
15
17
|
export declare const L10N_DIR_NAME = "@l10n";
|
|
16
18
|
export declare const RESERVED_DIR_NAMES: string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ServerRoutes as
|
|
1
|
+
import{ServerRoutes as I}from"../../constants/api.js";import{USER_THEME_ALIAS as A}from"../../constants/common.js";import{envConfig as _}from"../config/env-config.js";const N="runtime",x="/assets",U="/_spec",M="/_bundle",P="static",l="redocly:::linkOriginal",a="@",i="default",m=new RegExp("((?!@i18n\\/|@l10n\\/)\\/?@.*?(?=\\/))","g"),F="@redocly/theme/plugin.js",H="styles.css",u=["@theme/plugin.js","@theme/plugin.cjs","@theme/plugin.mjs"],d=_.JWT_SECRET_KEY||"test_secret_key",G=3600,K=1440*60,c="@i18n",S="@l10n",Y=[A,c,S],B="https://redocly.com/auth/aud",g="catalog.json",h="scorecard.json",J="page-count.json",W="sitemap.xml",f="llms.txt",o=_.PROJECT_ID,R=_.PROJECT_SLUG,e=_.ORGANIZATION_ID,n=_.ORG_SLUG,E=_.BH_API_URL,s=E&&n&&R?`${E}/orgs/${n}/projects/${R}`:void 0,t=E&&e&&o?`${E}/orgs/${e}/projects/${o}`:void 0,p=E?`${E}/entitlements/.well-known/jwks`:"https://app.cloud.redocly.com/api/entitlements/.well-known/jwks",j=_.ENTITLEMENTS_JWKS_CDN_URL||p,k=s?`${s}/feedback`:"",w=t?`${t}/ai-agentic-conversations`:"",V=t?`${t}/semantic-search`:"",X="no-store",$=365*24*60*60,v="X-Redocly-Cache-Control",y="no-cache",b="public, s-maxage=86400, max-age=10, must-revalidate",Z=_.AUTH_URL,q="Developer Documentation",T=_.REDOCLY_SSR_RENDER_MODE==="worker"?"worker":"main",z=T==="main"?0:_.REDOCLY_SSR_WORKERS_MIN!=null?Number(_.REDOCLY_SSR_WORKERS_MIN):2,Q=T==="main"?1:_.REDOCLY_SSR_WORKERS_MAX!=null?Number(_.REDOCLY_SSR_WORKERS_MAX):5,__="-----BEGIN CERTIFICATE-----",E_="-----END CERTIFICATE-----",t_=!_.isDevelopMode&&_.REDOCLY_TELEMETRY!=="off"||_.REDOCLY_TELEMETRY==="on",o_="http://localhost:4318/v1/traces",R_=[I.HEALTH],r=_.SERVER_EDITOR_APP_URL||"http://127.0.0.1:3000",e_=_.REDOCLY_CORS_ORIGINS?_.REDOCLY_CORS_ORIGINS.split(",").map(L=>L.trim()).filter(Boolean).concat(r):[r],n_="markdown/partials",s_="markdown/partials-deps";export{e_ as ALLOWED_CORS_ORIGINS,B as ALTERNATIVE_AUD_CLAIM_NAME,w as ASK_AI_API_URL,Z as AUTH_URL,__ as BEGIN_CERTIFICATE_DELIMITER,s as BH_API_PROJECTS_URL,t as BH_API_PROJECTS_URL_V2,X as CACHE_CONTROL_NO_STORE_HEADER_VALUE,y as CACHE_CONTROL_PUBLIC_HTML,g as CATALOG_OUTPUT_FILE_NAME,$ as DEFAULT_IMMUTABLE_CACHE_MAX_AGE,u as DEFAULT_PROJECT_PLUGIN_PATHS,F as DEFAULT_THEME_PLUGIN_PATH,q as DEFAULT_TITLE,i as DEFAULT_VERSION_NAME,U as DEPRECATED_PUBLIC_API_DEFINITIONS_FOLDER,E_ as END_CERTIFICATE_DELIMITER,j as ENTITLEMENTS_JWKS_URL,k as FEEDBACK_API_URL,c as I18N_DIR_NAME,d as JWT_SECRET_KEY,S as L10N_DIR_NAME,l as LINK_ORIGINAL_ATTR_NAME,f as LLMS_TXT_FILE_NAME,n_ as MARKDOC_PARTIALS_DATA_KEY,s_ as MARKDOC_PARTIALS_DEPS_KEY,G as MCP_ACCESS_TOKEN_TTL_SEC,K as MCP_REFRESH_SESSION_LIFETIME_SEC,e as ORG_ID,n as ORG_SLUG,R_ as OTEL_EXCLUDED_ROUTES,o_ as OTEL_TRACES_DEV_URL,J as PAGE_COUNT_OUTPUT_FILE_NAME,o as PROJECT_ID,R as PROJECT_SLUG,M as PUBLIC_API_DEFINITIONS_FOLDER,x as PUBLIC_ASSETS_FOLDER,P as PUBLIC_STATIC_FOLDER,Y as RESERVED_DIR_NAMES,N as RUNTIME_RESOURCES_DIR,h as SCORECARD_OUTPUT_FILE_NAME,V as SEMANTIC_SEARCH_API_URL,r as SERVER_EDITOR_APP_URL,W as SITEMAP_FILE_NAME,T as SSR_RENDER_MODE,Q as SSR_WORKERS_MAX,z as SSR_WORKERS_MIN,H as STYLES_FILE,t_ as TELEMETRY_ENABLED,m as VERSIONED_FOLDER_REGEXP_MATCH,a as VERSION_SEPARATOR,v as X_REDOCLY_CACHE_CONTROL_HEADER,b as X_REDOCLY_CACHE_CONTROL_PUBLIC_HTML};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e={pro:{rbac:!1,sso:!1,analytics:!0,removeAttribution:!1,advancedSearch:!1,ssoDirect:!1,aiSearchLimit:0,kvStorageLimit:.5,mcp:!1},enterprise:{rbac:!0,sso:!0,analytics:!0,removeAttribution:!0,advancedSearch:!0,ssoDirect:!1,aiSearchLimit:750,kvStorageLimit:5,mcp:!0}},t=["@redocly/portal-plugin-async-api/plugin.js","@redocly/portal-plugin-mock-server/plugin.js","@redocly/portal-plugin-soap-api/plugin.js"],
|
|
1
|
+
const e={pro:{rbac:!1,sso:!1,analytics:!0,removeAttribution:!1,advancedSearch:!1,ssoDirect:!1,aiSearchLimit:0,kvStorageLimit:.5,mcp:!1,mcpGateway:!1,mcpMode:"tools"},enterprise:{rbac:!0,sso:!0,analytics:!0,removeAttribution:!0,advancedSearch:!0,ssoDirect:!1,aiSearchLimit:750,kvStorageLimit:5,mcp:!0,mcpGateway:!0,mcpMode:"code"}},t=["@redocly/portal-plugin-async-api/plugin.js","@redocly/portal-plugin-mock-server/plugin.js","@redocly/portal-plugin-soap-api/plugin.js"],a={"code-walkthrough":"codeWalkthrough",step:"codeWalkthrough",toggle:"codeWalkthrough",input:"codeWalkthrough"};export{a as GATED_MARKDOC_TAGS,t as GATED_PLUGINS,e as PLAN_GATES_DEFAULTS};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import w from"path";import{lintConfig as A,loadConfig as T,createConfigTypes as U}from"@redocly/openapi-core";import{deepMerge as $}from"../../../../../utils/object/deep-merge.js";import{logger as d}from"../../../../tools/notifiers/logger.js";import{BRANCH_ENV_PREFIX as L}from"../../../../../constants/common.js";import{sanitizeBranchName as x}from"../../../../utils/envs/sanitize-branch-name.js";import{envConfig as C}from"../../../../config/env-config.js";import{safeParsePartial as E}from"../../safe-parse.js";import{formatConfigProblem as B}from"../../format-error.js";import{ExternalResolver as j}from"../../../../fs/utils/external-ref-resolver.js";import{resolveMutuallyExclusiveProps as q}from"../../resolve-mutual-exclusion.js";function
|
|
1
|
+
import w from"path";import{lintConfig as A,loadConfig as T,createConfigTypes as U}from"@redocly/openapi-core";import{deepMerge as $}from"../../../../../utils/object/deep-merge.js";import{logger as d}from"../../../../tools/notifiers/logger.js";import{BRANCH_ENV_PREFIX as L}from"../../../../../constants/common.js";import{sanitizeBranchName as x}from"../../../../utils/envs/sanitize-branch-name.js";import{envConfig as C}from"../../../../config/env-config.js";import{safeParsePartial as E}from"../../safe-parse.js";import{formatConfigProblem as B}from"../../format-error.js";import{ExternalResolver as j}from"../../../../fs/utils/external-ref-resolver.js";import{resolveMutuallyExclusiveProps as q}from"../../resolve-mutual-exclusion.js";function h(e,t,s,o){t in e&&e[t]&&typeof e[t]=="string"&&(/^https?:\/\/.*/.test(e[t])||o(new Error(`Invalid ${s} URL: "${e[t]}". ${s} must start with "http://" or "https://".`)))}function N(e,t){if("access"in e&&e.access&&typeof e.access=="object"){const s=e.access;h(s,"logoutReturnUrl","access.logoutReturnUrl",t),h(s,"residency","access.residency",t);const o=["requiresLogin","logoutReturnUrl","residency","sso","rbac"];for(const a of o)a in s&&s[a]!==void 0&&a in e&&e[a]!==void 0&&t(new Error(`Property '${a}' is defined both at root level and in 'access' object. Please use 'access.${a}' to define this configuration.`))}}async function J(e,t,s,o){const p=t.getFileInfo(e)?.realRelativePath||e;async function i(){const l=new j(t),u=w.join(t.cwd,p),c=await T({configPath:u,externalRefResolver:l}),f=await o(c.resolvedConfig);if(f===void 0)return c.resolvedConfig;const m=c.document?.source,P=[...m?await A({config:c,externalConfigTypes:U(f,c)}):[],...m?q(c.resolvedConfig,m):[]];if(P.length>0)for(const b of P)s(new Error(B(b,t.cwd)));return c.resolvedConfig}const r=await t.exists(e)?await i():{},R=k(r),v=await o(r);h(r,"residency","Residency",s),h(r,"logoutReturnUrl","Logout return URL",s),N(r,s);let g=v?E(v,r):r;const{env:y}=g;if(y){const l=C.REDOCLY_ENV,u=y[l]||{},c=C.PUBLIC_REDOCLY_BRANCH_NAME||"",f=c?x(c):"",m=f&&y[`${L}${f}`]||{};g=$(g,m,u)}const n=I(g,R);if(n.imports&&n.imports.length>0){d.warn("The 'imports' property is deprecated. Please use 'plugins' property instead.");const l=new Set([...n.plugins||[],...n.imports.map(u=>w.posix.join(u,"plugin.js"))]);n.plugins=Array.from(l),delete n.imports}if(n.catalog&&(d.warn("The 'catalog' property is deprecated. Please use 'catalogClassic' property instead."),n.catalogClassic={...n.catalog},delete n.catalog),n.scorecard&&(d.warn("The 'scorecard' property is deprecated. Please use 'scorecardClassic' property instead."),n.scorecardClassic=n.scorecard,delete n.scorecard),n.search?.ai){d.warn("The 'search.ai' property is deprecated. Please use 'aiAssistant' property instead.");const l={...n.search?.ai,...n.aiAssistant,suggestions:n.aiAssistant?.suggestions?.length?n.aiAssistant.suggestions:n.search?.ai.suggestions||[]};n.aiAssistant=l,delete n.search.ai}return _(n)}function _(e){const t={...e},o={..."access"in e&&e.access&&typeof e.access=="object"?e.access:{}},a=["requiresLogin","logoutReturnUrl","residency","sso","idps","rbac"],p=[];for(const i of a){const r=t[i];r!==void 0&&(p.push(i),i==="requiresLogin"&&o.requiresLogin===void 0&&(o.requiresLogin=r),i==="logoutReturnUrl"&&o.logoutReturnUrl===void 0&&(o.logoutReturnUrl=r),i==="residency"&&o.residency===void 0&&(o.residency=r),i==="sso"&&o.sso===void 0&&(o.sso=r),i==="idps"&&o.idps===void 0&&(o.idps=r),i==="rbac"&&o.rbac===void 0&&(o.rbac=r),delete t[i])}return p.length>0&&d.warn(`The following properties at root level are deprecated: ${p.join(", ")}. Please move them to the 'access' object.`),Object.keys(o).length>0&&(t.access=o),t}function k(e){if(!e.theme)return[];d.warn("The 'theme' property in redocly.yaml is deprecated. Please move all of the properties from 'theme' to the root of the config.");const t=[];for(const s of Object.keys(e.theme))e[s]==null?t.push(s):d.warn(`Detected both '${s}' and 'theme.${s}' properties in redocly.yaml. The 'theme.${s}' property will be ignored and needs to be removed or merged into the '${s}'.`);return t}function I(e,t){if(!e.theme||t.length===0)return e;const s={...e};for(const o of t)s[o]=e.theme[o];return delete s.theme,s}export{_ as ensureAccessBackwardsCompatibility,J as readAndValidateConfig};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { MarkdocTagSchema } from '@redocly/theme/markdoc/tags/types';
|
|
2
|
+
import type { TFunction } from '@redocly/theme/core/types';
|
|
2
3
|
import type { RenderTagFn } from '../../../types/plugins/markdown';
|
|
3
|
-
export declare function createRenderTagFn(markdocTags: Record<string, MarkdocTagSchema> | undefined): RenderTagFn;
|
|
4
|
+
export declare function createRenderTagFn(markdocTags: Record<string, MarkdocTagSchema> | undefined, locale: string, translate: TFunction): RenderTagFn;
|
|
4
5
|
//# sourceMappingURL=create-render-tag-fn.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a(e,n,t){return(r,u)=>{if(r.tag)return e?.[r.tag]?.renderForLlms?.(r,{...u,locale:n,translate:t})}}export{a as createRenderTagFn};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import _ from"@markdoc/markdoc";import D from"node:path";import{AI_SEARCH_CHUNK_SIZE as
|
|
2
|
-
${
|
|
3
|
-
`:"";let
|
|
4
|
-
`)};(t.attributes.level>1||p(t)!==
|
|
5
|
-
`:"",h.content+=t.content.trimEnd()),
|
|
6
|
-
`)});else{const
|
|
7
|
-
`:"",m.content+=t.content.trimEnd(),
|
|
8
|
-
`),fsPath:n.fsPath,locale:
|
|
9
|
-
`+i.content:(
|
|
1
|
+
import _ from"@markdoc/markdoc";import D from"node:path";import{AI_SEARCH_CHUNK_SIZE as b,AI_SEARCH_DOCUMENT_CHUNK_SIZE as E}from"../../../constants/plugins/search.js";import{slugger as M}from"../../../../utils/slugger.js";import{joinSectionContent as P}from"./join-section-content.js";import{toMarkdown as U}from"./to-markdown.js";import{AstToSearchNodeTransformer as x}from"./walk-sections.js";import{createRenderTagFn as I}from"./create-render-tag-fn.js";import{getBuildTranslateContext as y}from"../../../utils/l10n/get-build-translate-context.js";import{getLocaleFromRelativePath as L}from"../../../fs/utils/get-locale-from-relative-path.js";import{HeadingNode as H}from"./nodes/heading-node.js";import{extractDocumentSearchFacets as K}from"./search-facets.js";import{formatDocumentMetadata as N}from"../../search/utils.js";import{TagNode as R}from"./nodes/tag-node.js";import{MARKDOC_PARTIALS_DATA_KEY as j}from"../../../constants/common.js";const w=Symbol(),rt=(n,o)=>async(e,r,i,c)=>{if(o?.excludeFromSearch)return;M.reset();const l=await e.getNavText?.()||D.basename(e.fsPath),f=_.Ast.fromJSON(r.ast),{locale:d,translate:C}=await y(e.slug,c.getGlobalData?.().l10n),s=new x({partials:c.getGlobalConfig(j)||{},renderTag:I(c.markdocOptions.tags,d,C),getInnerContent:U,ast:f,skipConditionals:!0}),g=Array.from(s.transform());return{async getLLMsTxts(){const u=o?.seo,t=u&&typeof u=="object"&&"description"in u?String(u.description):void 0,a=P(g);return[{title:l,description:t,slug:e.slug,fsPath:e.fsPath,content:a,includeInLLMsTxt:!0}]},async getSearchDocuments(){return F(e,g,n,l)}}};function F(n,o,e,r){const i=n.slug,c=new Map,l=n.metadata||{},f=K(l,e),d=N(l),C=d?`Metadata:
|
|
2
|
+
${d}
|
|
3
|
+
`:"";let s=[];for(const t of o)if(t instanceof H){s.splice(t.attributes.level-1,6);const a=t.attributes.level>2,m=s[s.length-1]?.title,S=s[s.length-1]?.url,T=a&&m?m:$(r,t),A=a&&S?S:t.getUrl(i),h={title:T,content:"",url:A,level:t.attributes.level,toc:s.map(v=>p(v.section)).join(`
|
|
4
|
+
`)};(t.attributes.level>1||p(t)!==r)&&(h.content+=h.content?`
|
|
5
|
+
`:"",h.content+=t.content.trimEnd()),c.set(t.id,h),s.push({section:t,title:T,url:A})}else if(t instanceof R)c.set(t.id,{title:t.content,content:t.content,url:t.getUrl(i),level:t.attributes.level+1,toc:s.map(a=>p(a.section)).concat(t.content).join(`
|
|
6
|
+
`)});else{const a=t.parentNode?.id??w,m=c.get(a)??{title:r,content:"",url:i,level:1/0,toc:""};m.content+=m.content?`
|
|
7
|
+
`:"",m.content+=t.content.trimEnd(),c.set(a,m)}const g=O(Array.from(c.values())),u=L(n.fsPath);return g.filter(t=>t.content).map(t=>({title:t.title,url:t.url,content:[C,t.toc||`# ${r}`,t.content].filter(Boolean).join(`
|
|
8
|
+
`),fsPath:n.fsPath,locale:u,product:n.product?.name,facets:f}))}function k(n){return n.length/4}function O(n){if(n.length===0)return[];const o=[];let e=n[0];for(let r=1;r<n.length;r++){const i=n[r],c=k(e.content),l=k(i.content),f=r===n.length-1;l<b&&(c<E||f)&&i.level>e.level?e.content+=`
|
|
9
|
+
`+i.content:(o.push(e),e=i)}return o.push(e),o}function $(n,o){return o.content===n?n:`${n} \u2192 ${p(o)}`}function p(n){return n.content.replace(/^#+/,"").trim()}export{rt as getAiDocumentsStore};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{mcpToolHandlers as
|
|
1
|
+
import{mcpToolHandlers as l}from"../../../../../client/mcp-tool-handlers-entry.js";import{runInSandbox as m}from"../../../../sandbox/sandbox.js";import{isMcpToolAvailable as u}from"../../workers/execute-mcp-tool.js";import{buildExecuteHostFetch as f,isFetchCapable as p}from"../../gateway-mcp/fetch-capability.js";import{withAuthRequiredMeta as d}from"../../gateway-mcp/upstream-auth.js";import{CODE_MODE_TOOL_NAMES as b,EXECUTE_TOOL_NAME as h}from"../constants.js";import{sanitizeToolName as E}from"../build-tool-type-declarations.js";import{invokeTool as T}from"../invoke-tool.js";import{createSandboxSetup as O}from"../sandbox/create-sandbox-setup.js";const A=async(e,t,i)=>{const o=await v(t,i),r=[],n=p(t)?f(t,c=>r.push(c)):void 0,{result:a,error:s}=await m(e.code,{setupContext:O(o,n)});return d({content:[{type:"text",text:JSON.stringify({result:a,error:s})}],isError:s!==void 0},r)};async function v(e,t){const i={};for(const o of Object.keys(l))b.has(o)||!await u({toolName:o,context:e}).catch(()=>!1)||(i[E(o)]=n=>T(o,n,e,t));return i}var F={[h]:A};export{F as default};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { UpstreamAuthRequiredEvent } from './upstream-auth.js';
|
|
2
|
+
import type { UpstreamAuthScheme } from './upstream-auth-scheme.js';
|
|
3
|
+
export declare const ELICITATION_TIMEOUT_MS = 300000;
|
|
4
|
+
export type SendElicitRequest = (request: object, resultSchema: unknown, options: {
|
|
5
|
+
timeout: number;
|
|
6
|
+
}) => Promise<{
|
|
7
|
+
action: string;
|
|
8
|
+
}>;
|
|
9
|
+
export type ElicitationOutcome = {
|
|
10
|
+
status: 'accepted';
|
|
11
|
+
} | {
|
|
12
|
+
status: 'fallback';
|
|
13
|
+
text: string;
|
|
14
|
+
} | {
|
|
15
|
+
status: 'skipped';
|
|
16
|
+
};
|
|
17
|
+
export declare function runUpstreamCredentialElicitation({ sendRequest, clientSupportsElicitation, sessionId, baseUrl, events, auth, }: {
|
|
18
|
+
sendRequest: SendElicitRequest;
|
|
19
|
+
clientSupportsElicitation: boolean;
|
|
20
|
+
sessionId: string;
|
|
21
|
+
baseUrl: string;
|
|
22
|
+
events: UpstreamAuthRequiredEvent[];
|
|
23
|
+
auth: UpstreamAuthScheme;
|
|
24
|
+
}): Promise<ElicitationOutcome>;
|
|
25
|
+
//# sourceMappingURL=elicitation.d.ts.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{ElicitResultSchema as m}from"@redocly/mcp-typescript-sdk/types.js";import{logger as d}from"../../../tools/notifiers/logger.js";import{secretStore as p,ELICITATION_TTL_MS as h}from"./secret-store.js";const f=3e5;async function $({sendRequest:e,clientSupportsElicitation:t,sessionId:r,baseUrl:i,events:n,auth:s}){const a=n[0],l=p.createElicitation({sessionId:r,api:a.api,name:a.name,auth:s}),c=g(i,l);if(!t)return{status:"fallback",text:u(n,c)};try{return(await e({method:"elicitation/create",params:{mode:"url",message:`The "${a.name}" API requires credentials. Open the link to provide them securely; they never pass through the chat.`,url:c,elicitationId:l}},m,{timeout:f})).action==="accept"?{status:"accepted"}:{status:"skipped"}}catch(o){return d.warn(`URL-mode elicitation failed, falling back to markdown link: ${o instanceof Error?o.message:String(o)}`),{status:"fallback",text:u(n,c)}}}function g(e,t){if(!e)return`/mcp/credentials?token=${t}`;try{const r=new URL("/mcp/credentials",e);return r.searchParams.set("token",t),r.toString()}catch{return`${e}/mcp/credentials?token=${t}`}}function u(e,t){const[r,...i]=e,n=[`The upstream API "${r.name}" returned 401 Unauthorized.`,"",`**Action required: show the user the link below and ask them to open it in a browser to provide the API credentials (valid ${Math.round(h/6e4)} minutes):**`,"",t,"","Then call this tool again - the credentials are applied server-side and never appear in the conversation."];if(i.length>0){const s=i.map(a=>`"${a.name}"`).join(", ");n.push("",`The remaining APIs (${s}) will prompt for credentials on subsequent calls.`)}return n.join(`
|
|
2
|
+
`)}export{f as ELICITATION_TIMEOUT_MS,$ as runUpstreamCredentialElicitation};
|
|
@@ -1,18 +1,8 @@
|
|
|
1
1
|
import type { OpenAPIDefinition } from '@redocly/openapi-docs';
|
|
2
2
|
import type { OpenAPIMcp } from '@redocly/openapi-docs/lib/types/open-api.js';
|
|
3
|
-
import type { RbacConfig } from '@redocly/config';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
docs?: {
|
|
7
|
-
hide?: boolean;
|
|
8
|
-
ignore?: readonly string[];
|
|
9
|
-
};
|
|
10
|
-
gateway?: {
|
|
11
|
-
hide?: boolean;
|
|
12
|
-
};
|
|
13
|
-
};
|
|
14
|
-
/** Whether the gateway fetch capability is on: the feature flag plus none of mcp/docs/gateway hidden. */
|
|
15
|
-
export declare function isGatewayCapabilityEnabled(mcp: GatewayVisibility | undefined): boolean;
|
|
3
|
+
import type { RbacConfig, RedoclyConfig } from '@redocly/config';
|
|
4
|
+
/** Whether the gateway fetch capability is on: the feature flag plus none of mcp/docs hidden. */
|
|
5
|
+
export declare function isGatewayCapabilityEnabled(mcp?: RedoclyConfig['mcp']): boolean;
|
|
16
6
|
/** Whether an API is eligible for the gateway (fetch-capable `execute` + `/mcp` advertisement). */
|
|
17
7
|
export declare function isGatewayEligible(info: OpenAPIDefinition['info'] | undefined, relativePath: string, rbacConfig: RbacConfig): boolean;
|
|
18
8
|
/**
|
|
@@ -24,7 +14,6 @@ export declare function shouldAdvertiseGatewayXMcp(definition: (OpenAPIDefinitio
|
|
|
24
14
|
'x-mcp'?: {
|
|
25
15
|
servers?: unknown[];
|
|
26
16
|
};
|
|
27
|
-
}) | undefined, relativePath: string, rbacConfig: RbacConfig, mcpConfig
|
|
17
|
+
}) | undefined, relativePath: string, rbacConfig: RbacConfig, mcpConfig?: RedoclyConfig['mcp']): boolean;
|
|
28
18
|
export declare function buildGatewayXMcp(url: string): OpenAPIMcp;
|
|
29
|
-
export {};
|
|
30
19
|
//# sourceMappingURL=eligibility.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{join as
|
|
1
|
+
import{join as e}from"node:path";import{PUBLIC_API_DEFINITIONS_FOLDER as s}from"../../../constants/common.js";import{DEFAULT_ANONYMOUS_VISITOR_TEAM as a}from"../../../../constants/common.js";import{canDownloadApiDefinition as n}from"../../../utils/rbac.js";import{MCP_PROTOCOL_VERSION as p}from"../constants.js";import{isApiIncludedInDocsMcp as c}from"../utils.js";import{isMcpGatewayEnabled as l}from"../utils/mode.js";import{isDefinitionHidden as m,hasGatewayConfig as f}from"../utils/xmcp-utils.js";function u(o){return l()&&!o?.hide&&!o?.docs?.hide}function d(o,i,r){return m(o,"gateway")?!1:n(e(s,i),r,!1,{isAuthenticated:!1,teams:[a]})||f(o)}function D(o,i,r,t){return u(t)&&!o?.["x-mcp"]?.servers?.length&&d(o?.info,i,r)&&c(i,o,t)}function M(o){return{protocolVersion:p,capabilities:{tools:{}},servers:[{url:o}],tools:[],resources:[],prompts:[]}}export{M as buildGatewayXMcp,u as isGatewayCapabilityEnabled,d as isGatewayEligible,D as shouldAdvertiseGatewayXMcp};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import type { OpenAPIServer } from '@redocly/openapi-docs/lib/types/open-api.js';
|
|
2
2
|
/**
|
|
3
|
-
* Build case-insensitive host matchers from an API's server URL templates
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* `
|
|
8
|
-
*
|
|
9
|
-
*
|
|
3
|
+
* Build case-insensitive host matchers from an API's server URL templates. A server URL host
|
|
4
|
+
* may contain server-variable placeholders (e.g. a tenant `{subdomain}`); each placeholder
|
|
5
|
+
* expands to its `enum` values, or - when free-form - to one DNS label plus any fixed parent
|
|
6
|
+
* domain carried by the variable's `default`. So `{subdomain}.dealpos.com` matches
|
|
7
|
+
* `acme.dealpos.com`, and a whole-host `{subdomain}` defaulting to `acme.dealpos.net` matches
|
|
8
|
+
* `<tenant>.dealpos.net`, but neither matches `a.b.dealpos.com`, the bare parent domain, or an
|
|
9
|
+
* unrelated host.
|
|
10
10
|
*/
|
|
11
|
-
export declare function buildAllowedHostMatchers(servers?: readonly OpenAPIServer[]
|
|
11
|
+
export declare function buildAllowedHostMatchers(servers?: readonly OpenAPIServer[]): RegExp[];
|
|
12
12
|
export declare function isHostAllowed(host: string, matchers: readonly RegExp[]): boolean;
|
|
13
13
|
//# sourceMappingURL=allowed-hosts.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const h=/\{([^}]+)\}/g;function g(n=[]){const e=[];for(const t of n){const r=p(t);r&&e.push(r)}return e}function x(n,e){return e.some(t=>t.test(n))}function p(n){const e=m(n.url);if(!e)return null;let t="",r=0,o=!1;for(const l of e.matchAll(h)){const[i,f]=l,c=e.slice(r,l.index);c.includes(".")&&(o=!0),t+=s(c);const u=d(n.variables?.[f]);u.guaranteesDot&&(o=!0),t+=u.pattern,r=l.index+i.length}const a=e.slice(r);return a.includes(".")&&(o=!0),t+=s(a),o?new RegExp(`^${t}$`,"i"):null}function d(n){const e=n?.enum?.filter(Boolean);if(e&&e.length>0)return{pattern:`(?:${e.map(s).join("|")})`,guaranteesDot:e.every(r=>r.includes("."))};const t=n?.default?.split(".").slice(1).join(".");return t?{pattern:`[^.]+\\.${s(t)}`,guaranteesDot:!0}:{pattern:"[^.]+",guaranteesDot:!1}}function m(n){if(!n)return null;const t=n.replace(/^[a-z][a-z0-9+.-]*:\/\//i,"").split(/[/?#]/,1)[0];return t&&(t.includes("@")?t.slice(t.lastIndexOf("@")+1):t).replace(/:(?:\d+|\{[^}]+\})$/,"")||null}function s(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}export{g as buildAllowedHostMatchers,x as isHostAllowed};
|
|
@@ -1,12 +1,26 @@
|
|
|
1
|
+
import { Agent, type Dispatcher } from 'undici';
|
|
1
2
|
import type { SandboxFetch } from '../../codemode/types.js';
|
|
3
|
+
import type { UpstreamAuthRequiredEvent } from '../upstream-auth.js';
|
|
4
|
+
import type { StoredSecret } from '../secret-store.js';
|
|
5
|
+
export declare const ssrfSafeAgent: Agent;
|
|
6
|
+
export type FetchBridgeApi = {
|
|
7
|
+
slug: string;
|
|
8
|
+
name: string;
|
|
9
|
+
matchers: readonly RegExp[];
|
|
10
|
+
secret?: StoredSecret;
|
|
11
|
+
};
|
|
2
12
|
type FetchBridgeOptions = {
|
|
3
13
|
allowedHosts: readonly RegExp[];
|
|
14
|
+
apis?: readonly FetchBridgeApi[];
|
|
4
15
|
authorization?: string;
|
|
16
|
+
onAuthRequired?: (event: UpstreamAuthRequiredEvent) => void;
|
|
5
17
|
fetchImpl?: typeof fetch;
|
|
18
|
+
dispatcher?: Dispatcher;
|
|
6
19
|
timeoutMs?: number;
|
|
7
20
|
maxResponseBytes?: number;
|
|
8
21
|
};
|
|
9
22
|
/** Build the host-side `fetch` the gateway sandbox calls. */
|
|
10
|
-
export declare function buildFetchBridge({ allowedHosts, authorization, fetchImpl, timeoutMs, maxResponseBytes, }: FetchBridgeOptions): SandboxFetch;
|
|
23
|
+
export declare function buildFetchBridge({ allowedHosts, apis, authorization, onAuthRequired, fetchImpl, dispatcher, timeoutMs, maxResponseBytes, }: FetchBridgeOptions): SandboxFetch;
|
|
24
|
+
export declare function readCappedBody(response: Response, maxBytes: number): Promise<string>;
|
|
11
25
|
export {};
|
|
12
26
|
//# sourceMappingURL=fetch-bridge.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{assertUrlAllowed as
|
|
1
|
+
import{Agent as y}from"undici";import{assertUrlAllowed as T}from"./ssrf-guard.js";import{createSsrfSafeLookup as E}from"./ssrf-safe-lookup.js";const A=3e4,L=1024*1024,S=new y({connect:{lookup:E()}});function F({allowedHosts:t,apis:e=[],authorization:r,onAuthRequired:o,fetchImpl:c=fetch,dispatcher:n=S,timeoutMs:d=A,maxResponseBytes:i=L}){const a=[...t,...e.flatMap(l=>l.matchers)];return async l=>{const h=T(l.url,a),m=e.filter(s=>s.matchers.some(f=>f.test(h.hostname))),u=m.length===1?m[0]:void 0,b=v(l.headers,u?.secret,r),g=new AbortController,p=setTimeout(()=>g.abort(),d);try{const s=await c(h,{method:l.method??"GET",headers:b,body:l.body,redirect:"manual",signal:g.signal,dispatcher:n});s.status===401&&u&&o&&o({api:u.slug,name:u.name});const f=await k(s,i);return{status:s.status,statusText:s.statusText,ok:s.ok,headers:_(s.headers),bodyText:f}}finally{clearTimeout(p)}}}async function k(t,e){const r=Number(t.headers.get("content-length"));if(Number.isFinite(r)&&r>e)throw w(e,r);if(!t.body)return"";const o=t.body.getReader(),c=new TextDecoder;let n=0,d="";try{for(;;){const{done:i,value:a}=await o.read();if(i)break;if(n+=a.byteLength,n>e)throw w(e,n);d+=c.decode(a,{stream:!0})}return d+c.decode()}finally{await o.cancel().catch(()=>{})}}function w(t,e){return new Error(`Response is too large (over ${t} bytes, got ${e}); request less data`)}function v(t,e,r){const o={},c=new Set;for(const[d,i]of Object.entries(t??{})){const a=d.toLowerCase();a==="host"||a==="content-length"||(c.add(a),o[d]=i)}const n=e??(r?{header:"Authorization",value:r}:void 0);return n&&!c.has(n.header.toLowerCase())&&(o[n.header]=n.value),o}function _(t){const e={};return t.forEach((r,o)=>{e[o.toLowerCase()]=r}),e}export{F as buildFetchBridge,k as readCappedBody,S as ssrfSafeAgent};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare class SsrfBlockedError extends Error {
|
|
2
|
+
code: string;
|
|
3
|
+
constructor(message: string);
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* True if `ip` (a literal IPv4/IPv6 string) is in a range unsafe to reach. Non-IP input is
|
|
7
|
+
* treated as blocked (fail closed). Handles IPv4-mapped IPv6 by checking the embedded IPv4.
|
|
8
|
+
*/
|
|
9
|
+
export declare function isBlockedIp(ip: string): boolean;
|
|
10
|
+
//# sourceMappingURL=ssrf-blocklist.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{BlockList as l,isIP as i}from"node:net";class E extends Error{code="SSRF_BLOCKED";constructor(t){super(t),this.name="SsrfBlockedError"}}const x=[["0.0.0.0",8],["10.0.0.0",8],["100.64.0.0",10],["127.0.0.0",8],["169.254.0.0",16],["172.16.0.0",12],["192.0.0.0",24],["192.0.2.0",24],["192.168.0.0",16],["198.18.0.0",15],["198.51.100.0",24],["203.0.113.0",24],["224.0.0.0",4],["240.0.0.0",4],["255.255.255.255",32]],h=[["::",128],["::1",128],["64:ff9b::",96],["64:ff9b:1::",48],["100::",64],["2001::",32],["2001:db8::",32],["2002::",16],["fc00::",7],["fe80::",10],["fec0::",10],["ff00::",8]],c=(()=>{const n=new l;for(const[t,r]of x)n.addSubnet(t,r,"ipv4");for(const[t,r]of h)n.addSubnet(t,r,"ipv6");return n})();function m(n){if(i(n)!==6)return;const t=S(n);if(!(t.length===8&&t[0]===0&&t[1]===0&&t[2]===0&&t[3]===0&&t[4]===0&&t[5]===65535))return;const e=t[6]??0,f=t[7]??0;return[e>>8&255,e&255,f>>8&255,f&255].join(".")}function S(n){const r=n.replace(/:(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/,(s,d,p,u,a)=>`:${((+d&255)<<8|+p&255).toString(16)}:${((+u&255)<<8|+a&255).toString(16)}`).split("::");if(r.length>2)return[];const e=r[0]?r[0].split(":"):[],f=r[1]?r[1].split(":"):[],o=r.length===2?8-e.length-f.length:0;return o<0?[]:[...e,...Array(o).fill("0"),...f].map(s=>Number.parseInt(s,16))}function B(n){const t=i(n);if(t===0||c.check(n,t===4?"ipv4":"ipv6"))return!0;if(t===6){const r=m(n);if(r&&c.check(r,"ipv4"))return!0}return!1}export{E as SsrfBlockedError,B as isBlockedIp};
|
|
@@ -4,6 +4,6 @@
|
|
|
4
4
|
* Returns the parsed URL on success; throws with a clear message otherwise.
|
|
5
5
|
*/
|
|
6
6
|
export declare function assertUrlAllowed(rawUrl: string, matchers: readonly RegExp[]): URL;
|
|
7
|
-
/** True for
|
|
7
|
+
/** True for localhost or any literal IP in a blocked (private/reserved/loopback/link-local/…) range. */
|
|
8
8
|
export declare function isBlockedAddress(host: string): boolean;
|
|
9
9
|
//# sourceMappingURL=ssrf-guard.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{isHostAllowed as
|
|
1
|
+
import{isIP as n}from"node:net";import{isHostAllowed as l}from"./allowed-hosts.js";import{isBlockedIp as i}from"./ssrf-blocklist.js";function w(r,t){let o;try{o=new URL(r)}catch{throw new Error(`Invalid URL: ${r}`)}if(o.protocol!=="http:"&&o.protocol!=="https:")throw new Error(`Only http(s) URLs are allowed, got ${o.protocol}`);if(o.username||o.password)throw new Error("URLs must not contain embedded credentials");const e=s(o.hostname);if(c(e)||!l(e,t))throw new Error(`Host "${e}" is not allowed`);return o}function c(r){const t=s(r.toLowerCase()).split("%")[0];return t==="localhost"||t.endsWith(".localhost")?!0:n(t)!==0?i(t):!1}function s(r){return r.replace(/^\[|\]$/g,"")}export{w as assertUrlAllowed,c as isBlockedAddress};
|