@redocly/realm 0.136.0-next.0 → 0.136.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 (535) hide show
  1. package/CHANGELOG.md +202 -0
  2. package/dist/bin.js +1 -1
  3. package/dist/cli/build/analytics/collect-analytics.js +1 -1
  4. package/dist/cli/build/index.js +1 -1
  5. package/dist/cli/eject/ejectComponent.d.ts +1 -1
  6. package/dist/cli/eject/ejectTheme.d.ts +1 -1
  7. package/dist/cli/eject/resolveEjectParams.js +1 -1
  8. package/dist/cli/eject/themeOperations.d.ts +2 -2
  9. package/dist/cli/stats/collectors/openapi/index.js +1 -1
  10. package/dist/cli/stats/index.js +1 -1
  11. package/dist/client/App.js +1 -1
  12. package/dist/client/ErrorBoundary.js +1 -1
  13. package/dist/client/TestProvider.d.ts +1 -1
  14. package/dist/client/TestProvider.js +1 -1
  15. package/dist/client/api-docs-builder-entry.d.ts +3 -0
  16. package/dist/client/api-docs-builder-entry.js +1 -0
  17. package/dist/client/app/ConditionalLink.d.ts +1 -1
  18. package/dist/client/app/Feedback/useSubmitFeedback.js +1 -1
  19. package/dist/client/app/Sidebar/Sidebar.js +3 -3
  20. package/dist/client/app/Sidebar/helpers/hide-empty-separators.d.ts +13 -0
  21. package/dist/client/app/Sidebar/helpers/hide-empty-separators.js +1 -0
  22. package/dist/client/app/Sidebar/useActions.js +1 -1
  23. package/dist/client/app/Sidebar/utils.js +1 -1
  24. package/dist/client/app/hooks/catalog/useCatalogFilter.d.ts +1 -1
  25. package/dist/client/app/hooks/catalog/useCatalogViewMode.js +1 -1
  26. package/dist/client/app/hooks/catalog/useFetchCatalogEntities.d.ts +1 -1
  27. package/dist/client/app/hooks/catalog/useFetchCatalogEntities.js +1 -1
  28. package/dist/client/app/hooks/catalog/useFetchCatalogEntitiesRelations.d.ts +2 -2
  29. package/dist/client/app/hooks/catalog/useFetchCatalogEntitiesRelations.js +1 -1
  30. package/dist/client/app/hooks/catalog/useFetchCatalogEntityRevisions.d.ts +1 -1
  31. package/dist/client/app/hooks/catalog/useSearchTracker.d.ts +2 -5
  32. package/dist/client/app/hooks/catalog/useSearchTracker.js +1 -1
  33. package/dist/client/app/hooks/codeHighlight/useCodeHighlight.d.ts +1 -6
  34. package/dist/client/app/hooks/codeHighlight/useCodeHighlight.js +1 -1
  35. package/dist/client/app/hooks/index.d.ts +1 -0
  36. package/dist/client/app/hooks/index.js +1 -1
  37. package/dist/client/app/hooks/useAutoScroll.js +1 -1
  38. package/dist/client/app/hooks/useUserClaims.js +1 -1
  39. package/dist/client/app/l10n/hooks/index.d.ts +1 -0
  40. package/dist/client/app/l10n/hooks/index.js +1 -1
  41. package/dist/client/app/l10n/hooks/useTranslate.js +1 -1
  42. package/dist/client/app/l10n/hooks/useTranslationKeys.d.ts +2 -0
  43. package/dist/client/app/l10n/hooks/useTranslationKeys.js +1 -0
  44. package/dist/client/app/l10n/initL10n.js +1 -1
  45. package/dist/client/app/markdoc/custom-components/openapi/json-schema.d.ts +1 -1
  46. package/dist/client/app/markdoc/custom-components/openapi/json-schema.js +1 -1
  47. package/dist/client/app/markdoc/custom-components/openapi/openapi-code-sample.d.ts +1 -5
  48. package/dist/client/app/markdoc/custom-components/openapi/openapi-code-sample.js +1 -1
  49. package/dist/client/app/markdoc/custom-components/openapi/openapi-example.js +1 -1
  50. package/dist/client/app/markdoc/custom-components/openapi/openapi-response-sample.js +1 -1
  51. package/dist/client/app/markdoc/custom-components/openapi/replay-openapi.d.ts +8 -24
  52. package/dist/client/app/markdoc/custom-components/openapi/replay-openapi.js +1 -1
  53. package/dist/client/app/markdoc/hooks/use-store.d.ts +8 -6
  54. package/dist/client/app/markdoc/utils/build-replay-operation-source-map.d.ts +20 -0
  55. package/dist/client/app/markdoc/utils/build-replay-operation-source-map.js +1 -0
  56. package/dist/client/app/markdoc/utils/find-api-item.d.ts +15 -0
  57. package/dist/client/app/markdoc/utils/find-api-item.js +1 -0
  58. package/dist/client/app/markdoc/utils/find-code-sample-panel.d.ts +11 -0
  59. package/dist/client/app/markdoc/utils/find-code-sample-panel.js +1 -0
  60. package/dist/client/app/markdoc/utils/find-openapi-response-samples.d.ts +15 -0
  61. package/dist/client/app/markdoc/utils/find-openapi-response-samples.js +1 -0
  62. package/dist/client/app/markdoc/utils/openapi-panel-entry.d.ts +18 -0
  63. package/dist/client/app/markdoc/utils/openapi-panel-entry.js +1 -0
  64. package/dist/client/app/pages/DevLogin/DevLoginForm.d.ts +1 -1
  65. package/dist/client/app/useGlobalData.d.ts +1 -1
  66. package/dist/client/app/usePreloadHistory.d.ts +2 -2
  67. package/dist/client/app/usePreloadHistory.js +1 -1
  68. package/dist/client/app/utils/loadAndNavigate.d.ts +1 -1
  69. package/dist/client/app/utils/loadAndNavigate.js +1 -1
  70. package/dist/client/app/utils/resolveRouteBySlug.js +1 -1
  71. package/dist/client/app/utils/same-resolved-route.d.ts +5 -0
  72. package/dist/client/app/utils/same-resolved-route.js +1 -0
  73. package/dist/client/browser-entry.js +2 -2
  74. package/dist/client/providers/page-data/hooks.d.ts +2 -2
  75. package/dist/client/providers/post-message/PostMessageProvider.js +1 -1
  76. package/dist/client/providers/post-message/use-post-message.d.ts +1 -1
  77. package/dist/client/providers/theme/ThemeDataProvider.js +1 -1
  78. package/dist/client/runtime/loader.js +1 -1
  79. package/dist/client/templates/api-docs/helpers.d.ts +10 -0
  80. package/dist/client/templates/api-docs/helpers.js +1 -0
  81. package/dist/client/templates/api-docs/template.d.ts +17 -0
  82. package/dist/client/templates/api-docs/template.js +14 -0
  83. package/dist/client/templates/openapi-docs/helpers.d.ts +1 -1
  84. package/dist/client/templates/openapi-docs/helpers.js +2 -2
  85. package/dist/client/types/sidebar.d.ts +0 -1
  86. package/dist/client/utils/utils.d.ts +0 -2
  87. package/dist/client/utils/utils.js +1 -1
  88. package/dist/constants/common.d.ts +14 -1
  89. package/dist/constants/common.js +1 -1
  90. package/dist/constants/l10n/langs/ar.js +1 -1
  91. package/dist/constants/l10n/langs/de.js +1 -1
  92. package/dist/constants/l10n/langs/en.js +1 -1
  93. package/dist/constants/l10n/langs/es.js +1 -1
  94. package/dist/constants/l10n/langs/fr.js +1 -1
  95. package/dist/constants/l10n/langs/hi.js +1 -1
  96. package/dist/constants/l10n/langs/it.js +1 -1
  97. package/dist/constants/l10n/langs/ja.js +1 -1
  98. package/dist/constants/l10n/langs/ko.js +1 -1
  99. package/dist/constants/l10n/langs/pl.js +1 -1
  100. package/dist/constants/l10n/langs/pt-BR.js +1 -1
  101. package/dist/constants/l10n/langs/pt.js +1 -1
  102. package/dist/constants/l10n/langs/ru.js +1 -1
  103. package/dist/constants/l10n/langs/uk.js +1 -1
  104. package/dist/constants/l10n/langs/zh.js +1 -1
  105. package/dist/markdoc/tags/index.d.ts +48 -2
  106. package/dist/server/api-routes/execute-api-route.js +1 -1
  107. package/dist/server/api-routes/helpers/enhance-context.d.ts +3 -1
  108. package/dist/server/api-routes/helpers/enhance-context.js +1 -1
  109. package/dist/server/api-routes/helpers/is-mock-server.d.ts +2 -0
  110. package/dist/server/api-routes/helpers/is-mock-server.js +1 -0
  111. package/dist/server/api-routes/helpers/read-stream-with-size-limit.d.ts +1 -1
  112. package/dist/server/api-routes/mock-server/kv-state-store.d.ts +3 -0
  113. package/dist/server/api-routes/mock-server/kv-state-store.js +1 -0
  114. package/dist/server/api-routes/mock-server/mock-js-executor.d.ts +3 -0
  115. package/dist/server/api-routes/mock-server/mock-js-executor.js +13 -0
  116. package/dist/server/api-routes/run-api-routes-worker.d.ts +1 -1
  117. package/dist/server/api-routes/run-api-routes-worker.js +1 -1
  118. package/dist/server/config/env-config.d.ts +4 -4
  119. package/dist/server/config/env-schema.d.ts +10 -10
  120. package/dist/server/config/env-schemas/catalog.d.ts +3 -0
  121. package/dist/server/config/env-schemas/catalog.js +1 -1
  122. package/dist/server/config/env-schemas/feature-flags.d.ts +4 -8
  123. package/dist/server/config/env-schemas/feature-flags.js +1 -1
  124. package/dist/server/constants/common.d.ts +2 -0
  125. package/dist/server/constants/common.js +1 -1
  126. package/dist/server/constants/entitlements.js +1 -1
  127. package/dist/server/constants/plugins/api-docs.d.ts +3 -0
  128. package/dist/server/constants/plugins/api-docs.js +1 -0
  129. package/dist/server/esbuild/esbuild-logger.js +3 -3
  130. package/dist/server/esbuild/esbuild.js +3 -3
  131. package/dist/server/esbuild/plugins/api-docs-module-replacer/empty-check.d.ts +9 -0
  132. package/dist/server/esbuild/plugins/api-docs-module-replacer/empty-check.js +1 -0
  133. package/dist/server/esbuild/plugins/api-docs-module-replacer/empty-overlay.d.ts +2 -0
  134. package/dist/server/esbuild/plugins/api-docs-module-replacer/empty-overlay.js +1 -0
  135. package/dist/server/esbuild/plugins/api-docs-module-replacer/index.d.ts +6 -0
  136. package/dist/server/esbuild/plugins/api-docs-module-replacer/index.js +1 -0
  137. package/dist/server/persistence/cache/mappers/create-cache-db-record.d.ts +1 -1
  138. package/dist/server/persistence/file-hashes/mappers/create-file-hash-db-record.d.ts +1 -1
  139. package/dist/server/persistence/kv/mappers/create-kv-db-record.d.ts +1 -1
  140. package/dist/server/plugins/api-docs/get-server-props.d.ts +4 -0
  141. package/dist/server/plugins/api-docs/get-server-props.js +1 -0
  142. package/dist/server/plugins/api-docs/get-template-path.d.ts +2 -0
  143. package/dist/server/plugins/api-docs/get-template-path.js +1 -0
  144. package/dist/server/plugins/api-docs/import-api-docs-builder.d.ts +8 -0
  145. package/dist/server/plugins/api-docs/import-api-docs-builder.js +1 -0
  146. package/dist/server/plugins/api-docs/index.d.ts +19 -0
  147. package/dist/server/plugins/api-docs/index.js +1 -0
  148. package/dist/server/plugins/api-docs/loader.d.ts +35 -0
  149. package/dist/server/plugins/api-docs/loader.js +3 -0
  150. package/dist/server/plugins/api-docs/options.d.ts +14 -0
  151. package/dist/server/plugins/api-docs/options.js +1 -0
  152. package/dist/server/plugins/api-docs/search/get-ai-search-documents.d.ts +20 -0
  153. package/dist/server/plugins/api-docs/search/get-ai-search-documents.js +105 -0
  154. package/dist/server/plugins/api-docs/search/search-facets.d.ts +10 -0
  155. package/dist/server/plugins/api-docs/search/search-facets.js +1 -0
  156. package/dist/server/plugins/api-docs/search/search-indexer.d.ts +9 -0
  157. package/dist/server/plugins/api-docs/search/search-indexer.js +1 -0
  158. package/dist/server/plugins/api-docs/search/search-resolver.d.ts +5 -0
  159. package/dist/server/plugins/api-docs/search/search-resolver.js +1 -0
  160. package/dist/server/plugins/api-docs/spec-download.api.d.ts +4 -0
  161. package/dist/server/plugins/api-docs/spec-download.api.js +1 -0
  162. package/dist/server/plugins/api-docs/store-definition-bundles.d.ts +3 -0
  163. package/dist/server/plugins/api-docs/store-definition-bundles.js +1 -0
  164. package/dist/server/plugins/api-docs/utils/build-item-positions.d.ts +17 -0
  165. package/dist/server/plugins/api-docs/utils/build-item-positions.js +1 -0
  166. package/dist/server/plugins/api-docs/utils/build-routes-mapping.d.ts +3 -0
  167. package/dist/server/plugins/api-docs/utils/build-routes-mapping.js +1 -0
  168. package/dist/server/plugins/api-docs/utils/collect-item-routes.d.ts +12 -0
  169. package/dist/server/plugins/api-docs/utils/collect-item-routes.js +1 -0
  170. package/dist/server/plugins/api-docs/utils/decorators.d.ts +26 -0
  171. package/dist/server/plugins/api-docs/utils/decorators.js +1 -0
  172. package/dist/server/plugins/api-docs/utils/format-bundle-error.d.ts +6 -0
  173. package/dist/server/plugins/api-docs/utils/format-bundle-error.js +5 -0
  174. package/dist/server/plugins/api-docs/utils/normalize-api-version.d.ts +2 -0
  175. package/dist/server/plugins/api-docs/utils/normalize-api-version.js +1 -0
  176. package/dist/server/plugins/api-docs/utils/normalize-feedback-options.d.ts +2 -0
  177. package/dist/server/plugins/api-docs/utils/normalize-feedback-options.js +1 -0
  178. package/dist/server/plugins/api-docs/utils/relative-path-to-base-slug.d.ts +20 -0
  179. package/dist/server/plugins/api-docs/utils/relative-path-to-base-slug.js +1 -0
  180. package/dist/server/plugins/api-docs/utils/replace-file-extension.d.ts +2 -0
  181. package/dist/server/plugins/api-docs/utils/replace-file-extension.js +1 -0
  182. package/dist/server/plugins/api-docs/utils/resolve-api-doc-title.d.ts +3 -0
  183. package/dist/server/plugins/api-docs/utils/resolve-api-doc-title.js +1 -0
  184. package/dist/server/plugins/api-docs/utils/resolve-config-rbac.d.ts +10 -0
  185. package/dist/server/plugins/api-docs/utils/resolve-config-rbac.js +1 -0
  186. package/dist/server/plugins/api-docs/utils/to-relative-slug.d.ts +2 -0
  187. package/dist/server/plugins/api-docs/utils/to-relative-slug.js +1 -0
  188. package/dist/server/plugins/api-functions/index.js +1 -1
  189. package/dist/server/plugins/arazzo-docs/index.js +1 -1
  190. package/dist/server/plugins/asyncapi-docs/index.js +1 -1
  191. package/dist/server/plugins/catalog-classic/index.js +1 -1
  192. package/dist/server/plugins/catalog-entities/database/catalog-entities-diff-publisher.d.ts +27 -0
  193. package/dist/server/plugins/catalog-entities/database/catalog-entities-diff-publisher.js +12 -0
  194. package/dist/server/plugins/catalog-entities/database/catalog-entities-publisher.js +1 -12
  195. package/dist/server/plugins/catalog-entities/database/catalog-entities-revisions-pruner.d.ts +22 -0
  196. package/dist/server/plugins/catalog-entities/database/catalog-entities-revisions-pruner.js +62 -0
  197. package/dist/server/plugins/catalog-entities/database/catalog-entities-service.d.ts +5 -5
  198. package/dist/server/plugins/catalog-entities/database/consts.d.ts +5 -0
  199. package/dist/server/plugins/catalog-entities/database/consts.js +1 -1
  200. package/dist/server/plugins/catalog-entities/database/mappers/create-entity-attributes-db-record.d.ts +1 -1
  201. package/dist/server/plugins/catalog-entities/database/mappers/create-entity-db-record.d.ts +1 -1
  202. package/dist/server/plugins/catalog-entities/database/mappers/create-entity-relation-db-record-from-file-schema.d.ts +1 -1
  203. package/dist/server/plugins/catalog-entities/database/remote-publish-lock-service.d.ts +3 -3
  204. package/dist/server/plugins/catalog-entities/database/repositories/bffEntities/bff-entities-read-repository.d.ts +2 -2
  205. package/dist/server/plugins/catalog-entities/database/repositories/catalog-entities-repository.js +1 -1
  206. package/dist/server/plugins/catalog-entities/database/repositories/common/filters-repository.d.ts +1 -1
  207. package/dist/server/plugins/catalog-entities/database/repositories/common/revision-repository.d.ts +1 -1
  208. package/dist/server/plugins/catalog-entities/database/repositories/entities/entities-read-repository.d.ts +1 -1
  209. package/dist/server/plugins/catalog-entities/database/repositories/entities/entities-write-repository.d.ts +2 -2
  210. package/dist/server/plugins/catalog-entities/database/repositories/entities/entities-write-repository.js +1 -1
  211. package/dist/server/plugins/catalog-entities/database/repositories/entityAttributes/entity-attributes-write-repository.d.ts +1 -1
  212. package/dist/server/plugins/catalog-entities/database/repositories/relations/relations-read-repository.d.ts +1 -1
  213. package/dist/server/plugins/catalog-entities/extensions/extractors/api-description/arazzo-entities-extractor.js +1 -1
  214. package/dist/server/plugins/catalog-entities/extensions/extractors/api-description/asyncapi-entities-extractor.d.ts +13 -5
  215. package/dist/server/plugins/catalog-entities/extensions/extractors/api-description/asyncapi-entities-extractor.js +1 -1
  216. package/dist/server/plugins/catalog-entities/extensions/extractors/api-description/base.d.ts +5 -2
  217. package/dist/server/plugins/catalog-entities/extensions/extractors/api-description/base.js +1 -1
  218. package/dist/server/plugins/catalog-entities/extensions/extractors/api-description/graphql-entities-extractor.d.ts +6 -5
  219. package/dist/server/plugins/catalog-entities/extensions/extractors/api-description/graphql-entities-extractor.js +2 -2
  220. package/dist/server/plugins/catalog-entities/extensions/extractors/api-description/openapi-entities-extractor.d.ts +12 -5
  221. package/dist/server/plugins/catalog-entities/extensions/extractors/api-description/openapi-entities-extractor.js +1 -1
  222. package/dist/server/plugins/catalog-entities/extensions/extractors/fs-entities-extractor.d.ts +1 -1
  223. package/dist/server/plugins/catalog-entities/plugin.js +1 -1
  224. package/dist/server/plugins/catalog-entities/template/index.js +1 -1
  225. package/dist/server/plugins/catalog-entities/types/openapi.d.ts +1 -1
  226. package/dist/server/plugins/catalog-entities/utils/get-not-accessible-catalog-resources.d.ts +1 -1
  227. package/dist/server/plugins/catalog-entities/utils/openapi-component-content-extractor.d.ts +4 -4
  228. package/dist/server/plugins/catalog-entities/utils/openapi-component-content-extractor.js +1 -1
  229. package/dist/server/plugins/catalog-entities/utils/openapi-schema-resolver.d.ts +4 -3
  230. package/dist/server/plugins/catalog-entities/utils/openapi-schema-resolver.js +1 -1
  231. package/dist/server/plugins/config-parser/index.js +1 -1
  232. package/dist/server/plugins/config-parser/loaders/utils/read-and-validate-config.js +1 -1
  233. package/dist/server/plugins/create-slugify.d.ts +17 -0
  234. package/dist/server/plugins/create-slugify.js +1 -0
  235. package/dist/server/plugins/default-theme/index.js +1 -1
  236. package/dist/server/plugins/dev-onboarding/index.d.ts +1 -1
  237. package/dist/server/plugins/dev-onboarding/index.js +1 -1
  238. package/dist/server/plugins/dev-onboarding/template/components/RevokeAPIKey.d.ts +1 -1
  239. package/dist/server/plugins/dev-onboarding/template/components/RollAPIKey.d.ts +1 -1
  240. package/dist/server/plugins/entitlements/index.js +1 -1
  241. package/dist/server/plugins/graphql-docs/index.js +1 -1
  242. package/dist/server/plugins/graphql-docs/search/ai/utils.d.ts +1 -1
  243. package/dist/server/plugins/helpers/parse-partials.d.ts +3 -0
  244. package/dist/server/plugins/helpers/parse-partials.js +1 -0
  245. package/dist/server/plugins/l10n/index.js +1 -1
  246. package/dist/server/plugins/lifecycle.js +2 -2
  247. package/dist/server/plugins/markdown/attribute-resolvers/helpers/load-openapi-bundle.d.ts +5 -3
  248. package/dist/server/plugins/markdown/attribute-resolvers/helpers/load-openapi-bundle.js +1 -1
  249. package/dist/server/plugins/markdown/attribute-resolvers/resolve-json-example-ref.js +1 -1
  250. package/dist/server/plugins/markdown/attribute-resolvers/resolve-open-api-ref.js +1 -1
  251. package/dist/server/plugins/markdown/attribute-resolvers/resolve-openapi-code-samples.js +1 -1
  252. package/dist/server/plugins/markdown/attribute-resolvers/resolve-openapi-response-samples.js +1 -1
  253. package/dist/server/plugins/markdown/index.js +1 -1
  254. package/dist/server/plugins/markdown/markdoc/markdoc-options.d.ts +9 -9
  255. package/dist/server/plugins/markdown/markdoc/plugins/utils.d.ts +5 -0
  256. package/dist/server/plugins/markdown/markdoc/plugins/utils.js +1 -1
  257. package/dist/server/plugins/markdown/runtime-transform.js +1 -1
  258. package/dist/server/plugins/markdown/search/create-render-tag-fn.d.ts +2 -1
  259. package/dist/server/plugins/markdown/search/create-render-tag-fn.js +1 -1
  260. package/dist/server/plugins/markdown/search/get-ai-search-documents.js +9 -9
  261. package/dist/server/plugins/markdown/search/walk-sections.js +1 -1
  262. package/dist/server/plugins/markdown/utils/resolve-markdown-template.d.ts +1 -1
  263. package/dist/server/plugins/mcp/auth/auth-handlers.d.ts +3 -0
  264. package/dist/server/plugins/mcp/auth/auth-handlers.js +1 -1
  265. package/dist/server/plugins/mcp/codemode/capabilities/types.d.ts +1 -1
  266. package/dist/server/plugins/mcp/codemode/capabilities/utils.d.ts +1 -1
  267. package/dist/server/plugins/mcp/codemode/code-audit.d.ts +12 -0
  268. package/dist/server/plugins/mcp/codemode/code-audit.js +1 -0
  269. package/dist/server/plugins/mcp/codemode/code-execution-telemetry.d.ts +11 -0
  270. package/dist/server/plugins/mcp/codemode/code-execution-telemetry.js +1 -0
  271. package/dist/server/plugins/mcp/codemode/constants.d.ts +3 -0
  272. package/dist/server/plugins/mcp/codemode/constants.js +1 -1
  273. package/dist/server/plugins/mcp/codemode/prompts.js +1 -1
  274. package/dist/server/plugins/mcp/codemode/sandbox/create-sandbox-setup.d.ts +10 -0
  275. package/dist/server/plugins/mcp/codemode/sandbox/create-sandbox-setup.js +11 -0
  276. package/dist/server/plugins/mcp/codemode/sandbox/polyfills.d.ts +2 -0
  277. package/dist/server/plugins/mcp/codemode/sandbox/{sandbox-polyfills.js → polyfills.js} +7 -8
  278. package/dist/server/plugins/mcp/codemode/tools/describe-tools.d.ts +2 -3
  279. package/dist/server/plugins/mcp/codemode/tools/execute-schema.d.ts +1 -1
  280. package/dist/server/plugins/mcp/codemode/tools/execute-schema.js +1 -1
  281. package/dist/server/plugins/mcp/codemode/tools/execute.d.ts +1 -0
  282. package/dist/server/plugins/mcp/codemode/tools/execute.js +1 -1
  283. package/dist/server/plugins/mcp/codemode/types.d.ts +0 -8
  284. package/dist/server/plugins/mcp/constants.d.ts +2 -1
  285. package/dist/server/plugins/mcp/constants.js +1 -1
  286. package/dist/server/plugins/mcp/docs-mcp/tool-schemas.d.ts +1 -0
  287. package/dist/server/plugins/mcp/docs-mcp/tool-schemas.js +1 -1
  288. package/dist/server/plugins/mcp/docs-mcp/tools/core/create-anonymous-session.d.ts +11 -0
  289. package/dist/server/plugins/mcp/docs-mcp/tools/core/create-anonymous-session.js +1 -0
  290. package/dist/server/plugins/mcp/docs-mcp/tools/graphql/constants.d.ts +4 -0
  291. package/dist/server/plugins/mcp/docs-mcp/tools/graphql/constants.js +1 -0
  292. package/dist/server/plugins/mcp/docs-mcp/tools/graphql/get-graphql-type-list.js +1 -1
  293. package/dist/server/plugins/mcp/docs-mcp/tools/graphql/get-graphql-type.js +7 -4
  294. package/dist/server/plugins/mcp/docs-mcp/tools/graphql/types.d.ts +7 -1
  295. package/dist/server/plugins/mcp/docs-mcp/tools/graphql/types.js +0 -1
  296. package/dist/server/plugins/mcp/docs-mcp/tools/graphql/utils.d.ts +5 -1
  297. package/dist/server/plugins/mcp/docs-mcp/tools/graphql/utils.js +4 -2
  298. package/dist/server/plugins/mcp/docs-mcp/tools/index.d.ts +4 -0
  299. package/dist/server/plugins/mcp/docs-mcp/tools/index.js +1 -1
  300. package/dist/server/plugins/mcp/docs-mcp/tools/openapi/constants.d.ts +2 -0
  301. package/dist/server/plugins/mcp/docs-mcp/tools/openapi/constants.js +1 -0
  302. package/dist/server/plugins/mcp/docs-mcp/tools/openapi/get-endpoint-info.js +1 -1
  303. package/dist/server/plugins/mcp/docs-mcp/tools/openapi/get-endpoints.js +1 -1
  304. package/dist/server/plugins/mcp/docs-mcp/tools/openapi/get-full-api-description.js +1 -1
  305. package/dist/server/plugins/mcp/docs-mcp/tools/openapi/get-security-schemes.js +1 -1
  306. package/dist/server/plugins/mcp/docs-mcp/tools/openapi/list-apis.js +1 -1
  307. package/dist/server/plugins/mcp/docs-mcp/tools/openapi/load-api-description.d.ts +6 -2
  308. package/dist/server/plugins/mcp/docs-mcp/tools/openapi/load-api-description.js +1 -1
  309. package/dist/server/plugins/mcp/docs-mcp/tools/openapi/types.d.ts +2 -0
  310. package/dist/server/plugins/mcp/docs-mcp/tools/openapi/utils.d.ts +2 -2
  311. package/dist/server/plugins/mcp/docs-mcp/tools/openapi/utils.js +1 -1
  312. package/dist/server/plugins/mcp/docs-mcp/utils.d.ts +3 -3
  313. package/dist/server/plugins/mcp/docs-mcp/utils.js +1 -1
  314. package/dist/server/plugins/mcp/gateway-mcp/elicitation.d.ts +28 -0
  315. package/dist/server/plugins/mcp/gateway-mcp/elicitation.js +2 -0
  316. package/dist/server/plugins/mcp/gateway-mcp/eligibility.d.ts +5 -17
  317. package/dist/server/plugins/mcp/gateway-mcp/eligibility.js +1 -1
  318. package/dist/server/plugins/mcp/gateway-mcp/fetch/allowed-hosts.d.ts +9 -9
  319. package/dist/server/plugins/mcp/gateway-mcp/fetch/allowed-hosts.js +1 -1
  320. package/dist/server/plugins/mcp/gateway-mcp/fetch/fetch-bridge.d.ts +17 -1
  321. package/dist/server/plugins/mcp/gateway-mcp/fetch/fetch-bridge.js +1 -1
  322. package/dist/server/plugins/mcp/gateway-mcp/fetch/fetch-errors.d.ts +11 -0
  323. package/dist/server/plugins/mcp/gateway-mcp/fetch/fetch-errors.js +1 -0
  324. package/dist/server/plugins/mcp/gateway-mcp/fetch/fetch-telemetry.d.ts +14 -0
  325. package/dist/server/plugins/mcp/gateway-mcp/fetch/fetch-telemetry.js +1 -0
  326. package/dist/server/plugins/mcp/gateway-mcp/fetch/normalize-path.d.ts +6 -0
  327. package/dist/server/plugins/mcp/gateway-mcp/fetch/normalize-path.js +1 -0
  328. package/dist/server/plugins/mcp/gateway-mcp/fetch/redact.d.ts +4 -0
  329. package/dist/server/plugins/mcp/gateway-mcp/fetch/redact.js +1 -0
  330. package/dist/server/plugins/mcp/gateway-mcp/fetch/ssrf-blocklist.d.ts +22 -0
  331. package/dist/server/plugins/mcp/gateway-mcp/fetch/ssrf-blocklist.js +1 -0
  332. package/dist/server/plugins/mcp/gateway-mcp/fetch/ssrf-guard.d.ts +1 -1
  333. package/dist/server/plugins/mcp/gateway-mcp/fetch/ssrf-guard.js +1 -1
  334. package/dist/server/plugins/mcp/gateway-mcp/fetch/ssrf-safe-lookup.d.ts +13 -0
  335. package/dist/server/plugins/mcp/gateway-mcp/fetch/ssrf-safe-lookup.js +1 -0
  336. package/dist/server/plugins/mcp/gateway-mcp/fetch-capability.d.ts +8 -1
  337. package/dist/server/plugins/mcp/gateway-mcp/fetch-capability.js +1 -1
  338. package/dist/server/plugins/mcp/gateway-mcp/rate-limit/apply-edge-rate-limit.d.ts +3 -0
  339. package/dist/server/plugins/mcp/gateway-mcp/rate-limit/apply-edge-rate-limit.js +1 -0
  340. package/dist/server/plugins/mcp/gateway-mcp/rate-limit/edge-limiter.d.ts +16 -0
  341. package/dist/server/plugins/mcp/gateway-mcp/rate-limit/edge-limiter.js +1 -0
  342. package/dist/server/plugins/mcp/gateway-mcp/rate-limit/ip-key.d.ts +2 -0
  343. package/dist/server/plugins/mcp/gateway-mcp/rate-limit/ip-key.js +1 -0
  344. package/dist/server/plugins/mcp/gateway-mcp/rate-limit/limits.d.ts +7 -0
  345. package/dist/server/plugins/mcp/gateway-mcp/rate-limit/limits.js +1 -0
  346. package/dist/server/plugins/mcp/gateway-mcp/rate-limit/rate-limit-telemetry.d.ts +8 -0
  347. package/dist/server/plugins/mcp/gateway-mcp/rate-limit/rate-limit-telemetry.js +1 -0
  348. package/dist/server/plugins/mcp/gateway-mcp/rate-limit/window-counter.d.ts +15 -0
  349. package/dist/server/plugins/mcp/gateway-mcp/rate-limit/window-counter.js +1 -0
  350. package/dist/server/plugins/mcp/gateway-mcp/secret-store.d.ts +24 -0
  351. package/dist/server/plugins/mcp/gateway-mcp/secret-store.js +1 -0
  352. package/dist/server/plugins/mcp/gateway-mcp/subject.d.ts +20 -0
  353. package/dist/server/plugins/mcp/gateway-mcp/subject.js +1 -0
  354. package/dist/server/plugins/mcp/gateway-mcp/upstream-auth-scheme.d.ts +18 -0
  355. package/dist/server/plugins/mcp/gateway-mcp/upstream-auth-scheme.js +1 -0
  356. package/dist/server/plugins/mcp/gateway-mcp/upstream-auth.d.ts +10 -0
  357. package/dist/server/plugins/mcp/gateway-mcp/upstream-auth.js +1 -0
  358. package/dist/server/plugins/mcp/handlers/docs-mcp-handler.js +1 -1
  359. package/dist/server/plugins/mcp/handlers/errors.d.ts +3 -3
  360. package/dist/server/plugins/mcp/handlers/errors.js +1 -1
  361. package/dist/server/plugins/mcp/handlers/handle-mcp-request.js +1 -1
  362. package/dist/server/plugins/mcp/handlers/mcp-credentials-handler.d.ts +5 -0
  363. package/dist/server/plugins/mcp/handlers/mcp-credentials-handler.js +101 -0
  364. package/dist/server/plugins/mcp/index.d.ts +1 -0
  365. package/dist/server/plugins/mcp/index.js +1 -1
  366. package/dist/server/plugins/mcp/servers/docs-server.d.ts +3 -1
  367. package/dist/server/plugins/mcp/servers/docs-server.js +1 -1
  368. package/dist/server/plugins/mcp/servers/mcp-server.d.ts +15 -8
  369. package/dist/server/plugins/mcp/servers/mcp-server.js +1 -1
  370. package/dist/server/plugins/mcp/types.d.ts +16 -20
  371. package/dist/server/plugins/mcp/utils/json-schema-validator.d.ts +9 -0
  372. package/dist/server/plugins/mcp/utils/json-schema-validator.js +1 -0
  373. package/dist/server/plugins/mcp/utils/jwt.d.ts +0 -9
  374. package/dist/server/plugins/mcp/utils/jwt.js +1 -1
  375. package/dist/server/plugins/mcp/utils/mode.d.ts +12 -2
  376. package/dist/server/plugins/mcp/utils/mode.js +1 -1
  377. package/dist/server/plugins/mcp/utils/telemetry-attributes.d.ts +8 -0
  378. package/dist/server/plugins/mcp/utils/telemetry-attributes.js +1 -0
  379. package/dist/server/plugins/mcp/utils/xmcp-utils.d.ts +1 -1
  380. package/dist/server/plugins/mcp/utils.d.ts +17 -5
  381. package/dist/server/plugins/mcp/utils.js +1 -1
  382. package/dist/server/plugins/mcp/workers/execute-mcp-tool.js +1 -1
  383. package/dist/server/plugins/mcp/workers/mcp-tool-telemetry.d.ts +10 -2
  384. package/dist/server/plugins/mcp/workers/mcp-tool-telemetry.js +1 -1
  385. package/dist/server/plugins/openapi-docs/index.js +1 -1
  386. package/dist/server/plugins/openapi-docs/search/get-ai-search-documents.js +16 -16
  387. package/dist/server/plugins/openapi-docs/utils.js +1 -1
  388. package/dist/server/plugins/pages/index.js +1 -1
  389. package/dist/server/plugins/scorecard-classic/compute-scorecard.d.ts +1 -1
  390. package/dist/server/plugins/scorecard-classic/compute-scorecard.js +4 -4
  391. package/dist/server/plugins/scorecard-classic/index.d.ts +1 -1
  392. package/dist/server/plugins/scorecard-classic/index.js +1 -1
  393. package/dist/server/plugins/scorecard-classic/template/components.d.ts +1 -1
  394. package/dist/server/plugins/scorecard-classic/template/useData.d.ts +1 -1
  395. package/dist/server/plugins/scorecards/plugin.js +1 -1
  396. package/dist/server/plugins/search/ai-indexer/prepare-semantic-documents.d.ts +1 -1
  397. package/dist/server/plugins/search/ai-indexer/prepare-semantic-documents.js +2 -2
  398. package/dist/server/plugins/search/documents/search-documents.js +1 -1
  399. package/dist/server/plugins/search/engines/flexsearch/index.js +1 -1
  400. package/dist/server/plugins/search/engines/flexsearch/search-index.js +1 -1
  401. package/dist/server/plugins/search/engines/search-engine.d.ts +1 -1
  402. package/dist/server/plugins/search/engines/typesense/index.js +1 -1
  403. package/dist/server/plugins/search/index.js +1 -1
  404. package/dist/server/plugins/search/llmstxt/index.d.ts +1 -1
  405. package/dist/server/plugins/search/llmstxt/index.js +4 -4
  406. package/dist/server/plugins/sidebars/index.d.ts +1 -1
  407. package/dist/server/plugins/sidebars/index.js +1 -1
  408. package/dist/server/plugins/sitemap/index.js +1 -1
  409. package/dist/server/plugins/sso/index.js +1 -1
  410. package/dist/server/providers/database/database-path-generator.d.ts +2 -2
  411. package/dist/server/providers/database/utils/storage-limit-validator.d.ts +1 -1
  412. package/dist/server/sandbox/constants/host-functions.d.ts +3 -0
  413. package/dist/server/sandbox/constants/host-functions.js +1 -0
  414. package/dist/server/sandbox/constants/sandbox.d.ts +6 -0
  415. package/dist/server/sandbox/constants/sandbox.js +1 -0
  416. package/dist/server/sandbox/sandbox.d.ts +8 -0
  417. package/dist/server/sandbox/sandbox.js +3 -0
  418. package/dist/server/sandbox/types.d.ts +25 -0
  419. package/dist/server/sandbox/utils/eval-guest-code.d.ts +15 -0
  420. package/dist/server/sandbox/utils/eval-guest-code.js +1 -0
  421. package/dist/server/sandbox/utils/execution-budget.d.ts +12 -0
  422. package/dist/server/sandbox/utils/execution-budget.js +1 -0
  423. package/dist/server/sandbox/utils/setup-host-functions.d.ts +18 -0
  424. package/dist/server/sandbox/utils/setup-host-functions.js +5 -0
  425. package/dist/server/ssr/render.js +1 -1
  426. package/dist/server/ssr/server-side-props/get-default-static-props.d.ts +1 -1
  427. package/dist/server/ssr/server-side-props/get-server-props-from-user-handler.d.ts +1 -1
  428. package/dist/server/ssr/template.d.ts +1 -1
  429. package/dist/server/ssr/utils.d.ts +1 -0
  430. package/dist/server/ssr/utils.js +5 -5
  431. package/dist/server/store.d.ts +2 -6
  432. package/dist/server/store.js +1 -1
  433. package/dist/server/tools/notifiers/logger.js +1 -1
  434. package/dist/server/tools/notifiers/reporter.js +6 -6
  435. package/dist/server/types/plugins/common.d.ts +4 -6
  436. package/dist/server/types/plugins/markdown.d.ts +1 -3
  437. package/dist/server/types/plugins/search.d.ts +1 -0
  438. package/dist/server/utils/catalog-classic/get-route-slug-to-catalog-slug-map.test.js +1 -1
  439. package/dist/server/utils/crypto/constants.d.ts +5 -0
  440. package/dist/server/utils/crypto/constants.js +1 -0
  441. package/dist/server/utils/crypto/decrypt-aes-gcm.d.ts +6 -0
  442. package/dist/server/utils/crypto/decrypt-aes-gcm.js +1 -0
  443. package/dist/server/utils/crypto/decrypt-claim-value.d.ts +6 -0
  444. package/dist/server/utils/crypto/decrypt-claim-value.js +1 -0
  445. package/dist/server/utils/crypto/derive-key.d.ts +5 -0
  446. package/dist/server/utils/crypto/derive-key.js +1 -0
  447. package/dist/server/utils/crypto/encrypt-aes-gcm.d.ts +6 -0
  448. package/dist/server/utils/crypto/encrypt-aes-gcm.js +1 -0
  449. package/dist/server/utils/crypto/encrypt-claim-value.d.ts +6 -0
  450. package/dist/server/utils/crypto/encrypt-claim-value.js +1 -0
  451. package/dist/server/utils/fetch-with-client.d.ts +10 -0
  452. package/dist/server/utils/fetch-with-client.js +1 -0
  453. package/dist/server/utils/l10n/get-build-translate-context.d.ts +7 -0
  454. package/dist/server/utils/l10n/get-build-translate-context.js +1 -0
  455. package/dist/server/utils/llmstxt/agent-feedback-llms-footer.js +1 -1
  456. package/dist/server/utils/rbac.d.ts +4 -0
  457. package/dist/server/utils/rbac.js +1 -1
  458. package/dist/server/utils/report-all-errors.js +1 -1
  459. package/dist/server/utils/sandbox-context.d.ts +18 -0
  460. package/dist/server/utils/sandbox-context.js +1 -0
  461. package/dist/server/utils/shared-data.js +1 -1
  462. package/dist/server/web-server/auth.d.ts +34 -4
  463. package/dist/server/web-server/auth.js +3 -3
  464. package/dist/server/web-server/handle-api-route-request.js +1 -1
  465. package/dist/server/web-server/middleware/apiKeyMiddleware.js +1 -1
  466. package/dist/server/web-server/middleware/catalogAuthMiddleware.d.ts +1 -1
  467. package/dist/server/web-server/middleware/catalogAuthMiddleware.js +1 -1
  468. package/dist/server/web-server/middleware/telemetry-middleware.js +1 -1
  469. package/dist/server/web-server/routes/api-routes/api-routes.js +1 -1
  470. package/dist/server/web-server/routes/ask-ai.js +1 -1
  471. package/dist/server/web-server/routes/auth.js +1 -1
  472. package/dist/server/web-server/routes/catalog/bff-catalog-related-entities.js +1 -1
  473. package/dist/server/web-server/routes/catalog/bff-catalog-revisions.js +1 -1
  474. package/dist/server/web-server/routes/catalog/bff-catalog.js +1 -1
  475. package/dist/server/web-server/routes/catalog/catalog-relations.js +1 -1
  476. package/dist/server/web-server/routes/catalog/catalog.js +1 -1
  477. package/dist/server/web-server/routes/catalog/helpers/has-access-to-entity.d.ts +1 -1
  478. package/dist/server/web-server/routes/catalog/helpers/upsert-pages-stats.d.ts +1 -1
  479. package/dist/server/web-server/routes/catalog/helpers/upsert-pages-stats.js +1 -1
  480. package/dist/server/web-server/routes/dynamic-route.js +1 -1
  481. package/dist/server/web-server/routes/feedback.d.ts +1 -1
  482. package/dist/server/web-server/routes/feedback.js +1 -1
  483. package/dist/server/web-server/routes/helpers/process-redirects.d.ts +1 -1
  484. package/dist/server/web-server/routes/mcp-routes/a2a.js +1 -1
  485. package/dist/server/web-server/routes/mcp-routes/agent-card.js +1 -1
  486. package/dist/server/web-server/routes/mcp-routes/mcp-oauth.d.ts +10 -6
  487. package/dist/server/web-server/routes/mcp-routes/mcp-oauth.js +1 -1
  488. package/dist/server/web-server/routes/mcp-routes/mcp-routes.js +1 -1
  489. package/dist/server/web-server/routes/mcp-routes/mcp-server-card.js +1 -1
  490. package/dist/server/web-server/routes/mcp-routes/utils/build-agent-card.d.ts +1 -1
  491. package/dist/server/web-server/routes/page-data.js +1 -1
  492. package/dist/server/web-server/routes/resolve-route.js +1 -1
  493. package/dist/server/web-server/routes/search.js +1 -1
  494. package/dist/server/web-server/routes/semantic-search.js +1 -1
  495. package/dist/server/web-server/routes/skills/skill-markdown.js +1 -1
  496. package/dist/server/web-server/routes/skills/skills-index.js +1 -1
  497. package/dist/server/web-server/utils/prepare-list-response.d.ts +1 -1
  498. package/dist/server/workers/api-routes-worker-pool.js +1 -1
  499. package/dist/server/workers/mcp-tool-worker-pool.js +1 -1
  500. package/dist/server/workers/worker-pool.d.ts +1 -0
  501. package/dist/server/workers/worker-pool.js +1 -1
  502. package/dist/types/entitlements.d.ts +6 -1
  503. package/dist/types/markdoc.d.ts +2 -1
  504. package/dist/utils/l10n/build-i18n-config.d.ts +24 -0
  505. package/dist/utils/l10n/build-i18n-config.js +1 -0
  506. package/dist/utils/l10n/create-translate.d.ts +19 -0
  507. package/dist/utils/l10n/create-translate.js +1 -0
  508. package/dist/utils/url/get-shared-data-fetch-url.d.ts +17 -0
  509. package/dist/utils/url/get-shared-data-fetch-url.js +1 -0
  510. package/dist/utils/url/parse-preview-url.d.ts +22 -0
  511. package/dist/utils/url/parse-preview-url.js +1 -0
  512. package/package.json +16 -15
  513. package/dist/markdoc/helpers/get-operation/get-operation-info-by-id.d.ts +0 -4
  514. package/dist/markdoc/helpers/get-operation/get-operation-info-by-id.js +0 -1
  515. package/dist/markdoc/helpers/get-operation/get-operation-info-by-pointer.d.ts +0 -4
  516. package/dist/markdoc/helpers/get-operation/get-operation-info-by-pointer.js +0 -1
  517. package/dist/markdoc/helpers/get-operation/get-operation.d.ts +0 -14
  518. package/dist/markdoc/helpers/get-operation/get-operation.js +0 -1
  519. package/dist/markdoc/helpers/get-operation/index.d.ts +0 -4
  520. package/dist/markdoc/helpers/get-operation/index.js +0 -1
  521. package/dist/markdoc/helpers/get-operation/types/index.d.ts +0 -4
  522. package/dist/markdoc/helpers/get-operation/types/operation-identifier.d.ts +0 -5
  523. package/dist/markdoc/helpers/get-operation/types/operation-identifier.js +0 -0
  524. package/dist/markdoc/helpers/get-operation/types/operation-info.d.ts +0 -6
  525. package/dist/markdoc/helpers/get-operation/types/operation-info.js +0 -0
  526. package/dist/markdoc/helpers/get-operation/types/operation-parameters.d.ts +0 -3
  527. package/dist/markdoc/helpers/get-operation/types/operation-parameters.js +0 -0
  528. package/dist/server/plugins/markdown/attribute-resolvers/helpers/get-media-content-samples.d.ts +0 -4
  529. package/dist/server/plugins/markdown/attribute-resolvers/helpers/get-media-content-samples.js +0 -1
  530. package/dist/server/plugins/mcp/codemode/sandbox/sandbox-polyfills.d.ts +0 -3
  531. package/dist/server/plugins/mcp/codemode/sandbox/sandbox.d.ts +0 -3
  532. package/dist/server/plugins/mcp/codemode/sandbox/sandbox.js +0 -15
  533. package/dist/server/plugins/mcp/handlers/sse-keepalive.d.ts +0 -15
  534. package/dist/server/plugins/mcp/handlers/sse-keepalive.js +0 -3
  535. /package/dist/{markdoc/helpers/get-operation/types/index.js → server/sandbox/types.js} +0 -0
@@ -1 +1 @@
1
- import{REDOCLY_TEAMS_RBAC as y}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 le(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("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||{},F=await _(a,"markdown-frontmatter",r,t),p=L(F,a);let d=null;r?.sidebar&&(d=await G(r.sidebar,a,t.fs));let u=n;const f=q({realRelativePath:b,frontmatter:r,markdown:m,contentDir:h.contentDir});f&&(u=e.createTemplate(f.templateRef,f.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(v=>{e.addRoute({excludeFromSearch:r?.excludeFromSearch||!1,slug:v,fsPath:a,templateId:u,sharedData:d?[{id:d,key:"sidebar"}]:void 0,redirectFrom:Object.entries(r.redirects||{}).map(([l,{type:c}])=>({type:c||301,from:l})),[y]:r?.rbac,getNavText:async()=>(r?.seo?.title||await A(a,t)||"").toString(),metadata:{type:"markdown",...P},async getStaticData(l,c){return E(o,l,t,r,c)},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{le 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),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};
@@ -24,7 +24,7 @@ export declare function getMarkdocOptions(serverOutDir?: string, _templateId?: s
24
24
  };
25
25
  }>>): import("@markdoc/markdoc").MaybePromise<import("@markdoc/markdoc").RenderableTreeNodes>;
26
26
  validate?(node: import("@markdoc/markdoc").Node, config: Readonly<Partial<{
27
- nodes: Partial<Record<import("@markdoc/markdoc").NodeType, import("@markdoc/markdoc").Schema<Partial</*elided*/ any>, string>>>;
27
+ nodes: Partial<Record<import("@markdoc/markdoc").NodeType, import("@markdoc/markdoc").Schema<Partial<any>, string>>>;
28
28
  tags: Record<string, import("@markdoc/markdoc").Schema>;
29
29
  variables: Record<string, any>;
30
30
  functions: Record<string, import("@markdoc/markdoc").ConfigFunction>;
@@ -45,7 +45,7 @@ export declare function getMarkdocOptions(serverOutDir?: string, _templateId?: s
45
45
  selfClosing?: boolean;
46
46
  inline?: boolean;
47
47
  transform?(node: import("@markdoc/markdoc").Node, config: Readonly<Partial<{
48
- nodes: Partial<Record<import("@markdoc/markdoc").NodeType, import("@markdoc/markdoc").Schema<Partial</*elided*/ any>, string>>>;
48
+ nodes: Partial<Record<import("@markdoc/markdoc").NodeType, import("@markdoc/markdoc").Schema<Partial<any>, string>>>;
49
49
  tags: Record<string, import("@markdoc/markdoc").Schema>;
50
50
  variables: Record<string, any>;
51
51
  functions: Record<string, import("@markdoc/markdoc").ConfigFunction>;
@@ -57,7 +57,7 @@ export declare function getMarkdocOptions(serverOutDir?: string, _templateId?: s
57
57
  };
58
58
  }>>): import("@markdoc/markdoc").MaybePromise<import("@markdoc/markdoc").RenderableTreeNodes>;
59
59
  validate?(node: import("@markdoc/markdoc").Node, config: Readonly<Partial<{
60
- nodes: Partial<Record<import("@markdoc/markdoc").NodeType, import("@markdoc/markdoc").Schema<Partial</*elided*/ any>, string>>>;
60
+ nodes: Partial<Record<import("@markdoc/markdoc").NodeType, import("@markdoc/markdoc").Schema<Partial<any>, string>>>;
61
61
  tags: Record<string, import("@markdoc/markdoc").Schema>;
62
62
  variables: Record<string, any>;
63
63
  functions: Record<string, import("@markdoc/markdoc").ConfigFunction>;
@@ -78,7 +78,7 @@ export declare function getMarkdocOptions(serverOutDir?: string, _templateId?: s
78
78
  selfClosing?: boolean;
79
79
  inline?: boolean;
80
80
  transform?(node: import("@markdoc/markdoc").Node, config: Readonly<Partial<{
81
- nodes: Partial<Record<import("@markdoc/markdoc").NodeType, import("@markdoc/markdoc").Schema<Partial</*elided*/ any>, string>>>;
81
+ nodes: Partial<Record<import("@markdoc/markdoc").NodeType, import("@markdoc/markdoc").Schema<Partial<any>, string>>>;
82
82
  tags: Record<string, import("@markdoc/markdoc").Schema>;
83
83
  variables: Record<string, any>;
84
84
  functions: Record<string, import("@markdoc/markdoc").ConfigFunction>;
@@ -90,7 +90,7 @@ export declare function getMarkdocOptions(serverOutDir?: string, _templateId?: s
90
90
  };
91
91
  }>>): import("@markdoc/markdoc").MaybePromise<import("@markdoc/markdoc").RenderableTreeNodes>;
92
92
  validate?(node: import("@markdoc/markdoc").Node, config: Readonly<Partial<{
93
- nodes: Partial<Record<import("@markdoc/markdoc").NodeType, import("@markdoc/markdoc").Schema<Partial</*elided*/ any>, string>>>;
93
+ nodes: Partial<Record<import("@markdoc/markdoc").NodeType, import("@markdoc/markdoc").Schema<Partial<any>, string>>>;
94
94
  tags: Record<string, import("@markdoc/markdoc").Schema>;
95
95
  variables: Record<string, any>;
96
96
  functions: Record<string, import("@markdoc/markdoc").ConfigFunction>;
@@ -110,7 +110,7 @@ export declare function getMarkdocOptions(serverOutDir?: string, _templateId?: s
110
110
  selfClosing?: boolean;
111
111
  inline?: boolean;
112
112
  transform?(node: import("@markdoc/markdoc").Node, config: Readonly<Partial<{
113
- nodes: Partial<Record<import("@markdoc/markdoc").NodeType, import("@markdoc/markdoc").Schema<Partial</*elided*/ any>, string>>>;
113
+ nodes: Partial<Record<import("@markdoc/markdoc").NodeType, import("@markdoc/markdoc").Schema<Partial<any>, string>>>;
114
114
  tags: Record<string, import("@markdoc/markdoc").Schema>;
115
115
  variables: Record<string, any>;
116
116
  functions: Record<string, import("@markdoc/markdoc").ConfigFunction>;
@@ -122,7 +122,7 @@ export declare function getMarkdocOptions(serverOutDir?: string, _templateId?: s
122
122
  };
123
123
  }>>): import("@markdoc/markdoc").MaybePromise<import("@markdoc/markdoc").RenderableTreeNodes>;
124
124
  validate?(node: import("@markdoc/markdoc").Node, config: Readonly<Partial<{
125
- nodes: Partial<Record<import("@markdoc/markdoc").NodeType, import("@markdoc/markdoc").Schema<Partial</*elided*/ any>, string>>>;
125
+ nodes: Partial<Record<import("@markdoc/markdoc").NodeType, import("@markdoc/markdoc").Schema<Partial<any>, string>>>;
126
126
  tags: Record<string, import("@markdoc/markdoc").Schema>;
127
127
  variables: Record<string, any>;
128
128
  functions: Record<string, import("@markdoc/markdoc").ConfigFunction>;
@@ -144,7 +144,7 @@ export declare function getMarkdocOptions(serverOutDir?: string, _templateId?: s
144
144
  selfClosing?: boolean;
145
145
  inline?: boolean;
146
146
  transform?(node: import("@markdoc/markdoc").Node, config: Readonly<Partial<{
147
- nodes: Partial<Record<import("@markdoc/markdoc").NodeType, import("@markdoc/markdoc").Schema<Partial</*elided*/ any>, string>>>;
147
+ nodes: Partial<Record<import("@markdoc/markdoc").NodeType, import("@markdoc/markdoc").Schema<Partial<any>, string>>>;
148
148
  tags: Record<string, import("@markdoc/markdoc").Schema>;
149
149
  variables: Record<string, any>;
150
150
  functions: Record<string, import("@markdoc/markdoc").ConfigFunction>;
@@ -156,7 +156,7 @@ export declare function getMarkdocOptions(serverOutDir?: string, _templateId?: s
156
156
  };
157
157
  }>>): import("@markdoc/markdoc").MaybePromise<import("@markdoc/markdoc").RenderableTreeNodes>;
158
158
  validate?(node: import("@markdoc/markdoc").Node, config: Readonly<Partial<{
159
- nodes: Partial<Record<import("@markdoc/markdoc").NodeType, import("@markdoc/markdoc").Schema<Partial</*elided*/ any>, string>>>;
159
+ nodes: Partial<Record<import("@markdoc/markdoc").NodeType, import("@markdoc/markdoc").Schema<Partial<any>, string>>>;
160
160
  tags: Record<string, import("@markdoc/markdoc").Schema>;
161
161
  variables: Record<string, any>;
162
162
  functions: Record<string, import("@markdoc/markdoc").ConfigFunction>;
@@ -4,6 +4,11 @@ export declare function getHeadingData(node: Tag | Node): {
4
4
  id: any;
5
5
  depth: any;
6
6
  } | undefined;
7
+ export declare function getNumberedItemHeadingData(node: Tag | Node): {
8
+ value: string;
9
+ id: any;
10
+ depth: any;
11
+ } | undefined;
7
12
  export declare function extractFirstHeading(ast: Node): undefined | string;
8
13
  export declare const EXIT: unique symbol;
9
14
  /**
@@ -1 +1 @@
1
- import{isNode as l}from"../../../../../markdoc/helpers/guards/is-node.js";import{isStringNode as s}from"../../../../../markdoc/helpers/guards/is-string-node.js";import{getNodeAttribute as c}from"../../../../../markdoc/helpers/get-node-attribute.js";import{getInnerText as a}from"../../../../../markdoc/helpers/get-inner-text.js";function p(t){const r=c(t,"level");if(r)return{value:a(t.children),id:c(t,"id"),depth:r}}function h(t){let r;return f(t,i=>{if(l(i)&&i.type==="heading")return r=p(i)?.value,o}),r}const o=Symbol("Exit visitor");function f(t,r){if(!t)return;const i=r(t);if(i===o)return i;for(const e of t.children){if(!e||s(e))continue;const n=f(e,r);if(n===o)return n}const u=t.slots||{};for(const e of Object.values(u)){if(!e||s(e))continue;const n=f(e,r);if(n===o)return n}}export{o as EXIT,h as extractFirstHeading,p as getHeadingData,f as visit};
1
+ import{isNode as l}from"../../../../../markdoc/helpers/guards/is-node.js";import{isStringNode as f}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";function d(t){const e=o(t,"level");if(e)return{value:a(t.children),id:o(t,"id"),depth:e}}function x(t){const e=o(t,"headlineLevel"),r=o(t,"anchorId"),s=o(t,"headline");if(!(!e||!r||!Array.isArray(s)))return{value:a(s),id:r,depth:e}}function v(t){let e;return u(t,r=>{if(l(r)&&r.type==="heading")return e=d(r)?.value,c}),e}const c=Symbol("Exit visitor");function u(t,e){if(!t)return;const r=e(t);if(r===c)return r;for(const i of t.children){if(!i||f(i))continue;const n=u(i,e);if(n===c)return n}const s=t.slots||{};for(const i of Object.values(s)){if(!i||f(i))continue;const n=u(i,e);if(n===c)return n}}export{c as EXIT,v as extractFirstHeading,d as getHeadingData,x as getNumberedItemHeadingData,u as visit};
@@ -1 +1 @@
1
- import u from"@markdoc/markdoc";import{isTag as b}from"../../../markdoc/helpers/guards/is-tag.js";import{slugger as l}from"../../utils/index.js";import{getMarkdocOptions as f}from"./markdoc/markdoc-options.js";import{visit as h,getHeadingData as k}from"./markdoc/plugins/utils.js";import{renderDiagramsWithVariants as v}from"./markdoc/plugins/render-diagrams.js";import{deepStringify as y}from"./markdoc/utils/deep-stringify.js";import{stringifyTagChildrenObjects as D}from"./utils/stringify-tag-children-objects.js";async function _(d,a,p){const g=await f(p),i=[],t=[],s=y(a.variables?.pageProps),{headers:H,...c}=a.variables||{};l.reset();const o=u.transform(d,{...g,...a,variables:{...c,pageProps:s}});let m=0;h(o,r=>{if(b(r)){switch(r.name){case"Heading":r.attributes.__idx=m,m++;const n=k(r);n&&i.push(n);break;case"Diagram":t.push({tag:r,input:{type:r.attributes.diagramType,source:r.attributes.diagramSource}});break}D(r)}});const e=await v(t.map(r=>r.input));for(let r=0;r<t.length;r++)t[r].tag.attributes.diagramError=e[r].error,t[r].tag.attributes.diagramHtml=e[r].light,t[r].tag.attributes.diagramHtmlDark=e[r].dark;return{headings:i,renderableAst:o,pageProps:s}}export{_ as transformMdAst};
1
+ import b from"@markdoc/markdoc";import{isTag as f}from"../../../markdoc/helpers/guards/is-tag.js";import{slugger as l}from"../../utils/index.js";import{getMarkdocOptions as h}from"./markdoc/markdoc-options.js";import{visit as k,getHeadingData as D,getNumberedItemHeadingData as H}from"./markdoc/plugins/utils.js";import{renderDiagramsWithVariants as v}from"./markdoc/plugins/render-diagrams.js";import{deepStringify as y}from"./markdoc/utils/deep-stringify.js";import{stringifyTagChildrenObjects as T}from"./utils/stringify-tag-children-objects.js";async function _(p,t,g){const u=await h(g),e=[],a=[],s=y(t.variables?.pageProps),{headers:w,...c}=t.variables||{};l.reset();const o=b.transform(p,{...u,...t,variables:{...c,pageProps:s}});let m=0;k(o,r=>{if(f(r)){switch(r.name){case"Heading":r.attributes.__idx=m,m++;const n=D(r);n&&e.push(n);break;case"NumberedItem":const d=H(r);d&&e.push(d);break;case"Diagram":a.push({tag:r,input:{type:r.attributes.diagramType,source:r.attributes.diagramSource}});break}T(r)}});const i=await v(a.map(r=>r.input));for(let r=0;r<a.length;r++)a[r].tag.attributes.diagramError=i[r].error,a[r].tag.attributes.diagramHtml=i[r].light,a[r].tag.attributes.diagramHtmlDark=i[r].dark;return{headings:e,renderableAst:o,pageProps:s}}export{_ as transformMdAst};
@@ -1,4 +1,5 @@
1
1
  import type { MarkdocTagSchema } from '@redocly/theme/markdoc/tags/types';
2
+ import type { TFunction } from '@redocly/theme/core/types';
2
3
  import type { RenderTagFn } from '../../../types/plugins/markdown';
3
- export declare function createRenderTagFn(markdocTags: Record<string, MarkdocTagSchema> | undefined): RenderTagFn;
4
+ export declare function createRenderTagFn(markdocTags: Record<string, MarkdocTagSchema> | undefined, locale: string, translate: TFunction): RenderTagFn;
4
5
  //# sourceMappingURL=create-render-tag-fn.d.ts.map
@@ -1 +1 @@
1
- function t(e){return(r,n)=>{if(r.tag)return e?.[r.tag]?.renderForLlms?.(r,n)}}export{t as createRenderTagFn};
1
+ function a(e,n,t){return(r,u)=>{if(r.tag)return e?.[r.tag]?.renderForLlms?.(r,{...u,locale:n,translate:t})}}export{a as createRenderTagFn};
@@ -1,9 +1,9 @@
1
- import _ from"@markdoc/markdoc";import D from"node:path";import{AI_SEARCH_CHUNK_SIZE as E,AI_SEARCH_DOCUMENT_CHUNK_SIZE as M}from"../../../constants/plugins/search.js";import{slugger as P}from"../../../../utils/slugger.js";import{joinSectionContent as U}from"./join-section-content.js";import{toMarkdown as b}from"./to-markdown.js";import{AstToSearchNodeTransformer as I}from"./walk-sections.js";import{createRenderTagFn as x}from"./create-render-tag-fn.js";import{getLocaleFromRelativePath as y}from"../../../fs/utils/get-locale-from-relative-path.js";import{HeadingNode as L}from"./nodes/heading-node.js";import{extractDocumentSearchFacets as H}from"./search-facets.js";import{formatDocumentMetadata as K}from"../../search/utils.js";import{TagNode as N}from"./nodes/tag-node.js";import{MARKDOC_PARTIALS_DATA_KEY as R}from"../../../constants/common.js";const j=Symbol(),et=(n,r)=>async(e,c,i,s)=>{if(r?.excludeFromSearch)return;P.reset();const a=await e.getNavText?.()||D.basename(e.fsPath),u=_.Ast.fromJSON(c.ast),f=new I({partials:s.getGlobalConfig(R)||{},renderTag:x(s.markdocOptions.tags),getInnerContent:b,ast:u,skipConditionals:!0}),d=Array.from(f.transform());return{async getLLMsTxts(){const o=r?.seo,g=o&&typeof o=="object"&&"description"in o?String(o.description):void 0,C=U(d);return[{title:a,description:g,slug:e.slug,fsPath:e.fsPath,content:C,includeInLLMsTxt:!0}]},async getSearchDocuments(){return F(e,d,n,a)}}};function F(n,r,e,c){const i=n.slug,s=new Map,a=n.metadata||{},u=H(a,e),f=K(a),d=f?`Metadata:
2
- ${f}
3
- `:"";let o=[];for(const t of r)if(t instanceof L){o.splice(t.attributes.level-1,6);const l=t.attributes.level>2,m=o[o.length-1]?.title,S=o[o.length-1]?.url,T=l&&m?m:O(c,t),A=l&&S?S:t.getUrl(i),h={title:T,content:"",url:A,level:t.attributes.level,toc:o.map(v=>p(v.section)).join(`
4
- `)};(t.attributes.level>1||p(t)!==c)&&(h.content+=h.content?`
5
- `:"",h.content+=t.content.trimEnd()),s.set(t.id,h),o.push({section:t,title:T,url:A})}else if(t instanceof N)s.set(t.id,{title:t.content,content:t.content,url:t.getUrl(i),level:t.attributes.level+1,toc:o.map(l=>p(l.section)).concat(t.content).join(`
6
- `)});else{const l=t.parentNode?.id??j,m=s.get(l)??{title:c,content:"",url:i,level:1/0,toc:""};m.content+=m.content?`
7
- `:"",m.content+=t.content.trimEnd(),s.set(l,m)}const g=w(Array.from(s.values())),C=y(n.fsPath);return g.filter(t=>t.content).map(t=>({title:t.title,url:t.url,content:[d,t.toc||`# ${c}`,t.content].filter(Boolean).join(`
8
- `),fsPath:n.fsPath,locale:C,product:n.product?.name,facets:u}))}function k(n){return n.length/4}function w(n){if(n.length===0)return[];const r=[];let e=n[0];for(let c=1;c<n.length;c++){const i=n[c],s=k(e.content),a=k(i.content),u=c===n.length-1;a<E&&(s<M||u)&&i.level>e.level?e.content+=`
9
- `+i.content:(r.push(e),e=i)}return r.push(e),r}function O(n,r){return r.content===n?n:`${n} \u2192 ${p(r)}`}function p(n){return n.content.replace(/^#+/,"").trim()}export{et as getAiDocumentsStore};
1
+ import _ from"@markdoc/markdoc";import D from"node:path";import{AI_SEARCH_CHUNK_SIZE as b,AI_SEARCH_DOCUMENT_CHUNK_SIZE as E}from"../../../constants/plugins/search.js";import{slugger as M}from"../../../../utils/slugger.js";import{joinSectionContent as P}from"./join-section-content.js";import{toMarkdown as U}from"./to-markdown.js";import{AstToSearchNodeTransformer as x}from"./walk-sections.js";import{createRenderTagFn as I}from"./create-render-tag-fn.js";import{getBuildTranslateContext as y}from"../../../utils/l10n/get-build-translate-context.js";import{getLocaleFromRelativePath as L}from"../../../fs/utils/get-locale-from-relative-path.js";import{HeadingNode as H}from"./nodes/heading-node.js";import{extractDocumentSearchFacets as K}from"./search-facets.js";import{formatDocumentMetadata as N}from"../../search/utils.js";import{TagNode as R}from"./nodes/tag-node.js";import{MARKDOC_PARTIALS_DATA_KEY as j}from"../../../constants/common.js";const w=Symbol(),rt=(n,o)=>async(e,r,i,c)=>{if(o?.excludeFromSearch)return;M.reset();const l=await e.getNavText?.()||D.basename(e.fsPath),f=_.Ast.fromJSON(r.ast),{locale:d,translate:C}=await y(e.slug,c.getGlobalData?.().l10n),s=new x({partials:c.getGlobalConfig(j)||{},renderTag:I(c.markdocOptions.tags,d,C),getInnerContent:U,ast:f,skipConditionals:!0}),g=Array.from(s.transform());return{async getLLMsTxts(){const u=o?.seo,t=u&&typeof u=="object"&&"description"in u?String(u.description):void 0,a=P(g);return[{title:l,description:t,slug:e.slug,fsPath:e.fsPath,content:a,includeInLLMsTxt:!0}]},async getSearchDocuments(){return F(e,g,n,l)}}};function F(n,o,e,r){const i=n.slug,c=new Map,l=n.metadata||{},f=K(l,e),d=N(l),C=d?`Metadata:
2
+ ${d}
3
+ `:"";let s=[];for(const t of o)if(t instanceof H){s.splice(t.attributes.level-1,6);const a=t.attributes.level>2,m=s[s.length-1]?.title,S=s[s.length-1]?.url,T=a&&m?m:$(r,t),A=a&&S?S:t.getUrl(i),h={title:T,content:"",url:A,level:t.attributes.level,toc:s.map(v=>p(v.section)).join(`
4
+ `)};(t.attributes.level>1||p(t)!==r)&&(h.content+=h.content?`
5
+ `:"",h.content+=t.content.trimEnd()),c.set(t.id,h),s.push({section:t,title:T,url:A})}else if(t instanceof R)c.set(t.id,{title:t.content,content:t.content,url:t.getUrl(i),level:t.attributes.level+1,toc:s.map(a=>p(a.section)).concat(t.content).join(`
6
+ `)});else{const a=t.parentNode?.id??w,m=c.get(a)??{title:r,content:"",url:i,level:1/0,toc:""};m.content+=m.content?`
7
+ `:"",m.content+=t.content.trimEnd(),c.set(a,m)}const g=O(Array.from(c.values())),u=L(n.fsPath);return g.filter(t=>t.content).map(t=>({title:t.title,url:t.url,content:[C,t.toc||`# ${r}`,t.content].filter(Boolean).join(`
8
+ `),fsPath:n.fsPath,locale:u,product:n.product?.name,facets:f}))}function k(n){return n.length/4}function O(n){if(n.length===0)return[];const o=[];let e=n[0];for(let r=1;r<n.length;r++){const i=n[r],c=k(e.content),l=k(i.content),f=r===n.length-1;l<b&&(c<E||f)&&i.level>e.level?e.content+=`
9
+ `+i.content:(o.push(e),e=i)}return o.push(e),o}function $(n,o){return o.content===n?n:`${n} \u2192 ${p(o)}`}function p(n){return n.content.replace(/^#+/,"").trim()}export{rt as getAiDocumentsStore};
@@ -1,3 +1,3 @@
1
- import{logger as N}from"../../../tools/notifiers/logger.js";import{isNode as f}from"../../../../markdoc/helpers/guards/is-node.js";import{isConditionalNode as T}from"../../../../markdoc/helpers/guards/is-conditional-node.js";import{isContentNode as m}from"../../../../markdoc/helpers/guards/is-content-node.js";import{getNodeAttribute as u}from"../../../../markdoc/helpers/get-node-attribute.js";import{extractRbacFromCondition as w}from"../../../../markdoc/helpers/extract-rbac-from-condition-node.js";import{TextNode as n}from"./nodes/text-node.js";import{TAG_TITLE_ATTRIBUTES as b,TagNode as p}from"./nodes/tag-node.js";import{HeadingNode as y}from"./nodes/heading-node.js";import{joinSectionContent as d}from"./join-section-content.js";class B{#s;#o;#e;#r;#c;constructor({ast:i,partials:t,skipConditionals:r=!1,getInnerContent:s,renderTag:o}){if(this.#s=i,this.#o=t,this.#e=r,this.#r=s,this.#c=o,!this.#s||!f(this.#s))throw new Error("ast is not a valid Markdoc Node.")}#i(){return{skipConditionals:this.#e,renderTag:this.#c}}*transform(){yield*this.#n(this.#s,{parentNode:null})}*#n(i,t,r=this.#r){if(!(!i||!f(i))){if(T(i)){if(this.#e)return;const s=w(i);s&&s.length>0&&(yield*this.#t(i,{...t,rbacTeams:s},r));return}if(m(i)){yield new n({node:i,content:r([i],this.#i()),...t});return}if(i.type==="heading"){yield new y({node:i,content:r([i],this.#i()),rbacTeams:t?.rbacTeams});return}if(i.type==="tag"){yield*this.#l(i,t,r);return}yield*this.#t(i,t,r)}}*#l(i,t,r=this.#r){switch(i.tag){case"partial":{const s=i.attributes.file,o=i.attributes.variables??{};if(s&&this.#o[s]){yield*this.#n(this.#o[s],t,(e,l)=>r(e,{...l,variables:o}));return}N.warn(`Could not create search indexes for partial \u201C${s}\u201D: file not found`);return}case"cards":case"tabs":case"code-walkthrough":{yield*this.#t(i,t,r);return}case"markdoc-example":{const s=r([i],this.#i());yield new n({node:i,content:s,...t});return}case"code-snippet":{const s=u(i,"title"),o=r([i],this.#i());if(s){const e=new p({node:i,content:s,...t});t={...t,parentNode:e},yield e}o&&(yield new n({node:i,content:o,...t}));return}default:{const s=this.#h(i,t,r);if(s){yield*s;return}const o=b.find(c=>c in i.attributes),e=(o&&u(i,o))??"",l=typeof e=="string"?e:r([e]);if(l){const c=new p({node:i,content:l,...t});t={...t,parentNode:c},yield c}if(a(i))yield*this.#t(i,t,r);else{const c=r([i],this.#i());c&&(yield new n({node:i,content:c,...t}))}return}}}#h(i,t,r){const s=()=>a(i)?d([...this.#t(i,t,r)]):"",o=this.#c?.(i,{getBody:s});return o===void 0?void 0:[new n({node:i,content:o.endsWith(`
1
+ import{logger as N}from"../../../tools/notifiers/logger.js";import{isNode as f}from"../../../../markdoc/helpers/guards/is-node.js";import{isConditionalNode as T}from"../../../../markdoc/helpers/guards/is-conditional-node.js";import{isContentNode as m}from"../../../../markdoc/helpers/guards/is-content-node.js";import{getNodeAttribute as u}from"../../../../markdoc/helpers/get-node-attribute.js";import{extractRbacFromCondition as w}from"../../../../markdoc/helpers/extract-rbac-from-condition-node.js";import{TextNode as n}from"./nodes/text-node.js";import{TAG_TITLE_ATTRIBUTES as b,TagNode as p}from"./nodes/tag-node.js";import{HeadingNode as y}from"./nodes/heading-node.js";import{joinSectionContent as d}from"./join-section-content.js";class B{#s;#o;#e;#r;#c;constructor({ast:i,partials:t,skipConditionals:r=!1,getInnerContent:s,renderTag:o}){if(this.#s=i,this.#o=t,this.#e=r,this.#r=s,this.#c=o,!this.#s||!f(this.#s))throw new Error("ast is not a valid Markdoc Node.")}#i(i={}){return{skipConditionals:this.#e,renderTag:this.#c,...i}}*transform(){yield*this.#n(this.#s,{parentNode:null})}*#n(i,t,r=this.#r){if(!(!i||!f(i))){if(T(i)){if(this.#e)return;const s=w(i);s&&s.length>0&&(yield*this.#t(i,{...t,rbacTeams:s},r));return}if(m(i)){yield new n({node:i,content:r([i],this.#i()),...t});return}if(i.type==="heading"){yield new y({node:i,content:r([i],this.#i()),rbacTeams:t?.rbacTeams});return}if(i.type==="tag"){yield*this.#l(i,t,r);return}yield*this.#t(i,t,r)}}*#l(i,t,r=this.#r){switch(i.tag){case"partial":{const s=i.attributes.file,o=i.attributes.variables??{};if(s&&this.#o[s]){yield*this.#n(this.#o[s],t,(e,l)=>r(e,{...l,variables:o}));return}N.warn(`Could not create search indexes for partial \u201C${s}\u201D: file not found`);return}case"cards":case"tabs":case"code-walkthrough":{yield*this.#t(i,t,r);return}case"markdoc-example":{const s=r([i],this.#i());yield new n({node:i,content:s,...t});return}case"code-snippet":{const s=u(i,"title"),o=r([i],this.#i());if(s){const e=new p({node:i,content:s,...t});t={...t,parentNode:e},yield e}o&&(yield new n({node:i,content:o,...t}));return}default:{const s=this.#h(i,t,r);if(s){yield*s;return}const o=b.find(c=>c in i.attributes),e=(o&&u(i,o))??"",l=typeof e=="string"?e:r([e]);if(l){const c=new p({node:i,content:l,...t});t={...t,parentNode:c},yield c}if(a(i))yield*this.#t(i,t,r);else{const c=r([i],this.#i());c&&(yield new n({node:i,content:c,...t}))}return}}}#h(i,t,r){const s=()=>a(i)?d([...this.#t(i,t,r)]):"",o=this.#c?.(i,{getBody:s});return o===void 0?void 0:[new n({node:i,content:o.endsWith(`
2
2
  `)?o:`${o}
3
3
  `,...t})]}*#t(i,t,r=this.#r){for(const s of[...Object.values(i.slots),...i.children])for(const o of this.#n(s,t,r))o instanceof y&&(t={...t,parentNode:o}),yield o}}function a(h){return h.children.length>0||Object.keys(h.slots).length>0}export{B as AstToSearchNodeTransformer};
@@ -9,5 +9,5 @@ export type ResolveMarkdownTemplateParams = {
9
9
  markdown?: MarkdownConfig;
10
10
  contentDir: string;
11
11
  };
12
- export declare function resolveMarkdownTemplate({ realRelativePath, frontmatter, markdown, contentDir }: ResolveMarkdownTemplateParams): ResolvedMarkdownTemplate | null;
12
+ export declare function resolveMarkdownTemplate({ realRelativePath, frontmatter, markdown, contentDir, }: ResolveMarkdownTemplateParams): ResolvedMarkdownTemplate | null;
13
13
  //# sourceMappingURL=resolve-markdown-template.d.ts.map
@@ -1,5 +1,7 @@
1
1
  import type { ApiFunctionsContext, ApiFunctionsUser } from '@redocly/config';
2
+ import type { Store } from '../../../store.js';
2
3
  export declare function shouldHandleMcpAuth(requiresLogin: boolean, rbacConfig?: Record<string, unknown>): boolean;
4
+ export declare function isMcpContentProtected(store: Store): boolean;
3
5
  export declare function handleMcpAuth(request: Request, context: ApiFunctionsContext): Promise<{
4
6
  isAuthenticated: boolean;
5
7
  isTokenValid?: boolean;
@@ -7,5 +9,6 @@ export declare function handleMcpAuth(request: Request, context: ApiFunctionsCon
7
9
  accessToken?: string;
8
10
  }>;
9
11
  export declare function constructUnauthorizedResponse(baseUrl: string): Response;
12
+ export declare function constructForbiddenResponse(): Response;
10
13
  export declare function constructInvalidTokenResponse(): Response;
11
14
  //# sourceMappingURL=auth-handlers.d.ts.map
@@ -1 +1 @@
1
- import{extractTokenFromAuthHeader as u}from"../../../plugins/mcp/utils/jwt.js";import{getUserParamsFromCookies as d}from"../../../web-server/auth.js";import{ServerRoutes as l}from"../../../../constants/api.js";import{DEFAULT_ANONYMOUS_VISITOR_TEAM as i,RBAC_ALL_OTHER_TEAMS as a}from"../../../../constants/common.js";import{withPathPrefix as h}from"@redocly/theme/core/utils";function c(e){return!e||typeof e!="object"||Object.keys(e).length===0?!1:!(e[i]&&e[i]!=="none"||e[a]&&e[a]!=="none")}function R(e,t){if(!t||Object.keys(t).length===0)return e;const r=t.content;if(r&&Object.keys(r).length>0&&Object.values(r).some(c))return!0;const o=t.teamFoldersBaseRoles;return c(o)?!0:e}async function O(e,t){const r=e.headers.get("Authorization");if(!r)return{isAuthenticated:!1};const o=u(r),s=t?.config?.ssoDirect||{},n=o?await d(s,{authorization:o}):{};return o&&n&&n.isAuthenticated?{isAuthenticated:!0,isTokenValid:!0,currentUser:{teams:n.teams||[],email:n.email||"",claims:n,isAuthenticated:!0,idpAccessToken:n.idpAccessToken||void 0,idpId:n.idpId||void 0},accessToken:o}:{isAuthenticated:!1,isTokenValid:!1}}function _(e){return e=e.replace(/^http:\/\//,"https://"),new Response(JSON.stringify({error:"unauthorized",message:"Authentication required"}),{status:401,headers:{"Content-Type":"application/json","WWW-Authenticate":`Bearer resource_metadata="${e}${l.MCP_OAUTH_PROTECTED_RESOURCE}${h("/mcp")}"`,"Access-Control-Allow-Origin":"*"}})}function g(){return new Response(JSON.stringify({error:"invalid_token",message:"Invalid or expired token"}),{status:401,headers:{"Content-Type":"application/json","WWW-Authenticate":'Bearer error="invalid_token", error_description="Invalid or expired token"',"Access-Control-Allow-Origin":"*"}})}export{g as constructInvalidTokenResponse,_ as constructUnauthorizedResponse,O as handleMcpAuth,R as shouldHandleMcpAuth};
1
+ import{extractTokenFromAuthHeader as u}from"../../../plugins/mcp/utils/jwt.js";import{getUserParamsFromCookies as d}from"../../../web-server/auth.js";import{ServerRoutes as l}from"../../../../constants/api.js";import{DEFAULT_ANONYMOUS_VISITOR_TEAM as a,RBAC_ALL_OTHER_TEAMS as c,RbacFeatures as f}from"../../../../constants/common.js";import{withPathPrefix as p}from"@redocly/theme/core/utils";function i(e){return!e||typeof e!="object"||Object.keys(e).length===0?!1:!(e[a]&&e[a]!=="none"||e[c]&&e[c]!=="none")}function h(e,t){if(!t||Object.keys(t).length===0)return e;const r=t.content;if(r&&Object.keys(r).length>0&&Object.values(r).some(i))return!0;const s=t.teamFoldersBaseRoles;if(i(s))return!0;const o=t.features;return i(o?.[f.MCP])?!0:e}function g(e){const t=e.getConfig().access;return h(!!t?.requiresLogin,t?.rbac||{})}async function C(e,t){const r=e.headers.get("Authorization");if(!r)return{isAuthenticated:!1};const s=u(r),o=t?.config?.ssoDirect||{},n=s?await d(o,{authorization:s}):{};return s&&n&&n.isAuthenticated?{isAuthenticated:!0,isTokenValid:!0,currentUser:{teams:n.teams||[],email:n.email||"",claims:n,isAuthenticated:!0,idpAccessToken:n.idpAccessToken||void 0,idpId:n.idpId||void 0},accessToken:s}:{isAuthenticated:!1,isTokenValid:!1}}function _(e){return e=e.replace(/^http:\/\//,"https://"),new Response(JSON.stringify({error:"unauthorized",message:"Authentication required"}),{status:401,headers:{"Content-Type":"application/json","WWW-Authenticate":`Bearer resource_metadata="${e}${l.MCP_OAUTH_PROTECTED_RESOURCE}${p("/mcp")}"`,"Access-Control-Allow-Origin":"*"}})}function y(){return new Response(JSON.stringify({error:"forbidden",message:"You do not have access to this MCP server"}),{status:403,headers:{"Content-Type":"application/json","Access-Control-Allow-Origin":"*"}})}function x(){return new Response(JSON.stringify({error:"invalid_token",message:"Invalid or expired token"}),{status:401,headers:{"Content-Type":"application/json","WWW-Authenticate":'Bearer error="invalid_token", error_description="Invalid or expired token"',"Access-Control-Allow-Origin":"*"}})}export{y as constructForbiddenResponse,x as constructInvalidTokenResponse,_ as constructUnauthorizedResponse,C as handleMcpAuth,g as isMcpContentProtected,h as shouldHandleMcpAuth};
@@ -1,4 +1,4 @@
1
- import type { ToolAnnotations } from '@redocly/mcp-typescript-sdk/types.js';
1
+ import type { ToolAnnotations } from '@modelcontextprotocol/server';
2
2
  import type { McpToolContext } from '../../types.js';
3
3
  /** A capability is a per-request-gated global the code-mode sandbox exposes beyond the schema-driven `tools.*` surface. */
4
4
  export type SandboxCapability = {
@@ -1,4 +1,4 @@
1
- import type { ToolAnnotations } from '@redocly/mcp-typescript-sdk/types.js';
1
+ import type { ToolAnnotations } from '@modelcontextprotocol/server';
2
2
  import type { McpToolSchema } from '../../../../types';
3
3
  import type { McpToolContext } from '../../types.js';
4
4
  import type { SandboxCapability } from './types.js';
@@ -0,0 +1,12 @@
1
+ export type CodeAudit = {
2
+ sha256: string;
3
+ length: number;
4
+ flags: string;
5
+ };
6
+ /**
7
+ * Fingerprint model-supplied code for the audit trail. The body itself is never reported — it can
8
+ * contain data the model already pulled from a customer API — so callers get a hash plus flags for
9
+ * patterns worth reviewing. The sandbox blocks all of the flagged targets; a flag is an attempt.
10
+ */
11
+ export declare function auditCode(code: string): CodeAudit;
12
+ //# sourceMappingURL=code-audit.d.ts.map
@@ -0,0 +1 @@
1
+ import{createHash as e}from"node:crypto";const n=/(169\.254\.169\.254|metadata\.google\.internal|\.consul\b|\.internal\b|localhost|127\.0\.0\.1|\b10\.\d{1,3}\.\d{1,3}\.\d{1,3}\b|\b192\.168\.\d{1,3}\.\d{1,3}\b|\b172\.(?:1[6-9]|2\d|3[01])\.\d{1,3}\.\d{1,3}\b)/i,a=/(process\s*(?:\.\s*env\b|\[)|globalThis|require\s*\(|__proto__)/;function r(t){const s=[];return a.test(t)&&s.push("env_probe"),n.test(t)&&s.push("internal_target"),{sha256:e("sha256").update(t,"utf8").digest("hex"),length:t.length,flags:s.sort().join(",")}}export{r as auditCode};
@@ -0,0 +1,11 @@
1
+ import type { CodeAudit } from './code-audit.js';
2
+ type CodeExecutedEvent = {
3
+ audit: CodeAudit;
4
+ fetchCount: number;
5
+ outcome: 'ok' | 'error';
6
+ durationMs: number;
7
+ };
8
+ /** Audit record for one sandbox run. Carries the code fingerprint, never the code. */
9
+ export declare function reportCodeExecuted({ audit, fetchCount, outcome, durationMs, }: CodeExecutedEvent): void;
10
+ export {};
11
+ //# sourceMappingURL=code-execution-telemetry.d.ts.map
@@ -0,0 +1 @@
1
+ import{telemetry as c}from"../../../telemetry/index.js";import{logger as s}from"../../../tools/notifiers/logger.js";import{McpServerType as f}from"../constants.js";import{serverAttributes as g}from"../utils/telemetry-attributes.js";function p({audit:e,fetchCount:o,outcome:r,durationMs:t}){try{c.sendMcpCodeExecutedMessage([{...g(f.Docs),code_sha256:e.sha256,code_length:e.length,fetch_count:o,outcome:r,flags:e.flags,duration_ms:t}])}catch{}s.info(`Gateway MCP code executed [${e.sha256.slice(0,12)}] outcome=${r} codeLength=${e.length} fetchCount=${o}`+(e.flags?` flags=${e.flags}`:"")+` durationMs=${t}`)}export{p as reportCodeExecuted};
@@ -2,4 +2,7 @@ export declare const EXECUTE_TOOL_NAME = "execute";
2
2
  export declare const DESCRIBE_TOOLS_TOOL_NAME = "describe-tools";
3
3
  export declare const FETCH_TOOL_NAME = "fetch";
4
4
  export declare const CODE_MODE_TOOL_NAMES: ReadonlySet<string>;
5
+ export declare const TOOLS_BRIDGE_GLOBAL_NAME = "tools";
6
+ export declare const FETCH_BRIDGE_GLOBAL_NAME = "__fetchBridge";
7
+ export declare const FETCH_BRIDGE_FUNCTION_NAME = "fetch";
5
8
  //# sourceMappingURL=constants.d.ts.map
@@ -1 +1 @@
1
- const e="execute",t="describe-tools",E="fetch",O=new Set([e,t]);export{O as CODE_MODE_TOOL_NAMES,t as DESCRIBE_TOOLS_TOOL_NAME,e as EXECUTE_TOOL_NAME,E as FETCH_TOOL_NAME};
1
+ import{CREATE_ANONYMOUS_SESSION_TOOL_NAME as _}from"../constants.js";const E="execute",t="describe-tools",o="fetch",e=new Set([E,t,_]),N="tools",T="__fetchBridge",c="fetch";export{e as CODE_MODE_TOOL_NAMES,t as DESCRIBE_TOOLS_TOOL_NAME,E as EXECUTE_TOOL_NAME,c as FETCH_BRIDGE_FUNCTION_NAME,T as FETCH_BRIDGE_GLOBAL_NAME,o as FETCH_TOOL_NAME,N as TOOLS_BRIDGE_GLOBAL_NAME};
@@ -1,4 +1,4 @@
1
- const t="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).";function o(e){return["Run JavaScript in a sandbox against the documentation tools on the global `tools` object.",e?"The only extra globals are `tools` and `fetch` - 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 (every tool name is listed in the `describe-tools` input schema / description).","2. Call `describe-tools` with those names to get their exact TypeScript signatures. NEVER call `execute` with guessed method names, parameter names, or enum values.","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.","",...e?["Example - list the Billing API endpoints and call one of them:","","```ts","const { items } = await tools.listApis({ filter: 'billing' });","const { endpoints } = await tools.getEndpoints({ name: items[0].name });","const ep = endpoints.find((e) => e.method === 'POST' && e.path.includes('invoices'));","const info = await tools.getEndpointInfo({ name: items[0].name, path: ep.path, method: ep.method });","const url = (info.servers?.[0]?.url ?? '') + ep.path;","try {"," const res = await fetch(url, { method: 'POST', body: JSON.stringify({ /* fields from info */ }) });"," return res.ok ? await res.json() : { status: res.status, error: await res.text() };","} catch (error) {"," return { error: error instanceof Error ? error.message : String(error), endpointId: info };","}","```"]:["Example - list the write endpoints of an API:","","```ts","const { items } = await tools.listApis({ filter: 'billing' });","const { endpoints } = await tools.getEndpoints({ name: items[0].name });","const writes = endpoints.filter((e) => e.method !== 'GET');","return { api: items[0].name, writes: writes.map((e) => `${e.method} ${e.path}`) };","```"]].join(`
1
+ const t="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).";function o(e){return["Run JavaScript in a sandbox against the documentation tools on the global `tools` object.",e?"The only extra globals are `tools` and `fetch` - 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 (every tool name is listed in the `describe-tools` input schema / description).","2. Call `describe-tools` with those names to get their exact TypeScript signatures - inputs AND result shapes. 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.","",...e?["Example - list the Billing API endpoints and call one of them:","","```ts","const { items } = await tools.listApis({ filter: 'billing' });","const { endpoints } = await tools.getEndpoints({ name: items[0].name });","const ep = endpoints.find((e) => e.method === 'POST' && e.path.includes('invoices'));","const info = await tools.getEndpointInfo({ name: items[0].name, path: ep.path, method: ep.method });","const url = (info.servers?.[0]?.url ?? '') + ep.path;","try {"," const res = await fetch(url, { method: 'POST', body: JSON.stringify({ /* fields from info */ }) });"," return res.ok ? await res.json() : { status: res.status, error: await res.text() };","} catch (error) {"," return { error: error instanceof Error ? error.message : String(error), endpointId: info };","}","```"]:["Example - list the write endpoints of an API:","","```ts","const { items } = await tools.listApis({ filter: 'billing' });","const { endpoints } = await tools.getEndpoints({ name: items[0].name });","const writes = endpoints.filter((e) => e.method !== 'GET');","return { api: items[0].name, writes: writes.map((e) => `${e.method} ${e.path}`) };","```"]].join(`
2
2
  `)}const s=["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(`
3
3
  `);function n(e){return["This server exposes documentation tools (API discovery, endpoint details, security schemes, full-text search) through two tools:","- `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 only the tool 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(`
4
4
  `)}const i="Types named `OpenApi\u2026` are the standard OpenAPI Specification objects.";export{s as DESCRIBE_TOOLS_DESCRIPTION,t as EXECUTE_ARGS_NOTE,i as USAGE_NOTES,n as buildCodeModeInstructions,o as buildExecuteDescription};
@@ -0,0 +1,10 @@
1
+ import type { SetupSandboxContext } from '../../../../sandbox/types.js';
2
+ import type { SandboxFetch, SandboxTool } from '../types.js';
3
+ /**
4
+ * Builds the `setupContext` that shapes the shared sandbox (`~/server/sandbox`) for code
5
+ * mode: the given tools — and, when provided, host fetch — become host-function rails, each
6
+ * capped and bound by the run's budget, and the prelude installs the code-mode guest surface
7
+ * over them.
8
+ */
9
+ export declare function createSandboxSetup(tools: Record<string, SandboxTool>, hostFetch?: SandboxFetch): SetupSandboxContext;
10
+ //# sourceMappingURL=create-sandbox-setup.d.ts.map
@@ -0,0 +1,11 @@
1
+ import{setupHostFunctions as a}from"../../../../sandbox/utils/setup-host-functions.js";import{evalGuestCode as p}from"../../../../sandbox/utils/eval-guest-code.js";import{SANDBOX_FETCH_SETUP as i}from"./polyfills.js";import{FETCH_BRIDGE_FUNCTION_NAME as u,FETCH_BRIDGE_GLOBAL_NAME as c,TOOLS_BRIDGE_GLOBAL_NAME as n}from"../constants.js";const m=100,f=50;function T(r,t){return(e,l)=>{const s=[a(e,r,{globalName:n,budget:l,maxCalls:m,messages:{outputTooLarge:o=>`Tool output is too large (${o} bytes); request narrower data instead`,callLimitExceeded:o=>`Exceeded the limit of ${o} tool calls`}})];return t&&s.push(a(e,{[u]:o=>t(o)},{globalName:c,budget:l,maxCalls:f,messages:{outputTooLarge:o=>`Response is too large (${o} bytes); request less data`,callLimitExceeded:o=>`Exceeded the limit of ${o} fetch calls`}})),p(e,E(!!t)),()=>{for(const o of s)o()}}}function E(r){const t=r?i:"",e=`globalThis[${JSON.stringify(n)}]`;return`(() => {${t}
2
+ const tools = ${e};
3
+ ${e} = new Proxy(tools, {
4
+ get(target, prop) {
5
+ if (typeof prop !== 'string' || prop in target || prop === 'then' || prop === 'toJSON') {
6
+ return target[prop];
7
+ }
8
+ throw new TypeError('Unknown tool "' + prop + '". Available tools: ' + Object.keys(target).join(', '));
9
+ },
10
+ });
11
+ })();`}export{T as createSandboxSetup};
@@ -0,0 +1,2 @@
1
+ export declare const SANDBOX_FETCH_SETUP = "\n const URLSearchParams = class URLSearchParams {\n constructor(init) {\n this._params = [];\n if (typeof init === 'string') {\n const str = init.startsWith('?') ? init.slice(1) : init;\n for (const pair of (str ? str.split('&') : [])) {\n const eq = pair.indexOf('=');\n const k = eq >= 0 ? pair.slice(0, eq) : pair;\n const v = eq >= 0 ? pair.slice(eq + 1) : '';\n if (k) this._params.push([decodeURIComponent(k), decodeURIComponent(v)]);\n }\n } else if (init != null && typeof init === 'object') {\n for (const [k, v] of Object.entries(init)) this._params.push([k, String(v)]);\n }\n }\n append(key, value) { this._params.push([String(key), String(value)]); }\n set(key, value) {\n const k = String(key), v = String(value);\n this._params = this._params.filter(([pk]) => pk !== k);\n this._params.push([k, v]);\n }\n get(key) { return (this._params.find(([k]) => k === String(key)) ?? [undefined, null])[1]; }\n getAll(key) { return this._params.filter(([k]) => k === String(key)).map(([, v]) => v); }\n has(key) { return this._params.some(([k]) => k === String(key)); }\n delete(key) { this._params = this._params.filter(([k]) => k !== String(key)); }\n entries() { return this._params.values(); }\n [Symbol.iterator]() { return this._params.values(); }\n toString() {\n return this._params\n .map(([k, v]) => encodeURIComponent(k) + '=' + encodeURIComponent(v))\n .join('&');\n }\n };\n globalThis.URLSearchParams = URLSearchParams;\n\n const FormData = class FormData {\n constructor() { this._fields = []; }\n append(key, value) { this._fields.push([String(key), String(value)]); }\n set(key, value) {\n const k = String(key), v = String(value);\n this._fields = this._fields.filter(([fk]) => fk !== k);\n this._fields.push([k, v]);\n }\n get(key) { return (this._fields.find(([k]) => k === String(key)) ?? [undefined, null])[1]; }\n has(key) { return this._fields.some(([k]) => k === String(key)); }\n delete(key) { this._fields = this._fields.filter(([k]) => k !== String(key)); }\n entries() { return this._fields.values(); }\n [Symbol.iterator]() { return this._fields.values(); }\n };\n globalThis.FormData = FormData;\n\n const hostFetch = globalThis.__fetchBridge.fetch;\n delete globalThis.__fetchBridge;\n globalThis.fetch = (url, init = {}) => {\n let body;\n let autoContentType;\n if (init.body instanceof URLSearchParams) {\n body = init.body.toString();\n autoContentType = 'application/x-www-form-urlencoded';\n } else if (init.body instanceof FormData) {\n const boundary = '----FormBoundary' + Math.random().toString(36).slice(2);\n body = init.body._fields\n .map(([k, v]) =>\n '--' + boundary + '\\r\\nContent-Disposition: form-data; name=\"' + k + '\"\\r\\n\\r\\n' + v,\n )\n .join('\\r\\n') + '\\r\\n--' + boundary + '--';\n autoContentType = 'multipart/form-data; boundary=' + boundary;\n } else if (init.body != null && typeof init.body !== 'string') {\n throw new TypeError('fetch body must be a string, URLSearchParams, or FormData');\n } else {\n body = init.body ?? undefined;\n }\n const callerHeaders = init.headers;\n const hasContentType = callerHeaders != null && Object.keys(callerHeaders).some(\n (k) => k.toLowerCase() === 'content-type',\n );\n const headers = autoContentType && !hasContentType\n ? Object.assign({ 'content-type': autoContentType }, callerHeaders)\n : callerHeaders;\n return hostFetch({ url: String(url), method: init.method, headers, body })\n .then((res) => {\n const resHeaders = res.headers || {};\n return {\n status: res.status,\n statusText: res.statusText,\n ok: res.ok,\n headers: {\n get: (name) => {\n const value = resHeaders[String(name).toLowerCase()];\n return value === undefined ? null : value;\n },\n },\n json: () => Promise.resolve(JSON.parse(res.bodyText)),\n text: () => Promise.resolve(res.bodyText),\n };\n });\n };\n";
2
+ //# sourceMappingURL=polyfills.d.ts.map
@@ -1,4 +1,4 @@
1
- const e=`
1
+ import{FETCH_BRIDGE_FUNCTION_NAME as t,FETCH_BRIDGE_GLOBAL_NAME as e}from"../constants.js";const s=`
2
2
  const URLSearchParams = class URLSearchParams {
3
3
  constructor(init) {
4
4
  this._params = [];
@@ -49,9 +49,9 @@ const e=`
49
49
  [Symbol.iterator]() { return this._fields.values(); }
50
50
  };
51
51
  globalThis.FormData = FormData;
52
- `,t=`
53
- const hostFetch = globalThis.__fetch;
54
- delete globalThis.__fetch;
52
+ `,r=`
53
+ const hostFetch = globalThis.${e}.${t};
54
+ delete globalThis.${e};
55
55
  globalThis.fetch = (url, init = {}) => {
56
56
  let body;
57
57
  let autoContentType;
@@ -78,9 +78,8 @@ const e=`
78
78
  const headers = autoContentType && !hasContentType
79
79
  ? Object.assign({ 'content-type': autoContentType }, callerHeaders)
80
80
  : callerHeaders;
81
- return hostFetch(JSON.stringify({ url: String(url), method: init.method, headers, body }))
82
- .then((json) => {
83
- const res = JSON.parse(json);
81
+ return hostFetch({ url: String(url), method: init.method, headers, body })
82
+ .then((res) => {
84
83
  const resHeaders = res.headers || {};
85
84
  return {
86
85
  status: res.status,
@@ -97,4 +96,4 @@ const e=`
97
96
  };
98
97
  });
99
98
  };
100
- `;export{t as SANDBOX_FETCH_SETUP,e as SANDBOX_POLYFILLS};
99
+ `,i=`${s}${r}`;export{i as SANDBOX_FETCH_SETUP};
@@ -1,7 +1,6 @@
1
- import type { ToolCallback } from '@redocly/mcp-typescript-sdk/server/mcp.js';
2
1
  import type { McpToolSchema } from '../../../../types';
3
- import type { McpToolContext } from '../../types.js';
2
+ import type { McpToolCallback, McpToolContext } from '../../types.js';
4
3
  import { type SandboxCapability } from '../capabilities/index.js';
5
4
  export declare function describeToolsSchema(tools: McpToolSchema[], capabilities: SandboxCapability[]): Record<string, unknown>;
6
- export declare function describeTools(tools: McpToolSchema[], isToolAvailable: (toolName: string) => Promise<boolean>, capabilities: SandboxCapability[], context: McpToolContext): ToolCallback<Record<string, unknown>>;
5
+ export declare function describeTools(tools: McpToolSchema[], isToolAvailable: (toolName: string) => Promise<boolean>, capabilities: SandboxCapability[], context: McpToolContext): McpToolCallback;
7
6
  //# sourceMappingURL=describe-tools.d.ts.map
@@ -1,4 +1,4 @@
1
- import type { ToolAnnotations } from '@redocly/mcp-typescript-sdk/types.js';
1
+ import type { ToolAnnotations } from '@modelcontextprotocol/server';
2
2
  import type { McpToolSchema } from '../../../../types';
3
3
  export declare const EXECUTE_BASE_ANNOTATIONS: ToolAnnotations;
4
4
  export declare const EXECUTE_TOOL_SCHEMA: McpToolSchema;
@@ -1 +1 @@
1
- import{EXECUTE_TOOL_NAME as e}from"../constants.js";import{buildExecuteDescription as t}from"../prompts.js";const i={title:"Execute code",readOnlyHint:!0,openWorldHint:!1},n={name:e,description:t(!1),annotations:i,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}}}};export{i as EXECUTE_BASE_ANNOTATIONS,n as EXECUTE_TOOL_SCHEMA};
1
+ import{EXECUTE_TOOL_NAME as e}from"../constants.js";import{buildExecuteDescription as t}from"../prompts.js";const n={title:"Execute code",readOnlyHint:!0,openWorldHint:!1},r={name:e,description:t(!1),annotations:n,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}}}};export{n as EXECUTE_BASE_ANNOTATIONS,r as EXECUTE_TOOL_SCHEMA};
@@ -3,6 +3,7 @@ declare const _default: {
3
3
  execute: McpToolHandler<{
4
4
  code: string;
5
5
  description: string;
6
+ sessionHandle?: string;
6
7
  }>;
7
8
  };
8
9
  export default _default;
@@ -1 +1 @@
1
- import{mcpToolHandlers as a}from"../../../../../client/mcp-tool-handlers-entry.js";import{isMcpToolAvailable as l}from"../../workers/execute-mcp-tool.js";import{buildExecuteHostFetch as c,isFetchCapable as m}from"../../gateway-mcp/fetch-capability.js";import{CODE_MODE_TOOL_NAMES as f,EXECUTE_TOOL_NAME as p}from"../constants.js";import{sanitizeToolName as u}from"../build-tool-type-declarations.js";import{invokeTool as d}from"../invoke-tool.js";import{runInSandbox as T}from"../sandbox/sandbox.js";const b=async(e,t,i)=>{const o=await E(t,i),s=m(t)?{hostFetch:c(t)}:{},{result:r,error:n}=await T(e.code,o,s);return{content:[{type:"text",text:JSON.stringify({result:r,error:n})}],isError:n!==void 0}};async function E(e,t){const i={};for(const o of Object.keys(a))f.has(o)||!await l({toolName:o,context:e}).catch(()=>!1)||(i[u(o)]=r=>d(o,r,e,t));return i}var M={[p]:b};export{M as default};
1
+ import{mcpToolHandlers as l}from"../../../../../client/mcp-tool-handlers-entry.js";import{runInSandbox as p}from"../../../../sandbox/sandbox.js";import{isMcpToolAvailable as h}from"../../workers/execute-mcp-tool.js";import{buildExecuteHostFetch as b,isFetchCapable as E}from"../../gateway-mcp/fetch-capability.js";import{withAuthRequiredMeta as T}from"../../gateway-mcp/upstream-auth.js";import{CODE_MODE_TOOL_NAMES as O,EXECUTE_TOOL_NAME as A}from"../constants.js";import{sanitizeToolName as C}from"../build-tool-type-declarations.js";import{invokeTool as w}from"../invoke-tool.js";import{createSandboxSetup as x}from"../sandbox/create-sandbox-setup.js";import{auditCode as M}from"../code-audit.js";import{reportCodeExecuted as v}from"../code-execution-telemetry.js";const y=async(t,e,r)=>{const o=await N(e,r),n=[],i=E(e)?b(e,s=>n.push(s)):void 0;let c=0;const u=i?s=>(c+=1,i(s)):void 0,d=M(t.code),m=Date.now(),{result:f,error:a}=await p(t.code,{setupContext:x(o,u)});return v({audit:d,fetchCount:c,outcome:a===void 0?"ok":"error",durationMs:Date.now()-m}),T({content:[{type:"text",text:JSON.stringify({result:f,error:a})}],isError:a!==void 0},n)};async function N(t,e){const r={};for(const o of Object.keys(l))O.has(o)||!await h({toolName:o,context:t}).catch(()=>!1)||(r[C(o)]=i=>w(o,i,t,e));return r}var B={[A]:y};export{B as default};
@@ -13,12 +13,4 @@ export type SandboxFetchResponse = {
13
13
  bodyText: string;
14
14
  };
15
15
  export type SandboxFetch = (request: SandboxFetchRequest) => Promise<SandboxFetchResponse>;
16
- export type SandboxResult = {
17
- result?: unknown;
18
- error?: string;
19
- };
20
- export type RunInSandboxOptions = {
21
- timeoutMs?: number;
22
- hostFetch?: SandboxFetch;
23
- };
24
16
  //# sourceMappingURL=types.d.ts.map
@@ -8,10 +8,11 @@ export declare const McpErrorCodes: {
8
8
  readonly MethodNotFound: -32601;
9
9
  readonly InvalidParams: -32602;
10
10
  };
11
- export declare const MCP_PROTOCOL_VERSION = "2025-06-18";
11
+ export declare const MCP_PROTOCOL_VERSION = "2025-11-25";
12
12
  export declare const DEFAULT_CONNECTION_TIMEOUT_MS = 30000;
13
13
  export declare const SSE_KEEPALIVE_INTERVAL_MS = 15000;
14
14
  export declare const MAX_DOCUMENTS_PER_CATEGORY = 3;
15
15
  export declare const MCP_NOT_ALLOWED_TEMPLATE_ID = "mcp-not-allowed";
16
16
  export declare const DEFAULT_DOCS_MCP_SERVER_NAME = "Docs MCP server";
17
+ export declare const CREATE_ANONYMOUS_SESSION_TOOL_NAME = "createAnonymousSession";
17
18
  //# sourceMappingURL=constants.d.ts.map
@@ -1 +1 @@
1
- const o={Docs:"docs"},r={InternalError:-32603,ServerError:-32e3,InvalidRequest:-32600,MethodNotFound:-32601,InvalidParams:-32602},E="2025-06-18",e=3e4,t=15e3,_=3,s="mcp-not-allowed",c="Docs MCP server";export{e as DEFAULT_CONNECTION_TIMEOUT_MS,c as DEFAULT_DOCS_MCP_SERVER_NAME,_ as MAX_DOCUMENTS_PER_CATEGORY,s as MCP_NOT_ALLOWED_TEMPLATE_ID,E as MCP_PROTOCOL_VERSION,r as McpErrorCodes,o as McpServerType,t as SSE_KEEPALIVE_INTERVAL_MS};
1
+ import{LATEST_PROTOCOL_VERSION as o}from"@modelcontextprotocol/server";const E={Docs:"docs"},e={InternalError:-32603,ServerError:-32e3,InvalidRequest:-32600,MethodNotFound:-32601,InvalidParams:-32602},t=o,_=3e4,O=15e3,s=3,n="mcp-not-allowed",T="Docs MCP server",S="createAnonymousSession";export{S as CREATE_ANONYMOUS_SESSION_TOOL_NAME,_ as DEFAULT_CONNECTION_TIMEOUT_MS,T as DEFAULT_DOCS_MCP_SERVER_NAME,s as MAX_DOCUMENTS_PER_CATEGORY,n as MCP_NOT_ALLOWED_TEMPLATE_ID,t as MCP_PROTOCOL_VERSION,e as McpErrorCodes,E as McpServerType,O as SSE_KEEPALIVE_INTERVAL_MS};
@@ -5,5 +5,6 @@ export declare function getDefaultToolSchemas(config: {
5
5
  requiresLogin: boolean;
6
6
  rbac?: Record<string, unknown>;
7
7
  hasGraphqlApis?: boolean;
8
+ elicitationEnabled?: boolean;
8
9
  }): McpToolSchema[];
9
10
  //# sourceMappingURL=tool-schemas.d.ts.map
@@ -1 +1 @@
1
- import{shouldHandleMcpAuth as m}from"../auth/auth-handlers.js";import{GRAPHQL_TYPE_KINDS as o}from"./tools/graphql/types.js";const p=["GET","POST","PUT","DELETE","PATCH","OPTIONS","HEAD","TRACE"],t={type:"string",nullable:!0},n={limit:{type:"number"},total:{type:"number"},page:{type:"number"},totalPages:{type:"number"}},r={codemodeType:"OpenApiServer[]"},s={codemodeType:"OpenApiSecurityRequirement[]"},l={codemodeType:"Record<string, OpenApiSecurityScheme>"},d={codemodeType:"OpenApiDocument"},h={codemodeType:"OpenApiOperation & { path: string; method: string }"},y={type:"object",additionalProperties:!1,required:[],properties:{filter:{type:"string",description:"API 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 APIs per page. Default is 300",minimum:1,default:300,nullable:!0}}},a={type:"object",required:["name"],additionalProperties:!1,properties:{name:{type:"string",description:"API name",minLength:1},version:{type:"string",description:"API version (required when multiple APIs share the same name but differ by version)",nullable:!0}}},g={type:"object",required:["name","path","method"],additionalProperties:!1,properties:{name:{type:"string",description:"API name",minLength:1},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:[...p,...p.map(e=>e.toLowerCase())],minLength:1},version:{type:"string",description:"API version (required when multiple APIs share the same name but differ by version)",nullable:!0}}},f={type:"object",required:[],additionalProperties:!1,properties:{}};function q(e){const i=[{name:"list-apis",description:"Lists available APIs with their context and purpose",schema:y,annotations:{title:"List APIs",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},outputSchema:{type:"object",properties:{items:{type:"array",items:{type:"object",properties:{name:{type:"string"},description:t,version:t,servers:r}}},...n}}},{name:"get-endpoints",description:"Get all endpoints for a specific API",schema:a,annotations:{title:"Get Endpoints",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},outputSchema:{type:"object",properties:{api:{type:"string"},version:{type:"string"},servers:r,endpoints:{type:"array",items:{type:"object",properties:{path:{type:"string"},method:{type:"string"},summary:t,description:t,security:s}}}}}},{name:"get-endpoint-info",description:"Get comprehensive information about specific endpoint including parameters, security, and examples",schema:g,annotations:{title:"Get Endpoint Info",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},outputSchema:{type:"object",properties:{api:{type:"string"},version:{type:"string"},servers:r,endpoint:h,globalSecurity:s,securitySchemes:l}}},{name:"get-security-schemes",description:"Get the security schemes for a specific API",schema:a,annotations:{title:"Get Security Schemes",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},outputSchema:{type:"object",properties:{name:t,version:t,securitySchemes:l,security:s}}},{name:"get-full-api-description",description:"Get the complete OpenAPI description",schema:a,annotations:{title:"Get Full API Description",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},outputSchema:{type:"object",properties:{api:{type:"string"},version:{type:"string"},definition:d}}},P(e.products,e.locales)];return m(e.requiresLogin,e.rbac)&&i.push({name:"whoami",description:"Get information about the currently authenticated user",schema:f,annotations:{title:"Who Am I",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},outputSchema:{type:"object",properties:{email:{type:"string"},name:{type:"string"},subject:{type:"string"},clientId:{type:"string"},scope:{type:"string"},issuedAt:{type:"string"},expiresAt:{type:"string"}}}}),e.hasGraphqlApis&&i.push(...L()),i}const b={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}}},S={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",enum:[...o],nullable:!0},filter:{type:"string",description:'Optional: only members whose name contains this substring (e.g. "book")',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}}},H={type:"object",required:["name","type"],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},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}}},v={type:"object",required:["name"],additionalProperties:!1,properties:{name:{type:"string",description:"GraphQL schema name",minLength:1}}};function L(){return[{name:"list-graphql-apis",description:"Lists available GraphQL schemas with their context and purpose",schema:b,annotations:{title:"List GraphQL APIs",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},outputSchema:{type:"object",properties:{items:{type:"array",items:{type:"object",properties:{name:{type:"string"},description:t}}},...n}}},{name:"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` (member-name substring, 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.',schema:S,annotations:{title:"Get GraphQL Type List",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},outputSchema:{type:"object",properties:{name:{type:"string"},items:{type:"array",items:{type:"object",properties:{kind:{type:"string",enum:o},name:{type:"string"},description:t,type:{type:"string"},args:{type:"string"}}}},...n}}},{name:"get-graphql-type",description:"Get the SDL for a single GraphQL type, operation (query/mutation/subscription field), or directive. Set includeReferencedTypes to also pull in every type it references transitively \u2014 the full 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:H,annotations:{title:"Get GraphQL Type",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},outputSchema:{type:"string"}},{name:"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:v,annotations:{title:"Get GraphQL Schema",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},outputSchema:{type:"string"}}]}function P(e,i){const c=e&&e.length>0,u=i&&i.length>0;return{name:"search",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},...c?{product:{type:"string",description:"Optional product name to filter search results by specific product.",enum:e,nullable:!0}}:{},...u?{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,nullable:!0}}:{}}},annotations:{title:"Search Documentation",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!1,openWorldHint:!1},outputSchema:{type:"string"}}}export{q as getDefaultToolSchemas};
1
+ import{shouldHandleMcpAuth as d}from"../auth/auth-handlers.js";import{CREATE_ANONYMOUS_SESSION_TOOL_NAME as m}from"../constants.js";import{GRAPHQL_TYPE_KINDS as o,GRAPHQL_LIST_SCOPES as h}from"./tools/graphql/constants.js";import{OPERATION_METHODS as p}from"./tools/openapi/constants.js";const i={type:"string",nullable:!0},n={limit:{type:"number"},total:{type:"number"},page:{type:"number"},totalPages:{type:"number"}},r={codemodeType:"OpenApiServer[]"},s={codemodeType:"OpenApiSecurityRequirement[]"},l={codemodeType:"Record<string, OpenApiSecurityScheme>"},y={codemodeType:"OpenApiDocument"},f={codemodeType:"OpenApiOperation & { path: string; method: string }"},g={type:"object",additionalProperties:!1,required:[],properties:{filter:{type:"string",description:"API 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 APIs per page. Default is 300",minimum:1,default:300,nullable:!0}}},a={type:"object",required:["name"],additionalProperties:!1,properties:{name:{type:"string",description:"API name",minLength:1},version:{type:"string",description:"API version",nullable:!0},filePath:{type:"string",description:"API definition file path",nullable:!0}}},b={type:"object",required:["name","path","method"],additionalProperties:!1,properties:{name:{type:"string",description:"API name",minLength:1},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:[...p.map(e=>e.toUpperCase()),...p],minLength:1},version:{type:"string",description:"API version (required when multiple APIs share the same name but differ by version)",nullable:!0},filePath:{type:"string",description:"API definition file path",nullable:!0}}},S={type:"object",required:[],additionalProperties:!1,properties:{}},v={type:"object",required:[],additionalProperties:!1,properties:{}};function I(e){const t=[{name:"list-apis",description:"Lists available APIs with their context and purpose",schema:g,annotations:{title:"List APIs",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},outputSchema:{type:"object",properties:{items:{type:"array",items:{type:"object",properties:{name:{type:"string"},description:i,version:i,servers:r,filePath:{type:"string",description:"API definition file path"}}}},...n}}},{name:"get-endpoints",description:"Get all endpoints for a specific API",schema:a,annotations:{title:"Get Endpoints",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},outputSchema:{type:"object",properties:{api:{type:"string"},version:{type:"string"},servers:r,endpoints:{type:"array",items:{type:"object",properties:{path:{type:"string"},method:{type:"string"},summary:i,description:i,security:s}}}}}},{name:"get-endpoint-info",description:"Get comprehensive information about specific endpoint including parameters, security, and examples",schema:b,annotations:{title:"Get Endpoint Info",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},outputSchema:{type:"object",properties:{api:{type:"string"},version:{type:"string"},servers:r,endpoint:f,globalSecurity:s,securitySchemes:l}}},{name:"get-security-schemes",description:"Get the security schemes for a specific API",schema:a,annotations:{title:"Get Security Schemes",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},outputSchema:{type:"object",properties:{name:i,version:i,securitySchemes:l,security:s}}},{name:"get-full-api-description",description:"Get the complete OpenAPI description",schema:a,annotations:{title:"Get Full API Description",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},outputSchema:{type:"object",properties:{api:{type:"string"},version:{type:"string"},definition:y}}},G(e.products,e.locales)];return d(e.requiresLogin,e.rbac)&&t.push({name:"whoami",description:"Get information about the currently authenticated user",schema:S,annotations:{title:"Who Am I",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},outputSchema:{type:"object",properties:{email:{type:"string"},name:{type:"string"},subject:{type:"string"},clientId:{type:"string"},scope:{type:"string"},issuedAt:{type:"string"},expiresAt:{type:"string"}}}}),e.hasGraphqlApis&&t.push(...T()),e.elicitationEnabled&&t.push({name:m,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:v,annotations:{title:"Create anonymous session",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1,openWorldHint:!1},outputSchema:{type:"object",required:["sessionHandle"],properties:{sessionHandle:{type:"string"}}}}),t}const H={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}}},P={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:[...o],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:[...h],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}}},A={type:"object",required:["name","type"],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},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}}},L={type:"object",required:["name"],additionalProperties:!1,properties:{name:{type:"string",description:"GraphQL schema name",minLength:1}}};function T(){return[{name:"list-graphql-apis",description:"Lists available GraphQL schemas with their context and purpose",schema:H,annotations:{title:"List GraphQL APIs",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},outputSchema:{type:"object",properties:{items:{type:"array",items:{type:"object",properties:{name:{type:"string"},description:i}}},...n}}},{name:"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:P,annotations:{title:"Get GraphQL Type List",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},outputSchema:{type:"object",properties:{name:{type:"string"},items:{type:"array",items:{type:"object",properties:{kind:{type:"string",enum:o},name:{type:"string"},description:i,type:{type:"string"},args:{type:"string"},directives:{type:"string"}}}},...n}}},{name:"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:A,annotations:{title:"Get GraphQL Type",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},outputSchema:{type:"string"}},{name:"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:L,annotations:{title:"Get GraphQL Schema",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},outputSchema:{type:"string"}}]}function G(e,t){const c=e&&e.length>0,u=t&&t.length>0;return{name:"search",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},...c?{product:{type:"string",description:"Optional product name to filter search results by specific product.",enum:e,nullable:!0}}:{},...u?{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,nullable:!0}}:{}}},annotations:{title:"Search Documentation",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!1,openWorldHint:!1},outputSchema:{type:"string"}}}export{I as getDefaultToolSchemas};
@@ -0,0 +1,11 @@
1
+ import type { McpToolContext, McpToolHandler } from '../../../types.js';
2
+ export type CreateAnonymousSessionArgs = Record<string, never>;
3
+ export declare function isAnonymousSessionToolAvailable(context: McpToolContext): boolean;
4
+ declare const _default: {
5
+ createAnonymousSession: {
6
+ execute: McpToolHandler<CreateAnonymousSessionArgs>;
7
+ isAvailable: typeof isAnonymousSessionToolAvailable;
8
+ };
9
+ };
10
+ export default _default;
11
+ //# sourceMappingURL=create-anonymous-session.d.ts.map
@@ -0,0 +1 @@
1
+ import{CREATE_ANONYMOUS_SESSION_TOOL_NAME as t}from"../../../constants.js";import{createSessionHandle as n}from"../../../gateway-mcp/subject.js";const o=async()=>({content:[{type:"text",text:JSON.stringify({sessionHandle:n()})}],isError:!1});function i(e){return!!e.elicitationEnabled&&!e.user?.isAuthenticated}var a={[t]:{execute:o,isAvailable:i}};export{a as default,i as isAnonymousSessionToolAvailable};
@@ -0,0 +1,4 @@
1
+ export declare const GRAPHQL_TYPE_KINDS: readonly ['queries', 'mutations', 'subscriptions', 'objects', 'interfaces', 'unions', 'enums', 'inputs', 'scalars', 'directives'];
2
+ export declare const GRAPHQL_LIST_SCOPES: readonly ['members', 'fields'];
3
+ export declare const FIELD_SCOPE_KINDS: readonly ['objects', 'interfaces', 'inputs'];
4
+ //# sourceMappingURL=constants.d.ts.map