@redocly/revel 0.138.1 → 0.139.0-next.10

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 (139) hide show
  1. package/CHANGELOG.md +148 -0
  2. package/dist/cli/eject/resolveEjectParams.js +1 -1
  3. package/dist/client/app/Sidebar/RequestAccessButton.js +2 -2
  4. package/dist/client/app/hooks/useL10nConfig.d.ts +1 -0
  5. package/dist/client/app/markdoc/custom-components/openapi/openapi-example.js +1 -1
  6. package/dist/client/app/markdoc/custom-components/openapi/replay-openapi.js +1 -1
  7. package/dist/client/app/search/useSearch.js +1 -1
  8. package/dist/client/app/utils/programmatic-scroll.js +1 -1
  9. package/dist/client/app/webmcp/tools/api-tools.js +1 -1
  10. package/dist/client/app/webmcp/tools/site-tools.js +2 -2
  11. package/dist/client/app/webmcp/useWebMcpTools.js +1 -1
  12. package/dist/client/templates/api-docs/template.js +10 -8
  13. package/dist/constants/common.d.ts +1 -0
  14. package/dist/constants/common.js +1 -1
  15. package/dist/constants/l10n/langs/ar.js +1 -1
  16. package/dist/constants/l10n/langs/de.js +1 -1
  17. package/dist/constants/l10n/langs/en.js +1 -1
  18. package/dist/constants/l10n/langs/es.js +1 -1
  19. package/dist/constants/l10n/langs/fr.js +1 -1
  20. package/dist/constants/l10n/langs/hi.js +1 -1
  21. package/dist/constants/l10n/langs/it.js +1 -1
  22. package/dist/constants/l10n/langs/ja.js +1 -1
  23. package/dist/constants/l10n/langs/ko.js +1 -1
  24. package/dist/constants/l10n/langs/pl.js +1 -1
  25. package/dist/constants/l10n/langs/pt-BR.js +1 -1
  26. package/dist/constants/l10n/langs/pt.js +1 -1
  27. package/dist/constants/l10n/langs/ru.js +1 -1
  28. package/dist/constants/l10n/langs/uk.js +1 -1
  29. package/dist/constants/l10n/langs/zh.js +1 -1
  30. package/dist/markdoc/helpers/get-inner-text.d.ts +2 -0
  31. package/dist/markdoc/helpers/get-inner-text.js +2 -2
  32. package/dist/markdoc/helpers/remove-markdoc-tags.js +1 -1
  33. package/dist/server/config/env-schemas/feature-flags.d.ts +1 -1
  34. package/dist/server/constants/entitlements.d.ts +2 -2
  35. package/dist/server/constants/entitlements.js +1 -1
  36. package/dist/server/entitlements/entitlements-provider.d.ts +2 -2
  37. package/dist/server/entitlements/is-valid-plan.d.ts +2 -2
  38. package/dist/server/entitlements/is-valid-plan.js +1 -1
  39. package/dist/server/fs/content-fs.js +1 -1
  40. package/dist/server/fs/utils/external-ref-resolver.js +2 -2
  41. package/dist/server/fs/utils/is-translation-fallback.d.ts +9 -0
  42. package/dist/server/fs/utils/is-translation-fallback.js +1 -0
  43. package/dist/server/node-bundle-entry.js +1 -1
  44. package/dist/server/plugins/api-docs/get-server-props.js +1 -1
  45. package/dist/server/plugins/api-docs/index.js +1 -1
  46. package/dist/server/plugins/api-docs/search/create-indexer.d.ts +9 -2
  47. package/dist/server/plugins/api-docs/search/create-indexer.js +1 -1
  48. package/dist/server/plugins/api-docs/search/get-ai-search-documents.js +72 -72
  49. package/dist/server/plugins/api-docs/search/search-resolver.js +1 -1
  50. package/dist/server/plugins/arazzo-docs/arazzo-doc-loader.js +2 -2
  51. package/dist/server/plugins/arazzo-docs/index.js +1 -1
  52. package/dist/server/plugins/catalog-entities/extensions/extractors/api-description/openapi-entities-extractor.js +1 -1
  53. package/dist/server/plugins/catalog-entities/template/index.js +1 -1
  54. package/dist/server/plugins/config-parser/loaders/utils/read-and-validate-config.js +1 -1
  55. package/dist/server/plugins/config-parser/loaders/versions-config-loader.js +1 -1
  56. package/dist/server/plugins/default-theme/resolve-logo.js +1 -1
  57. package/dist/server/plugins/dev-onboarding/api/routes/index.js +1 -1
  58. package/dist/server/plugins/dev-onboarding/api/routes/products.js +1 -1
  59. package/dist/server/plugins/dev-onboarding/template/App.js +4 -4
  60. package/dist/server/plugins/dev-onboarding/template/AppsList.js +7 -7
  61. package/dist/server/plugins/dev-onboarding/template/CreateAppDialog.js +3 -3
  62. package/dist/server/plugins/dev-onboarding/template/components/ApiKeyItem.js +4 -4
  63. package/dist/server/plugins/dev-onboarding/template/components/ApiLogDetails.js +7 -7
  64. package/dist/server/plugins/dev-onboarding/template/components/ApiLogs.js +5 -5
  65. package/dist/server/plugins/dev-onboarding/template/components/ApiLogsActions.js +6 -6
  66. package/dist/server/plugins/dev-onboarding/template/components/ApisList.js +1 -1
  67. package/dist/server/plugins/dev-onboarding/template/components/CreateApiKey.js +1 -1
  68. package/dist/server/plugins/dev-onboarding/template/components/DeleteAppDialog.js +1 -1
  69. package/dist/server/plugins/dev-onboarding/template/components/EditApis.js +1 -1
  70. package/dist/server/plugins/dev-onboarding/template/components/EditAppDescriptionDialog.js +1 -1
  71. package/dist/server/plugins/dev-onboarding/template/components/EditAppDialog.js +1 -1
  72. package/dist/server/plugins/dev-onboarding/template/components/EditCallbackUrlDialog.js +1 -1
  73. package/dist/server/plugins/dev-onboarding/template/components/RevokeAPIKey.js +5 -5
  74. package/dist/server/plugins/dev-onboarding/template/components/RollAPIKey.js +5 -5
  75. package/dist/server/plugins/dev-onboarding/template/components/UpdateApiKey.js +1 -1
  76. package/dist/server/plugins/l10n/index.js +1 -1
  77. package/dist/server/plugins/markdown/attribute-resolvers/resolve-json-example-ref.js +1 -1
  78. package/dist/server/plugins/markdown/attribute-resolvers/resolve-link.js +1 -1
  79. package/dist/server/plugins/markdown/get-server-props.js +1 -1
  80. package/dist/server/plugins/markdown/index.js +1 -1
  81. package/dist/server/plugins/markdown/markdoc/plugins/utils.js +1 -1
  82. package/dist/server/plugins/markdown/markdoc/resolve-raw-partials.js +1 -1
  83. package/dist/server/plugins/markdown/markdown-static-data-loader.js +1 -1
  84. package/dist/server/plugins/markdown/read-file-content.js +1 -1
  85. package/dist/server/plugins/markdown/search/search-resolver.js +1 -1
  86. package/dist/server/plugins/mcp/codemode/capabilities/utils.js +4 -4
  87. package/dist/server/plugins/mcp/codemode/constants.js +1 -1
  88. package/dist/server/plugins/mcp/codemode/prompts.d.ts +2 -2
  89. package/dist/server/plugins/mcp/codemode/prompts.js +8 -8
  90. package/dist/server/plugins/mcp/codemode/tools/describe-tools.js +2 -2
  91. package/dist/server/plugins/mcp/codemode/tools/execute-schema.d.ts +2 -0
  92. package/dist/server/plugins/mcp/codemode/tools/execute-schema.js +1 -1
  93. package/dist/server/plugins/mcp/constants.d.ts +2 -2
  94. package/dist/server/plugins/mcp/constants.js +1 -1
  95. package/dist/server/plugins/mcp/docs-mcp/tool-schemas.js +1 -1
  96. package/dist/server/plugins/mcp/docs-mcp/tools/core/create-anonymous-session.js +1 -1
  97. package/dist/server/plugins/mcp/docs-mcp/tools/core/submit-feedback.js +2 -2
  98. package/dist/server/plugins/mcp/docs-mcp/tools/openapi/endpoint-suggestions.d.ts +0 -2
  99. package/dist/server/plugins/mcp/docs-mcp/tools/openapi/endpoint-suggestions.js +1 -1
  100. package/dist/server/plugins/mcp/gateway-mcp/allowed-http-methods.d.ts +0 -5
  101. package/dist/server/plugins/mcp/gateway-mcp/allowed-http-methods.js +1 -1
  102. package/dist/server/plugins/mcp/gateway-mcp/callable-apis.d.ts +3 -2
  103. package/dist/server/plugins/mcp/gateway-mcp/callable-apis.js +1 -1
  104. package/dist/server/plugins/mcp/gateway-mcp/caller-api-calls.d.ts +3 -4
  105. package/dist/server/plugins/mcp/gateway-mcp/caller-api-calls.js +1 -1
  106. package/dist/server/plugins/mcp/gateway-mcp/eligibility.d.ts +1 -12
  107. package/dist/server/plugins/mcp/gateway-mcp/eligibility.js +1 -1
  108. package/dist/server/plugins/mcp/handlers/docs-mcp-handler.js +1 -1
  109. package/dist/server/plugins/mcp/handlers/errors.d.ts +0 -2
  110. package/dist/server/plugins/mcp/handlers/errors.js +1 -1
  111. package/dist/server/plugins/mcp/servers/docs-server.js +1 -1
  112. package/dist/server/plugins/mcp/utils/docs-site-url.d.ts +6 -0
  113. package/dist/server/plugins/mcp/utils/docs-site-url.js +1 -0
  114. package/dist/server/plugins/mcp/utils.d.ts +0 -8
  115. package/dist/server/plugins/mcp/utils.js +1 -1
  116. package/dist/server/plugins/nav-utils.js +1 -1
  117. package/dist/server/plugins/pages/index.js +1 -1
  118. package/dist/server/plugins/register-page-props.d.ts +1 -1
  119. package/dist/server/plugins/register-page-props.js +1 -1
  120. package/dist/server/plugins/sidebars/index.js +1 -1
  121. package/dist/server/plugins/sidebars/utils.js +1 -1
  122. package/dist/server/types/plugins/markdown.d.ts +1 -0
  123. package/dist/server/utils/envs/load-env-variables.js +1 -1
  124. package/dist/server/utils/rbac-expand.d.ts +4 -0
  125. package/dist/server/utils/rbac-expand.js +1 -1
  126. package/dist/server/utils/rbac.js +1 -1
  127. package/dist/server/utils/resolve-asset-path.js +1 -1
  128. package/dist/server/web-server/auth.d.ts +2 -0
  129. package/dist/server/web-server/auth.js +3 -3
  130. package/dist/server/web-server/jwt/jwt.js +1 -1
  131. package/dist/server/web-server/middleware/catalogAuthMiddleware.js +1 -1
  132. package/dist/server/web-server/routes/mcp-routes/mcp-server-card.js +1 -1
  133. package/dist/types/entitlements.d.ts +2 -1
  134. package/dist/types/global-data.d.ts +1 -0
  135. package/dist/utils/url/api-keys-url.d.ts +11 -0
  136. package/dist/utils/url/api-keys-url.js +1 -0
  137. package/package.json +7 -7
  138. package/dist/server/plugins/mcp/docs-mcp/tools/core/utils.d.ts +0 -3
  139. package/dist/server/plugins/mcp/docs-mcp/tools/core/utils.js +0 -11
@@ -1,4 +1,4 @@
1
- import*as e from"react";import o from"styled-components";import{useMutation as E,useQueryClient as x}from"@tanstack/react-query";import{useParams as A}from"react-router";import{Button as b}from"@redocly/theme/components/Button/Button";import{H2 as P}from"@redocly/theme/components/Typography/H2";import{RenewIcon as I}from"@redocly/theme/icons/RenewIcon/RenewIcon";import{Admonition as R}from"@redocly/theme/markdoc/components/Admonition/Admonition";import{useTranslate as C}from"../../../../../client/app/l10n/hooks";import{Dialog as w}from"./Dialog";import{ButtonWithLoading as K}from"./ButtonWithLoading";import{Separator as z}from"./ApiKeys";import{getReadableDate as S}from"./AppOverview";const s=5;function _({apiKey:{expiresAt:t,clientId:n,clientSecret:l,id:y}}){const{id:r}=A(),{translate:a}=C(),g=x(),[u,d]=e.useState(!1),f=Number(t)>0?S(t):"Never",v=n||l,p=()=>d(!0),i=()=>d(!1),k=async()=>{await h()},{isPending:m,error:c,mutateAsync:h}=E({mutationKey:["ROLL_API_KEY"+r],mutationFn:()=>fetch(`/api/api-keys/apps/${r}/credentials/${y}`,{method:"PUT",body:JSON.stringify({clientId:n,clientSecret:l})}),onSuccess:()=>{g.invalidateQueries({queryKey:["APP:"+r]}),i()}});return e.createElement(e.Fragment,null,e.createElement($,{onClick:p},e.createElement("span",{"data-translation-key":"dev.app.key.roll"},a("dev.app.key.roll","Roll API key")),e.createElement(I,{size:"20px",color:"#161616"})),e.createElement(w,{open:u,onOpen:p,onClose:i},e.createElement(F,null,e.createElement(e.Fragment,null,e.createElement(P,{"data-translation-key":"dev.roll.key.dialog.title"},a("dev.roll.key.dialog.title","Roll API key")),e.createElement(O,null,e.createElement("span",{"data-translation-key":"dev.roll.key.dialog.apiKey"},a("dev.roll.key.dialog.apiKey","API key")),e.createElement("span",null,B(v||"")),e.createElement("span",{"data-translation-key":"dev.roll.key.dialog.expires"},a("dev.roll.key.dialog.expires","Expires")),e.createElement("span",null,f)),e.createElement(z,null),e.createElement("div",{"data-translation-key":"dev.roll.key.dialog.confirmation"},a("dev.roll.key.dialog.confirmation","Are you sure you want to roll this API key?")),c&&e.createElement(R,{type:"danger"},c.message),e.createElement(L,null,e.createElement(b,{onClick:i,"data-translation-key":"dev.roll.key.dialog.cancel",variant:"text",size:"large"},a("dev.roll.key.dialog.cancel","Cancel")),e.createElement(K,{variant:"primary",onClick:k,disabled:m,loading:m,"data-translation-key":"dev.roll.key.dialog.roll"},a("dev.roll.key.dialog.roll","Roll API key")))))))}function B(t){if(t.length>s*2){const n=t.slice(0,s),l=t.slice(-s);return`${n} . . . ${l}`}return t}const O=o.div`
1
+ import*as e from"react";import l from"styled-components";import{useMutation as E,useQueryClient as x}from"@tanstack/react-query";import{useParams as A}from"react-router";import{Button as b}from"@redocly/theme/components/Button/Button";import{H2 as P}from"@redocly/theme/components/Typography/H2";import{RenewIcon as I}from"@redocly/theme/icons/RenewIcon/RenewIcon";import{Admonition as R}from"@redocly/theme/markdoc/components/Admonition/Admonition";import{useTranslate as C}from"../../../../../client/app/l10n/hooks";import{Dialog as w}from"./Dialog";import{ButtonWithLoading as K}from"./ButtonWithLoading";import{Separator as z}from"./ApiKeys";import{getReadableDate as S}from"./AppOverview";import{apiKeysUrl as _}from"../../../../../utils/url/api-keys-url";const s=5;function B({apiKey:{expiresAt:t,clientId:n,clientSecret:o,id:y}}){const{id:r}=A(),{translate:a}=C(),g=x(),[u,d]=e.useState(!1),f=Number(t)>0?S(t):"Never",v=n||o,m=()=>d(!0),i=()=>d(!1),k=async()=>{await h()},{isPending:p,error:c,mutateAsync:h}=E({mutationKey:["ROLL_API_KEY"+r],mutationFn:()=>fetch(_(`/apps/${r}/credentials/${y}`),{method:"PUT",body:JSON.stringify({clientId:n,clientSecret:o})}),onSuccess:()=>{g.invalidateQueries({queryKey:["APP:"+r]}),i()}});return e.createElement(e.Fragment,null,e.createElement(F,{onClick:m},e.createElement("span",{"data-translation-key":"dev.app.key.roll"},a("dev.app.key.roll","Roll API key")),e.createElement(I,{size:"20px",color:"#161616"})),e.createElement(w,{open:u,onOpen:m,onClose:i},e.createElement(N,null,e.createElement(e.Fragment,null,e.createElement(P,{"data-translation-key":"dev.roll.key.dialog.title"},a("dev.roll.key.dialog.title","Roll API key")),e.createElement(L,null,e.createElement("span",{"data-translation-key":"dev.roll.key.dialog.apiKey"},a("dev.roll.key.dialog.apiKey","API key")),e.createElement("span",null,O(v||"")),e.createElement("span",{"data-translation-key":"dev.roll.key.dialog.expires"},a("dev.roll.key.dialog.expires","Expires")),e.createElement("span",null,f)),e.createElement(z,null),e.createElement("div",{"data-translation-key":"dev.roll.key.dialog.confirmation"},a("dev.roll.key.dialog.confirmation","Are you sure you want to roll this API key?")),c&&e.createElement(R,{type:"danger"},c.message),e.createElement($,null,e.createElement(b,{onClick:i,"data-translation-key":"dev.roll.key.dialog.cancel",variant:"text",size:"large"},a("dev.roll.key.dialog.cancel","Cancel")),e.createElement(K,{variant:"primary",onClick:k,disabled:p,loading:p,"data-translation-key":"dev.roll.key.dialog.roll"},a("dev.roll.key.dialog.roll","Roll API key")))))))}function O(t){if(t.length>s*2){const n=t.slice(0,s),o=t.slice(-s);return`${n} . . . ${o}`}return t}const L=l.div`
2
2
  display: grid;
3
3
  grid-template-columns: 1fr 1fr;
4
4
 
@@ -11,14 +11,14 @@ import*as e from"react";import o from"styled-components";import{useMutation as E
11
11
  max-width: 170px;
12
12
  word-break: break-all;
13
13
  }
14
- `,L=o.div`
14
+ `,$=l.div`
15
15
  display: flex;
16
16
  justify-content: flex-end;
17
17
  align-items: center;
18
18
  gap: var(--spacing-base);
19
19
  margin-top: auto;
20
20
  padding-top: 30px;
21
- `,$=o.div`
21
+ `,F=l.div`
22
22
  display: flex;
23
23
  align-items: center;
24
24
  cursor: pointer;
@@ -34,9 +34,9 @@ import*as e from"react";import o from"styled-components";import{useMutation as E
34
34
  &:hover {
35
35
  background: var(--color-red-2);
36
36
  }
37
- `,F=o.div`
37
+ `,N=l.div`
38
38
  display: flex;
39
39
  flex-direction: column;
40
40
  min-height: 428px;
41
41
  width: 344px;
42
- `;export{L as ButtonsContainer,_ as default};
42
+ `;export{$ as ButtonsContainer,B as default};
@@ -1 +1 @@
1
- import*as e from"react";import{useMutation as E,useQueryClient as A}from"@tanstack/react-query";import{useParams as C}from"react-router";import{Button as h}from"@redocly/theme/components/Button/Button";import{H3 as v}from"@redocly/theme/components/Typography/H3";import{Admonition as P}from"@redocly/theme/markdoc/components/Admonition/Admonition";import{useTranslate as S}from"../../../../../client/app/l10n/hooks";import{ButtonWithLoading as b}from"./ButtonWithLoading";import{Dialog as U}from"./Dialog";import I from"./ApisList";import{ButtonsWrapper as T}from"./ApiKeyItem";function W(p){const m=A(),{credential:a,open:c,onClose:n,onOpen:u}=p,{translate:i}=S(),{id:o}=C(),r=e.useMemo(()=>a.apiProductsStatus?.map(t=>t.apiId||t.id),[a]),[l,y]=e.useState(r),{isPending:d,error:s,mutateAsync:g}=E({mutationKey:["MUTATE_CRED"+o],mutationFn:()=>fetch(`/api/api-keys/apps/${o}/credentials/${a.id}`,{method:"PUT",body:JSON.stringify({apiProductIds:l,clientId:a.clientId,clientSecret:a.clientSecret})}).then(t=>t.json()),onSuccess:()=>{m.invalidateQueries({queryKey:["APP:"+o]})}}),f=async()=>{await g(),n()},k=t=>{y(t||[])};return e.createElement(e.Fragment,null,e.createElement(U,{open:c,onClose:n,onOpen:u},e.createElement(e.Fragment,null,e.createElement(v,{"data-translation-key":"dev.update.key.dialog.title"},i("dev.update.key.dialog.title","Update key")),e.createElement(I,{initialEnabledApis:r,onChange:k}),s?e.createElement(P,{type:"danger"}," ",s.message," "):null,e.createElement(T,null,e.createElement(h,{onClick:n,"data-translation-key":"dev.update.key.dialog.cancel"},i("dev.update.key.dialog.cancel","Cancel")),e.createElement(b,{variant:"primary",onClick:f,disabled:d||l.length<1,loading:d,"data-translation-key":"dev.update.key.dialog.update"},i("dev.update.key.dialog.update","Update key"))))))}export{W as UpdateKey};
1
+ import*as e from"react";import{useMutation as k,useQueryClient as A}from"@tanstack/react-query";import{useParams as C}from"react-router";import{Button as h}from"@redocly/theme/components/Button/Button";import{H3 as v}from"@redocly/theme/components/Typography/H3";import{Admonition as P}from"@redocly/theme/markdoc/components/Admonition/Admonition";import{useTranslate as S}from"../../../../../client/app/l10n/hooks";import{ButtonWithLoading as b}from"./ButtonWithLoading";import{Dialog as U}from"./Dialog";import I from"./ApisList";import{ButtonsWrapper as K}from"./ApiKeyItem";import{apiKeysUrl as T}from"../../../../../utils/url/api-keys-url";function j(m){const p=A(),{credential:a,open:c,onClose:n,onOpen:u}=m,{translate:i}=S(),{id:o}=C(),r=e.useMemo(()=>a.apiProductsStatus?.map(t=>t.apiId||t.id),[a]),[l,y]=e.useState(r),{isPending:d,error:s,mutateAsync:g}=k({mutationKey:["MUTATE_CRED"+o],mutationFn:()=>fetch(T(`/apps/${o}/credentials/${a.id}`),{method:"PUT",body:JSON.stringify({apiProductIds:l,clientId:a.clientId,clientSecret:a.clientSecret})}).then(t=>t.json()),onSuccess:()=>{p.invalidateQueries({queryKey:["APP:"+o]})}}),f=async()=>{await g(),n()},E=t=>{y(t||[])};return e.createElement(e.Fragment,null,e.createElement(U,{open:c,onClose:n,onOpen:u},e.createElement(e.Fragment,null,e.createElement(v,{"data-translation-key":"dev.update.key.dialog.title"},i("dev.update.key.dialog.title","Update key")),e.createElement(I,{initialEnabledApis:r,onChange:E}),s?e.createElement(P,{type:"danger"}," ",s.message," "):null,e.createElement(K,null,e.createElement(h,{onClick:n,"data-translation-key":"dev.update.key.dialog.cancel"},i("dev.update.key.dialog.cancel","Cancel")),e.createElement(b,{variant:"primary",onClick:f,disabled:d||l.length<1,loading:d,"data-translation-key":"dev.update.key.dialog.update"},i("dev.update.key.dialog.update","Update key"))))))}export{j as UpdateKey};
@@ -1 +1 @@
1
- import g from"path";import{DEFAULT_LOCALE_PLACEHOLDER as d,TRANSLATIONS_FILE_NAME as h}from"../../../constants/common.js";import{I18N_DIR_NAME as y,L10N_DIR_NAME as A}from"../../constants/common.js";import{logger as m}from"../../tools/notifiers/logger.js";import{reporter as w}from"../../tools/notifiers/reporter.js";import{EntitlementsProvider as O}from"../../entitlements/entitlements-provider.js";import{isL10nPath as E}from"../../fs/utils/is-l10n-path.js";import{isOpenapiDoc as I}from"../api-docs/utils/is-api-doc.js";import{telemetryTraceStep as N}from"../../../cli/telemetry/helpers/trace-step.js";async function $(){return{id:"l10n",async processContent(n,i){await N("com.redocly.build.plugin.l10n",async a=>{const{fs:t,cache:c,getConfig:r}=i,e={},p=O.instance(),l=await r();a?.setAttribute("config",JSON.stringify(l.l10n||{}));const s=l.l10n?.defaultLocale||d;if(p.canAccessFeature("l10n")){await F(i);for(const{relativePath:o}of t.scan(/(?:^|[/\\])translations\.yaml$/)){const u=await c.load(o,"yaml"),L=P(o)||s;e[L]={translation:u.data||{}}}}e[s]={translation:{...e[s]?.translation||{}}};const f=l.l10n?.locales||[d,...t.localeFolders].map(o=>({code:o.toLowerCase(),name:o}));a?.setAttribute("locales",JSON.stringify(f)),n.setGlobalData({l10n:{translations:e,defaultLocale:s,locales:f.map(o=>({code:o.code,name:o.name||o.code}))}})})}}}function P(n){return n.indexOf("/")>0?n.split("/")[1]:void 0}async function F(n){const i=n.fs.scan();for(const{isVirtual:a,realRelativePath:t}of i){if(a)continue;if(E(t)&&t.endsWith(".page.tsx")&&await w.panicOnBuild(`The file %rp is not allowed in ${A} or ${y} folders`,t),g.posix.basename(t)===h){const r=/^(?:@(i18n|l10n)[/\\][^/\\]+[/\\])?translations\.yaml$/.test(t),e=await I(t,n);!r&&!e&&m.warn("The file %rp is in the wrong location. Make sure it is located in the root directory or in the locale root directory.",t),r&&e&&m.warn("It looks like the file %rp might be an OpenAPI definition and is located in a location reserved for translation files. Please rename it or move to another directory if it is not a translations file",t)}}}export{$ as l10nPlugin};
1
+ import g from"path";import{DEFAULT_LOCALE_PLACEHOLDER as d,TRANSLATIONS_FILE_NAME as h}from"../../../constants/common.js";import{I18N_DIR_NAME as y,L10N_DIR_NAME as w}from"../../constants/common.js";import{logger as m}from"../../tools/notifiers/logger.js";import{reporter as A}from"../../tools/notifiers/reporter.js";import{EntitlementsProvider as N}from"../../entitlements/entitlements-provider.js";import{isL10nPath as O}from"../../fs/utils/is-l10n-path.js";import{isOpenapiDoc as E}from"../api-docs/utils/is-api-doc.js";import{telemetryTraceStep as I}from"../../../cli/telemetry/helpers/trace-step.js";async function $(){return{id:"l10n",async processContent(n,e){await I("com.redocly.build.plugin.l10n",async a=>{const{fs:t,cache:c,getConfig:r}=e,i={},p=N.instance(),l=await r();a?.setAttribute("config",JSON.stringify(l.l10n||{}));const s=l.l10n?.defaultLocale||d;if(p.canAccessFeature("l10n")){await F(e);for(const{relativePath:o}of t.scan(/(?:^|[/\\])translations\.yaml$/)){const u=await c.load(o,"yaml"),L=P(o)||s;i[L]={translation:u.data||{}}}}i[s]={translation:{...i[s]?.translation||{}}};const f=l.l10n?.locales||[d,...t.localeFolders].map(o=>({code:o.toLowerCase(),name:o}));a?.setAttribute("locales",JSON.stringify(f)),n.setGlobalData({l10n:{translations:i,defaultLocale:s,locales:f.map(o=>({code:o.code,name:o.name||o.code,showMissingTranslationNotice:o.showMissingTranslationNotice}))}})})}}}function P(n){return n.indexOf("/")>0?n.split("/")[1]:void 0}async function F(n){const e=n.fs.scan();for(const{isVirtual:a,realRelativePath:t}of e){if(a)continue;if(O(t)&&t.endsWith(".page.tsx")&&await A.panicOnBuild(`The file %rp is not allowed in ${w} or ${y} folders`,t),g.posix.basename(t)===h){const r=/^(?:@(i18n|l10n)[/\\][^/\\]+[/\\])?translations\.yaml$/.test(t),i=await E(t,n);!r&&!i&&m.warn("The file %rp is in the wrong location. Make sure it is located in the root directory or in the locale root directory.",t),r&&i&&m.warn("It looks like the file %rp might be an OpenAPI definition and is located in a location reserved for translation files. Please rename it or move to another directory if it is not a translations file",t)}}}export{$ as l10nPlugin};
@@ -1 +1 @@
1
- import{JsonPointer as w}from"@redocly/api-docs";import{isObject as d}from"../../../../utils/guards/is-object.js";import{getNodeAttribute as u}from"../../../../markdoc/helpers/get-node-attribute.js";import{setNodeAttributeValue as s}from"../../../../markdoc/helpers/set-node-attribute-value.js";import{MdResolveError as p}from"./md-resolve-error.js";import{resolvePathInMarkdown as $}from"../resolve-path-in-markdown.js";async function b(e,o,m,{context:n,actions:h}){const r=u(e,o);try{if(!d(r)||typeof r.$ref!="string"){try{JSON.stringify(r)}catch(i){throw new Error(`Invalid JSON value: ${i.message}`)}s(e,o+"Resolved",r);return}const[t,f]=r.$ref.split("#");if(!t)throw new Error(`Invalid $ref. Path to file is required: ${r.$ref}`);const l=$(t,m,h.contentDir),c=await n.fs.getFileInfo(l);if(!c)throw new Error(`Invalid $ref. No such file: ${l}`);let a;try{a=(await n.cache.load(c.realRelativePath,"yaml")).data}catch(i){throw new Error(`Invalid file format. File must be valid json or yaml: ${l} ${i?.message||""}`)}if(!f){s(e,o+"Resolved",a);return}const v=w.get(a,f);s(e,o+"Resolved",v)}catch(t){throw s(e,o+"ResolvedErrors",[t.message]),new p(t.message,{rawLink:""})}}export{b as resolveJsonExampleRef};
1
+ import{JsonPointer as d}from"@redocly/api-docs";import{isObject as u}from"../../../../utils/guards/is-object.js";import{getNodeAttribute as w}from"../../../../markdoc/helpers/get-node-attribute.js";import{setNodeAttributeValue as s}from"../../../../markdoc/helpers/set-node-attribute-value.js";import{MdResolveError as p}from"./md-resolve-error.js";import{resolvePathInMarkdown as $}from"../resolve-path-in-markdown.js";async function b(e,o,m,{context:n,actions:h}){const r=w(e,o);try{if(!u(r)||typeof r.$ref!="string"){try{JSON.stringify(r)}catch(i){throw new Error(`Invalid JSON value: ${i.message}`)}s(e,o+"Resolved",r);return}const[t,f]=r.$ref.split("#");if(!t)throw new Error(`Invalid $ref. Path to file is required: ${r.$ref}`);const l=$(t,m,h.contentDir),c=n.fs.getFileInfo(l);if(!c)throw new Error(`Invalid $ref. No such file: ${l}`);let a;try{a=(await n.cache.load(c.realRelativePath,"yaml")).data}catch(i){throw new Error(`Invalid file format. File must be valid json or yaml: ${l} ${i?.message||""}`)}if(!f){s(e,o+"Resolved",a);return}const v=d.get(a,f);s(e,o+"Resolved",v)}catch(t){throw s(e,o+"ResolvedErrors",[t.message]),new p(t.message,{rawLink:""})}}export{b as resolveJsonExampleRef};
@@ -1 +1 @@
1
- import n from"node:path";import{API_DOCS_TEMPLATE_ID as y,ASYNC_API_DOCS_TEMPLATE_ID as F,GRAPHQL_TEMPLATE_ID as M,OPENAPI_DOCS_TEMPLATE_ID as U}from"../../../../constants/common.js";import{isLocalLink as C}from"../../../../utils/path/is-local-link.js";import{normalizeRouteSlug as P}from"../../../../utils/path/normalize-route-slug.js";import{removeFragment as B}from"../../../../utils/path/remove-fragment.js";import{getInnerText as W}from"../../../../markdoc/helpers/get-inner-text.js";import{getNodeAttribute as j}from"../../../../markdoc/helpers/get-node-attribute.js";import{setNodeAttributeValue as c}from"../../../../markdoc/helpers/set-node-attribute-value.js";import{isAuthRoutePath as $}from"../../../../utils/auth/is-auth-route-path.js";import{isApiDownloadLink as V}from"../../../utils/is-api-download-link.js";import{MdResolveError as A}from"./md-resolve-error.js";import{getLinkOriginalAttrName as b}from"./utils.js";import{isOpenApiURL as z}from"../../api-docs/utils/is-api-doc.js";import{parseBaseName as G}from"../../utils.js";import{isMarkdownPage as N}from"../is-markdown-page.js";import{copyStaticFile as q}from"../../../utils/fs.js";async function pt(i,r,p,{actions:w,context:u}){const{contentDir:D,outdir:T,getRouteByFsPath:x,getRouteBySlug:I,hasRouteOrRedirectBySlug:d}=w,k=b(r),o=i[k]||j(i,r);if(i[k]=o,!C(o)||V(o)||$(o))return;const[H,t="",R,L]=/^([^?#]+)?([^#]+)?(.+)?/.exec(o)||[],f=i.type==="image"?"IMAGE":"LINK",g=String(i.attributes.title||i.attributes.alt||W([i])||""),a=B(p);if(i.type!=="image"){const{isOpenapiDetected:e,isOpenapiValid:s}=await z(t,a,w,u);if(e&&!s)throw new A(`OpenAPI route ${o} does not exist`,{rawLink:o,link:t,title:g,brokenLinkType:f})}if(n.extname(t)===""){if(t.startsWith("/")){const e=P(t),s=d(e)?t:_(e,I);if(!s)throw new A(`Route ${t} does not exist`,{rawLink:o,link:t,title:g,brokenLinkType:f});c(i,r,s+(R||"")+(L||""))}if(!o.startsWith("#")&&!t.startsWith("/")&&N(a)){const e=x(a)?.slug;if(!e)return;const{isIndexFile:s}=G(a),h=s?P(n.posix.join(e,t)):P(n.posix.join(e,"../",t)),E=d(P(h))?h:_(h,I);if(!E)throw new A(`Route ${t} does not exist`,{rawLink:o,link:h,title:g,brokenLinkType:f});c(i,r,E+(R||"")+(L||""))}return}const l=t.startsWith("/")?t.substring(1):n.posix.join(n.posix.dirname(a),decodeURI(t)),v=t.startsWith("/")?n.posix.join("static",t.substring(1)):"",S=u.fs.exists(l),O=u.fs.exists(v),m=x(l);if(!S&&!m&&!O)throw c(i,r,"#"),new A(`File ${l} does not exist`,{rawLink:o,link:l,title:g,brokenLinkType:f});if(m){const e=[U,M,F].includes(m.templateId);c(i,r,(e?m.baseSlug:m.slug)+(L||""))}else if(S){const e=u.fs.getFileInfo(l);if(!e||e.isVirtual)return;const s=await q(D,e.realRelativePath,T);c(i,r,s)}}function _(i,r){const p=r(i.toLowerCase());return p?.templateId===y?p.slug:void 0}export{pt as resolveLink};
1
+ import l from"node:path";import{API_DOCS_TEMPLATE_ID as O,ASYNC_API_DOCS_TEMPLATE_ID as y,GRAPHQL_TEMPLATE_ID as M,OPENAPI_DOCS_TEMPLATE_ID as U}from"../../../../constants/common.js";import{isLocalLink as C}from"../../../../utils/path/is-local-link.js";import{normalizeRouteSlug as P}from"../../../../utils/path/normalize-route-slug.js";import{removeFragment as B}from"../../../../utils/path/remove-fragment.js";import{getInnerText as W}from"../../../../markdoc/helpers/get-inner-text.js";import{getNodeAttribute as j}from"../../../../markdoc/helpers/get-node-attribute.js";import{setNodeAttributeValue as p}from"../../../../markdoc/helpers/set-node-attribute-value.js";import{isAuthRoutePath as $}from"../../../../utils/auth/is-auth-route-path.js";import{isApiDownloadLink as b}from"../../../utils/is-api-download-link.js";import{isTranslationFallback as V}from"../../../fs/utils/is-translation-fallback.js";import{removeL10nPrefix as z}from"../../../fs/utils/remove-l10n-prefix.js";import{MdResolveError as A}from"./md-resolve-error.js";import{getLinkOriginalAttrName as G}from"./utils.js";import{isOpenApiURL as N}from"../../api-docs/utils/is-api-doc.js";import{parseBaseName as q}from"../../utils.js";import{isMarkdownPage as H}from"../is-markdown-page.js";import{copyStaticFile as K}from"../../../utils/fs.js";async function ht(i,s,u,{actions:I,context:m}){const{contentDir:T,outdir:v,getRouteByFsPath:d,getRouteBySlug:k,hasRouteOrRedirectBySlug:w}=I,x=G(s),o=i[x]||j(i,s);if(i[x]=o,!C(o)||b(o)||$(o))return;const[Q,t="",R,L]=/^([^?#]+)?([^#]+)?(.+)?/.exec(o)||[],g=i.type==="image"?"IMAGE":"LINK",h=String(i.attributes.title||i.attributes.alt||W([i])||""),c=B(u);if(i.type!=="image"){const{isOpenapiDetected:e,isOpenapiValid:r}=await N(t,c,I,m);if(e&&!r)throw new A(`OpenAPI route ${o} does not exist`,{rawLink:o,link:t,title:h,brokenLinkType:g})}if(l.extname(t)===""){if(t.startsWith("/")){const e=P(t),r=w(e)?t:_(e,k);if(!r)throw new A(`Route ${t} does not exist`,{rawLink:o,link:t,title:h,brokenLinkType:g});p(i,s,r+(R||"")+(L||""))}if(!o.startsWith("#")&&!t.startsWith("/")&&H(c)){const e=d(c)?.slug;if(!e)return;const{isIndexFile:r}=q(c),a=r?P(l.posix.join(e,t)):P(l.posix.join(e,"../",t)),E=w(P(a))?a:_(a,k);if(!E)throw new A(`Route ${t} does not exist`,{rawLink:o,link:a,title:h,brokenLinkType:g});p(i,s,E+(R||"")+(L||""))}return}const n=t.startsWith("/")?t.substring(1):l.posix.join(l.posix.dirname(c),decodeURI(t)),D=t.startsWith("/")?l.posix.join("static",t.substring(1)):"",S=m.fs.exists(n),F=m.fs.exists(D),f=d(n);if(!S&&!f&&!F)throw p(i,s,"#"),new A(`File ${n} does not exist`,{rawLink:o,link:n,title:h,brokenLinkType:g});if(f){const e=[U,M,y].includes(f.templateId);p(i,s,(e?f.baseSlug:f.slug)+(L||""))}else if(S){const e=m.fs.getFileInfo(n),r=V(e)?m.fs.getFileInfo(z(n)):e;if(!r||r.isVirtual)return;const a=await K(T,r.realRelativePath,v);p(i,s,a)}}function _(i,s){const u=s(i.toLowerCase());return u?.templateId===O?u.slug:void 0}export{ht as resolveLink};
@@ -1 +1 @@
1
- import s from"@markdoc/markdoc";import{getPublicEnvVariables as u}from"../../utils/envs/get-public-env-variables.js";import{transformMdAst as i}from"./runtime-transform";const v=async(A,o,t,e)=>{const{ast:n,frontmatter:r,props:l,editPage:f,lastModified:m}=o,{headings:d,renderableAst:p}=await i(s.Ast.fromJSON(n),{partials:t.partials,variables:{frontmatter:r,...t.variables,env:u()}},e.serverOutDir);return Array.isArray(r.banner)&&(r.banner=await Promise.all(r.banner.map(async a=>{if(a.ast){const{renderableAst:b}=await i(s.Ast.fromJSON(a.ast),{partials:{},variables:{}},e.serverOutDir);return{...a,ast:b}}return a}))),{...l,ast:p,headings:d,frontmatter:r,editPage:f,lastModified:m}};var P=v;export{P as default};
1
+ import e from"@markdoc/markdoc";import{getPublicEnvVariables as u}from"../../utils/envs/get-public-env-variables.js";import{transformMdAst as i}from"./runtime-transform";const v=async(A,o,t,s)=>{const{ast:l,frontmatter:r,props:n,editPage:f,lastModified:m,isTranslationFallback:b}=o,{headings:d,renderableAst:p}=await i(e.Ast.fromJSON(l),{partials:t.partials,variables:{frontmatter:r,...t.variables,env:u()}},s.serverOutDir);return Array.isArray(r.banner)&&(r.banner=await Promise.all(r.banner.map(async a=>{if(a.ast){const{renderableAst:c}=await i(e.Ast.fromJSON(a.ast),{partials:{},variables:{}},s.serverOutDir);return{...a,ast:c}}return a}))),{...n,ast:p,headings:d,frontmatter:r,editPage:f,lastModified:m,...b?{isTranslationFallback:!0}:{}}};var k=v;export{k as default};
@@ -1 +1 @@
1
- import{REDOCLY_TEAMS_RBAC as v}from"@redocly/config";import{MARKDOC_PARTIALS_DATA_KEY as D}from"../../constants/common.js";import{reporter as R}from"../../tools/notifiers/reporter.js";import{canAccessFeature as g}from"../../utils/entitlements/can-access-feature.js";import{extractMdFirstHeading as A,getAst as T}from"./compiler.js";import{getTemplatePath as w}from"./get-template-path.js";import{prepareMarkdocPartials as M}from"./markdoc/partials.js";import{searchResolver as C}from"./search/search-resolver.js";import{markdownStaticDataLoader as E}from"./markdown-static-data-loader.js";import{makeErrorRoute as I}from"../error-route.js";import{validateRbacConfig as O}from"../validate-rbac-config.js";import{findFrontmatterSlugs as _,getSidebarSharedDataId as G,resolveFrontmatterSlugs as L}from"../utils.js";import{isPartial as j}from"./is-partial.js";import{markdownFrontmatterLoader as B}from"./markdown-frontmatter-loader.js";import{resolveRawPartials as K}from"./markdoc/resolve-raw-partials.js";import{getAiDocumentsStore as N}from"./search/get-ai-search-documents.js";import{registerPageProps as Y}from"../register-page-props.js";import{resolveMarkdownTemplate as q}from"./utils/resolve-markdown-template.js";import{sanitizeMalformedMdContent as z}from"./utils/sanitize-malformed-md-content.js";import{telemetryTraceStep as H}from"../../../cli/telemetry/helpers/trace-step.js";async function ce(h){return{id:"markdoc",requiredEntitlements:["markdown"],loaders:{"markdown-frontmatter":B,"markdown-ast":async(e,t)=>{const i=await t.fs.read(e),m=await t.getConfig(),s=await K(i,e,m?.markdown?.partialsFolders,t),n=z(s);return T(e,n)}},processContent:async(e,t)=>{await H("com.redocly.build.plugin.markdown",async i=>{const{markdown:m}=await t.getConfig();i?.setAttribute("config",JSON.stringify(m||{}));const s=m?.partialsFolders??[],n=e.createTemplate("markdown","@redocly/theme/core/templates/Markdown"),S=e.registerServerPropsGetter("markdown",w("./get-server-props.js"));e.createTemplate("error",w("../../../client/app/Error/ErrorDetails.js"));for(const o of t.fs.scan(/\.md$/))if(!await t.isPathIgnored(o.relativePath)&&!j(o.relativePath,s))try{await k(o)}catch(a){e.addRoute(I(o.relativePath,a)),i?.error(a),await R.panicOnBuild("Failed to create route for markdown file: %s",a.message)}async function k(o){const{relativePath:a,realRelativePath:b}=o,{data:{frontmatter:r}}=await t.cache.load(a,"markdown-frontmatter"),P=r?.metadata||{},y=await _(a,"markdown-frontmatter",r,t),p=L(y,a);let d=null;r?.sidebar&&(d=await G(r.sidebar,a,t.fs));let u=n;const l=q({realRelativePath:b,frontmatter:r,markdown:m,contentDir:h.contentDir});l&&(u=e.createTemplate(l.templateRef,l.templatePath)),r?.rbac&&(g("rbac")?O({content:{[a]:r.rbac}}):r.rbac=void 0),g("banner")||(r.banner=void 0),await Y(o,t.fs,e),(p.length?p.reverse():[void 0]).forEach(F=>{e.addRoute({excludeFromSearch:r?.excludeFromSearch||!1,slug:F,fsPath:a,templateId:u,sharedData:d?[{id:d,key:"sidebar"}]:void 0,redirectFrom:Object.entries(r.redirects||{}).map(([c,{type:f}])=>({type:f||301,from:c})),[v]:r?.rbac,getNavText:async()=>(r?.seo?.title||await A(a,t)||"").toString(),metadata:{type:"markdown",...P},async getStaticData(c,f){return E(o,c,t,r,f)},getSearchDocuments:C(r,a,e.getSearchFacets,e.setSearchFacets),getAiDocumentsStore:N(e.getSearchFacets,r),serverPropsGetterIds:[S]})})}})},afterRoutesCreated:async(e,t)=>{const i=await M(t,e);e.setGlobalConfig({[D]:i})}}}export{ce as markdownPlugin};
1
+ import{REDOCLY_TEAMS_RBAC as v}from"@redocly/config";import{MARKDOC_PARTIALS_DATA_KEY as D}from"../../constants/common.js";import{reporter as R}from"../../tools/notifiers/reporter.js";import{canAccessFeature as g}from"../../utils/entitlements/can-access-feature.js";import{extractMdFirstHeading as A,getAst as T}from"./compiler.js";import{getTemplatePath as w}from"./get-template-path.js";import{prepareMarkdocPartials as M}from"./markdoc/partials.js";import{searchResolver as C}from"./search/search-resolver.js";import{markdownStaticDataLoader as E}from"./markdown-static-data-loader.js";import{makeErrorRoute as I}from"../error-route.js";import{validateRbacConfig as O}from"../validate-rbac-config.js";import{findFrontmatterSlugs as _,getSidebarSharedDataId as G,resolveFrontmatterSlugs as L}from"../utils.js";import{isPartial as j}from"./is-partial.js";import{markdownFrontmatterLoader as B}from"./markdown-frontmatter-loader.js";import{resolveRawPartials as K}from"./markdoc/resolve-raw-partials.js";import{getAiDocumentsStore as N}from"./search/get-ai-search-documents.js";import{registerPageProps as Y}from"../register-page-props.js";import{resolveMarkdownTemplate as q}from"./utils/resolve-markdown-template.js";import{sanitizeMalformedMdContent as z}from"./utils/sanitize-malformed-md-content.js";import{telemetryTraceStep as H}from"../../../cli/telemetry/helpers/trace-step.js";async function ce(h){return{id:"markdoc",requiredEntitlements:["markdown"],loaders:{"markdown-frontmatter":B,"markdown-ast":async(e,t)=>{const i=await t.fs.read(e),m=await t.getConfig(),s=await K(i,e,m?.markdown?.partialsFolders,t),n=z(s);return T(e,n)}},processContent:async(e,t)=>{await H("com.redocly.build.plugin.markdown",async i=>{const{markdown:m}=await t.getConfig();i?.setAttribute("config",JSON.stringify(m||{}));const s=m?.partialsFolders??[],n=e.createTemplate("markdown","@redocly/theme/core/templates/Markdown"),S=e.registerServerPropsGetter("markdown",w("./get-server-props.js"));e.createTemplate("error",w("../../../client/app/Error/ErrorDetails.js"));for(const o of t.fs.scan(/\.md$/))if(!await t.isPathIgnored(o.relativePath)&&!j(o.relativePath,s))try{await k(o)}catch(a){e.addRoute(I(o.relativePath,a)),i?.error(a),await R.panicOnBuild("Failed to create route for markdown file: %s",a.message)}async function k(o){const{relativePath:a,realRelativePath:b}=o,{data:{frontmatter:r}}=await t.cache.load(a,"markdown-frontmatter"),P=r?.metadata||{},y=await _(a,"markdown-frontmatter",r,t),p=L(y,a);let d=null;r?.sidebar&&(d=await G(r.sidebar,a,t.fs));let u=n;const l=q({realRelativePath:b,frontmatter:r,markdown:m,contentDir:h.contentDir});l&&(u=e.createTemplate(l.templateRef,l.templatePath)),r?.rbac&&(g("rbac")?O({content:{[a]:r.rbac}}):r.rbac=void 0),g("banner")||(r.banner=void 0),Y(o,t.fs,e),(p.length?p.reverse():[void 0]).forEach(F=>{e.addRoute({excludeFromSearch:r?.excludeFromSearch||!1,slug:F,fsPath:a,templateId:u,sharedData:d?[{id:d,key:"sidebar"}]:void 0,redirectFrom:Object.entries(r.redirects||{}).map(([c,{type:f}])=>({type:f||301,from:c})),[v]:r?.rbac,getNavText:async()=>(r?.seo?.title||await A(a,t)||"").toString(),metadata:{type:"markdown",...P},async getStaticData(c,f){return E(o,c,t,r,f)},getSearchDocuments:C(r,a,e.getSearchFacets,e.setSearchFacets),getAiDocumentsStore:N(e.getSearchFacets,r),serverPropsGetterIds:[S]})})}})},afterRoutesCreated:async(e,t)=>{const i=await M(t,e);e.setGlobalConfig({[D]:i})}}}export{ce as markdownPlugin};
@@ -1 +1 @@
1
- import{isNode as p}from"../../../../../markdoc/helpers/guards/is-node.js";import{isStringNode as u}from"../../../../../markdoc/helpers/guards/is-string-node.js";import{getNodeAttribute as o}from"../../../../../markdoc/helpers/get-node-attribute.js";import{getInnerText as a}from"../../../../../markdoc/helpers/get-inner-text.js";import{isPromptNode as m}from"../../../../../markdoc/helpers/guards/is-prompt-node.js";function d(t){const r=o(t,"level");if(r)return{value:a(t.children),id:o(t,"id"),depth:r}}function y(t){const r=o(t,"headlineLevel"),e=o(t,"anchorId"),s=o(t,"headline");if(!(!r||!e||!Array.isArray(s)))return{value:a(s),id:e,depth:r}}function I(t){let r;return f(t,e=>{if(p(e)){if(m(e))return l;if(e.type==="heading")return r=d(e)?.value,c}}),r}const c=Symbol("Exit visitor"),l=Symbol("Skip children");function f(t,r){if(!t)return;const e=r(t);if(e===c)return e;if(e===l)return;for(const i of t.children){if(!i||u(i))continue;const n=f(i,r);if(n===c)return n}const s=t.slots||{};for(const i of Object.values(s)){if(!i||u(i))continue;const n=f(i,r);if(n===c)return n}}export{c as EXIT,l as SKIP,I as extractFirstHeading,d as getHeadingData,y as getNumberedItemHeadingData,f as visit};
1
+ import{isForAgentsOnly as m}from"@redocly/theme/markdoc/tags/visibility";import{isNode as p}from"../../../../../markdoc/helpers/guards/is-node.js";import{isStringNode as u}from"../../../../../markdoc/helpers/guards/is-string-node.js";import{getNodeAttribute as o}from"../../../../../markdoc/helpers/get-node-attribute.js";import{getInnerText as l}from"../../../../../markdoc/helpers/get-inner-text.js";import{isPromptNode as d}from"../../../../../markdoc/helpers/guards/is-prompt-node.js";function h(t){const r=o(t,"level");if(r)return{value:l(t.children),id:o(t,"id"),depth:r}}function N(t){const r=o(t,"headlineLevel"),e=o(t,"anchorId"),s=o(t,"headline");if(!(!r||!e||!Array.isArray(s)))return{value:l(s),id:e,depth:r}}function S(t){let r;return c(t,e=>{if(p(e)){if(d(e)||m(e))return a;if(e.type==="heading")return r=h(e)?.value,f}}),r}const f=Symbol("Exit visitor"),a=Symbol("Skip children");function c(t,r){if(!t)return;const e=r(t);if(e===f)return e;if(e===a)return;for(const i of t.children){if(!i||u(i))continue;const n=c(i,r);if(n===f)return n}const s=t.slots||{};for(const i of Object.values(s)){if(!i||u(i))continue;const n=c(i,r);if(n===f)return n}}export{f as EXIT,a as SKIP,S as extractFirstHeading,h as getHeadingData,N as getNumberedItemHeadingData,c as visit};
@@ -1,2 +1,2 @@
1
- import p from"node:path";import _ from"is-glob";import{slash as $}from"../../../../utils/path/slash.js";import{reporter as d}from"../../../tools/notifiers/reporter.js";import{convertGlobToRegex as h}from"../../../utils/index.js";import{formatMarkdocError as k}from"../errors.js";import{isPartial as E}from"../is-partial.js";const b=/\{% ?raw-partial file="([^"]+)" ?\/?%\}/gm,y=async(t,a,i=[],o,l=[a])=>{for(const s of i){const r=_(s)?h(s):new RegExp(`^${s}/`);await o.fs.scan(r)}const n=[],f=t.replace(b,(s,r)=>(n.push(u(s,r)),"_$redocly$"+(n.length-1)+"$")),w=await Promise.all(n);return f.replace(/_\$redocly\$(\d+)\$/g,(s,r)=>w[+r]);async function u(s,r){const e=r.startsWith("/")?r.slice(1):$(p.relative(o.fs.cwd,p.resolve(o.fs.cwd,p.dirname(a),r)));if(l.includes(e)){const c=[...l,e];return await d.panicOnBuildContentError(`Circular reference chain detected when processing raw partials: ${c.map(()=>"%rp").join(" -> ")}`,...c),""}const m=!o.fs.exists(e),g=!e.endsWith(".md")||await o.isPathIgnored(e)||!E(e,i);if(m||g){const R={type:"resolve_link",lines:[1,t.split(`
1
+ import p from"node:path";import _ from"is-glob";import{slash as $}from"../../../../utils/path/slash.js";import{reporter as d}from"../../../tools/notifiers/reporter.js";import{convertGlobToRegex as h}from"../../../utils/index.js";import{formatMarkdocError as k}from"../errors.js";import{isPartial as E}from"../is-partial.js";const b=/\{% ?raw-partial file="([^"]+)" ?\/?%\}/gm,y=async(t,a,i=[],o,l=[a])=>{for(const s of i){const r=_(s)?h(s):new RegExp(`^${s}/`);o.fs.scan(r)}const n=[],f=t.replace(b,(s,r)=>(n.push(u(s,r)),"_$redocly$"+(n.length-1)+"$")),w=await Promise.all(n);return f.replace(/_\$redocly\$(\d+)\$/g,(s,r)=>w[+r]);async function u(s,r){const e=r.startsWith("/")?r.slice(1):$(p.relative(o.fs.cwd,p.resolve(o.fs.cwd,p.dirname(a),r)));if(l.includes(e)){const c=[...l,e];return await d.panicOnBuildContentError(`Circular reference chain detected when processing raw partials: ${c.map(()=>"%rp").join(" -> ")}`,...c),""}const m=!o.fs.exists(e),g=!e.endsWith(".md")||await o.isPathIgnored(e)||!E(e,i);if(m||g){const R={type:"resolve_link",lines:[1,t.split(`
2
2
  `).length],meta:{rawLink:r,link:e},error:{id:"error",level:"error",message:m?"Raw partial file does not exist":"Could not resolve raw partial. Starting with 0.73.0 version all partials should be placed in partials folders"}};return d.reportMarkdocProblem(k(R,a,t)),""}const v=await o.fs.read(e);return await y(v,e,i,o,[...l,e])}};export{y as resolveRawPartials};
@@ -1 +1 @@
1
- import D from"path";import{REDOCLY_TEAMS_RBAC as v,REDOCLY_ROUTE_RBAC as A}from"@redocly/config";import{removeTrailingSlash as M}from"../../../utils/url/remove-trailing-slash.js";import{addLeadingSlash as N}from"../../../utils/url/add-leading-slash.js";import{shaHexShort as E}from"../../utils/crypto/sha-hex-short.js";import{isDefined as I}from"../../../utils/guards/is-defined.js";import{resolveFrontmatterKeys as L}from"../resolve-frontmatter-keys.js";import{resolveItem as _}from"../nav-utils.js";const R=new WeakMap;async function j(o,i,s,e,a){const d=await s.getConfig(),{ast:r,compoundHash:n,info:g}=await a.parseMarkdoc({input:o,context:s}),l={...d.markdown?.editPage,...e.markdown?.editPage},t=i.fsPath!=null?s.fs.getFileInfo(i.fsPath):null,f=!l?.hide&&l?.baseUrl?{to:M(l.baseUrl)+N(t?.realRelativePath||i.fsPath||"")}:void 0,w={...d.feedback,...e.feedback},m=e.feedback?{type:w.type||"sentiment",settings:w.settings||{},hide:e.feedback?.hide}:void 0;let h;Array.isArray(e.banner)&&(h=(await Promise.all(e.banner.map(async(B,O)=>{const{content:k,...b}=B;if(!k)return;const{ast:T}=await a.parseMarkdoc({input:{content:k,relativePath:o.relativePath,isVirtual:o.isVirtual},context:s,resource:`${o.relativePath}#banner${O}`});return{...b,...b.rbac?{[v]:b.rbac}:{},ast:JSON.stringify(T),hash:E(k)}}))).filter(I));const y=R.get(r);let c=y?.ast;(!c||y?.compoundHash!==n)&&(c=JSON.stringify(r),R.set(r,{ast:c,compoundHash:n}));let p;e.navigation&&(p={...e.navigation,nextButton:await S(e.navigation.nextButton,i,a,s),previousButton:await S(e.navigation.previousButton,i,a,s)});const u=e?.seo?await L(e.seo,["image"],i.fsPath||"",a,s):void 0,P=g.tagList;Array.isArray(P)&&P.includes("code-walkthrough")&&(e.markdown=e.markdown||{},e.markdown.toc={hide:!0},e.footer=e.footer||{},e.footer={hide:!0});const C=e?.seo?.title||await i.getNavText?.();return{ast:c,frontmatter:await L({...e,...m!==void 0?{feedback:m}:{},...u!==void 0?{seo:u}:{},...p!==void 0?{navigation:p}:{},...h!==void 0?{banner:h}:{}},d.markdown?.frontMatterKeysToResolve||["image","links"],i.fsPath||"",a,s),editPage:f,props:{metadata:{markdoc:{tagList:g.tagList}},seo:{...u,...C?{title:C}:{}}},[v]:i[v],[A]:i[A]}}async function S(o,i,s,e){if(!o||typeof o!="object")return;let a=o,d,r;if("page"in a&&typeof a.page=="string"){const{page:t,...f}=a;a=f,d=t}if("label"in a&&typeof a.label=="string"){const{label:t,...f}=a;a=f,r=t}let n;if(d){const t=await _({page:d},i.fsPath?D.dirname(i.fsPath):".",s,e,{navFile:i.fsPath||""});n=Array.isArray(t)?t[0]:t,n=n?.type!=="error"?n:void 0}const g=n?.routeSlug,l=r??n?.label;return{...a,label:l,link:g}}export{j as markdownStaticDataLoader};
1
+ import D from"path";import{REDOCLY_TEAMS_RBAC as m,REDOCLY_ROUTE_RBAC as A}from"@redocly/config";import{removeTrailingSlash as F}from"../../../utils/url/remove-trailing-slash.js";import{addLeadingSlash as M}from"../../../utils/url/add-leading-slash.js";import{shaHexShort as N}from"../../utils/crypto/sha-hex-short.js";import{isDefined as E}from"../../../utils/guards/is-defined.js";import{isTranslationFallback as I}from"../../fs/utils/is-translation-fallback.js";import{resolveFrontmatterKeys as L}from"../resolve-frontmatter-keys.js";import{resolveItem as _}from"../nav-utils.js";const R=new WeakMap;async function z(n,i,s,e,a){const l=await s.getConfig(),{ast:d,compoundHash:t,info:g}=await a.parseMarkdoc({input:n,context:s}),r={...l.markdown?.editPage,...e.markdown?.editPage},o=i.fsPath!=null?s.fs.getFileInfo(i.fsPath):null,f=!r?.hide&&r?.baseUrl?{to:F(r.baseUrl)+M(o?.realRelativePath||i.fsPath||"")}:void 0,v={...l.feedback,...e.feedback},w=e.feedback?{type:v.type||"sentiment",settings:v.settings||{},hide:e.feedback?.hide}:void 0;let h;Array.isArray(e.banner)&&(h=(await Promise.all(e.banner.map(async(T,B)=>{const{content:k,...b}=T;if(!k)return;const{ast:O}=await a.parseMarkdoc({input:{content:k,relativePath:n.relativePath,isVirtual:n.isVirtual},context:s,resource:`${n.relativePath}#banner${B}`});return{...b,...b.rbac?{[m]:b.rbac}:{},ast:JSON.stringify(O),hash:N(k)}}))).filter(E));const y=R.get(d);let c=y?.ast;(!c||y?.compoundHash!==t)&&(c=JSON.stringify(d),R.set(d,{ast:c,compoundHash:t}));let p;e.navigation&&(p={...e.navigation,nextButton:await S(e.navigation.nextButton,i,a,s),previousButton:await S(e.navigation.previousButton,i,a,s)});const u=e?.seo?await L(e.seo,["image"],i.fsPath||"",a,s):void 0,P=g.tagList;Array.isArray(P)&&P.includes("code-walkthrough")&&(e.markdown=e.markdown||{},e.markdown.toc={hide:!0},e.footer=e.footer||{},e.footer={hide:!0});const C=e?.seo?.title||await i.getNavText?.();return{ast:c,frontmatter:await L({...e,...w!==void 0?{feedback:w}:{},...u!==void 0?{seo:u}:{},...p!==void 0?{navigation:p}:{},...h!==void 0?{banner:h}:{}},l.markdown?.frontMatterKeysToResolve||["image","links"],i.fsPath||"",a,s),editPage:f,...I(n)?{isTranslationFallback:!0}:{},props:{metadata:{markdoc:{tagList:g.tagList}},seo:{...u,...C?{title:C}:{}}},[m]:i[m],[A]:i[A]}}async function S(n,i,s,e){if(!n||typeof n!="object")return;let a=n,l,d;if("page"in a&&typeof a.page=="string"){const{page:o,...f}=a;a=f,l=o}if("label"in a&&typeof a.label=="string"){const{label:o,...f}=a;a=f,d=o}let t;if(l){const o=await _({page:l},i.fsPath?D.dirname(i.fsPath):".",s,e,{navFile:i.fsPath||""});t=Array.isArray(o)?o[0]:o,t=t?.type!=="error"?t:void 0}const g=t?.routeSlug,r=d??t?.label;return{...a,label:r,link:g}}export{z as markdownStaticDataLoader};
@@ -1 +1 @@
1
- import{reporter as t}from"../../tools/notifiers/reporter.js";async function o(r,n){return await n.exists(r)?n.read(r):(await t.panicOnBuildContentError(`File ${r} does not exist`),null)}export{o as readFileContent};
1
+ import{reporter as e}from"../../tools/notifiers/reporter.js";async function o(r,n){return n.exists(r)?n.read(r):(await e.panicOnBuildContentError(`File ${r} does not exist`),null)}export{o as readFileContent};
@@ -1 +1 @@
1
- import p from"@markdoc/markdoc";import{REDOCLY_ROUTE_RBAC as l,REDOCLY_TEAMS_RBAC as A}from"@redocly/config";import{getInnerText as T}from"../../../../markdoc/helpers/get-inner-text.js";import{getSearchDocuments as h}from"./get-search-documents.js";import{AstToSearchNodeTransformer as R}from"./walk-sections.js";import{setDocumentSearchFacets as S,extractDocumentSearchFacets as C}from"./search-facets.js";import{MARKDOC_PARTIALS_DATA_KEY as D}from"../../../constants/common.js";import{normalizeFrontmatterKeywords as _}from"../../helpers/normalize-frontmatter-keywords.js";function K(e,m,o,c){return async(t,r,a)=>{if(e?.excludeFromSearch)return[];const i=p.Ast.fromJSON(r.ast),u=new R({ast:i,getInnerContent:T,partials:a.getGlobalConfig(D)||{},indexPromptTitles:!0}),f=t.metadata||{},n=C(f,o);S(n,o,c);const d=e?.seo?.title||m,{result:s}=_(e?.keywords);return h(u,t.slug,d,r[A],r[l],n,s||void 0)}}export{K as searchResolver};
1
+ import d from"@markdoc/markdoc";import{REDOCLY_ROUTE_RBAC as l,REDOCLY_TEAMS_RBAC as A}from"@redocly/config";import{getInnerText as T}from"../../../../markdoc/helpers/get-inner-text.js";import{skipAgentsOnlyContent as h}from"@redocly/theme/markdoc/tags/visibility";import{getSearchDocuments as g}from"./get-search-documents.js";import{AstToSearchNodeTransformer as C}from"./walk-sections.js";import{setDocumentSearchFacets as R,extractDocumentSearchFacets as S}from"./search-facets.js";import{MARKDOC_PARTIALS_DATA_KEY as D}from"../../../constants/common.js";import{normalizeFrontmatterKeywords as _}from"../../helpers/normalize-frontmatter-keywords.js";function Y(e,m,o,c){return async(t,r,a)=>{if(e?.excludeFromSearch)return[];const i=d.Ast.fromJSON(r.ast),f=new C({ast:i,getInnerContent:T,partials:a.getGlobalConfig(D)||{},renderTag:h,indexPromptTitles:!0}),p=t.metadata||{},n=S(p,o);R(n,o,c);const u=e?.seo?.title||m,{result:s}=_(e?.keywords);return g(f,t.slug,u,r[A],r[l],n,s||void 0)}}export{Y as searchResolver};
@@ -1,7 +1,7 @@
1
- import{buildToolTypeDeclarations as p,sanitizeToolName as c}from"../build-tool-type-declarations.js";import{buildExecuteExample as a,EXECUTE_ARGS_NOTE as m,USAGE_NOTES as u}from"../prompts.js";import{FETCH_TOOL_NAME as l}from"../constants.js";import{ALL_CAPABILITIES as d}from"./registry.js";function H(n){return d.filter(o=>o.isActive(n))}function h(n,o,r){const i=[...n.map(({annotations:t})=>t??{}),...o.map(t=>t.annotations(r))],e=i.filter(t=>t.readOnlyHint!==!0);return{readOnlyHint:e.length===0,destructiveHint:e.some(t=>t.destructiveHint!==!1),idempotentHint:e.every(t=>t.idempotentHint===!0),openWorldHint:i.some(t=>t.openWorldHint!==!1)}}function O(n,o,r){const i=n.map(t=>c(t.name)),e=[];if(n.length>0){const t=p(n),s=t.includes("OpenApi")?`
1
+ import{buildToolTypeDeclarations as p,sanitizeToolName as c}from"../build-tool-type-declarations.js";import{buildExecuteExample as a,EXECUTE_ARGS_NOTE as m,USAGE_NOTES as u}from"../prompts.js";import{FETCH_TOOL_NAME as l}from"../constants.js";import{READ_ONLY_ANNOTATIONS as f}from"../../constants.js";import{ALL_CAPABILITIES as d}from"./registry.js";function N(o){return d.filter(i=>i.isActive(o))}function h(o,i,s){const r=[...o.map(({annotations:t})=>t??{}),...i.map(t=>t.annotations(s))],n=r.filter(t=>t.readOnlyHint!==!0),e=r.some(t=>t.openWorldHint!==!1);return n.length===0?{...f,openWorldHint:e}:{readOnlyHint:!1,destructiveHint:n.some(t=>t.destructiveHint!==!1),idempotentHint:n.every(t=>t.idempotentHint===!0),openWorldHint:e}}function _(o,i,s){const r=o.map(e=>c(e.name)),n=[];if(o.length>0){const e=p(o),t=e.includes("OpenApi")?`
2
2
 
3
- ${u}`:"";e.push(`## Sandbox tools
3
+ ${u}`:"";n.push(`## Sandbox tools
4
4
 
5
- ${t}${s}`)}e.push(m),n.length>0&&!o.some(t=>t.id===l)&&e.push(a(i));for(const t of o)e.push(t.renderSection(r,i));return e.join(`
5
+ ${e}${t}`)}n.push(m),o.length>0&&!i.some(e=>e.id===l)&&n.push(a(r));for(const e of i)n.push(e.renderSection(s,r));return n.join(`
6
6
 
7
- `)}export{h as composeExecuteAnnotations,H as getActiveCapabilities,O as renderDescribeToolsOutput};
7
+ `)}export{h as composeExecuteAnnotations,N as getActiveCapabilities,_ as renderDescribeToolsOutput};
@@ -1 +1 @@
1
- import{CREATE_ANONYMOUS_SESSION_TOOL_NAME as _,MANAGE_API_CREDENTIALS_TOOL_NAME as E}from"../constants.js";const O="execute",t="describe-tools",e="fetch",A=new Set([O,t,_,E]),N="tools",T="__fetchBridge",L="fetch";export{A as CODE_MODE_TOOL_NAMES,t as DESCRIBE_TOOLS_TOOL_NAME,O as EXECUTE_TOOL_NAME,L as FETCH_BRIDGE_FUNCTION_NAME,T as FETCH_BRIDGE_GLOBAL_NAME,e as FETCH_TOOL_NAME,N as TOOLS_BRIDGE_GLOBAL_NAME};
1
+ import{CREATE_ANONYMOUS_SESSION_TOOL_NAME as _,MANAGE_API_CREDENTIALS_TOOL_NAME as E,SUBMIT_FEEDBACK_TOOL_NAME as O}from"../constants.js";const t="execute",o="describe-tools",e="fetch",N=new Set([t,o,_,E,O]),T="tools",L="__fetchBridge",M="fetch";export{N as CODE_MODE_TOOL_NAMES,o as DESCRIBE_TOOLS_TOOL_NAME,t as EXECUTE_TOOL_NAME,M as FETCH_BRIDGE_FUNCTION_NAME,L as FETCH_BRIDGE_GLOBAL_NAME,e as FETCH_TOOL_NAME,T as TOOLS_BRIDGE_GLOBAL_NAME};
@@ -1,7 +1,7 @@
1
1
  import { type ToolListEntry } from './build-tool-list.js';
2
- export declare const DESCRIPTION_CHAR_LIMIT = 2048;
3
2
  export declare const EXECUTE_ARGS_NOTE = "Both `execute` arguments are required: `code` (the JavaScript to run; return a value to receive it) and `description` (a short human-readable summary of what the code does).";
4
- export declare function buildExecuteDescription(hasFetch: boolean, toolList?: ToolListEntry[]): string;
3
+ /** The first line names the docs at `docsUrl` when the prose with it fits `DESCRIPTION_CHAR_LIMIT`. */
4
+ export declare function buildExecuteDescription(hasFetch: boolean, toolList?: ToolListEntry[], docsUrl?: string): string;
5
5
  export declare const DESCRIBE_TOOLS_DESCRIPTION: string;
6
6
  export declare function buildCodeModeInstructions(hasFetch: boolean, toolList?: ToolListEntry[]): string;
7
7
  export declare function buildExecuteExample(toolNames: string[]): string;
@@ -1,8 +1,8 @@
1
- import{buildToolList as i}from"./build-tool-list.js";const r=2048,d="Both `execute` arguments are required: `code` (the JavaScript to run; return a value to receive it) and `description` (a short human-readable summary of what the code does).",n="Available tools (exact signatures come from `describe-tools`):";function a(e,t){if(t.length===0)return e;const o=r-e.length-n.length-3,s=i(t,o);return s?[e,"",n,s].join(`
2
- `):e}function h(e,t=[]){const o=["Run JavaScript in a sandbox against the documentation tools on the global `tools` object.",e?"The extra globals are `tools`, `fetch`, `URL`, `URLSearchParams`, and `FormData` - there is no `console`, `setTimeout`, `require`, or Node.js API; all other I/O goes through `tools`.":"The only extra global is `tools` - there is no `fetch`, `console`, `setTimeout`, `require`, or Node.js API; all I/O goes through `tools`.","","Workflow - minimize round-trips; one `describe-tools` call plus one `execute` call covers most requests:","1. Analyze the request and decide which sandbox tools it needs.","2. Call `describe-tools` with those names to get their exact TypeScript signatures - inputs, result shapes, and a worked example. NEVER call `execute` with guessed method names, parameter names, enum values, or result field names: read fields off the declared return types, not from assumptions.","3. Batch everything into a SINGLE script: chain tool calls, pass one call's output into the next, process results in plain JavaScript, and `return` only what the request needs."].join(`
3
- `);return a(o,t)}const p=["Get the exact TypeScript signatures of the sandbox tools available to `execute`.","Analyze the user request first, then pass `tools` with only the tool names the request needs (every name is listed in this input schema / description); omit `tools` only when you cannot tell which tools apply.","Always call this before your first `execute` and never guess signatures. Request every tool the task may need in ONE call instead of calling this repeatedly."].join(`
4
- `);function m(e,t=[]){const o=["This server exposes documentation tools (API discovery, endpoint details, security schemes, full-text search) through `describe-tools` and `execute`:","- `describe-tools` returns the exact TypeScript signatures of the sandbox tools.","- `execute` runs JavaScript that calls those tools on the global `tools` object.","Workflow: analyze the request, call `describe-tools` once with `tools` set to only the names it needs, then batch everything into a single `execute` script. Minimize round-trips and never guess tool signatures.",...e?["The sandbox also has a global `fetch` that can call the documented APIs (allow-listed hosts only). Include `fetch` in your `describe-tools` call to get its contract and the list of callable APIs."]:[]].join(`
5
- `);return a(o,t)}const l=["listApis","getEndpoints"],c=["Example - list the write endpoints of an API:","","```ts","const { items } = await tools.listApis({ filter: 'billing' });","const [api] = items;",`if (!api) return { error: 'no API matches "billing"' };`,"const { endpoints } = await tools.getEndpoints({ name: api.name });","const writes = endpoints.filter((e) => e.method !== 'GET');","return { api: api.name, writes: writes.map((e) => `${e.method} ${e.path}`) };","```"].join(`
6
- `);function g(e){if(l.every(o=>e.includes(o)))return c;const[t]=e;return t?[`Example - call \`${t}\` and return what the request needs:`,"","```ts",`const result = await tools.${t}({ /* the input its signature above declares */ });`,"return result;","```"].join(`
7
- `):""}const b=["Types named `OpenApi\u2026` are the standard OpenAPI Specification objects.","Payload samples live on a media type object (`requestBody.content[mediaType]`, `responses[code].content[mediaType]`): `.example` holds a single value, `.examples[name].value` a named map, and some descriptions only set `.schema.example`. Read each before concluding a sample is absent."].join(`
8
- `);export{p as DESCRIBE_TOOLS_DESCRIPTION,r as DESCRIPTION_CHAR_LIMIT,d as EXECUTE_ARGS_NOTE,b as USAGE_NOTES,m as buildCodeModeInstructions,h as buildExecuteDescription,g as buildExecuteExample};
1
+ import{buildToolList as c}from"./build-tool-list.js";const n=2048,m="Both `execute` arguments are required: `code` (the JavaScript to run; return a value to receive it) and `description` (a short human-readable summary of what the code does).",a="Available tools (exact signatures come from `describe-tools`):";function i(e,t){if(t.length===0)return e;const o=n-e.length-a.length-3,s=c(t,o);return s?[e,"",a,s].join(`
2
+ `):e}const u="Run JavaScript in a sandbox against the documentation tools on the global `tools` object.";function r(e,t){return[e,t?"The extra globals are `tools`, `fetch`, `URL`, `URLSearchParams`, and `FormData` - there is no `console`, `setTimeout`, `require`, or Node.js API; all other I/O goes through `tools`.":"The only extra global is `tools` - there is no `fetch`, `console`, `setTimeout`, `require`, or Node.js API; all I/O goes through `tools`.","","Workflow - minimize round-trips; one `describe-tools` call plus one `execute` call covers most requests:","1. Analyze the request and decide which sandbox tools it needs.","2. Call `describe-tools` with those names to get their exact TypeScript signatures - inputs, result shapes, and a worked example. NEVER call `execute` with guessed method names, parameter names, enum values, or result field names: read fields off the declared return types, not from assumptions.","3. Batch everything into a SINGLE script: chain tool calls, pass one call's output into the next, process results in plain JavaScript, and `return` only what the request needs."].join(`
3
+ `)}function g(e,t=[],o){const s=o&&r(`Run JavaScript in a sandbox against the tools for the documentation at ${o}. The tools are on the global \`tools\` object.`,e),l=s&&s.length<=n?s:r(u,e);return i(l,t)}const b=["Get the exact TypeScript signatures of the sandbox tools available to `execute`.","Analyze the user request first, then pass `tools` with only the tool names the request needs (every name is listed in this input schema / description); omit `tools` only when you cannot tell which tools apply.","Always call this before your first `execute` and never guess signatures. Request every tool the task may need in ONE call instead of calling this repeatedly."].join(`
4
+ `);function f(e,t=[]){const o=["This server exposes documentation tools (API discovery, endpoint details, security schemes, full-text search) through `describe-tools` and `execute`:","- `describe-tools` returns the exact TypeScript signatures of the sandbox tools.","- `execute` runs JavaScript that calls those tools on the global `tools` object.","Workflow: analyze the request, call `describe-tools` once with `tools` set to only the names it needs, then batch everything into a single `execute` script. Minimize round-trips and never guess tool signatures.",...e?["The sandbox also has a global `fetch` that can call the documented APIs (allow-listed hosts only). Include `fetch` in your `describe-tools` call to get its contract and the list of callable APIs."]:[]].join(`
5
+ `);return i(o,t)}const h=["listApis","getEndpoints"],d=["Example - list the write endpoints of an API:","","```ts","const { items } = await tools.listApis({ filter: 'billing' });","const [api] = items;",`if (!api) return { error: 'no API matches "billing"' };`,"const { endpoints } = await tools.getEndpoints({ name: api.name });","const writes = endpoints.filter((e) => e.method !== 'GET');","return { api: api.name, writes: writes.map((e) => `${e.method} ${e.path}`) };","```"].join(`
6
+ `);function x(e){if(h.every(o=>e.includes(o)))return d;const[t]=e;return t?[`Example - call \`${t}\` and return what the request needs:`,"","```ts",`const result = await tools.${t}({ /* the input its signature above declares */ });`,"return result;","```"].join(`
7
+ `):""}const y=["Types named `OpenApi\u2026` are the standard OpenAPI Specification objects.","Payload samples live on a media type object (`requestBody.content[mediaType]`, `responses[code].content[mediaType]`): `.example` holds a single value, `.examples[name].value` a named map, and some descriptions only set `.schema.example`. Read each before concluding a sample is absent."].join(`
8
+ `);export{b as DESCRIBE_TOOLS_DESCRIPTION,m as EXECUTE_ARGS_NOTE,y as USAGE_NOTES,f as buildCodeModeInstructions,g as buildExecuteDescription,x as buildExecuteExample};
@@ -1,3 +1,3 @@
1
- import{renderDescribeToolsOutput as _}from"../capabilities/index.js";import{McpServerType as u}from"../../constants.js";import{logMcpToolCallAudit as E,reportMcpToolCalled as k,reportMcpToolError as C}from"../../workers/mcp-tool-telemetry.js";import{DESCRIBE_TOOLS_TOOL_NAME as l}from"../constants.js";import{DESCRIBE_TOOLS_DESCRIPTION as j}from"../prompts.js";import{sanitizeToolName as s}from"../build-tool-type-declarations.js";import{UnknownToolError as O}from"./tool-errors.js";import{callAttribution as N}from"../../utils/telemetry-attributes.js";function U(c,f){const r=[...new Set([...c.map(n=>s(n.name)),...f.map(n=>s(n.id))])];return{name:l,title:"Describe tools",description:j,annotations:{readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},schema:{type:"object",required:[],additionalProperties:!1,properties:{tools:{type:"array",description:`Tool names to describe: ${r.join(", ")}. Omit to describe everything.`,items:r.length>0?{type:"string",enum:r}:{type:"string"},nullable:!0}}}}}function x(c,f,r,n){const p=new Map(c.map(t=>[s(t.name),t])),w=new Map(r.map(t=>[s(t.id),t]));return async t=>{const b=performance.now(),m=n.mcpMode??"code",d=N(n);try{const o=[...new Set((t.tools??[]).map(s))],i=o.length===0,a=o.filter(e=>!p.has(e)&&!w.has(e));if(a.length>0){const e=[...p.keys(),...w.keys()];throw new O(`Unknown tool(s): ${a.join(", ")}. Valid tools: ${e.join(", ")}.`)}const S=i?r:r.filter(e=>o.includes(s(e.id))),T=i?c:o.filter(e=>p.has(e)).map(e=>p.get(e)),v=await Promise.all(T.map(e=>f(e.name))),D=T.filter((e,y)=>v[y]),M=T.filter((e,y)=>!v[y]),g=[_(D,S,n)];M.length>0&&g.push(`Not available for this request: ${M.map(e=>s(e.name)).join(", ")}`);const h=g.join(`
1
+ import{renderDescribeToolsOutput as N}from"../capabilities/index.js";import{McpServerType as u,READ_ONLY_ANNOTATIONS as D}from"../../constants.js";import{logMcpToolCallAudit as E,reportMcpToolCalled as k,reportMcpToolError as C}from"../../workers/mcp-tool-telemetry.js";import{DESCRIBE_TOOLS_TOOL_NAME as l}from"../constants.js";import{DESCRIBE_TOOLS_DESCRIPTION as j}from"../prompts.js";import{sanitizeToolName as s}from"../build-tool-type-declarations.js";import{UnknownToolError as O}from"./tool-errors.js";import{callAttribution as A}from"../../utils/telemetry-attributes.js";function B(c,f){const r=[...new Set([...c.map(n=>s(n.name)),...f.map(n=>s(n.id))])];return{name:l,title:"Get docs function signatures",description:j,annotations:D,schema:{type:"object",required:[],additionalProperties:!1,properties:{tools:{type:"array",description:`Tool names to describe: ${r.join(", ")}. Omit to describe everything.`,items:r.length>0?{type:"string",enum:r}:{type:"string"},nullable:!0}}}}}function z(c,f,r,n){const p=new Map(c.map(t=>[s(t.name),t])),w=new Map(r.map(t=>[s(t.id),t]));return async t=>{const b=performance.now(),m=n.mcpMode??"code",d=A(n);try{const e=[...new Set((t.tools??[]).map(s))],i=e.length===0,a=e.filter(o=>!p.has(o)&&!w.has(o));if(a.length>0){const o=[...p.keys(),...w.keys()];throw new O(`Unknown tool(s): ${a.join(", ")}. Valid tools: ${o.join(", ")}.`)}const S=i?r:r.filter(o=>e.includes(s(o.id))),T=i?c:e.filter(o=>p.has(o)).map(o=>p.get(o)),g=await Promise.all(T.map(o=>f(o.name))),_=T.filter((o,y)=>g[y]),v=T.filter((o,y)=>!g[y]),M=[N(_,S,n)];v.length>0&&M.push(`Not available for this request: ${v.map(o=>s(o.name)).join(", ")}`);const h=M.join(`
2
2
 
3
- `);return E({tool:l,mode:m,serverType:u.Docs,args:t,result:h,...d}),k({tool:l,mode:m,serverType:u.Docs,durationMs:Math.round(performance.now()-b),outputLength:h.length,...d}),{content:[{type:"text",text:h}]}}catch(o){const i=o instanceof O,a=i?"tool_error":"server_error";throw E({tool:l,mode:m,serverType:u.Docs,args:t,errorClass:a,...d}),C({tool:l,mode:m,serverType:u.Docs,durationMs:Math.round(performance.now()-b),message:o instanceof Error?o.message:String(o),stack:!i&&o instanceof Error&&o.stack||"",errorClass:a,...d}),o}}}export{x as describeTools,U as describeToolsSchema};
3
+ `);return E({tool:l,mode:m,serverType:u.Docs,args:t,result:h,...d}),k({tool:l,mode:m,serverType:u.Docs,durationMs:Math.round(performance.now()-b),outputLength:h.length,...d}),{content:[{type:"text",text:h}]}}catch(e){const i=e instanceof O,a=i?"tool_error":"server_error";throw E({tool:l,mode:m,serverType:u.Docs,args:t,errorClass:a,...d}),C({tool:l,mode:m,serverType:u.Docs,durationMs:Math.round(performance.now()-b),message:e instanceof Error?e.message:String(e),stack:!i&&e instanceof Error&&e.stack||"",errorClass:a,...d}),e}}}export{z as describeTools,B as describeToolsSchema};
@@ -1,3 +1,5 @@
1
+ import type { ToolAnnotations } from '@modelcontextprotocol/server';
1
2
  import type { McpToolSchema } from '../../../../types';
3
+ export declare function executeToolTitle(annotations: ToolAnnotations): string;
2
4
  export declare const EXECUTE_TOOL_SCHEMA: McpToolSchema;
3
5
  //# sourceMappingURL=execute-schema.d.ts.map
@@ -1 +1 @@
1
- import{EXECUTE_TOOL_NAME as e}from"../constants.js";import{buildExecuteDescription as t}from"../prompts.js";const r={name:e,title:"Execute code",description:t(!1),schema:{type:"object",required:["code","description"],additionalProperties:!1,properties:{code:{type:"string",description:"JavaScript to run in the sandbox. Return a value to receive it as the result.",minLength:1},description:{type:"string",description:"A short, human-readable summary of what this code does.",minLength:1},sessionHandle:{type:"string",description:"Handle returned by createAnonymousSession. Required when an API needs credentials. This parameter is only offered when createAnonymousSession is available, so pass it whenever you have called that tool.",minLength:1}}},outputSchema:{type:"object",properties:{result:{description:"The value the code returned, as JSON"},error:{type:"string",description:"Why the code failed. Set only on a failed call"}}}};export{r as EXECUTE_TOOL_SCHEMA};
1
+ import{EXECUTE_TOOL_NAME as o}from"../constants.js";import{buildExecuteDescription as i}from"../prompts.js";const e="Execute code";function s(t){return t.readOnlyHint?"Query the docs with code":e}const a={name:o,title:e,description:i(!1),schema:{type:"object",required:["code","description"],additionalProperties:!1,properties:{code:{type:"string",description:"JavaScript to run in the sandbox. Return a value to receive it as the result.",minLength:1},description:{type:"string",description:"A short, human-readable summary of what this code does.",minLength:1},sessionHandle:{type:"string",description:"Handle returned by createAnonymousSession. Required when an API needs credentials. This parameter is only offered when createAnonymousSession is available, so pass it whenever you have called that tool.",minLength:1}}},outputSchema:{type:"object",properties:{result:{description:"The value the code returned, as JSON"},error:{type:"string",description:"Why the code failed. Set only on a failed call"}}}};export{a as EXECUTE_TOOL_SCHEMA,s as executeToolTitle};
@@ -1,3 +1,4 @@
1
+ import type { ToolAnnotations } from '@modelcontextprotocol/server';
1
2
  export declare const McpServerType: {
2
3
  readonly Docs: 'docs';
3
4
  };
@@ -9,13 +10,12 @@ export declare const McpErrorCodes: {
9
10
  readonly InvalidParams: -32602;
10
11
  };
11
12
  export declare const MCP_PROTOCOL_VERSION = "2025-11-25";
12
- export declare const DEFAULT_CONNECTION_TIMEOUT_MS = 30000;
13
13
  export declare const SSE_KEEPALIVE_INTERVAL_MS = 15000;
14
- export declare const MAX_DOCUMENTS_PER_CATEGORY = 3;
15
14
  export declare const DEFAULT_DOCS_MCP_SERVER_NAME = "Docs MCP server";
16
15
  export declare const SUPPORTED_MCP_SCOPES: readonly ['openid', 'profile', 'email', 'offline_access'];
17
16
  export declare const CREATE_ANONYMOUS_SESSION_TOOL_NAME = "createAnonymousSession";
18
17
  export declare const SUBMIT_FEEDBACK_TOOL_NAME = "submit-feedback";
19
18
  export declare const MANAGE_API_CREDENTIALS_TOOL_NAME = "manageApiCredentials";
19
+ export declare const READ_ONLY_ANNOTATIONS: ToolAnnotations;
20
20
  export declare const CUSTOM_MCP_TOOLS_META_DIR = "custom-mcp-tools-meta";
21
21
  //# sourceMappingURL=constants.d.ts.map
@@ -1 +1 @@
1
- import{LATEST_PROTOCOL_VERSION as o}from"@modelcontextprotocol/server";const t={Docs:"docs"},E={InternalError:-32603,ServerError:-32e3,InvalidRequest:-32600,MethodNotFound:-32601,InvalidParams:-32602},_=o,r=3e4,s=15e3,O=3,n="Docs MCP server",S=["openid","profile","email","offline_access"],c="createAnonymousSession",T="submit-feedback",M="manageApiCredentials",A="custom-mcp-tools-meta";export{c as CREATE_ANONYMOUS_SESSION_TOOL_NAME,A as CUSTOM_MCP_TOOLS_META_DIR,r as DEFAULT_CONNECTION_TIMEOUT_MS,n as DEFAULT_DOCS_MCP_SERVER_NAME,M as MANAGE_API_CREDENTIALS_TOOL_NAME,O as MAX_DOCUMENTS_PER_CATEGORY,_ as MCP_PROTOCOL_VERSION,E as McpErrorCodes,t as McpServerType,s as SSE_KEEPALIVE_INTERVAL_MS,T as SUBMIT_FEEDBACK_TOOL_NAME,S as SUPPORTED_MCP_SCOPES};
1
+ import{LATEST_PROTOCOL_VERSION as o}from"@modelcontextprotocol/server";const t={Docs:"docs"},r={InternalError:-32603,ServerError:-32e3,InvalidRequest:-32600,MethodNotFound:-32601,InvalidParams:-32602},_=o,s=15e3,E="Docs MCP server",n=["openid","profile","email","offline_access"],O="createAnonymousSession",c="submit-feedback",S="manageApiCredentials",A={readOnlyHint:!0,destructiveHint:!1,openWorldHint:!1},p="custom-mcp-tools-meta";export{O as CREATE_ANONYMOUS_SESSION_TOOL_NAME,p as CUSTOM_MCP_TOOLS_META_DIR,E as DEFAULT_DOCS_MCP_SERVER_NAME,S as MANAGE_API_CREDENTIALS_TOOL_NAME,_ as MCP_PROTOCOL_VERSION,r as McpErrorCodes,t as McpServerType,A as READ_ONLY_ANNOTATIONS,s as SSE_KEEPALIVE_INTERVAL_MS,c as SUBMIT_FEEDBACK_TOOL_NAME,n as SUPPORTED_MCP_SCOPES};
@@ -1 +1 @@
1
- import{SEMANTIC_SEARCH_API_URL as y}from"../../../constants/common.js";import{shouldHandleMcpAuth as f}from"../../../utils/rbac/should-handle-mcp-auth.js";import{CREATE_ANONYMOUS_SESSION_TOOL_NAME as g,SUBMIT_FEEDBACK_TOOL_NAME as b}from"../constants.js";import{GRAPHQL_TYPE_KINDS as l,GRAPHQL_LIST_SCOPES as v}from"./tools/graphql/constants.js";import{OPERATION_METHODS as c}from"./tools/openapi/constants.js";const i={type:"string",nullable:!0},s={limit:{type:"number"},total:{type:"number"},page:{type:"number"},totalPages:{type:"number"}},a={codemodeType:"OpenApiServer[]"},o={codemodeType:"OpenApiSecurityRequirement[]"},u={codemodeType:"Record<string, OpenApiSecurityScheme>"},P={codemodeType:"OpenApiDocument"},A={codemodeType:"OpenApiOperation & { path: string; method: string }"},S={codemodeType:"OpenApiComponents",description:"Components the endpoint references. A `$ref` in `endpoint` resolves against the root of the result."},n={filePath:{type:"string",description:"API definition file path"},otherMatches:{type:"array",description:"Other API definitions the lookup also matched. Present only when several matched; pass `filePath` to pick another one",items:{type:"object",required:["filePath"],properties:{version:{type:"string"},filePath:{type:"string"}}}}},r="When several definitions match the name, the highest version or the shortest file path is used and the rest are listed in `otherMatches`; tell the user which version or file the answer is based on.",H="A `$ref` in `endpoint` points into the `components` key at the root of the result: read `#/components/<section>/<name>` there.",L={type:"object",additionalProperties:!1,required:[],properties:{filter:{type:"string",description:"Matches part of an API name, or of a description when no name matches",minLength:1,nullable:!0},page:{type:"number",description:"Page number",minimum:1,default:1,nullable:!0},limit:{type:"number",description:"Number of APIs per page. Default is 300",minimum:1,default:300,nullable:!0}}},p={type:"object",required:[],additionalProperties:!1,properties:{name:{type:"string",description:"API name, or a unique part of it. Omit when `filePath` is given.",minLength:1,nullable:!0},apiName:{type:"string",description:"Alias of `name`",nullable:!0},api:{type:"string",description:"Alias of `name`",nullable:!0},version:{type:"string",description:"API version. When omitted and several versions exist, the highest one is used",nullable:!0},filePath:{type:"string",description:"API definition file path, as returned by `listApis`",nullable:!0}}},q={type:"object",required:["path","method"],additionalProperties:!1,properties:{name:{type:"string",description:"API name, or a unique part of it. Omit when `filePath` is given.",minLength:1,nullable:!0},apiName:{type:"string",description:"Alias of `name`",nullable:!0},api:{type:"string",description:"Alias of `name`",nullable:!0},path:{type:"string",description:"Endpoint path (e.g. /api/v1/users)",minLength:1},method:{type:"string",description:"HTTP method (GET, POST, PUT, DELETE, etc.)",enum:[...c.map(e=>e.toUpperCase()),...c],minLength:1},version:{type:"string",description:"API version. When omitted and several versions exist, the highest one is used",nullable:!0},filePath:{type:"string",description:"API definition file path, as returned by `listApis`",nullable:!0}}},O={type:"object",required:[],additionalProperties:!1,properties:{}},T={type:"object",required:[],additionalProperties:!1,properties:{}},G={type:"object",required:["path","summary"],additionalProperties:!1,properties:{path:{type:"string",description:"Path or URL of the documentation page the feedback is about (e.g. /guides/auth)",minLength:1,maxLength:1e3},summary:{type:"string",description:"One sentence that names what is wrong with the page",minLength:1,maxLength:500},details:{type:"string",description:"Expected versus actual behavior, missing steps, or the snippet that failed",maxLength:4e3,nullable:!0},targetFeature:{type:"string",description:"The API or feature the page documents",maxLength:500,nullable:!0}}};function I(e){const t=[{name:"list-apis",title:"List APIs",description:"Lists the APIs documented in this project",schema:L,annotations:{readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},outputSchema:{type:"object",required:["items","limit","total","page","totalPages"],properties:{items:{type:"array",items:{type:"object",required:["name","description","version","servers","filePath"],properties:{name:{type:"string"},description:{type:"string"},version:{type:"string"},servers:a,filePath:{type:"string",description:"API definition file path"},ambiguousTitle:{type:"boolean",description:"true = another API shares this title; a lookup picks the highest version, or the shortest file path at the same version, and lists the rest in `otherMatches`. Pass `filePath` to pick another one"},...e.hasCallableApis?{callable:{type:"boolean",description:"true = the documented hosts of this API are reachable via `fetch`; false = documentation only"}}:{}}}},...s}}},{name:"get-endpoints",title:"Get endpoints",description:`Get all endpoints for a specific API. ${r}`,schema:p,annotations:{readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},outputSchema:{type:"object",required:["api","version","filePath","servers","endpoints"],properties:{api:{type:"string"},version:{type:"string"},...n,servers:a,endpoints:{type:"array",items:{type:"object",required:["path","method"],properties:{path:{type:"string"},method:{type:"string"},summary:i,description:i,security:o}}}}}},{name:"get-endpoint-info",title:"Get endpoint info",description:`Get comprehensive information about specific endpoint including parameters, security, and examples. ${H} ${r}`,schema:q,annotations:{readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},outputSchema:{type:"object",required:["api","version","filePath","servers","endpoint","globalSecurity","securitySchemes"],properties:{api:{type:"string"},version:{type:"string"},...n,servers:a,endpoint:A,globalSecurity:o,securitySchemes:u,components:S}}},{name:"get-security-schemes",title:"Get security schemes",description:`Get the security schemes for a specific API. ${r}`,schema:p,annotations:{readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},outputSchema:{type:"object",required:["api","version","filePath","securitySchemes","security"],properties:{api:{type:"string"},version:{type:"string"},...n,securitySchemes:u,security:o}}},{name:"get-full-api-description",title:"Get full API description",description:`Get the complete OpenAPI description. ${r}`,schema:p,annotations:{readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},outputSchema:{type:"object",required:["api","version","filePath","definition"],properties:{api:{type:"string"},version:{type:"string"},...n,definition:P}}},...y?[d(e.products,e.locales)]:[]];return f(e.requiresLogin,e.rbac)&&t.push({name:"whoami",title:"Who am I",description:"Get information about the currently authenticated user",schema:O,annotations:{readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},outputSchema:{type:"object",required:["authenticated"],properties:{authenticated:{type:"boolean"},email:{type:"string"},name:{type:"string"},subject:{type:"string"},clientId:{type:"string"},scope:{type:"string"},issuedAt:{type:"string"},expiresAt:{type:"string"}}}}),e.feedbackHidden||t.push({name:b,title:"Submit feedback",description:"Report a documentation page that is wrong or incomplete",schema:G,annotations:{readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1,openWorldHint:!1},outputSchema:{type:"object",required:["status","page","message"],properties:{status:{type:"string"},page:{type:"string"},message:{type:"string"}}}}),e.hasGraphqlApis&&t.push(...k()),e.elicitationEnabled&&e.hasCallableApis&&t.push({name:g,title:"Create anonymous session",description:"Create an anonymous session handle for storing upstream API credentials. Pass the returned sessionHandle to execute when an API needs credentials and the caller is not signed in. Treat it as a secret and reuse it across calls.",schema:T,annotations:{readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1,openWorldHint:!1},outputSchema:{type:"object",required:["sessionHandle"],properties:{sessionHandle:{type:"string"}}}}),t}const w={type:"object",required:[],additionalProperties:!1,properties:{filter:{type:"string",description:"GraphQL schema name (or part of it)",minLength:1,nullable:!0},page:{type:"number",description:"Page number",minimum:1,default:1,nullable:!0},limit:{type:"number",description:"Number of results per page. Default is 300",minimum:1,default:300,nullable:!0}}},j={type:"object",required:["name"],additionalProperties:!1,properties:{name:{type:"string",description:"GraphQL schema name",minLength:1},kind:{type:"string",description:'Optional: return only a single category of schema members. With scope "fields", restricts to the fields of that parent category ("objects", "interfaces", or "inputs" only).',enum:[...l,null],nullable:!0},scope:{type:"string",description:'Optional: what each list item is. "members" (default) lists top-level types and operations. "fields" flattens every field of every object/interface/input type into "ParentType.fieldName" entries with their descriptions \u2014 combine with `filter` to search nested fields anywhere in the schema.',enum:[...v,null],nullable:!0},filter:{type:"string",description:'Optional: only members whose name or description contains this substring, case-insensitive (e.g. "custom tags")',minLength:1,nullable:!0},referencesType:{type:"string",description:'Optional: only members that reference this type directly or transitively (via return, field, argument, union-member or input-field types). Finds cross-cutting members that never name it \u2014 e.g. referencesType "Book" surfaces a search query returning a union that includes Book.',minLength:1,nullable:!0},page:{type:"number",description:"Page number",minimum:1,default:1,nullable:!0},limit:{type:"number",description:"Number of results per page. Default is 300",minimum:1,default:300,nullable:!0}}},E={type:"object",required:["name"],additionalProperties:!1,properties:{name:{type:"string",description:"GraphQL schema name",minLength:1},type:{type:"string",description:"Name of the type, operation, or directive",minLength:1,nullable:!0},typeName:{type:"string",description:"Alias of `type`",nullable:!0},includeReferencedTypes:{type:"boolean",description:"Also include the SDL of every type referenced transitively. Gives the whole subgraph at once, but can be large for highly-connected types.",default:!1,nullable:!0}}},N={type:"object",required:["name"],additionalProperties:!1,properties:{name:{type:"string",description:"GraphQL schema name",minLength:1}}};function k(){return[{name:"list-graphql-apis",title:"List GraphQL APIs",description:"Lists available GraphQL schemas with their context and purpose",schema:w,annotations:{readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},outputSchema:{type:"object",required:["items","limit","total","page","totalPages"],properties:{items:{type:"array",items:{type:"object",required:["name"],properties:{name:{type:"string"},description:i}}},...s}}},{name:"get-graphql-type-list",title:"Get GraphQL type list",description:'List all operations and types in a GraphQL schema as a flat, paginated list. Each item is tagged with its kind (query, object, enum, \u2026) and carries a one-line description; operations also include their return type and argument signature \u2014 use it to decide which members to fetch in detail. Narrow the result with `kind` (one category), `filter` (case-insensitive substring of the member name or description, e.g. "book"), or `referencesType` (only members that use a given type, directly or transitively) to explore a domain cheaply instead of pulling the full schema. To search nested fields \u2014 not just type names \u2014 set scope "fields": it flattens every field of every object/interface/input type into "ParentType.fieldName" entries with their descriptions, so `filter` finds things like an input field whose docstring mentions your keyword.',schema:j,annotations:{readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},outputSchema:{type:"object",required:["name","items","limit","total","page","totalPages"],properties:{name:{type:"string"},items:{type:"array",items:{type:"object",required:["kind","name"],properties:{kind:{type:"string",enum:l},name:{type:"string"},description:i,type:{type:"string"},args:{type:"string"},directives:{type:"string"}}}},...s}}},{name:"get-graphql-type",title:"Get GraphQL type",description:'Get the SDL for a single GraphQL type, operation (query/mutation/subscription field), or directive. Without includeReferencedTypes, the SDL is followed by a one-level manifest of every directly referenced type\'s field names (e.g. "input ActionOperationInput { addTags, removeTags }"), so you can see what nested types contain before fetching them. Set includeReferencedTypes to instead pull in the full SDL of every type it references transitively \u2014 the whole structural subgraph in one call, ideal for complete exploration of an entity (e.g. Book and all the types it touches). That traversal only follows what the target depends on; to go the other direction and find the members that use a type, call get-graphql-type-list with `referencesType`.',schema:E,annotations:{readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},outputSchema:{type:"string"}},{name:"get-graphql-schema",title:"Get GraphQL schema",description:"Get the complete GraphQL schema as SDL \u2014 the whole type graph in one call. Returns everything, so it can be very large and token-expensive for big schemas; prefer get-graphql-type-list (filter/paginate) plus targeted get-graphql-type calls, and reach for this only for small schemas or when you truly need the full SDL.",schema:N,annotations:{readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},outputSchema:{type:"string"}}]}function d(e,t){const h=e&&e.length>0,m=t&&t.length>0;return{name:"search",title:"Search documentation",description:"Search across the documentation to fetch relevant content for a given query",schema:{type:"object",required:["query"],additionalProperties:!1,properties:{query:{type:"string",description:"Search query. Should be a single word or that phrase that is presented in a documentation.",minLength:1},...h?{product:{type:"string",description:"Optional product name to filter search results by specific product.",enum:[...e,null],nullable:!0}}:{},...m?{locale:{type:"string",description:"Optional locale code to filter search results by documentation language (e.g. 'en', 'ja'). Use the locale matching the language of the user's request. Defaults to the project's default locale.",enum:[...t,null],nullable:!0}}:{}}},annotations:{readOnlyHint:!0,destructiveHint:!1,idempotentHint:!1,openWorldHint:!1},outputSchema:{type:"string"}}}const Q=new Set([...I({requiresLogin:!0,hasGraphqlApis:!0,elicitationEnabled:!0,hasCallableApis:!0}).map(e=>e.name),d().name]);export{Q as ALL_DEFAULT_TOOL_NAMES,I as getDefaultToolSchemas};
1
+ import{SEMANTIC_SEARCH_API_URL as g}from"../../../constants/common.js";import{shouldHandleMcpAuth as f}from"../../../utils/rbac/should-handle-mcp-auth.js";import{CREATE_ANONYMOUS_SESSION_TOOL_NAME as b,READ_ONLY_ANNOTATIONS as t,SUBMIT_FEEDBACK_TOOL_NAME as A}from"../constants.js";import{GRAPHQL_TYPE_KINDS as c,GRAPHQL_LIST_SCOPES as P}from"./tools/graphql/constants.js";import{OPERATION_METHODS as h}from"./tools/openapi/constants.js";const n={type:"string",nullable:!0},a={limit:{type:"number"},total:{type:"number"},page:{type:"number"},totalPages:{type:"number"}},o={codemodeType:"OpenApiServer[]"},p={codemodeType:"OpenApiSecurityRequirement[]"},u={codemodeType:"Record<string, OpenApiSecurityScheme>"},v={codemodeType:"OpenApiDocument"},S={codemodeType:"OpenApiOperation & { path: string; method: string }"},L={codemodeType:"OpenApiComponents",description:"Components the endpoint references. A `$ref` in `endpoint` resolves against the root of the result."},r={filePath:{type:"string",description:"API definition file path"},otherMatches:{type:"array",description:"Other API definitions the lookup also matched. Present only when several matched; pass `filePath` to pick another one",items:{type:"object",required:["filePath"],properties:{version:{type:"string"},filePath:{type:"string"}}}}},s="When several definitions match the name, the highest version or the shortest file path is used and the rest are listed in `otherMatches`; tell the user which version or file the answer is based on.",q="A `$ref` in `endpoint` points into the `components` key at the root of the result: read `#/components/<section>/<name>` there.",T={type:"object",additionalProperties:!1,required:[],properties:{filter:{type:"string",description:"Matches part of an API name, or of a description when no name matches",minLength:1,nullable:!0},page:{type:"number",description:"Page number",minimum:1,default:1,nullable:!0},limit:{type:"number",description:"Number of APIs per page. Default is 300",minimum:1,default:300,nullable:!0}}},l={type:"object",required:[],additionalProperties:!1,properties:{name:{type:"string",description:"API name, or a unique part of it. Omit when `filePath` is given.",minLength:1,nullable:!0},apiName:{type:"string",description:"Alias of `name`",nullable:!0},api:{type:"string",description:"Alias of `name`",nullable:!0},version:{type:"string",description:"API version. When omitted and several versions exist, the highest one is used",nullable:!0},filePath:{type:"string",description:"API definition file path from the API list",nullable:!0}}},I={type:"object",required:["path","method"],additionalProperties:!1,properties:{name:{type:"string",description:"API name, or a unique part of it. Omit when `filePath` is given.",minLength:1,nullable:!0},apiName:{type:"string",description:"Alias of `name`",nullable:!0},api:{type:"string",description:"Alias of `name`",nullable:!0},path:{type:"string",description:"Endpoint path (e.g. /api/v1/users)",minLength:1},method:{type:"string",description:"HTTP method (GET, POST, PUT, DELETE, etc.)",enum:[...h.map(e=>e.toUpperCase()),...h],minLength:1},version:{type:"string",description:"API version. When omitted and several versions exist, the highest one is used",nullable:!0},filePath:{type:"string",description:"API definition file path from the API list",nullable:!0}}},O={type:"object",required:[],additionalProperties:!1,properties:{}},G={type:"object",required:[],additionalProperties:!1,properties:{}},w={type:"object",required:["path","summary"],additionalProperties:!1,properties:{path:{type:"string",description:"Path or URL of the documentation page the feedback is about (e.g. /guides/auth)",minLength:1,maxLength:1e3},summary:{type:"string",description:"One sentence that names what is wrong with the page",minLength:1,maxLength:500},details:{type:"string",description:"Expected versus actual behavior, missing steps, or the snippet that failed",maxLength:4e3,nullable:!0},targetFeature:{type:"string",description:"The API or feature the page documents",maxLength:500,nullable:!0}}};function j(e){const i=[{name:"list-apis",title:"List APIs",description:"Lists the APIs documented in this project",schema:T,annotations:t,outputSchema:{type:"object",required:["items","limit","total","page","totalPages"],properties:{items:{type:"array",items:{type:"object",required:["name","description","version","servers","filePath"],properties:{name:{type:"string"},description:{type:"string"},version:{type:"string"},servers:o,filePath:{type:"string",description:"API definition file path"},ambiguousTitle:{type:"boolean",description:"true = another API shares this title; a lookup picks the highest version, or the shortest file path at the same version, and lists the rest in `otherMatches`. Pass `filePath` to pick another one"},...e.hasCallableApis?{callable:{type:"boolean",description:"true = the documented hosts of this API are reachable via `fetch`; false = documentation only"}}:{}}}},...a}}},{name:"get-endpoints",title:"Get endpoints",description:`Get all endpoints for a specific API. ${s}`,schema:l,annotations:t,outputSchema:{type:"object",required:["api","version","filePath","servers","endpoints"],properties:{api:{type:"string"},version:{type:"string"},...r,servers:o,endpoints:{type:"array",items:{type:"object",required:["path","method"],properties:{path:{type:"string"},method:{type:"string"},summary:n,description:n,security:p}}}}}},{name:"get-endpoint-info",title:"Get endpoint info",description:`Get comprehensive information about specific endpoint including parameters, security, and examples. ${q} ${s}`,schema:I,annotations:t,outputSchema:{type:"object",required:["api","version","filePath","servers","endpoint","globalSecurity","securitySchemes"],properties:{api:{type:"string"},version:{type:"string"},...r,servers:o,endpoint:S,globalSecurity:p,securitySchemes:u,components:L}}},{name:"get-security-schemes",title:"Get security schemes",description:`Get the security schemes for a specific API. ${s}`,schema:l,annotations:t,outputSchema:{type:"object",required:["api","version","filePath","securitySchemes","security"],properties:{api:{type:"string"},version:{type:"string"},...r,securitySchemes:u,security:p}}},{name:"get-full-api-description",title:"Get full API description",description:`Get the complete OpenAPI description. ${s}`,schema:l,annotations:t,outputSchema:{type:"object",required:["api","version","filePath","definition"],properties:{api:{type:"string"},version:{type:"string"},...r,definition:v}}},...g?[m(e.products,e.locales)]:[]];return f(e.requiresLogin,e.rbac)&&i.push({name:"whoami",title:"Who am I",description:"Get information about the currently authenticated user",schema:O,annotations:t,outputSchema:{type:"object",required:["authenticated"],properties:{authenticated:{type:"boolean"},email:{type:"string"},name:{type:"string"},subject:{type:"string"},clientId:{type:"string"},scope:{type:"string"},issuedAt:{type:"string"},expiresAt:{type:"string"}}}}),e.feedbackHidden||i.push({name:A,title:"Submit feedback",description:"Report a documentation page that is wrong or incomplete",schema:w,annotations:{readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1,openWorldHint:!0},outputSchema:{type:"object",required:["status","page","message"],properties:{status:{type:"string"},page:{type:"string"},message:{type:"string"}}}}),e.hasGraphqlApis&&i.push(...D()),e.elicitationEnabled&&e.hasCallableApis&&i.push({name:b,title:"Create anonymous session",description:"Create an anonymous session handle for storing upstream API credentials. Pass the returned sessionHandle to execute when an API needs credentials and the caller is not signed in. Treat it as a secret and reuse it across calls.",schema:G,annotations:t,outputSchema:{type:"object",required:["sessionHandle"],properties:{sessionHandle:{type:"string"}}}}),i}const E={type:"object",required:[],additionalProperties:!1,properties:{filter:{type:"string",description:"GraphQL schema name (or part of it)",minLength:1,nullable:!0},page:{type:"number",description:"Page number",minimum:1,default:1,nullable:!0},limit:{type:"number",description:"Number of results per page. Default is 300",minimum:1,default:300,nullable:!0}}},N={type:"object",required:["name"],additionalProperties:!1,properties:{name:{type:"string",description:"GraphQL schema name",minLength:1},kind:{type:"string",description:'Optional: return only a single category of schema members. With scope "fields", restricts to the fields of that parent category ("objects", "interfaces", or "inputs" only).',enum:[...c,null],nullable:!0},scope:{type:"string",description:'Optional: what each list item is. "members" (default) lists top-level types and operations. "fields" flattens every field of every object/interface/input type into "ParentType.fieldName" entries with their descriptions \u2014 combine with `filter` to search nested fields anywhere in the schema.',enum:[...P,null],nullable:!0},filter:{type:"string",description:'Optional: only members whose name or description contains this substring, case-insensitive (e.g. "custom tags")',minLength:1,nullable:!0},referencesType:{type:"string",description:'Optional: only members that reference this type directly or transitively (via return, field, argument, union-member or input-field types). Finds cross-cutting members that never name it \u2014 e.g. referencesType "Book" surfaces a search query returning a union that includes Book.',minLength:1,nullable:!0},page:{type:"number",description:"Page number",minimum:1,default:1,nullable:!0},limit:{type:"number",description:"Number of results per page. Default is 300",minimum:1,default:300,nullable:!0}}},_={type:"object",required:["name"],additionalProperties:!1,properties:{name:{type:"string",description:"GraphQL schema name",minLength:1},type:{type:"string",description:"Name of the type, operation, or directive",minLength:1,nullable:!0},typeName:{type:"string",description:"Alias of `type`",nullable:!0},includeReferencedTypes:{type:"boolean",description:"Also include the SDL of every type referenced transitively. Gives the whole subgraph at once, but can be large for highly-connected types.",default:!1,nullable:!0}}},k={type:"object",required:["name"],additionalProperties:!1,properties:{name:{type:"string",description:"GraphQL schema name",minLength:1}}};function D(){return[{name:"list-graphql-apis",title:"List GraphQL APIs",description:"Lists available GraphQL schemas with their context and purpose",schema:E,annotations:t,outputSchema:{type:"object",required:["items","limit","total","page","totalPages"],properties:{items:{type:"array",items:{type:"object",required:["name"],properties:{name:{type:"string"},description:n}}},...a}}},{name:"get-graphql-type-list",title:"Get GraphQL type list",description:'List all operations and types in a GraphQL schema as a flat, paginated list. Each item is tagged with its kind (query, object, enum, \u2026) and carries a one-line description; operations also include their return type and argument signature \u2014 use it to decide which members to fetch in detail. Narrow the result with `kind` (one category), `filter` (case-insensitive substring of the member name or description, e.g. "book"), or `referencesType` (only members that use a given type, directly or transitively) to explore a domain cheaply instead of pulling the full schema. To search nested fields \u2014 not just type names \u2014 set scope "fields": it flattens every field of every object/interface/input type into "ParentType.fieldName" entries with their descriptions, so `filter` finds things like an input field whose docstring mentions your keyword.',schema:N,annotations:t,outputSchema:{type:"object",required:["name","items","limit","total","page","totalPages"],properties:{name:{type:"string"},items:{type:"array",items:{type:"object",required:["kind","name"],properties:{kind:{type:"string",enum:c},name:{type:"string"},description:n,type:{type:"string"},args:{type:"string"},directives:{type:"string"}}}},...a}}},{name:"get-graphql-type",title:"Get GraphQL type",description:'Get the SDL for a single GraphQL type, operation (query/mutation/subscription field), or directive. Without includeReferencedTypes, the SDL is followed by a one-level manifest of every directly referenced type\'s field names (e.g. "input ActionOperationInput { addTags, removeTags }"), so you can see what nested types contain before fetching them. Set includeReferencedTypes to instead pull in the full SDL of every type it references transitively \u2014 the whole structural subgraph in one call, ideal for complete exploration of an entity (e.g. Book and all the types it touches). That traversal only follows what the target depends on; to go the other direction and find the members that use a type, call get-graphql-type-list with `referencesType`.',schema:_,annotations:t,outputSchema:{type:"string"}},{name:"get-graphql-schema",title:"Get GraphQL schema",description:"Get the complete GraphQL schema as SDL \u2014 the whole type graph in one call. Returns everything, so it can be very large and token-expensive for big schemas; prefer get-graphql-type-list (filter/paginate) plus targeted get-graphql-type calls, and reach for this only for small schemas or when you truly need the full SDL.",schema:k,annotations:t,outputSchema:{type:"string"}}]}function m(e,i){const d=e&&e.length>0,y=i&&i.length>0;return{name:"search",title:"Search documentation",description:"Search across the documentation to fetch relevant content for a given query",schema:{type:"object",required:["query"],additionalProperties:!1,properties:{query:{type:"string",description:"Search query. Should be a single word or that phrase that is presented in a documentation.",minLength:1},...d?{product:{type:"string",description:"Optional product name to filter search results by specific product.",enum:[...e,null],nullable:!0}}:{},...y?{locale:{type:"string",description:"Optional locale code to filter search results by documentation language (e.g. 'en', 'ja'). Use the locale matching the language of the user's request. Defaults to the project's default locale.",enum:[...i,null],nullable:!0}}:{}}},annotations:t,outputSchema:{type:"string"}}}const M=new Set([...j({requiresLogin:!0,hasGraphqlApis:!0,elicitationEnabled:!0,hasCallableApis:!0}).map(e=>e.name),m().name]);export{M as ALL_DEFAULT_TOOL_NAMES,j as getDefaultToolSchemas};
@@ -1 +1 @@
1
- import{CREATE_ANONYMOUS_SESSION_TOOL_NAME as t}from"../../../constants.js";import{isFetchCapable as o}from"../../../gateway-mcp/callable-apis.js";import{createSessionHandle as n}from"../../../gateway-mcp/subject.js";const i=async()=>{const e={sessionHandle:n()};return{content:[{type:"text",text:JSON.stringify(e)}],structuredContent:e}};function s(e){return!!e.elicitationEnabled&&e.mcpMode==="code"&&o(e)&&!e.user?.isAuthenticated}var u={[t]:{execute:i,isAvailable:s}};export{u as default,s as isAnonymousSessionToolAvailable};
1
+ import{CREATE_ANONYMOUS_SESSION_TOOL_NAME as t}from"../../../constants.js";import{isFetchCapable as o}from"../../../gateway-mcp/callable-apis.js";import{createSessionHandle as n}from"../../../gateway-mcp/subject.js";const i=async()=>{const e={sessionHandle:n()};return{content:[{type:"text",text:JSON.stringify(e)}],structuredContent:e}};function s(e){return!!e.elicitationEnabled&&o(e)&&!e.user?.isAuthenticated}var u={[t]:{execute:i,isAvailable:s}};export{u as default,s as isAnonymousSessionToolAvailable};
@@ -1,3 +1,3 @@
1
- import{getPathPrefix as p,withPathPrefix as h,withoutPathPrefix as l}from"@redocly/theme/core/utils";import{ServerRoutes as g}from"../../../../../../constants/api.js";import{normalizeRouteSlug as b}from"../../../../../../utils/path/normalize-route-slug.js";import{SUBMIT_FEEDBACK_TOOL_NAME as y}from"../../../constants.js";const k="mcp",P="mcp-client";function r(t,e=!1){return{content:[{type:"text",text:JSON.stringify(t)}],isError:e}}function i(t){const e=t?.trim();return e||void 0}function U(t){const e=p();return!!e&&(t===e||t.startsWith(`${e}/`))?l(t):t}function F(t,e){try{const{pathname:n}=new URL(t,e),a=new URL(e);return a.pathname=U(b(n)),a.toString()}catch{return}}function T(t){const e=t.client??P;return t.clientVersion?`${e}/${t.clientVersion}`:e}async function A(t){const n=(await t.json().catch(()=>{}))?.errors;return Array.isArray(n)?n.filter(a=>typeof a=="string"):[]}const E=async(t,e)=>{const n=i(t.path),a=i(t.summary);if(!n||!a)return r({error:"Invalid arguments",message:"`path` and `summary` are required."},!0);const c=e.baseUrl;if(!c)return r({error:"Unavailable",message:"The feedback endpoint of this site is not configured."},!0);const s=F(n,c);if(!s)return r({error:"Invalid arguments",message:"`path` must be a page path or URL of this site."},!0);const u=i(t.details),d=T(e),f=e.accessToken?.replace(/^Bearer /,""),m=`${e.internalBaseUrl||c}${h(g.FEEDBACK)}`;let o;try{o=await fetch(m,{method:"POST",headers:{"Content-Type":"application/json","User-Agent":d,...f?{Cookie:`authorization=${f}`}:{},...e.clientIp?{"X-Real-IP":e.clientIp}:{}},body:JSON.stringify({component:"comment",path:s,comment:u?`${a}
1
+ import{getPathPrefix as p,withPathPrefix as h,withoutPathPrefix as l}from"@redocly/theme/core/utils";import{ServerRoutes as g}from"../../../../../../constants/api.js";import{normalizeRouteSlug as b}from"../../../../../../utils/path/normalize-route-slug.js";import{SUBMIT_FEEDBACK_TOOL_NAME as y}from"../../../constants.js";const k="mcp",P="mcp-client";function a(e){return{content:[{type:"text",text:JSON.stringify(e)}],isError:!0}}function i(e){const t=e?.trim();return t||void 0}function U(e){const t=p();return!!t&&(e===t||e.startsWith(`${t}/`))?l(e):e}function E(e,t){try{const{pathname:r}=new URL(e,t),n=new URL(t);return n.pathname=U(b(r)),n.toString()}catch{return}}function F(e){const t=e.client??P;return e.clientVersion?`${t}/${e.clientVersion}`:t}async function T(e){const r=(await e.json().catch(()=>{}))?.errors;return Array.isArray(r)?r.filter(n=>typeof n=="string"):[]}const A=async(e,t)=>{const r=i(e.path),n=i(e.summary);if(!r||!n)return a({error:"Invalid arguments",message:"`path` and `summary` are required."});const c=t.baseUrl;if(!c)return a({error:"Unavailable",message:"The feedback endpoint of this site is not configured."});const s=E(r,c);if(!s)return a({error:"Invalid arguments",message:"`path` must be a page path or URL of this site."});const u=i(e.details),d=F(t),f=t.accessToken?.replace(/^Bearer /,""),m=`${t.internalBaseUrl||c}${h(g.FEEDBACK)}`;let o;try{o=await fetch(m,{method:"POST",headers:{"Content-Type":"application/json","User-Agent":d,...f?{Cookie:`authorization=${f}`}:{},...t.clientIp?{"X-Real-IP":t.clientIp}:{}},body:JSON.stringify({component:"comment",path:s,comment:u?`${n}
2
2
 
3
- ${u}`:a,agent:d,targetFeature:i(t.targetFeature),origin:k})})}catch{return r({error:"Failed to submit feedback",message:"The feedback endpoint could not be reached."},!0)}return o.status===403?r({error:"Forbidden",message:"You have no access to this page, so feedback for it is not accepted."},!0):o.status===404?r({error:"Not found",message:`No page exists at ${s}.`},!0):o.status===400?r({error:"Invalid feedback",errors:await A(o)},!0):o.ok?r({status:"received",page:s,message:"Thanks for your feedback. The documentation team sees it on the Feedback page."}):r({error:"Failed to submit feedback",message:`The feedback endpoint answered ${o.status}.`},!0)};var N={[y]:E};export{N as default};
3
+ ${u}`:n,agent:d,targetFeature:i(e.targetFeature),origin:k})})}catch{return a({error:"Failed to submit feedback",message:"The feedback endpoint could not be reached."})}return o.status===403?a({error:"Forbidden",message:"You have no access to this page, so feedback for it is not accepted."}):o.status===404?a({error:"Not found",message:`No page exists at ${s}.`}):o.status===400?a({error:"Invalid feedback",errors:await T(o)}):o.ok?{status:"received",page:s,message:"Thanks for your feedback. The documentation team sees it on the Feedback page."}:a({error:"Failed to submit feedback",message:`The feedback endpoint answered ${o.status}.`})};var N={[y]:A};export{N as default};
@@ -2,8 +2,6 @@ import type { OpenAPIDefinition } from '@redocly/api-docs';
2
2
  import type { McpMode } from '../../../types.js';
3
3
  /** Methods documented and visible at `path`, uppercased. */
4
4
  export declare function visibleMethodsAt(definition: OpenAPIDefinition, path: string): string[];
5
- /** Paths with at least one visible operation. */
6
- export declare function visiblePaths(definition: OpenAPIDefinition): string[];
7
5
  /** The tools that recover a lookup miss. The sandbox calls the same tools by their JS names. */
8
6
  export declare function recoveryToolNames(mcpMode?: McpMode): {
9
7
  endpoints: string;
@@ -1 +1 @@
1
- import{formatCandidates as r}from"../../utils/api-name-matching.js";import{visibleOperations as l}from"./utils.js";function i(t,e){return l(t.paths?.[e]).map(([o])=>o.toUpperCase()).sort()}function h(t){return Object.keys(t.paths??{}).filter(e=>i(t,e).length>0).sort()}function c(t){return t==="code"?{endpoints:"tools.getEndpoints",search:"tools.search",listApis:"tools.listApis"}:{endpoints:"get-endpoints",search:"search",listApis:"list-apis"}}function f(t,e,o,n){const s=h(t);if(s.length===0)return"Endpoint not found";const{endpoints:p,search:a}=c(n);return`No path "${o}" in "${e}". Documented paths: ${r(s)}. Call ${p} for the full list, or ${a} with a keyword from the request.`}function m(t,e,o,n){const s=i(t,o);return s.length===0?"Endpoint not found":`"${o}" in "${e}" documents no ${n.toUpperCase()}. Available methods: ${r(s)}.`}export{m as describeMethodMiss,f as describePathMiss,c as recoveryToolNames,i as visibleMethodsAt,h as visiblePaths};
1
+ import{formatCandidates as r}from"../../utils/api-name-matching.js";import{visibleOperations as l}from"./utils.js";function i(t,e){return l(t.paths?.[e]).map(([o])=>o.toUpperCase()).sort()}function h(t){return Object.keys(t.paths??{}).filter(e=>i(t,e).length>0).sort()}function c(t){return t==="code"?{endpoints:"tools.getEndpoints",search:"tools.search",listApis:"tools.listApis"}:{endpoints:"get-endpoints",search:"search",listApis:"list-apis"}}function f(t,e,o,n){const s=h(t);if(s.length===0)return"Endpoint not found";const{endpoints:p,search:a}=c(n);return`No path "${o}" in "${e}". Documented paths: ${r(s)}. Call ${p} for the full list, or ${a} with a keyword from the request.`}function m(t,e,o,n){const s=i(t,o);return s.length===0?"Endpoint not found":`"${o}" in "${e}" documents no ${n.toUpperCase()}. Available methods: ${r(s)}.`}export{m as describeMethodMiss,f as describePathMiss,c as recoveryToolNames,i as visibleMethodsAt};
@@ -1,11 +1,6 @@
1
1
  import type { RedoclyConfig } from '@redocly/config';
2
- export type ApiCallsConfig = NonNullable<NonNullable<RedoclyConfig['mcp']>['apiCalls']>;
3
- type ApiCallsHttpMethod = NonNullable<ApiCallsConfig['allowedHttpMethods']>[number];
4
- /** The methods agents may send when `mcp.apiCalls.allowedHttpMethods` is not set. */
5
- export declare const DEFAULT_ALLOWED_HTTP_METHODS: readonly ApiCallsHttpMethod[];
6
2
  /** Upper-case HTTP methods agents may send; read-only unless `redocly.yaml` allows more. */
7
3
  export declare function getAllowedHttpMethods(mcp: RedoclyConfig['mcp'] | undefined): string[];
8
4
  /** Whether every allowed method is safe by HTTP semantics (`GET`, `HEAD`, `OPTIONS`). */
9
5
  export declare function allowsOnlySafeHttpMethods(mcp: RedoclyConfig['mcp'] | undefined): boolean;
10
- export {};
11
6
  //# sourceMappingURL=allowed-http-methods.d.ts.map
@@ -1 +1 @@
1
- const o=["GET","HEAD","OPTIONS"],r={GET:!0,HEAD:!0,OPTIONS:!0};function T(t){return(t?.apiCalls?.allowedHttpMethods??o).map(e=>e.toUpperCase())}function p(t){return T(t).every(e=>r[e])}export{o as DEFAULT_ALLOWED_HTTP_METHODS,p as allowsOnlySafeHttpMethods,T as getAllowedHttpMethods};
1
+ const o=["GET","HEAD","OPTIONS"],r={GET:!0,HEAD:!0,OPTIONS:!0};function T(t){return(t?.apiCalls?.allowedHttpMethods??o).map(e=>e.toUpperCase())}function l(t){return T(t).every(e=>r[e])}export{l as allowsOnlySafeHttpMethods,T as getAllowedHttpMethods};
@@ -2,8 +2,9 @@ import type { ApiDescriptionInfo, McpToolContext } from '../types.js';
2
2
  import type { ExcludedOperation } from './api-call-operations.js';
3
3
  /**
4
4
  * The APIs an agent may call in this request: the build-stamped `fetchEligible` entries of the
5
- * already RBAC-filtered map, minus what `mcp.apiCalls` removes. The config is read from the
6
- * request context, so a `redocly.yaml` edit applies without restarting the dev server.
5
+ * already RBAC-filtered map, minus what `mcp.apiCalls` removes; none outside code mode. The
6
+ * config is read from the request context, so a `redocly.yaml` edit applies without restarting
7
+ * the dev server.
7
8
  * No EntitlementsProvider read — this code runs in graphs where the provider is uninitialized.
8
9
  */
9
10
  export declare function getCallableApis(context: McpToolContext): ApiDescriptionInfo[];
@@ -1 +1 @@
1
- import c from"picomatch";function r(e){const i=e.config?.mcp?.apiCalls;if(i?.hide)return[];const t=c(i?.excludeFiles??[]);return Object.values(e.apiDescriptionsMap??{}).filter(l=>l.fetchEligible&&!t(l.relativePath))}function n(e,i){return(e.config?.mcp?.apiCalls?.excludeOperations??[]).filter(({file:t})=>c.isMatch(i,t))}function p(e){return r(e).length>0}export{r as getCallableApis,n as getExcludedOperations,p as isFetchCapable};
1
+ import c from"picomatch";function r(e){const i=e.config?.mcp?.apiCalls;if(e.mcpMode!=="code"||i?.hide)return[];const t=c(i?.excludeFiles??[]);return Object.values(e.apiDescriptionsMap??{}).filter(l=>l.fetchEligible&&!t(l.relativePath))}function p(e,i){return(e.config?.mcp?.apiCalls?.excludeOperations??[]).filter(({file:t})=>c.isMatch(i,t))}function n(e){return r(e).length>0}export{r as getCallableApis,p as getExcludedOperations,n as isFetchCapable};
@@ -1,9 +1,8 @@
1
1
  import type { RedoclyConfig } from '@redocly/config';
2
2
  /**
3
- * `mcp` with `apiCalls` narrowed by the caller's `metadata.apiCalls` (`hide`, `allowedHttpMethods`),
4
- * which the AI Assistant fills from `aiAssistant.mcp.apiCalls`. The caller can only take API calls
5
- * or methods away: a value of another shape changes nothing, and a method list that keeps none of
6
- * the project's methods turns API calls off.
3
+ * `mcp` with API calls turned off when the caller's `metadata.apiCalls.hide` is `true`: the AI
4
+ * Assistant sends it when the host page of its web component runs the API calls itself. The caller
5
+ * can only take API calls away; a value of another shape changes nothing.
7
6
  */
8
7
  export declare function narrowMcpConfigForCaller(mcp: RedoclyConfig['mcp'], metadata: Record<string, unknown> | undefined): RedoclyConfig['mcp'];
9
8
  //# sourceMappingURL=caller-api-calls.d.ts.map
@@ -1 +1 @@
1
- import{DEFAULT_ALLOWED_HTTP_METHODS as d}from"./allowed-http-methods.js";function h(e,a){const o=a?.apiCalls;if(!o||typeof o!="object")return e;const{hide:i,allowedHttpMethods:s}=o,t={...e?.apiCalls};if(i===!0&&(t.hide=!0),Array.isArray(s)){const n=new Set(s.map(r=>String(r).toUpperCase())),l=(e?.apiCalls?.allowedHttpMethods??d).filter(r=>n.has(r));l.length===0?t.hide=!0:t.allowedHttpMethods=l}return{...e,apiCalls:t}}export{h as narrowMcpConfigForCaller};
1
+ function i(e,t){const r=t?.apiCalls;return!r||typeof r!="object"||r.hide!==!0?e:{...e,apiCalls:{...e?.apiCalls,hide:!0}}}export{i as narrowMcpConfigForCaller};
@@ -1,4 +1,4 @@
1
- import type { OpenAPIDefinition, OpenAPIMcp } from '@redocly/api-docs';
1
+ import type { OpenAPIDefinition } from '@redocly/api-docs';
2
2
  import type { RedoclyConfig } from '@redocly/config';
3
3
  /** Whether the gateway fetch capability is on: the feature flag plus none of mcp/docs hidden. */
4
4
  export declare function isGatewayCapabilityEnabled(mcp?: RedoclyConfig['mcp']): boolean;
@@ -8,15 +8,4 @@ export declare function isGatewayCapabilityEnabled(mcp?: RedoclyConfig['mcp']):
8
8
  * `mcp.apiCalls` config by `getCallableApis`.
9
9
  */
10
10
  export declare function isGatewayEligible(info: OpenAPIDefinition['info'] | undefined): boolean;
11
- /**
12
- * Whether an API docs page advertises the `/mcp` endpoint via an injected root-level x-mcp:
13
- * the capability is on, the author has not provided their own x-mcp servers, and the API is
14
- * both gateway-eligible and part of the Docs MCP catalog.
15
- */
16
- export declare function shouldAdvertiseGatewayXMcp(definition: (OpenAPIDefinition & {
17
- 'x-mcp'?: {
18
- servers?: unknown[];
19
- };
20
- }) | undefined, relativePath: string, mcpConfig?: RedoclyConfig['mcp']): boolean;
21
- export declare function buildGatewayXMcp(url: string): OpenAPIMcp;
22
11
  //# sourceMappingURL=eligibility.d.ts.map
@@ -1 +1 @@
1
- import{MCP_PROTOCOL_VERSION as t}from"../constants.js";import{isApiIncludedInDocsMcp as i}from"../utils.js";import{isMcpGatewayEnabled as s}from"../utils/mode.js";import{isDefinitionHidden as a}from"../utils/xmcp-utils.js";function p(e){return s()&&!e?.hide&&!e?.docs?.hide}function n(e){return!a(e,"apiCalls")}function m(e,o,r){return p(r)&&!e?.["x-mcp"]?.servers?.length&&n(e?.info)&&i(o,e,r)}function f(e){return{protocolVersion:t,capabilities:{tools:{}},servers:[{url:e}],tools:[],resources:[],prompts:[]}}export{f as buildGatewayXMcp,p as isGatewayCapabilityEnabled,n as isGatewayEligible,m as shouldAdvertiseGatewayXMcp};
1
+ import{isMcpGatewayEnabled as e}from"../utils/mode.js";import{isDefinitionHidden as t}from"../utils/xmcp-utils.js";function o(i){return e()&&!i?.hide&&!i?.docs?.hide}function r(i){return!t(i,"apiCalls")}export{o as isGatewayCapabilityEnabled,r as isGatewayEligible};